mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
Merge pull request #379 from feat/agent-orchestration into beta
feat(sessions): add permission modes, session goals, ocm session tool and multi-run Resolve the duplicate parseJsonBody added by both #380 and #379 into one helper: #379's result shape and allowEmpty option, with the first validation message as the error and the issues as details. Update the repo-git callers, affected route tests and the internal API docs.
This commit is contained in:
commit
8dec410c63
120 files changed
+10402
-219
No files matched your search
@@ -3,17 +3,34 @@ export const ASSISTANT_REPO_NAME = 'Assistant'
|
||||
export const ASSISTANT_REPO_PATH = 'assistant'
|
||||
export const ASSISTANT_OPENCODE_DIR_NAME = '.opencode'
|
||||
|
||||
export function buildSessionPath(
|
||||
repoId: number | string,
|
||||
sessionId: string,
|
||||
options?: { repoTab?: string },
|
||||
): string {
|
||||
const params = new URLSearchParams()
|
||||
if (String(repoId) === String(ASSISTANT_REPO_ID)) {
|
||||
params.set('assistant', '1')
|
||||
}
|
||||
if (options?.repoTab) {
|
||||
params.set('repoTab', options.repoTab)
|
||||
}
|
||||
const search = params.toString()
|
||||
|
||||
return `/repos/${repoId}/sessions/${sessionId}${search ? `?${search}` : ''}`
|
||||
}
|
||||
|
||||
function trimTrailingChar(value: string, char: string): string {
|
||||
let end = value.length
|
||||
while (end > 0 && value[end - 1] === char) end--
|
||||
return value.slice(0, end)
|
||||
}
|
||||
|
||||
export function sanitizeRepoDirectoryName(input: string): string {
|
||||
export function sanitizeRepoDirectoryName(input: string, fallback = 'repo'): string {
|
||||
const collapsed = input.trim().replace(/[^a-zA-Z0-9._-]+/g, '-').replace(/^-+/, '')
|
||||
const sanitized = trimTrailingChar(collapsed, '-')
|
||||
|
||||
return sanitized || 'repo'
|
||||
return sanitized || fallback
|
||||
}
|
||||
|
||||
export function getRepoDirectoryNameError(input: string): string | null {
|
||||
|
||||
Reference in new issue
Block a user