@intutic/mcp-governance-proxy 2.2.0 → 2.4.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 (137) hide show
  1. package/README.md +8 -7
  2. package/dist/agentTools.d.ts +83 -0
  3. package/dist/agentTools.d.ts.map +1 -0
  4. package/dist/agentTools.js +170 -0
  5. package/dist/agentTools.js.map +1 -0
  6. package/dist/anomaly/detectors.js +1 -1
  7. package/dist/anomaly/detectors.js.map +1 -1
  8. package/dist/approvalHold.d.ts +8 -7
  9. package/dist/approvalHold.d.ts.map +1 -1
  10. package/dist/approvalHold.js +7 -6
  11. package/dist/approvalHold.js.map +1 -1
  12. package/dist/budget.d.ts +133 -0
  13. package/dist/budget.d.ts.map +1 -0
  14. package/dist/budget.js +191 -0
  15. package/dist/budget.js.map +1 -0
  16. package/dist/config.d.ts +1 -1
  17. package/dist/config.js +1 -1
  18. package/dist/config.js.map +1 -1
  19. package/dist/daemon/healthMonitor.d.ts.map +1 -1
  20. package/dist/daemon/healthMonitor.js +0 -1
  21. package/dist/daemon/healthMonitor.js.map +1 -1
  22. package/dist/daemon/index.d.ts +0 -2
  23. package/dist/daemon/index.d.ts.map +1 -1
  24. package/dist/daemon/index.js +0 -2
  25. package/dist/daemon/index.js.map +1 -1
  26. package/dist/daemon/policyCache.d.ts +22 -3
  27. package/dist/daemon/policyCache.d.ts.map +1 -1
  28. package/dist/daemon/policyCache.js +38 -15
  29. package/dist/daemon/policyCache.js.map +1 -1
  30. package/dist/daemon/socketServer.d.ts +0 -1
  31. package/dist/daemon/socketServer.d.ts.map +1 -1
  32. package/dist/daemon/socketServer.js +0 -1
  33. package/dist/daemon/socketServer.js.map +1 -1
  34. package/dist/daemon/statusReporter.d.ts.map +1 -1
  35. package/dist/daemon/statusReporter.js +0 -1
  36. package/dist/daemon/statusReporter.js.map +1 -1
  37. package/dist/daemon/telemetryBatcher.d.ts.map +1 -1
  38. package/dist/daemon/telemetryBatcher.js +0 -1
  39. package/dist/daemon/telemetryBatcher.js.map +1 -1
  40. package/dist/daemonClient.d.ts.map +1 -1
  41. package/dist/daemonClient.js +0 -1
  42. package/dist/daemonClient.js.map +1 -1
  43. package/dist/dlp.d.ts +32 -3
  44. package/dist/dlp.d.ts.map +1 -1
  45. package/dist/dlp.js +116 -18
  46. package/dist/dlp.js.map +1 -1
  47. package/dist/dlpPii.d.ts +66 -0
  48. package/dist/dlpPii.d.ts.map +1 -0
  49. package/dist/dlpPii.js +235 -0
  50. package/dist/dlpPii.js.map +1 -0
  51. package/dist/emitter.d.ts +65 -3
  52. package/dist/emitter.d.ts.map +1 -1
  53. package/dist/emitter.js +13 -1
  54. package/dist/emitter.js.map +1 -1
  55. package/dist/guardedValkey.d.ts +40 -0
  56. package/dist/guardedValkey.d.ts.map +1 -0
  57. package/dist/guardedValkey.js +84 -0
  58. package/dist/guardedValkey.js.map +1 -0
  59. package/dist/httpJson.d.ts +7 -0
  60. package/dist/httpJson.d.ts.map +1 -1
  61. package/dist/httpJson.js +39 -0
  62. package/dist/httpJson.js.map +1 -1
  63. package/dist/injection.js +1 -1
  64. package/dist/interceptor.d.ts +65 -10
  65. package/dist/interceptor.d.ts.map +1 -1
  66. package/dist/interceptor.js +190 -69
  67. package/dist/interceptor.js.map +1 -1
  68. package/dist/policy.d.ts +37 -1
  69. package/dist/policy.d.ts.map +1 -1
  70. package/dist/policy.js +62 -3
  71. package/dist/policy.js.map +1 -1
  72. package/dist/proxy.d.ts +30 -9
  73. package/dist/proxy.d.ts.map +1 -1
  74. package/dist/proxy.js +127 -57
  75. package/dist/proxy.js.map +1 -1
  76. package/dist/refusals.d.ts +26 -0
  77. package/dist/refusals.d.ts.map +1 -0
  78. package/dist/refusals.js +43 -0
  79. package/dist/refusals.js.map +1 -0
  80. package/dist/registryObserver.d.ts +9 -5
  81. package/dist/registryObserver.d.ts.map +1 -1
  82. package/dist/registryObserver.js +19 -8
  83. package/dist/registryObserver.js.map +1 -1
  84. package/dist/session.d.ts +1 -1
  85. package/dist/session.js +1 -1
  86. package/dist/sessionScope.d.ts +1 -1
  87. package/dist/sessionScope.js +1 -1
  88. package/dist/sessionStore.d.ts +10 -23
  89. package/dist/sessionStore.d.ts.map +1 -1
  90. package/dist/sessionStore.js +17 -76
  91. package/dist/sessionStore.js.map +1 -1
  92. package/dist/wasm/cloudRules.d.ts +138 -0
  93. package/dist/wasm/cloudRules.d.ts.map +1 -0
  94. package/dist/wasm/cloudRules.js +242 -0
  95. package/dist/wasm/cloudRules.js.map +1 -0
  96. package/dist/wasm/context.d.ts +10 -0
  97. package/dist/wasm/context.d.ts.map +1 -1
  98. package/dist/wasm/context.js +27 -0
  99. package/dist/wasm/context.js.map +1 -1
  100. package/dist/wasm/hostImports.d.ts +3 -3
  101. package/dist/wasm/hostImports.d.ts.map +1 -1
  102. package/dist/wasm/hostImports.js +8 -7
  103. package/dist/wasm/hostImports.js.map +1 -1
  104. package/dist/wasm/loader.d.ts +10 -1
  105. package/dist/wasm/loader.d.ts.map +1 -1
  106. package/dist/wasm/loader.js +2 -0
  107. package/dist/wasm/loader.js.map +1 -1
  108. package/dist/wasm/referencedFiles.d.ts +29 -4
  109. package/dist/wasm/referencedFiles.d.ts.map +1 -1
  110. package/dist/wasm/referencedFiles.js +48 -21
  111. package/dist/wasm/referencedFiles.js.map +1 -1
  112. package/dist/wasm/runner.d.ts +169 -31
  113. package/dist/wasm/runner.d.ts.map +1 -1
  114. package/dist/wasm/runner.js +298 -83
  115. package/dist/wasm/runner.js.map +1 -1
  116. package/dist/wasm/watch.js +1 -1
  117. package/dist/wasm/worker.d.ts +10 -6
  118. package/dist/wasm/worker.d.ts.map +1 -1
  119. package/dist/wasm/worker.js +93 -9
  120. package/dist/wasm/worker.js.map +1 -1
  121. package/package.json +5 -4
  122. package/dist/toolPoison.d.ts +0 -32
  123. package/dist/toolPoison.d.ts.map +0 -1
  124. package/dist/toolPoison.js +0 -81
  125. package/dist/toolPoison.js.map +0 -1
  126. package/dist/wasm/fuel.d.ts +0 -35
  127. package/dist/wasm/fuel.d.ts.map +0 -1
  128. package/dist/wasm/fuel.js +0 -299
  129. package/dist/wasm/fuel.js.map +0 -1
  130. package/dist/wasm/memoryCap.d.ts +0 -21
  131. package/dist/wasm/memoryCap.d.ts.map +0 -1
  132. package/dist/wasm/memoryCap.js +0 -54
  133. package/dist/wasm/memoryCap.js.map +0 -1
  134. package/dist/wasm/wasmBinary.d.ts +0 -25
  135. package/dist/wasm/wasmBinary.d.ts.map +0 -1
  136. package/dist/wasm/wasmBinary.js +0 -100
  137. package/dist/wasm/wasmBinary.js.map +0 -1
