@neuroverseos/governance 0.2.1 → 0.2.3

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 (92) hide show
  1. package/.well-known/ai-plugin.json +26 -0
  2. package/.well-known/mcp.json +68 -0
  3. package/AGENTS.md +219 -0
  4. package/README.md +84 -4
  5. package/dist/adapters/autoresearch.cjs +196 -0
  6. package/dist/adapters/autoresearch.d.cts +103 -0
  7. package/dist/adapters/autoresearch.d.ts +103 -0
  8. package/dist/adapters/autoresearch.js +7 -0
  9. package/dist/adapters/deep-agents.cjs +1472 -0
  10. package/dist/adapters/deep-agents.d.cts +181 -0
  11. package/dist/adapters/deep-agents.d.ts +181 -0
  12. package/dist/adapters/deep-agents.js +17 -0
  13. package/dist/adapters/express.cjs +103 -21
  14. package/dist/adapters/express.d.cts +1 -1
  15. package/dist/adapters/express.d.ts +1 -1
  16. package/dist/adapters/express.js +3 -3
  17. package/dist/adapters/index.cjs +678 -102
  18. package/dist/adapters/index.d.cts +4 -1
  19. package/dist/adapters/index.d.ts +4 -1
  20. package/dist/adapters/index.js +39 -13
  21. package/dist/adapters/langchain.cjs +181 -47
  22. package/dist/adapters/langchain.d.cts +5 -5
  23. package/dist/adapters/langchain.d.ts +5 -5
  24. package/dist/adapters/langchain.js +4 -3
  25. package/dist/adapters/openai.cjs +183 -49
  26. package/dist/adapters/openai.d.cts +5 -5
  27. package/dist/adapters/openai.d.ts +5 -5
  28. package/dist/adapters/openai.js +4 -3
  29. package/dist/adapters/openclaw.cjs +181 -47
  30. package/dist/adapters/openclaw.d.cts +5 -5
  31. package/dist/adapters/openclaw.d.ts +5 -5
  32. package/dist/adapters/openclaw.js +4 -3
  33. package/dist/{build-P42YFKQV.js → build-X5MZY4IA.js} +2 -2
  34. package/dist/{chunk-ZL4AHY4X.js → chunk-4L6OPKMQ.js} +1 -1
  35. package/dist/chunk-5U2MQO5P.js +57 -0
  36. package/dist/{chunk-UPJNTSVM.js → chunk-6BB55YJI.js} +16 -31
  37. package/dist/{chunk-37JG24WH.js → chunk-6CZSKEY5.js} +3 -0
  38. package/dist/{chunk-5EDDNJU6.js → chunk-AF2VX4AL.js} +52 -10
  39. package/dist/chunk-BQZMOEML.js +43 -0
  40. package/dist/chunk-D2UCV5AK.js +326 -0
  41. package/dist/{chunk-IVPKFJX3.js → chunk-EVDJUSZ2.js} +16 -31
  42. package/dist/{chunk-PQBJBVSW.js → chunk-IZSO75NZ.js} +72 -7
  43. package/dist/chunk-JCKSW2PZ.js +304 -0
  44. package/dist/{chunk-ADV7Q2LJ.js → chunk-KTFTTLTP.js} +25 -4
  45. package/dist/{chunk-MWDQ4MJB.js → chunk-MH7BT4VH.js} +5 -1
  46. package/dist/{chunk-P74Y66ZV.js → chunk-QLPTHTVB.js} +66 -18
  47. package/dist/{chunk-2JQJ5U5X.js → chunk-REXY4LUL.js} +49 -10
  48. package/dist/chunk-T5EUJQE5.js +172 -0
  49. package/dist/{chunk-PAX2P6ZP.js → chunk-TTBKTF3P.js} +15 -8
  50. package/dist/{chunk-TINSRYXQ.js → chunk-ZIVQNSZU.js} +16 -33
  51. package/dist/{chunk-BUWWN2NX.js → chunk-ZJTDUCC2.js} +9 -7
  52. package/dist/cli/neuroverse.cjs +2648 -495
  53. package/dist/cli/neuroverse.js +39 -15
  54. package/dist/cli/plan.cjs +178 -46
  55. package/dist/cli/plan.js +33 -26
  56. package/dist/cli/run.cjs +257 -28
  57. package/dist/cli/run.js +2 -2
  58. package/dist/decision-flow-LETV5NWY.js +61 -0
  59. package/dist/{derive-TLIV4OOU.js → derive-7365SUFU.js} +2 -2
  60. package/dist/{doctor-V72UM2TC.js → doctor-QYISMKEL.js} +5 -2
  61. package/dist/equity-penalties-63FGB3I2.js +244 -0
  62. package/dist/{explain-IDCRWMPX.js → explain-A2EWI2OL.js} +4 -23
  63. package/dist/{guard-WA3FCCIO.js → guard-3BWL3IGH.js} +6 -10
  64. package/dist/{guard-contract-D-2LQInm.d.ts → guard-contract-C9_zKbzd.d.cts} +155 -5
  65. package/dist/{guard-contract-D-2LQInm.d.cts → guard-contract-C9_zKbzd.d.ts} +155 -5
  66. package/dist/{guard-engine-D7X4CVAE.js → guard-engine-QFMIBWJY.js} +2 -2
  67. package/dist/{impact-BWULZ5RP.js → impact-UB6DXKSX.js} +4 -4
  68. package/dist/{improve-GPUBKTEA.js → improve-XZA57GER.js} +5 -24
  69. package/dist/index.cjs +639 -51
  70. package/dist/index.d.cts +235 -7
  71. package/dist/index.d.ts +235 -7
  72. package/dist/index.js +92 -41
  73. package/dist/infer-world-7GVZWFX4.js +543 -0
  74. package/dist/init-world-VWMQZQC7.js +223 -0
  75. package/dist/{mcp-server-YUOQP4M5.js → mcp-server-XWQZXNW7.js} +3 -3
  76. package/dist/{playground-CBXMAW2B.js → playground-ADWZORNV.js} +2 -2
  77. package/dist/{redteam-SSNABQ7W.js → redteam-JRQ7FD2F.js} +2 -2
  78. package/dist/{session-MWRBTCYX.js → session-MMYX5YCF.js} +4 -3
  79. package/dist/shared--Q8wPBVN.d.ts +60 -0
  80. package/dist/shared-HpAG90PX.d.cts +60 -0
  81. package/dist/shared-U2QFV7JH.js +16 -0
  82. package/dist/{simulate-VDOYQFRO.js → simulate-GMIFFXYV.js} +5 -30
  83. package/dist/{test-3GZSG5FR.js → test-JBBZ65X4.js} +2 -2
  84. package/dist/{trace-TM4Z7G73.js → trace-3MYWIDEF.js} +3 -3
  85. package/dist/worlds/autoresearch.nv-world.md +230 -0
  86. package/dist/worlds/coding-agent.nv-world.md +211 -0
  87. package/llms.txt +79 -0
  88. package/openapi.yaml +230 -0
  89. package/package.json +26 -4
  90. package/dist/{chunk-GR6DGCZ2.js → chunk-BMOXICAB.js} +3 -3
  91. package/dist/{chunk-NF5POFCI.js → chunk-ORJ3NOE6.js} +3 -3
  92. package/dist/{world-LAXO6DOX.js → world-BFJCIQSH.js} +3 -3
