@intutic/gate 1.10.1

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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +261 -0
  3. package/dist/actions.d.ts +86 -0
  4. package/dist/actions.d.ts.map +1 -0
  5. package/dist/actions.js +239 -0
  6. package/dist/actions.js.map +1 -0
  7. package/dist/client.d.ts +94 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/client.js +207 -0
  10. package/dist/client.js.map +1 -0
  11. package/dist/dsh.d.ts +162 -0
  12. package/dist/dsh.d.ts.map +1 -0
  13. package/dist/dsh.js +189 -0
  14. package/dist/dsh.js.map +1 -0
  15. package/dist/errors.d.ts +41 -0
  16. package/dist/errors.d.ts.map +1 -0
  17. package/dist/errors.js +53 -0
  18. package/dist/errors.js.map +1 -0
  19. package/dist/eve.d.ts +425 -0
  20. package/dist/eve.d.ts.map +1 -0
  21. package/dist/eve.js +378 -0
  22. package/dist/eve.js.map +1 -0
  23. package/dist/gate.d.ts +113 -0
  24. package/dist/gate.d.ts.map +1 -0
  25. package/dist/gate.js +274 -0
  26. package/dist/gate.js.map +1 -0
  27. package/dist/harness.d.ts +482 -0
  28. package/dist/harness.d.ts.map +1 -0
  29. package/dist/harness.js +504 -0
  30. package/dist/harness.js.map +1 -0
  31. package/dist/headers.d.ts +26 -0
  32. package/dist/headers.d.ts.map +1 -0
  33. package/dist/headers.js +30 -0
  34. package/dist/headers.js.map +1 -0
  35. package/dist/imagecheck.d.ts +93 -0
  36. package/dist/imagecheck.d.ts.map +1 -0
  37. package/dist/imagecheck.js +286 -0
  38. package/dist/imagecheck.js.map +1 -0
  39. package/dist/index.d.ts +26 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +19 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/managedAgents.d.ts +375 -0
  44. package/dist/managedAgents.d.ts.map +1 -0
  45. package/dist/managedAgents.js +446 -0
  46. package/dist/managedAgents.js.map +1 -0
  47. package/dist/mastra.d.ts +175 -0
  48. package/dist/mastra.d.ts.map +1 -0
  49. package/dist/mastra.js +161 -0
  50. package/dist/mastra.js.map +1 -0
  51. package/dist/openai.d.ts +392 -0
  52. package/dist/openai.d.ts.map +1 -0
  53. package/dist/openai.js +658 -0
  54. package/dist/openai.js.map +1 -0
  55. package/dist/shlex.d.ts +16 -0
  56. package/dist/shlex.d.ts.map +1 -0
  57. package/dist/shlex.js +78 -0
  58. package/dist/shlex.js.map +1 -0
  59. package/dist/snapshot.d.ts +111 -0
  60. package/dist/snapshot.d.ts.map +1 -0
  61. package/dist/snapshot.js +243 -0
  62. package/dist/snapshot.js.map +1 -0
  63. package/dist/soprules.d.ts +88 -0
  64. package/dist/soprules.d.ts.map +1 -0
  65. package/dist/soprules.js +176 -0
  66. package/dist/soprules.js.map +1 -0
  67. package/dist/trueforge.d.ts +191 -0
  68. package/dist/trueforge.d.ts.map +1 -0
  69. package/dist/trueforge.js +184 -0
  70. package/dist/trueforge.js.map +1 -0
  71. package/dist/vercel.d.ts +174 -0
  72. package/dist/vercel.d.ts.map +1 -0
  73. package/dist/vercel.js +157 -0
  74. package/dist/vercel.js.map +1 -0
  75. package/dist/workflow.d.ts +209 -0
  76. package/dist/workflow.d.ts.map +1 -0
  77. package/dist/workflow.js +254 -0
  78. package/dist/workflow.js.map +1 -0
  79. package/dist/wrapTools.d.ts +68 -0
  80. package/dist/wrapTools.d.ts.map +1 -0
  81. package/dist/wrapTools.js +95 -0
  82. package/dist/wrapTools.js.map +1 -0
  83. package/package.json +123 -0