@@ -1,27 +1,40 @@
1
1
  /**
2
2
  * wasm/runner.ts — WasmRunner: owns the one dedicated `worker_threads`
3
- * Worker (worker.ts), the local-rules loader (loader.ts), and the
4
- * evaluate-all-rules union logic ported from
5
- * `packages/proxy/src/wasm/registry.rs`'s `evaluate_inner` (most-restrictive-
6
- * wins, short-circuit on a block, carry the first reask through).
3
+ * Worker (worker.ts), the local-rules loader (loader.ts), the workspace's
4
+ * control-plane rules (cloudRules.ts), and the evaluate-all-rules union logic
5
+ * ported from `packages/proxy/src/wasm/registry.rs`'s `evaluate_inner`
6
+ * (most-restrictive-wins, short-circuit on a block, carry the first reask
7
+ * through).
8
+ *
9
+ * Both sources run as one list in priority order, lower first; on a tie a
10
+ * control-plane rule runs before a local one, as in `registry.rs`. Local rules
11
+ * are `local:<file name>`; a control-plane rule keeps the control plane's id,
12
+ * the one the LLM proxy and the dashboard name it by. A control-plane rule in
13
+ * `SHADOW` mode is evaluated like any other and logged, and never decides the
14
+ * call — not even when it reaches no verdict.
7
15
  *
8
16
  * ## Divergences from the Rust runner (all recorded as TD entries)
9
17
  *
10
18
  * - **Fuel: the same 1,000,000-instruction budget, metered a different
11
- * way.** V8 has no fuel hook, so `fuel.ts` rewrites each rule at load to
12
- * count its own instructions and trap when the budget runs out (TD-440).
13
- * A rule that exhausts it fails open for that call, as under Wasmtime.
14
- * - **50ms per-rule deadline, not 5ms.** Fuel bounds the guest's own work;
15
- * the deadline is the backstop for everything else, and it races a
16
- * `postMessage` round trip that pays IPC overhead the in-process Wasmtime
17
- * call never did. 50ms, not 5ms, keeps that overhead from
18
- * false-positiving a legitimate rule under normal load.
19
+ * way.** V8 has no fuel hook, so `wasmFuel.ts` (shared-types) rewrites each rule at load to
20
+ * count its own instructions and trap when the budget runs out.
21
+ * A rule that exhausts it reaches no verdict, as under Wasmtime.
22
+ * - **The deadline is a backstop, not the limit.** Fuel is the limit: it is
23
+ * deterministic, so a rule within budget is never refused because the
24
+ * machine is busy. The deadline catches what fuel cannot see — a bulk
25
+ * `memory.fill` costs one instruction whatever its length, a host call
26
+ * costs none — and it races a `postMessage` round trip that the
27
+ * in-process Wasmtime call never pays. See {@link EVALUATE_TIMEOUT_MS}.
19
28
  * - **Guest memory ceiling: the same 16MB, enforced a different way.**
20
29
  * `runner.rs` sets a `StoreLimits` cap; V8 has no such hook, but it does
21
30
  * enforce the maximum a module declares, so `worker.ts` rewrites the
22
31
  * module's memory section to declare 16MB as its maximum before compiling
23
- * (`memoryCap.ts`). A `memory.grow` past it returns -1 as it would under
24
- * Wasmtime. Not a divergence any more; TD-440 records how it got here.
32
+ * (`wasmMemoryCap.ts`). A `memory.grow` past it returns -1 as it would under
33
+ * Wasmtime. Not a divergence any more.
34
+ * - **Rego rules (OPA builds) run through `@intutic/shared-types`' Rego
35
+ * host**, with their own instruction budget (`wasmFuel.ts`'s
36
+ * `REGO_FUEL_BUDGET`) and deadline (`REGO_EVALUATE_TIMEOUT_MS`), and
37
+ * reply with a decision instead of a verdict code — a hold has none.
25
38
  * - **`read_referenced_file` is served from a pre-read table**
26
39
  * (`referencedFiles.ts`, the port of `referenced_files.rs`), prefetched
27
40
  * once per `evaluate()` only when a loaded rule imports the function and
@@ -35,22 +48,39 @@ import { existsSync } from 'node:fs';
35
48
  import { fileURLToPath } from 'node:url';
36
49
  import { createStderrLogger as createLogger } from '../stderrLog.js';
37
50
  import { WasmLoader, resolveWasmDir } from './loader.js';
38
- import { buildWasmContext } from './context.js';
51
+ import { buildRegoInput, buildWasmContext } from './context.js';
39
52
  import { prefetch, resolveRoot, ReferencedFiles } from './referencedFiles.js';
40
53
  const log = createLogger('mcp-proxy-wasm-runner');
41
54
  /**
42
- * Per-rule evaluation deadline. See this module's doc comment for why this
43
- * is 50ms rather than `runner.rs`'s 5ms.
55
+ * A native rule's deadline: a backstop for stalls the instruction budget
56
+ * cannot see, set well above the time any rule within budget takes on a busy
57
+ * machine, because a rule that reaches no verdict refuses the call.
58
+ *
59
+ * Measured on a 14-core machine, idle and with 100 busy threads (about the
60
+ * oversubscription of a 4-vCPU CI runner running every package's suite): the
61
+ * 1,000,000-instruction budget runs out in at most 2 ms either way, and a
62
+ * worker round trip for a 60 KB context takes at most 0.5 ms idle and 3.9 ms
63
+ * loaded. The Rego round trip below shows the loaded machine also stalls a
64
+ * thread for hundreds of milliseconds, which is what one second covers.
44
65
  */
