nexus-agents 4.26.9 → 4.28.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.
Files changed (31) hide show
  1. package/dist/{chunk-O7LX6CCH.js → chunk-6OAWETHW.js} +2 -2
  2. package/dist/{chunk-YOGYNVAN.js → chunk-7V5V6H5C.js} +26 -24
  3. package/dist/{chunk-YOGYNVAN.js.map → chunk-7V5V6H5C.js.map} +1 -1
  4. package/dist/chunk-D2E5PC2V.js +7 -0
  5. package/dist/{chunk-VYZWF4DB.js → chunk-EGO754SU.js} +41 -18
  6. package/dist/{chunk-VYZWF4DB.js.map → chunk-EGO754SU.js.map} +1 -1
  7. package/dist/{chunk-FQQOROWP.js → chunk-LLJ65HUO.js} +2 -2
  8. package/dist/{chunk-DHYDTSS3.js → chunk-Q4T3UWOC.js} +2 -2
  9. package/dist/{chunk-MJQVSJZB.js → chunk-RV57MIQU.js} +1 -1
  10. package/dist/chunk-RV57MIQU.js.map +1 -0
  11. package/dist/{chunk-MQTXQPFN.js → chunk-VEFRTBUE.js} +3 -3
  12. package/dist/cli.js +22 -10
  13. package/dist/cli.js.map +1 -1
  14. package/dist/{consensus-vote-ZCZJS543.js → consensus-vote-YYHQHD7V.js} +5 -5
  15. package/dist/{improvement-review-GG7IIXBS.js → improvement-review-C74SDVTQ.js} +5 -5
  16. package/dist/index.d.ts +46 -0
  17. package/dist/index.js +9 -9
  18. package/dist/{issue-triage-N4ZYYJYR.js → issue-triage-BOGQS5GP.js} +3 -3
  19. package/dist/{setup-data-dir-CF5HCZ3V.js → setup-data-dir-YSN7UU3M.js} +3 -3
  20. package/package.json +1 -1
  21. package/dist/chunk-ARR4ZJVE.js +0 -7
  22. package/dist/chunk-MJQVSJZB.js.map +0 -1
  23. /package/dist/{chunk-O7LX6CCH.js.map → chunk-6OAWETHW.js.map} +0 -0
  24. /package/dist/{chunk-ARR4ZJVE.js.map → chunk-D2E5PC2V.js.map} +0 -0
  25. /package/dist/{chunk-FQQOROWP.js.map → chunk-LLJ65HUO.js.map} +0 -0
  26. /package/dist/{chunk-DHYDTSS3.js.map → chunk-Q4T3UWOC.js.map} +0 -0
  27. /package/dist/{chunk-MQTXQPFN.js.map → chunk-VEFRTBUE.js.map} +0 -0
  28. /package/dist/{consensus-vote-ZCZJS543.js.map → consensus-vote-YYHQHD7V.js.map} +0 -0
  29. /package/dist/{improvement-review-GG7IIXBS.js.map → improvement-review-C74SDVTQ.js.map} +0 -0
  30. /package/dist/{issue-triage-N4ZYYJYR.js.map → issue-triage-BOGQS5GP.js.map} +0 -0
  31. /package/dist/{setup-data-dir-CF5HCZ3V.js.map → setup-data-dir-YSN7UU3M.js.map} +0 -0
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-UBWHBW7S.js";
15
15
  import {
16
16
  emitPolicyEvent
17
- } from "./chunk-MJQVSJZB.js";
17
+ } from "./chunk-RV57MIQU.js";
18
18
  import {
19
19
  hasToken
20
20
  } from "./chunk-V353Q4L7.js";
@@ -1247,4 +1247,4 @@ export {
1247
1247
  IssueTriage,
1248
1248
  createIssueTriage
1249
1249
  };
