codedeck 0.2.0 → 0.4.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.
Files changed (125) hide show
  1. package/README.md +45 -16
  2. package/dist/cli/charts/bar-chart.js +104 -0
  3. package/dist/cli/charts/bar-chart.js.map +1 -0
  4. package/dist/cli/charts/sparkline.js +18 -0
  5. package/dist/cli/charts/sparkline.js.map +1 -0
  6. package/dist/cli/charts/stacked-bar.js +59 -0
  7. package/dist/cli/charts/stacked-bar.js.map +1 -0
  8. package/dist/cli/cli-name.js +20 -0
  9. package/dist/cli/cli-name.js.map +1 -0
  10. package/dist/cli/commands/claims.js +170 -0
  11. package/dist/cli/commands/claims.js.map +1 -0
  12. package/dist/cli/commands/doctor.js +22 -1
  13. package/dist/cli/commands/doctor.js.map +1 -1
  14. package/dist/cli/commands/models.js +5 -5
  15. package/dist/cli/commands/models.js.map +1 -1
  16. package/dist/cli/commands/open.js +309 -315
  17. package/dist/cli/commands/open.js.map +1 -1
  18. package/dist/cli/commands/ps.js +226 -23
  19. package/dist/cli/commands/ps.js.map +1 -1
  20. package/dist/cli/commands/rename.js +29 -0
  21. package/dist/cli/commands/rename.js.map +1 -0
  22. package/dist/cli/commands/run.js +50 -18
  23. package/dist/cli/commands/run.js.map +1 -1
  24. package/dist/cli/commands/setup.js +989 -72
  25. package/dist/cli/commands/setup.js.map +1 -1
  26. package/dist/cli/commands/usage.js +192 -0
  27. package/dist/cli/commands/usage.js.map +1 -0
  28. package/dist/cli/commands/wait.js +3 -2
  29. package/dist/cli/commands/wait.js.map +1 -1
  30. package/dist/cli/commands/web.js +224 -0
  31. package/dist/cli/commands/web.js.map +1 -0
  32. package/dist/cli/index.js +36 -21
  33. package/dist/cli/index.js.map +1 -1
  34. package/dist/cli/picker-state.js +75 -8
  35. package/dist/cli/picker-state.js.map +1 -1
  36. package/dist/cli/picker.js +13 -3
  37. package/dist/cli/picker.js.map +1 -1
  38. package/dist/cli/ui.js +54 -4
  39. package/dist/cli/ui.js.map +1 -1
  40. package/dist/cli/usage/dashboard.js +330 -0
  41. package/dist/cli/usage/dashboard.js.map +1 -0
  42. package/dist/cli/usage/snapshot.js +112 -0
  43. package/dist/cli/usage/snapshot.js.map +1 -0
  44. package/dist/config/config.js +326 -5
  45. package/dist/config/config.js.map +1 -1
  46. package/dist/config/orchestrator-mode.js +72 -0
  47. package/dist/config/orchestrator-mode.js.map +1 -0
  48. package/dist/config/paths.js +28 -9
  49. package/dist/config/paths.js.map +1 -1
  50. package/dist/core/autocompact.js +77 -0
  51. package/dist/core/autocompact.js.map +1 -0
  52. package/dist/core/driver.js.map +1 -1
  53. package/dist/core/models.js +166 -3
  54. package/dist/core/models.js.map +1 -1
  55. package/dist/core/pricing.js +83 -0
  56. package/dist/core/pricing.js.map +1 -0
  57. package/dist/core/roles.js +14 -3
  58. package/dist/core/roles.js.map +1 -1
  59. package/dist/core/run-usage.js +46 -0
  60. package/dist/core/run-usage.js.map +1 -0
  61. package/dist/core/session.js +18 -0
  62. package/dist/core/session.js.map +1 -1
  63. package/dist/daemon/daemon.js +286 -8
  64. package/dist/daemon/daemon.js.map +1 -1
  65. package/dist/daemon/ipc.js +10 -3
  66. package/dist/daemon/ipc.js.map +1 -1
  67. package/dist/drivers/antigravity/driver.js +158 -0
  68. package/dist/drivers/antigravity/driver.js.map +1 -0
  69. package/dist/drivers/antigravity/parser.js +168 -0
  70. package/dist/drivers/antigravity/parser.js.map +1 -0
  71. package/dist/drivers/claude/driver.js +13 -3
  72. package/dist/drivers/claude/driver.js.map +1 -1
  73. package/dist/drivers/opencode/driver.js +1 -114
  74. package/dist/drivers/opencode/driver.js.map +1 -1
  75. package/dist/drivers/opencode/parser.js +86 -0
  76. package/dist/drivers/opencode/parser.js.map +1 -0
  77. package/dist/drivers/registry.js +2 -0
  78. package/dist/drivers/registry.js.map +1 -1
  79. package/dist/drivers/session-driver.js +6 -4
  80. package/dist/drivers/session-driver.js.map +1 -1
  81. package/dist/drivers/session-runtime.js +1 -0
  82. package/dist/drivers/session-runtime.js.map +1 -1
  83. package/dist/git/worktree.js +1 -1
  84. package/dist/git/worktree.js.map +1 -1
  85. package/dist/open/contract.js +116 -0
  86. package/dist/open/contract.js.map +1 -0
  87. package/dist/open/injection.js +60 -0
  88. package/dist/open/injection.js.map +1 -0
  89. package/dist/open/launchers/claude.js +215 -0
  90. package/dist/open/launchers/claude.js.map +1 -0
  91. package/dist/open/launchers/opencode.js +213 -0
  92. package/dist/open/launchers/opencode.js.map +1 -0
  93. package/dist/open/orchestrator-prose.js +12 -0
  94. package/dist/open/orchestrator-prose.js.map +1 -0
  95. package/dist/open/pty.js +281 -0
  96. package/dist/open/pty.js.map +1 -0
  97. package/dist/open/runtime.js +632 -0
  98. package/dist/open/runtime.js.map +1 -0
  99. package/dist/plugin/agents/auditor.md +7 -1
  100. package/dist/plugin/agents/general.md +12 -1
  101. package/dist/plugin/agents/orchestrator-edit.md +67 -0
  102. package/dist/plugin/agents/orchestrator-read.md +67 -0
  103. package/dist/plugin/agents/orchestrator.md +74 -17
  104. package/dist/plugin/agents/reviewer.md +3 -0
  105. package/dist/plugin/commands/autonomous.md +58 -0
  106. package/dist/plugin/hooks/hooks.json +24 -0
  107. package/dist/plugin/hooks/session-id.sh +23 -0
  108. package/dist/plugin/hooks/session-name-lib.mjs +40 -0
  109. package/dist/plugin/hooks/session-name-worker.mjs +124 -0
  110. package/dist/plugin/hooks/session-name.mjs +66 -0
  111. package/dist/plugin/hooks/session-name.sh +7 -0
  112. package/dist/plugin/pty-shim.mjs +114 -0
  113. package/dist/plugin/statusline.sh +214 -22
  114. package/dist/plugin/themes/codedeck-rage.json +74 -0
  115. package/dist/plugin/themes/codedeck-ultra.json +52 -44
  116. package/dist/store/claims.js +152 -0
  117. package/dist/store/claims.js.map +1 -0
  118. package/dist/store/database.js +50 -15
  119. package/dist/store/database.js.map +1 -1
  120. package/dist/store/sessions.js +234 -3
  121. package/dist/store/sessions.js.map +1 -1
  122. package/dist/web/canvas-page.js +921 -0
  123. package/dist/web/canvas-page.js.map +1 -0
  124. package/package.json +3 -2
  125. package/dist/plugin/settings.json +0 -7