package/dist/dsh.js ADDED
@@ -0,0 +1,189 @@
1
+ /**
2
+ * dsh.ts — Cordis plugin adapter for DeepSeek's "dsh" harness.
3
+ *
4
+ * Published as the `@intutic/gate/dsh` subpath (see README.md's "Subpath
5
+ * convention for later phases"). `services/sync-daemon/src/harness/dshHooks.ts`
6
+ * merge-writes a row naming this module (`name: '@intutic/gate/dsh'`) into a
7
+ * dsh profile's `cordis.patch.yml`; dsh's own Cordis loader resolves that name
8
+ * with a plain dynamic `import()` and mounts the exported plugin
9
+ * (`{ name, inject, apply }`) the same way it mounts every other bundle row.
10
+ *
11
+ * ## The veto mechanism — CONFIRMED against a real install, not assumed
12
+ *
13
+ * dsh is a developer preview (`@deepseek-ai/dsh`, first published 2026-08-13)
14
+ * built on DeepSeek's own "Cordis" plugin framework (`@deepseek-ai/cordis`,
15
+ * `@deepseek-ai/dsh-tools`, `@deepseek-ai/dsh-app-boot`, ...). Both are public
16
+ * on the npm registry, and this module was authored against a real
17
+ * `npm pack`/inspection of them (see the TD entry this phase filed for exactly
18
+ * what was checked and what still had to be assumed) — NOT solely from the
19
+ * phase brief's prior guess, which named a different event (`agent/pre-step`)
20
+ * and a different decision shape (`{kind:'reject',...}`). Both turned out to
21
+ * be close but not exact:
22
+ *
23
+ * - The real per-tool veto point is `tools/pre-execute` (declared by
24
+ * `@deepseek-ai/dsh-tools`), not `agent/pre-step` (`@deepseek-ai/dsh-agent`'s
25
+ * per-turn/step event — a coarser boundary that batches a driver step
26
+ * rather than one tool call, and the wrong extension point for a
27
+ * per-tool-call gate).
28
+ * - It is a genuine Cordis `waterfall`: `(exec: ToolExecution, next: () =>
29
+ * Promise<PreToolDecision>) => Promise<PreToolDecision>`. Cordis's own
30
+ * waterfall contract (confirmed by reading `@deepseek-ai/cordis`'s
31
+ * `events.d.ts`) composes listeners around a `next()` continuation —
32
+ * "a listener that does not call next() vetoes the rest of the chain,
33
+ * including the built-in behavior" — so this listener calls `next()` on
34
+ * ALLOW (to preserve whatever later listener or built-in behaviour — e.g.
35
+ * dsh's own `ask`/approval flow — would otherwise run) and returns its own
36
+ * `{kind:'deny',...}` WITHOUT calling `next()` to veto.
37
+ * - The decision shape is `PreToolDecision = {kind:'allow'} | {kind:'deny',
38
+ * reason} | {kind:'ask', reason?}` (confirmed from
39
+ * `@deepseek-ai/dsh-tools`'s shipped `.d.ts`) — `'deny'`, not the phase
40
+ * brief's guessed `'reject'`.
41
+ *
42
+ * `ctx.tools.guard()` (a separate, monotonic, explicitly SYNCHRONOUS
43
+ * mechanism dsh also exposes) was considered and rejected: `@intutic/gate`'s
44
+ * `Gate.guard()` is async (network-backed SOP-rule fetch and `/hook-gate`
45
+ * POST — see gate.ts's module doc), and a synchronous `ToolGuard` cannot
46
+ * `await` it. `tools/pre-execute` is the only one of dsh's two extension
47
+ * points this package's async contract fits.
48
+ *
49
+ * ## What this module does NOT import
50
+ *
51
+ * Deliberately no dependency on `@deepseek-ai/cordis` or `@deepseek-ai/dsh-tools`
52
+ * at runtime — `CordisLikeContext`/`DshToolExecution`/`DshPreToolDecision`
53
+ * below are narrow structural types capturing only the shape this plugin
54
+ * actually touches, matching Cordis's own duck-typed plugin contract (a
55
+ * plain `{ name?, inject?, apply(ctx, config) }` object — confirmed against
56
+ * both `@deepseek-ai/cordis`'s README quick-start and dsh's own in-product
57
+ * "cordis-plugin-development" skill doc, which returns `{ apply(ctx) {...} }`
58
+ * with no import of anything). Adding a hard dependency on a fast-moving
59
+ * preview product's framework package to `@intutic/gate`'s dsh subpath would
60
+ * make every OTHER subpath's install pull it in too (or need a peerDependency
61
+ * carve-out) for a shape simple enough to describe locally. The real
62
+ * `@deepseek-ai/cordis` package is used only as a devDependency, in this
63
+ * module's own test file, to exercise the real waterfall dispatch mechanics
64
+ * against the genuine `Context` class rather than a hand-rolled stand-in.
65
+ *
66
+ * @module
67
+ */
68
+ import { randomUUID } from 'node:crypto';
69
+ import { Gate, install } from './gate.js';
70
+ import { GateClient } from './client.js';
71
+ import { IntuticGateRefusal } from './errors.js';
72
+ /** The Cordis Plugin id this module registers as. Shown in dsh's own plugin
73
+ * diagnostics/`--dump-config` output. */
74
+ export const PLUGIN_NAME = 'intutic-governance';
75
+ /** Cordis Plugins declare their hard dependencies here; the loader defers
76
+ * activation until every named service exists and reactivates on restart.
77
+ * `tools` is `@deepseek-ai/dsh-tools`'s `ToolRegistry` service — the thing
78
+ * that actually dispatches `tools/pre-execute`. */
79
+ export const inject = ['tools'];
80
+ /**
81
+ * Render a `tools/pre-execute` call's `arguments` as the `tool_input` object
82
+ * {@link Gate.guard} evaluates.
83
+ *
84
+ * Mirrors `wrapTools.ts`'s `renderToolInput` (not exported from there, so
85
+ * reimplemented rather than reached into a sibling module's internals): a
86
+ * plain object passes through as-is; anything else (a scalar, an array, or
87
+ * — per dsh's own doc — a value that failed to serialize) falls back to
88
+ * `{ args: [...] }` so the gate still has something to evaluate.
89
+ */
90
+ function renderDshToolInput(args) {
91
+ if (args !== null && typeof args === 'object' && !Array.isArray(args)) {
92
+ return args;
93
+ }
94
+ return { args: [args] };
95
+ }
96
+ /**
97
+ * One session id per dsh PROCESS, not per dsh conversation.
98
+ *
99
+ * `GateClient.fromEnv` throws without a session id (see client.ts — an unset
100
+ * `x-session-id` collapses every run onto one dashboard row at the proxy, so
101
+ * the client refuses to construct with none at all). dsh has no single
102
+ * "current session" this plugin can read at plugin-mount time — sessions are
103
+ * created and disposed while the process runs (`agent/session-start` et al.,
104
+ * per `@deepseek-ai/dsh-goal`'s shipped types) — so rather than leave Tier B
105
+ * (the control-plane `/hook-gate` call) and Tier A3 (SOP-rule fetch)
106
+ * permanently inactive for the whole process when `INTUTIC_SESSION_ID` is
107
+ * unset, this generates one random id at plugin-mount time and reuses it for
108
+ * every session the process handles for its lifetime. Coarser attribution
109
+ * than per-conversation, but strictly better than "those two tiers never run
110
+ * under dsh at all" — and Tier A1 (the local policy snapshot, the
111
+ * load-bearing tier) is unaffected either way; it needs no session id.
112
+ */
113
+ function resolveSessionId(config) {
114
+ return config.sessionId || process.env.INTUTIC_SESSION_ID || randomUUID();
115
+ }
116
+ /**
117
+ * Build the `tools/pre-execute` listener for a given {@link Gate}.
118
+ *
119
+ * Factored out of {@link apply} so a test can exercise the exact listener
120
+ * `apply()` registers — event extraction, the refusal-to-decision mapping,
121
+ * the fail-closed default, and the waterfall `next()`-calling on allow —
122
+ * against a controllable fake `Gate`, without needing a real dsh install or
123
+ * network access to construct a `GateClient`.
124
+ *
125
+ * Never throws: every path returns a {@link DshPreToolDecision}. A crash
126
+ * inside `gate.guard()` that is not an {@link IntuticGateRefusal} — a bug in
127
+ * this gate, or an unexpected throw from a tier it calls into — is treated
128
+ * as "cannot evaluate" and denied rather than allowed to escape the
129
+ * waterfall or fall through to an allow; see gate.ts's own module doc for why
130
+ * every tier in this package takes that direction on failure.
131
+ */
132
+ export function createPreExecuteListener(gate) {
133
+ return async (exec, next) => {
134
+ try {
135
+ await gate.guard(exec.name, renderDshToolInput(exec.arguments));
136
+ }
137
+ catch (err) {
138
+ if (err instanceof IntuticGateRefusal) {
139
+ return { kind: 'deny', reason: err.message };
140
+ }
141
+ const detail = err instanceof Error ? err.message : String(err);
142
+ return {
143
+ kind: 'deny',
144
+ reason: `[Intutic Governance] BLOCKED: gate crashed (${detail}) — failing closed rather than allowing an unevaluated call.`,
145
+ };
146
+ }
147
+ // Allow: call next() rather than returning {kind:'allow'} directly, so a
148
+ // later listener in the waterfall (including dsh's own built-in
149
+ // ask/approval behaviour) still runs — see the module doc's note on
150
+ // Cordis's waterfall semantics.
151
+ return next();
152
+ };
153
+ }
154
+ /**
155
+ * Mount the Intutic governance gate on a dsh profile.
156
+ *
157
+ * Builds one {@link Gate} for the lifetime of this plugin instance (not per
158
+ * call — Tier A1/A2/A3 all cache within a `Gate`, see gate.ts) and installs it
159
+ * as the process-wide default too (`install()`), so a hand-authored
160
+ * `wrapTool`/`wrapTools` call elsewhere in the same dsh process picks up the
161
+ * identical instance rather than constructing a second one with independent
162
+ * caches.
163
+ *
164
+ * Never throws out of `apply()` itself: a `GateClient.fromEnv` failure (e.g.
165
+ * credentials genuinely unreadable) degrades to a client-less `Gate` — Tier B
166
+ * and Tier A3 inactive, Tier A1/A2 (local, load-bearing) unaffected — rather
167
+ * than taking down the whole dsh profile boot over a governance layer that is
168
+ * additive by design.
169
+ */
170
+ export function apply(ctx, config = {}) {
171
+ let client;
172
+ try {
173
+ client = GateClient.fromEnv({ harness: 'dsh', sessionId: resolveSessionId(config) });
174
+ }
175
+ catch {
176
+ client = null;
177
+ }
178
+ const gate = new Gate(config, client);
179
+ install(gate);
180
+ ctx.on('tools/pre-execute', createPreExecuteListener(gate));
181
+ }
182
+ /** Default export — the whole Plugin object, for `name: '@intutic/gate/dsh'`
183
+ * cordis.patch.yml rows that resolve this module and pass it directly to
184
+ * `ctx.plugin()` (dsh's loader unwraps a default export the same way it
185
+ * unwraps a named one — see `dsh-app-boot`'s `unwrapExports`). Named exports
186
+ * (`apply`, `inject`, `PLUGIN_NAME`) are also available for a caller that
187
+ * imports this subpath directly rather than through the loader. */
188
+ export default { name: PLUGIN_NAME, inject, apply };
189
+ //# sourceMappingURL=dsh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dsh.js","sourceRoot":"","sources":["../src/dsh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD;0CAC0C;AAC1C,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAA;AAuC/C;;;oDAGoD;AACpD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,CAAA;AAE/B;;;;;;;;;GASG;AACH,SAAS,kBAAkB,CAAC,IAAa;IACvC,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACtE,OAAO,IAAiB,CAAA;IAC1B,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CAAA;AACzB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAS,gBAAgB,CAAC,MAAqB;IAC7C,OAAO,MAAM,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,UAAU,EAAE,CAAA;AAC3E,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAU;IAEV,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAC1B,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAA;QACjE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,kBAAkB,EAAE,CAAC;gBACtC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,CAAA;YAC9C,CAAC;YACD,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YAC/D,OAAO;gBACL,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,+CAA+C,MAAM,8DAA8D;aAC5H,CAAA;QACH,CAAC;QACD,yEAAyE;QACzE,gEAAgE;QAChE,oEAAoE;QACpE,gCAAgC;QAChC,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,KAAK,CAAC,GAAsB,EAAE,SAAwB,EAAE;IACtE,IAAI,MAAyB,CAAA;IAC7B,IAAI,CAAC;QACH,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACtF,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,IAAI,CAAA;IACf,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,OAAO,CAAC,IAAI,CAAC,CAAA;IAEb,GAAG,CAAC,EAAE,CAAC,mBAAmB,EAAE,wBAAwB,CAAC,IAAI,CAAC,CAAC,CAAA;AAC7D,CAAC;AAED;;;;;oEAKoE;AACpE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Error hierarchy for `@intutic/gate`.
3
+ *
4
+ * Port of `packages/intutic-clawde/intutic_clawde/errors.py` +
5
+ * `intutic_clawde/gate/gate.py`'s `IntuticGateRefusal`.
6
+ *
7
+ * `IntuticGateRefusal` is the load-bearing one: {@link Gate.guard} THROWS this
8
+ * on a refused call rather than returning a verdict object. That is the
9
+ * "JS-throw contract" already used elsewhere in this repo's gate vocabulary —
10
+ * see `services/sync-daemon/src/harness/gateBody.ts`'s emitted gates, which
11
+ * either `process.exit(2)` or write a `{cancel:true,...}` stdout envelope, and
12
+ * `packages/mcp-proxy/src/policy.ts`, which throws a `PolicyBlockedError` for
13
+ * the same reason: a tool call that must not run is an exceptional control
14
+ * flow event, not a value the caller might forget to check.
15
+ *
16
+ * `.message` is prefixed `[Intutic Governance] BLOCKED:` — the same family the
17
+ * Open WebUI filter and the Python SDK raise — so harnesses and log scrapers
18
+ * that already recognise that prefix recognise this refusal too.
19
+ */
20
+ /** Base class for every error this package throws. */
21
+ export declare class GateError extends Error {
22
+ constructor(message: string);
23
+ }
24
+ /** Thrown when the SDK cannot reach the Intutic control plane. */
25
+ export declare class GateConnectionError extends GateError {
26
+ constructor(message: string);
27
+ }
28
+ /**
29
+ * Raised when a tool call must not run.
30
+ *
31
+ * The structured fields (`reason`, `code`, `incidentId`) carry the
32
+ * machine-readable version of the refusal; `.message` carries the
33
+ * human-readable, prefix-recognisable one.
34
+ */
35
+ export declare class IntuticGateRefusal extends GateError {
36
+ readonly reason: string;
37
+ readonly code: string;
38
+ readonly incidentId: string | undefined;
39
+ constructor(reason: string, code: string, incidentId?: string);
40
+ }
41
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,sDAAsD;AACtD,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAED,kEAAkE;AAClE,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;GAMG;AACH,qBAAa,kBAAmB,SAAQ,SAAS;IAC/C,SAAgB,MAAM,EAAE,MAAM,CAAA;IAC9B,SAAgB,IAAI,EAAE,MAAM,CAAA;IAC5B,SAAgB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;gBAElC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAO9D"}
package/dist/errors.js ADDED
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Error hierarchy for `@intutic/gate`.
3
+ *
4
+ * Port of `packages/intutic-clawde/intutic_clawde/errors.py` +
5
+ * `intutic_clawde/gate/gate.py`'s `IntuticGateRefusal`.
6
+ *
7
+ * `IntuticGateRefusal` is the load-bearing one: {@link Gate.guard} THROWS this
8
+ * on a refused call rather than returning a verdict object. That is the
9
+ * "JS-throw contract" already used elsewhere in this repo's gate vocabulary —
10
+ * see `services/sync-daemon/src/harness/gateBody.ts`'s emitted gates, which
11
+ * either `process.exit(2)` or write a `{cancel:true,...}` stdout envelope, and
12
+ * `packages/mcp-proxy/src/policy.ts`, which throws a `PolicyBlockedError` for
13
+ * the same reason: a tool call that must not run is an exceptional control
14
+ * flow event, not a value the caller might forget to check.
15
+ *
16
+ * `.message` is prefixed `[Intutic Governance] BLOCKED:` — the same family the
17
+ * Open WebUI filter and the Python SDK raise — so harnesses and log scrapers
18
+ * that already recognise that prefix recognise this refusal too.
19
+ */
20
+ /** Base class for every error this package throws. */
21
+ export class GateError extends Error {
22
+ constructor(message) {
23
+ super(message);
24
+ this.name = 'GateError';
25
+ }
26
+ }
27
+ /** Thrown when the SDK cannot reach the Intutic control plane. */
28
+ export class GateConnectionError extends GateError {
29
+ constructor(message) {
30
+ super(message);
31
+ this.name = 'GateConnectionError';
32
+ }
33
+ }
34
+ /**
35
+ * Raised when a tool call must not run.
36
+ *
37
+ * The structured fields (`reason`, `code`, `incidentId`) carry the
38
+ * machine-readable version of the refusal; `.message` carries the
39
+ * human-readable, prefix-recognisable one.
40
+ */
41
+ export class IntuticGateRefusal extends GateError {
42
+ reason;
43
+ code;
44
+ incidentId;
45
+ constructor(reason, code, incidentId) {
46
+ super(`[Intutic Governance] BLOCKED: ${reason}`);
47
+ this.name = 'IntuticGateRefusal';
48
+ this.reason = reason;
49
+ this.code = code;
50
+ this.incidentId = incidentId;
51
+ }
52
+ }
53
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,sDAAsD;AACtD,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,WAAW,CAAA;IACzB,CAAC;CACF;AAED,kEAAkE;AAClE,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/B,MAAM,CAAQ;IACd,IAAI,CAAQ;IACZ,UAAU,CAAoB;IAE9C,YAAY,MAAc,EAAE,IAAY,EAAE,UAAmB;QAC3D,KAAK,CAAC,iCAAiC,MAAM,EAAE,CAAC,CAAA;QAChD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;CACF"}