harnery 0.31.6 → 0.32.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/commander.d.ts.map +1 -1
- package/dist/commander.js +2 -0
- package/dist/commands/agents.d.ts +0 -9
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +70 -95
- package/dist/commands/browse-session.d.ts +21 -0
- package/dist/commands/browse-session.d.ts.map +1 -0
- package/dist/commands/browse-session.js +157 -0
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +205 -37
- package/dist/commands/checkpoint.js +1 -1
- package/dist/commands/deinit.d.ts.map +1 -1
- package/dist/commands/deinit.js +4 -0
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +40 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +100 -17
- package/dist/commands/init.d.ts +1 -2
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +16 -5
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +2 -3
- package/dist/core/agents/canonical-emit.d.ts +1 -2
- package/dist/core/agents/canonical-emit.d.ts.map +1 -1
- package/dist/core/agents/canonical-emit.js +1 -2
- package/dist/core/agents/cli.js +123 -88
- package/dist/core/agents/coord-client.d.ts +7 -3
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +5 -4
- package/dist/core/agents/finalization.d.ts +68 -0
- package/dist/core/agents/finalization.d.ts.map +1 -0
- package/dist/core/agents/finalization.js +443 -0
- package/dist/core/agents/git-hook.d.ts +51 -0
- package/dist/core/agents/git-hook.d.ts.map +1 -0
- package/dist/core/agents/git-hook.js +118 -0
- package/dist/core/agents/render/prompt-context.d.ts +6 -5
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
- package/dist/core/agents/render/prompt-context.js +26 -13
- package/dist/core/agents/render/session-context.d.ts.map +1 -1
- package/dist/core/agents/render/session-context.js +15 -2
- package/dist/core/agents/rules/claim-conflict.js +3 -3
- package/dist/core/agents/rules/commit-conflict.d.ts +15 -6
- package/dist/core/agents/rules/commit-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/commit-conflict.js +21 -5
- package/dist/core/agents/rules/stop-hook.d.ts +3 -0
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +59 -23
- package/dist/core/agents/session-events.d.ts +8 -16
- package/dist/core/agents/session-events.d.ts.map +1 -1
- package/dist/core/agents/session-events.js +12 -26
- package/dist/core/agents/state/heartbeat-projector.d.ts +3 -0
- package/dist/core/agents/state/heartbeat-projector.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-projector.js +44 -1
- package/dist/core/agents/state/heartbeat-writer.d.ts +32 -5
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +54 -17
- package/dist/core/agents/state/names.d.ts +22 -1
- package/dist/core/agents/state/names.d.ts.map +1 -1
- package/dist/core/agents/state/names.js +40 -2
- package/dist/core/config.d.ts +30 -2
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +74 -11
- package/dist/core/governor/planning.d.ts.map +1 -1
- package/dist/core/governor/planning.js +12 -13
- package/dist/core/hooks/adapter/detect.d.ts +2 -4
- package/dist/core/hooks/adapter/detect.d.ts.map +1 -1
- package/dist/core/hooks/adapter/detect.js +4 -14
- package/dist/core/hooks/adapter/output.d.ts +1 -1
- package/dist/core/hooks/adapter/output.d.ts.map +1 -1
- package/dist/core/hooks/adapter/output.js +5 -4
- package/dist/core/hooks/adapter/wiring.d.ts +23 -0
- package/dist/core/hooks/adapter/wiring.d.ts.map +1 -1
- package/dist/core/hooks/adapter/wiring.js +32 -0
- package/dist/core/hooks/cli.d.ts +1 -2
- package/dist/core/hooks/cli.d.ts.map +1 -1
- package/dist/core/hooks/cli.js +169 -27
- package/dist/core/hooks/codex-wsl-bridge.d.ts +46 -0
- package/dist/core/hooks/codex-wsl-bridge.d.ts.map +1 -0
- package/dist/core/hooks/codex-wsl-bridge.js +137 -0
- package/dist/core/hooks/effects/index.d.ts +1 -1
- package/dist/core/hooks/effects/index.js +3 -3
- package/dist/core/hooks/events/schema.d.ts +27 -0
- package/dist/core/hooks/events/schema.d.ts.map +1 -1
- package/dist/core/hooks/resolve/owner.d.ts +7 -1
- package/dist/core/hooks/resolve/owner.d.ts.map +1 -1
- package/dist/core/hooks/resolve/owner.js +15 -0
- package/dist/core/hooks/resolve/transcript.d.ts +44 -0
- package/dist/core/hooks/resolve/transcript.d.ts.map +1 -1
- package/dist/core/hooks/resolve/transcript.js +176 -1
- package/dist/core/hooks/session-name-presence.d.ts +30 -0
- package/dist/core/hooks/session-name-presence.d.ts.map +1 -0
- package/dist/core/hooks/session-name-presence.js +43 -0
- package/dist/core/hooks/unsafe-cross-shell.d.ts +13 -0
- package/dist/core/hooks/unsafe-cross-shell.d.ts.map +1 -0
- package/dist/core/hooks/unsafe-cross-shell.js +151 -0
- package/dist/core/work/state.d.ts +4 -5
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +5 -8
- package/dist/core/workflow/index.d.ts +1 -1
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/proof.d.ts +2 -2
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +2 -2
- package/dist/core/workflow/run-state.d.ts +2 -2
- package/dist/core/workflow/run-state.d.ts.map +1 -1
- package/dist/core/workflow/run-state.js +2 -2
- package/dist/core/workflow/types.d.ts +3 -3
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/execution.d.ts +2 -2
- package/dist/core/workflow/workspaces/execution.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/execution.js +5 -0
- package/dist/core/workflow/workspaces/index.d.ts +1 -1
- package/dist/core/workflow/workspaces/index.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/local-git.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/local-git.js +1 -2
- package/dist/core/workflow/workspaces/paths.d.ts +2 -2
- package/dist/core/workflow/workspaces/types.d.ts +0 -6
- package/dist/core/workflow/workspaces/types.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/validate.d.ts +0 -2
- package/dist/core/workflow/workspaces/validate.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/validate.js +0 -2
- package/dist/lib/browser/client.d.ts +118 -1
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +435 -6
- package/dist/lib/browser/geometry.d.ts.map +1 -1
- package/dist/lib/browser/geometry.js +180 -37
- package/dist/lib/browser/index.d.ts +5 -1
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +5 -1
- package/dist/lib/browser/netscape-cookies.d.ts +6 -0
- package/dist/lib/browser/netscape-cookies.d.ts.map +1 -0
- package/dist/lib/browser/netscape-cookies.js +31 -0
- package/dist/lib/browser/proxy.d.ts +24 -0
- package/dist/lib/browser/proxy.d.ts.map +1 -0
- package/dist/lib/browser/proxy.js +84 -0
- package/dist/lib/browser/runts.d.ts +6 -0
- package/dist/lib/browser/runts.d.ts.map +1 -1
- package/dist/lib/browser/runts.js +21 -4
- package/dist/lib/browser/session-control.d.ts +112 -0
- package/dist/lib/browser/session-control.d.ts.map +1 -0
- package/dist/lib/browser/session-control.js +670 -0
- package/dist/lib/docs-links.d.ts +108 -0
- package/dist/lib/docs-links.d.ts.map +1 -0
- package/dist/lib/docs-links.js +555 -0
- package/dist/lib/exec.d.ts +1 -1
- package/dist/lib/exec.js +1 -1
- package/dist/lib/identities/assume.d.ts +4 -2
- package/dist/lib/identities/assume.d.ts.map +1 -1
- package/dist/lib/identities/assume.js +15 -2
- package/dist/lib/instructions/git-hooks.d.ts +75 -0
- package/dist/lib/instructions/git-hooks.d.ts.map +1 -0
- package/dist/lib/instructions/git-hooks.js +238 -0
- package/dist/lib/instructions/splice.d.ts +10 -4
- package/dist/lib/instructions/splice.d.ts.map +1 -1
- package/dist/lib/instructions/splice.js +19 -11
- package/package.json +1 -1
- package/schemas/config.schema.json +32 -0
- package/src/commander.ts +2 -0
- package/src/commands/agents.ts +96 -115
- package/src/commands/browse-session.ts +245 -0
- package/src/commands/browse.ts +287 -44
- package/src/commands/checkpoint.ts +1 -1
- package/src/commands/deinit.ts +7 -1
- package/src/commands/docs.ts +56 -0
- package/src/commands/doctor.ts +100 -18
- package/src/commands/init.ts +17 -9
- package/src/commands/tunnel.ts +2 -5
- package/src/core/agents/canonical-emit.ts +1 -2
- package/src/core/agents/cli.ts +137 -88
- package/src/core/agents/coord-client.ts +10 -5
- package/src/core/agents/finalization.ts +595 -0
- package/src/core/agents/git-hook.ts +126 -0
- package/src/core/agents/render/prompt-context.ts +28 -13
- package/src/core/agents/render/session-context.ts +15 -2
- package/src/core/agents/rules/claim-conflict.ts +3 -3
- package/src/core/agents/rules/commit-conflict.ts +35 -8
- package/src/core/agents/rules/stop-hook.ts +71 -23
- package/src/core/agents/session-events.ts +14 -41
- package/src/core/agents/state/heartbeat-projector.ts +45 -1
- package/src/core/agents/state/heartbeat-writer.ts +78 -16
- package/src/core/agents/state/names.ts +54 -2
- package/src/core/config.ts +92 -12
- package/src/core/governor/planning.ts +17 -12
- package/src/core/hooks/adapter/detect.ts +4 -13
- package/src/core/hooks/adapter/output.ts +9 -4
- package/src/core/hooks/adapter/wiring.ts +43 -0
- package/src/core/hooks/cli.ts +201 -23
- package/src/core/hooks/codex-wsl-bridge.ts +188 -0
- package/src/core/hooks/effects/index.ts +5 -5
- package/src/core/hooks/events/schema.ts +27 -0
- package/src/core/hooks/resolve/owner.ts +22 -1
- package/src/core/hooks/resolve/transcript.ts +164 -1
- package/src/core/hooks/session-name-presence.ts +52 -0
- package/src/core/hooks/unsafe-cross-shell.ts +160 -0
- package/src/core/work/state.ts +8 -12
- package/src/core/workflow/engine.ts +2 -2
- package/src/core/workflow/index.ts +0 -1
- package/src/core/workflow/proof.ts +4 -4
- package/src/core/workflow/run-state.ts +5 -5
- package/src/core/workflow/types.ts +3 -3
- package/src/core/workflow/workspaces/execution.ts +11 -4
- package/src/core/workflow/workspaces/index.ts +0 -3
- package/src/core/workflow/workspaces/local-git.ts +1 -2
- package/src/core/workflow/workspaces/paths.ts +2 -2
- package/src/core/workflow/workspaces/types.ts +0 -9
- package/src/core/workflow/workspaces/validate.ts +1 -5
- package/src/lib/browser/client.ts +528 -6
- package/src/lib/browser/geometry.ts +197 -37
- package/src/lib/browser/index.ts +39 -0
- package/src/lib/browser/netscape-cookies.ts +39 -0
- package/src/lib/browser/proxy.ts +105 -0
- package/src/lib/browser/runts.ts +27 -3
- package/src/lib/browser/session-control.ts +892 -0
- package/src/lib/docs-links.ts +674 -0
- package/src/lib/exec.ts +1 -1
- package/src/lib/identities/assume.ts +22 -1
- package/src/lib/instructions/git-hooks.ts +259 -0
- package/src/lib/instructions/splice.ts +41 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/events/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,cAAc,EAAG,CAAU,CAAC;AAEzC;;;4CAG4C;AAC5C,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEzD,MAAM,MAAM,MAAM,GAAG,aAAa,GAAG,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,WAAW,aAAa,CAAC,KAAK,SAAS,MAAM,EAAE,KAAK;IACxD,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,KAAK,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;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OAAO,CAAC;CACnB,CACF,CAAC;AAIF,MAAM,MAAM,KAAK,GACb,YAAY,GACZ,UAAU,GACV,aAAa,GACb,YAAY,GACZ,gBAAgB,GAChB,QAAQ,GACR,YAAY,GACZ,aAAa,GACb,UAAU,GACV,SAAS,GACT,UAAU,GACV,WAAW,GACX,kBAAkB,GAClB,eAAe,GACf,aAAa,GACb,cAAc,GACd,wBAAwB,GACxB,wBAAwB,GACxB,0BAA0B,GAC1B,uBAAuB,GACvB,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,YAAY,GACZ,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,GACnB,cAAc,GACd,eAAe,GACf,WAAW,GACX,gBAAgB,GAChB,mBAAmB,GACnB,iBAAiB,GACjB,YAAY,GACZ,cAAc,GACd,aAAa,GACb,YAAY,GACZ,aAAa,GACb,mBAAmB,GACnB,gBAAgB,GAChB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;AAE5C;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,kBAAkB,GAAG,kBAAkB,GAAG,cAAc,CAAC;IAC/D,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
* events; session_id is the parent-shape default.
|
|
12
12
|
* 3. PID-map lookup at `.harnery/pid-map/<pid>` for our own pid, then ppid
|
|
13
13
|
* chain (up to 20 hops).
|
|
14
|
+
* 4. `CODEX_THREAD_ID` env var, accepted only when a live heartbeat by that
|
|
15
|
+
* id exists under `.harnery/active/`. Codex sessions use their thread id
|
|
16
|
+
* as the heartbeat instance_id, and a Windows→WSL bridge forwards the
|
|
17
|
+
* var into process trees that descend from no registered process — the
|
|
18
|
+
* one place the pid walk can never land. Validated so a garbage value
|
|
19
|
+
* cannot fabricate an identity.
|
|
14
20
|
*
|
|
15
21
|
* Returns null when nothing resolves. Callers must treat null as "no owner"
|
|
16
22
|
* and skip the event (Phase 2 fail-safe; Phase 3 will mint a temporary owner
|
|
@@ -21,7 +27,7 @@ export declare function resolveOwner(opts: {
|
|
|
21
27
|
coordRoot: string;
|
|
22
28
|
}): {
|
|
23
29
|
instance_id: string;
|
|
24
|
-
source: "env" | "payload" | "pidmap-self" | "pidmap-ancestor";
|
|
30
|
+
source: "env" | "payload" | "pidmap-self" | "pidmap-ancestor" | "codex-env";
|
|
25
31
|
} | null;
|
|
26
32
|
/**
|
|
27
33
|
* Find the parent owner for a subagent invocation. The per-shell marker at
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"owner.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/resolve/owner.ts"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"owner.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/resolve/owner.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,KAAK,GAAG,SAAS,GAAG,aAAa,GAAG,iBAAiB,GAAG,WAAW,CAAC;CAC7E,GAAG,IAAI,CAgEP;AA2BD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ7E;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUxF;AAED,2DAA2D;AAC3D,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAgBnF"}
|
|
@@ -16,6 +16,12 @@ import { checkPidToken } from "../../agents/state/proc-start.js";
|
|
|
16
16
|
* events; session_id is the parent-shape default.
|
|
17
17
|
* 3. PID-map lookup at `.harnery/pid-map/<pid>` for our own pid, then ppid
|
|
18
18
|
* chain (up to 20 hops).
|
|
19
|
+
* 4. `CODEX_THREAD_ID` env var, accepted only when a live heartbeat by that
|
|
20
|
+
* id exists under `.harnery/active/`. Codex sessions use their thread id
|
|
21
|
+
* as the heartbeat instance_id, and a Windows→WSL bridge forwards the
|
|
22
|
+
* var into process trees that descend from no registered process — the
|
|
23
|
+
* one place the pid walk can never land. Validated so a garbage value
|
|
24
|
+
* cannot fabricate an identity.
|
|
19
25
|
*
|
|
20
26
|
* Returns null when nothing resolves. Callers must treat null as "no owner"
|
|
21
27
|
* and skip the event (Phase 2 fail-safe; Phase 3 will mint a temporary owner
|
|
@@ -71,6 +77,15 @@ export function resolveOwner(opts) {
|
|
|
71
77
|
hops++;
|
|
72
78
|
}
|
|
73
79
|
}
|
|
80
|
+
// Tier 4: Codex thread id, heartbeat-validated. Last because the pid map is
|
|
81
|
+
// more specific when it answers — an inherited env var can outlive the
|
|
82
|
+
// process tree it described, a live pid-map row cannot.
|
|
83
|
+
const codexThreadId = process.env.CODEX_THREAD_ID?.trim();
|
|
84
|
+
if (codexThreadId &&
|
|
85
|
+
/^[A-Za-z0-9-]+$/.test(codexThreadId) &&
|
|
86
|
+
existsSync(join(opts.coordRoot, ".harnery", "active", `${codexThreadId}.json`))) {
|
|
87
|
+
return { instance_id: codexThreadId, source: "codex-env" };
|
|
88
|
+
}
|
|
74
89
|
return null;
|
|
75
90
|
}
|
|
76
91
|
function readPpid(pid) {
|
|
@@ -10,6 +10,21 @@
|
|
|
10
10
|
* and Phase 5 verdict path catches the race via a single retry.
|
|
11
11
|
*/
|
|
12
12
|
export declare function scanStatusBoxPresent(transcriptPath: string | undefined): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Scan a CC-style JSONL transcript for a needle in ASSISTANT message text
|
|
15
|
+
* blocks only. Used by `turn.stop` to detect the suggested session name in the
|
|
16
|
+
* reply.
|
|
17
|
+
*
|
|
18
|
+
* The row filter is load-bearing: the transcript tail also carries the needle
|
|
19
|
+
* inside `tool_result` rows (the `agents set-task` JSON output) and hook
|
|
20
|
+
* context rows, so a raw `includes()` over the tail — the way the status-box
|
|
21
|
+
* scan works — would false-pass the moment set-task runs. Verified empirically
|
|
22
|
+
* 2026-08-09 against a live transcript.
|
|
23
|
+
*
|
|
24
|
+
* Same 256KB tail window as the other scans; the window's first line may be a
|
|
25
|
+
* truncated JSON row, which the per-line parse guard skips.
|
|
26
|
+
*/
|
|
27
|
+
export declare function scanAssistantTextIncludes(transcriptPath: string | undefined, needle: string): boolean;
|
|
13
28
|
/**
|
|
14
29
|
* Resolve the agent's model from a CC-style JSONL transcript by reading the
|
|
15
30
|
* most-recent assistant message's `message.model`. Claude Code's SessionStart
|
|
@@ -23,4 +38,33 @@ export declare function scanStatusBoxPresent(transcriptPath: string | undefined)
|
|
|
23
38
|
* transcript is missing/empty (e.g. a fresh session's first SessionStart).
|
|
24
39
|
*/
|
|
25
40
|
export declare function scanTranscriptModel(transcriptPath: string | undefined): string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Detect the parent session of a forked CC conversation from its transcript.
|
|
43
|
+
*
|
|
44
|
+
* Empirical basis (verified 2026-08-05 against `claude --resume <id>
|
|
45
|
+
* --fork-session`): the fork copies the parent's rows into a new
|
|
46
|
+
* `<new-session-id>.jsonl`, rewriting every row's `sessionId` to the new id
|
|
47
|
+
* but PRESERVING each copied message row's `uuid`. So a sibling transcript in
|
|
48
|
+
* the same project directory that contains the fork's message uuids is an
|
|
49
|
+
* ancestor of the fork.
|
|
50
|
+
*
|
|
51
|
+
* Ancestor vs. parent: a grandparent (when the parent was itself a fork)
|
|
52
|
+
* shares the fork's early uuids too, but only the true parent contains the
|
|
53
|
+
* whole copied prefix. At detection time the fork's transcript is almost
|
|
54
|
+
* entirely copied prefix, so uuids sampled across the whole file separate the
|
|
55
|
+
* two: score candidates by containment, highest wins.
|
|
56
|
+
*
|
|
57
|
+
* Sibling forks force a second rule: a PRIOR fork of the same parent also
|
|
58
|
+
* contains the whole copied prefix, so it ties the true parent on score. The
|
|
59
|
+
* sibling additionally carries its own post-fork turns, which the parent
|
|
60
|
+
* lacks, so among tied scores the MINIMAL container (fewest message rows)
|
|
61
|
+
* wins. A wrong pick under this rule stays within the ancestry (grandparent
|
|
62
|
+
* at worst); a recency tie-break can name a non-ancestor sibling (observed
|
|
63
|
+
* 2026-08-05 with two probes forked off one parent).
|
|
64
|
+
*
|
|
65
|
+
* Fail-soft by design: any read error, an unflushed transcript, or no
|
|
66
|
+
* qualifying sibling returns undefined, which downgrades the caller to the
|
|
67
|
+
* no-lineage behavior. Never throws.
|
|
68
|
+
*/
|
|
69
|
+
export declare function detectForkParent(transcriptPath: string | undefined, sessionId: string): string | undefined;
|
|
26
70
|
//# sourceMappingURL=transcript.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/resolve/transcript.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../../../../src/core/hooks/resolve/transcript.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAOhF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,MAAM,EAAE,MAAM,GACb,OAAO,CA+BT;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAsB1F;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAgDpB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { existsSync, statSync } from "node:fs";
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { basename, dirname, join } from "node:path";
|
|
2
3
|
/**
|
|
3
4
|
* Scan a CC-style JSONL transcript for the `┌─ agent-` status-box prefix in
|
|
4
5
|
* the most-recent assistant turn. Used by `turn.stop` events to populate
|
|
@@ -20,6 +21,57 @@ export function scanStatusBoxPresent(transcriptPath) {
|
|
|
20
21
|
// for the prefix on any line of the trailing window.
|
|
21
22
|
return text.includes("┌─ agent-");
|
|
22
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Scan a CC-style JSONL transcript for a needle in ASSISTANT message text
|
|
26
|
+
* blocks only. Used by `turn.stop` to detect the suggested session name in the
|
|
27
|
+
* reply.
|
|
28
|
+
*
|
|
29
|
+
* The row filter is load-bearing: the transcript tail also carries the needle
|
|
30
|
+
* inside `tool_result` rows (the `agents set-task` JSON output) and hook
|
|
31
|
+
* context rows, so a raw `includes()` over the tail — the way the status-box
|
|
32
|
+
* scan works — would false-pass the moment set-task runs. Verified empirically
|
|
33
|
+
* 2026-08-09 against a live transcript.
|
|
34
|
+
*
|
|
35
|
+
* Same 256KB tail window as the other scans; the window's first line may be a
|
|
36
|
+
* truncated JSON row, which the per-line parse guard skips.
|
|
37
|
+
*/
|
|
38
|
+
export function scanAssistantTextIncludes(transcriptPath, needle) {
|
|
39
|
+
if (!transcriptPath || !needle || !existsSync(transcriptPath))
|
|
40
|
+
return false;
|
|
41
|
+
const text = tailText(transcriptPath);
|
|
42
|
+
if (!text)
|
|
43
|
+
return false;
|
|
44
|
+
for (const line of text.split("\n")) {
|
|
45
|
+
// Cheap gate before parsing: most lines don't contain the needle at all.
|
|
46
|
+
if (!line.includes(needle))
|
|
47
|
+
continue;
|
|
48
|
+
try {
|
|
49
|
+
const row = JSON.parse(line);
|
|
50
|
+
if (row.type !== "assistant")
|
|
51
|
+
continue;
|
|
52
|
+
const content = row.message?.content;
|
|
53
|
+
if (typeof content === "string") {
|
|
54
|
+
if (content.includes(needle))
|
|
55
|
+
return true;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (!Array.isArray(content))
|
|
59
|
+
continue;
|
|
60
|
+
for (const block of content) {
|
|
61
|
+
if (typeof block !== "object" || block === null)
|
|
62
|
+
continue;
|
|
63
|
+
const b = block;
|
|
64
|
+
if (b.type === "text" && typeof b.text === "string" && b.text.includes(needle)) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Truncated/partial line (tail-window start or flush race); skip it.
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
23
75
|
/**
|
|
24
76
|
* Resolve the agent's model from a CC-style JSONL transcript by reading the
|
|
25
77
|
* most-recent assistant message's `message.model`. Claude Code's SessionStart
|
|
@@ -56,6 +108,129 @@ export function scanTranscriptModel(transcriptPath) {
|
|
|
56
108
|
}
|
|
57
109
|
return undefined;
|
|
58
110
|
}
|
|
111
|
+
const SESSION_FILE_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.jsonl$/i;
|
|
112
|
+
/** Skip absurdly large transcripts rather than buffering them. */
|
|
113
|
+
const FORK_SCAN_MAX_BYTES = 128 * 1024 * 1024;
|
|
114
|
+
/** How many message uuids to sample across the fork's copied prefix. */
|
|
115
|
+
const FORK_SAMPLE_SIZE = 24;
|
|
116
|
+
/**
|
|
117
|
+
* Detect the parent session of a forked CC conversation from its transcript.
|
|
118
|
+
*
|
|
119
|
+
* Empirical basis (verified 2026-08-05 against `claude --resume <id>
|
|
120
|
+
* --fork-session`): the fork copies the parent's rows into a new
|
|
121
|
+
* `<new-session-id>.jsonl`, rewriting every row's `sessionId` to the new id
|
|
122
|
+
* but PRESERVING each copied message row's `uuid`. So a sibling transcript in
|
|
123
|
+
* the same project directory that contains the fork's message uuids is an
|
|
124
|
+
* ancestor of the fork.
|
|
125
|
+
*
|
|
126
|
+
* Ancestor vs. parent: a grandparent (when the parent was itself a fork)
|
|
127
|
+
* shares the fork's early uuids too, but only the true parent contains the
|
|
128
|
+
* whole copied prefix. At detection time the fork's transcript is almost
|
|
129
|
+
* entirely copied prefix, so uuids sampled across the whole file separate the
|
|
130
|
+
* two: score candidates by containment, highest wins.
|
|
131
|
+
*
|
|
132
|
+
* Sibling forks force a second rule: a PRIOR fork of the same parent also
|
|
133
|
+
* contains the whole copied prefix, so it ties the true parent on score. The
|
|
134
|
+
* sibling additionally carries its own post-fork turns, which the parent
|
|
135
|
+
* lacks, so among tied scores the MINIMAL container (fewest message rows)
|
|
136
|
+
* wins. A wrong pick under this rule stays within the ancestry (grandparent
|
|
137
|
+
* at worst); a recency tie-break can name a non-ancestor sibling (observed
|
|
138
|
+
* 2026-08-05 with two probes forked off one parent).
|
|
139
|
+
*
|
|
140
|
+
* Fail-soft by design: any read error, an unflushed transcript, or no
|
|
141
|
+
* qualifying sibling returns undefined, which downgrades the caller to the
|
|
142
|
+
* no-lineage behavior. Never throws.
|
|
143
|
+
*/
|
|
144
|
+
export function detectForkParent(transcriptPath, sessionId) {
|
|
145
|
+
try {
|
|
146
|
+
if (!transcriptPath || !sessionId || !existsSync(transcriptPath))
|
|
147
|
+
return undefined;
|
|
148
|
+
if (statSync(transcriptPath).size > FORK_SCAN_MAX_BYTES)
|
|
149
|
+
return undefined;
|
|
150
|
+
const own = readFileSync(transcriptPath, "utf8");
|
|
151
|
+
const uuids = messageUuids(own);
|
|
152
|
+
if (uuids.length === 0)
|
|
153
|
+
return undefined;
|
|
154
|
+
const sample = sampleEvenly(uuids, FORK_SAMPLE_SIZE);
|
|
155
|
+
const dir = dirname(transcriptPath);
|
|
156
|
+
const ownFile = basename(transcriptPath);
|
|
157
|
+
let best = null;
|
|
158
|
+
for (const file of readdirSync(dir)) {
|
|
159
|
+
if (file === ownFile || !SESSION_FILE_RE.test(file))
|
|
160
|
+
continue;
|
|
161
|
+
const candidateId = file.slice(0, -".jsonl".length);
|
|
162
|
+
if (candidateId === sessionId)
|
|
163
|
+
continue;
|
|
164
|
+
const path = join(dir, file);
|
|
165
|
+
let stat;
|
|
166
|
+
try {
|
|
167
|
+
stat = statSync(path);
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (stat.size > FORK_SCAN_MAX_BYTES)
|
|
173
|
+
continue;
|
|
174
|
+
let text;
|
|
175
|
+
try {
|
|
176
|
+
text = readFileSync(path, "utf8");
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
// Cheap gate before scoring: an ancestor must contain the fork's first
|
|
182
|
+
// copied message uuid (the copy always starts at the beginning).
|
|
183
|
+
if (!text.includes(sample[0]))
|
|
184
|
+
continue;
|
|
185
|
+
let score = 0;
|
|
186
|
+
for (const u of sample)
|
|
187
|
+
if (text.includes(u))
|
|
188
|
+
score++;
|
|
189
|
+
if (score < Math.max(1, Math.ceil(sample.length / 2)))
|
|
190
|
+
continue;
|
|
191
|
+
const rows = messageUuids(text).length;
|
|
192
|
+
const wins = !best ||
|
|
193
|
+
score > best.score ||
|
|
194
|
+
(score === best.score &&
|
|
195
|
+
(rows < best.rows || (rows === best.rows && stat.mtimeMs < best.mtimeMs)));
|
|
196
|
+
if (wins)
|
|
197
|
+
best = { id: candidateId, score, rows, mtimeMs: stat.mtimeMs };
|
|
198
|
+
}
|
|
199
|
+
return best?.id;
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
return undefined;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/** Message-row uuids (user/assistant rows only), in file order. */
|
|
206
|
+
function messageUuids(text) {
|
|
207
|
+
const out = [];
|
|
208
|
+
for (const line of text.split("\n")) {
|
|
209
|
+
if (!line.includes('"uuid"'))
|
|
210
|
+
continue;
|
|
211
|
+
try {
|
|
212
|
+
const row = JSON.parse(line);
|
|
213
|
+
if (row.type !== "user" && row.type !== "assistant")
|
|
214
|
+
continue;
|
|
215
|
+
if (typeof row.uuid === "string" && row.uuid.length > 0)
|
|
216
|
+
out.push(row.uuid);
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
// Truncated/partial line (flush race); skip it.
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return out;
|
|
223
|
+
}
|
|
224
|
+
/** Up to <n> items spread evenly across the list, always including the first. */
|
|
225
|
+
function sampleEvenly(items, n) {
|
|
226
|
+
if (items.length <= n)
|
|
227
|
+
return items;
|
|
228
|
+
const out = [];
|
|
229
|
+
const step = items.length / n;
|
|
230
|
+
for (let i = 0; i < n; i++)
|
|
231
|
+
out.push(items[Math.floor(i * step)]);
|
|
232
|
+
return out;
|
|
233
|
+
}
|
|
59
234
|
/** Tail-read up to 256KB from the end of a file as UTF-8, or undefined on error. */
|
|
60
235
|
function tailText(path) {
|
|
61
236
|
try {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session-name presence for `turn.stop`.
|
|
3
|
+
*
|
|
4
|
+
* While the heartbeat carries a `suggested_session_name`, report whether the
|
|
5
|
+
* naming ritual is satisfied: either this turn's reply shows the name, or an
|
|
6
|
+
* earlier reply already did. Scanning covers assistant text blocks only (the
|
|
7
|
+
* raw transcript tail also carries the name inside the set-task tool_result,
|
|
8
|
+
* which must not count) plus the adapter-supplied last assistant message, for
|
|
9
|
+
* stops that arrive without a transcript.
|
|
10
|
+
*
|
|
11
|
+
* Two properties the stop-hook naming rule depends on:
|
|
12
|
+
*
|
|
13
|
+
* 1. Once a name is satisfied, every later stop keeps reporting `true` rather
|
|
14
|
+
* than omitting the field. The rule wants an in-window `turn.stop` carrying
|
|
15
|
+
* `session_name_present: true`; omitting it after the heartbeat stamp meant
|
|
16
|
+
* nothing could ever re-emit the flag, so every subsequent reply blocked --
|
|
17
|
+
* including the replies reproducing the exact name the rule asked for.
|
|
18
|
+
* 2. The result names WHICH suggested name it covered, so a projector rebuild
|
|
19
|
+
* attributes the sighting to that name instead of to whichever name is
|
|
20
|
+
* current during the replay. Without it, a re-minted name inherited an older
|
|
21
|
+
* name's sighting and looked satisfied without ever having been shown.
|
|
22
|
+
*
|
|
23
|
+
* Never throws: coordination telemetry must not take down a hook.
|
|
24
|
+
*/
|
|
25
|
+
export interface SessionNamePresence {
|
|
26
|
+
session_name_present?: boolean;
|
|
27
|
+
session_name_present_for?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function sessionNamePresence(coordRoot: string, instanceId: string, lastAssistantMessage: string, scanAssistantText: (name: string) => boolean): SessionNamePresence;
|
|
30
|
+
//# sourceMappingURL=session-name-presence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-name-presence.d.ts","sourceRoot":"","sources":["../../../src/core/hooks/session-name-presence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,oBAAoB,EAAE,MAAM,EAC5B,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAC3C,mBAAmB,CAcrB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session-name presence for `turn.stop`.
|
|
3
|
+
*
|
|
4
|
+
* While the heartbeat carries a `suggested_session_name`, report whether the
|
|
5
|
+
* naming ritual is satisfied: either this turn's reply shows the name, or an
|
|
6
|
+
* earlier reply already did. Scanning covers assistant text blocks only (the
|
|
7
|
+
* raw transcript tail also carries the name inside the set-task tool_result,
|
|
8
|
+
* which must not count) plus the adapter-supplied last assistant message, for
|
|
9
|
+
* stops that arrive without a transcript.
|
|
10
|
+
*
|
|
11
|
+
* Two properties the stop-hook naming rule depends on:
|
|
12
|
+
*
|
|
13
|
+
* 1. Once a name is satisfied, every later stop keeps reporting `true` rather
|
|
14
|
+
* than omitting the field. The rule wants an in-window `turn.stop` carrying
|
|
15
|
+
* `session_name_present: true`; omitting it after the heartbeat stamp meant
|
|
16
|
+
* nothing could ever re-emit the flag, so every subsequent reply blocked --
|
|
17
|
+
* including the replies reproducing the exact name the rule asked for.
|
|
18
|
+
* 2. The result names WHICH suggested name it covered, so a projector rebuild
|
|
19
|
+
* attributes the sighting to that name instead of to whichever name is
|
|
20
|
+
* current during the replay. Without it, a re-minted name inherited an older
|
|
21
|
+
* name's sighting and looked satisfied without ever having been shown.
|
|
22
|
+
*
|
|
23
|
+
* Never throws: coordination telemetry must not take down a hook.
|
|
24
|
+
*/
|
|
25
|
+
import { readHeartbeat, stampSessionNameSeen } from "../agents/state/heartbeat-writer.js";
|
|
26
|
+
export function sessionNamePresence(coordRoot, instanceId, lastAssistantMessage, scanAssistantText) {
|
|
27
|
+
try {
|
|
28
|
+
const hb = readHeartbeat(coordRoot, instanceId);
|
|
29
|
+
const name = hb?.suggested_session_name;
|
|
30
|
+
if (!name)
|
|
31
|
+
return {};
|
|
32
|
+
if (hb?.session_name_seen_for === name) {
|
|
33
|
+
return { session_name_present: true, session_name_present_for: name };
|
|
34
|
+
}
|
|
35
|
+
const present = scanAssistantText(name) || lastAssistantMessage.includes(name);
|
|
36
|
+
if (present)
|
|
37
|
+
stampSessionNameSeen(coordRoot, instanceId, name);
|
|
38
|
+
return { session_name_present: present, session_name_present_for: name };
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return {};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Adapter } from "./events/schema.js";
|
|
2
|
+
export interface CrossShellInspection {
|
|
3
|
+
adapter: Adapter;
|
|
4
|
+
cwd: unknown;
|
|
5
|
+
toolName: unknown;
|
|
6
|
+
toolInput: unknown;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Deny only the unsafe hybrid shape: Windows-native Codex, WSL UNC workspace,
|
|
10
|
+
* shell tool, and a direct wsl.exe -> bash -c/-lc command-string invocation.
|
|
11
|
+
*/
|
|
12
|
+
export declare function unsafeCrossShellReason(input: CrossShellInspection): string | null;
|
|
13
|
+
//# sourceMappingURL=unsafe-cross-shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unsafe-cross-shell.d.ts","sourceRoot":"","sources":["../../../src/core/hooks/unsafe-cross-shell.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB;AA8ID;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,GAAG,IAAI,CAKjF"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { isWslUncPath } from "./codex-wsl-bridge.js";
|
|
2
|
+
const DENY_REASON = "Unsafe Windows-to-WSL shell-string construction blocked. Use the host's argv-preserving " +
|
|
3
|
+
"WSL bridge for a single executable, or its literal-script mode for compound Bash. Do not " +
|
|
4
|
+
"invoke wsl.exe with bash -c or bash -lc.";
|
|
5
|
+
function shellCommand(toolName, toolInput) {
|
|
6
|
+
if (typeof toolName !== "string")
|
|
7
|
+
return null;
|
|
8
|
+
const normalized = toolName.toLowerCase();
|
|
9
|
+
if (normalized !== "bash" &&
|
|
10
|
+
normalized !== "shell" &&
|
|
11
|
+
normalized !== "shell_command" &&
|
|
12
|
+
normalized !== "functions.shell_command") {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
let input = toolInput;
|
|
16
|
+
if (typeof input === "string") {
|
|
17
|
+
try {
|
|
18
|
+
input = JSON.parse(input);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (!input || typeof input !== "object")
|
|
25
|
+
return null;
|
|
26
|
+
const command = input.command;
|
|
27
|
+
return typeof command === "string" ? command : null;
|
|
28
|
+
}
|
|
29
|
+
function quotedToken(command, start) {
|
|
30
|
+
const quote = command[start];
|
|
31
|
+
let token = "";
|
|
32
|
+
for (let index = start + 1; index < command.length; index += 1) {
|
|
33
|
+
const char = command[index];
|
|
34
|
+
if (char === "`" && quote === '"' && index + 1 < command.length) {
|
|
35
|
+
token += command[index + 1];
|
|
36
|
+
index += 1;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (char === quote) {
|
|
40
|
+
if (quote === "'" && command[index + 1] === "'") {
|
|
41
|
+
token += "'";
|
|
42
|
+
index += 1;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
return { token, end: index + 1 };
|
|
46
|
+
}
|
|
47
|
+
token += char;
|
|
48
|
+
}
|
|
49
|
+
return { token, end: command.length };
|
|
50
|
+
}
|
|
51
|
+
/** Find direct PowerShell command invocations of wsl/wsl.exe outside quoted strings. */
|
|
52
|
+
function wslInvocationOffsets(command) {
|
|
53
|
+
const offsets = [];
|
|
54
|
+
let expectCommand = true;
|
|
55
|
+
let callOperator = false;
|
|
56
|
+
for (let index = 0; index < command.length;) {
|
|
57
|
+
const char = command[index];
|
|
58
|
+
if (/\s/.test(char)) {
|
|
59
|
+
if (char === "\n" || char === "\r") {
|
|
60
|
+
expectCommand = true;
|
|
61
|
+
callOperator = false;
|
|
62
|
+
}
|
|
63
|
+
index += 1;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (char === "#" && expectCommand) {
|
|
67
|
+
const newline = command.indexOf("\n", index + 1);
|
|
68
|
+
index = newline === -1 ? command.length : newline + 1;
|
|
69
|
+
expectCommand = true;
|
|
70
|
+
callOperator = false;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (";|{}=()".includes(char)) {
|
|
74
|
+
expectCommand = true;
|
|
75
|
+
callOperator = false;
|
|
76
|
+
index += 1;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (char === "&") {
|
|
80
|
+
expectCommand = true;
|
|
81
|
+
callOperator = true;
|
|
82
|
+
index += command[index + 1] === "&" ? 2 : 1;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (char === "'" || char === '"') {
|
|
86
|
+
const parsed = quotedToken(command, index);
|
|
87
|
+
if (expectCommand && callOperator && /^wsl(?:\.exe)?$/i.test(parsed.token)) {
|
|
88
|
+
offsets.push(index);
|
|
89
|
+
}
|
|
90
|
+
expectCommand = false;
|
|
91
|
+
callOperator = false;
|
|
92
|
+
index = parsed.end;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const start = index;
|
|
96
|
+
while (index < command.length && !/[\s;|{}=()&]/.test(command[index]))
|
|
97
|
+
index += 1;
|
|
98
|
+
const token = command.slice(start, index);
|
|
99
|
+
if (expectCommand && /^wsl(?:\.exe)?$/i.test(token))
|
|
100
|
+
offsets.push(start);
|
|
101
|
+
expectCommand = false;
|
|
102
|
+
callOperator = false;
|
|
103
|
+
}
|
|
104
|
+
return offsets;
|
|
105
|
+
}
|
|
106
|
+
function statementEnd(command, start) {
|
|
107
|
+
let quote = null;
|
|
108
|
+
for (let index = start; index < command.length; index += 1) {
|
|
109
|
+
const char = command[index];
|
|
110
|
+
if (quote) {
|
|
111
|
+
if (char === "`" && quote === '"') {
|
|
112
|
+
index += 1;
|
|
113
|
+
}
|
|
114
|
+
else if (char === quote) {
|
|
115
|
+
if (quote === "'" && command[index + 1] === "'")
|
|
116
|
+
index += 1;
|
|
117
|
+
else
|
|
118
|
+
quote = null;
|
|
119
|
+
}
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (char === "'" || char === '"')
|
|
123
|
+
quote = char;
|
|
124
|
+
else if (char === ";" || char === "\n" || char === "\r" || char === "|")
|
|
125
|
+
return index;
|
|
126
|
+
else if (char === "&" && command[index + 1] === "&")
|
|
127
|
+
return index;
|
|
128
|
+
}
|
|
129
|
+
return command.length;
|
|
130
|
+
}
|
|
131
|
+
function invokesBashCommandString(command) {
|
|
132
|
+
for (const offset of wslInvocationOffsets(command)) {
|
|
133
|
+
const segment = command.slice(offset, statementEnd(command, offset));
|
|
134
|
+
if (/(?:^|\s)(?:\/bin\/)?bash(?=\s|$)[\s\S]*?\s-[a-z]*c[a-z]*(?=\s|$)/i.test(segment)) {
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Deny only the unsafe hybrid shape: Windows-native Codex, WSL UNC workspace,
|
|
142
|
+
* shell tool, and a direct wsl.exe -> bash -c/-lc command-string invocation.
|
|
143
|
+
*/
|
|
144
|
+
export function unsafeCrossShellReason(input) {
|
|
145
|
+
if (input.adapter !== "codex" || !isWslUncPath(input.cwd))
|
|
146
|
+
return null;
|
|
147
|
+
const command = shellCommand(input.toolName, input.toolInput);
|
|
148
|
+
if (!command || !invokesBashCommandString(command))
|
|
149
|
+
return null;
|
|
150
|
+
return DENY_REASON;
|
|
151
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const WORK_INTENT_SCHEMA_VERSION:
|
|
1
|
+
export declare const WORK_INTENT_SCHEMA_VERSION: 2;
|
|
2
2
|
export declare const WORK_EVENT_SCHEMA_VERSION: 1;
|
|
3
3
|
export type WorkState = "waiting" | "ready" | "running" | "awaiting_approval" | "in_review" | "blocked" | "succeeded" | "cancelled";
|
|
4
4
|
export type WorkNextAction = "wait_for_dependencies" | "run" | "wait_for_run" | "resolve_approval" | "resume" | "retry" | "review" | "none";
|
|
@@ -15,12 +15,11 @@ export interface WorkIntent {
|
|
|
15
15
|
sha256: string;
|
|
16
16
|
};
|
|
17
17
|
max_attempts: number;
|
|
18
|
-
/** Ceiling on
|
|
18
|
+
/** Ceiling on consecutive uncharged attempts (ADR 0046), separate from
|
|
19
19
|
* max_attempts. An upstream outage produces uncharged attempt after uncharged
|
|
20
20
|
* attempt; without a bound it would retry forever. At the bound the item stops
|
|
21
|
-
* and reports it is blocked on an outside service.
|
|
22
|
-
|
|
23
|
-
max_uncharged_attempts?: number;
|
|
21
|
+
* and reports it is blocked on an outside service. */
|
|
22
|
+
max_uncharged_attempts: number;
|
|
24
23
|
source?: {
|
|
25
24
|
kind: "human" | "workflow" | "external";
|
|
26
25
|
ref?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/core/work/state.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,0BAA0B,EAAG,CAAU,CAAC;AACrD,eAAO,MAAM,yBAAyB,EAAG,CAAU,CAAC;AAwBpD,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,OAAO,GACP,SAAS,GACT,mBAAmB,GACnB,WAAW,GACX,SAAS,GACT,WAAW,GACX,WAAW,CAAC;AAEhB,MAAM,MAAM,cAAc,GACtB,uBAAuB,GACvB,KAAK,GACL,cAAc,GACd,kBAAkB,GAClB,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,MAAM,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,OAAO,CAAC;AAErD,MAAM,WAAW,UAAU;IACzB,cAAc,EAAE,OAAO,0BAA0B,CA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