45
- const EVALUATE_TIMEOUT_MS = 50;
66
+ export const EVALUATE_TIMEOUT_MS = 1_000;
67
+ /**
68
+ * A Rego rule's deadline, on the same reasoning with the Rego budget
69
+ * (`REGO_FUEL_BUDGET`): the destructive-shell example on the largest input
70
+ * (64 KB) takes at most 6 ms idle and 430 ms loaded, round trip included, and
71
+ * a loop using up the whole budget takes up to 350 ms idle and 4.4 s loaded.
72
+ * Ten seconds is over twice that, so on a loaded machine the budget still
73
+ * stops a runaway rule first, and only a stall fuel cannot see waits this long.
74
+ */
75
+ export const REGO_EVALUATE_TIMEOUT_MS = 10_000;
46
76
  /** Generous — compilation is not guest-controlled per evaluation, but a
47
77
  * pathological file must not hang a rescan forever. */
48
78
  const COMPILE_TIMEOUT_MS = 3_000;
49
79
  /**
50
80
  * Consecutive per-rule runaways (a timeout, or the instruction budget running
51
- * out) before that rule is disabled until the next rescan.
81
+ * out) before that rule is quarantined until the next rescan.
52
82
  */
53
- const MAX_CONSECUTIVE_TIMEOUTS = 3;
83
+ export const MAX_CONSECUTIVE_RUNAWAYS = 3;
54
84
  /**
55
85
  * Resolves the worker script to spawn.
56
86
  *
@@ -85,22 +115,73 @@ function workerScriptSpec() {
85
115
  return { url, execArgv: isSource ? ['--import', 'tsx/esm'] : [] };
86
116
  }
87
117
  export class WasmRunner {
118
+ cloud;
88
119
  loader;
89
120
  worker = null;
90
121
  nextRequestId = 1;
91
122
  pending = new Map();
92
- consecutiveTimeouts = new Map();
93
- disabledRuleIds = new Set();
94
- constructor(dirOverride) {
123
+ consecutiveRunaways = new Map();
124
+ /** The worker replacing one that missed a deadline, while its rules recompile. */
125
+ respawning = null;
126
+ quarantined = new Set();
127
+ /**
128
+ * @param dirOverride - the local rules directory (see `resolveWasmDir`).
129
+ * @param cloud - the workspace's control-plane rules; absent where there is
130
+ * no control plane to fetch them from (tests, local-only use).
131
+ */
132
+ constructor(dirOverride, cloud) {
133
+ this.cloud = cloud;
95
134
  this.loader = new WasmLoader(resolveWasmDir(dirOverride));
96
135
  }