@@ -0,0 +1,215 @@
1
+ import { execFile } from "node:child_process";
2
+ import path from "node:path";
3
+ import { promisify } from "node:util";
4
+ import { DISPATCHER_PRESET } from "../../config/orchestrator-mode.js";
5
+ import { detectBinary } from "../../drivers/helpers.js";
6
+ import { getRegistry } from "../../drivers/registry.js";
7
+ import { autocompactArgs } from "../../core/autocompact.js";
8
+ import { getCachedOrDiscoverModels } from "../../core/models.js";
9
+ import { catalogWarning, judgeModelIn, readUltra } from "../contract.js";
10
+ import { composeOrchestratorProse } from "../orchestrator-prose.js";
11
+ import { errorDetails, sanitizeEnv, shellQuote, spinnerTips, SPINNER_VERBS, } from "../runtime.js";
12
+ export const DEFAULT_MODEL = "claude-opus-4-8";
13
+ export const DEFAULT_EFFORT = "xhigh";
14
+ const PLUGIN_NAME = "codedeck";
15
+ const THEME_REF = `custom:${PLUGIN_NAME}:codedeck-ultra`;
16
+ /**
17
+ * There is no startup text slot worth using, and the two that exist were tried.
18
+ *
19
+ * `companyAnnouncements` renders our string, but Claude Code puts its own dim
20
+ * "Message from <organization>:" above it whenever the account belongs to one,
21
+ * with no way to suppress that from settings. On an account with an org it
22
+ * therefore reads as a message from the employer, which is false.
23
+ *
24
+ * A SessionStart hook can print, but every hook message renders as
25
+ * "<hook> says: <text>", so it cannot draw a clean line either.
26
+ *
27
+ * Nothing is lost by leaving both alone. Claude Code's own opening header
28
+ * already names the model, the effort and the agent, and the footer already
29
+ * says whether permissions are bypassed.
30
+ */
31
+ export const CLAUDE_NOT_FOUND = "Claude Code was not found on PATH. Install Claude Code and ensure `claude` is available.";
32
+ const execFileAsync = promisify(execFile);
33
+ /**
34
+ * The settings are built here, at launch, rather than shipped as a file, and
35
+ * the reason is the status line.
36
+ *
37
+ * `${CLAUDE_PLUGIN_ROOT}` is expanded only for hooks declared in a plugin's
38
+ * hooks/hooks.json. It is never expanded for statusLine.command: the runner
39
+ * calls its executor with nine arguments where the plugin root sits in the
40
+ * fourteenth, so the check reads undefined and throws "This variable is only
41
+ * available in hooks defined in a plugin's hooks/hooks.json file". The runner
42
+ * swallows that, so the shipped settings.json produced no status line and no
43
+ * error, in any version. `open` knows the real directory, so it writes the
44
+ * resolved path instead of a placeholder nothing will substitute.
45
+ *
46
+ * Building it here also means one definition rather than two: the file that
47
+ * shipped alongside this code was never exercised by a launch, which is exactly
48
+ * how a broken command sat in it unnoticed.
49
+ */
50
+ export function buildSettings(pluginDir, flags) {
51
+ const statusLine = {
52
+ type: "command",
53
+ command: `bash ${shellQuote(path.join(pluginDir, "statusline.sh"))}`,
54
+ refreshInterval: 2,
55
+ };
56
+ // --no-theme means "do not restyle my session", so it drops the whole look,
57
+ // renderer included, and not just the palette. The status line is the one
58
+ // thing it keeps, because that is what the flag has always promised.
59
+ if (flags.theme === false)
60
+ return { statusLine };
61
+ return {
62
+ theme: THEME_REF,
63
+ tui: "fullscreen",
64
+ spinnerVerbs: { mode: "replace", verbs: SPINNER_VERBS },
65
+ spinnerTipsOverride: { excludeDefault: true, label: "ULTRA", tips: spinnerTips() },
66
+ statusLine,
67
+ };
68
+ }
69
+ /**
70
+ * The session name is what Claude shows on the ruler above the input, in
71
+ * `/resume` and in the window title, so it carries the project folder along
72
+ * with the role. With three terminals open on the same role, the role alone
73
+ * leaves them indistinguishable. The role stays last because the status line
74
+ * reads it off the tail of this same string.
75
+ */
76
+ export function sessionName(role, cwd) {
77
+ const project = cwd?.split("/").filter(Boolean).at(-1)?.replace(/[\t\r\n]/g, " ").trim();
78
+ if (!project)
79
+ return `CodeDeck · ${role}`;
80
+ return `CodeDeck · ${project} · ${role}`;
81
+ }
82
+ export function buildOpenArgs(role, flags, pluginDir, passthrough, cwd, mode = DISPATCHER_PRESET, config = {}) {
83
+ const orchestratorProse = role === "orchestrator" ? composeOrchestratorProse(mode) : "";
84
+ const agent = role !== "orchestrator"
85
+ ? `${PLUGIN_NAME}:${role}`
86
+ : `${PLUGIN_NAME}:orchestrator${mode.tools === "dispatch" ? "" : `-${mode.tools}`}`;
87
+ const autocompact = flags.autocompact ?? (config.autocompact === undefined ? false : undefined);
88
+ const args = [
89
+ "--model",
90
+ flags.model ?? DEFAULT_MODEL,
91
+ "--effort",
92
+ flags.effort ?? DEFAULT_EFFORT,
93
+ // Remote Control is interactive-only. It requires a subscribed Claude
94
+ // account and a prior workspace-trust dialog.
95
+ ...(flags.remoteControl !== false ? ["--remote-control"] : []),
96
+ ...(flags.bypass !== false ? ["--dangerously-skip-permissions"] : []),
97
+ "--plugin-dir",
98
+ pluginDir,
99
+ ...appendSystemPromptArgs(pluginDir, orchestratorProse),
100
+ "--settings",
101
+ JSON.stringify(buildSettings(pluginDir, flags)),
102
+ // `--agent` layers on top of Claude's own system prompt rather than
103
+ // replacing it, and an agent file with no `tools:` key inherits the whole
104
+ // toolset. So `general` carries its contract the same way the others do,
105
+ // with nothing taken away.
106
+ "--agent",
107
+ agent,
108
+ "-n",
109
+ sessionName(role, cwd),
110
+ ...(flags.resume ? ["--resume", flags.resume] : []),
111
+ ...(flags.worktree ? ["-w"] : []),
112
+ ...autocompactArgs({ config, explicit: autocompact, passthrough }),
113
+ ...passthrough,
114
+ ];
115
+ return args;
116
+ }
117
+ /**
118
+ * Ultra ships as a file, but Claude Code refuses --append-system-prompt-file
119
+ * together with --append-system-prompt, and an orchestrator preset needs its
120
+ * dynamic prose appended too. With prose the two are merged and handed over
121
+ * inline as the single source Claude allows; without it the file keeps the
122
+ * original, cheaper contract.
123
+ */
124
+ function appendSystemPromptArgs(pluginDir, prose) {
125
+ if (!prose)
126
+ return ["--append-system-prompt-file", path.join(pluginDir, "ultra.md")];
127
+ return ["--append-system-prompt", `${readUltra(pluginDir).trimEnd()}\n\n${prose}`];
128
+ }
129
+ /**
130
+ * The claude half of the split: find this harness's catalog, judge it with
131
+ * the shared pure verdict. Kept while the suite pins this shape.
132
+ */
133
+ export function judgeModel(model, catalogs, fromConfig) {
134
+ return judgeModelIn(catalogs?.find((item) => item.agent === "claude"), model, fromConfig, "Claude");
135
+ }
136
+ export async function preflightModel(model, fromConfig) {
137
+ let catalogs;
138
+ try {
139
+ catalogs = await getCachedOrDiscoverModels(getRegistry(), { agent: "claude" });
140
+ }
141
+ catch (error) {
142
+ // A catalog that cannot be reached is not evidence against the model, so
143
+ // this warns and lets the launch decide.
144
+ const details = errorDetails(error);
145
+ console.warn(catalogWarning("Claude", model, `unavailable (${details.text})`));
146
+ return;
147
+ }
148
+ const verdict = judgeModel(model, catalogs, fromConfig);
149
+ if (verdict.kind === "ok")
150
+ return;
151
+ if (verdict.kind === "unknown-catalog") {
152
+ console.warn(verdict.warning);
153
+ return;
154
+ }
155
+ throw new Error(verdict.error);
156
+ }
157
+ /**
158
+ * Returns the resolved path rather than a boolean so everything downstream
159
+ * launches the exact binary that was checked, instead of asking PATH again and
160
+ * hoping it answers the same way.
161
+ */
162
+ export async function resolveBinary() {
163
+ // detectBinary reports failure in its result and never rejects, so there is
164
+ // nothing here to catch.
165
+ const installation = await detectBinary("claude");
166
+ if (!installation.installed || !installation.path) {
167
+ throw new Error(CLAUDE_NOT_FOUND);
168
+ }
169
+ return installation.path;
170
+ }
171
+ export async function assertSupport(claudeBin, cwd) {
172
+ try {
173
+ await execFileAsync(claudeBin, ["--append-system-prompt-file"], {
174
+ cwd,
175
+ env: sanitizeEnv(process.env),
176
+ timeout: 5000,
177
+ maxBuffer: 1024 * 1024,
178
+ });
179
+ }
180
+ catch (error) {
181
+ const details = errorDetails(error);
182
+ if (details.code === "ENOENT") {
183
+ throw new Error(CLAUDE_NOT_FOUND);
184
+ }
185
+ if (/unknown option|unknown argument|unrecognized option|invalid option/i.test(details.text)) {
186
+ throw new Error("This Claude Code version does not support --append-system-prompt-file. Upgrade Claude Code and retry.");
187
+ }
188
+ // A supported Commander option reports a missing argument for this probe.
189
+ // Other probe failures are left to the real launch, which can provide the
190
+ // harness-specific diagnostic without blocking a valid installation.
191
+ }
192
+ }
193
+ /**
194
+ * The catalog knows which models exist, not which ones this account may use, so
195
+ * an entitlement problem can only be read off the launch itself. Claude Code
196
+ * reports it as a tagged error rather than a distinct exit code.
197
+ */
198
+ export function entitlementError(model, output) {
199
+ const tag = /\[claude-code:unrecognized_model\]\s*(\{.*\})?/i.exec(output);
200
+ if (!tag)
201
+ return undefined;
202
+ // The passthrough can carry its own --model, which wins over the one CodeDeck
203
+ // resolved, so the name in the payload is the one that was actually rejected.
204
+ let rejected = model;
205
+ if (tag[1]) {
206
+ try {
207
+ const payload = JSON.parse(tag[1]);
208
+ if (typeof payload.model === "string" && payload.model)
209
+ rejected = payload.model;
210
+ }
211
+ catch { }
212
+ }
213
+ return `Claude Code rejected model "${rejected}" because this account is not entitled to it. Check the Claude plan or model access for the account.`;
214
+ }
215
+ //# sourceMappingURL=claude.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../../src/open/launchers/claude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAyB,MAAM,mCAAmC,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAsB,MAAM,sBAAsB,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAqC,MAAM,gBAAgB,CAAC;AAC5G,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,GACd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";
3
+ import path from "node:path";
4
+ import { detectBinary } from "../../drivers/helpers.js";
5
+ import { getRegistry } from "../../drivers/registry.js";
6
+ import { getCachedOrDiscoverModels } from "../../core/models.js";
7
+ import { catalogWarning, judgeModelIn, resolveRoleContract, } from "../contract.js";
8
+ import { DISPATCHER_PRESET } from "../../config/orchestrator-mode.js";
9
+ import { composeOrchestratorProse } from "../orchestrator-prose.js";
10
+ /**
11
+ * Claude `tools:` becomes opencode `permission:`. Every key below was
12
+ * resolved live through `opencode debug agent`: `edit: deny` turns off edit
13
+ * and write, `read: deny` turns off read with bash intact, `task: deny`
14
+ * turns off dispatch, and `"*": "allow"` turns everything on. No role leans
15
+ * on user defaults, so `general` stays unrestricted and the restricted three
16
+ * stay restricted whatever the user configured globally.
17
+ */
18
+ export function rolePermission(role, mode = DISPATCHER_PRESET) {
19
+ switch (role) {
20
+ case "general":
21
+ return { "*": "allow" };
22
+ case "orchestrator":
23
+ switch (mode.tools) {
24
+ case "dispatch":
25
+ return { read: "deny", edit: "deny", write: "deny", task: "deny", bash: "allow" };
26
+ case "read":
27
+ return { read: "allow", edit: "deny", write: "deny", task: "deny", bash: "allow" };
28
+ case "edit":
29
+ return { read: "allow", edit: "allow", write: "allow", task: "deny", bash: "allow" };
30
+ }
31
+ case "reviewer":
32
+ return { edit: "deny", write: "deny", task: "deny", bash: "allow" };
33
+ case "auditor":
34
+ return { edit: "deny", write: "deny", task: "allow", bash: "allow" };
35
+ }
36
+ }
37
+ export function agentName(role) {
38
+ return `codedeck-${role}`;
39
+ }
40
+ const AUTONOMOUS_COMMAND = "autonomous";
41
+ /**
42
+ * The /autonomous slash command for opencode, read from the same file
43
+ * Claude serves via --plugin-dir. Body means the md minus frontmatter,
44
+ * the same strip rule resolveRoleContract applies to agent files, so
45
+ * the contract text stays identical on both harnesses.
46
+ */
47
+ export function autonomousCommand(pluginDir) {
48
+ const raw = fs.readFileSync(path.join(pluginDir, "commands", `${AUTONOMOUS_COMMAND}.md`), "utf8");
49
+ const match = /^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/.exec(raw);
50
+ const frontmatter = match ? match[0] : "";
51
+ const description = /^description:\s*(.+)$/m.exec(frontmatter)?.[1]?.trim() ??
52
+ "Continue this autonomous orchestrator session";
53
+ return {
54
+ template: (match ? raw.slice(match[0].length) : raw).trim(),
55
+ description,
56
+ };
57
+ }
58
+ /**
59
+ * The whole opencode contract as one `OPENCODE_CONFIG_CONTENT` value: global
60
+ * instructions from ultra plus the role agent carrying its prompt and
61
+ * permission map. Pure and file-free: nothing lands in `~/.config/opencode`
62
+ * or tmp, so there is nothing to clean up and concurrent opens share nothing.
63
+ */
64
+ export function buildInlineConfig(pluginDir, role, mode = DISPATCHER_PRESET, options) {
65
+ const { agentBody, ultra } = resolveRoleContract(pluginDir, role, mode);
66
+ const orchestratorProse = role === "orchestrator" ? composeOrchestratorProse(mode) : "";
67
+ const explicit = options?.explicit;
68
+ const cfg = options?.config?.autocompact;
69
+ const auto = explicit === false || explicit === "--no-autocompact"
70
+ ? false
71
+ : explicit !== undefined
72
+ ? true
73
+ : cfg === undefined
74
+ ? undefined
75
+ : cfg.enabled === false
76
+ ? false
77
+ : true;
78
+ // OpenCode owns the overflow trigger, so Claude's token, cap, and percent
79
+ // settings have no equivalent here and stay unmapped.
80
+ return JSON.stringify({
81
+ instructions: [ultra],
82
+ agent: {
83
+ [agentName(role)]: {
84
+ mode: "primary",
85
+ description: `CodeDeck ${role}`,
86
+ prompt: orchestratorProse ? `${agentBody}\n\n${orchestratorProse}` : agentBody,
87
+ permission: rolePermission(role, mode),
88
+ },
89
+ },
90
+ command: {
91
+ [AUTONOMOUS_COMMAND]: autonomousCommand(pluginDir),
92
+ },
93
+ ...(auto === undefined ? {} : { compaction: { auto } }),
94
+ });
95
+ }
96
+ const MODEL_SHAPE = /^[^/\s]+\/[^/\s]+$/;
97
+ export function buildArgs(role, flags, passthrough) {
98
+ if (!MODEL_SHAPE.test(flags.model)) {
99
+ throw new Error(`Model "${flags.model}" must be provider/model for opencode (e.g. anthropic/claude-sonnet-4-6).`);
100
+ }
101
+ return [
102
+ "--agent",
103
+ agentName(role),
104
+ "--model",
105
+ flags.model,
106
+ // --auto mirrors the claude bypass default; --no-bypass drops it. Effort
107
+ // has no opencode equivalent in this scope and stays unmapped.
108
+ ...(flags.bypass !== false ? ["--auto"] : []),
109
+ ...(flags.resume ? ["--session", flags.resume] : []),
110
+ ...passthrough,
111
+ ];
112
+ }
113
+ export const OPENCODE_NOT_FOUND = "Opencode was not found on PATH. Install opencode and ensure `opencode` is available.";
114
+ /**
115
+ * The opencode half of the CodeDeck look. The name answers to the theme file
116
+ * basename: `codedeck-rage.json` selected as `codedeck-rage`, the same rule
117
+ * the Claude side pins for its own slug.
118
+ */
119
+ export const OPENCODE_THEME_NAME = "codedeck-rage";
120
+ const OPENCODE_THEME_FILE = `${OPENCODE_THEME_NAME}.json`;
121
+ /**
122
+ * Where opencode discovers custom theme files. Project directories come
123
+ * first at runtime, but a launch must not write into the user's checkout,
124
+ * so the managed copy lives here, next to the user's own themes.
125
+ */
126
+ export function userThemesDir(home = os.homedir(), xdgConfigHome = process.env.XDG_CONFIG_HOME) {
127
+ const configHome = xdgConfigHome && xdgConfigHome.length > 0
128
+ ? xdgConfigHome
129
+ : path.join(home, ".config");
130
+ return path.join(configHome, "opencode", "themes");
131
+ }
132
+ /** The per-session TUI selection, as an ephemeral config dir understands it. */
133
+ export function buildTuiConfig() {
134
+ return JSON.stringify({
135
+ $schema: "https://opencode.ai/tui.json",
136
+ theme: OPENCODE_THEME_NAME,
137
+ });
138
+ }
139
+ /**
140
+ * Installs the managed theme file when it is missing or stale. Returns
141
+ * whether the theme can be selected: a read-only home or a broken plugin
142
+ * directory falls back to the user's own theme instead of failing the launch.
143
+ */
144
+ export function ensureOpencodeTheme(pluginDir, themesDir = userThemesDir()) {
145
+ try {
146
+ const wanted = fs.readFileSync(path.join(pluginDir, "themes", OPENCODE_THEME_FILE), "utf8");
147
+ const target = path.join(themesDir, OPENCODE_THEME_FILE);
148
+ let current;
149
+ try {
150
+ current = fs.readFileSync(target, "utf8");
151
+ }
152
+ catch {
153
+ current = undefined;
154
+ }
155
+ if (current !== wanted) {
156
+ fs.mkdirSync(themesDir, { recursive: true });
157
+ fs.writeFileSync(target, wanted);
158
+ }
159
+ return true;
160
+ }
161
+ catch {
162
+ return false;
163
+ }
164
+ }
165
+ /**
166
+ * A config dir holding only the TUI selection. The main contract still
167
+ * travels through OPENCODE_CONFIG_CONTENT, which merges with every config
168
+ * dir, so this stays a one-file directory with nothing to drift.
169
+ */
170
+ export function createEphemeralTuiDir() {
171
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), "codedeck-opencode-"));
172
+ fs.writeFileSync(path.join(dir, "tui.json"), buildTuiConfig());
173
+ return dir;
174
+ }
175
+ export function removeEphemeralTuiDir(dir) {
176
+ try {
177
+ fs.rmSync(dir, { recursive: true, force: true });
178
+ }
179
+ catch { }
180
+ }
181
+ /**
182
+ * Returns the resolved path rather than a boolean so everything downstream
183
+ * launches the exact binary that was checked.
184
+ */
185
+ export async function resolveBinary() {
186
+ const installation = await detectBinary("opencode");
187
+ if (!installation.installed || !installation.path) {
188
+ throw new Error(OPENCODE_NOT_FOUND);
189
+ }
190
+ return installation.path;
191
+ }
192
+ export async function preflight(model, fromConfig) {
193
+ let catalogs;
194
+ try {
195
+ catalogs = await getCachedOrDiscoverModels(getRegistry(), { agent: "opencode" });
196
+ }
197
+ catch (error) {
198
+ // A catalog that cannot be reached is not evidence against the model, so
199
+ // this warns and lets the launch decide.
200
+ const text = error instanceof Error ? error.message : String(error);
201
+ console.warn(catalogWarning("opencode", model, `unavailable (${text})`));
202
+ return;
203
+ }
204
+ const verdict = judgeModelIn(catalogs?.find((item) => item.agent === "opencode"), model, fromConfig, "opencode");
205
+ if (verdict.kind === "ok")
206
+ return;
207
+ if (verdict.kind === "unknown-catalog") {
208
+ console.warn(verdict.warning);
209
+ return;
210
+ }
211
+ throw new Error(verdict.error);
212
+ }
213
+ //# sourceMappingURL=opencode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode.js","sourceRoot":"","sources":["../../../src/open/launchers/opencode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EACL,cAAc,EACd,YAAY,EACZ,mBAAmB,GAEpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAyB,MAAM,mCAAmC,CAAC;AAG7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAIpE;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAU,EACV,OAAyB,iBAAiB;IAE1C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;QAC1B,KAAK,cAAc;YACjB,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC;gBACnB,KAAK,UAAU;oBACb,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gBACpF,KAAK,MAAM;oBACT,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gBACrF,KAAK,MAAM;oBACT,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK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AAQ,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,UAAU,CAAC,EACnD,KAAK,EACL,UAAU,EACV,UAAU,CACX,CAAC;IACF,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO;IAClC,IAAI,OAAO,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO;IACT,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export function composeOrchestratorProse(mode) {
2
+ const lines = [];
3
+ if (mode.investigate !== "none" || mode.selfWork !== "none") {
4
+ lines.push(`Investigation allowance: ${mode.investigate}.`);
5
+ lines.push(`Self-work allowance: ${mode.selfWork}.`);
6
+ }
7
+ if (mode.parallelism !== undefined) {
8
+ lines.push(`Run at most ${mode.parallelism} workers concurrently.`);
9
+ }
10
+ return lines.join("\n");
11
+ }
12
+ //# sourceMappingURL=orchestrator-prose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator-prose.js","sourceRoot":"","sources":["../../src/open/orchestrator-prose.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,wBAAwB,CAAC,IAAsB;IAC7D,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,IAAI,CAAC,WAAW,KAAK,MAAM,IAAI,IAAI,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;QAC5D,KAAK,CAAC,IAAI,CAAC,4BAA4B,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QAC5D,KAAK,CAAC,IAAI,CAAC,wBAAwB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,WAAW,wBAAwB,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}