@open-mercato/cezar 0.9.2 → 0.10.0-pr892.1298
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/LICENSE +21 -0
- package/README.md +169 -38
- package/dist/agent-config/account-identity.d.ts +44 -0
- package/dist/agent-config/account-identity.js +128 -0
- package/dist/agent-config/account-identity.js.map +1 -0
- package/dist/agent-config/catalog.d.ts +8 -0
- package/dist/agent-config/catalog.js +18 -0
- package/dist/agent-config/catalog.js.map +1 -1
- package/dist/agent-config/model-settings/claude.d.ts +2 -0
- package/dist/agent-config/model-settings/claude.js +11 -0
- package/dist/agent-config/model-settings/claude.js.map +1 -0
- package/dist/agent-config/model-settings/codex.d.ts +2 -0
- package/dist/agent-config/model-settings/codex.js +16 -0
- package/dist/agent-config/model-settings/codex.js.map +1 -0
- package/dist/agent-config/model-settings/opencode.d.ts +2 -0
- package/dist/agent-config/model-settings/opencode.js +8 -0
- package/dist/agent-config/model-settings/opencode.js.map +1 -0
- package/dist/agent-config/model-settings/pi.d.ts +12 -0
- package/dist/agent-config/model-settings/pi.js +18 -0
- package/dist/agent-config/model-settings/pi.js.map +1 -0
- package/dist/agent-config/model-settings/shared.d.ts +9 -0
- package/dist/agent-config/model-settings/shared.js +93 -0
- package/dist/agent-config/model-settings/shared.js.map +1 -0
- package/dist/agent-config/model-settings/types.d.ts +9 -0
- package/dist/agent-config/model-settings/types.js +2 -0
- package/dist/agent-config/model-settings/types.js.map +1 -0
- package/dist/agent-config/models.d.ts +9 -0
- package/dist/agent-config/models.js +32 -0
- package/dist/agent-config/models.js.map +1 -0
- package/dist/agent-config/service.js +4 -4
- package/dist/agent-config/service.js.map +1 -1
- package/dist/automations/types.d.ts +4 -0
- package/dist/automations/types.js +2 -1
- package/dist/automations/types.js.map +1 -1
- package/dist/config.d.ts +10 -1
- package/dist/config.js +48 -5
- package/dist/config.js.map +1 -1
- package/dist/contract/agent-config.d.ts +2 -0
- package/dist/contract/agent-profiles.d.ts +347 -0
- package/dist/contract/automations.d.ts +24 -0
- package/dist/contract/events.d.ts +59 -0
- package/dist/contract/github.d.ts +88 -0
- package/dist/contract/health.d.ts +7 -1
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +1005 -555
- package/dist/contract/projects.d.ts +33 -5
- package/dist/contract/runs.d.ts +247 -0
- package/dist/contract/skills.d.ts +7 -0
- package/dist/contract/workflows.d.ts +6 -0
- package/dist/contract/workspace.d.ts +137 -2
- package/dist/core/agent-env.js +41 -16
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-model-policy.d.ts +10 -0
- package/dist/core/agent-model-policy.js +36 -0
- package/dist/core/agent-model-policy.js.map +1 -0
- package/dist/core/agent-profiles.d.ts +62 -0
- package/dist/core/agent-profiles.js +90 -0
- package/dist/core/agent-profiles.js.map +1 -0
- package/dist/core/agent-runner.d.ts +37 -6
- package/dist/core/agent-runner.js +35 -3
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/backend-detect.d.ts +5 -5
- package/dist/core/backend-detect.js +44 -7
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/claude-cli-runner.js +10 -5
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/codex-app-server-runner.js +13 -3
- package/dist/core/codex-app-server-runner.js.map +1 -1
- package/dist/core/codex-app-server-transport.js +7 -2
- package/dist/core/codex-app-server-transport.js.map +1 -1
- package/dist/core/model-identity.d.ts +23 -11
- package/dist/core/model-identity.js +41 -24
- package/dist/core/model-identity.js.map +1 -1
- package/dist/core/model-presets.d.ts +8 -2
- package/dist/core/model-presets.js +51 -8
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/opencode-model-catalog.d.ts +32 -0
- package/dist/core/opencode-model-catalog.js +153 -0
- package/dist/core/opencode-model-catalog.js.map +1 -0
- package/dist/core/opencode-server-runner.d.ts +2 -0
- package/dist/core/opencode-server-runner.js +42 -11
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-runner.d.ts +24 -0
- package/dist/core/pi-runner.js +349 -0
- package/dist/core/pi-runner.js.map +1 -0
- package/dist/core/pi-ui-mapper.d.ts +34 -0
- package/dist/core/pi-ui-mapper.js +270 -0
- package/dist/core/pi-ui-mapper.js.map +1 -0
- package/dist/core/provider-auth.d.ts +95 -3
- package/dist/core/provider-auth.js +234 -15
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/provider-availability.d.ts +1 -1
- package/dist/core/provider-availability.js +2 -1
- package/dist/core/provider-availability.js.map +1 -1
- package/dist/core/runner-factory.js +3 -0
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/shell-env.d.ts +28 -0
- package/dist/core/shell-env.js +56 -0
- package/dist/core/shell-env.js.map +1 -0
- package/dist/core/ui-events.d.ts +1 -1
- package/dist/core/usage-limit.d.ts +42 -0
- package/dist/core/usage-limit.js +209 -0
- package/dist/core/usage-limit.js.map +1 -0
- package/dist/git-diff-base.d.ts +51 -26
- package/dist/git-diff-base.js +163 -37
- package/dist/git-diff-base.js.map +1 -1
- package/dist/git-worktree.d.ts +15 -6
- package/dist/git-worktree.js +10 -3
- package/dist/git-worktree.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/paths.d.ts +53 -5
- package/dist/paths.js +63 -9
- package/dist/paths.js.map +1 -1
- package/dist/planner.js +6 -0
- package/dist/planner.js.map +1 -1
- package/dist/release/snapshot.d.ts +13 -2
- package/dist/release/snapshot.js +25 -1
- package/dist/release/snapshot.js.map +1 -1
- package/dist/runs/agent-tmpdir.d.ts +41 -0
- package/dist/runs/agent-tmpdir.js +183 -0
- package/dist/runs/agent-tmpdir.js.map +1 -0
- package/dist/runs/auto-name.js +6 -1
- package/dist/runs/auto-name.js.map +1 -1
- package/dist/runs/event-history.d.ts +50 -0
- package/dist/runs/event-history.js +613 -0
- package/dist/runs/event-history.js.map +1 -0
- package/dist/runs/run-index.d.ts +19 -0
- package/dist/runs/run-index.js +43 -0
- package/dist/runs/run-index.js.map +1 -0
- package/dist/runs/store.d.ts +78 -19
- package/dist/runs/store.js +175 -43
- package/dist/runs/store.js.map +1 -1
- package/dist/server/capabilities.d.ts +15 -1
- package/dist/server/capabilities.js +16 -1
- package/dist/server/capabilities.js.map +1 -1
- package/dist/server/forge/github.d.ts +169 -0
- package/dist/server/forge/github.js +511 -0
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/forge/index.d.ts +9 -0
- package/dist/server/forge/index.js +14 -0
- package/dist/server/forge/index.js.map +1 -1
- package/dist/server/git-changes.d.ts +7 -5
- package/dist/server/git-changes.js +15 -10
- package/dist/server/git-changes.js.map +1 -1
- package/dist/server/github.d.ts +2 -2
- package/dist/server/github.js +1 -1
- package/dist/server/github.js.map +1 -1
- package/dist/server/open-in-app.d.ts +2 -1
- package/dist/server/open-in-app.js +3 -1
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/open-in-terminal.d.ts +46 -1
- package/dist/server/open-in-terminal.js +72 -13
- package/dist/server/open-in-terminal.js.map +1 -1
- package/dist/server/provider-action-gate.js +3 -1
- package/dist/server/provider-action-gate.js.map +1 -1
- package/dist/server/server.d.ts +2206 -434
- package/dist/server/server.js +1219 -136
- package/dist/server/server.js.map +1 -1
- package/dist/server-install/engine.js +5 -18
- package/dist/server-install/engine.js.map +1 -1
- package/dist/server-install/steps.js +6 -2
- package/dist/server-install/steps.js.map +1 -1
- package/dist/skills.js +4 -0
- package/dist/skills.js.map +1 -1
- package/dist/workflows/run.d.ts +229 -9
- package/dist/workflows/run.js +877 -147
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.d.ts +3 -0
- package/dist/workflows/types.js +11 -2
- package/dist/workflows/types.js.map +1 -1
- package/dist/workspace/agent-accounts.d.ts +153 -0
- package/dist/workspace/agent-accounts.js +304 -0
- package/dist/workspace/agent-accounts.js.map +1 -0
- package/dist/workspace/agent-profiles.d.ts +78 -0
- package/dist/workspace/agent-profiles.js +115 -0
- package/dist/workspace/agent-profiles.js.map +1 -0
- package/dist/workspace/config.d.ts +27 -1
- package/dist/workspace/config.js +83 -2
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/projects-cli.js +54 -4
- package/dist/workspace/projects-cli.js.map +1 -1
- package/dist/workspace/projects.d.ts +19 -1
- package/dist/workspace/projects.js +34 -1
- package/dist/workspace/projects.js.map +1 -1
- package/dist/workspace/semaphore.d.ts +46 -1
- package/dist/workspace/semaphore.js +41 -4
- package/dist/workspace/semaphore.js.map +1 -1
- package/dist/workspace/ui-state.d.ts +3 -2
- package/dist/workspace/ui-state.js +3 -2
- package/dist/workspace/ui-state.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-claude.mjs +20 -0
- package/scripts/mock-pi-rpc.mjs +83 -0
- package/web/dist/assets/{alert-dialog-ghffK6g9.js → alert-dialog-Byp42_IG.js} +1 -1
- package/web/dist/assets/arrow-down-CGDbDYKD.js +1 -0
- package/web/dist/assets/arrow-left-ESCjr1Hq.js +1 -0
- package/web/dist/assets/centered-state-LfAW-igm.js +43 -0
- package/web/dist/assets/chevron-right-Du-P1IUd.js +1 -0
- package/web/dist/assets/{collapsible-B0JVzd0B.js → collapsible-CBiiqDJM.js} +1 -1
- package/web/dist/assets/{commit-list-wm6DPHNs.js → commit-list-6PPve7PE.js} +1 -1
- package/web/dist/assets/{compare-variants-DbdP4Y5T.js → compare-variants-BDnp6mXJ.js} +1 -1
- package/web/dist/assets/{diff-Bizc96qe.js → diff-_jK0OWpF.js} +2 -2
- package/web/dist/assets/{diff-stat-Dyfg3ltF.js → diff-stat-CIrTu4Ym.js} +1 -1
- package/web/dist/assets/{diff-view-CG8ek6tC.js → diff-view-COA_5IyY.js} +1 -1
- package/web/dist/assets/dropdown-menu-BofYpFFw.js +1 -0
- package/web/dist/assets/editable-title-_J0zFDl-.js +1 -0
- package/web/dist/assets/{ellipsis-vertical-DpGTRqC2.js → ellipsis-vertical-BeMR-l62.js} +1 -1
- package/web/dist/assets/{file-DlUGpUlb.js → file-DY996Pee.js} +1 -1
- package/web/dist/assets/{folder-BAY6Vddy.js → folder-NO3Ec-TY.js} +1 -1
- package/web/dist/assets/git-toolbar-BqJeUWcD.js +1 -0
- package/web/dist/assets/github-C96HPV9E.js +1 -0
- package/web/dist/assets/{image-preview-BWGk5fPX.js → image-preview-D9cCDfKQ.js} +1 -1
- package/web/dist/assets/index-Bx-grqa9.css +2 -0
- package/web/dist/assets/index-DoVvGDfW.js +7 -0
- package/web/dist/assets/{markdown-BGBOGCA_.js → markdown-DDzk11zj.js} +1 -1
- package/web/dist/assets/new-task-form-BNLLgC6P.js +1 -0
- package/web/dist/assets/pill-CVM1EmV4.js +1 -0
- package/web/dist/assets/{project-router-Cx8NPoqn.js → project-router-LRCtP48W.js} +1 -1
- package/web/dist/assets/prompt-templates-DFOvYgtW.js +15 -0
- package/web/dist/assets/{refresh-cw-BoGdAykg.js → refresh-cw-D1ys6QY2.js} +1 -1
- package/web/dist/assets/repo-git-CzUnsgWY.js +1 -0
- package/web/dist/assets/{run-diff-EcOkf3ti.js → run-diff-BlnqwfSS.js} +2 -2
- package/web/dist/assets/run-header-Bn7cN0Z1.js +1 -0
- package/web/dist/assets/{search-x-X3EpVhgs.js → search-x-D6FSpxId.js} +1 -1
- package/web/dist/assets/{skill-empty-hint-CZLALx6l.js → skill-empty-hint-iwpCcqgI.js} +1 -1
- package/web/dist/assets/skills-CezbOaol.js +1 -0
- package/web/dist/assets/{sparkles-Dt4q7pbG.js → sparkles-MrQrgCI9.js} +1 -1
- package/web/dist/assets/{square-terminal-hwBL8XsC.js → square-terminal-TTH64lO7.js} +1 -1
- package/web/dist/assets/tab-link-FYksz037.js +1 -0
- package/web/dist/assets/task-changes-ClWlnzBL.js +1 -0
- package/web/dist/assets/{task-commits-BTTA5k5T.js → task-commits-Crbrl86b.js} +1 -1
- package/web/dist/assets/{task-files-Da8_4C9g.js → task-files-uSCWyD0-.js} +2 -2
- package/web/dist/assets/task-thread-DPmamBA1.js +9 -0
- package/web/dist/assets/{textarea-CUdokhkv.js → textarea-B9Ahj4E4.js} +1 -1
- package/web/dist/assets/thread-loading-BH_ypQoy.js +1 -0
- package/web/dist/assets/{trash-2-DhVIdWv8.js → trash-2-D8S3V3fu.js} +1 -1
- package/web/dist/assets/{triangle-alert-XYT0DGCI.js → triangle-alert-bB7p9n5E.js} +1 -1
- package/web/dist/assets/{upload-BKjN59-1.js → upload-Bd5oRLPV.js} +1 -1
- package/web/dist/assets/{use-desktop-Bf5LS_P4.js → use-desktop-BNvbRBeZ.js} +1 -1
- package/web/dist/assets/{use-submit-shortcut-CzVyoAMd.js → use-submit-shortcut-B-xhu4Bf.js} +1 -1
- package/web/dist/assets/utils-BhpbVMwN.js +64 -0
- package/web/dist/assets/{workflows-o2QU_pvU.js → workflows-RmfbM9Vy.js} +3 -3
- package/web/dist/assets/{zoomable-image-7WyUiaVD.js → zoomable-image-BCW6ZBV0.js} +1 -1
- package/web/dist/index.html +24 -23
- package/web/dist/assets/arrow-down-Cz8qb71e.js +0 -1
- package/web/dist/assets/arrow-left-wcYKQXI_.js +0 -1
- package/web/dist/assets/centered-state-ZtnFHA-n.js +0 -43
- package/web/dist/assets/chevron-right-G4caF2QV.js +0 -1
- package/web/dist/assets/circle-check--KvBxXWp.js +0 -1
- package/web/dist/assets/circle-x-C3EFZ3xf.js +0 -1
- package/web/dist/assets/dropdown-menu-C1Dlf35P.js +0 -1
- package/web/dist/assets/editable-title-5rC_QRBZ.js +0 -1
- package/web/dist/assets/git-pull-request-agOG0iGM.js +0 -1
- package/web/dist/assets/git-toolbar-DGiNMmtY.js +0 -1
- package/web/dist/assets/github-Vp7lxYGQ.js +0 -1
- package/web/dist/assets/index-DSxyJpuK.css +0 -2
- package/web/dist/assets/index-DiawI6RX.js +0 -6
- package/web/dist/assets/new-task-form-BpAw_Dks.js +0 -1
- package/web/dist/assets/pill-Dvs-P0xy.js +0 -1
- package/web/dist/assets/prompt-templates-CSBYBR1I.js +0 -15
- package/web/dist/assets/repo-git-PmX-BNMo.js +0 -1
- package/web/dist/assets/run-header-BGiv6_qX.js +0 -1
- package/web/dist/assets/skills-CC91ouGH.js +0 -1
- package/web/dist/assets/tab-link-DIlR5T07.js +0 -1
- package/web/dist/assets/task-changes-XkHDxzQA.js +0 -1
- package/web/dist/assets/task-thread-DoNXUsHr.js +0 -9
- package/web/dist/assets/thread-loading-B8q8ukXJ.js +0 -1
- package/web/dist/assets/utils-DsLuRXwV.js +0 -64
|
@@ -36,9 +36,24 @@ export declare const workspaceConfigResponseSchema: z.ZodObject<{
|
|
|
36
36
|
maxParallel: z.ZodNumber;
|
|
37
37
|
maxMonitoringSessions: z.ZodNumber;
|
|
38
38
|
monitoringWakeIntervalMinutes: z.ZodNullable<z.ZodNumber>;
|
|
39
|
+
autoResumeOnUsageLimit: z.ZodBoolean;
|
|
39
40
|
memoryLimitMb: z.ZodNullable<z.ZodNumber>;
|
|
40
41
|
worktreeRetentionDefault: z.ZodNumber;
|
|
41
42
|
}, z.core.$strip>;
|
|
43
|
+
agentDefaults: z.ZodObject<{
|
|
44
|
+
runner: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
claude: "claude";
|
|
46
|
+
codex: "codex";
|
|
47
|
+
opencode: "opencode";
|
|
48
|
+
pi: "pi";
|
|
49
|
+
}>>;
|
|
50
|
+
models: z.ZodOptional<z.ZodObject<{
|
|
51
|
+
claude: z.ZodOptional<z.ZodString>;
|
|
52
|
+
codex: z.ZodOptional<z.ZodString>;
|
|
53
|
+
opencode: z.ZodOptional<z.ZodString>;
|
|
54
|
+
pi: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
}, z.core.$strip>;
|
|
42
57
|
}, z.core.$strip>;
|
|
43
58
|
export type WorkspaceConfigResponse = z.infer<typeof workspaceConfigResponseSchema>;
|
|
44
59
|
/**
|
|
@@ -56,10 +71,25 @@ export declare const setWorkspaceConfigInputSchema: z.ZodObject<{
|
|
|
56
71
|
autonomous: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
57
72
|
worktree: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
58
73
|
}, z.core.$strip>>;
|
|
74
|
+
agentDefaults: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
runner: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
76
|
+
claude: "claude";
|
|
77
|
+
codex: "codex";
|
|
78
|
+
opencode: "opencode";
|
|
79
|
+
pi: "pi";
|
|
80
|
+
}>>>;
|
|
81
|
+
models: z.ZodOptional<z.ZodObject<{
|
|
82
|
+
claude: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
83
|
+
codex: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
84
|
+
opencode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
85
|
+
pi: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
}, z.core.$strip>>;
|
|
59
88
|
resources: z.ZodOptional<z.ZodObject<{
|
|
60
89
|
maxParallel: z.ZodOptional<z.ZodNumber>;
|
|
61
90
|
maxMonitoringSessions: z.ZodOptional<z.ZodNumber>;
|
|
62
91
|
monitoringWakeIntervalMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
92
|
+
autoResumeOnUsageLimit: z.ZodOptional<z.ZodBoolean>;
|
|
63
93
|
memoryLimitMb: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
64
94
|
worktreeRetentionDefault: z.ZodOptional<z.ZodNumber>;
|
|
65
95
|
}, z.core.$strip>>;
|
|
@@ -116,6 +146,10 @@ export declare const uiStateSchema: z.ZodObject<{
|
|
|
116
146
|
compact: "compact";
|
|
117
147
|
ultra: "ultra";
|
|
118
148
|
}>>;
|
|
149
|
+
width: z.ZodOptional<z.ZodEnum<{
|
|
150
|
+
narrow: "narrow";
|
|
151
|
+
wide: "wide";
|
|
152
|
+
}>>;
|
|
119
153
|
}, z.core.$strip>>;
|
|
120
154
|
promptTemplates: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
121
155
|
id: z.ZodString;
|
|
@@ -149,6 +183,7 @@ export declare const workspaceUiStateSchema: z.ZodObject<{
|
|
|
149
183
|
claude: z.ZodOptional<z.ZodString>;
|
|
150
184
|
codex: z.ZodOptional<z.ZodString>;
|
|
151
185
|
opencode: z.ZodOptional<z.ZodString>;
|
|
186
|
+
pi: z.ZodOptional<z.ZodString>;
|
|
152
187
|
}, z.core.$strip>>;
|
|
153
188
|
appearance: z.ZodOptional<z.ZodObject<{
|
|
154
189
|
accent: z.ZodOptional<z.ZodEnum<{
|
|
@@ -160,10 +195,17 @@ export declare const workspaceUiStateSchema: z.ZodObject<{
|
|
|
160
195
|
compact: "compact";
|
|
161
196
|
ultra: "ultra";
|
|
162
197
|
}>>;
|
|
198
|
+
width: z.ZodOptional<z.ZodEnum<{
|
|
199
|
+
narrow: "narrow";
|
|
200
|
+
wide: "wide";
|
|
201
|
+
}>>;
|
|
163
202
|
}, z.core.$strip>>;
|
|
164
203
|
notifications: z.ZodOptional<z.ZodObject<{
|
|
165
204
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
166
205
|
}, z.core.$loose>>;
|
|
206
|
+
taskTable: z.ZodOptional<z.ZodObject<{
|
|
207
|
+
expandedColumns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
208
|
+
}, z.core.$loose>>;
|
|
167
209
|
lastLocation: z.ZodOptional<z.ZodObject<{
|
|
168
210
|
projectId: z.ZodString;
|
|
169
211
|
pathname: z.ZodString;
|
|
@@ -173,6 +215,51 @@ export declare const workspaceUiStateSchema: z.ZodObject<{
|
|
|
173
215
|
importedSkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
174
216
|
}, z.core.$loose>;
|
|
175
217
|
export type WorkspaceUiState = z.infer<typeof workspaceUiStateSchema>;
|
|
218
|
+
/**
|
|
219
|
+
* `PUT /api/v1/workspace/ui-state` body. The response remains an open, tolerant bag so data from
|
|
220
|
+
* a newer cockpit survives an older server; this write-side schema adds bounded known fields so
|
|
221
|
+
* the current cockpit cannot grow the user-owned file without limit.
|
|
222
|
+
*/
|
|
223
|
+
export declare const setWorkspaceUiStateInputSchema: z.ZodObject<{
|
|
224
|
+
appearance: z.ZodOptional<z.ZodObject<{
|
|
225
|
+
accent: z.ZodOptional<z.ZodEnum<{
|
|
226
|
+
lime: "lime";
|
|
227
|
+
violet: "violet";
|
|
228
|
+
}>>;
|
|
229
|
+
density: z.ZodOptional<z.ZodEnum<{
|
|
230
|
+
comfortable: "comfortable";
|
|
231
|
+
compact: "compact";
|
|
232
|
+
ultra: "ultra";
|
|
233
|
+
}>>;
|
|
234
|
+
width: z.ZodOptional<z.ZodEnum<{
|
|
235
|
+
narrow: "narrow";
|
|
236
|
+
wide: "wide";
|
|
237
|
+
}>>;
|
|
238
|
+
}, z.core.$strip>>;
|
|
239
|
+
notifications: z.ZodOptional<z.ZodObject<{
|
|
240
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
241
|
+
}, z.core.$loose>>;
|
|
242
|
+
lastLocation: z.ZodOptional<z.ZodObject<{
|
|
243
|
+
projectId: z.ZodString;
|
|
244
|
+
pathname: z.ZodString;
|
|
245
|
+
search: z.ZodOptional<z.ZodString>;
|
|
246
|
+
hash: z.ZodOptional<z.ZodString>;
|
|
247
|
+
}, z.core.$strict>>;
|
|
248
|
+
sidebar: z.ZodOptional<z.ZodObject<{
|
|
249
|
+
collapsed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
250
|
+
}, z.core.$loose>>;
|
|
251
|
+
dismissedProviderAuthFailures: z.ZodOptional<z.ZodObject<{
|
|
252
|
+
claude: z.ZodOptional<z.ZodString>;
|
|
253
|
+
codex: z.ZodOptional<z.ZodString>;
|
|
254
|
+
opencode: z.ZodOptional<z.ZodString>;
|
|
255
|
+
pi: z.ZodOptional<z.ZodString>;
|
|
256
|
+
}, z.core.$strict>>;
|
|
257
|
+
importedSkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
258
|
+
taskTable: z.ZodOptional<z.ZodObject<{
|
|
259
|
+
expandedColumns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
260
|
+
}, z.core.$loose>>;
|
|
261
|
+
}, z.core.$loose>;
|
|
262
|
+
export type SetWorkspaceUiStateInput = z.infer<typeof setWorkspaceUiStateInputSchema>;
|
|
176
263
|
/** Per-runner default model preset (Settings → Agents): the composer preselects this model id for
|
|
177
264
|
* the runner. Absent = auto (the runner decides). Keyed by runner name rather than derived from
|
|
178
265
|
* `runnerSchema` because the server's own `defaultModels` object (src/config.ts:92) is spelled
|
|
@@ -181,6 +268,7 @@ export declare const runnerModelsSchema: z.ZodObject<{
|
|
|
181
268
|
claude: z.ZodOptional<z.ZodString>;
|
|
182
269
|
codex: z.ZodOptional<z.ZodString>;
|
|
183
270
|
opencode: z.ZodOptional<z.ZodString>;
|
|
271
|
+
pi: z.ZodOptional<z.ZodString>;
|
|
184
272
|
}, z.core.$strip>;
|
|
185
273
|
export type RunnerModels = z.infer<typeof runnerModelsSchema>;
|
|
186
274
|
/** `GET /api/v1/config` — every Settings → Agents knob in one read. */
|
|
@@ -190,13 +278,16 @@ export declare const configResponseSchema: z.ZodObject<{
|
|
|
190
278
|
claude: "claude";
|
|
191
279
|
codex: "codex";
|
|
192
280
|
opencode: "opencode";
|
|
281
|
+
pi: "pi";
|
|
193
282
|
}>;
|
|
194
283
|
systemPrompt: z.ZodNullable<z.ZodString>;
|
|
195
284
|
defaultModels: z.ZodObject<{
|
|
196
285
|
claude: z.ZodOptional<z.ZodString>;
|
|
197
286
|
codex: z.ZodOptional<z.ZodString>;
|
|
198
287
|
opencode: z.ZodOptional<z.ZodString>;
|
|
288
|
+
pi: z.ZodOptional<z.ZodString>;
|
|
199
289
|
}, z.core.$strip>;
|
|
290
|
+
modelsLocked: z.ZodBoolean;
|
|
200
291
|
maxParallel: z.ZodNumber;
|
|
201
292
|
memoryLimitMb: z.ZodNullable<z.ZodNumber>;
|
|
202
293
|
worktreeRetention: z.ZodNumber;
|
|
@@ -211,13 +302,16 @@ export declare const setConfigResponseSchema: z.ZodObject<{
|
|
|
211
302
|
claude: "claude";
|
|
212
303
|
codex: "codex";
|
|
213
304
|
opencode: "opencode";
|
|
305
|
+
pi: "pi";
|
|
214
306
|
}>;
|
|
215
307
|
systemPrompt: z.ZodNullable<z.ZodString>;
|
|
216
308
|
defaultModels: z.ZodObject<{
|
|
217
309
|
claude: z.ZodOptional<z.ZodString>;
|
|
218
310
|
codex: z.ZodOptional<z.ZodString>;
|
|
219
311
|
opencode: z.ZodOptional<z.ZodString>;
|
|
312
|
+
pi: z.ZodOptional<z.ZodString>;
|
|
220
313
|
}, z.core.$strip>;
|
|
314
|
+
modelsLocked: z.ZodBoolean;
|
|
221
315
|
maxParallel: z.ZodNumber;
|
|
222
316
|
memoryLimitMb: z.ZodNullable<z.ZodNumber>;
|
|
223
317
|
worktreeRetention: z.ZodNumber;
|
|
@@ -238,12 +332,14 @@ export declare const setConfigInputSchema: z.ZodObject<{
|
|
|
238
332
|
claude: "claude";
|
|
239
333
|
codex: "codex";
|
|
240
334
|
opencode: "opencode";
|
|
335
|
+
pi: "pi";
|
|
241
336
|
}>>;
|
|
242
337
|
systemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
243
338
|
defaultModels: z.ZodOptional<z.ZodObject<{
|
|
244
339
|
claude: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
245
340
|
codex: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
246
341
|
opencode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
342
|
+
pi: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
247
343
|
}, z.core.$strip>>;
|
|
248
344
|
maxParallel: z.ZodOptional<z.ZodNumber>;
|
|
249
345
|
memoryLimitMb: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -329,6 +425,7 @@ export declare const providerIdSchema: z.ZodEnum<{
|
|
|
329
425
|
claude: "claude";
|
|
330
426
|
codex: "codex";
|
|
331
427
|
opencode: "opencode";
|
|
428
|
+
pi: "pi";
|
|
332
429
|
}>;
|
|
333
430
|
export type ProviderId = Runner;
|
|
334
431
|
/** Coarse host authentication state. Credentials, account identity, and raw CLI output never
|
|
@@ -352,6 +449,7 @@ export declare const providerStatusSchema: z.ZodObject<{
|
|
|
352
449
|
claude: "claude";
|
|
353
450
|
codex: "codex";
|
|
354
451
|
opencode: "opencode";
|
|
452
|
+
pi: "pi";
|
|
355
453
|
}>;
|
|
356
454
|
status: z.ZodEnum<{
|
|
357
455
|
connected: "connected";
|
|
@@ -362,6 +460,7 @@ export declare const providerStatusSchema: z.ZodObject<{
|
|
|
362
460
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
363
461
|
hint: z.ZodOptional<z.ZodString>;
|
|
364
462
|
authFailureId: z.ZodOptional<z.ZodString>;
|
|
463
|
+
profileId: z.ZodOptional<z.ZodString>;
|
|
365
464
|
}, z.core.$strip>;
|
|
366
465
|
export type ProviderStatus = z.infer<typeof providerStatusSchema>;
|
|
367
466
|
/** `GET /api/v1/providers/status`, and the answer of the enabled/retry mutators. */
|
|
@@ -371,6 +470,7 @@ export declare const providerStatusResponseSchema: z.ZodObject<{
|
|
|
371
470
|
claude: "claude";
|
|
372
471
|
codex: "codex";
|
|
373
472
|
opencode: "opencode";
|
|
473
|
+
pi: "pi";
|
|
374
474
|
}>;
|
|
375
475
|
status: z.ZodEnum<{
|
|
376
476
|
connected: "connected";
|
|
@@ -381,6 +481,7 @@ export declare const providerStatusResponseSchema: z.ZodObject<{
|
|
|
381
481
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
382
482
|
hint: z.ZodOptional<z.ZodString>;
|
|
383
483
|
authFailureId: z.ZodOptional<z.ZodString>;
|
|
484
|
+
profileId: z.ZodOptional<z.ZodString>;
|
|
384
485
|
}, z.core.$strip>>;
|
|
385
486
|
}, z.core.$strip>;
|
|
386
487
|
export type ProviderStatusResponse = z.infer<typeof providerStatusResponseSchema>;
|
|
@@ -396,19 +497,35 @@ export declare const providerConnectResponseSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
396
497
|
command: z.ZodString;
|
|
397
498
|
}, z.core.$strip>], "opened">;
|
|
398
499
|
export type ProviderConnectResponse = z.infer<typeof providerConnectResponseSchema>;
|
|
500
|
+
/**
|
|
501
|
+
* The runners whose model list is discovered from the host rather than hard-coded: Codex
|
|
502
|
+
* through its app-server protocol, OpenCode through its own `models` listing (#794). Claude has
|
|
503
|
+
* no equivalent local source, so its picker keeps static presets and `GET /api/v1/models`
|
|
504
|
+
* rejects it. One definition, used by the route's query validator and by the cockpit's picker.
|
|
505
|
+
*/
|
|
506
|
+
export declare const modelDiscoveryRunnerSchema: z.ZodEnum<{
|
|
507
|
+
codex: "codex";
|
|
508
|
+
opencode: "opencode";
|
|
509
|
+
}>;
|
|
510
|
+
export type ModelDiscoveryRunner = z.infer<typeof modelDiscoveryRunnerSchema>;
|
|
511
|
+
export declare const MODEL_DISCOVERY_RUNNERS: readonly ModelDiscoveryRunner[];
|
|
512
|
+
/** True when `runner` has a host-discovered catalog (and therefore a `/models` answer). */
|
|
513
|
+
export declare function runnerDiscoversModels(runner: Runner): runner is ModelDiscoveryRunner;
|
|
399
514
|
export declare const runnerModelOptionSchema: z.ZodObject<{
|
|
400
515
|
id: z.ZodString;
|
|
401
516
|
label: z.ZodString;
|
|
402
517
|
description: z.ZodString;
|
|
403
518
|
}, z.core.$strip>;
|
|
404
519
|
export type RunnerModelOption = z.infer<typeof runnerModelOptionSchema>;
|
|
405
|
-
/** `GET /api/v1/models?runner=codex` —
|
|
406
|
-
*
|
|
520
|
+
/** `GET /api/v1/models?runner=codex|opencode` — the models discovered from that runner's own
|
|
521
|
+
* host installation, plus how fresh the answer is. Never an error: an unavailable CLI degrades
|
|
522
|
+
* to `source: 'unavailable'` with a `reason`. Claude has no host-local catalog and is rejected. */
|
|
407
523
|
export declare const runnerModelCatalogResponseSchema: z.ZodObject<{
|
|
408
524
|
runner: z.ZodEnum<{
|
|
409
525
|
claude: "claude";
|
|
410
526
|
codex: "codex";
|
|
411
527
|
opencode: "opencode";
|
|
528
|
+
pi: "pi";
|
|
412
529
|
}>;
|
|
413
530
|
models: z.ZodArray<z.ZodObject<{
|
|
414
531
|
id: z.ZodString;
|
|
@@ -440,3 +557,21 @@ export declare const openTargetsResponseSchema: z.ZodObject<{
|
|
|
440
557
|
}, z.core.$strip>>;
|
|
441
558
|
}, z.core.$strip>;
|
|
442
559
|
export type OpenTargetsResponse = z.infer<typeof openTargetsResponseSchema>;
|
|
560
|
+
/**
|
|
561
|
+
* `POST /api/v1/open-in` — open THIS PROJECT'S root in a detected app (Settings → the project
|
|
562
|
+
* folder row). The path is never sent: it is the scoped project's own registered root, resolved
|
|
563
|
+
* server-side, so the route has no traversal surface at all. `target` is an
|
|
564
|
+
* `/api/v1/open-targets` id; unlike the run route there is no `default`/`cli:` handling, because
|
|
565
|
+
* a repo root is a directory and an agent CLI belongs in a task worktree.
|
|
566
|
+
*/
|
|
567
|
+
export declare const openProjectInSchema: z.ZodObject<{
|
|
568
|
+
target: z.ZodString;
|
|
569
|
+
}, z.core.$strip>;
|
|
570
|
+
export type OpenProjectInRequest = z.infer<typeof openProjectInSchema>;
|
|
571
|
+
/** The 200 for the above — `opened` is a literal because every failure is a 409 with `{ error }`,
|
|
572
|
+
* so a `false` would be unreachable and would only invite a client to branch on it. */
|
|
573
|
+
export declare const openProjectInResponseSchema: z.ZodObject<{
|
|
574
|
+
opened: z.ZodLiteral<true>;
|
|
575
|
+
path: z.ZodString;
|
|
576
|
+
}, z.core.$strip>;
|
|
577
|
+
export type OpenProjectInResponse = z.infer<typeof openProjectInResponseSchema>;
|
package/dist/core/agent-env.js
CHANGED
|
@@ -192,26 +192,36 @@ const BASE_ALLOW_PREFIXES = [
|
|
|
192
192
|
'MISE_',
|
|
193
193
|
'COMPOSER_',
|
|
194
194
|
];
|
|
195
|
+
/** The provider credentials a backend that selects models as `provider/model` may need — it can
|
|
196
|
+
* be pointed at any of them, so none can be pruned without breaking a legitimate model id. */
|
|
197
|
+
const MULTI_PROVIDER_PREFIXES = [
|
|
198
|
+
'OPENAI_',
|
|
199
|
+
'ANTHROPIC_',
|
|
200
|
+
'AZURE_OPENAI_',
|
|
201
|
+
'OPENROUTER_',
|
|
202
|
+
'GROQ_',
|
|
203
|
+
'MISTRAL_',
|
|
204
|
+
'GEMINI_',
|
|
205
|
+
'GOOGLE_GENERATIVE_AI_',
|
|
206
|
+
'DEEPSEEK_',
|
|
207
|
+
'XAI_',
|
|
208
|
+
'PERPLEXITY_',
|
|
209
|
+
'TOGETHER_',
|
|
210
|
+
'FIREWORKS_',
|
|
211
|
+
];
|
|
195
212
|
/** Per-backend auth/config the runner genuinely needs, by prefix. */
|
|
196
213
|
const BACKEND_ALLOW_PREFIXES = {
|
|
197
214
|
claude: ['ANTHROPIC_', 'CLAUDE_'],
|
|
198
215
|
'claude-cli': ['ANTHROPIC_', 'CLAUDE_'],
|
|
199
216
|
codex: ['OPENAI_', 'CODEX_', 'AZURE_OPENAI_'],
|
|
200
|
-
opencode:
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
'GOOGLE_GENERATIVE_AI_',
|
|
209
|
-
'DEEPSEEK_',
|
|
210
|
-
'XAI_',
|
|
211
|
-
'PERPLEXITY_',
|
|
212
|
-
'TOGETHER_',
|
|
213
|
-
'FIREWORKS_',
|
|
214
|
-
],
|
|
217
|
+
opencode: MULTI_PROVIDER_PREFIXES,
|
|
218
|
+
// pi selects models as `provider/model` (#387), so it needs both its own config and any
|
|
219
|
+
// provider a configured model id can name — the same set OpenCode gets, for the same reason.
|
|
220
|
+
// Deliberately NOT `CLAUDE_`: pi is not Claude Code and reads none of its variables, and the
|
|
221
|
+
// prefix is load-bearing below — it is what unlocks the Bedrock/Vertex cloud credentials, so
|
|
222
|
+
// granting it here handed pi the whole `AWS_*` / `GOOGLE_CLOUD_*` family on any host that had
|
|
223
|
+
// set `CLAUDE_CODE_USE_BEDROCK=1` for Claude Code, plus Claude's own config dir.
|
|
224
|
+
pi: ['PI_', ...MULTI_PROVIDER_PREFIXES],
|
|
215
225
|
};
|
|
216
226
|
/** `gh` handoff (draft PRs) works in every backend — the one credential the
|
|
217
227
|
* project deliberately keeps in the environment (AGENTS.md "No secrets in
|
|
@@ -278,12 +288,25 @@ function isTruthy(value) {
|
|
|
278
288
|
export function buildChildEnv(opts) {
|
|
279
289
|
const source = opts.source ?? process.env;
|
|
280
290
|
const extra = opts.extraEnv ?? {};
|
|
291
|
+
// Names `extra` is about to define, normalized. The host copy of a var the
|
|
292
|
+
// per-run env overrides must be DROPPED, not merely shadowed: env names are
|
|
293
|
+
// matched case-insensitively here (and by Windows itself), so a host `Temp`
|
|
294
|
+
// and a per-run `TEMP` are the same variable spelled two ways — leaving both
|
|
295
|
+
// in the child env hands the backend the host value under one of them. That
|
|
296
|
+
// is exactly the temp-directory bug #785 fixes, so the override has to be
|
|
297
|
+
// total. `extra` is cezar's own, never a host secret, and always wins.
|
|
298
|
+
const overridden = upperSet(Object.keys(extra));
|
|
281
299
|
// Escape hatch: restore legacy full-inheritance (opt-in, off by default).
|
|
282
300
|
// Parsed with the same `isTruthy` the Bedrock/Vertex toggles use (#456
|
|
283
301
|
// review) — an exact `=== '1'` made `CEZ_AGENT_ENV_FULL=true` silently do
|
|
284
302
|
// nothing, which is a confusing way to fail open-vs-closed.
|
|
285
303
|
if (isTruthy(readVar(source, 'CEZ_AGENT_ENV_FULL'))) {
|
|
286
|
-
|
|
304
|
+
const full = {};
|
|
305
|
+
for (const [name, value] of Object.entries(source)) {
|
|
306
|
+
if (!overridden.has(name.toUpperCase()))
|
|
307
|
+
full[name] = value;
|
|
308
|
+
}
|
|
309
|
+
return { ...full, ...extra };
|
|
287
310
|
}
|
|
288
311
|
const backendPrefixes = BACKEND_ALLOW_PREFIXES[opts.backend] ?? BACKEND_ALLOW_PREFIXES.claude;
|
|
289
312
|
const passthrough = upperSet((readVar(source, 'CEZ_ENV_PASSTHROUGH') ?? '')
|
|
@@ -307,6 +330,8 @@ export function buildChildEnv(opts) {
|
|
|
307
330
|
for (const [name, value] of Object.entries(source)) {
|
|
308
331
|
if (value === undefined)
|
|
309
332
|
continue;
|
|
333
|
+
if (overridden.has(name.toUpperCase()))
|
|
334
|
+
continue; // the per-run value replaces it, whatever the spelling
|
|
310
335
|
if (allow(name))
|
|
311
336
|
out[name] = value;
|
|
312
337
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-env.js","sourceRoot":"","sources":["../../src/core/agent-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;GAOG;AACH,SAAS,QAAQ,CAAC,KAAwB;IACxC,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,6EAA6E;AAC7E,MAAM,gBAAgB,GAAwB,QAAQ,CAAC;IACrD,gCAAgC;IAChC,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,SAAS;IACT,OAAO;IACP,KAAK;IACL,QAAQ;IACR,OAAO;IACP,UAAU;IACV,MAAM;IACN,UAAU;IACV,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,KAAK;IACL,IAAI;IACJ,SAAS;IACT,MAAM;IACN,UAAU;IACV,qBAAqB;IACrB,MAAM;IACN,UAAU;IACV,WAAW;IACX,SAAS;IACT,OAAO;IACP,UAAU;IACV,aAAa;IACb,UAAU;IACV,SAAS;IACT,iBAAiB;IACjB,YAAY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AS;IACT,WAAW;IACX,aAAa;IACb,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,aAAa;IACb,yBAAyB;IACzB,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,SAAS;IACT,UAAU;IACV,SAAS;IACT,eAAe;IACf,SAAS;IACT,QAAQ;IACR,OAAO;IACP,OAAO;IACP,WAAW;IACX,OAAO;IACP,OAAO;IACP,WAAW;CACZ,CAAC;AAEF,qEAAqE;AACrE,MAAM,sBAAsB,GAA4C;IACtE,MAAM,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC;IACjC,YAAY,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC;IACvC,KAAK,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,eAAe,CAAC;IAC7C,QAAQ,EAAE
|
|
1
|
+
{"version":3,"file":"agent-env.js","sourceRoot":"","sources":["../../src/core/agent-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;GAOG;AACH,SAAS,QAAQ,CAAC,KAAwB;IACxC,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,6EAA6E;AAC7E,MAAM,gBAAgB,GAAwB,QAAQ,CAAC;IACrD,gCAAgC;IAChC,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,SAAS;IACT,OAAO;IACP,KAAK;IACL,QAAQ;IACR,OAAO;IACP,UAAU;IACV,MAAM;IACN,UAAU;IACV,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,KAAK;IACL,IAAI;IACJ,SAAS;IACT,MAAM;IACN,UAAU;IACV,qBAAqB;IACrB,MAAM;IACN,UAAU;IACV,WAAW;IACX,SAAS;IACT,OAAO;IACP,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AAC;QACxC,uEAAuE;QACvE,4EAA4E;QAC5E,qEAAqE;QACrE,wDAAwD;QACxD,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACzC,IAAI,aAAa,CAAC,GAAG,EAAE,eAAe,CAAC;YAAE,OAAO,IAAI,CAAC;QACrD,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,GAAG,EAAE,aAAa,CAAC;YAAE,OAAO,IAAI,CAAC;QAC1E,+BAA+B;QAC/B,IAAI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,0EAA0E;QAC1E,uEAAuE;QACvE,uEAAuE;QACvE,IAAI,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAC3C,IAAI,aAAa,CAAC,GAAG,EAAE,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAC9E,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The server-side switch that makes native agent settings authoritative. */
|
|
2
|
+
export declare const AGENT_MODELS_LOCKED_ENV = "CEZ_AGENT_MODELS_LOCKED";
|
|
3
|
+
/**
|
|
4
|
+
* Only the exact environment value `1` enables the process-wide lock. The
|
|
5
|
+
* global workspace config or one repository may additionally opt in with
|
|
6
|
+
* `"modelsLocked": true`; missing, unreadable, malformed, and false values
|
|
7
|
+
* preserve ordinary model selection unless another source enables the lock.
|
|
8
|
+
*/
|
|
9
|
+
export declare function agentModelsLocked(repoRoot?: string, env?: NodeJS.ProcessEnv): boolean;
|
|
10
|
+
export declare const AGENT_MODELS_LOCKED_ERROR = "agent models are locked \u2014 configure the model in the native coding-agent settings";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { workspaceConfigPath } from '../paths.js';
|
|
5
|
+
/** The server-side switch that makes native agent settings authoritative. */
|
|
6
|
+
export const AGENT_MODELS_LOCKED_ENV = 'CEZ_AGENT_MODELS_LOCKED';
|
|
7
|
+
const modelPolicyConfigSchema = z.object({
|
|
8
|
+
modelsLocked: z.boolean().optional(),
|
|
9
|
+
}).passthrough();
|
|
10
|
+
/**
|
|
11
|
+
* Only the exact environment value `1` enables the process-wide lock. The
|
|
12
|
+
* global workspace config or one repository may additionally opt in with
|
|
13
|
+
* `"modelsLocked": true`; missing, unreadable, malformed, and false values
|
|
14
|
+
* preserve ordinary model selection unless another source enables the lock.
|
|
15
|
+
*/
|
|
16
|
+
export function agentModelsLocked(repoRoot, env = process.env) {
|
|
17
|
+
if (env[AGENT_MODELS_LOCKED_ENV] === '1')
|
|
18
|
+
return true;
|
|
19
|
+
const paths = [
|
|
20
|
+
workspaceConfigPath(env),
|
|
21
|
+
...(repoRoot ? [join(repoRoot, '.ai', 'cezar', 'config.json')] : []),
|
|
22
|
+
];
|
|
23
|
+
for (const path of paths) {
|
|
24
|
+
try {
|
|
25
|
+
const parsed = modelPolicyConfigSchema.safeParse(JSON.parse(readFileSync(path, 'utf8')));
|
|
26
|
+
if (parsed.success && parsed.data.modelsLocked === true)
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// Each source is optional and independently degradable.
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
export const AGENT_MODELS_LOCKED_ERROR = 'agent models are locked — configure the model in the native coding-agent settings';
|
|
36
|
+
//# sourceMappingURL=agent-model-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-model-policy.js","sourceRoot":"","sources":["../../src/core/agent-model-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MA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+1,62 @@
|
|
|
1
|
+
import type { ProviderId } from './provider-auth.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Agent profiles — a second (third, …) login of the SAME agent CLI.
|
|
4
|
+
*
|
|
5
|
+
* The binary never changes; only the environment does. `CLAUDE_CONFIG_DIR=~/.claude-klaudiusz claude`
|
|
6
|
+
* is the same Claude Code talking to a different account, because that one variable relocates the
|
|
7
|
+
* agent's ENTIRE per-user home: credentials, settings, projects and — the part that bites —
|
|
8
|
+
* `sessions/`, so a session id only means something inside the dir it was created in.
|
|
9
|
+
*
|
|
10
|
+
* This module is the single maintenance surface for that vendor knowledge, and it is deliberately
|
|
11
|
+
* the SIBLING of `src/agent-config/catalog.ts` rather than part of it: the catalog owns config
|
|
12
|
+
* *file* knowledge (paths, formats, verbatim precedence strings), this owns the *home-relocation*
|
|
13
|
+
* variable. Splitting them also keeps the layering honest — `agent-config/` may import `paths.ts`,
|
|
14
|
+
* while this is imported BY the runners, provider auth and the terminal handoff.
|
|
15
|
+
*
|
|
16
|
+
* Pure by construction: no filesystem, no `process.env`, nothing to stub. Resolution against the
|
|
17
|
+
* workspace config lives in `src/workspace/agent-profiles.ts`.
|
|
18
|
+
*
|
|
19
|
+
* Facts verified against the shipped CLIs on 2026-07-29.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Which env var relocates each agent's whole per-user home.
|
|
23
|
+
*
|
|
24
|
+
* `null` means the agent has no such variable and therefore cannot carry profiles:
|
|
25
|
+
*
|
|
26
|
+
* - **claude** → `CLAUDE_CONFIG_DIR`. Documented; moves credentials, settings, projects, sessions.
|
|
27
|
+
* - **codex** → `CODEX_HOME`. Documented; `auth.json` lives inside it, so identity moves too.
|
|
28
|
+
* - **opencode** → nothing usable. `OPENCODE_CONFIG_DIR`/`OPENCODE_CONFIG` move CONFIG ONLY;
|
|
29
|
+
* credentials live in `~/.local/share/opencode/opencode.db`, behind a separate `OPENCODE_DB`.
|
|
30
|
+
* A config-dir-only profile would swap settings while still billing the other account — the UI
|
|
31
|
+
* would say "Work" and the run would not be — so OpenCode is unsupported until it documents a
|
|
32
|
+
* single home variable. `XDG_CONFIG_HOME` is rejected regardless: it is machine-wide and would
|
|
33
|
+
* relocate every other XDG-aware tool the agent's own Bash calls touch.
|
|
34
|
+
* - **pi** → nothing documented. pi ships no per-user home variable of its own, so — exactly like
|
|
35
|
+
* OpenCode — a second account cannot be carried without silently billing the wrong one. `null`
|
|
36
|
+
* until pi documents a single home variable that moves credentials as well as config.
|
|
37
|
+
*/
|
|
38
|
+
export declare const PROFILE_ENV_VAR: Record<ProviderId, string | null>;
|
|
39
|
+
/** Providers that can carry more than one account — what the UI offers "Add account" for. */
|
|
40
|
+
export declare const PROFILE_CAPABLE_PROVIDERS: readonly ProviderId[];
|
|
41
|
+
export declare function supportsProfiles(provider: ProviderId): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The env a spawned agent needs to run under `configDir`, or `{}` for the default profile.
|
|
44
|
+
*
|
|
45
|
+
* `{}` is load-bearing, not a convenience: `buildChildEnv` applies `extraEnv` AFTER its allowlist
|
|
46
|
+
* and so bypasses it entirely, which makes this function the only thing standing between a
|
|
47
|
+
* profile and the child environment. Returning nothing for the zero-config case means the
|
|
48
|
+
* overwhelmingly common path adds literally no variable — the same environment cezar has always
|
|
49
|
+
* spawned. It also means this can never emit one provider's variable for another provider's
|
|
50
|
+
* process: the name comes from `PROFILE_ENV_VAR[provider]` and nowhere else.
|
|
51
|
+
*/
|
|
52
|
+
export declare function profileEnv(provider: ProviderId, configDir: string | null | undefined): Record<string, string>;
|
|
53
|
+
/**
|
|
54
|
+
* Does `entries` look like a config dir this provider actually wrote?
|
|
55
|
+
*
|
|
56
|
+
* ADVISORY, never a gate. The honest first-run flow for a second account is *add the profile →
|
|
57
|
+
* Connect → the CLI creates the dir on login*, so refusing an unrecognized directory would break
|
|
58
|
+
* the very case the feature exists for. The answer drives a warning line in the UI, nothing more.
|
|
59
|
+
*
|
|
60
|
+
* Takes the directory listing rather than a path so it stays pure; the caller reads the dir.
|
|
61
|
+
*/
|
|
62
|
+
export declare function looksLikeProfileDir(provider: ProviderId, entries: readonly string[]): boolean;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent profiles — a second (third, …) login of the SAME agent CLI.
|
|
3
|
+
*
|
|
4
|
+
* The binary never changes; only the environment does. `CLAUDE_CONFIG_DIR=~/.claude-klaudiusz claude`
|
|
5
|
+
* is the same Claude Code talking to a different account, because that one variable relocates the
|
|
6
|
+
* agent's ENTIRE per-user home: credentials, settings, projects and — the part that bites —
|
|
7
|
+
* `sessions/`, so a session id only means something inside the dir it was created in.
|
|
8
|
+
*
|
|
9
|
+
* This module is the single maintenance surface for that vendor knowledge, and it is deliberately
|
|
10
|
+
* the SIBLING of `src/agent-config/catalog.ts` rather than part of it: the catalog owns config
|
|
11
|
+
* *file* knowledge (paths, formats, verbatim precedence strings), this owns the *home-relocation*
|
|
12
|
+
* variable. Splitting them also keeps the layering honest — `agent-config/` may import `paths.ts`,
|
|
13
|
+
* while this is imported BY the runners, provider auth and the terminal handoff.
|
|
14
|
+
*
|
|
15
|
+
* Pure by construction: no filesystem, no `process.env`, nothing to stub. Resolution against the
|
|
16
|
+
* workspace config lives in `src/workspace/agent-profiles.ts`.
|
|
17
|
+
*
|
|
18
|
+
* Facts verified against the shipped CLIs on 2026-07-29.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Which env var relocates each agent's whole per-user home.
|
|
22
|
+
*
|
|
23
|
+
* `null` means the agent has no such variable and therefore cannot carry profiles:
|
|
24
|
+
*
|
|
25
|
+
* - **claude** → `CLAUDE_CONFIG_DIR`. Documented; moves credentials, settings, projects, sessions.
|
|
26
|
+
* - **codex** → `CODEX_HOME`. Documented; `auth.json` lives inside it, so identity moves too.
|
|
27
|
+
* - **opencode** → nothing usable. `OPENCODE_CONFIG_DIR`/`OPENCODE_CONFIG` move CONFIG ONLY;
|
|
28
|
+
* credentials live in `~/.local/share/opencode/opencode.db`, behind a separate `OPENCODE_DB`.
|
|
29
|
+
* A config-dir-only profile would swap settings while still billing the other account — the UI
|
|
30
|
+
* would say "Work" and the run would not be — so OpenCode is unsupported until it documents a
|
|
31
|
+
* single home variable. `XDG_CONFIG_HOME` is rejected regardless: it is machine-wide and would
|
|
32
|
+
* relocate every other XDG-aware tool the agent's own Bash calls touch.
|
|
33
|
+
* - **pi** → nothing documented. pi ships no per-user home variable of its own, so — exactly like
|
|
34
|
+
* OpenCode — a second account cannot be carried without silently billing the wrong one. `null`
|
|
35
|
+
* until pi documents a single home variable that moves credentials as well as config.
|
|
36
|
+
*/
|
|
37
|
+
export const PROFILE_ENV_VAR = {
|
|
38
|
+
claude: 'CLAUDE_CONFIG_DIR',
|
|
39
|
+
codex: 'CODEX_HOME',
|
|
40
|
+
opencode: null,
|
|
41
|
+
pi: null,
|
|
42
|
+
};
|
|
43
|
+
/** Providers that can carry more than one account — what the UI offers "Add account" for. */
|
|
44
|
+
export const PROFILE_CAPABLE_PROVIDERS = Object.keys(PROFILE_ENV_VAR).filter((provider) => PROFILE_ENV_VAR[provider] !== null);
|
|
45
|
+
export function supportsProfiles(provider) {
|
|
46
|
+
return PROFILE_ENV_VAR[provider] !== null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The env a spawned agent needs to run under `configDir`, or `{}` for the default profile.
|
|
50
|
+
*
|
|
51
|
+
* `{}` is load-bearing, not a convenience: `buildChildEnv` applies `extraEnv` AFTER its allowlist
|
|
52
|
+
* and so bypasses it entirely, which makes this function the only thing standing between a
|
|
53
|
+
* profile and the child environment. Returning nothing for the zero-config case means the
|
|
54
|
+
* overwhelmingly common path adds literally no variable — the same environment cezar has always
|
|
55
|
+
* spawned. It also means this can never emit one provider's variable for another provider's
|
|
56
|
+
* process: the name comes from `PROFILE_ENV_VAR[provider]` and nowhere else.
|
|
57
|
+
*/
|
|
58
|
+
export function profileEnv(provider, configDir) {
|
|
59
|
+
const name = PROFILE_ENV_VAR[provider];
|
|
60
|
+
const dir = configDir?.trim();
|
|
61
|
+
if (name === null || !dir)
|
|
62
|
+
return {};
|
|
63
|
+
return { [name]: dir };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Does `entries` look like a config dir this provider actually wrote?
|
|
67
|
+
*
|
|
68
|
+
* ADVISORY, never a gate. The honest first-run flow for a second account is *add the profile →
|
|
69
|
+
* Connect → the CLI creates the dir on login*, so refusing an unrecognized directory would break
|
|
70
|
+
* the very case the feature exists for. The answer drives a warning line in the UI, nothing more.
|
|
71
|
+
*
|
|
72
|
+
* Takes the directory listing rather than a path so it stays pure; the caller reads the dir.
|
|
73
|
+
*/
|
|
74
|
+
export function looksLikeProfileDir(provider, entries) {
|
|
75
|
+
const present = new Set(entries);
|
|
76
|
+
const markers = PROFILE_DIR_MARKERS[provider];
|
|
77
|
+
return markers.some((marker) => present.has(marker));
|
|
78
|
+
}
|
|
79
|
+
/** What each agent drops into its home on first login. Any one is enough. */
|
|
80
|
+
const PROFILE_DIR_MARKERS = {
|
|
81
|
+
// `.claude.json` sits INSIDE the dir once it is overridden (see `claudeStateFilePath`), which
|
|
82
|
+
// is exactly the case being probed here.
|
|
83
|
+
claude: ['.claude.json', 'settings.json', 'projects', 'sessions'],
|
|
84
|
+
codex: ['auth.json', 'config.toml'],
|
|
85
|
+
opencode: [],
|
|
86
|
+
// pi cannot carry profiles (`PROFILE_ENV_VAR.pi === null`), so nothing ever probes a pi
|
|
87
|
+
// profile dir; the entry exists to keep this table exhaustive over `ProviderId`.
|
|
88
|
+
pi: [],
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=agent-profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-profiles.js","sourceRoot":"","sources":["../../src/core/agent-profiles.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,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