@neuroverseos/governance 0.3.1 → 0.3.4

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 (133) hide show
  1. package/.well-known/ai-plugin.json +34 -9
  2. package/AGENTS.md +72 -24
  3. package/README.md +343 -248
  4. package/dist/adapters/autoresearch.cjs +1345 -0
  5. package/dist/adapters/autoresearch.d.cts +111 -0
  6. package/dist/adapters/autoresearch.d.ts +111 -0
  7. package/dist/adapters/autoresearch.js +12 -0
  8. package/dist/adapters/deep-agents.cjs +1528 -0
  9. package/dist/adapters/deep-agents.d.cts +181 -0
  10. package/dist/adapters/deep-agents.d.ts +181 -0
  11. package/dist/adapters/deep-agents.js +17 -0
  12. package/dist/adapters/express.cjs +1253 -0
  13. package/dist/adapters/express.d.cts +66 -0
  14. package/dist/adapters/express.d.ts +66 -0
  15. package/dist/adapters/express.js +12 -0
  16. package/dist/adapters/index.cjs +2112 -0
  17. package/dist/adapters/index.d.cts +8 -0
  18. package/dist/adapters/index.d.ts +8 -0
  19. package/dist/adapters/index.js +68 -0
  20. package/dist/adapters/langchain.cjs +1315 -0
  21. package/dist/adapters/langchain.d.cts +89 -0
  22. package/dist/adapters/langchain.d.ts +89 -0
  23. package/dist/adapters/langchain.js +17 -0
  24. package/dist/adapters/openai.cjs +1345 -0
  25. package/dist/adapters/openai.d.cts +99 -0
  26. package/dist/adapters/openai.d.ts +99 -0
  27. package/dist/adapters/openai.js +17 -0
  28. package/dist/adapters/openclaw.cjs +1337 -0
  29. package/dist/adapters/openclaw.d.cts +99 -0
  30. package/dist/adapters/openclaw.d.ts +99 -0
  31. package/dist/adapters/openclaw.js +17 -0
  32. package/dist/add-ROOZLU62.js +314 -0
  33. package/dist/behavioral-MJO34S6Q.js +118 -0
  34. package/dist/bootstrap-CQRZVOXK.js +116 -0
  35. package/dist/bootstrap-emitter-Q7UIJZ2O.js +7 -0
  36. package/dist/bootstrap-parser-EEF36XDU.js +7 -0
  37. package/dist/browser.global.js +941 -0
  38. package/dist/build-ZHPMX5AZ.js +342 -0
  39. package/dist/chunk-3WQLXYTP.js +91 -0
  40. package/dist/chunk-4FLICVVA.js +119 -0
  41. package/dist/chunk-4NGDRRQH.js +10 -0
  42. package/dist/chunk-5TPFNWRU.js +215 -0
  43. package/dist/chunk-5U2MQO5P.js +57 -0
  44. package/dist/chunk-6CZSKEY5.js +164 -0
  45. package/dist/chunk-7P3S7MAY.js +1090 -0
  46. package/dist/chunk-A5W4GNQO.js +130 -0
  47. package/dist/chunk-A7GKPPU7.js +226 -0
  48. package/dist/chunk-AKW5YVCE.js +96 -0
  49. package/dist/chunk-B6OXJLJ5.js +622 -0
  50. package/dist/chunk-BNKJPUPQ.js +113 -0
  51. package/dist/chunk-BQZMOEML.js +43 -0
  52. package/dist/chunk-CNSO6XW5.js +207 -0
  53. package/dist/chunk-CTZHONLA.js +135 -0
  54. package/dist/chunk-D2UCV5AK.js +326 -0
  55. package/dist/chunk-EMQDLDAF.js +458 -0
  56. package/dist/chunk-F66BVUYB.js +340 -0
  57. package/dist/chunk-FMSTRBBS.js +17 -0
  58. package/dist/chunk-G7DJ6VOD.js +101 -0
  59. package/dist/chunk-I3RRAYK2.js +11 -0
  60. package/dist/chunk-INWQHLPS.js +47 -0
  61. package/dist/chunk-IS4WUH6Y.js +363 -0
  62. package/dist/chunk-O5ABKEA7.js +304 -0
  63. package/dist/chunk-OT6PXH54.js +61 -0
  64. package/dist/chunk-PVTQQS3Y.js +186 -0
  65. package/dist/chunk-QLPTHTVB.js +253 -0
  66. package/dist/chunk-QWGCMQQD.js +16 -0
  67. package/dist/chunk-QXBFT7NI.js +201 -0
  68. package/dist/chunk-TG6SEF24.js +246 -0
  69. package/dist/chunk-U6U7EJZL.js +177 -0
  70. package/dist/chunk-VXHSMA3I.js +166 -0
  71. package/dist/chunk-W7LLXRGY.js +830 -0
  72. package/dist/chunk-YEKMVDWK.js +624 -0
  73. package/dist/chunk-ZJTDUCC2.js +194 -0
  74. package/dist/chunk-ZWI3NIXK.js +314 -0
  75. package/dist/cli/neuroverse.cjs +14379 -0
  76. package/dist/cli/neuroverse.d.cts +1 -0
  77. package/dist/cli/neuroverse.d.ts +1 -0
  78. package/dist/cli/neuroverse.js +227 -0
  79. package/dist/cli/plan.cjs +2439 -0
  80. package/dist/cli/plan.d.cts +20 -0
  81. package/dist/cli/plan.d.ts +20 -0
  82. package/dist/cli/plan.js +353 -0
  83. package/dist/cli/run.cjs +2001 -0
  84. package/dist/cli/run.d.cts +20 -0
  85. package/dist/cli/run.d.ts +20 -0
  86. package/dist/cli/run.js +143 -0
  87. package/dist/configure-ai-5MP5DWTT.js +134 -0
  88. package/dist/decision-flow-M63D47LO.js +61 -0
  89. package/dist/demo-G43RLCPK.js +469 -0
  90. package/dist/derive-LMDUTXDD.js +154 -0
  91. package/dist/doctor-6BC6X2VO.js +173 -0
  92. package/dist/equity-penalties-SG5IZQ7I.js +244 -0
  93. package/dist/explain-RHBU2GBR.js +51 -0
  94. package/dist/guard-AEEJNWLD.js +126 -0
  95. package/dist/guard-contract-B7lplwm9.d.cts +837 -0
  96. package/dist/guard-contract-B7lplwm9.d.ts +837 -0
  97. package/dist/guard-engine-PNR6MHCM.js +10 -0
  98. package/dist/impact-3XVDSCBU.js +59 -0
  99. package/dist/improve-TQP4ECSY.js +66 -0
  100. package/dist/index.cjs +7738 -0
  101. package/dist/index.d.cts +2350 -0
  102. package/dist/index.d.ts +2350 -0
  103. package/dist/index.js +479 -0
  104. package/dist/infer-world-IFXCACJ5.js +543 -0
  105. package/dist/init-FYPV4SST.js +144 -0
  106. package/dist/init-world-TI7ARHBT.js +223 -0
  107. package/dist/mcp-server-5Y3ZM7TV.js +13 -0
  108. package/dist/model-adapter-VXEKB4LS.js +11 -0
  109. package/dist/playground-VZBNPPBO.js +560 -0
  110. package/dist/redteam-MZPZD3EF.js +357 -0
  111. package/dist/session-JYOARW54.js +15 -0
  112. package/dist/shared-7RLUHNMU.js +16 -0
  113. package/dist/shared-C_zpdvBm.d.cts +60 -0
  114. package/dist/shared-Cf7yxx4-.d.ts +60 -0
  115. package/dist/simulate-LJXYBC6M.js +83 -0
  116. package/dist/test-BOOR4A5F.js +217 -0
  117. package/dist/trace-PKV4KX56.js +166 -0
  118. package/dist/validate-RALX7CZS.js +81 -0
  119. package/dist/validate-engine-7ZXFVGF2.js +7 -0
  120. package/dist/viz/assets/index-B8SaeJZZ.js +23 -0
  121. package/dist/viz/index.html +23 -0
  122. package/dist/world-BIP4GZBZ.js +376 -0
  123. package/dist/world-loader-Y6HMQH2D.js +13 -0
  124. package/dist/worlds/autoresearch.nv-world.md +230 -0
  125. package/dist/worlds/coding-agent.nv-world.md +211 -0
  126. package/dist/worlds/derivation-world.nv-world.md +278 -0
  127. package/dist/worlds/research-agent.nv-world.md +169 -0
  128. package/dist/worlds/social-media.nv-world.md +198 -0
  129. package/dist/worlds/trading-agent.nv-world.md +218 -0
  130. package/examples/social-media-sim/bridge.py +209 -0
  131. package/examples/social-media-sim/simulation.py +927 -0
  132. package/package.json +16 -3
  133. package/simulate.html +4 -336
