aicodeman 1.41.1 → 1.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -24
- package/dist/claude-session-title.d.ts +6 -4
- package/dist/claude-session-title.d.ts.map +1 -1
- package/dist/claude-session-title.js +6 -4
- package/dist/claude-session-title.js.map +1 -1
- package/dist/cli-agent.js +1 -1
- package/dist/cli-agent.js.map +1 -1
- package/dist/config/cli-registry/patterns.d.ts +1 -1
- package/dist/config/cli-registry/patterns.d.ts.map +1 -1
- package/dist/config/cli-registry/patterns.js +3 -0
- package/dist/config/cli-registry/patterns.js.map +1 -1
- package/dist/config/cli-registry/schema.d.ts +3 -0
- package/dist/config/cli-registry/schema.d.ts.map +1 -1
- package/dist/config/cli-registry/schema.js +19 -3
- package/dist/config/cli-registry/schema.js.map +1 -1
- package/dist/config/cli-registry/stock.d.ts.map +1 -1
- package/dist/config/cli-registry/stock.js +302 -7
- package/dist/config/cli-registry/stock.js.map +1 -1
- package/dist/config/cli-registry/types.d.ts +37 -3
- package/dist/config/cli-registry/types.d.ts.map +1 -1
- package/dist/git-worktrees.d.ts +292 -0
- package/dist/git-worktrees.d.ts.map +1 -0
- package/dist/git-worktrees.js +791 -0
- package/dist/git-worktrees.js.map +1 -0
- package/dist/hooks-config.d.ts +9 -0
- package/dist/hooks-config.d.ts.map +1 -1
- package/dist/hooks-config.js +12 -0
- package/dist/hooks-config.js.map +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +2 -1
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp-sync-targets.d.ts +6 -3
- package/dist/mcp-sync-targets.d.ts.map +1 -1
- package/dist/mcp-sync-targets.js +6 -3
- package/dist/mcp-sync-targets.js.map +1 -1
- package/dist/mux-interface.d.ts +7 -3
- package/dist/mux-interface.d.ts.map +1 -1
- package/dist/services/unified-session-service.d.ts +8 -0
- package/dist/services/unified-session-service.d.ts.map +1 -1
- package/dist/services/unified-session-service.js +21 -0
- package/dist/services/unified-session-service.js.map +1 -1
- package/dist/session-activity.d.ts +51 -0
- package/dist/session-activity.d.ts.map +1 -1
- package/dist/session-activity.js +62 -0
- package/dist/session-activity.js.map +1 -1
- package/dist/session-cli-registry-bridge.d.ts +2 -1
- package/dist/session-cli-registry-bridge.d.ts.map +1 -1
- package/dist/session-cli-registry-bridge.js.map +1 -1
- package/dist/session-submit-verifier.js +1 -1
- package/dist/session.d.ts +84 -9
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +232 -18
- package/dist/session.js.map +1 -1
- package/dist/tmux-manager.d.ts +62 -7
- package/dist/tmux-manager.d.ts.map +1 -1
- package/dist/tmux-manager.js +98 -20
- package/dist/tmux-manager.js.map +1 -1
- package/dist/types/session.d.ts +32 -4
- package/dist/types/session.d.ts.map +1 -1
- package/dist/types/session.js +2 -1
- package/dist/types/session.js.map +1 -1
- package/dist/utils/cli-installed-probes.d.ts +1 -1
- package/dist/utils/cli-installed-probes.d.ts.map +1 -1
- package/dist/utils/cli-installed-probes.js +4 -2
- package/dist/utils/cli-installed-probes.js.map +1 -1
- package/dist/utils/copilot-cli-resolver.d.ts +48 -0
- package/dist/utils/copilot-cli-resolver.d.ts.map +1 -0
- package/dist/utils/copilot-cli-resolver.js +112 -0
- package/dist/utils/copilot-cli-resolver.js.map +1 -0
- package/dist/utils/deepseek-cli-resolver.d.ts.map +1 -1
- package/dist/utils/deepseek-cli-resolver.js +1 -1
- package/dist/utils/deepseek-cli-resolver.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/web/approval-inbox.d.ts +12 -2
- package/dist/web/approval-inbox.d.ts.map +1 -1
- package/dist/web/approval-inbox.js +7 -2
- package/dist/web/approval-inbox.js.map +1 -1
- package/dist/web/case-path.d.ts +4 -2
- package/dist/web/case-path.d.ts.map +1 -1
- package/dist/web/case-path.js +13 -4
- package/dist/web/case-path.js.map +1 -1
- package/dist/web/public/admin-ui.js.gz +0 -0
- package/dist/web/public/api-client.c9b1cddc.js.gz +0 -0
- package/dist/web/public/app.ae50029a.js +43 -0
- package/dist/web/public/app.ae50029a.js.br +0 -0
- package/dist/web/public/app.ae50029a.js.gz +0 -0
- package/dist/web/public/approvals-ui.js.gz +0 -0
- package/dist/web/public/{constants.17d77b65.js → constants.e5e588db.js} +156 -2
- package/dist/web/public/constants.e5e588db.js.br +0 -0
- package/dist/web/public/constants.e5e588db.js.gz +0 -0
- package/dist/web/public/cron-ui.js.gz +0 -0
- package/dist/web/public/entrance-animations.js.gz +0 -0
- package/dist/web/public/git-status-ui.js.gz +0 -0
- package/dist/web/public/home-sessions.js.gz +0 -0
- package/dist/web/public/host-wake-ui.js.gz +0 -0
- package/dist/web/public/i18n.8f291f06.js +2 -0
- package/dist/web/public/i18n.8f291f06.js.br +0 -0
- package/dist/web/public/i18n.8f291f06.js.gz +0 -0
- package/dist/web/public/{image-input.9ed1d0d2.js → image-input.941386e7.js} +41 -22
- package/dist/web/public/image-input.941386e7.js.br +0 -0
- package/dist/web/public/image-input.941386e7.js.gz +0 -0
- package/dist/web/public/index.html +88 -16
- package/dist/web/public/index.html.br +0 -0
- package/dist/web/public/index.html.gz +0 -0
- package/dist/web/public/input-cjk.8bc46081.js.gz +0 -0
- package/dist/web/public/{keyboard-accessory.c458eea8.js → keyboard-accessory.c283e827.js} +40 -29
- package/dist/web/public/keyboard-accessory.c283e827.js.br +0 -0
- package/dist/web/public/keyboard-accessory.c283e827.js.gz +0 -0
- package/dist/web/public/mobile-handlers.0ef9c311.js.gz +0 -0
- package/dist/web/public/mobile-ime-preview.2dbaf262.js.gz +0 -0
- package/dist/web/public/mobile-overview.js +1 -0
- package/dist/web/public/mobile-overview.js.br +0 -0
- package/dist/web/public/mobile-overview.js.gz +0 -0
- package/dist/web/public/mobile.13514863.css +1 -0
- package/dist/web/public/mobile.13514863.css.br +0 -0
- package/dist/web/public/mobile.13514863.css.gz +0 -0
- package/dist/web/public/notification-manager.feb82c04.js.gz +0 -0
- package/dist/web/public/orchestrator-panel.js.gz +0 -0
- package/dist/web/public/{panels-ui.73ec0137.js → panels-ui.b7bfb9da.js} +6 -6
- package/dist/web/public/panels-ui.b7bfb9da.js.br +0 -0
- package/dist/web/public/panels-ui.b7bfb9da.js.gz +0 -0
- package/dist/web/public/ralph-panel.b350e2ef.js.gz +0 -0
- package/dist/web/public/ralph-wizard.b6c0dd19.js.gz +0 -0
- package/dist/web/public/readmymind-ui.js.gz +0 -0
- package/dist/web/public/reboot-restore-ui.js.gz +0 -0
- package/dist/web/public/{respawn-ui.ff0dae4c.js → respawn-ui.d7adcf6a.js} +1 -1
- package/dist/web/public/respawn-ui.d7adcf6a.js.br +0 -0
- package/dist/web/public/respawn-ui.d7adcf6a.js.gz +0 -0
- package/dist/web/public/sanitize-html.e7147e76.js.gz +0 -0
- package/dist/web/public/security-notices.json +21 -0
- package/dist/web/public/session-lineage.js.gz +0 -0
- package/dist/web/public/session-ui.be076c88.js +100 -0
- package/dist/web/public/session-ui.be076c88.js.br +0 -0
- package/dist/web/public/session-ui.be076c88.js.gz +0 -0
- package/dist/web/public/settings-ui.fc4cc50a.js +97 -0
- package/dist/web/public/settings-ui.fc4cc50a.js.br +0 -0
- package/dist/web/public/settings-ui.fc4cc50a.js.gz +0 -0
- package/dist/web/public/spreadsheet-preview-worker.js.gz +0 -0
- package/dist/web/public/spreadsheet-preview.75c751de.js.gz +0 -0
- package/dist/web/public/spreadsheet-xlsx-core.js.gz +0 -0
- package/dist/web/public/styles.dcfa907f.css +1 -0
- package/dist/web/public/styles.dcfa907f.css.br +0 -0
- package/dist/web/public/styles.dcfa907f.css.gz +0 -0
- package/dist/web/public/subagent-windows.07277a58.js.gz +0 -0
- package/dist/web/public/sw.js +2 -2
- package/dist/web/public/sw.js.br +0 -0
- package/dist/web/public/sw.js.gz +0 -0
- package/dist/web/public/tab-layout-browser.2d6189f7.js.gz +0 -0
- package/dist/web/public/tab-rail-resize.7157e0bd.js.gz +0 -0
- package/dist/web/public/terminal-keycode229-recovery.af09f99a.js.gz +0 -0
- package/dist/web/public/terminal-split.js.gz +0 -0
- package/dist/web/public/terminal-tile.js +1 -0
- package/dist/web/public/terminal-tile.js.br +0 -0
- package/dist/web/public/terminal-tile.js.gz +0 -0
- package/dist/web/public/terminal-ui.ae01a7d1.js +2 -0
- package/dist/web/public/terminal-ui.ae01a7d1.js.br +0 -0
- package/dist/web/public/terminal-ui.ae01a7d1.js.gz +0 -0
- package/dist/web/public/tile-grid.js +3 -6
- package/dist/web/public/tile-grid.js.br +0 -0
- package/dist/web/public/tile-grid.js.gz +0 -0
- package/dist/web/public/ultracode-panel.js.gz +0 -0
- package/dist/web/public/ultracode-windows.js.gz +0 -0
- package/dist/web/public/vendor/dompurify.min.js.gz +0 -0
- package/dist/web/public/vendor/exceljs.min.js.gz +0 -0
- package/dist/web/public/vendor/fflate.min.js.gz +0 -0
- package/dist/web/public/vendor/marked.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-serialize.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-predictive-echo.ae5e3d5d.js.gz +0 -0
- package/dist/web/public/vendor/xterm-zerolag-input.0b69623c.js.gz +0 -0
- package/dist/web/public/vendor/xterm.css.gz +0 -0
- package/dist/web/public/vendor/xterm.min.js.gz +0 -0
- package/dist/web/public/voice-input.2342c37b.js.gz +0 -0
- package/dist/web/public/voice-pcm-worklet.js.gz +0 -0
- package/dist/web/public/webview-tabs.js.gz +0 -0
- package/dist/web/public/whats-new.json +13 -0
- package/dist/web/response-viewer-transcript.d.ts +6 -0
- package/dist/web/response-viewer-transcript.d.ts.map +1 -1
- package/dist/web/response-viewer-transcript.js +134 -1
- package/dist/web/response-viewer-transcript.js.map +1 -1
- package/dist/web/routes/approval-routes.d.ts.map +1 -1
- package/dist/web/routes/approval-routes.js +12 -8
- package/dist/web/routes/approval-routes.js.map +1 -1
- package/dist/web/routes/case-routes.d.ts.map +1 -1
- package/dist/web/routes/case-routes.js +9 -2
- package/dist/web/routes/case-routes.js.map +1 -1
- package/dist/web/routes/index.d.ts +1 -0
- package/dist/web/routes/index.d.ts.map +1 -1
- package/dist/web/routes/index.js +1 -0
- package/dist/web/routes/index.js.map +1 -1
- package/dist/web/routes/mcp-sync-routes.d.ts +4 -4
- package/dist/web/routes/mcp-sync-routes.js +4 -4
- package/dist/web/routes/ralph-routes.d.ts.map +1 -1
- package/dist/web/routes/ralph-routes.js +19 -14
- package/dist/web/routes/ralph-routes.js.map +1 -1
- package/dist/web/routes/session-routes.d.ts +19 -7
- package/dist/web/routes/session-routes.d.ts.map +1 -1
- package/dist/web/routes/session-routes.js +227 -66
- package/dist/web/routes/session-routes.js.map +1 -1
- package/dist/web/routes/status-telemetry-routes.d.ts.map +1 -1
- package/dist/web/routes/status-telemetry-routes.js +9 -5
- package/dist/web/routes/status-telemetry-routes.js.map +1 -1
- package/dist/web/routes/system-routes.d.ts +9 -0
- package/dist/web/routes/system-routes.d.ts.map +1 -1
- package/dist/web/routes/system-routes.js +102 -12
- package/dist/web/routes/system-routes.js.map +1 -1
- package/dist/web/routes/worktree-routes.d.ts +52 -0
- package/dist/web/routes/worktree-routes.d.ts.map +1 -0
- package/dist/web/routes/worktree-routes.js +220 -0
- package/dist/web/routes/worktree-routes.js.map +1 -0
- package/dist/web/schemas.d.ts +30 -1
- package/dist/web/schemas.d.ts.map +1 -1
- package/dist/web/schemas.js +74 -3
- package/dist/web/schemas.js.map +1 -1
- package/dist/web/screen-blocked.d.ts +80 -0
- package/dist/web/screen-blocked.d.ts.map +1 -0
- package/dist/web/screen-blocked.js +106 -0
- package/dist/web/screen-blocked.js.map +1 -0
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +23 -2
- package/dist/web/server.js.map +1 -1
- package/dist/web/session-listener-wiring.d.ts +1 -0
- package/dist/web/session-listener-wiring.d.ts.map +1 -1
- package/dist/web/session-listener-wiring.js +20 -0
- package/dist/web/session-listener-wiring.js.map +1 -1
- package/dist/web/session-wait-registry.d.ts +27 -9
- package/dist/web/session-wait-registry.d.ts.map +1 -1
- package/dist/web/session-wait-registry.js +36 -13
- package/dist/web/session-wait-registry.js.map +1 -1
- package/dist/web/sse-events.d.ts +7 -2
- package/dist/web/sse-events.d.ts.map +1 -1
- package/dist/web/sse-events.js +7 -2
- package/dist/web/sse-events.js.map +1 -1
- package/package.json +2 -2
- package/skills/codeman/SKILL.md +21 -17
- package/skills/codeman/preamble.sh +14 -11
- package/skills/codeman/reference/endpoints.md +8 -8
- package/skills/codeman/reference/messaging.md +5 -5
- package/skills/codeman/reference/recipes.md +13 -10
- package/skills/codeman/reference/verbs.md +7 -5
- package/dist/web/public/app.24689381.js +0 -43
- package/dist/web/public/app.24689381.js.br +0 -0
- package/dist/web/public/app.24689381.js.gz +0 -0
- package/dist/web/public/constants.17d77b65.js.br +0 -0
- package/dist/web/public/constants.17d77b65.js.gz +0 -0
- package/dist/web/public/i18n.9afd8e4d.js +0 -2
- package/dist/web/public/i18n.9afd8e4d.js.br +0 -0
- package/dist/web/public/i18n.9afd8e4d.js.gz +0 -0
- package/dist/web/public/image-input.9ed1d0d2.js.br +0 -0
- package/dist/web/public/image-input.9ed1d0d2.js.gz +0 -0
- package/dist/web/public/keyboard-accessory.c458eea8.js.br +0 -0
- package/dist/web/public/keyboard-accessory.c458eea8.js.gz +0 -0
- package/dist/web/public/mobile.2dff1580.css +0 -1
- package/dist/web/public/mobile.2dff1580.css.br +0 -0
- package/dist/web/public/mobile.2dff1580.css.gz +0 -0
- package/dist/web/public/panels-ui.73ec0137.js.br +0 -0
- package/dist/web/public/panels-ui.73ec0137.js.gz +0 -0
- package/dist/web/public/respawn-ui.ff0dae4c.js.br +0 -0
- package/dist/web/public/respawn-ui.ff0dae4c.js.gz +0 -0
- package/dist/web/public/session-ui.dbc6819b.js +0 -100
- package/dist/web/public/session-ui.dbc6819b.js.br +0 -0
- package/dist/web/public/session-ui.dbc6819b.js.gz +0 -0
- package/dist/web/public/settings-ui.81ac264e.js +0 -97
- package/dist/web/public/settings-ui.81ac264e.js.br +0 -0
- package/dist/web/public/settings-ui.81ac264e.js.gz +0 -0
- package/dist/web/public/styles.900a28e4.css +0 -1
- package/dist/web/public/styles.900a28e4.css.br +0 -0
- package/dist/web/public/styles.900a28e4.css.gz +0 -0
- package/dist/web/public/terminal-ui.858f5da5.js +0 -2
- package/dist/web/public/terminal-ui.858f5da5.js.br +0 -0
- package/dist/web/public/terminal-ui.858f5da5.js.gz +0 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Git worktrees of a local case (src/git-worktrees.ts holds the rules):
|
|
3
|
+
*
|
|
4
|
+
* GET /api/cases/:name/worktrees the case repository's worktrees, which of them
|
|
5
|
+
* Codeman manages, and the live sessions in each
|
|
6
|
+
* POST /api/cases/:name/worktrees create `<case>/.claude/worktrees/<name>` on a
|
|
7
|
+
* new branch (`{ name, branch?, base? }`)
|
|
8
|
+
* DELETE /api/cases/:name/worktrees/:worktree `git worktree remove` WITHOUT --force, refused
|
|
9
|
+
* while a live session runs inside; optional
|
|
10
|
+
* `?deleteBranch=true` is `git branch -d`
|
|
11
|
+
*
|
|
12
|
+
* A session starts in a worktree through the EXISTING create paths, never a new spawn path here:
|
|
13
|
+
* `POST /api/quick-start` with `worktree: <name>` (validated against this module's rules), or
|
|
14
|
+
* `POST /api/sessions` with the worktree path as `workingDir`.
|
|
15
|
+
*
|
|
16
|
+
* The case is resolved the way quick-start resolves it: an owned remote or Docker case is refused
|
|
17
|
+
* with a 400 (git must never run on the host over a Docker workspace, and a remote case's folder
|
|
18
|
+
* is on another machine); a linked case resolves for admins only in multi-user mode; anything else
|
|
19
|
+
* is the caller's own case space, confined with `isWorkingDirAllowed`. The case folder is probed
|
|
20
|
+
* BOUNDED (#516): a case on a network mount that stopped answering is a 422, never a 404.
|
|
21
|
+
*
|
|
22
|
+
* Statuses are set explicitly from the error code, so the route answers the same with or without
|
|
23
|
+
* the server's envelope hook.
|
|
24
|
+
*/
|
|
25
|
+
import { ApiErrorCode, createErrorResponse, httpStatusForErrorCode } from '../../types.js';
|
|
26
|
+
import { readDockerCases } from '../../docker-hosts.js';
|
|
27
|
+
import { readRemoteCases } from '../../remote-hosts.js';
|
|
28
|
+
import { dataPath, getDataDir } from '../../config/instance.js';
|
|
29
|
+
import { isMultiUserMode } from '../../config/multiuser.js';
|
|
30
|
+
import { listClis } from '../../config/cli-registry/registry.js';
|
|
31
|
+
import { agentSkillDir } from '../../hooks-config.js';
|
|
32
|
+
import { describeUnknownPath, probePathKind } from '../../utils/index.js';
|
|
33
|
+
import { createCaseWorktree, isPathWithin, listCaseWorktrees, managedWorktreesDir, removeCaseWorktree, resolveCaseRepository, respellUnder, worktreeNameError, } from '../../git-worktrees.js';
|
|
34
|
+
import { CreateWorktreeSchema, RemoveWorktreeQuerySchema } from '../schemas.js';
|
|
35
|
+
import { canAccessOwned, getAuthUser, isAdmin, isWorkingDirAllowed, parseBody, readJsonConfig, resolveCasesDir, validatePathWithinBase, } from '../route-helpers.js';
|
|
36
|
+
const SAFE_CASE_NAME = /^[a-zA-Z0-9_-]+$/;
|
|
37
|
+
/** Host paths of every Docker case workspace: git never runs for a case at or inside one. */
|
|
38
|
+
const defaultDockerWorkspaces = async () => (await readDockerCases(getDataDir()).catch(() => [])).map((c) => c.hostWorkspacePath).filter(Boolean);
|
|
39
|
+
/**
|
|
40
|
+
* Every workspace skills folder a session of some registry CLI gets Codeman's agent skill in
|
|
41
|
+
* (`capabilities.agentSkillDir`), read from the registry at call time as data, never by CLI id.
|
|
42
|
+
*/
|
|
43
|
+
const registryAgentSkillDirs = () => {
|
|
44
|
+
const dirs = new Set();
|
|
45
|
+
for (const cli of listClis()) {
|
|
46
|
+
const dir = agentSkillDir(cli.capabilities);
|
|
47
|
+
if (dir)
|
|
48
|
+
dirs.add(dir);
|
|
49
|
+
}
|
|
50
|
+
return [...dirs];
|
|
51
|
+
};
|
|
52
|
+
function failWith(reply, code, message) {
|
|
53
|
+
reply.code(httpStatusForErrorCode(code));
|
|
54
|
+
return createErrorResponse(code, message);
|
|
55
|
+
}
|
|
56
|
+
function failFrom(reply, failure) {
|
|
57
|
+
return failWith(reply, ApiErrorCode[failure.code], failure.message);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The LOCAL folder of case `name` for this caller, or the refusal. Mirrors quick-start's
|
|
61
|
+
* resolution (remote, then Docker, then linked, then the caller's case space) so a name means
|
|
62
|
+
* the same case here as it does to the Run button.
|
|
63
|
+
*/
|
|
64
|
+
async function resolveLocalCaseFolder(req, name) {
|
|
65
|
+
if (!SAFE_CASE_NAME.test(name)) {
|
|
66
|
+
return { ok: false, code: ApiErrorCode.INVALID_INPUT, message: 'Invalid case name' };
|
|
67
|
+
}
|
|
68
|
+
const user = getAuthUser(req);
|
|
69
|
+
const configDir = getDataDir();
|
|
70
|
+
// Ownership folded into the match, as quick-start does: a foreign same-named remote/Docker
|
|
71
|
+
// case falls through to the caller's own local case instead of shadowing it.
|
|
72
|
+
if ((await readRemoteCases(configDir)).some((c) => c.name === name && canAccessOwned(user, c.owner))) {
|
|
73
|
+
return {
|
|
74
|
+
ok: false,
|
|
75
|
+
code: ApiErrorCode.INVALID_INPUT,
|
|
76
|
+
message: 'Worktrees are not available for remote (SSH) cases: the repository is on another machine.',
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if ((await readDockerCases(configDir)).some((c) => c.name === name && canAccessOwned(user, c.owner))) {
|
|
80
|
+
return {
|
|
81
|
+
ok: false,
|
|
82
|
+
code: ApiErrorCode.INVALID_INPUT,
|
|
83
|
+
message: 'Worktrees are not available for Docker cases: a container can write to the workspace, and git would run its hooks and filters on this machine.',
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const linkedCases = await readJsonConfig(dataPath('linked-cases.json'), 'linked cases', {});
|
|
87
|
+
// Linked cases carry no owner: only admins resolve them in multi-user mode.
|
|
88
|
+
const linked = !isMultiUserMode() || isAdmin(req) ? linkedCases[name] : undefined;
|
|
89
|
+
const casePath = linked || validatePathWithinBase(name, resolveCasesDir(user));
|
|
90
|
+
if (!casePath)
|
|
91
|
+
return { ok: false, code: ApiErrorCode.INVALID_INPUT, message: 'Invalid case path' };
|
|
92
|
+
if (!isWorkingDirAllowed(user, casePath)) {
|
|
93
|
+
return { ok: false, code: ApiErrorCode.FORBIDDEN, message: 'case path is outside your workspace' };
|
|
94
|
+
}
|
|
95
|
+
const kind = await probePathKind(casePath, { pastCap: true });
|
|
96
|
+
if (kind === 'unknown') {
|
|
97
|
+
return {
|
|
98
|
+
ok: false,
|
|
99
|
+
code: ApiErrorCode.OPERATION_FAILED,
|
|
100
|
+
message: describeUnknownPath('Case folder', casePath, { pastCap: true }),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (kind === 'absent')
|
|
104
|
+
return { ok: false, code: ApiErrorCode.NOT_FOUND, message: `Case "${name}" not found` };
|
|
105
|
+
if (kind !== 'directory')
|
|
106
|
+
return { ok: false, code: ApiErrorCode.INVALID_INPUT, message: 'Case path is not a folder' };
|
|
107
|
+
return { ok: true, casePath };
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Live local sessions, with the folder each runs in as the case's repository spells it
|
|
111
|
+
* (`respellUnder`: a folder named through the case's own path, which can run through a symlink,
|
|
112
|
+
* is moved onto the repository's real top level, where git lists the worktrees). Remote sessions
|
|
113
|
+
* have no local folder.
|
|
114
|
+
*/
|
|
115
|
+
function liveLocalSessions(ctx, casePath, repoRoot) {
|
|
116
|
+
const out = [];
|
|
117
|
+
for (const session of ctx.sessions.values()) {
|
|
118
|
+
if (session.remote || !session.workingDir || !session.workingDir.startsWith('/'))
|
|
119
|
+
continue;
|
|
120
|
+
const dir = respellUnder(session.workingDir, casePath, repoRoot);
|
|
121
|
+
out.push({ id: session.id, name: session.name, owner: session.owner, dir });
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
export function registerWorktreeRoutes(app, ctx, deps = {}) {
|
|
126
|
+
const dockerWorkspaces = deps.dockerWorkspaces ?? defaultDockerWorkspaces;
|
|
127
|
+
/**
|
|
128
|
+
* Case folder → its repository, or the refusal already rendered. `casePath` is the folder as
|
|
129
|
+
* the case resolves it (possibly through a symlink); `repo.repoRoot` is its real path.
|
|
130
|
+
*/
|
|
131
|
+
async function caseRepository(req, reply, name) {
|
|
132
|
+
const folder = await resolveLocalCaseFolder(req, name);
|
|
133
|
+
if (!folder.ok)
|
|
134
|
+
return { ok: false, fail: failWith(reply, folder.code, folder.message) };
|
|
135
|
+
const dockerRoots = await dockerWorkspaces();
|
|
136
|
+
const repo = await resolveCaseRepository(folder.casePath, { git: deps.git, dockerWorkspaces: dockerRoots });
|
|
137
|
+
if (!repo.ok)
|
|
138
|
+
return { ok: false, fail: failFrom(reply, repo) };
|
|
139
|
+
return { ok: true, repo: repo.repo, casePath: folder.casePath, dockerRoots };
|
|
140
|
+
}
|
|
141
|
+
app.get('/api/cases/:name/worktrees', async (req, reply) => {
|
|
142
|
+
const { name } = req.params;
|
|
143
|
+
const resolved = await caseRepository(req, reply, name);
|
|
144
|
+
if (!resolved.ok)
|
|
145
|
+
return resolved.fail;
|
|
146
|
+
const { repo, casePath } = resolved;
|
|
147
|
+
const listed = await listCaseWorktrees(repo, { git: deps.git });
|
|
148
|
+
if (!listed.ok)
|
|
149
|
+
return failFrom(reply, listed);
|
|
150
|
+
// Each live session belongs to the DEEPEST worktree holding its folder, so a session in a
|
|
151
|
+
// managed worktree is not also counted against the main checkout that contains it.
|
|
152
|
+
const user = getAuthUser(req);
|
|
153
|
+
const rows = listed.worktrees.map((wt) => ({ ...wt, sessionCount: 0, sessions: [] }));
|
|
154
|
+
for (const session of liveLocalSessions(ctx, casePath, repo.repoRoot)) {
|
|
155
|
+
let best;
|
|
156
|
+
for (const row of rows) {
|
|
157
|
+
if (!isPathWithin(session.dir, row.path))
|
|
158
|
+
continue;
|
|
159
|
+
if (!best || row.path.length > best.path.length)
|
|
160
|
+
best = row;
|
|
161
|
+
}
|
|
162
|
+
if (!best)
|
|
163
|
+
continue;
|
|
164
|
+
best.sessionCount += 1;
|
|
165
|
+
if (canAccessOwned(user, session.owner))
|
|
166
|
+
best.sessions.push({ id: session.id, name: session.name });
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
success: true,
|
|
170
|
+
data: {
|
|
171
|
+
caseName: name,
|
|
172
|
+
repoRoot: repo.repoRoot,
|
|
173
|
+
worktreesDir: managedWorktreesDir(repo.repoRoot),
|
|
174
|
+
worktrees: rows,
|
|
175
|
+
truncated: listed.truncated,
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
});
|
|
179
|
+
app.post('/api/cases/:name/worktrees', async (req, reply) => {
|
|
180
|
+
const { name } = req.params;
|
|
181
|
+
const body = parseBody(CreateWorktreeSchema, req.body);
|
|
182
|
+
const nameError = worktreeNameError(body.name);
|
|
183
|
+
if (nameError)
|
|
184
|
+
return failWith(reply, ApiErrorCode.INVALID_INPUT, nameError);
|
|
185
|
+
const resolved = await caseRepository(req, reply, name);
|
|
186
|
+
if (!resolved.ok)
|
|
187
|
+
return resolved.fail;
|
|
188
|
+
const created = await createCaseWorktree(resolved.repo, body, {
|
|
189
|
+
git: deps.git,
|
|
190
|
+
agentSkillDirs: registryAgentSkillDirs(),
|
|
191
|
+
});
|
|
192
|
+
if (!created.ok)
|
|
193
|
+
return failFrom(reply, created);
|
|
194
|
+
reply.code(201);
|
|
195
|
+
return { success: true, data: { worktree: created.worktree } };
|
|
196
|
+
});
|
|
197
|
+
app.delete('/api/cases/:name/worktrees/:worktree', async (req, reply) => {
|
|
198
|
+
const { name, worktree } = req.params;
|
|
199
|
+
const query = parseBody(RemoveWorktreeQuerySchema, req.query ?? {});
|
|
200
|
+
const nameError = worktreeNameError(worktree);
|
|
201
|
+
if (nameError)
|
|
202
|
+
return failWith(reply, ApiErrorCode.INVALID_INPUT, nameError);
|
|
203
|
+
const resolved = await caseRepository(req, reply, name);
|
|
204
|
+
if (!resolved.ok)
|
|
205
|
+
return resolved.fail;
|
|
206
|
+
const removed = await removeCaseWorktree(resolved.repo, {
|
|
207
|
+
name: worktree,
|
|
208
|
+
deleteBranch: query.deleteBranch === 'true' || query.deleteBranch === '1',
|
|
209
|
+
// Any owner's session blocks: removing the folder under a running agent is the damage
|
|
210
|
+
// this refusal exists to prevent, whoever started it.
|
|
211
|
+
isInUse: (path) => liveLocalSessions(ctx, resolved.casePath, resolved.repo.repoRoot).some((s) => isPathWithin(s.dir, path)),
|
|
212
|
+
},
|
|
213
|
+
// The worktree folder itself must not be (or hold) a Docker case workspace either.
|
|
214
|
+
{ git: deps.git, dockerWorkspaces: resolved.dockerRoots });
|
|
215
|
+
if (!removed.ok)
|
|
216
|
+
return failFrom(reply, removed);
|
|
217
|
+
return { success: true, data: { removed: removed.removed } };
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=worktree-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree-routes.js","sourceRoot":"","sources":["../../../src/web/routes/worktree-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,sBAAsB,EAAoB,MAAM,gBAAgB,CAAC;AAC7G,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,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chema: z.ZodObject<{
|
|
|
173
173
|
continueSession: z.ZodOptional<z.ZodBoolean>;
|
|
174
174
|
resumeSessionId: z.ZodOptional<z.ZodString>;
|
|
175
175
|
}, z.core.$strip>>;
|
|
176
|
+
copilotConfig: z.ZodOptional<z.ZodObject<{
|
|
177
|
+
model: z.ZodOptional<z.ZodString>;
|
|
178
|
+
allowAll: z.ZodOptional<z.ZodBoolean>;
|
|
179
|
+
continueSession: z.ZodOptional<z.ZodBoolean>;
|
|
180
|
+
resumeSessionId: z.ZodOptional<z.ZodString>;
|
|
181
|
+
}, z.core.$strip>>;
|
|
176
182
|
deepSeekConfig: z.ZodOptional<z.ZodObject<{
|
|
177
183
|
profile: z.ZodOptional<z.ZodString>;
|
|
178
184
|
permissionMode: z.ZodOptional<z.ZodEnum<{
|
|
@@ -254,7 +260,7 @@ export declare const StatusTelemetrySchema: z.ZodObject<{
|
|
|
254
260
|
last_miss_at: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
255
261
|
recache_tokens_if_cold: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
256
262
|
last_miss_cause: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
257
|
-
causes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown
|
|
263
|
+
causes: z.ZodPreprocess<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>>;
|
|
258
264
|
}, z.core.$strip>>>;
|
|
259
265
|
}, z.core.$strip>>>;
|
|
260
266
|
}, z.core.$strip>>>;
|
|
@@ -287,6 +293,21 @@ export declare const CloneCaseSchema: z.ZodObject<{
|
|
|
287
293
|
export declare const ClonePreflightSchema: z.ZodObject<{
|
|
288
294
|
repository: z.ZodString;
|
|
289
295
|
}, z.core.$strip>;
|
|
296
|
+
/** Schema for POST /api/cases/:name/worktrees: a new worktree on a new branch. */
|
|
297
|
+
export declare const CreateWorktreeSchema: z.ZodObject<{
|
|
298
|
+
name: z.ZodString;
|
|
299
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
300
|
+
base: z.ZodOptional<z.ZodString>;
|
|
301
|
+
}, z.core.$strip>;
|
|
302
|
+
/** Query of DELETE /api/cases/:name/worktrees/:worktree. */
|
|
303
|
+
export declare const RemoveWorktreeQuerySchema: z.ZodObject<{
|
|
304
|
+
deleteBranch: z.ZodOptional<z.ZodEnum<{
|
|
305
|
+
0: "0";
|
|
306
|
+
false: "false";
|
|
307
|
+
1: "1";
|
|
308
|
+
true: "true";
|
|
309
|
+
}>>;
|
|
310
|
+
}, z.core.$strip>;
|
|
290
311
|
export declare const RemoteHostSchema: z.ZodObject<{
|
|
291
312
|
id: z.ZodString;
|
|
292
313
|
label: z.ZodString;
|
|
@@ -427,6 +448,7 @@ export declare const QuickStartSchema: z.ZodObject<{
|
|
|
427
448
|
sessionName: z.ZodOptional<z.ZodString>;
|
|
428
449
|
parentSessionId: z.ZodOptional<z.ZodString>;
|
|
429
450
|
tabGroupId: z.ZodOptional<z.ZodString>;
|
|
451
|
+
worktree: z.ZodOptional<z.ZodString>;
|
|
430
452
|
modelOverride: z.ZodOptional<z.ZodString>;
|
|
431
453
|
mode: z.ZodOptional<z.ZodType<SessionMode, unknown, z.core.$ZodTypeInternals<SessionMode, unknown>>>;
|
|
432
454
|
openCodeConfig: z.ZodOptional<z.ZodObject<{
|
|
@@ -493,6 +515,12 @@ export declare const QuickStartSchema: z.ZodObject<{
|
|
|
493
515
|
continueSession: z.ZodOptional<z.ZodBoolean>;
|
|
494
516
|
resumeSessionId: z.ZodOptional<z.ZodString>;
|
|
495
517
|
}, z.core.$strip>>;
|
|
518
|
+
copilotConfig: z.ZodOptional<z.ZodObject<{
|
|
519
|
+
model: z.ZodOptional<z.ZodString>;
|
|
520
|
+
allowAll: z.ZodOptional<z.ZodBoolean>;
|
|
521
|
+
continueSession: z.ZodOptional<z.ZodBoolean>;
|
|
522
|
+
resumeSessionId: z.ZodOptional<z.ZodString>;
|
|
523
|
+
}, z.core.$strip>>;
|
|
496
524
|
deepSeekConfig: z.ZodOptional<z.ZodObject<{
|
|
497
525
|
profile: z.ZodOptional<z.ZodString>;
|
|
498
526
|
permissionMode: z.ZodOptional<z.ZodEnum<{
|
|
@@ -673,6 +701,7 @@ export declare const SettingsUpdateSchema: z.ZodObject<{
|
|
|
673
701
|
imageWatcherEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
674
702
|
agentSkillEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
675
703
|
workspaceHooksEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
704
|
+
pinCliSessionName: z.ZodOptional<z.ZodBoolean>;
|
|
676
705
|
claudeVoiceEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
677
706
|
approvalsInboxEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
678
707
|
autoNameSessions: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/web/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C,sFAAsF;AACtF,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAuBpD;AA4BD,yEAAyE;AACzE,eAAO,MAAM,2BAA2B;;;;;;;iBAQtC,CAAC;AAEH,0EAA0E;AAC1E,eAAO,MAAM,4BAA4B;;;;;;;iBAQvC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;;;;;;;;;kBAcjB,CAAC;AAEZ;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;kBAUpB,CAAC;AAEZ;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/web/schemas.ts"],"names":[],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172
172
|
/**
|
|
173
173
|
* Allowlisted env var key prefixes, contributed by the ENABLED CLIs in the registry
|
|
174
174
|
* (`env.allowedPrefixes`) — `CLAUDE_CODE_`, `OPENCODE_`, `CODEX_`, `GEMINI_`, `GOOGLE_`,
|
|
175
|
-
* `ANTIGRAVITY_`, `PI_`, `GROK_`, `XAI_`, `DSH_`, `DEEPSEEK_` as shipped.
|
|
175
|
+
* `ANTIGRAVITY_`, `PI_`, `GROK_`, `XAI_`, `DSH_`, `DEEPSEEK_`, `OMP_`, `COPILOT_` as shipped.
|
|
176
176
|
*
|
|
177
177
|
* ⚠️ Resolved AT PARSE TIME, not at module load. This used to be a frozen array computed
|
|
178
178
|
* once when the module was imported, which meant a CLI enabled while the server was running
|
|
@@ -233,7 +233,7 @@ const safeEnvOverridesSchema = z
|
|
|
233
233
|
return true;
|
|
234
234
|
return Object.keys(val).every(isAllowedEnvKey);
|
|
235
235
|
}, {
|
|
236
|
-
message: 'envOverrides contains blocked or disallowed env var keys. Only CLAUDE_CODE_*, OPENCODE_*, CODEX_*, GEMINI_*, GOOGLE_*, ANTIGRAVITY_*, PI_*, GROK_*, XAI_*, DSH_*, DEEPSEEK_*, OMP_* keys and CLAUDE_CONFIG_DIR are allowed.',
|
|
236
|
+
message: 'envOverrides contains blocked or disallowed env var keys. Only CLAUDE_CODE_*, OPENCODE_*, CODEX_*, GEMINI_*, GOOGLE_*, ANTIGRAVITY_*, PI_*, GROK_*, XAI_*, DSH_*, DEEPSEEK_*, OMP_*, COPILOT_* keys and CLAUDE_CONFIG_DIR are allowed.',
|
|
237
237
|
});
|
|
238
238
|
// ========== Effort Level ==========
|
|
239
239
|
/**
|
|
@@ -399,6 +399,27 @@ const GrokConfigSchema = z
|
|
|
399
399
|
.optional(),
|
|
400
400
|
})
|
|
401
401
|
.optional();
|
|
402
|
+
const CopilotConfigSchema = z
|
|
403
|
+
.object({
|
|
404
|
+
// A leading alphanumeric, like resumeSessionId below: a value like `--yolo` would otherwise be read
|
|
405
|
+
// as its own flag after `--model` (bypassing the allowAll clamp). `/` stays for provider/id.
|
|
406
|
+
model: z
|
|
407
|
+
.string()
|
|
408
|
+
.max(100)
|
|
409
|
+
.regex(/^[a-zA-Z0-9][a-zA-Z0-9._\-/]*$/)
|
|
410
|
+
.optional(),
|
|
411
|
+
allowAll: z.boolean().optional(),
|
|
412
|
+
continueSession: z.boolean().optional(),
|
|
413
|
+
// A single plain word with a leading alphanumeric: --resume also matches session NAMES, so
|
|
414
|
+
// `my-feature` is accepted, but a value like `--yolo` must not be, because --resume's value is
|
|
415
|
+
// optional and the next token would be read as its own flag (bypassing the allowAll clamp).
|
|
416
|
+
resumeSessionId: z
|
|
417
|
+
.string()
|
|
418
|
+
.max(100)
|
|
419
|
+
.regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/)
|
|
420
|
+
.optional(),
|
|
421
|
+
})
|
|
422
|
+
.optional();
|
|
402
423
|
/**
|
|
403
424
|
* Schema for OMP CLI-specific configuration.
|
|
404
425
|
*/
|
|
@@ -550,6 +571,7 @@ export const CreateSessionSchema = z.object({
|
|
|
550
571
|
antigravityConfig: AntigravityConfigSchema,
|
|
551
572
|
piConfig: PiConfigSchema,
|
|
552
573
|
grokConfig: GrokConfigSchema,
|
|
574
|
+
copilotConfig: CopilotConfigSchema,
|
|
553
575
|
deepSeekConfig: DeepSeekConfigSchema,
|
|
554
576
|
ompConfig: OmpConfigSchema,
|
|
555
577
|
/** Resume a previous Claude conversation by its session ID (used for reboot recovery) */
|
|
@@ -657,7 +679,16 @@ export const StatusTelemetrySchema = z.object({
|
|
|
657
679
|
miss_recache_tokens: z.number().nullish(),
|
|
658
680
|
last_miss_at: z.number().nullish(),
|
|
659
681
|
recache_tokens_if_cold: z.number().nullish(),
|
|
660
|
-
|
|
682
|
+
// Keep the first 20 causes instead of 400-ing the whole post (which also drops the
|
|
683
|
+
// footer, the plan chip and the model report it carries) when Claude Code reports more. The
|
|
684
|
+
// preprocess slices BEFORE the array validates, so an over-long array costs one bounded
|
|
685
|
+
// slice, never per-element validation across every entry (parsePromptCache then keeps
|
|
686
|
+
// the string ones among those 20).
|
|
687
|
+
last_miss_cause: z
|
|
688
|
+
.object({
|
|
689
|
+
causes: z.preprocess((v) => (Array.isArray(v) ? v.slice(0, 20) : v), z.array(z.unknown()).nullish()),
|
|
690
|
+
})
|
|
691
|
+
.nullish(),
|
|
661
692
|
})
|
|
662
693
|
.nullish(),
|
|
663
694
|
})
|
|
@@ -704,6 +735,30 @@ export const CloneCaseSchema = z.object({
|
|
|
704
735
|
export const ClonePreflightSchema = z.object({
|
|
705
736
|
repository: z.string().min(1).max(2048),
|
|
706
737
|
});
|
|
738
|
+
// ========== Git worktrees of a case (src/git-worktrees.ts) ==========
|
|
739
|
+
/**
|
|
740
|
+
* A worktree name: one segment of letters, digits, `.`, `_`, `-`, starting with a letter or
|
|
741
|
+
* digit, at most 64 characters (Claude Code's own `--worktree` limit). The finer rules (no `..`,
|
|
742
|
+
* no trailing `.lock`) are `worktreeNameError()`, which every route applies after this.
|
|
743
|
+
*/
|
|
744
|
+
const worktreeNameSchema = z
|
|
745
|
+
.string()
|
|
746
|
+
.min(1)
|
|
747
|
+
.max(64)
|
|
748
|
+
.regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/, 'Invalid worktree name. Use letters, digits, ".", "_" and "-".');
|
|
749
|
+
/** Schema for POST /api/cases/:name/worktrees: a new worktree on a new branch. */
|
|
750
|
+
export const CreateWorktreeSchema = z.object({
|
|
751
|
+
name: worktreeNameSchema,
|
|
752
|
+
/** New branch name; default `worktree-<name>`, Claude Code's convention. */
|
|
753
|
+
branch: z.string().min(1).max(200).optional(),
|
|
754
|
+
/** Start point (branch, tag or commit); default the case's current HEAD. */
|
|
755
|
+
base: z.string().min(1).max(200).optional(),
|
|
756
|
+
});
|
|
757
|
+
/** Query of DELETE /api/cases/:name/worktrees/:worktree. */
|
|
758
|
+
export const RemoveWorktreeQuerySchema = z.object({
|
|
759
|
+
/** Also `git branch -d` the worktree's branch (never `-D`). */
|
|
760
|
+
deleteBranch: z.enum(['true', 'false', '1', '0']).optional(),
|
|
761
|
+
});
|
|
707
762
|
const RemoteCommandOverridesSchema = z
|
|
708
763
|
.object({
|
|
709
764
|
shell: z.string().min(1).max(300).optional(),
|
|
@@ -1056,6 +1111,13 @@ export const QuickStartSchema = z.object({
|
|
|
1056
1111
|
parentSessionId: parentSessionIdSchema,
|
|
1057
1112
|
/** Tab group to place the new session in: see tabGroupIdSchema. */
|
|
1058
1113
|
tabGroupId: tabGroupIdSchema,
|
|
1114
|
+
/**
|
|
1115
|
+
* Start the session in this git worktree of the case (`<case>/.claude/worktrees/<worktree>`,
|
|
1116
|
+
* created through POST /api/cases/:name/worktrees) instead of the case folder. Local cases
|
|
1117
|
+
* only: refused (400) for remote and Docker cases. The worktree must be a registered worktree
|
|
1118
|
+
* of the case's repository; it is never created here.
|
|
1119
|
+
*/
|
|
1120
|
+
worktree: worktreeNameSchema.optional(),
|
|
1059
1121
|
/** Model override written to <case>/.claude/settings.local.json (e.g. "opus[1m]").
|
|
1060
1122
|
* Empty string clears. Applied for local AND docker cases (the docker workspace is
|
|
1061
1123
|
* a real host dir, so the settings file crosses the bind mount); rejected for
|
|
@@ -1068,6 +1130,7 @@ export const QuickStartSchema = z.object({
|
|
|
1068
1130
|
antigravityConfig: AntigravityConfigSchema,
|
|
1069
1131
|
piConfig: PiConfigSchema,
|
|
1070
1132
|
grokConfig: GrokConfigSchema,
|
|
1133
|
+
copilotConfig: CopilotConfigSchema,
|
|
1071
1134
|
deepSeekConfig: DeepSeekConfigSchema,
|
|
1072
1135
|
ompConfig: OmpConfigSchema,
|
|
1073
1136
|
envOverrides: safeEnvOverridesSchema,
|
|
@@ -1283,6 +1346,14 @@ export const SettingsUpdateSchema = z
|
|
|
1283
1346
|
* never added — for a user who wants Codeman to leave their repos alone.
|
|
1284
1347
|
*/
|
|
1285
1348
|
workspaceHooksEnabled: z.boolean().optional(),
|
|
1349
|
+
/**
|
|
1350
|
+
* Launch every Claude session with `--name` set to its tab name (default OFF: only a
|
|
1351
|
+
* name the user chose is pinned). Nothing acts on it in `PUT /api/settings`: it is read
|
|
1352
|
+
* fresh from disk by readPinCliSessionNameEnabled() (hooks-config.ts) at every claude
|
|
1353
|
+
* create and respawn, like readPlanUsageTelemetryEnabled(), so a toggle applies from the
|
|
1354
|
+
* next spawn with no restart.
|
|
1355
|
+
*/
|
|
1356
|
+
pinCliSessionName: z.boolean().optional(),
|
|
1286
1357
|
/**
|
|
1287
1358
|
* Let browser dictation transcribe through this machine's Claude Code login,
|
|
1288
1359
|
* the same speech-to-text service the CLI's own `/voice` mode uses
|