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