codedeck 0.1.9 → 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 (99) hide show
  1. package/README.md +97 -1
  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 +331 -0
  11. package/dist/cli/commands/open.js.map +1 -0
  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 +68 -30
  17. package/dist/cli/commands/run.js.map +1 -1
  18. package/dist/cli/commands/setup.js +508 -0
  19. package/dist/cli/commands/setup.js.map +1 -0
  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 +37 -21
  25. package/dist/cli/index.js.map +1 -1
  26. package/dist/cli/picker-state.js +168 -0
  27. package/dist/cli/picker-state.js.map +1 -0
  28. package/dist/cli/picker.js +157 -0
  29. package/dist/cli/picker.js.map +1 -0
  30. package/dist/cli/ui.js +233 -0
  31. package/dist/cli/ui.js.map +1 -0
  32. package/dist/config/config.js +47 -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/models.js +23 -4
  39. package/dist/core/models.js.map +1 -1
  40. package/dist/core/pricing.js +65 -0
  41. package/dist/core/pricing.js.map +1 -0
  42. package/dist/core/roles.js +83 -0
  43. package/dist/core/roles.js.map +1 -0
  44. package/dist/core/run-usage.js +46 -0
  45. package/dist/core/run-usage.js.map +1 -0
  46. package/dist/core/session.js +5 -0
  47. package/dist/core/session.js.map +1 -1
  48. package/dist/daemon/daemon.js +90 -3
  49. package/dist/daemon/daemon.js.map +1 -1
  50. package/dist/daemon/ipc.js +10 -3
  51. package/dist/daemon/ipc.js.map +1 -1
  52. package/dist/drivers/opencode/driver.js +1 -114
  53. package/dist/drivers/opencode/driver.js.map +1 -1
  54. package/dist/drivers/opencode/parser.js +86 -0
  55. package/dist/drivers/opencode/parser.js.map +1 -0
  56. package/dist/drivers/session-runtime.js +1 -0
  57. package/dist/drivers/session-runtime.js.map +1 -1
  58. package/dist/git/worktree.js +1 -1
  59. package/dist/git/worktree.js.map +1 -1
  60. package/dist/open/contract.js +104 -0
  61. package/dist/open/contract.js.map +1 -0
  62. package/dist/open/injection.js +59 -0
  63. package/dist/open/injection.js.map +1 -0
  64. package/dist/open/launchers/claude.js +212 -0
  65. package/dist/open/launchers/claude.js.map +1 -0
  66. package/dist/open/launchers/opencode.js +178 -0
  67. package/dist/open/launchers/opencode.js.map +1 -0
  68. package/dist/open/orchestrator-prose.js +12 -0
  69. package/dist/open/orchestrator-prose.js.map +1 -0
  70. package/dist/open/pty.js +281 -0
  71. package/dist/open/pty.js.map +1 -0
  72. package/dist/open/runtime.js +597 -0
  73. package/dist/open/runtime.js.map +1 -0
  74. package/dist/plugin/.claude-plugin/plugin.json +11 -0
  75. package/dist/plugin/agents/auditor.md +36 -0
  76. package/dist/plugin/agents/general.md +35 -0
  77. package/dist/plugin/agents/orchestrator-edit.md +69 -0
  78. package/dist/plugin/agents/orchestrator-read.md +69 -0
  79. package/dist/plugin/agents/orchestrator.md +91 -0
  80. package/dist/plugin/agents/reviewer.md +36 -0
  81. package/dist/plugin/commands/autonomous.md +58 -0
  82. package/dist/plugin/hooks/hooks.json +24 -0
  83. package/dist/plugin/hooks/session-id.sh +23 -0
  84. package/dist/plugin/hooks/session-name-lib.mjs +40 -0
  85. package/dist/plugin/hooks/session-name-worker.mjs +124 -0
  86. package/dist/plugin/hooks/session-name.mjs +66 -0
  87. package/dist/plugin/hooks/session-name.sh +7 -0
  88. package/dist/plugin/pty-shim.mjs +114 -0
  89. package/dist/plugin/statusline.sh +260 -0
  90. package/dist/plugin/themes/codedeck-rage.json +74 -0
  91. package/dist/plugin/themes/codedeck-ultra.json +76 -0
  92. package/dist/plugin/ultra.md +9 -0
  93. package/dist/store/claims.js +152 -0
  94. package/dist/store/claims.js.map +1 -0
  95. package/dist/store/database.js +14 -0
  96. package/dist/store/database.js.map +1 -1
  97. package/dist/store/sessions.js +17 -3
  98. package/dist/store/sessions.js.map +1 -1
  99. package/package.json +6 -4