1250
- //# sourceMappingURL=chunk-FQQOROWP.js.map
1250
+ //# sourceMappingURL=chunk-LLJ65HUO.js.map
@@ -7,7 +7,7 @@ import {
7
7
  toolStructuredError,
8
8
  toolSuccessStructured,
9
9
  wrapToolWithTimeout
10
- } from "./chunk-YOGYNVAN.js";
10
+ } from "./chunk-7V5V6H5C.js";
11
11
  import {
12
12
  JsonlStore,
13
13
  SECURITY_KEYWORDS,
@@ -2132,4 +2132,4 @@ export {
2132
2132
  runImprovementReview,
2133
2133
  registerImprovementReviewTool
2134
2134
  };
2135
- //# sourceMappingURL=chunk-DHYDTSS3.js.map
2135
+ //# sourceMappingURL=chunk-Q4T3UWOC.js.map
@@ -205,4 +205,4 @@ export {
205
205
  createGraphAuditBridge,
206
206
  createAuditTrail
207
207
  };
208
- //# sourceMappingURL=chunk-MJQVSJZB.js.map
208
+ //# sourceMappingURL=chunk-RV57MIQU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/security/audit-trail.ts"],"sourcesContent":["/**\n * nexus-agents/security - Audit Trail\n *\n * Machine-readable JSON audit events for security pipeline decisions.\n * Every trust classification, policy gate decision, corroboration check,\n * and reputation assessment is recorded as a structured event.\n *\n * Satisfies CLAUDE.md requirement: \"Every action on untrusted input must\n * log: trust tier, sources cited, policy gate decision, stripped content.\"\n *\n * @module security/audit-trail\n * (Source: Issue #832 — Security audit trail)\n */\n\nimport { getTimeProvider } from '../core/index.js';\nimport type { TrustTier } from './trust-types.js';\nimport type { AgentActionType } from './action-schema.js';\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Maximum stored events before oldest are evicted. */\nconst MAX_EVENTS = 10_000;\n\n/**\n * Discriminated union of audit event types.\n * Each event captures a single security pipeline decision.\n */\nexport type AuditEvent =\n | TrustClassificationEvent\n | PolicyGateEvent\n | CorroborationEvent\n | ReputationEvent\n | SanitizationEvent\n | GraphExecutionAuditEvent\n | ClawGuardViolationEvent;\n\n/** Base fields shared by all audit events. */\ninterface AuditEventBase {\n readonly id: string;\n readonly timestamp: string;\n readonly component: string;\n}\n\n/** Trust classification decision. */\nexport interface TrustClassificationEvent extends AuditEventBase {\n readonly type: 'trust_classification';\n readonly username: string;\n readonly assignedTier: TrustTier;\n readonly userRole: string;\n readonly isAllowlisted: boolean;\n readonly wasDowngraded: boolean;\n readonly reason: string;\n}\n\n/** Policy gate evaluation result. */\nexport interface PolicyGateEvent extends AuditEventBase {\n readonly type: 'policy_gate';\n /**\n * The agent action evaluated, for the security policy-gate path\n * (security/policy-gate.ts). Optional because the PIPELINE policy path\n * (pipeline/policy-evaluator.ts → #3710) records stage-boundary policy\n * decisions that have no `AgentAction` — they carry {@link stageType} +\n * {@link mode} + {@link ruleIds} instead. Security emitters always set it.\n */\n readonly actionType?: AgentActionType;\n readonly allowed: boolean;\n readonly requiresApproval: boolean;\n readonly inputTrustTier: TrustTier;\n readonly violationRules: readonly string[];\n /**\n * Pipeline-policy fields (#3710). Carried for the dev-pipeline\n * consensus→execute seam so the DURABLE record can distinguish soak (`warn`)\n * from enforce (`block`) and which rules/stage fired — without these the\n * persisted event is useless to the tune/readiness loop. Absent for the\n * security policy-gate path.\n */\n /** Enforcement mode the decision was made under: `warn` (soak) or `block` (enforce). */\n readonly mode?: 'off' | 'warn' | 'block';\n /** IDs of the policy rules that fired (mirrors `violationRules` for the pipeline path). */\n readonly ruleIds?: readonly string[];\n /** Type of the stage the gate guarded (e.g. `execute`). */\n readonly stageType?: string;\n /**\n * #3727: discriminates a per-EVALUATION SUMMARY record (`'summary'` — emitted\n * once per pipeline policy evaluation INCLUDING clean ones, the DENOMINATOR for\n * the would-block rate) from a per-VIOLATION record (`'violation'` — the\n * existing #3710 per-violation records). Absent for the security policy-gate\n * path. Denominator = count(recordKind==='summary'); numerator = summaries with\n * `violationCount > 0`. Scope the #3710 count-parity assertion to `'violation'`.\n */\n readonly recordKind?: 'summary' | 'violation';\n /** #3727: number of violations in THIS evaluation (set on the summary record). */\n readonly violationCount?: number;\n}\n\n/** Corroboration validation result. */\nexport interface CorroborationEvent extends AuditEventBase {\n readonly type: 'corroboration';\n readonly actionType: AgentActionType;\n readonly satisfied: boolean;\n readonly sourceCount: number;\n readonly missingRequirements: readonly string[];\n}\n\n/** Reputation assessment result. */\nexport interface ReputationEvent extends AuditEventBase {\n readonly type: 'reputation';\n readonly username: string;\n readonly reputationScore: number;\n readonly isSuspicious: boolean;\n readonly effectiveTier: TrustTier;\n readonly signalCount: number;\n}\n\n/** Summary of a single element stripped during sanitization. */\nexport interface StrippedElementSummary {\n /** Truncated tag text (≤30 chars + '...' from the sanitizer). */\n readonly tag: string;\n /** Reason the element was removed (e.g. 'Trail of Bits injection vector'). */\n readonly reason: string;\n}\n\n/** Max stripped-element details retained per sanitization event. */\nexport const MAX_STRIPPED_ELEMENTS_PER_EVENT = 20;\n\n/** Input sanitization result. */\nexport interface SanitizationEvent extends AuditEventBase {\n readonly type: 'sanitization';\n readonly source: string;\n readonly wasModified: boolean;\n readonly strippedCount: number;\n readonly injectionFlagCount: number;\n /**\n * Per-element tag/reason details, truncated to at most\n * MAX_STRIPPED_ELEMENTS_PER_EVENT entries. Required by CLAUDE.md's\n * Untrusted Input Policy: \"Log stripped elements for audit trail.\"\n */\n readonly strippedElements: readonly StrippedElementSummary[];\n}\n\n/**\n * ClawGuard AUDIT-mode violation (#4097). Records a tool call that VIOLATED the\n * derived access policy but was ALLOWED to proceed because the policy is in\n * `audit` mode (log-and-allow). Persisting these is what lets the audit→enforce\n * graduation loop size the real violation rate from durable telemetry rather\n * than ephemeral logs.\n */\nexport interface ClawGuardViolationEvent extends AuditEventBase {\n readonly type: 'clawguard_violation';\n /** The tool whose call violated the policy. */\n readonly toolName: string;\n /** Human-readable warning from the access decision (may be truncated). */\n readonly warning: string;\n /** Source of the derived policy (`llm` / `fallback-keyword` / `bypass`). */\n readonly policySource: string;\n /** Policy mode under which the violation was allowed (e.g. `audit`). */\n readonly mode: string;\n /** Request ID of the offending tool call, for correlation. */\n readonly requestId: string;\n /**\n * Which rule produced the verdict (#5106) — `unbypassable:tool`,\n * `unbypassable:path`, `allowedTools`, `allowedTools:confirm_risky`.\n *\n * A first-class field rather than prose inside `warning`, because `warning`\n * is truncated at 500 chars and a long attacker-selectable `path` argument\n * pushes the rule off the end. A chain reader must be able to tell an\n * unbypassable denylist hit from an allowlist miss without parsing a string\n * that may have been cut mid-word.\n *\n * Absent for verdicts that carry no rule (an audit-mode allowlist\n * observation), which is why it is optional rather than defaulted — there is\n * no rule to name, and inventing one would misreport.\n */\n readonly matchedRule?: string;\n}\n\n/** Graph execution lifecycle event (Issue #839). */\nexport interface GraphExecutionAuditEvent extends AuditEventBase {\n readonly type: 'graph_execution';\n readonly graphEvent: string;\n readonly nodeId?: string;\n readonly stepNumber: number;\n readonly detail: string;\n}\n\n/**\n * Query filter for retrieving audit events.\n *\n * The post-mortem dimensions (#3197) — `actionType`, `actor`, `violationRule`\n * — NARROW to events that actually carry the field (events lacking it are\n * excluded), unlike `trustTier`'s legacy keep-non-applicable behavior. Only\n * dimensions backed by a real event field are offered: `resource` and\n * `policyName` from the original ask were dropped because no AuditEvent\n * records them (a filter with no backing field would be dead config); the\n * policy-rule intent is served by `violationRule` (PolicyGateEvent's\n * `violationRules`).\n */\nexport interface AuditQuery {\n readonly type?: AuditEvent['type'];\n readonly since?: string;\n readonly until?: string;\n readonly trustTier?: TrustTier;\n /** Match PolicyGate/Corroboration events by their `actionType`. */\n readonly actionType?: AgentActionType;\n /** Match Trust/Reputation events by `username` (the acting/assessed user). */\n readonly actor?: string;\n /** Match PolicyGate events whose `violationRules` include this rule name. */\n readonly violationRule?: string;\n readonly limit?: number;\n}\n\n// ============================================================================\n// AuditTrail\n// ============================================================================\n\n/**\n * Append-only audit trail for security pipeline decisions.\n * Events are bounded by MAX_EVENTS to prevent unbounded growth.\n */\n/**\n * Optional durable sink: receives every fully-formed event appended to the\n * trail, so security decisions can be mirrored to a persistent, hash-chained\n * store (see security/audit-bridge.ts). Default-off — when absent, the trail\n * behaves exactly as before (#3291).\n */\nexport type DurableAuditSink = (event: AuditEvent) => void;\n\nexport class AuditTrail {\n private events: AuditEvent[] = [];\n private nextId = 1;\n\n constructor(private readonly durableSink?: DurableAuditSink) {}\n\n /** Appends an event to the trail. Returns the assigned event ID. */\n append(event: Omit<AuditEvent, 'id' | 'timestamp'>): string {\n const id = `audit-${String(this.nextId++)}`;\n const fullEvent = {\n ...event,\n id,\n timestamp: getTimeProvider().nowIso(),\n } as AuditEvent;\n\n this.events.push(fullEvent);\n this.enforceLimit();\n\n // Mirror to the durable store when wired (#3291). Best-effort: a sink\n // failure must never break the in-memory security pipeline.\n if (this.durableSink !== undefined) {\n try {\n this.durableSink(fullEvent);\n } catch {\n // Sink implementations already swallow+log; this is belt-and-suspenders.\n }\n }\n\n return id;\n }\n\n /** Queries events matching the given filter. */\n query(filter: AuditQuery = {}): readonly AuditEvent[] {\n let results = this.events as readonly AuditEvent[];\n\n if (filter.type !== undefined) {\n results = results.filter((e) => e.type === filter.type);\n }\n\n if (filter.since !== undefined) {\n results = filterSince(results, filter.since);\n }\n\n if (filter.until !== undefined) {\n results = filterUntil(results, filter.until);\n }\n\n if (filter.trustTier !== undefined) {\n results = filterByTrustTier(results, filter.trustTier);\n }\n\n if (filter.actionType !== undefined) {\n results = filterByActionType(results, filter.actionType);\n }\n\n if (filter.actor !== undefined) {\n results = filterByActor(results, filter.actor);\n }\n\n if (filter.violationRule !== undefined) {\n results = filterByViolationRule(results, filter.violationRule);\n }\n\n const limit = filter.limit ?? results.length;\n return results.slice(-limit);\n }\n\n /** Returns the total number of events. */\n get size(): number {\n return this.events.length;\n }\n\n /** Clears all events. */\n clear(): void {\n this.events = [];\n }\n\n /** Enforces MAX_EVENTS bound. */\n private enforceLimit(): void {\n if (this.events.length > MAX_EVENTS) {\n this.events = this.events.slice(-MAX_EVENTS);\n }\n }\n}\n\n// ============================================================================\n// Filter Helpers\n// ============================================================================\n\nfunction filterSince(events: readonly AuditEvent[], since: string): readonly AuditEvent[] {\n const sinceTime = new Date(since).getTime();\n return events.filter((e) => new Date(e.timestamp).getTime() >= sinceTime);\n}\n\nfunction filterUntil(events: readonly AuditEvent[], until: string): readonly AuditEvent[] {\n const untilTime = new Date(until).getTime();\n return events.filter((e) => new Date(e.timestamp).getTime() <= untilTime);\n}\n\nfunction filterByTrustTier(events: readonly AuditEvent[], tier: TrustTier): readonly AuditEvent[] {\n return events.filter((e) => {\n if (e.type === 'trust_classification') return e.assignedTier === tier;\n if (e.type === 'policy_gate') return e.inputTrustTier === tier;\n if (e.type === 'reputation') return e.effectiveTier === tier;\n return true;\n });\n}\n\n/**\n * Narrow to events carrying the given `actionType` (#3197). Only PolicyGate and\n * Corroboration events have one; all others are excluded.\n */\nfunction filterByActionType(\n events: readonly AuditEvent[],\n actionType: AgentActionType\n): readonly AuditEvent[] {\n return events.filter(\n (e) => (e.type === 'policy_gate' || e.type === 'corroboration') && e.actionType === actionType\n );\n}\n\n/**\n * Narrow to events for the given actor (#3197), matched on `username`. Only\n * Trust-classification and Reputation events carry a username; others are\n * excluded so an actor filter never returns unrelated rows.\n */\nfunction filterByActor(events: readonly AuditEvent[], actor: string): readonly AuditEvent[] {\n return events.filter(\n (e) => (e.type === 'trust_classification' || e.type === 'reputation') && e.username === actor\n );\n}\n\n/**\n * Narrow to PolicyGate events whose `violationRules` include the given rule\n * name (#3197) — the security post-mortem \"who tripped rule X\" query.\n */\nfunction filterByViolationRule(events: readonly AuditEvent[], rule: string): readonly AuditEvent[] {\n return events.filter((e) => e.type === 'policy_gate' && e.violationRules.includes(rule));\n}\n\n// ============================================================================\n// Convenience Emitters\n// ============================================================================\n\n/**\n * Records a trust classification decision.\n */\nexport function emitTrustEvent(\n trail: AuditTrail,\n data: Omit<TrustClassificationEvent, 'id' | 'timestamp' | 'type' | 'component'>\n): string {\n return trail.append({\n type: 'trust_classification',\n component: 'trust-classifier',\n ...data,\n });\n}\n\n/**\n * Records a policy gate evaluation.\n */\nexport function emitPolicyEvent(\n trail: AuditTrail,\n data: Omit<PolicyGateEvent, 'id' | 'timestamp' | 'type' | 'component'>\n): string {\n return trail.append({\n type: 'policy_gate',\n component: 'policy-gate',\n ...data,\n });\n}\n\n/**\n * Records a PIPELINE-policy gate decision (#3710) — the dev-pipeline\n * consensus→execute seam. Distinct from {@link emitPolicyEvent} (the security\n * policy-gate path with an `AgentAction`): this carries `mode`/`ruleIds`/\n * `stageType` so the durable record distinguishes soak(warn) from enforce(block)\n * and is usable by the tune/readiness loop. ONE append per call.\n */\nexport function emitPipelinePolicyEvent(\n trail: AuditTrail,\n data: Omit<PolicyGateEvent, 'id' | 'timestamp' | 'type' | 'component' | 'actionType'>\n): string {\n return trail.append({\n type: 'policy_gate',\n component: 'pipeline-policy-evaluator',\n ...data,\n });\n}\n\n/** The pipeline-policy would-block rate over a window (#3727). */\nexport interface PolicyWouldBlockRate {\n /** Total pipeline-policy evaluations (the denominator — summary records). */\n readonly evaluations: number;\n /** Evaluations that had ≥1 violation (what enforce mode WOULD block). */\n readonly wouldBlock: number;\n /** `wouldBlock / evaluations`; 0 when there are no evaluations. */\n readonly rate: number;\n}\n\n/**\n * Compute the pipeline-policy would-block RATE from durable audit events (#3727)\n * — the read-side of the per-evaluation summary records, and the signal the\n * #3769-enforce soak-readiness gate needs. Denominator = per-evaluation SUMMARY\n * records (`recordKind === 'summary'`); numerator = summaries with\n * `violationCount > 0` (the would-block fraction, independent of warn/block mode).\n * Per-violation records (`recordKind === 'violation'`) are intentionally NOT\n * counted — counting them would double-count and break the denominator.\n */\nexport function computePolicyWouldBlockRate(events: readonly AuditEvent[]): PolicyWouldBlockRate {\n let evaluations = 0;\n let wouldBlock = 0;\n for (const e of events) {\n if (e.type !== 'policy_gate' || e.recordKind !== 'summary') continue;\n evaluations += 1;\n if ((e.violationCount ?? 0) > 0) wouldBlock += 1;\n }\n return { evaluations, wouldBlock, rate: evaluations > 0 ? wouldBlock / evaluations : 0 };\n}\n\n/**\n * Records a corroboration validation.\n */\nexport function emitCorroborationEvent(\n trail: AuditTrail,\n data: Omit<CorroborationEvent, 'id' | 'timestamp' | 'type' | 'component'>\n): string {\n return trail.append({\n type: 'corroboration',\n component: 'corroboration-validator',\n ...data,\n });\n}\n\n/**\n * Records a reputation assessment.\n */\nexport function emitReputationEvent(\n trail: AuditTrail,\n data: Omit<ReputationEvent, 'id' | 'timestamp' | 'type' | 'component'>\n): string {\n return trail.append({\n type: 'reputation',\n component: 'reputation-model',\n ...data,\n });\n}\n\n/**\n * Records an input sanitization result.\n */\nexport function emitSanitizationEvent(\n trail: AuditTrail,\n data: Omit<SanitizationEvent, 'id' | 'timestamp' | 'type' | 'component'>\n): string {\n return trail.append({\n type: 'sanitization',\n component: 'input-sanitizer',\n ...data,\n });\n}\n\n/**\n * Records a graph execution lifecycle event.\n */\nexport function emitGraphExecutionEvent(\n trail: AuditTrail,\n data: Omit<GraphExecutionAuditEvent, 'id' | 'timestamp' | 'type' | 'component'>\n): string {\n return trail.append({\n type: 'graph_execution',\n component: 'graph-executor',\n ...data,\n });\n}\n\n/**\n * Records a ClawGuard AUDIT-mode violation (#4097) — a policy-violating tool\n * call that was log-and-allowed because the policy is in `audit` mode. ONE\n * append per call; mirrors to the durable sink when the trail is wired.\n */\nexport function emitClawGuardViolation(\n trail: AuditTrail,\n data: Omit<ClawGuardViolationEvent, 'id' | 'timestamp' | 'type' | 'component'>\n): string {\n return trail.append({\n type: 'clawguard_violation',\n component: 'clawguard-audit',\n ...data,\n });\n}\n\n/**\n * Creates an onEvent callback that bridges graph events to the audit trail.\n * Pass the returned function as `onEvent` in GraphExecuteOptions.\n *\n * @example\n * const trail = createAuditTrail();\n * await executeGraph(graph, inputs, { onEvent: createGraphAuditBridge(trail) });\n */\nexport function createGraphAuditBridge(\n trail: AuditTrail\n): (event: { readonly type: string; readonly [key: string]: unknown }) => void {\n return (event) => {\n const nodeId = typeof event['nodeId'] === 'string' ? event['nodeId'] : undefined;\n const stepNumber = typeof event['stepNumber'] === 'number' ? event['stepNumber'] : 0;\n emitGraphExecutionEvent(trail, {\n graphEvent: event.type,\n ...(nodeId !== undefined ? { nodeId } : {}),\n stepNumber,\n detail: formatGraphEventDetail(event),\n });\n };\n}\n\n/** Formats a brief detail string from a graph event. */\nfunction formatGraphEventDetail(event: {\n readonly type: string;\n readonly [key: string]: unknown;\n}): string {\n switch (event.type) {\n case 'node_started':\n return `Node ${String(event['nodeId'])} starting`;\n case 'node_completed':\n return `Node ${String(event['nodeId'])} completed in ${String(event['durationMs'])}ms`;\n case 'node_error':\n return `Node ${String(event['nodeId'])} failed: ${String(event['error'])}`;\n case 'state_updated':\n return `State updated: ${String(event['updatedKeys'])}`;\n case 'step_completed':\n return `Step ${String(event['stepNumber'])}: ${String(event['nodesExecuted'])} nodes`;\n case 'execution_complete':\n return `Complete: ${String(event['totalSteps'])} steps, ${String(event['durationMs'])}ms`;\n default:\n return event.type;\n }\n}\n\n/**\n * Creates a new AuditTrail instance. Pass a {@link DurableAuditSink} (e.g. from\n * `createDurableAuditSink(auditLogger)`) to mirror appended security decisions\n * to a durable, hash-chained store (#3291). Default: in-memory only.\n */\nexport function createAuditTrail(durableSink?: DurableAuditSink): AuditTrail {\n return new AuditTrail(durableSink);\n}\n"],"mappings":";;;;;AAuBA,IAAM,aAAa;AAsGZ,IAAM,kCAAkC;AAwGxC,IAAM,aAAN,MAAiB;AAAA,EAItB,YAA6B,aAAgC;AAAhC;AAAA,EAAiC;AAAA,EAAjC;AAAA,EAHrB,SAAuB,CAAC;AAAA,EACxB,SAAS;AAAA;AAAA,EAKjB,OAAO,OAAqD;AAC1D,UAAM,KAAK,SAAS,OAAO,KAAK,QAAQ,CAAC;AACzC,UAAM,YAAY;AAAA,MAChB,GAAG;AAAA,MACH;AAAA,MACA,WAAW,gBAAgB,EAAE,OAAO;AAAA,IACtC;AAEA,SAAK,OAAO,KAAK,SAAS;AAC1B,SAAK,aAAa;AAIlB,QAAI,KAAK,gBAAgB,QAAW;AAClC,UAAI;AACF,aAAK,YAAY,SAAS;AAAA,MAC5B,QAAQ;AAAA,MAER;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,MAAM,SAAqB,CAAC,GAA0B;AACpD,QAAI,UAAU,KAAK;AAEnB,QAAI,OAAO,SAAS,QAAW;AAC7B,gBAAU,QAAQ,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO,IAAI;AAAA,IACxD;AAEA,QAAI,OAAO,UAAU,QAAW;AAC9B,gBAAU,YAAY,SAAS,OAAO,KAAK;AAAA,IAC7C;AAEA,QAAI,OAAO,UAAU,QAAW;AAC9B,gBAAU,YAAY,SAAS,OAAO,KAAK;AAAA,IAC7C;AAEA,QAAI,OAAO,cAAc,QAAW;AAClC,gBAAU,kBAAkB,SAAS,OAAO,SAAS;AAAA,IACvD;AAEA,QAAI,OAAO,eAAe,QAAW;AACnC,gBAAU,mBAAmB,S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chunk-OQB3XC5O.js";
7
7
  import {
8
8
  VERSION
9
- } from "./chunk-ARR4ZJVE.js";
9
+ } from "./chunk-D2E5PC2V.js";
10
10
  import {
11
11
  capitalize
12
12
  } from "./chunk-6T3EPABN.js";
