@darkhunt-security/endpoint-codex 0.9.6 → 0.9.7

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": "darkhunt-guard",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "hooks": "./hooks/hooks.json",
5
5
  "description": "Darkhunt endpoint plugin for Codex CLI \u2014 full session trace capture and PreToolUse guardrails.",
6
6
  "author": {
@@ -18489,6 +18489,21 @@ var SessionEmitter = class {
18489
18489
  agentType() {
18490
18490
  return this.options.agentType ?? this.meta["agentType"];
18491
18491
  }
18492
+ /**
18493
+ * The agent that spawned this one.
18494
+ *
18495
+ * Claude Code names it outright, from a sidecar the host writes, and it arrives as an
18496
+ * option. Codex never says "parent agent" — but it does not need to: a Codex subagent
18497
+ * is a rollout of its own, so its agent id IS its thread id, and `parent_thread_id`
18498
+ * (carried here as `parentSessionId`) therefore names the parent agent exactly.
18499
+ *
18500
+ * At depth 1 that thread is the session rather than a subagent, so the id names a node
18501
+ * the consumer has as a session and not as an agent. That is the consumer's fallback to
18502
+ * resolve; reporting what the producer actually observed is this side's job.
18503
+ */
18504
+ parentAgentId() {
18505
+ return this.options.parentAgentId ?? this.meta["parentSessionId"];
18506
+ }
18492
18507
  defaultTraceName() {
18493
18508
  const agentType = this.agentType();
18494
18509
  if (agentType)
@@ -18516,7 +18531,9 @@ var SessionEmitter = class {
18516
18531
  // agent out of a span already look for the snake_case names other producers
18517
18532
  // send. A camelCase key arrives intact and is never found.
18518
18533
  ...this.agentId() !== void 0 ? { agent_id: this.agentId() } : {},
18519
- ...this.agentType() !== void 0 ? { agent_type: this.agentType() } : {}
18534
+ ...this.agentType() !== void 0 ? { agent_type: this.agentType() } : {},
18535
+ ...this.parentAgentId() !== void 0 ? { parent_agent_id: this.parentAgentId() } : {},
18536
+ ...this.options.spawnDepth !== void 0 ? { spawn_depth: this.options.spawnDepth } : {}
18520
18537
  },
18521
18538
  ...this.options.userId !== void 0 ? { userId: this.options.userId } : {},
18522
18539
  ...this.options.userEmail !== void 0 ? { userEmail: this.options.userEmail } : {},
@@ -21669,6 +21686,8 @@ async function runForwarder(mapper, options = {}) {
21669
21686
  passKey: String(from),
21670
21687
  ...sub?.agentId !== void 0 ? { agentId: sub.agentId } : {},
21671
21688
  ...sub?.agentType !== void 0 ? { agentType: sub.agentType } : {},
21689
+ ...sub?.parentAgentId !== void 0 ? { parentAgentId: sub.parentAgentId } : {},
21690
+ ...sub?.spawnDepth !== void 0 ? { spawnDepth: sub.spawnDepth } : {},
21672
21691
  ...ids !== void 0 ? { ids } : {},
21673
21692
  ...userId !== void 0 ? { userId } : {},
21674
21693
  ...carried !== void 0 ? { resumeTurn: carried } : {}
@@ -18489,6 +18489,21 @@ var SessionEmitter = class {
18489
18489
  agentType() {
18490
18490
  return this.options.agentType ?? this.meta["agentType"];
18491
18491
  }
18492
+ /**
18493
+ * The agent that spawned this one.
18494
+ *
18495
+ * Claude Code names it outright, from a sidecar the host writes, and it arrives as an
18496
+ * option. Codex never says "parent agent" — but it does not need to: a Codex subagent
18497
+ * is a rollout of its own, so its agent id IS its thread id, and `parent_thread_id`
18498
+ * (carried here as `parentSessionId`) therefore names the parent agent exactly.
18499
+ *
18500
+ * At depth 1 that thread is the session rather than a subagent, so the id names a node
18501
+ * the consumer has as a session and not as an agent. That is the consumer's fallback to
18502
+ * resolve; reporting what the producer actually observed is this side's job.
18503
+ */
18504
+ parentAgentId() {
18505
+ return this.options.parentAgentId ?? this.meta["parentSessionId"];
18506
+ }
18492
18507
  defaultTraceName() {
18493
18508
  const agentType = this.agentType();
18494
18509
  if (agentType)
@@ -18516,7 +18531,9 @@ var SessionEmitter = class {
18516
18531
  // agent out of a span already look for the snake_case names other producers
18517
18532
  // send. A camelCase key arrives intact and is never found.
18518
18533
  ...this.agentId() !== void 0 ? { agent_id: this.agentId() } : {},
18519
- ...this.agentType() !== void 0 ? { agent_type: this.agentType() } : {}
18534
+ ...this.agentType() !== void 0 ? { agent_type: this.agentType() } : {},
18535
+ ...this.parentAgentId() !== void 0 ? { parent_agent_id: this.parentAgentId() } : {},
18536
+ ...this.options.spawnDepth !== void 0 ? { spawn_depth: this.options.spawnDepth } : {}
18520
18537
  },
18521
18538
  ...this.options.userId !== void 0 ? { userId: this.options.userId } : {},
18522
18539
  ...this.options.userEmail !== void 0 ? { userEmail: this.options.userEmail } : {},
@@ -21669,6 +21686,8 @@ async function runForwarder(mapper, options = {}) {
21669
21686
  passKey: String(from),
21670
21687
  ...sub?.agentId !== void 0 ? { agentId: sub.agentId } : {},
21671
21688
  ...sub?.agentType !== void 0 ? { agentType: sub.agentType } : {},
21689
+ ...sub?.parentAgentId !== void 0 ? { parentAgentId: sub.parentAgentId } : {},
21690
+ ...sub?.spawnDepth !== void 0 ? { spawnDepth: sub.spawnDepth } : {},
21672
21691
  ...ids !== void 0 ? { ids } : {},
21673
21692
  ...userId !== void 0 ? { userId } : {},
21674
21693
  ...carried !== void 0 ? { resumeTurn: carried } : {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darkhunt-security/endpoint-codex",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "type": "module",
5
5
  "description": "Darkhunt endpoint adapter for Codex CLI: hook codec, rollout transcript mapper, plugin manifest.",
6
6
  "bin": {