@@ -30,24 +30,34 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/adapters/openai.ts
31
31
  var openai_exports = {};
32
32
  __export(openai_exports, {
33
- GovernanceBlockedError: () => GovernanceBlockedError,
33
+ GovernanceBlockedError: () => GovernanceBlockedError2,
34
34
  GovernedToolExecutor: () => GovernedToolExecutor,
35
35
  createGovernedToolExecutor: () => createGovernedToolExecutor,
36
36
  createGovernedToolExecutorFromWorld: () => createGovernedToolExecutorFromWorld
37
37
  });
38
38
  module.exports = __toCommonJS(openai_exports);
39
39
 
40
- // src/engine/plan-engine.ts
41
- function keywordMatch(eventText, step) {
42
- const stepText = [
43
- step.label,
44
- step.description ?? "",
45
- ...step.tags ?? []
40
+ // src/engine/text-utils.ts
41
+ function normalizeEventText(event) {
42
+ return [
43
+ event.intent,
44
+ event.tool ?? "",
45
+ event.scope ?? ""
46
46
  ].join(" ").toLowerCase();
47
- const keywords = stepText.split(/\s+/).filter((w) => w.length > 3);
47
+ }
48
+ function extractKeywords(text, minLength = 3) {
49
+ return text.toLowerCase().split(/\s+/).filter((w) => w.length > minLength);
50
+ }
51
+ function matchesAllKeywords(eventText, ruleText) {
52
+ const keywords = extractKeywords(ruleText);
53
+ if (keywords.length === 0) return false;
54
+ return keywords.every((kw) => eventText.includes(kw));
55
+ }
56
+ function matchesKeywordThreshold(eventText, ruleText, threshold = 0.5) {
57
+ const keywords = extractKeywords(ruleText);
48
58
  if (keywords.length === 0) return false;
49
59
  const matched = keywords.filter((kw) => eventText.includes(kw));
50
- return matched.length >= Math.ceil(keywords.length * 0.5);
60
+ return matched.length >= Math.ceil(keywords.length * threshold);
51
61
  }
52
62
  function tokenSimilarity(a, b) {
53
63
  const tokensA = new Set(a.toLowerCase().split(/\s+/).filter((w) => w.length > 2));
@@ -60,6 +70,19 @@ function tokenSimilarity(a, b) {
60
70
  const union = (/* @__PURE__ */ new Set([...tokensA, ...tokensB])).size;
61
71
  return union > 0 ? intersection / union : 0;
62
72
  }
73
+
74
+ // src/engine/plan-engine.ts
75
+ function keywordMatch(eventText, step) {
76
+ const stepText = [
77
+ step.label,
78
+ step.description ?? "",
79
+ ...step.tags ?? []
80
+ ].join(" ");
81
+ return matchesKeywordThreshold(eventText, stepText, 0.5);
82
+ }
83
+ function tokenSimilarity2(a, b) {
84
+ return tokenSimilarity(a, b);
85
+ }
63
86
  function findMatchingStep(eventText, event, steps) {
64
87
  const pendingOrActive = steps.filter((s) => s.status === "pending" || s.status === "active");
65
88
  if (pendingOrActive.length === 0) {
@@ -78,7 +101,7 @@ function findMatchingStep(eventText, event, steps) {
78
101
  let bestScore = 0;
79
102
  for (const step of pendingOrActive) {
80
103
  const stepText = [step.label, step.description ?? "", ...step.tags ?? []].join(" ");
81
- const score = tokenSimilarity(intentText, stepText);
104
+ const score = tokenSimilarity2(intentText, stepText);
82
105
  if (score > bestScore) {
83
106
  bestScore = score;
84
107
  bestStep = step;
@@ -119,7 +142,7 @@ function checkConstraints(event, eventText, constraints) {
119
142
  continue;
120
143
  }
121
144
  if (constraint.type === "scope" && constraint.trigger) {
122
- const keywords = constraint.trigger.split(/\s+/).filter((w) => w.length > 3);
145
+ const keywords = extractKeywords(constraint.trigger);
123
146
  const violated = keywords.length > 0 && keywords.every((kw) => eventText.includes(kw));
124
147
  checks.push({
125
148
  constraintId: constraint.id,
@@ -144,13 +167,40 @@ function getPlanProgress(plan) {
144
167
  percentage: total > 0 ? Math.round(completed / total * 100) : 0
145
168
  };
146
169
  }
147
- function advancePlan(plan, stepId) {
148
- return {
170
+ function advancePlan(plan, stepId, evidence) {
171
+ const step = plan.steps.find((s) => s.id === stepId);
172
+ if (!step) {
173
+ return { success: false, reason: `Step "${stepId}" not found in plan.` };
174
+ }
175
+ if (step.status === "completed") {
176
+ return { success: false, reason: `Step "${stepId}" is already completed.` };
177
+ }
178
+ const mode = plan.completion ?? "trust";
179
+ if (mode === "verified" && step.verify) {
180
+ if (!evidence) {
181
+ return {
182
+ success: false,
183
+ reason: `Step "${step.label}" requires evidence (verify: ${step.verify}). Provide evidence to advance.`
184
+ };
185
+ }
186
+ if (evidence.type !== step.verify) {
187
+ return {
188
+ success: false,
189
+ reason: `Evidence type "${evidence.type}" does not match required verification "${step.verify}".`
190
+ };
191
+ }
192
+ }
193
+ const updatedPlan = {
149
194
  ...plan,
150
195
  steps: plan.steps.map(
151
196
  (s) => s.id === stepId ? { ...s, status: "completed" } : s
152
197
  )
153
198
  };
199
+ return {
200
+ success: true,
201
+ plan: updatedPlan,
202
+ evidence: evidence ?? void 0
203
+ };
154
204
  }
155
205
  function evaluatePlan(event, plan) {
156
206
  const progress = getPlanProgress(plan);
@@ -173,11 +223,7 @@ function evaluatePlan(event, plan) {
173
223
  progress
174
224
  };
175
225
  }
176
- const eventText = [
177
- event.intent,
178
- event.tool ?? "",
179
- event.scope ?? ""
180
- ].join(" ").toLowerCase();
226
+ const eventText = normalizeEventText(event);
181
227
  const { matched, closest, closestScore } = findMatchingStep(eventText, event, plan.steps);
182
228
  if (!matched) {
183
229
  return {
@@ -218,7 +264,7 @@ function evaluatePlan(event, plan) {
218
264
  };
219
265
  }
220
266
  function buildPlanCheck(event, plan, verdict) {
221
- const eventText = [event.intent, event.tool ?? "", event.scope ?? ""].join(" ").toLowerCase();
267
+ const eventText = normalizeEventText(event);
222
268
  const { matched, closest, closestScore } = findMatchingStep(eventText, event, plan.steps);
223
269
  const { checks: constraintChecks } = checkConstraints(event, eventText, plan.constraints);
224
270
  const progress = getPlanProgress(plan);
@@ -324,7 +370,7 @@ function evaluateGuard(event, world, options = {}) {
324
370
  const startTime = performance.now();
325
371
  const level = options.level ?? "standard";
326
372
  const includeTrace = options.trace ?? false;
327
- const eventText = (event.intent + " " + (event.tool ?? "") + " " + (event.scope ?? "")).toLowerCase();
373
+ const eventText = normalizeEventText(event);
328
374
  const invariantChecks = [];
329
375
  const safetyChecks = [];
330
376
  let planCheckResult;
@@ -337,6 +383,43 @@ function evaluateGuard(event, world, options = {}) {
337
383
  const guardsMatched = [];
338
384
  const rulesMatched = [];
339
385
  checkInvariantCoverage(world, invariantChecks);
386
+ if (event.roleId && options.agentStates) {
387
+ const agentState = options.agentStates.get(event.roleId);
388
+ if (agentState && agentState.cooldownRemaining > 0) {
389
+ decidingLayer = "safety";
390
+ decidingId = `penalize-cooldown-${event.roleId}`;
391
+ const verdict = buildVerdict(
392
+ "PENALIZE",
393
+ `Agent "${event.roleId}" is frozen for ${agentState.cooldownRemaining} more round(s) due to prior penalty.`,
394
+ `penalize-cooldown-${event.roleId}`,
395
+ void 0,
396
+ world,
397
+ level,
398
+ invariantChecks,
399
+ guardsMatched,
400
+ rulesMatched,
401
+ includeTrace ? buildTrace(
402
+ invariantChecks,
403
+ safetyChecks,
404
+ planCheckResult,
405
+ roleChecks,
406
+ guardChecks,
407
+ kernelRuleChecks,
408
+ levelChecks,
409
+ decidingLayer,
410
+ decidingId,
411
+ startTime
412
+ ) : void 0
413
+ );
414
+ verdict.intentRecord = {
415
+ originalIntent: event.intent,
416
+ finalAction: "blocked (agent frozen)",
417
+ enforcement: "PENALIZE",
418
+ consequence: { type: "freeze", rounds: agentState.cooldownRemaining, description: "Agent still in cooldown from prior penalty" }
419
+ };
420
+ return verdict;
421
+ }
422
+ }
340
423
  if (options.sessionAllowlist) {
341
424
  const key = eventToAllowlistKey(event);
342
425
  if (options.sessionAllowlist.has(key)) {
@@ -464,7 +547,16 @@ function evaluateGuard(event, world, options = {}) {
464
547
  if (guardVerdict.status !== "ALLOW") {
465
548
  decidingLayer = "guard";
466
549
  decidingId = guardVerdict.ruleId;
467
- return buildVerdict(
550
+ const intentRecord = {
551
+ originalIntent: event.intent,
552
+ finalAction: guardVerdict.status === "MODIFY" ? guardVerdict.modifiedTo ?? "modified" : guardVerdict.status === "PENALIZE" ? "blocked + penalized" : guardVerdict.status === "REWARD" ? event.intent : guardVerdict.status === "NEUTRAL" ? event.intent : guardVerdict.status === "BLOCK" ? "blocked" : "paused",
553
+ ruleApplied: guardVerdict.ruleId,
554
+ enforcement: guardVerdict.status,
555
+ modifiedTo: guardVerdict.modifiedTo,
556
+ consequence: guardVerdict.consequence,
557
+ reward: guardVerdict.reward
558
+ };
559
+ const verdict = buildVerdict(
468
560
  guardVerdict.status,
469
561
  guardVerdict.reason,
470
562
  guardVerdict.ruleId,
@@ -487,6 +579,10 @@ function evaluateGuard(event, world, options = {}) {
487
579
  startTime
488
580
  ) : void 0
489
581
  );
582
+ verdict.intentRecord = intentRecord;
583
+ if (guardVerdict.consequence) verdict.consequence = guardVerdict.consequence;
584
+ if (guardVerdict.reward) verdict.reward = guardVerdict.reward;
585
+ return verdict;
490
586
  }
491
587
  }
492
588
  const kernelVerdict = checkKernelRules(eventText, world, kernelRuleChecks, rulesMatched);
@@ -781,6 +877,21 @@ function checkGuards(event, eventText, world, checks, guardsMatched) {
781
877
  if (actionMode === "pause") {
782
878
  return { status: "PAUSE", reason, ruleId: `guard-${guard.id}` };
783
879
  }
880
+ if (actionMode === "penalize") {
881
+ const consequence = guard.consequence ? { ...guard.consequence } : { type: "freeze", rounds: 1, description: `Penalized for violating: ${guard.label}` };
882
+ return { status: "PENALIZE", reason, ruleId: `guard-${guard.id}`, consequence };
883
+ }
884
+ if (actionMode === "reward") {
885
+ const reward = guard.reward ? { ...guard.reward } : { type: "boost_influence", magnitude: 0.1, description: `Rewarded for: ${guard.label}` };
886
+ return { status: "REWARD", reason, ruleId: `guard-${guard.id}`, reward };
887
+ }
888
+ if (actionMode === "modify") {
889
+ const modifiedTo = guard.modify_to ?? guard.redirect ?? "hold";
890
+ return { status: "MODIFY", reason: `${reason} \u2192 Modified to: ${modifiedTo}`, ruleId: `guard-${guard.id}`, modifiedTo };
891
+ }
892
+ if (actionMode === "neutral") {
893
+ return { status: "NEUTRAL", reason, ruleId: `guard-${guard.id}` };
894
+ }
784
895
  if (actionMode === "warn" && !warnResult) {
785
896
  warnResult = { status: "ALLOW", warning: reason, ruleId: `guard-${guard.id}` };
786
897
  }
@@ -890,9 +1001,7 @@ function checkLevelConstraints(event, level, checks) {
890
1001
  return null;
891
1002
  }
892
1003
  function matchesKeywords(eventText, ruleText) {
893
- const keywords = ruleText.toLowerCase().split(/\s+/).filter((w) => w.length > 3);
894
- if (keywords.length === 0) return false;
895
- return keywords.every((kw) => eventText.includes(kw));
1004
+ return matchesAllKeywords(eventText, ruleText);
896
1005
  }
897
1006
  function eventToAllowlistKey(event) {
898
1007
  return `${(event.tool ?? "*").toLowerCase()}::${event.intent.toLowerCase().trim()}`;
@@ -1029,14 +1138,55 @@ async function loadWorld(worldPath) {
1029
1138
  throw new Error(`Cannot load world from: ${worldPath} \u2014 expected a directory or .nv-world.zip`);
1030
1139
  }
1031
1140
 
1032
- // src/adapters/openai.ts
1141
+ // src/adapters/shared.ts
1033
1142
  var GovernanceBlockedError = class extends Error {
1034
1143
  verdict;
1035
- toolCallId;
1036
- constructor(verdict, toolCallId) {
1037
- super(`[NeuroVerse] BLOCKED: ${verdict.reason ?? verdict.ruleId ?? "governance rule"}`);
1144
+ constructor(verdict, message) {
1145
+ super(message ?? `[NeuroVerse] BLOCKED: ${verdict.reason ?? verdict.ruleId ?? "governance rule"}`);
1038
1146
  this.name = "GovernanceBlockedError";
1039
1147
  this.verdict = verdict;
1148
+ }
1149
+ };
1150
+ function trackPlanProgress(event, state, callbacks) {
1151
+ if (!state.activePlan) return;
1152
+ const planVerdict = evaluatePlan(event, state.activePlan);
1153
+ if (planVerdict.matchedStep) {
1154
+ const advResult = advancePlan(state.activePlan, planVerdict.matchedStep);
1155
+ if (advResult.success && advResult.plan) {
1156
+ state.activePlan = advResult.plan;
1157
+ state.engineOptions.plan = state.activePlan;
1158
+ }
1159
+ const progress = getPlanProgress(state.activePlan);
1160
+ callbacks.onPlanProgress?.(progress);
1161
+ if (progress.completed === progress.total) {
1162
+ callbacks.onPlanComplete?.();
1163
+ }
1164
+ }
1165
+ }
1166
+ function extractScope(args) {
1167
+ if (typeof args.path === "string") return args.path;
1168
+ if (typeof args.file_path === "string") return args.file_path;
1169
+ if (typeof args.filename === "string") return args.filename;
1170
+ if (typeof args.url === "string") return args.url;
1171
+ if (typeof args.command === "string") return args.command;
1172
+ return void 0;
1173
+ }
1174
+ function buildEngineOptions(options, plan) {
1175
+ return {
1176
+ trace: options.trace ?? false,
1177
+ level: options.level,
1178
+ plan: plan ?? options.plan
1179
+ };
1180
+ }
1181
+ function defaultBlockMessage(verdict) {
1182
+ return `Action blocked by governance policy: ${verdict.reason ?? "rule violation"}. Rule: ${verdict.ruleId ?? "unknown"}.`;
1183
+ }
1184
+
1185
+ // src/adapters/openai.ts
1186
+ var GovernanceBlockedError2 = class extends GovernanceBlockedError {
1187
+ toolCallId;
1188
+ constructor(verdict, toolCallId) {
1189
+ super(verdict);
1040
1190
  this.toolCallId = toolCallId;
1041
1191
  }
1042
1192
  };
@@ -1044,14 +1194,11 @@ function defaultMapFunctionCall(name, args) {
1044
1194
  return {
1045
1195
  intent: name,
1046
1196
  tool: name,
1047
- scope: typeof args.path === "string" ? args.path : typeof args.url === "string" ? args.url : void 0,
1197
+ scope: extractScope(args),
1048
1198
  args,
1049
1199
  direction: "input"
1050
1200
  };
1051
1201
  }
1052
- function defaultBlockMessage(verdict) {
1053
- return `Action blocked by governance policy: ${verdict.reason ?? "rule violation"}. Rule: ${verdict.ruleId ?? "unknown"}.`;
1054
- }
1055
1202
  var GovernedToolExecutor = class {
1056
1203
  world;
1057
1204
  options;
@@ -1063,11 +1210,7 @@ var GovernedToolExecutor = class {
1063
1210
  this.world = world;
1064
1211
  this.options = options;
1065
1212
  this.activePlan = options.plan;
1066
- this.engineOptions = {
1067
- trace: options.trace ?? false,
1068
- level: options.level,
1069
- plan: this.activePlan
1070
- };
1213
+ this.engineOptions = buildEngineOptions(options, this.activePlan);
1071
1214
  this.mapFn = options.mapFunctionCall ?? defaultMapFunctionCall;
1072
1215
  this.blockMsg = options.blockMessage ?? defaultBlockMessage;
1073
1216
  }
@@ -1086,17 +1229,8 @@ var GovernedToolExecutor = class {
1086
1229
  this.engineOptions.plan = this.activePlan;
1087
1230
  const verdict = evaluateGuard(event, this.world, this.engineOptions);
1088
1231
  this.options.onEvaluate?.(verdict, event);
1089
- if (verdict.status === "ALLOW" && this.activePlan) {
1090
- const planVerdict = evaluatePlan(event, this.activePlan);
1091
- if (planVerdict.matchedStep) {
1092
- this.activePlan = advancePlan(this.activePlan, planVerdict.matchedStep);
1093
- this.engineOptions.plan = this.activePlan;
1094
- const progress = getPlanProgress(this.activePlan);
1095
- this.options.onPlanProgress?.(progress);
1096
- if (progress.completed === progress.total) {
1097
- this.options.onPlanComplete?.();
1098
- }
1099
- }
1232
+ if (verdict.status === "ALLOW") {
1233
+ trackPlanProgress(event, this, this.options);
1100
1234
  }
1101
1235
  return verdict;
1102
1236
  }
@@ -1122,7 +1256,7 @@ var GovernedToolExecutor = class {
1122
1256
  };
1123
1257
  }
1124
1258
  if (verdict.status === "PAUSE") {
1125
- throw new GovernanceBlockedError(verdict, toolCall.id);
1259
+ throw new GovernanceBlockedError2(verdict, toolCall.id);
1126
1260
  }
1127
1261
  let args;
1128
1262
  try {
@@ -1,4 +1,5 @@
1
- import { G as GuardVerdict, a as GuardEvent, P as PlanDefinition, b as PlanProgress, W as WorldDefinition } from '../guard-contract-D-2LQInm.cjs';
1
+ import { a as GuardVerdict, G as GuardEvent, P as PlanDefinition, c as PlanProgress, b as GuardEngineOptions, W as WorldDefinition } from '../guard-contract-C9_zKbzd.cjs';
2
+ import { G as GovernanceBlockedError$1 } from '../shared-HpAG90PX.cjs';
2
3
 
3
4
  /**
4
5
  * NeuroVerse Adapter — OpenAI
@@ -52,8 +53,7 @@ interface GovernedExecutorOptions {
52
53
  /** Called when all plan steps are completed. */
53
54
  onPlanComplete?: () => void;
54
55
  }
55
- declare class GovernanceBlockedError extends Error {
56
- readonly verdict: GuardVerdict;
56
+ declare class GovernanceBlockedError extends GovernanceBlockedError$1 {
57
57
  readonly toolCallId: string;
58
58
  constructor(verdict: GuardVerdict, toolCallId: string);
59
59
  }
@@ -64,10 +64,10 @@ declare class GovernanceBlockedError extends Error {
64
64
  declare class GovernedToolExecutor {
65
65
  private world;
66
66
  private options;
67
- private engineOptions;
67
+ engineOptions: GuardEngineOptions;
68
68
  private mapFn;
69
69
  private blockMsg;
70
- private activePlan?;
70
+ activePlan?: PlanDefinition;
71
71
  constructor(world: WorldDefinition, options?: GovernedExecutorOptions);
72
72
  /**
73
73
  * Evaluate a single tool call against governance rules.
@@ -1,4 +1,5 @@
1
- import { G as GuardVerdict, a as GuardEvent, P as PlanDefinition, b as PlanProgress, W as WorldDefinition } from '../guard-contract-D-2LQInm.js';
1
+ import { a as GuardVerdict, G as GuardEvent, P as PlanDefinition, c as PlanProgress, b as GuardEngineOptions, W as WorldDefinition } from '../guard-contract-C9_zKbzd.js';
2
+ import { G as GovernanceBlockedError$1 } from '../shared--Q8wPBVN.js';
2
3
 
3
4
  /**
4
5
  * NeuroVerse Adapter — OpenAI
@@ -52,8 +53,7 @@ interface GovernedExecutorOptions {
52
53
  /** Called when all plan steps are completed. */
53
54
  onPlanComplete?: () => void;
54
55
  }
55
- declare class GovernanceBlockedError extends Error {
56
- readonly verdict: GuardVerdict;
56
+ declare class GovernanceBlockedError extends GovernanceBlockedError$1 {
57
57
  readonly toolCallId: string;
58
58
  constructor(verdict: GuardVerdict, toolCallId: string);
59
59
  }
@@ -64,10 +64,10 @@ declare class GovernanceBlockedError extends Error {
64
64
  declare class GovernedToolExecutor {
65
65
  private world;
66
66
  private options;
67
- private engineOptions;
67
+ engineOptions: GuardEngineOptions;
68
68
  private mapFn;
69
69
  private blockMsg;
70
- private activePlan?;
70
+ activePlan?: PlanDefinition;
71
71
  constructor(world: WorldDefinition, options?: GovernedExecutorOptions);
72
72
  /**
73
73
  * Evaluate a single tool call against governance rules.
@@ -3,10 +3,11 @@ import {
3
3
  GovernedToolExecutor,
4
4
  createGovernedToolExecutor,
5
5
  createGovernedToolExecutorFromWorld
6
- } from "../chunk-TINSRYXQ.js";
7
- import "../chunk-PQBJBVSW.js";
6
+ } from "../chunk-ZIVQNSZU.js";
7
+ import "../chunk-5U2MQO5P.js";
8
+ import "../chunk-IZSO75NZ.js";
9
+ import "../chunk-QLPTHTVB.js";
8
10
  import "../chunk-JZPQGIKR.js";
9
- import "../chunk-P74Y66ZV.js";
10
11
  import "../chunk-YZFATT7X.js";
11
12
  export {
12
13
  GovernanceBlockedError,