@@ -1201,7 +1201,7 @@ async function runDoctorFix(result) {
1201
1201
  writeLine2("\u2500".repeat(40));
1202
1202
  let fixCount = 0;
1203
1203
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
1204
- const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-CF5HCZ3V.js");
1204
+ const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-YSN7UU3M.js");
1205
1205
  const outcome = describeDataDirFix2(initDataDirectories2());
1206
1206
  writeLine2(outcome.line);
1207
1207
  if (outcome.counted) fixCount++;
@@ -1303,4 +1303,4 @@ export {
1303
1303
  startStdioServer,
1304
1304
  closeServer
1305
1305
  };
1306
- //# sourceMappingURL=chunk-MQTXQPFN.js.map
1306
+ //# sourceMappingURL=chunk-VEFRTBUE.js.map
package/dist/cli.js CHANGED
@@ -152,7 +152,7 @@ import {
152
152
  validateNexusEnv,
153
153
  validateWorkflow,
154
154
  wrapInMarkdownFence
155
- } from "./chunk-VYZWF4DB.js";
155
+ } from "./chunk-EGO754SU.js";
156
156
  import "./chunk-QFO77VBC.js";
157
157
  import "./chunk-HFOQKCD2.js";
158
158
  import "./chunk-RSMG2DPB.js";