97
136
  /** The resolved local rules directory, for logging. */
98
137
  getDir() {
99
138
  return this.loader.getDir();
100
139
  }
101
- /** Currently loaded rule ids (`local:<file name>`), priority order — observability for callers/tests. */
140
+ /** Currently loaded rule ids, in evaluation order — observability for callers/tests. */
102
141
  getLoadedRuleIds() {
103
- return this.loader.getRules().map((r) => r.ruleId);
142
+ return this.activeRules().map((r) => r.ruleId);
143
+ }
144
+ /**
145
+ * Every loaded rule in evaluation order: by priority, and on a tie the
146
+ * control-plane rules first (a stable sort over cloud-then-local, as
147
+ * `registry.rs` sorts).
148
+ */
149
+ activeRules() {
150
+ const cloud = (this.cloud?.getRules() ?? []).map((r) => ({
151
+ ruleId: r.ruleId,
152
+ priority: r.priority,
153
+ rego: r.rego,
154
+ readsReferencedFiles: r.readsReferencedFiles,
155
+ shadow: r.mode === 'SHADOW',
156
+ }));
157
+ const local = this.loader.getRules().map((r) => ({
158
+ ruleId: r.ruleId,
159
+ priority: r.priority,
160
+ rego: r.rego,
161
+ readsReferencedFiles: r.readsReferencedFiles,
162
+ shadow: false,
163
+ }));
164
+ return [...cloud, ...local].sort((a, b) => a.priority - b.priority);
165
+ }
166
+ /**
167
+ * Brings the control-plane rules in line with the descriptors the policy
168
+ * carries. `undefined` — no policy from the control plane yet — leaves them
169
+ * as they are. See `CloudRuleSet.sync` for when this waits.
170
+ */
171
+ async syncCloudRules(descriptors) {
172
+ if (!this.cloud || !descriptors)
173
+ return;
174
+ await this.respawning;
175
+ await this.cloud.sync(descriptors, this);
176
+ }
177
+ /**
178
+ * Whether the workspace's control-plane rules are known: a descriptor list
179
+ * has been applied (or this runner has no control plane to ask). Until then,
180
+ * a call is judged without them, which the interceptor allows only under
181
+ * the fail-open setting.
182
+ */
183
+ cloudRulesLoaded() {
184
+ return !this.cloud || this.cloud.isLoaded();
104
185
  }
