@polygraph/codex-plugin 0.4.46 → 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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polygraph",
3
- "version": "0.4.46",
3
+ "version": "0.4.48",
4
4
  "description": "AI agent skills and subagents for Polygraph sessions, repository context, and coordination",
5
5
  "author": {
6
6
  "name": "Narwhal Technologies Inc",
@@ -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
- return polygraphSessionId ? { ...common, polygraphSessionId } : undefined;
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
- return linkAgentSession(
31
- {
32
- ...link,
33
- pid,
34
- cwd: link.cwd ?? process.cwd(),
35
- },
36
- spawn,
37
- env
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polygraph/codex-plugin",
3
- "version": "0.4.46",
3
+ "version": "0.4.48",
4
4
  "description": "AI agent skills and subagents for Polygraph sessions, repository context, and coordination",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,