package/dist/index.js ADDED
@@ -0,0 +1,479 @@
1
+ import {
2
+ actionToGuardEvent,
3
+ createGovernor,
4
+ govern,
5
+ handleCreateCapsule,
6
+ handleHealthCheck,
7
+ handleListPresets,
8
+ handleReasonRequest,
9
+ writeTempWorld
10
+ } from "./chunk-U6U7EJZL.js";
11
+ import {
12
+ generateImpactReport,
13
+ generateImpactReportFromFile,
14
+ renderImpactReport
15
+ } from "./chunk-TG6SEF24.js";
16
+ import {
17
+ adaptationFromVerdict,
18
+ classifyAdaptation,
19
+ detectBehavioralPatterns,
20
+ generateAdaptationNarrative
21
+ } from "./chunk-CNSO6XW5.js";
22
+ import {
23
+ CompositeAuditLogger,
24
+ ConsoleAuditLogger,
25
+ FileAuditLogger,
26
+ createGovernanceEngine,
27
+ readAuditLog,
28
+ summarizeAuditEvents,
29
+ verdictToAuditEvent
30
+ } from "./chunk-A7GKPPU7.js";
31
+ import {
32
+ improveWorld,
33
+ renderImproveText
34
+ } from "./chunk-F66BVUYB.js";
35
+ import {
36
+ BOOTSTRAP_EXIT_CODES
37
+ } from "./chunk-4NGDRRQH.js";
38
+ import {
39
+ VALIDATE_EXIT_CODES
40
+ } from "./chunk-I3RRAYK2.js";
41
+ import {
42
+ GUARD_EXIT_CODES,
43
+ classifyIntentWithAI,
44
+ evaluateGuardWithAI,
45
+ extractContentFields
46
+ } from "./chunk-VXHSMA3I.js";
47
+ import {
48
+ ModelAdapter,
49
+ PROVIDERS,
50
+ resolveProvider
51
+ } from "./chunk-A5W4GNQO.js";
52
+ import {
53
+ McpGovernanceServer
54
+ } from "./chunk-B6OXJLJ5.js";
55
+ import {
56
+ addGuard,
57
+ addInvariant,
58
+ addRule,
59
+ classifyIntent,
60
+ parseGuardDescription
61
+ } from "./chunk-5TPFNWRU.js";
62
+ import {
63
+ deriveWorld,
64
+ extractWorldMarkdown,
65
+ normalizeWorldMarkdown
66
+ } from "./chunk-YEKMVDWK.js";
67
+ import {
68
+ CONFIGURE_AI_EXIT_CODES,
69
+ DERIVE_EXIT_CODES
70
+ } from "./chunk-FMSTRBBS.js";
71
+ import "./chunk-OT6PXH54.js";
72
+ import "./chunk-INWQHLPS.js";
73
+ import {
74
+ validateWorld
75
+ } from "./chunk-7P3S7MAY.js";
76
+ import {
77
+ explainWorld,
78
+ renderExplainText
79
+ } from "./chunk-ZJTDUCC2.js";
80
+ import {
81
+ renderSimulateText,
82
+ simulateWorld
83
+ } from "./chunk-ZWI3NIXK.js";
84
+ import {
85
+ PLAN_EXIT_CODES,
86
+ parsePlanMarkdown
87
+ } from "./chunk-6CZSKEY5.js";
88
+ import {
89
+ describeActiveWorld,
90
+ getActiveWorldName,
91
+ listWorlds,
92
+ resolveWorldPath,
93
+ setActiveWorld
94
+ } from "./chunk-AKW5YVCE.js";
95
+ import {
96
+ parseWorldMarkdown
97
+ } from "./chunk-EMQDLDAF.js";
98
+ import {
99
+ emitWorldDefinition
100
+ } from "./chunk-PVTQQS3Y.js";
101
+ import {
102
+ SessionManager,
103
+ runInteractiveMode,
104
+ runPipeMode
105
+ } from "./chunk-IS4WUH6Y.js";
106
+ import {
107
+ applyConsequence,
108
+ applyReward,
109
+ createAgentState,
110
+ generateDecisionFlow,
111
+ renderDecisionFlow,
112
+ tickAgentStates
113
+ } from "./chunk-D2UCV5AK.js";
114
+ import {
115
+ evaluateGuard,
116
+ eventToAllowlistKey
117
+ } from "./chunk-W7LLXRGY.js";
118
+ import {
119
+ advancePlan,
120
+ buildPlanCheck,
121
+ evaluatePlan,
122
+ getPlanProgress
123
+ } from "./chunk-QLPTHTVB.js";
124
+ import {
125
+ loadWorld,
126
+ loadWorldFromDirectory
127
+ } from "./chunk-CTZHONLA.js";
128
+ import "./chunk-QWGCMQQD.js";
129
+
130
+ // src/engine/verdict-formatter.ts
131
+ var ANSI = {
132
+ red: "\x1B[31m",
133
+ green: "\x1B[32m",
134
+ yellow: "\x1B[33m",
135
+ blue: "\x1B[34m",
136
+ magenta: "\x1B[35m",
137
+ cyan: "\x1B[36m",
138
+ gray: "\x1B[90m",
139
+ bold: "\x1B[1m",
140
+ dim: "\x1B[2m",
141
+ reset: "\x1B[0m"
142
+ };
143
+ function c(text, ...codes) {
144
+ return codes.join("") + text + ANSI.reset;
145
+ }
146
+ function formatVerdict(verdict, options = {}) {
147
+ const {
148
+ showRuleId = true,
149
+ showEvidence = false,
150
+ showWarning = true,
151
+ color = false,
152
+ compact = false
153
+ } = options;
154
+ if (compact) {
155
+ return formatCompact(verdict, { showRuleId, showWarning, color });
156
+ }
157
+ return formatFull(verdict, { showRuleId, showEvidence, showWarning, color });
158
+ }
159
+ function formatCompact(verdict, opts) {
160
+ const status = formatStatus(verdict.status, opts.color);
161
+ const parts = [status];
162
+ if (opts.showRuleId && verdict.ruleId) {
163
+ parts.push(verdict.ruleId);
164
+ }
165
+ if (verdict.reason) {
166
+ parts.push(verdict.reason);
167
+ }
168
+ if (opts.showWarning && verdict.warning) {
169
+ parts.push(`warning: ${verdict.warning}`);
170
+ }
171
+ return parts.join(" \u2014 ");
172
+ }
173
+ function formatFull(verdict, opts) {
174
+ const lines = [];
175
+ lines.push(formatStatus(verdict.status, opts.color));
176
+ if (opts.showRuleId && verdict.ruleId) {
177
+ lines.push(` Rule: ${verdict.ruleId}`);
178
+ }
179
+ if (verdict.reason) {
180
+ lines.push(` Reason: ${verdict.reason}`);
181
+ }
182
+ if (verdict.consequence) {
183
+ const label = opts.color ? c("Consequence:", ANSI.red) : "Consequence:";
184
+ lines.push(` ${label} ${verdict.consequence.description}`);
185
+ if (verdict.consequence.rounds) {
186
+ lines.push(` Freeze: ${verdict.consequence.rounds} round(s)`);
187
+ }
188
+ if (verdict.consequence.magnitude) {
189
+ lines.push(` Magnitude: ${(verdict.consequence.magnitude * 100).toFixed(0)}%`);
190
+ }
191
+ }
192
+ if (verdict.reward) {
193
+ const label = opts.color ? c("Reward:", ANSI.blue) : "Reward:";
194
+ lines.push(` ${label} ${verdict.reward.description}`);
195
+ if (verdict.reward.rounds) {
196
+ lines.push(` Duration: ${verdict.reward.rounds} round(s)`);
197
+ }
198
+ if (verdict.reward.magnitude) {
199
+ lines.push(` Boost: ${(verdict.reward.magnitude * 100).toFixed(0)}%`);
200
+ }
201
+ }
202
+ if (verdict.intentRecord) {
203
+ const ir = verdict.intentRecord;
204
+ const label = opts.color ? c("Intent Flow:", ANSI.cyan) : "Intent Flow:";
205
+ lines.push(` ${label} ${ir.originalIntent} \u2192 ${ir.finalAction}`);
206
+ }
207
+ if (opts.showWarning && verdict.warning) {
208
+ const label = opts.color ? c("Warning:", ANSI.yellow) : "Warning:";
209
+ lines.push(` ${label} ${verdict.warning}`);
210
+ }
211
+ if (opts.showEvidence) {
212
+ const ev = verdict.evidence;
213
+ lines.push(` World: ${ev.worldName} v${ev.worldVersion}`);
214
+ lines.push(` Invariants: ${ev.invariantsSatisfied}/${ev.invariantsTotal} covered`);
215
+ if (ev.guardsMatched.length > 0) {
216
+ lines.push(` Guards matched: ${ev.guardsMatched.join(", ")}`);
217
+ }
218
+ if (ev.rulesMatched.length > 0) {
219
+ lines.push(` Rules matched: ${ev.rulesMatched.join(", ")}`);
220
+ }
221
+ lines.push(` Enforcement: ${ev.enforcementLevel}`);
222
+ }
223
+ return lines.join("\n");
224
+ }
225
+ function formatStatus(status, color) {
226
+ switch (status) {
227
+ case "ALLOW":
228
+ return color ? c("ALLOWED", ANSI.green, ANSI.bold) : "ALLOWED";
229
+ case "BLOCK":
230
+ return color ? c("BLOCKED", ANSI.red, ANSI.bold) : "BLOCKED";
231
+ case "PAUSE":
232
+ return color ? c("PAUSED", ANSI.yellow, ANSI.bold) : "PAUSED";
233
+ case "MODIFY":
234
+ return color ? c("MODIFIED", ANSI.yellow, ANSI.bold) : "MODIFIED";
235
+ case "PENALIZE":
236
+ return color ? c("PENALIZED", ANSI.red, ANSI.bold) : "PENALIZED";
237
+ case "REWARD":
238
+ return color ? c("REWARDED", ANSI.blue, ANSI.bold) : "REWARDED";
239
+ case "NEUTRAL":
240
+ return color ? c("NEUTRAL", ANSI.gray, ANSI.bold) : "NEUTRAL";
241
+ default:
242
+ return status;
243
+ }
244
+ }
245
+ function formatVerdictOneLine(verdict) {
246
+ const parts = [verdict.status];
247
+ if (verdict.ruleId) {
248
+ parts[0] += `: ${verdict.ruleId}`;
249
+ }
250
+ if (verdict.reason) {
251
+ parts.push(verdict.reason);
252
+ }
253
+ return parts.join(" \u2014 ");
254
+ }
255
+
256
+ // src/engine/condition-engine.ts
257
+ function getFieldValue(event, field) {
258
+ if (field.startsWith("args.")) {
259
+ const key = field.slice(5);
260
+ return event.args?.[key];
261
+ }
262
+ return event[field];
263
+ }
264
+ function toString(value) {
265
+ if (value === null || value === void 0) return "";
266
+ if (typeof value === "string") return value;
267
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
268
+ return JSON.stringify(value);
269
+ }
270
+ function evaluateCondition(condition, event) {
271
+ const fieldValue = getFieldValue(event, condition.field);
272
+ if (fieldValue === void 0 && condition.operator !== "!=") {
273
+ return { matched: false, evidence: null };
274
+ }
275
+ switch (condition.operator) {
276
+ case "==":
277
+ return evaluateEquals(fieldValue, condition.value);
278
+ case "!=":
279
+ return evaluateNotEquals(fieldValue, condition.value);
280
+ case ">":
281
+ return evaluateComparison(fieldValue, condition.value, (a, b) => a > b);
282
+ case "<":
283
+ return evaluateComparison(fieldValue, condition.value, (a, b) => a < b);
284
+ case ">=":
285
+ return evaluateComparison(fieldValue, condition.value, (a, b) => a >= b);
286
+ case "<=":
287
+ return evaluateComparison(fieldValue, condition.value, (a, b) => a <= b);
288
+ case "in":
289
+ return evaluateIn(fieldValue, condition.value);
290
+ case "contains":
291
+ return evaluateContains(fieldValue, condition.value);
292
+ case "contains_any":
293
+ return evaluateContainsAny(fieldValue, condition.value);
294
+ case "matches_pattern":
295
+ return evaluateMatchesPattern(fieldValue, condition.value);
296
+ case "starts_with":
297
+ return evaluateStartsWith(fieldValue, condition.value);
298
+ case "ends_with":
299
+ return evaluateEndsWith(fieldValue, condition.value);
300
+ default:
301
+ return { matched: false, evidence: null };
302
+ }
303
+ }
304
+ function evaluateEquals(fieldValue, conditionValue) {
305
+ const fieldStr = toString(fieldValue);
306
+ const condStr = toString(conditionValue);
307
+ const matched = fieldStr === condStr;
308
+ return {
309
+ matched,
310
+ evidence: matched ? `${fieldStr} == ${condStr}` : null
311
+ };
312
+ }
313
+ function evaluateNotEquals(fieldValue, conditionValue) {
314
+ const fieldStr = toString(fieldValue);
315
+ const condStr = toString(conditionValue);
316
+ const matched = fieldStr !== condStr;
317
+ return {
318
+ matched,
319
+ evidence: matched ? `${fieldStr} != ${condStr}` : null
320
+ };
321
+ }
322
+ function evaluateComparison(fieldValue, conditionValue, comparator) {
323
+ const a = Number(fieldValue);
324
+ const b = Number(conditionValue);
325
+ if (isNaN(a) || isNaN(b)) return { matched: false, evidence: null };
326
+ const matched = comparator(a, b);
327
+ return {
328
+ matched,
329
+ evidence: matched ? `${a} compared to ${b}` : null
330
+ };
331
+ }
332
+ function evaluateIn(fieldValue, conditionValue) {
333
+ if (!Array.isArray(conditionValue)) return { matched: false, evidence: null };
334
+ const fieldStr = toString(fieldValue);
335
+ const matched = conditionValue.some((v) => toString(v) === fieldStr);
336
+ return {
337
+ matched,
338
+ evidence: matched ? `"${fieldStr}" found in [${conditionValue.join(", ")}]` : null
339
+ };
340
+ }
341
+ function evaluateContains(fieldValue, conditionValue) {
342
+ const fieldStr = toString(fieldValue).toLowerCase();
343
+ const searchStr = toString(conditionValue).toLowerCase();
344
+ const matched = fieldStr.includes(searchStr);
345
+ return {
346
+ matched,
347
+ evidence: matched ? `"${searchStr}" found in field` : null
348
+ };
349
+ }
350
+ function evaluateContainsAny(fieldValue, conditionValue) {
351
+ if (!Array.isArray(conditionValue)) return { matched: false, evidence: null };
352
+ const fieldStr = toString(fieldValue).toLowerCase();
353
+ for (const pattern of conditionValue) {
354
+ const patternLower = toString(pattern).toLowerCase();
355
+ if (fieldStr.includes(patternLower)) {
356
+ return {
357
+ matched: true,
358
+ evidence: `"${patternLower}" found in field`
359
+ };
360
+ }
361
+ }
362
+ return { matched: false, evidence: null };
363
+ }
364
+ function evaluateMatchesPattern(fieldValue, conditionValue) {
365
+ const fieldStr = toString(fieldValue);
366
+ const patterns = Array.isArray(conditionValue) ? conditionValue : [toString(conditionValue)];
367
+ for (const pattern of patterns) {
368
+ try {
369
+ const regex = new RegExp(toString(pattern), "i");
370
+ if (regex.test(fieldStr)) {
371
+ return {
372
+ matched: true,
373
+ evidence: `matched pattern /${pattern}/`
374
+ };
375
+ }
376
+ } catch {
377
+ continue;
378
+ }
379
+ }
380
+ return { matched: false, evidence: null };
381
+ }
382
+ function evaluateStartsWith(fieldValue, conditionValue) {
383
+ const fieldStr = toString(fieldValue).toLowerCase();
384
+ const prefix = toString(conditionValue).toLowerCase();
385
+ const matched = fieldStr.startsWith(prefix);
386
+ return {
387
+ matched,
388
+ evidence: matched ? `field starts with "${prefix}"` : null
389
+ };
390
+ }
391
+ function evaluateEndsWith(fieldValue, conditionValue) {
392
+ const fieldStr = toString(fieldValue).toLowerCase();
393
+ const suffix = toString(conditionValue).toLowerCase();
394
+ const matched = fieldStr.endsWith(suffix);
395
+ return {
396
+ matched,
397
+ evidence: matched ? `field ends with "${suffix}"` : null
398
+ };
399
+ }
400
+ export {
401
+ BOOTSTRAP_EXIT_CODES,
402
+ CONFIGURE_AI_EXIT_CODES,
403
+ CompositeAuditLogger,
404
+ ConsoleAuditLogger,
405
+ DERIVE_EXIT_CODES,
406
+ FileAuditLogger,
407
+ GUARD_EXIT_CODES,
408
+ McpGovernanceServer,
409
+ ModelAdapter,
410
+ PLAN_EXIT_CODES,
411
+ PROVIDERS,
412
+ SessionManager,
413
+ VALIDATE_EXIT_CODES,
414
+ actionToGuardEvent,
415
+ adaptationFromVerdict,
416
+ addGuard,
417
+ addInvariant,
418
+ addRule,
419
+ advancePlan,
420
+ applyConsequence,
421
+ applyReward,
422
+ buildPlanCheck,
423
+ classifyAdaptation,
424
+ classifyIntent,
425
+ classifyIntentWithAI,
426
+ createAgentState,
427
+ createGovernanceEngine,
428
+ createGovernor,
429
+ deriveWorld,
430
+ describeActiveWorld,
431
+ detectBehavioralPatterns,
432
+ emitWorldDefinition,
433
+ evaluateCondition,
434
+ evaluateGuard,
435
+ evaluateGuardWithAI,
436
+ evaluatePlan,
437
+ eventToAllowlistKey,
438
+ explainWorld,
439
+ extractContentFields,
440
+ extractWorldMarkdown,
441
+ formatVerdict,
442
+ formatVerdictOneLine,
443
+ generateAdaptationNarrative,
444
+ generateDecisionFlow,
445
+ generateImpactReport,
446
+ generateImpactReportFromFile,
447
+ getActiveWorldName,
448
+ getPlanProgress,
449
+ govern,
450
+ handleCreateCapsule,
451
+ handleHealthCheck,
452
+ handleListPresets,
453
+ handleReasonRequest,
454
+ improveWorld,
455
+ listWorlds,
456
+ loadWorld,
457
+ loadWorldFromDirectory,
458
+ normalizeWorldMarkdown,
459
+ parseGuardDescription,
460
+ parsePlanMarkdown,
461
+ parseWorldMarkdown,
462
+ readAuditLog,
463
+ renderDecisionFlow,
464
+ renderExplainText,
465
+ renderImpactReport,
466
+ renderImproveText,
467
+ renderSimulateText,
468
+ resolveProvider,
469
+ resolveWorldPath,
470
+ runInteractiveMode,
471
+ runPipeMode,
472
+ setActiveWorld,
473
+ simulateWorld,
474
+ summarizeAuditEvents,
475
+ tickAgentStates,
476
+ validateWorld,
477
+ verdictToAuditEvent,
478
+ writeTempWorld
479
+ };