@bastani/atomic 0.5.32 → 0.5.33-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/cli/claude-stop-hook.d.ts +1 -0
- package/dist/commands/cli/claude-stop-hook.d.ts.map +1 -1
- package/dist/sdk/providers/claude.d.ts +0 -3
- package/dist/sdk/providers/claude.d.ts.map +1 -1
- package/dist/sdk/types.d.ts +0 -1
- package/dist/sdk/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cli.ts +12 -1
- package/src/commands/cli/claude-session-start-hook.ts +61 -0
- package/src/commands/cli/claude-stop-hook.ts +5 -0
- package/src/sdk/providers/claude.ts +84 -54
- package/src/sdk/types.ts +1 -1
|
@@ -46,6 +46,7 @@ export declare function claudeHookDirs(): {
|
|
|
46
46
|
release: string;
|
|
47
47
|
hil: string;
|
|
48
48
|
pid: string;
|
|
49
|
+
ready: string;
|
|
49
50
|
};
|
|
50
51
|
/** Options for {@link claudeStopHookCommand}. Primarily used by tests to shrink the wait budget. */
|
|
51
52
|
export interface ClaudeStopHookOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-stop-hook.d.ts","sourceRoot":"","sources":["../../../src/commands/cli/claude-stop-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAQH,yEAAyE;AACzE,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAeD;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"claude-stop-hook.d.ts","sourceRoot":"","sources":["../../../src/commands/cli/claude-stop-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAQH,yEAAyE;AACzE,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAeD;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAkBA;AAED,oGAAoG;AACpG,MAAM,WAAW,qBAAqB;IACpC,4FAA4F;IAC5F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAsFD;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,MAAM,CAAC,CAyMjB"}
|
|
@@ -30,8 +30,6 @@ export interface ClaudeSessionOptions {
|
|
|
30
30
|
paneId: string;
|
|
31
31
|
/** CLI flags to pass to the `claude` command (default: ["--allow-dangerously-skip-permissions", "--dangerously-skip-permissions"]) */
|
|
32
32
|
chatFlags?: string[];
|
|
33
|
-
/** Timeout in ms waiting for Claude TUI to be ready (default: 30s) */
|
|
34
|
-
readyTimeoutMs?: number;
|
|
35
33
|
}
|
|
36
34
|
/**
|
|
37
35
|
* Initialize per-pane Claude state. Does NOT spawn the `claude` CLI — the
|
|
@@ -238,7 +236,6 @@ export declare class ClaudeClientWrapper {
|
|
|
238
236
|
private readonly opts;
|
|
239
237
|
constructor(paneId: string, opts?: {
|
|
240
238
|
chatFlags?: string[];
|
|
241
|
-
readyTimeoutMs?: number;
|
|
242
239
|
});
|
|
243
240
|
/**
|
|
244
241
|
* Start the Claude CLI in the tmux pane. Returns the Claude session UUID
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/sdk/providers/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,OAAO,IAAI,UAAU,EAC3B,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/sdk/providers/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,OAAO,IAAI,UAAU,EAC3B,MAAM,gCAAgC,CAAC;AA8BxC;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBtE;AA4JD,MAAM,WAAW,oBAAoB;IACnC,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,sIAAsI;IACtI,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBxF;AA8HD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAUnE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAClC,eAAe,EAAE,MAAM,EACvB,KAA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;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAajD;AAED;;;;;;;;;;GAUG;AACH,qBAAa,4BAA4B;IACvC,QAAQ,CAAC,MAAM,MAAM;IACrB;;;;;OAKG;IACH,OAAO,CAAC,cAAc,CAAc;IACpC;;;;;;;OAOG;IACH,OAAO,CAAC,qBAAqB,CAAsB;IAEnD,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,oBAAoB,IAAI,OAAO,CAElC;IAEK,KAAK,CACT,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,cAAc,CAAC,EAC9C,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAC5B,OAAO,CAAC,cAAc,EAAE,CAAC;IA2CtB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAClC;AAQD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,+DAejC,CAAC"}
|
package/dist/sdk/types.d.ts
CHANGED
package/dist/sdk/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sdk/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,aAAa,IAAI,oBAAoB,EACtC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,cAAc,EACd,OAAO,IAAI,eAAe,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAE/B,4BAA4B;AAC5B,MAAM,MAAM,SAAS,GAAG,SAAS,GAA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,EAC/B,CAAC,SAAS,SAAS,aAAa,EAAE,GAAG,SAAS,aAAa,EAAE;IAE7D,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,iFAAiF;IACjF,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D"}
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -350,6 +350,16 @@ Examples:
|
|
|
350
350
|
process.exit(exitCode);
|
|
351
351
|
});
|
|
352
352
|
|
|
353
|
+
// ── Internal: Claude SessionStart hook handler ────────────────────────
|
|
354
|
+
program
|
|
355
|
+
.command("_claude-session-start-hook", { hidden: true })
|
|
356
|
+
.description("Internal: Claude Code SessionStart hook handler — writes a ready-marker file")
|
|
357
|
+
.action(async () => {
|
|
358
|
+
const { claudeSessionStartHookCommand } = await import("./commands/cli/claude-session-start-hook.ts");
|
|
359
|
+
const exitCode = await claudeSessionStartHookCommand();
|
|
360
|
+
process.exit(exitCode);
|
|
361
|
+
});
|
|
362
|
+
|
|
353
363
|
// ── Internal: Claude AskUserQuestion hook handler ─────────────────────
|
|
354
364
|
program
|
|
355
365
|
.command("_claude-ask-hook", { hidden: true })
|
|
@@ -423,7 +433,8 @@ async function main(): Promise<void> {
|
|
|
423
433
|
argv[0] === "completions" ||
|
|
424
434
|
argv[0] === "_footer" ||
|
|
425
435
|
argv[0] === "_claude-stop-hook" ||
|
|
426
|
-
argv[0] === "_claude-ask-hook"
|
|
436
|
+
argv[0] === "_claude-ask-hook" ||
|
|
437
|
+
argv[0] === "_claude-session-start-hook";
|
|
427
438
|
|
|
428
439
|
if (!isInfoCommand) {
|
|
429
440
|
const { autoSyncIfStale } = await import("./services/system/auto-sync.ts");
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude SessionStart Hook command — internal handler for the `startup` matcher.
|
|
3
|
+
*
|
|
4
|
+
* Invoked as:
|
|
5
|
+
* atomic _claude-session-start-hook
|
|
6
|
+
*
|
|
7
|
+
* Writes `~/.atomic/claude-ready/<session_id>` as a positive readiness signal.
|
|
8
|
+
* The workflow runtime (`src/sdk/providers/claude.ts`) `fs.watch`es that dir so
|
|
9
|
+
* it can resolve the spawn wait the instant Claude dispatches SessionStart —
|
|
10
|
+
* which fires before the JSONL transcript is created, making it a stricter and
|
|
11
|
+
* more reliable readiness signal than polling for the transcript file.
|
|
12
|
+
*
|
|
13
|
+
* Always exits 0 so a hook failure never shows up as a red "hook error" in
|
|
14
|
+
* Claude's transcript. The runtime's spawn timeout still protects against a
|
|
15
|
+
* truly broken startup (bad binary, exec failure).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import fs from "node:fs/promises";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
import { claudeHookDirs } from "./claude-stop-hook.ts";
|
|
21
|
+
|
|
22
|
+
/** Shape of the JSON payload Claude pipes to the SessionStart hook via stdin. */
|
|
23
|
+
export interface ClaudeSessionStartHookPayload {
|
|
24
|
+
session_id: string;
|
|
25
|
+
source?: string;
|
|
26
|
+
transcript_path?: string;
|
|
27
|
+
cwd?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function isClaudeSessionStartHookPayload(
|
|
31
|
+
value: unknown,
|
|
32
|
+
): value is ClaudeSessionStartHookPayload {
|
|
33
|
+
if (typeof value !== "object" || value === null) return false;
|
|
34
|
+
const obj = value as Record<string, unknown>;
|
|
35
|
+
return typeof obj["session_id"] === "string";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export async function claudeSessionStartHookCommand(): Promise<number> {
|
|
39
|
+
const raw = await Bun.stdin.text();
|
|
40
|
+
|
|
41
|
+
let payload: ClaudeSessionStartHookPayload;
|
|
42
|
+
try {
|
|
43
|
+
const parsed: unknown = JSON.parse(raw);
|
|
44
|
+
if (!isClaudeSessionStartHookPayload(parsed)) {
|
|
45
|
+
console.error(
|
|
46
|
+
"[claude-session-start-hook] Invalid payload: missing or malformed 'session_id'",
|
|
47
|
+
);
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
payload = parsed;
|
|
51
|
+
} catch {
|
|
52
|
+
console.error("[claude-session-start-hook] Failed to parse stdin as JSON");
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const { ready } = claudeHookDirs();
|
|
57
|
+
await fs.mkdir(ready, { recursive: true });
|
|
58
|
+
await Bun.write(path.join(ready, payload.session_id), raw);
|
|
59
|
+
|
|
60
|
+
return 0;
|
|
61
|
+
}
|
|
@@ -67,6 +67,7 @@ export function claudeHookDirs(): {
|
|
|
67
67
|
release: string;
|
|
68
68
|
hil: string;
|
|
69
69
|
pid: string;
|
|
70
|
+
ready: string;
|
|
70
71
|
} {
|
|
71
72
|
const base = path.join(os.homedir(), ".atomic");
|
|
72
73
|
return {
|
|
@@ -80,6 +81,10 @@ export function claudeHookDirs(): {
|
|
|
80
81
|
// can detect the orphaned session and self-exit instead of sitting in
|
|
81
82
|
// its wait loop for ~24 days.
|
|
82
83
|
pid: path.join(base, "claude-pid"),
|
|
84
|
+
// Written by the SessionStart hook on fresh spawns. The workflow runtime
|
|
85
|
+
// watches this directory to detect readiness — positive signal, unlike
|
|
86
|
+
// racing the JSONL writer.
|
|
87
|
+
ready: path.join(base, "claude-ready"),
|
|
83
88
|
};
|
|
84
89
|
}
|
|
85
90
|
|
|
@@ -49,8 +49,6 @@ interface PaneState {
|
|
|
49
49
|
claudeStarted: boolean;
|
|
50
50
|
/** CLI flags to pass to `claude` when it is spawned on the first query. */
|
|
51
51
|
chatFlags: string[];
|
|
52
|
-
/** Timeout in ms waiting for Claude TUI / JSONL file on first spawn. */
|
|
53
|
-
readyTimeoutMs: number;
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
const initializedPanes = new Map<string, PaneState>();
|
|
@@ -77,6 +75,13 @@ export async function clearClaudeSession(paneId: string): Promise<void> {
|
|
|
77
75
|
// Best-effort — stale pid file is inert; the next session writes a
|
|
78
76
|
// fresh one under its own UUID.
|
|
79
77
|
}
|
|
78
|
+
try {
|
|
79
|
+
await clearStaleReadyMarker(state.claudeSessionId);
|
|
80
|
+
} catch {
|
|
81
|
+
// Best-effort — stale ready marker is inert; the next session writes
|
|
82
|
+
// a fresh one under its own UUID and clears any prior leftover in
|
|
83
|
+
// `claudeQuery` before respawn.
|
|
84
|
+
}
|
|
80
85
|
}
|
|
81
86
|
initializedPanes.delete(paneId);
|
|
82
87
|
}
|
|
@@ -134,6 +139,18 @@ function buildWorkflowHookCommand(subcommand: string, extraArgs: readonly string
|
|
|
134
139
|
*/
|
|
135
140
|
const STOP_HOOK_TIMEOUT_SECONDS = 2_147_483;
|
|
136
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Effectively-unbounded ms ceiling for `waitForReadyMarker`. Mirrors
|
|
144
|
+
* {@link STOP_HOOK_TIMEOUT_SECONDS} but expressed in ms for `setTimeout`.
|
|
145
|
+
*
|
|
146
|
+
* The SessionStart hook fires well under a second on a working spawn, so in
|
|
147
|
+
* practice this timer never expires. It only protects against failure modes
|
|
148
|
+
* where the hook will never fire at all (claude binary missing, hook
|
|
149
|
+
* command not resolvable, settings JSON rejected), where a clear error
|
|
150
|
+
* beats a hung pane.
|
|
151
|
+
*/
|
|
152
|
+
const READY_HOOK_TIMEOUT_MS = 2_147_483_000;
|
|
153
|
+
|
|
137
154
|
/**
|
|
138
155
|
* Inline settings injected via `claude --settings <json>` on every workflow
|
|
139
156
|
* spawn. Registers the workflow-owned hooks without relying on
|
|
@@ -161,6 +178,17 @@ const STOP_HOOK_TIMEOUT_SECONDS = 2_147_483;
|
|
|
161
178
|
*/
|
|
162
179
|
const WORKFLOW_HOOK_SETTINGS = JSON.stringify({
|
|
163
180
|
hooks: {
|
|
181
|
+
SessionStart: [
|
|
182
|
+
{
|
|
183
|
+
matcher: "startup",
|
|
184
|
+
hooks: [
|
|
185
|
+
{
|
|
186
|
+
type: "command",
|
|
187
|
+
command: buildWorkflowHookCommand("_claude-session-start-hook"),
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
],
|
|
164
192
|
Stop: [
|
|
165
193
|
{
|
|
166
194
|
hooks: [
|
|
@@ -217,8 +245,6 @@ export interface ClaudeSessionOptions {
|
|
|
217
245
|
paneId: string;
|
|
218
246
|
/** CLI flags to pass to the `claude` command (default: ["--allow-dangerously-skip-permissions", "--dangerously-skip-permissions"]) */
|
|
219
247
|
chatFlags?: string[];
|
|
220
|
-
/** Timeout in ms waiting for Claude TUI to be ready (default: 30s) */
|
|
221
|
-
readyTimeoutMs?: number;
|
|
222
248
|
}
|
|
223
249
|
|
|
224
250
|
/**
|
|
@@ -251,18 +277,13 @@ export interface ClaudeSessionOptions {
|
|
|
251
277
|
* ```
|
|
252
278
|
*/
|
|
253
279
|
export async function createClaudeSession(options: ClaudeSessionOptions): Promise<string> {
|
|
254
|
-
const {
|
|
255
|
-
paneId,
|
|
256
|
-
chatFlags = DEFAULT_CHAT_FLAGS,
|
|
257
|
-
readyTimeoutMs = 30_000,
|
|
258
|
-
} = options;
|
|
280
|
+
const { paneId, chatFlags = DEFAULT_CHAT_FLAGS } = options;
|
|
259
281
|
|
|
260
282
|
const claudeSessionId = randomUUID();
|
|
261
283
|
initializedPanes.set(paneId, {
|
|
262
284
|
claudeSessionId,
|
|
263
285
|
claudeStarted: false,
|
|
264
286
|
chatFlags,
|
|
265
|
-
readyTimeoutMs,
|
|
266
287
|
});
|
|
267
288
|
|
|
268
289
|
// Write our PID so the Stop hook can detect an orphaned session if we
|
|
@@ -298,7 +319,6 @@ async function spawnClaudeWithPrompt(
|
|
|
298
319
|
promptFile: string,
|
|
299
320
|
chatFlags: string[],
|
|
300
321
|
sessionId: string,
|
|
301
|
-
readyTimeoutMs: number,
|
|
302
322
|
): Promise<void> {
|
|
303
323
|
// sessionDir is the workflow's `${name}-${sessionId}` directory under
|
|
304
324
|
// ~/.atomic/sessions — slug-based, so single-quoting is sufficient on
|
|
@@ -324,55 +344,58 @@ async function spawnClaudeWithPrompt(
|
|
|
324
344
|
// the command typed at the prompt but never submitted.
|
|
325
345
|
respawnPane(paneId, cmd);
|
|
326
346
|
|
|
327
|
-
//
|
|
328
|
-
//
|
|
329
|
-
|
|
347
|
+
// Positive readiness signal: wait for Claude's SessionStart hook (matcher
|
|
348
|
+
// `startup`) to write `~/.atomic/claude-ready/<session_id>`. This fires
|
|
349
|
+
// before Claude writes the JSONL transcript, so it beats the old
|
|
350
|
+
// transcript-file race and is deterministic.
|
|
351
|
+
await waitForReadyMarker(sessionId);
|
|
330
352
|
}
|
|
331
353
|
|
|
332
354
|
/**
|
|
333
|
-
* Wait for
|
|
355
|
+
* Wait for the SessionStart hook's ready marker at
|
|
356
|
+
* `~/.atomic/claude-ready/<session_id>`.
|
|
357
|
+
*
|
|
358
|
+
* `atomic _claude-session-start-hook` is registered in
|
|
359
|
+
* {@link WORKFLOW_HOOK_SETTINGS} with matcher `startup`; the Claude CLI
|
|
360
|
+
* dispatches it during spawn, before the first API call and before the JSONL
|
|
361
|
+
* transcript is created. Waiting on the resulting marker file gives us a
|
|
362
|
+
* positive "Claude is alive" signal instead of racing the transcript writer.
|
|
334
363
|
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* a polling fallback that handles the case where the session directory
|
|
339
|
-
* doesn't exist yet on first run.
|
|
364
|
+
* The timeout only fires on catastrophic startup failure (bad binary, exec
|
|
365
|
+
* error) — under load, Claude's own session bootstrap runs well under the
|
|
366
|
+
* limit because SessionStart is dispatched early in the startup sequence.
|
|
340
367
|
*/
|
|
341
|
-
async function
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
const sessionDir = resolveSessionDir(process.cwd());
|
|
346
|
-
const targetPath = `${sessionDir}/${sessionId}.jsonl`;
|
|
368
|
+
async function waitForReadyMarker(sessionId: string): Promise<void> {
|
|
369
|
+
const { ready: readyDir } = claudeHookDirs();
|
|
370
|
+
await mkdir(readyDir, { recursive: true });
|
|
371
|
+
const target = join(readyDir, sessionId);
|
|
347
372
|
|
|
348
|
-
if (existsSync(
|
|
373
|
+
if (existsSync(target)) return;
|
|
349
374
|
|
|
350
375
|
const ac = new AbortController();
|
|
351
|
-
const timeout = setTimeout(() => ac.abort(),
|
|
376
|
+
const timeout = setTimeout(() => ac.abort(), READY_HOOK_TIMEOUT_MS);
|
|
352
377
|
|
|
353
378
|
try {
|
|
354
379
|
await Promise.race([
|
|
355
|
-
// fs.watch — instant OS-native notification when
|
|
380
|
+
// fs.watch — instant OS-native notification when the hook writes the file
|
|
356
381
|
(async (): Promise<void> => {
|
|
357
382
|
try {
|
|
358
|
-
for await (const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
383
|
+
for await (const _event of watch(readyDir, { signal: ac.signal })) {
|
|
384
|
+
// Trust disk state, not event.filename (Linux can deliver
|
|
385
|
+
// unexpected basenames under tmp+rename writes).
|
|
386
|
+
if (existsSync(target)) return;
|
|
362
387
|
}
|
|
363
388
|
} catch (e: unknown) {
|
|
364
389
|
if (e instanceof Error && e.name === "AbortError") throw e;
|
|
365
|
-
// Directory doesn't exist yet — let polling handle it
|
|
366
390
|
}
|
|
367
|
-
// Park this branch so polling can win the race
|
|
368
391
|
return new Promise<void>(() => {});
|
|
369
392
|
})(),
|
|
370
393
|
|
|
371
|
-
// Polling fallback —
|
|
394
|
+
// Polling fallback — catches dropped inotify/FSEvent notifications
|
|
372
395
|
(async (): Promise<void> => {
|
|
373
396
|
while (!ac.signal.aborted) {
|
|
374
|
-
if (existsSync(
|
|
375
|
-
await Bun.sleep(
|
|
397
|
+
if (existsSync(target)) return;
|
|
398
|
+
await Bun.sleep(250);
|
|
376
399
|
}
|
|
377
400
|
throw new DOMException("Aborted", "AbortError");
|
|
378
401
|
})(),
|
|
@@ -380,8 +403,8 @@ async function waitForSessionFileAt(
|
|
|
380
403
|
} catch (e: unknown) {
|
|
381
404
|
if (e instanceof DOMException && e.name === "AbortError") {
|
|
382
405
|
throw new Error(
|
|
383
|
-
`Timed out waiting for Claude
|
|
384
|
-
|
|
406
|
+
`Timed out waiting for Claude SessionStart hook to signal readiness ` +
|
|
407
|
+
`at ${target}. Verify the \`claude\` command started successfully.`,
|
|
385
408
|
);
|
|
386
409
|
}
|
|
387
410
|
throw e;
|
|
@@ -391,16 +414,6 @@ async function waitForSessionFileAt(
|
|
|
391
414
|
}
|
|
392
415
|
}
|
|
393
416
|
|
|
394
|
-
/**
|
|
395
|
-
* Resolve the session directory for a given cwd.
|
|
396
|
-
* Session files live at `~/.claude/projects/<encoded-cwd>/`.
|
|
397
|
-
*/
|
|
398
|
-
function resolveSessionDir(cwd: string): string {
|
|
399
|
-
const encodedCwd = cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
400
|
-
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
401
|
-
return `${home}/.claude/projects/${encodedCwd}`;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
417
|
// ---------------------------------------------------------------------------
|
|
405
418
|
// HIL detection helpers
|
|
406
419
|
// ---------------------------------------------------------------------------
|
|
@@ -600,6 +613,24 @@ async function clearStaleHILMarker(claudeSessionId: string): Promise<void> {
|
|
|
600
613
|
}
|
|
601
614
|
}
|
|
602
615
|
|
|
616
|
+
/**
|
|
617
|
+
* Remove a stale ready marker from a prior session that reused this UUID (in
|
|
618
|
+
* practice impossible — UUIDs are fresh per session — but cheap insurance so
|
|
619
|
+
* `waitForReadyMarker`'s initial existsSync can't false-positive on anything
|
|
620
|
+
* we left behind). Ignores ENOENT.
|
|
621
|
+
*/
|
|
622
|
+
async function clearStaleReadyMarker(claudeSessionId: string): Promise<void> {
|
|
623
|
+
const { ready } = claudeHookDirs();
|
|
624
|
+
await mkdir(ready, { recursive: true });
|
|
625
|
+
try {
|
|
626
|
+
await unlink(join(ready, claudeSessionId));
|
|
627
|
+
} catch (e: unknown) {
|
|
628
|
+
if (!(e instanceof Error && "code" in e && (e as NodeJS.ErrnoException).code === "ENOENT")) {
|
|
629
|
+
throw e;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
|
|
603
634
|
/**
|
|
604
635
|
* Write the next prompt to the session queue file. The currently-running
|
|
605
636
|
* Stop hook process (blocked on poll from the previous turn) picks it up,
|
|
@@ -895,6 +926,7 @@ export async function claudeQuery(options: ClaudeQueryOptions): Promise<SessionM
|
|
|
895
926
|
await clearStaleMarker(claudeSessionId);
|
|
896
927
|
await clearStaleQueue(claudeSessionId);
|
|
897
928
|
await clearStaleHILMarker(claudeSessionId);
|
|
929
|
+
await clearStaleReadyMarker(claudeSessionId);
|
|
898
930
|
|
|
899
931
|
let transcriptBeforeCount = 0;
|
|
900
932
|
let spawnPromptFile: string | undefined;
|
|
@@ -931,7 +963,6 @@ export async function claudeQuery(options: ClaudeQueryOptions): Promise<SessionM
|
|
|
931
963
|
spawnPromptFile,
|
|
932
964
|
paneState.chatFlags,
|
|
933
965
|
claudeSessionId,
|
|
934
|
-
paneState.readyTimeoutMs,
|
|
935
966
|
);
|
|
936
967
|
paneState.claudeStarted = true;
|
|
937
968
|
}
|
|
@@ -995,11 +1026,11 @@ export function mergeDisallowedTools(
|
|
|
995
1026
|
*/
|
|
996
1027
|
export class ClaudeClientWrapper {
|
|
997
1028
|
readonly paneId: string;
|
|
998
|
-
private readonly opts: { chatFlags?: string[]
|
|
1029
|
+
private readonly opts: { chatFlags?: string[] };
|
|
999
1030
|
|
|
1000
1031
|
constructor(
|
|
1001
1032
|
paneId: string,
|
|
1002
|
-
opts: { chatFlags?: string[]
|
|
1033
|
+
opts: { chatFlags?: string[] } = {},
|
|
1003
1034
|
) {
|
|
1004
1035
|
this.paneId = paneId;
|
|
1005
1036
|
this.opts = opts;
|
|
@@ -1017,7 +1048,6 @@ export class ClaudeClientWrapper {
|
|
|
1017
1048
|
return await createClaudeSession({
|
|
1018
1049
|
paneId: this.paneId,
|
|
1019
1050
|
chatFlags: this.opts.chatFlags,
|
|
1020
|
-
readyTimeoutMs: this.opts.readyTimeoutMs,
|
|
1021
1051
|
});
|
|
1022
1052
|
}
|
|
1023
1053
|
|
package/src/sdk/types.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type AgentType = "copilot" | "opencode" | "claude";
|
|
|
36
36
|
type ClientOptionsMap = {
|
|
37
37
|
opencode: { directory?: string; experimental_workspaceID?: string };
|
|
38
38
|
copilot: Omit<CopilotClientOptions, "cliUrl">;
|
|
39
|
-
claude: { chatFlags?: string[]
|
|
39
|
+
claude: { chatFlags?: string[] };
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
/**
|