@@ -171,7 +171,7 @@ import {
171
171
  doctorCommand,
172
172
  initDataDirectories,
173
173
  runDoctor
174
- } from "./chunk-MQTXQPFN.js";
174
+ } from "./chunk-VEFRTBUE.js";
175
175
  import {
176
176
  buildOpenAICompatAdapters,
177
177
  readOpenAICompatEnv
@@ -189,7 +189,7 @@ import {
189
189
  mapOutcomeToDecision,
190
190
  recordAuthenticVote,
191
191
  registerConsensusVoteTool
192
- } from "./chunk-O7LX6CCH.js";
192
+ } from "./chunk-6OAWETHW.js";
193
193
  import {
194
194
  loadUsageEvents,
195
195
  rollupByModel
@@ -206,7 +206,7 @@ import {
206
206
  createFullGitHubProvider,
207
207
  evaluatePolicy,
208
208
  parsePRUrl
209
- } from "./chunk-FQQOROWP.js";
209
+ } from "./chunk-LLJ65HUO.js";
210
210
  import "./chunk-PSZVTY77.js";
211
211
  import {
212
212
  ReputationCache,
@@ -225,16 +225,16 @@ import {
225
225
  registerImprovementReviewTool,
226
226
  runImprovementReview,
227
227
  scanForSecrets
228
- } from "./chunk-DHYDTSS3.js";
228
+ } from "./chunk-Q4T3UWOC.js";
229
229
  import {
230
230
  createDefaultPolicyFirewall,
231
231
  setGlobalPolicyFirewall,
232
232
  stagePolicyFirewallForRollout
233
- } from "./chunk-YOGYNVAN.js";
233
+ } from "./chunk-7V5V6H5C.js";
234
234
  import {
235
235
  VERSION
236
- } from "./chunk-ARR4ZJVE.js";
237
- import "./chunk-MJQVSJZB.js";
236
+ } from "./chunk-D2E5PC2V.js";
237
+ import "./chunk-RV57MIQU.js";
238
238
  import {
239
239
  createUnifiedRegistry,
240
240
  getGlobalRegistry
@@ -19551,7 +19551,7 @@ function startImprovementReviewScheduler(options) {
19551
19551
  let running = false;
19552
19552
  const runOnce = async () => {
19553
19553
  try {
19554
- const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-GG7IIXBS.js");
19554
+ const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-C74SDVTQ.js");
19555
19555
  const input = ImprovementReviewInputSchema2.parse({ fileIssues });
19556
19556
  const result = await runImprovementReview2(input, { logger: logger22 });
19557
19557
  logger22.info("Scheduled improvement_review complete", {
@@ -19882,13 +19882,25 @@ function buildWorkflowEngine(ctx) {
19882
19882
  ...wfConfig?.maxParallel !== void 0 && { maxConcurrency: wfConfig.maxParallel },
19883
19883
  ...wfConfig?.templatesDir !== void 0 && { templatePaths: [wfConfig.templatesDir] }
19884
19884
  };
19885
+ return createRealWorkflowEngine({ ...engineConfig, useMockExecutor: true });
19886
+ }
19887
+ function buildExecutingWorkflowEngine(ctx) {
19888
+ const wfConfig = ctx.workflowConfig;
19889
+ const engineConfig = {
19890
+ builtInTemplates: ctx.builtInTemplates,
19891
+ logger: ctx.logger,
19892
+ ...wfConfig?.timeout !== void 0 && { defaultTimeoutMs: wfConfig.timeout },
19893
+ ...wfConfig?.maxParallel !== void 0 && { maxConcurrency: wfConfig.maxParallel },
19894
+ ...wfConfig?.templatesDir !== void 0 && { templatePaths: [wfConfig.templatesDir] }
19895
+ };
19885
19896
  return createRealWorkflowEngine(
19886
- ctx.modelAdapter !== void 0 ? { ...engineConfig, modelAdapter: ctx.modelAdapter } : { ...engineConfig, useMockExecutor: true }
19897
+ ctx.modelAdapter !== void 0 ? { ...engineConfig, modelAdapter: ctx.modelAdapter } : engineConfig
19887
19898
  );
19888
19899
  }
19889
19900
  function registerRunWorkflow(ctx, shared) {
19890
19901
  registerRunWorkflowTool(ctx.server, {
19891
19902
  workflowEngine: shared.workflowEngine(),
19903
+ resolveExecutionEngine: () => buildExecutingWorkflowEngine(ctx),
19892
19904
  logger: ctx.logger,
19893
19905
  rateLimiter: ctx.rateLimiterFactory.getForTool("run_workflow")
19894
19906
  });