105
186
  ensureWorker() {
106
187
  if (this.worker)
@@ -145,33 +226,53 @@ export class WasmRunner {
145
226
  const id = this.allocId();
146
227
  const reply = await this.send({ type: 'compile', id, ruleId, bytes: toArrayBuffer(bytes) }, COMPILE_TIMEOUT_MS);
147
228
  if (!reply)
148
- return { ok: false, error: `compile timed out after ${COMPILE_TIMEOUT_MS}ms` };
229
+ return { ok: false, reason: 'load_error', error: `compile timed out after ${COMPILE_TIMEOUT_MS}ms` };
149
230
  if (!reply.ok) {
150
231
  const fallback = reply.unsupportedImports && reply.unsupportedImports.length > 0
151
232
  ? `imports ${reply.unsupportedImports.join(', ')}, which this proxy does not provide`
152
233
  : 'unknown compile error';
153
- return { ok: false, error: reply.error ?? fallback, unsupportedImports: reply.unsupportedImports };
234
+ return {
235
+ ok: false,
236
+ reason: reply.reason ?? 'load_error',
237
+ error: reply.error ?? fallback,
238
+ unsupportedImports: reply.unsupportedImports,
239
+ };
154
240
  }
155
- return { ok: true, readsReferencedFiles: reply.readsReferencedFiles ?? false };
241
+ return { ok: true, readsReferencedFiles: reply.readsReferencedFiles ?? false, rego: reply.rego ?? false };
156
242
  }
157
243
  remove(ruleId) {
158
244
  this.ensureWorker().postMessage({ type: 'remove', ruleId });
159
- this.consecutiveTimeouts.delete(ruleId);
160
- this.disabledRuleIds.delete(ruleId);
245
+ this.replaced(ruleId);
246
+ }
247
+ /** A control-plane rule's version changed: the old version's runaways do not count against the new one. */
248
+ replaced(ruleId) {
249
+ this.consecutiveRunaways.delete(ruleId);
250
+ this.quarantined.delete(ruleId);
161
251
  }
162
252
  // ── Rescan (driven by the existing policy-tick timer — see policy.ts) ──
163
253
  /**
164
254
  * Rescans `~/.intutic/wasm/` and (re)compiles anything changed. Also
165
- * clears every rule's disabled-by-timeout status — "disable that rule
166
- * until the next policy-driven rescan" is this call.
255
+ * releases every quarantined rule — "quarantined until the next
256
+ * policy-driven rescan" is this call.
167
257
  */
168
258
  async rescan() {
259
+ await this.respawning;
169
260
  await this.loader.rescan(this);
170
- this.disabledRuleIds.clear();
171
- this.consecutiveTimeouts.clear();
261
+ this.quarantined.clear();
262
+ this.consecutiveRunaways.clear();
172
263
  }
173
- /** Terminates the worker and respawns a fresh one, resending every currently-loaded rule's bytes so its module cache is rebuilt. */
174
- async respawnWorker() {
264
+ /**
265
+ * Replaces the worker, resending every currently-loaded rule's bytes so the
266
+ * new one's module cache is rebuilt, without waiting for the old one to stop.
267
+ *
268
+ * `Worker.terminate()` can take seconds: V8 stops a guest only at an
269
+ * interrupt check, and a loop around a bulk `memory.fill` reaches one
270
+ * rarely — measured, 1.5 s on an idle machine and 16 s on a loaded one. The
271
+ * call that missed its deadline is refused at the deadline; the old worker
272
+ * stops whenever V8 gets to it, and the next evaluation waits only for the
273
+ * new worker's recompile (`respawning`, about 50 ms for three Rego rules).
274
+ */
275
+ respawnWorker() {
175
276
  const old = this.worker;
176
277
  this.worker = null;
177
278
  if (old) {
@@ -182,34 +283,117 @@ export class WasmRunner {
182
283
  entry.resolve({ ok: false, error: 'worker terminated' });
183
284
  this.pending.delete(id);
184
285
  }
185
- await old.terminate();
286
+ old.terminate().catch((err) => {
287
+ log.warn({ action: 'wasm_worker_terminate_error', err: err.message }, 'WASM worker did not terminate cleanly');
288
+ });
186
289
  }
187
290
  // Force-reload every currently-known file into the new worker — its
188
291
  // module cache started empty. `force: true` mirrors this loader's own
189
- // "worker cache was lost, nothing on disk moved" case.
190
- await this.loader.rescan(this, true);
292
+ // "worker cache was lost, nothing on disk moved" case. The control-plane
293
+ // rules recompile from the bytes they were fetched with.
294
+ const respawning = Promise.all([this.loader.rescan(this, true), this.cloud?.reload(this)])
295
+ .then(() => undefined)
296
+ .finally(() => {
297
+ if (this.respawning === respawning)
298
+ this.respawning = null;
299
+ });
300
+ this.respawning = respawning;
191
301
  }
192
302
  // ── Evaluation ───────────────────────────────────────────────────────
193
303
  /**
194
- * Evaluates every currently loaded, non-disabled rule (priority order)
195
- * against one context, mirroring `registry.rs`'s `evaluate_inner`:
196
- * short-circuit on the first block, carry the first reask through in case
197
- * a later, higher-priority rule still blocks, `allow` when nothing fired
198
- * or every loaded rule was fail-open (timeout/trap/unmapped code).
304
+ * Evaluates every currently loaded rule (priority order) against one
305
+ * context, as `registry.rs`'s `evaluate_inner` does: short-circuit on the
306
+ * first block, carry the first hold and reask through in case a later rule
307
+ * still blocks, `allow` when nothing fired.
308
+ *
309
+ * A rule that reaches no verdict — its deadline, its instruction budget, a
310
+ * trap or other error, or a result that is not a verdict — refuses the call
311
+ * (`unavailable`), whatever `mcpProxyFailBehavior` or
312
+ * `INTUTIC_MCP_FAIL_OPEN` say. That setting exists for control-plane
313
+ * outages, which an agent cannot cause; a rule's timeout an agent can cause
314
+ * by padding its input, so it must never become an allow. The refusal
315
+ * outranks a hold and a reask, since neither an approval nor a retry can
316
+ * clear a call a rule never judged; a later rule's block still wins,
317
+ * because it says what is wrong with the call.
318
+ *
319
+ * A quarantined rule (see {@link countRunaway}) refuses at once, without
320
+ * anything being evaluated, until the next rescan.
321
+ *
322
+ * A `SHADOW` rule is evaluated in its place and decides nothing: what it
323
+ * would have done, a refusal for reaching no verdict included, leaves the
324
+ * call as the other rules decide it. Each evaluation is appended to
325
+ * `shadowOut`, the evidence promotion out of shadow is judged on, and a
326
+ * would-act is logged. A quarantined one is skipped, and reported as
327
+ * nothing, since nothing ran.
199
328
  */
200
- async evaluate(input) {
201
- const rules = this.loader.getRules().filter((r) => !this.disabledRuleIds.has(r.ruleId));
329
+ async evaluate(input, shadowOut) {
330
+ const rules = this.activeRules();
331
+ const held = rules.find((r) => !r.shadow && this.quarantined.has(r.ruleId));
332
+ if (held) {
333
+ return {
334
+ code: 'unavailable',
335
+ stop: 'quarantined',
336
+ ruleId: held.ruleId,
337
+ reason: noVerdictReason(held.ruleId, 'quarantined', `it is quarantined after ${MAX_CONSECUTIVE_RUNAWAYS} runaway evaluations in a row (deadline or budget), until the next rescan`),
338
+ };
339
+ }
202
340
  if (rules.length === 0)
203
341
  return { code: 'allow' };
204
- const contextBytes = Buffer.from(JSON.stringify(buildWasmContext(input)));
342
+ // Each built once, and only if a rule of that kind is loaded.
343
+ let contextBytes;
344
+ let regoBytes;
345
+ const bytesFor = (rego) => rego
346
+ ? (regoBytes ??= Buffer.from(buildRegoInput(input)))
347
+ : (contextBytes ??= Buffer.from(JSON.stringify(buildWasmContext(input))));
205
348
  let pendingReask = null;
349
+ let pendingHold = null;
350
+ let unavailable = null;
206
351
  // Read once per evaluation, before any rule runs, so the per-rule
207
352
  // deadline covers guest execution only — and only when a rule will ask.
208
353
  const files = rules.some((r) => r.readsReferencedFiles) ? await this.prefetchReferencedFiles(input) : undefined;
209
354
  for (const rule of rules) {
210
- const result = await this.evaluateOne(rule.ruleId, contextBytes, rule.readsReferencedFiles ? files : undefined);
211
- if (result === null)
212
- continue; // fail-open ALLOW for this rule (timeout, trap, or worker error)
355
+ if (rule.shadow && this.quarantined.has(rule.ruleId))
356
+ continue;
357
+ const outcome = await this.evaluateOne(rule.ruleId, bytesFor(rule.rego), rule.rego ? REGO_EVALUATE_TIMEOUT_MS : EVALUATE_TIMEOUT_MS, rule.readsReferencedFiles ? files : undefined);
358
+ const failure = 'stop' in outcome ? outcome : undefinedVerdict(outcome);
359
+ if (rule.shadow) {
360
+ // A rule that reached no verdict would have refused the call, so it
361
+ // counts as acting, as the LLM proxy counts its `Unavailable`.
362
+ const wouldDo = failure ? `no verdict (${failure.stop}): ${failure.detail}` : describeResult(outcome);
363
+ logShadow(rule.ruleId, wouldDo);
364
+ shadowOut?.push({ ruleId: rule.ruleId, wouldAct: wouldDo !== undefined });
365
+ continue;
366
+ }
367
+ if (failure) {
368
+ const quarantinedNow = this.quarantined.has(rule.ruleId);
369
+ const detail = quarantinedNow
370
+ ? `${failure.detail}; it is now quarantined until the next rescan, after ${MAX_CONSECUTIVE_RUNAWAYS} runaway evaluations in a row`
371
+ : failure.detail;
372
+ log.warn({ action: 'wasm_rule_no_verdict', ruleId: rule.ruleId, stop: failure.stop }, `WASM rule reached no verdict: ${detail} — refusing`);
373
+ if (!unavailable) {
374
+ unavailable = {
375
+ code: 'unavailable',
376
+ stop: failure.stop,
377
+ ruleId: rule.ruleId,
378
+ reason: noVerdictReason(rule.ruleId, failure.stop, detail),
379
+ };
380
+ }
381
+ continue;
382
+ }
383
+ const result = outcome;
384
+ if ('decision' in result) {
385
+ // A Rego rule. Same ordering as the native codes below: a block ends
386
+ // it, and a hold waits for a person, so it outranks a reask.
387
+ const reason = result.reason ?? 'Refused by Rego policy';
388
+ if (result.decision === 'deny')
389
+ return { code: 'block', reason, ruleId: rule.ruleId };
390
+ if (result.decision === 'hold' && !pendingHold) {
391
+ pendingHold = { code: 'hold', reason, ruleId: rule.ruleId, ...(result.riskTier ? { riskTier: result.riskTier } : {}) };
392
+ }
393
+ if (result.decision === 'reask' && !pendingReask)
394
+ pendingReask = { code: 'reask', reason, ruleId: rule.ruleId };
395
+ continue;
396
+ }
213
397
  switch (result.code) {
214
398
  case 0:
215
399
  break; // Bypass — try the next rule
@@ -235,15 +419,12 @@ export class WasmRunner {
235
419
  };
236
420
  }
237
421
  break;
238
- default:
239
- log.warn({ action: 'wasm_unmapped_verdict', ruleId: rule.ruleId, code: result.code }, 'WASM rule returned an unmapped verdict code; allowing. Valid codes are 0 (allow), 1 (block), 3 (reask).');
240
- break;
241
422
  }
242
423
  }
243
- return pendingReask ?? { code: 'allow' };
424
+ return unavailable ?? pendingHold ?? pendingReask ?? { code: 'allow' };
244
425
  }
245
426
  /**
246
- * The referenced-files table for this evaluation (TD-441). With no
427
+ * The referenced-files table for this evaluation. With no
247
428
  * `INTUTIC_WASM_MANIFEST_ROOT` the table is empty and every read refuses.
248
429
  */
249
430
  async prefetchReferencedFiles(input) {
@@ -256,48 +437,57 @@ export class WasmRunner {
256
437
  }
257
438
  return files.toTable();
258
439
  }
259
- /** One rule's evaluation, raced against `EVALUATE_TIMEOUT_MS`. `null` means fail-open (timeout, worker error, or guest trap). */
260
- async evaluateOne(ruleId, contextBytes, files) {
440
+ /** One rule's evaluation, raced against its deadline: its answer, or why it reached none. */
441
+ async evaluateOne(ruleId, contextBytes, timeoutMs, files) {
442
+ // A worker replaced after a missed deadline has its rules only once they
443
+ // recompile; an evaluation sent before then would find none.
444
+ await this.respawning;
261
445
  const id = this.allocId();
262
- const reply = await this.send({ type: 'evaluate', id, ruleId, bytes: toArrayBuffer(contextBytes), ...(files ? { files } : {}) }, EVALUATE_TIMEOUT_MS);
446
+ const reply = await this.send({ type: 'evaluate', id, ruleId, bytes: toArrayBuffer(contextBytes), ...(files ? { files } : {}) }, timeoutMs);
263
447
  if (reply === null) {
264
- // Timed out. Mirrors `runner.rs`'s `Err(_) => Bypass` — this call
265
- // fails open — plus the MCP-specific per-rule consecutive-timeout
266
- // disable ladder the task calls for.
267
- log.warn({ action: 'wasm_evaluate_timeout', ruleId, timeoutMs: EVALUATE_TIMEOUT_MS }, 'WASM rule evaluation timed out — failing open');
268
- // terminate + lazily respawn: the NEXT evaluate() call pays the
269
- // respawn cost via ensureWorker()/rescan(force); triggered here so a
270
- // wedged worker does not keep timing out every rule behind it in this
271
- // same evaluate() loop.
272
- await this.respawnWorker();
448
+ // Timed out: `runner.rs`'s deadline, plus this proxy's quarantine. The
449
+ // worker is replaced so a wedged one does not time out every rule
450
+ // behind it; this call does not wait for that (see respawnWorker).
451
+ this.respawnWorker();
273
452
  this.countRunaway(ruleId);
274
- return null;
453
+ return { stop: 'deadline', detail: `it ran past its ${timeoutMs} ms deadline` };
275
454
  }
276
455
  if (!reply.ok && reply.fuelExhausted) {
277
456
  // The budget trapped the guest, so the worker is healthy: no respawn,
278
- // but the same disable ladder as a timeout, since it is the same
457
+ // but the same quarantine count as a timeout, since it is the same
279
458
  // runaway rule caught sooner.
280
- log.warn({ action: 'wasm_evaluate_fuel_exhausted', ruleId }, 'WASM rule ran out of its instruction budget — failing open');
281
459
  this.countRunaway(ruleId);
282
- return null;
460
+ return { stop: 'budget', detail: 'it used up its instruction budget' };
283
461
  }
284
462
  if (!reply.ok) {
285
- // Worker-reported failure: a guest trap (including one following an
286
- // `abort` call) or an internal error. Fail-open ALLOW for this call,
287
- // never a crash — matches the task's explicit instruction.
288
- log.warn({ action: 'wasm_evaluate_error', ruleId, err: reply.error }, 'WASM rule evaluation failed — failing open');
289
- return null;
463
+ // A guest trap (including one following an `abort` call), a result
464
+ // that is not a decision, or an internal error — never a crash.
465
+ return reply.notADecision
466
+ ? { stop: 'result', detail: reply.error ?? 'it returned a result that is not a decision' }
467
+ : { stop: 'error', detail: `it failed while running: ${reply.error ?? 'unknown error'}` };
468
+ }
469
+ // A clean reply resets this rule's runaway streak.
470
+ this.consecutiveRunaways.delete(ruleId);
471
+ if (reply.decision) {
472
+ return {
473
+ decision: reply.decision,
474
+ ...(reply.reason ? { reason: reply.reason } : {}),
475
+ ...(reply.riskTier ? { riskTier: reply.riskTier } : {}),
476
+ };
290
477
  }
291
- // A clean reply resets this rule's timeout streak.
292
- this.consecutiveTimeouts.delete(ruleId);
293
478
  return { code: reply.code ?? -1, reason: reply.reason };
294
479
  }
480
+ /**
481
+ * Counts one runaway (deadline or budget) against `ruleId`, quarantining
482
+ * the rule at {@link MAX_CONSECUTIVE_RUNAWAYS} in a row. Logged once, at the
483
+ * transition; what a quarantined rule means for a call is `evaluate`'s.
484
+ */
295
485
  countRunaway(ruleId) {
296
- const attempts = (this.consecutiveTimeouts.get(ruleId) ?? 0) + 1;
297
- this.consecutiveTimeouts.set(ruleId, attempts);
298
- if (attempts >= MAX_CONSECUTIVE_TIMEOUTS) {
299
- this.disabledRuleIds.add(ruleId);
300
- log.warn({ action: 'wasm_rule_disabled', ruleId, consecutiveRunaways: attempts }, 'WASM rule disabled after consecutive timeouts or budget exhaustion — will retry on the next policy-driven rescan');
486
+ const runaways = (this.consecutiveRunaways.get(ruleId) ?? 0) + 1;
487
+ this.consecutiveRunaways.set(ruleId, runaways);
488
+ if (runaways >= MAX_CONSECUTIVE_RUNAWAYS && !this.quarantined.has(ruleId)) {
489
+ this.quarantined.add(ruleId);
490
+ log.warn({ action: 'wasm_rule_quarantined', ruleId, consecutiveRunaways: runaways }, 'WASM rule quarantined after consecutive timeouts or budget exhaustion — retried on the next policy-driven rescan');
301
491
  }
302
492
  }
303
493
  /** Terminates the worker. Safe to call even if one was never spawned. */
@@ -313,6 +503,31 @@ export class WasmRunner {
313
503
  await worker.terminate();
314
504
  }
315
505
  }
506
+ /** What a rule's answer would do to the call, for the shadow log; `undefined` when it allows. */
507
+ function describeResult(result) {
508
+ if ('decision' in result)
509
+ return result.decision === 'allow' ? undefined : result.decision;
510
+ if (result.code === 0)
511
+ return undefined;
512
+ return result.code === 3 ? 'reask' : 'block';
513
+ }
514
+ /** A shadowed rule's outcome, logged when it would have acted. */
515
+ function logShadow(ruleId, wouldDo) {
516
+ if (wouldDo === undefined)
517
+ return;
518
+ log.info({ action: 'wasm_shadow_would_act', ruleId, shadowed: true, verdict: wouldDo }, 'WASM rule would have acted; shadow mode, call unchanged');
519
+ }
520
+ /** A native code that is not a verdict: the rule reached none. */
521
+ function undefinedVerdict(result) {
522
+ if ('decision' in result || [0, 1, 2, 3].includes(result.code))
523
+ return null;
524
+ return { stop: 'result', detail: `it returned ${result.code}, which is not a verdict code (0 allow, 1 block, 3 reask)` };
525
+ }
526
+ /** The refusal an agent reads when a rule reached no verdict: which rule, and why. */
527
+ function noVerdictReason(ruleId, stop, detail) {
528
+ return (`Custom rule ${ruleId} reached no verdict (${stop}): ${detail}. Tool call blocked: a ` +
529
+ `rule that cannot decide never allows.`);
530
+ }
316
531
  function toArrayBuffer(bytes) {
317
532
  // Structured-clone (postMessage) needs an ArrayBuffer, not a Node Buffer
318
533
  // view that may share a larger underlying pool — slice guarantees the
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/wasm/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,kBAAkB,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,cAAc,EAA2C,MAAM,aAAa,CAAA;AACjG,OAAO,EAAE,gBAAgB,EAAyB,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAA6B,MAAM,sBAAsB,CAAA;AAExG,MAAM,GAAG,GAAG,YAAY,CAAC,uBAAuB,CAAC,CAAA;AAEjD;;;GAGG;AACH,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAE9B;wDACwD;AACxD,MAAM,kBAAkB,GAAG,KAAK,CAAA;AAEhC;;;GAGG;AACH,MAAM,wBAAwB,GAAG,CAAC,CAAA;AAYlC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAS,gBAAgB;IACvB,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,C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,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAC3E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,MAAM,CAAC,IAAI,2DAA2D,EAAE,CAAA;AAC1H,CAAC;AAED,sFAAsF;AACtF,SAAS,eAAe,CAAC,MAAc,EAAE,IAAc,EAAE,MAAc;IACrE,OAAO,CACL,eAAe,MAAM,wBAAwB,IAAI,MAAM,MAAM,yBAAyB;QACtF,uCAAuC,CACxC,CAAA;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAiB;IACtC,yEAAyE;IACzE,sEAAsE;IACtE,+DAA+D;IAC/D,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAgB,CAAA;AACjG,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Watch the local rules directory and call back, debounced, when a `.wasm`
3
- * file appears, changes or goes away (TD-442).
3
+ * file appears, changes or goes away.
4
4
  *
5
5
  * The rescan rides the 60-second policy tick (`policy.ts` `start(onTick)`)
6
6
  * and no second timer was wanted. A filesystem watcher is not a timer: it
@@ -10,23 +10,27 @@
10
10
  * happen to share a rule.
11
11
  *
12
12
  * Protocol (see `runner.ts` for the main-thread side):
13
- * compile { type:'compile', id, ruleId, bytes } -> { type:'compile-result', id, ruleId, ok, unsupportedImports?, readsReferencedFiles?, error? }
13
+ * compile { type:'compile', id, ruleId, bytes } -> { type:'compile-result', id, ruleId, ok, reason?, unsupportedImports?, readsReferencedFiles?, rego?, error? }
14
14
  * remove { type:'remove', ruleId } (no reply)
15
- * evaluate { type:'evaluate', id, ruleId, bytes, files? } -> { type:'evaluate-result', id, ruleId, ok, code?, reason?, error? }
15
+ * evaluate { type:'evaluate', id, ruleId, bytes, files? } -> { type:'evaluate-result', id, ruleId, ok, code?, decision?, reason?, riskTier?, error?, fuelExhausted?, notADecision? }
16
16
  *
17
- * `files` is the per-evaluation referenced-files table (TD-441), posted only
17
+ * A Rego rule (an OPA build, `@intutic/shared-types`' Rego host) is compiled
18
+ * and evaluated here too; its `evaluate` bytes are the Rego input document and
19
+ * its reply carries `decision` instead of `code`.
20
+ *
21
+ * `files` is the per-evaluation referenced-files table, posted only
18
22
  * to a rule that imports `read_referenced_file`; it is rebuilt here into the
19
23
  * host-import state, so the main thread never shares memory with the guest.
20
24
  *
21
25
  * A guest `abort` call is inert (hostImports.ts logs and returns); an
22
26
  * uncaught exception or trap during instantiation/evaluation is caught here
23
- * and reported as `ok:false` — the caller (runner.ts) treats that as
24
- * fail-open ALLOW, exactly like a timeout, never a crash.
27
+ * and reported as `ok:false` — the caller (runner.ts) treats that as a rule
28
+ * that reached no verdict, exactly like a timeout, never a crash.
25
29
  *
26
30
  * @module
27
31
  */
28
32
  /**
29
- * Guest memory ceiling, `runner.rs`'s 16MB `StoreLimits` (TD-440). Enforced at
33
+ * Guest memory ceiling, `runner.rs`'s 16MB `StoreLimits`. Enforced at
30
34
  * load by `capDeclaredMemory`: the module's own memory is rewritten to declare
31
35
  * this as its maximum, so V8 refuses any `memory.grow` past it (the call
32
36
  * returns -1) instead of growing. A module whose initial size is already over
@@ -1 +1 @@
1
- {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/wasm/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AASH;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,QAAmB,CAAA"}
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/wasm/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAyBH;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,QAAmB,CAAA"}