@@ -0,0 +1,281 @@
1
+ import fs from "node:fs";
2
+ import net from "node:net";
3
+ import path from "node:path";
4
+ import { spawn as nodeSpawn } from "node:child_process";
5
+ import { getPaths } from "../config/paths.js";
6
+ /**
7
+ * Owning the pty is what lets CodeDeck type for the user.
8
+ *
9
+ * Claude Code renames a live session only through `/rename`, which is a TUI
10
+ * command: the `rename_session` control request needs an SDK stdin or a
11
+ * device-signed Remote Control bridge, and the title record in the transcript
12
+ * is re-read on re-stamp rather than watched. So the session name derived from
13
+ * the first prompt can only land the way a person would land it — typed.
14
+ *
15
+ * `script` allocates the pty, because it is the one allocator already on the
16
+ * box: a native dependency would follow every `npm i -g codedeck` onto
17
+ * machines that never open a session. Its stdin is a pipe here, which doubles
18
+ * as the injection channel, and that costs the window size — see the shim.
19
+ */
20
+ const SHIM_FILE = "pty-shim.mjs";
21
+ const SCRIPT_BINARY = "script";
22
+ /** A path with a control character in it cannot be a real binary, and a shell
23
+ * string is the wrong place to find out. */
24
+ const SAFE_PATH = /^[^\u0000-\u001f]+$/;
25
+ const CONTROL_ENV = "CODEDECK_PTY_CONTROL";
26
+ const ROWS_ENV = "CODEDECK_PTY_ROWS";
27
+ const COLS_ENV = "CODEDECK_PTY_COLS";
28
+ const NAME_SUFFIX = ".name";
29
+ /** ETX, which is what Ctrl+C is once the terminal stops turning it into SIGINT. */
30
+ const INTERRUPT_KEY = 0x03;
31
+ const FALLBACK_ROWS = 24;
32
+ const FALLBACK_COLUMNS = 80;
33
+ export function ptyShimPath(pluginDir) {
34
+ return path.join(pluginDir, SHIM_FILE);
35
+ }
36
+ /**
37
+ * Where the session file and the name the hook derives from the first prompt
38
+ * live. Created 0700 on the way out, because what lands here is typed into a
39
+ * live session and the shared temp directory is writable by anyone on the box.
40
+ */
41
+ export function sessionsDir() {
42
+ const dir = getPaths().sessionsDir;
43
+ fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
44
+ return dir;
45
+ }
46
+ const QUOTE = "'";
47
+ const ESCAPED_QUOTE = "'\\''";
48
+ function shellQuote(value) {
49
+ return QUOTE + value.replaceAll(QUOTE, ESCAPED_QUOTE) + QUOTE;
50
+ }
51
+ /**
52
+ * `exec` keeps the shim as the pty's session leader, so nothing but the shim
53
+ * and the harness sit between the terminal and Claude Code.
54
+ */
55
+ export function buildInnerCommand(shim, target, node = process.execPath) {
56
+ for (const part of [node, shim, target.bin]) {
57
+ if (!SAFE_PATH.test(part)) {
58
+ throw new Error(`pty: refusing to run a command with a control character in it: ${JSON.stringify(part)}`);
59
+ }
60
+ }
61
+ return `exec ${[node, shim, target.bin, ...target.args].map(shellQuote).join(" ")}`;
62
+ }
63
+ /**
64
+ * BSD and util-linux spell `script` differently, and only util-linux returns
65
+ * the child's exit status (`-e`). On macOS the status comes back on its own.
66
+ */
67
+ export function buildScriptInvocation(inner, platform = process.platform, bin = SCRIPT_BINARY) {
68
+ if (platform === "darwin")
69
+ return { bin, args: ["-q", "/dev/null", "/bin/sh", "-c", inner] };
70
+ return { bin, args: ["-qefc", inner, "/dev/null"] };
71
+ }
72
+ /**
73
+ * The absolute path of a binary on PATH, or nothing.
74
+ *
75
+ * Resolved rather than spawned by name so the session runs the `script` that
76
+ * was checked, instead of whatever a PATH entry resolves to a moment later.
77
+ */
78
+ export function findBinaryOnPath(name, env = process.env) {
79
+ const entries = (env.PATH ?? "").split(path.delimiter).filter(Boolean);
80
+ for (const entry of entries) {
81
+ const candidate = path.join(entry, name);
82
+ try {
83
+ fs.accessSync(candidate, fs.constants.X_OK);
84
+ return candidate;
85
+ }
86
+ catch { }
87
+ }
88
+ return undefined;
89
+ }
90
+ export function hasBinaryOnPath(name, env = process.env) {
91
+ return findBinaryOnPath(name, env) !== undefined;
92
+ }
93
+ /**
94
+ * Why this session cannot run under a pty, or nothing. Every reason is a
95
+ * fallback to the plain spawn rather than a failure: a session that opens
96
+ * without renaming itself beats a session that does not open.
97
+ */
98
+ export function ptyUnavailableReason(options) {
99
+ const platform = options.platform ?? process.platform;
100
+ const env = options.env ?? process.env;
101
+ const fileExists = options.fileExists ?? ((file) => fs.existsSync(file));
102
+ const hasScript = options.hasScript ?? ((value) => hasBinaryOnPath(SCRIPT_BINARY, value));
103
+ if (options.enabled === false)
104
+ return "disabled by configuration";
105
+ if (platform === "win32")
106
+ return "no script(1) on Windows";
107
+ if (options.stdinIsTty !== true || options.stdoutIsTty !== true)
108
+ return "not attached to a terminal";
109
+ if (!hasScript(env))
110
+ return "script(1) not found on PATH";
111
+ if (!fileExists(options.shim))
112
+ return `pty shim missing at ${options.shim}`;
113
+ return undefined;
114
+ }
115
+ /**
116
+ * `plugin/hooks/session-name.sh` writes the first prompt's slug next to the
117
+ * session file. Watching for it keeps this side ignorant of Claude Code
118
+ * internals: the hook decides the name, the wrapper only types it, once.
119
+ *
120
+ * Anything already sitting there belongs to a dead session: the watcher starts
121
+ * before the harness does, and the hook only writes once a prompt is
122
+ * submitted. The session file is named after a pid, which the kernel reuses,
123
+ * so a leaked sidecar would otherwise have this session rename itself after
124
+ * someone else's prompt. They are removed rather than read.
125
+ */
126
+ export function watchNameSidecar(sessionFile, onName) {
127
+ const dir = path.dirname(sessionFile);
128
+ const prefix = `${path.basename(sessionFile)}.`;
129
+ let delivered = false;
130
+ let watcher;
131
+ const isSidecar = (file) => file.startsWith(prefix) && file.endsWith(NAME_SUFFIX);
132
+ const read = (file) => {
133
+ if (delivered || !isSidecar(file))
134
+ return;
135
+ let name;
136
+ try {
137
+ // O_NOFOLLOW so a symlink planted under this name reads as nothing
138
+ // rather than as whatever it points at. Belt to the directory's braces.
139
+ const handle = fs.openSync(path.join(dir, file), fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW);
140
+ try {
141
+ name = fs.readFileSync(handle, "utf8");
142
+ }
143
+ finally {
144
+ fs.closeSync(handle);
145
+ }
146
+ }
147
+ catch {
148
+ return;
149
+ }
150
+ if (name.trim().length === 0)
151
+ return;
152
+ delivered = true;
153
+ onName(name);
154
+ };
155
+ try {
156
+ fs.mkdirSync(dir, { recursive: true });
157
+ for (const file of fs.readdirSync(dir)) {
158
+ if (isSidecar(file))
159
+ fs.rmSync(path.join(dir, file), { force: true });
160
+ }
161
+ watcher = fs.watch(dir, (_event, file) => {
162
+ if (typeof file === "string")
163
+ read(file);
164
+ });
165
+ }
166
+ catch {
167
+ // A watcher that cannot start costs the rename, never the session.
168
+ return () => watcher?.close();
169
+ }
170
+ return () => {
171
+ try {
172
+ watcher?.close();
173
+ }
174
+ catch { }
175
+ };
176
+ }
177
+ export function startPtySession(options) {
178
+ const spawnChild = options.spawnChild ?? nodeSpawn;
179
+ const stdin = options.stdin ?? process.stdin;
180
+ const stdout = options.stdout ?? process.stdout;
181
+ // In the private directory rather than the shared one: a peer that can
182
+ // connect to this socket can resize the session's terminal.
183
+ const control = path.join(sessionsDir(), `codedeck-pty-${process.pid}-${Date.now().toString(36)}.sock`);
184
+ // A terminal that reports 0 is a terminal whose size nobody set: passing the
185
+ // zero down would leave the inner pty exactly as unusable as script leaves it.
186
+ const rows = stdout.rows || FALLBACK_ROWS;
187
+ const columns = stdout.columns || FALLBACK_COLUMNS;
188
+ const invocation = buildScriptInvocation(buildInnerCommand(options.launch.shim, options.target), process.platform, findBinaryOnPath(SCRIPT_BINARY, options.env) ?? SCRIPT_BINARY);
189
+ const child = spawnChild(invocation.bin, invocation.args, {
190
+ cwd: options.cwd,
191
+ env: {
192
+ ...options.env,
193
+ [CONTROL_ENV]: control,
194
+ [ROWS_ENV]: String(rows),
195
+ [COLS_ENV]: String(columns),
196
+ },
197
+ // stdout is piped rather than inherited because the pty merges the
198
+ // harness's stderr into it, and that is where an entitlement refusal is
199
+ // read off. Bytes are written through untouched.
200
+ detached: false,
201
+ stdio: ["pipe", "pipe", "pipe"],
202
+ });
203
+ // Raw mode makes the parent a transparent wire: Ctrl+C stops being a signal
204
+ // here and becomes the byte the inner pty's line discipline interprets,
205
+ // exactly as it would in a terminal talking to Claude Code directly.
206
+ const wasRaw = stdin.isTTY ? stdin.isRaw : false;
207
+ if (stdin.isTTY)
208
+ stdin.setRawMode(true);
209
+ // A write to a pipe whose reader died raises EPIPE asynchronously, and an
210
+ // unhandled one takes the CLI down before it can print the farewell. The
211
+ // window is small — script gone, `close` not yet fired — and real: a
212
+ // keystroke lands in it whenever a session dies under someone's hands.
213
+ child.stdin?.on("error", () => { });
214
+ child.stdout?.on("error", () => { });
215
+ const write = (chunk) => {
216
+ if (child.stdin?.writable !== true)
217
+ return;
218
+ child.stdin.write(chunk);
219
+ };
220
+ const forward = (chunk) => {
221
+ if (options.onInterrupt && chunk.includes(INTERRUPT_KEY))
222
+ options.onInterrupt();
223
+ write(chunk);
224
+ };
225
+ stdin.on("data", forward);
226
+ stdin.resume();
227
+ // The shim binds the socket a moment after the pty exists, and a lost
228
+ // connection costs a redraw rather than the session.
229
+ let connection;
230
+ // Sent on connect as well as on resize: a resize that lands before the shim
231
+ // is listening would otherwise be dropped, leaving the harness drawing at
232
+ // the size it booted with until the next one.
233
+ const sendResize = () => {
234
+ connection?.write(`${JSON.stringify({ type: "resize", rows: stdout.rows, cols: stdout.columns })}\n`);
235
+ };
236
+ stdout.on("resize", sendResize);
237
+ let connecting = true;
238
+ const connect = (attempt = 0) => {
239
+ if (!connecting)
240
+ return;
241
+ const socket = net.connect(control);
242
+ socket.on("connect", () => {
243
+ connecting = false;
244
+ connection = socket;
245
+ sendResize();
246
+ });
247
+ socket.on("error", () => {
248
+ socket.destroy();
249
+ if (attempt < 60)
250
+ setTimeout(() => connect(attempt + 1), 50).unref();
251
+ });
252
+ };
253
+ connect();
254
+ const inject = (keystrokes) => {
255
+ write(keystrokes);
256
+ };
257
+ const keystrokesForName = options.launch.keystrokesForName;
258
+ const stopWatching = keystrokesForName
259
+ ? watchNameSidecar(options.launch.sessionFile, (name) => {
260
+ const keystrokes = keystrokesForName(name);
261
+ if (keystrokes)
262
+ inject(keystrokes);
263
+ })
264
+ : () => { };
265
+ const dispose = () => {
266
+ connecting = false;
267
+ stopWatching();
268
+ stdout.off("resize", sendResize);
269
+ stdin.off("data", forward);
270
+ if (stdin.isTTY)
271
+ stdin.setRawMode(wasRaw);
272
+ stdin.pause();
273
+ connection?.destroy();
274
+ try {
275
+ fs.rmSync(control, { force: true });
276
+ }
277
+ catch { }
278
+ };
279
+ return { child, inject, dispose };
280
+ }
281
+ //# sourceMappingURL=pty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pty.js","sourceRoot":"","sources":["../../src/open/pty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAqB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;;;;;;;;;;;;GAaG;AAEH,MAAM,SAAS,GAAG,cAAc,CAAC;AACjC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAC/B;4CAC4C;AAC5C,MAAM,SAAS,GAAG,qBAAqB,CAAC;AACxC,MAAM,WAAW,GAAG,sBAAsB,CA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