@polygraph/codex-plugin 0.4.47 → 0.4.48
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.
|
@@ -102,7 +102,11 @@ export function buildCommandHookLink(payload, agentType, env = process.env) {
|
|
|
102
102
|
|
|
103
103
|
if (payload.hook_event_name === 'SessionStart') {
|
|
104
104
|
const polygraphSessionId = nonEmptyString(env.POLYGRAPH_SESSION_ID);
|
|
105
|
-
|
|
105
|
+
if (polygraphSessionId) return { ...common, polygraphSessionId };
|
|
106
|
+
|
|
107
|
+
// Ordinary Claude sessions are eligible for speculative capture. Other
|
|
108
|
+
// harnesses still require launch-provided Polygraph session evidence.
|
|
109
|
+
return agentType === 'claude' ? common : undefined;
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
if (payload.hook_event_name === 'PostToolUse') {
|
|
@@ -27,15 +27,18 @@ export function main({
|
|
|
27
27
|
const link = buildCommandHookLink(payload, agentType, env);
|
|
28
28
|
if (!link) return false;
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
const claim = {
|
|
31
|
+
...link,
|
|
32
|
+
cwd: link.cwd ?? process.cwd(),
|
|
33
|
+
};
|
|
34
|
+
// Claude lifecycle hooks deliberately forward only the exact harness
|
|
35
|
+
// identity, transcript, cwd, and hook source. PID is not identity and can
|
|
36
|
+
// be stale by the time an asynchronous SessionStart hook runs.
|
|
37
|
+
if (!(agentType === 'claude' && payload?.hook_event_name === 'SessionStart')) {
|
|
38
|
+
claim.pid = pid;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return linkAgentSession(claim, spawn, env);
|
|
39
42
|
} catch (error) {
|
|
40
43
|
logHookFailure(`${agentType || 'unknown'}:link-agent-session`, error, {
|
|
41
44
|
hookEventName: payload?.hook_event_name,
|
package/package.json
CHANGED