@intutic/shared-types 2.3.0 → 2.5.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 (83) hide show
  1. package/README.md +1 -1
  2. package/dist/anomaly.d.ts +0 -19
  3. package/dist/anomaly.d.ts.map +1 -1
  4. package/dist/attenuation.d.ts +4 -3
  5. package/dist/attenuation.d.ts.map +1 -1
  6. package/dist/attenuation.js +4 -3
  7. package/dist/attenuation.js.map +1 -1
  8. package/dist/auth.d.ts +106 -0
  9. package/dist/auth.d.ts.map +1 -1
  10. package/dist/auth.js +17 -1
  11. package/dist/auth.js.map +1 -1
  12. package/dist/chaos.d.ts +2225 -0
  13. package/dist/chaos.d.ts.map +1 -0
  14. package/dist/chaos.js +358 -0
  15. package/dist/chaos.js.map +1 -0
  16. package/dist/chaosGate.d.ts +166 -0
  17. package/dist/chaosGate.d.ts.map +1 -0
  18. package/dist/chaosGate.js +383 -0
  19. package/dist/chaosGate.js.map +1 -0
  20. package/dist/cloudProbe.d.ts +54 -0
  21. package/dist/cloudProbe.d.ts.map +1 -0
  22. package/dist/cloudProbe.js +254 -0
  23. package/dist/cloudProbe.js.map +1 -0
  24. package/dist/enums.d.ts +48 -0
  25. package/dist/enums.d.ts.map +1 -1
  26. package/dist/enums.js +31 -3
  27. package/dist/enums.js.map +1 -1
  28. package/dist/finops.d.ts +38 -18
  29. package/dist/finops.d.ts.map +1 -1
  30. package/dist/guardrailIr.d.ts +4 -4
  31. package/dist/index.d.ts +18 -9
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +68 -9
  34. package/dist/index.js.map +1 -1
  35. package/dist/intelligence.d.ts +3 -100
  36. package/dist/intelligence.d.ts.map +1 -1
  37. package/dist/intelligence.js +3 -3
  38. package/dist/intelligence.js.map +1 -1
  39. package/dist/mcpBudgets.d.ts +32 -32
  40. package/dist/notifications.d.ts +17 -2
  41. package/dist/notifications.d.ts.map +1 -1
  42. package/dist/notifications.js +35 -5
  43. package/dist/notifications.js.map +1 -1
  44. package/dist/observability.d.ts +0 -31
  45. package/dist/observability.d.ts.map +1 -1
  46. package/dist/observability.js +0 -7
  47. package/dist/observability.js.map +1 -1
  48. package/dist/opaqueRefusal.d.ts +40 -0
  49. package/dist/opaqueRefusal.d.ts.map +1 -0
  50. package/dist/opaqueRefusal.js +53 -0
  51. package/dist/opaqueRefusal.js.map +1 -0
  52. package/dist/policyGuardrails.d.ts +5 -5
  53. package/dist/providerVerification.d.ts +35 -9
  54. package/dist/providerVerification.d.ts.map +1 -1
  55. package/dist/providerVerification.js +79 -19
  56. package/dist/providerVerification.js.map +1 -1
  57. package/dist/providers.d.ts +50 -13
  58. package/dist/providers.d.ts.map +1 -1
  59. package/dist/providers.js +131 -27
  60. package/dist/providers.js.map +1 -1
  61. package/dist/spendBudgets.d.ts +122 -0
  62. package/dist/spendBudgets.d.ts.map +1 -0
  63. package/dist/spendBudgets.js +92 -0
  64. package/dist/spendBudgets.js.map +1 -0
  65. package/dist/taskManagement.d.ts +34 -82
  66. package/dist/taskManagement.d.ts.map +1 -1
  67. package/dist/taskManagement.js +4 -4
  68. package/dist/toolPoison.d.ts +15 -2
  69. package/dist/toolPoison.d.ts.map +1 -1
  70. package/dist/toolPoison.js +14 -4
  71. package/dist/toolPoison.js.map +1 -1
  72. package/dist/upstreamRetry.d.ts +121 -0
  73. package/dist/upstreamRetry.d.ts.map +1 -0
  74. package/dist/upstreamRetry.js +90 -0
  75. package/dist/upstreamRetry.js.map +1 -0
  76. package/dist/wasmRuleDescriptor.d.ts +43 -0
  77. package/dist/wasmRuleDescriptor.d.ts.map +1 -0
  78. package/dist/wasmRuleDescriptor.js +65 -0
  79. package/dist/wasmRuleDescriptor.js.map +1 -0
  80. package/dist/workspaceSettings.d.ts +42 -4
  81. package/dist/workspaceSettings.d.ts.map +1 -1
  82. package/dist/workspaceSettings.js.map +1 -1
  83. package/package.json +2 -2
@@ -0,0 +1,383 @@
1
+ "use strict";
2
+ /**
3
+ * Fault injection in the gates: the part of a chaos run (`chaos.ts`) a hook
4
+ * gate or an in-process gate SDK carries.
5
+ *
6
+ * A hook gate is a new process per tool call, and parallel gates share one
7
+ * run, so nothing here keeps state in memory: the plan comes from {@link CHAOS_PLAN_ENV}-style text each call,
8
+ * and every count lives in files beside the events file.
9
+ *
10
+ * - `<events>.gate-plan-loaded` — created once, with an exclusive create; the
11
+ * gate that creates it reports `plan_loaded`, so separate gate processes do
12
+ * not repeat it.
13
+ * - `<events>.gate-counters/<fault index>.seen.<n>` and `.hit.<n>` — one
14
+ * empty file per matching call a fault saw and per call it hit. A call
15
+ * claims the next number with an exclusive create (`open` with `wx`,
16
+ * `O_CREAT | O_EXCL`), which the file system grants to exactly one process,
17
+ * so two gates deciding at once can never both take the same number; the
18
+ * claimed number is the call's 1-based index. A count is the number of
19
+ * files, read once to start the search, so a claim costs one directory
20
+ * read and usually one create. That is `FaultCounter`'s `after_calls` and
21
+ * `times` across processes.
22
+ * - `<events>.gate-counters/<fault index>.held.<key>.<g>` — a call a
23
+ * `permission.deny_or_delay` fault in `delay` or `hold_then_deny` mode
24
+ * held; its modification time is when. `<key>` is the call's digest (the
25
+ * tool and its input, as the gate keys an approval hold), `<g>` counts the
26
+ * holds of that call, claimed like a call number. `.released.<key>.<g>`,
27
+ * created with the same exclusive create, ends that hold: one retry, and
28
+ * only one, is the one the hold lets through or denies.
29
+ *
30
+ * A permission fault never makes a gate wait. It holds the call the way an
31
+ * approval hold does: the call is refused as held, and the identical retry
32
+ * (same tool, same input) is refused as held again until `delay_s` seconds
33
+ * have passed since the first refusal. After that the retry is allowed
34
+ * (`delay`) or denied (`hold_then_deny`), and the hold is over: the next
35
+ * identical call is a new matching call. A held call's retries are the same
36
+ * call, so no fault counts them as matching calls. A test moves the clock by
37
+ * moving the `held` files' modification times back.
38
+ *
39
+ * Only a call governance allowed counts: a fault never applies to a call the
40
+ * gate refused, held or asked about, so such a call is not one of the
41
+ * fault's matching calls either. Every fault whose `match` covers an allowed
42
+ * call counts it as seen; the first one in plan order that is due injects,
43
+ * and the faults after it do not spend a hit on the same call. A `tool.error`
44
+ * on an `mcp__<server>__<tool>` call is the MCP proxy's to inject, so a gate
45
+ * leaves it alone; `permission.deny_or_delay` is the gate's on any tool.
46
+ *
47
+ * The functions are self-contained on purpose — no imports, no module state —
48
+ * because the JavaScript hook gates emit them as source
49
+ * ({@link CHAOS_GATE_JS_SOURCE}) and run them outside this package, and
50
+ * `@intutic/gate` carries a byte-identical copy of this file
51
+ * (`packages/gate-js/src/chaosGate.ts`). The bash gates and
52
+ * `intutic_clawde.gate` run the Python transliteration,
53
+ * `intutic_clawde/gate/chaos.py`, which the sync daemon emits verbatim. All
54
+ * of them run `fixtures/chaos-gate-vectors.json`. File access goes through
55
+ * the `fs` argument (Node's `fs` in a gate).
56
+ *
57
+ * @module
58
+ */
59
+ Object.defineProperty(exports, "__esModule", { value: true });
60
+ exports.CHAOS_GATE_JS_SOURCE = void 0;
61
+ exports.chaosGateDecode = chaosGateDecode;
62
+ exports.chaosGateMatches = chaosGateMatches;
63
+ exports.chaosGateEvent = chaosGateEvent;
64
+ exports.chaosGateAppend = chaosGateAppend;
65
+ exports.chaosGateClaim = chaosGateClaim;
66
+ exports.chaosGateOpenHold = chaosGateOpenHold;
67
+ exports.chaosGateRelease = chaosGateRelease;
68
+ exports.chaosGateCall = chaosGateCall;
69
+ /**
70
+ * Decodes and checks a plan: base64url JSON, version 1, with valid values in
71
+ * every field a gate reads. Returns the plan, or why it is not one.
72
+ */
73
+ function chaosGateDecode(raw) {
74
+ const ids = [
75
+ 'llm.rate_limit', 'llm.upstream_5xx', 'llm.context_trim', 'llm.model_degrade', 'tool.error', 'tool.stale_data',
76
+ 'mcp.toolset_change', 'permission.deny_or_delay', 'inject.tool_result', 'egress.dns_fail', 'egress.credential_401',
77
+ ];
78
+ const invalid = (why) => ({ plan: null, error: 'INTUTIC_CHAOS_PLAN is not a valid plan: ' + why });
79
+ const isObject = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
80
+ const isInt = (v, min, max) => typeof v === 'number' && Number.isInteger(v) && v >= min && v <= max;
81
+ let json;
82
+ try {
83
+ if (typeof raw !== 'string' || !/^[A-Za-z0-9_-]+={0,2}$/.test(raw))
84
+ throw new Error('alphabet');
85
+ const b64 = raw.replace(/=+$/, '').replace(/-/g, '+').replace(/_/g, '/');
86
+ const binary = atob(b64 + '='.repeat((4 - (b64.length % 4)) % 4));
87
+ const bytes = new Uint8Array(binary.length);
88
+ for (let i = 0; i < binary.length; i++)
89
+ bytes[i] = binary.charCodeAt(i);
90
+ json = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes));
91
+ }
92
+ catch {
93
+ return { plan: null, error: 'INTUTIC_CHAOS_PLAN is not base64url-encoded JSON' };
94
+ }
95
+ if (!isObject(json))
96
+ return invalid('not a JSON object');
97
+ if (json.v !== 1)
98
+ return invalid('version ' + JSON.stringify(json.v) + ', and a gate reads only version 1');
99
+ if (typeof json.runId !== 'string' || !/^[A-Za-z0-9_-]{6,64}$/.test(json.runId))
100
+ return invalid('runId');
101
+ if (typeof json.canary !== 'string' || !/^E-INTUTIC-[0-9A-F]{4,16}$/.test(json.canary))
102
+ return invalid('canary');
103
+ if (!Array.isArray(json.faults) || json.faults.length > 50)
104
+ return invalid('faults');
105
+ const faults = [];
106
+ for (let i = 0; i < json.faults.length; i++) {
107
+ const f = json.faults[i];
108
+ const at = 'faults[' + i + ']';
109
+ if (!isObject(f) || typeof f.id !== 'string' || ids.indexOf(f.id) === -1)
110
+ return invalid(at + '.id');
111
+ if (f.id !== 'tool.error' && f.id !== 'permission.deny_or_delay')
112
+ continue;
113
+ let match = null;
114
+ if (f.match !== undefined) {
115
+ if (!isObject(f.match))
116
+ return invalid(at + '.match');
117
+ for (const k of Object.keys(f.match)) {
118
+ const v = f.match[k];
119
+ if ((k !== 'tool' && k !== 'host' && k !== 'model') || typeof v !== 'string' || v.length === 0) {
120
+ return invalid(at + '.match.' + k);
121
+ }
122
+ }
123
+ match = f.match;
124
+ }
125
+ if (f.after_calls !== undefined && !isInt(f.after_calls, 0, 10000))
126
+ return invalid(at + '.after_calls');
127
+ if (f.times !== undefined && !isInt(f.times, 1, 10000))
128
+ return invalid(at + '.times');
129
+ const fault = {
130
+ index: i,
131
+ id: f.id,
132
+ match: match,
133
+ afterCalls: f.after_calls === undefined ? 0 : f.after_calls,
134
+ times: f.times === undefined ? null : f.times,
135
+ message: 'tool failed',
136
+ mode: 'deny',
137
+ delayS: 0,
138
+ };
139
+ if (f.id === 'tool.error' && f.message !== undefined) {
140
+ if (typeof f.message !== 'string' || f.message.length < 1 || f.message.length > 2000)
141
+ return invalid(at + '.message');
142
+ fault.message = f.message;
143
+ }
144
+ if (f.id === 'permission.deny_or_delay') {
145
+ if (f.mode !== undefined) {
146
+ if (f.mode !== 'deny' && f.mode !== 'delay' && f.mode !== 'hold_then_deny')
147
+ return invalid(at + '.mode');
148
+ fault.mode = f.mode;
149
+ }
150
+ if (f.delay_s !== undefined) {
151
+ if (!isInt(f.delay_s, 0, 600))
152
+ return invalid(at + '.delay_s');
153
+ fault.delayS = f.delay_s;
154
+ }
155
+ }
156
+ faults.push(fault);
157
+ }
158
+ return { plan: { runId: json.runId, canary: json.canary, faults: faults }, error: null };
159
+ }
160
+ /**
161
+ * Whether a fault's `match` covers a gate call. A gate call has a tool and
162
+ * nothing else, so a fault that names a host or a model never matches one.
163
+ * `tool` matches exactly, or by suffix when it starts with `*`.
164
+ */
165
+ function chaosGateMatches(match, tool) {
166
+ if (!match)
167
+ return true;
168
+ if (match.host !== undefined || match.model !== undefined)
169
+ return false;
170
+ const p = match.tool;
171
+ if (p === undefined)
172
+ return true;
173
+ return p.charAt(0) === '*' ? tool.endsWith(p.slice(1)) : tool === p;
174
+ }
175
+ /** One events-file line: `ts`, `runId`, `component`, `type`, then the fields that are set. */
176
+ function chaosGateEvent(plan, type, fields, now) {
177
+ const event = { ts: now, runId: plan.runId, component: 'gate', type: type };
178
+ for (const k of Object.keys(fields))
179
+ if (fields[k] !== undefined && fields[k] !== null)
180
+ event[k] = fields[k];
181
+ return JSON.stringify(event) + '\n';
182
+ }
183
+ /** Appends whole lines in one write. An I/O error is reported, never thrown: it must not decide the call. */
184
+ function chaosGateAppend(fs, eventsPath, lines) {
185
+ try {
186
+ fs.appendFileSync(eventsPath, lines);
187
+ }
188
+ catch (e) {
189
+ try {
190
+ console.error('[Intutic Governance] chaos: could not append to ' + eventsPath + ': ' + String((e && e.message) || e));
191
+ }
192
+ catch {
193
+ /* stderr gone too */
194
+ }
195
+ }
196
+ }
197
+ /**
198
+ * Claims the next numbered file `<dir>/<prefix><n>` with an exclusive create
199
+ * and returns n, or 0 when every number up to `limit` is taken. -1 on an I/O
200
+ * error, after saying so.
201
+ */
202
+ function chaosGateClaim(fs, dir, prefix, limit) {
203
+ try {
204
+ // Beside the events file, never creating its directory: the runner did.
205
+ try {
206
+ fs.mkdirSync(dir);
207
+ }
208
+ catch (e) {
209
+ if (!e || e.code !== 'EEXIST')
210
+ throw e;
211
+ }
212
+ const names = fs.readdirSync(dir);
213
+ let n = 0;
214
+ for (let i = 0; i < names.length; i++)
215
+ if (names[i].indexOf(prefix) === 0)
216
+ n++;
217
+ for (n = n + 1; limit === null || n <= limit; n++) {
218
+ try {
219
+ fs.closeSync(fs.openSync(dir + '/' + prefix + n, 'wx'));
220
+ return n;
221
+ }
222
+ catch (e) {
223
+ if (!e || e.code !== 'EEXIST')
224
+ throw e;
225
+ }
226
+ }
227
+ return 0;
228
+ }
229
+ catch (e) {
230
+ try {
231
+ console.error('[Intutic Governance] chaos: could not count calls in ' + dir + ': ' + String((e && e.message) || e));
232
+ }
233
+ catch {
234
+ /* stderr gone too */
235
+ }
236
+ return -1;
237
+ }
238
+ }
239
+ /**
240
+ * The open hold of one fault on one call: the number of the newest
241
+ * `<fault>.held.<key>.<g>` file that has no `.released.` twin, and when it
242
+ * was created. Null when there is none or it cannot be read.
243
+ */
244
+ function chaosGateOpenHold(fs, dir, fault, key) {
245
+ try {
246
+ const held = fault + '.held.' + key + '.';
247
+ const names = fs.readdirSync(dir);
248
+ let g = 0;
249
+ for (let i = 0; i < names.length; i++) {
250
+ if (names[i].indexOf(held) !== 0)
251
+ continue;
252
+ const n = Number(names[i].slice(held.length));
253
+ if (n > g)
254
+ g = n;
255
+ }
256
+ if (g === 0 || names.indexOf(fault + '.released.' + key + '.' + g) !== -1)
257
+ return null;
258
+ // In whole milliseconds, as now is: a hold is never younger than the call that reads it.
259
+ return { g: g, sinceMs: Math.floor(fs.statSync(dir + '/' + held + g).mtimeMs) };
260
+ }
261
+ catch {
262
+ // No counters yet, or none readable: no hold to continue.
263
+ return null;
264
+ }
265
+ }
266
+ /** Ends hold g with an exclusive create: true for the one caller that does. */
267
+ function chaosGateRelease(fs, dir, fault, key, g) {
268
+ try {
269
+ fs.closeSync(fs.openSync(dir + '/' + fault + '.released.' + key + '.' + g, 'wx'));
270
+ return true;
271
+ }
272
+ catch {
273
+ // Another gate released it first, or it cannot be written.
274
+ return false;
275
+ }
276
+ }
277
+ /**
278
+ * Reports one call: `plan_loaded` the first time any gate reports to this
279
+ * events file, then `gate_decision`; for an allowed call, the fault that is
280
+ * due (`fault_injected`, once per held call however often it is retried),
281
+ * and `tool_call`: ok when the call goes ahead, not ok when it is held.
282
+ * Returns the fault the gate must apply, or null. `now` is the ISO-8601 time,
283
+ * and the clock a hold is timed by.
284
+ */
285
+ function chaosGateCall(fs, plan, eventsPath, call, now) {
286
+ let lines = '';
287
+ let first = true;
288
+ try {
289
+ fs.closeSync(fs.openSync(eventsPath + '.gate-plan-loaded', 'wx'));
290
+ }
291
+ catch (e) {
292
+ // Already reported. Any other error: report again rather than not at all.
293
+ if (e && e.code === 'EEXIST')
294
+ first = false;
295
+ }
296
+ if (first)
297
+ lines += chaosGateEvent(plan, 'plan_loaded', { faults: plan.faults.length }, now);
298
+ lines += chaosGateEvent(plan, 'gate_decision', {
299
+ tool: call.tool,
300
+ decision: call.decision,
301
+ ruleId: call.ruleId || null,
302
+ destructive: !!call.destructive,
303
+ policyHit: !!call.policyHit,
304
+ }, now);
305
+ let fault = null;
306
+ if (call.decision === 'allow') {
307
+ const dir = eventsPath + '.gate-counters';
308
+ const key = String(call.key || '').replace(/[^0-9A-Za-z]/g, '').slice(0, 128) || 'call';
309
+ let nowMs = Date.parse(now);
310
+ if (isNaN(nowMs))
311
+ nowMs = Date.now();
312
+ const tag = ' [' + plan.canary + ']';
313
+ const held = 'Permission held for approval; retrying this exact call passes once it is approved' + tag;
314
+ // The retry of a held call: still held until the delay has passed, then
315
+ // let through or denied by the one retry that releases it.
316
+ let retry = false;
317
+ for (let i = 0; i < plan.faults.length && !retry; i++) {
318
+ const f = plan.faults[i];
319
+ if (f.id !== 'permission.deny_or_delay' || f.mode === 'deny' || !chaosGateMatches(f.match, call.tool))
320
+ continue;
321
+ const open = chaosGateOpenHold(fs, dir, f.index, key);
322
+ if (!open)
323
+ continue;
324
+ retry = true;
325
+ if (f.delayS > 0 && nowMs - open.sinceMs < f.delayS * 1000) {
326
+ fault = { faultId: f.id, kind: 'hold', reason: held };
327
+ }
328
+ else if (chaosGateRelease(fs, dir, f.index, key, open.g)) {
329
+ if (f.mode === 'hold_then_deny') {
330
+ fault = { faultId: f.id, kind: 'deny', reason: 'Permission held for approval, then denied by approver' + tag };
331
+ }
332
+ }
333
+ else {
334
+ // Another gate released it first: this call is a new one.
335
+ retry = false;
336
+ }
337
+ }
338
+ for (let i = 0; i < plan.faults.length && !retry; i++) {
339
+ const f = plan.faults[i];
340
+ if (!chaosGateMatches(f.match, call.tool))
341
+ continue;
342
+ // An MCP tool's error is the MCP proxy's to inject; a gate injects the built-in side.
343
+ if (f.id === 'tool.error' && call.tool.indexOf('mcp__') === 0)
344
+ continue;
345
+ const seen = chaosGateClaim(fs, dir, f.index + '.seen.', null);
346
+ if (fault || seen < 1 || seen <= f.afterCalls)
347
+ continue;
348
+ if (f.times !== null && chaosGateClaim(fs, dir, f.index + '.hit.', f.times) < 1)
349
+ continue;
350
+ if (f.id === 'tool.error') {
351
+ fault = { faultId: f.id, kind: 'deny', reason: f.message + tag };
352
+ }
353
+ else if (f.mode === 'deny') {
354
+ fault = { faultId: f.id, kind: 'deny', reason: 'Permission denied by approver' + tag };
355
+ }
356
+ else {
357
+ // Held from now: the hold's file is what its retries find.
358
+ if (chaosGateClaim(fs, dir, f.index + '.held.' + key + '.', null) < 1)
359
+ continue;
360
+ fault = { faultId: f.id, kind: 'hold', reason: held };
361
+ }
362
+ lines += chaosGateEvent(plan, 'fault_injected', { faultId: f.id, call: seen, target: call.tool }, now);
363
+ }
364
+ if (!fault || fault.kind === 'hold')
365
+ lines += chaosGateEvent(plan, 'tool_call', { tool: call.tool, ok: !fault }, now);
366
+ }
367
+ chaosGateAppend(fs, eventsPath, lines);
368
+ return fault;
369
+ }
370
+ /** Every function above as JavaScript source, for a hook gate to emit. */
371
+ exports.CHAOS_GATE_JS_SOURCE = [
372
+ chaosGateDecode,
373
+ chaosGateMatches,
374
+ chaosGateEvent,
375
+ chaosGateAppend,
376
+ chaosGateClaim,
377
+ chaosGateOpenHold,
378
+ chaosGateRelease,
379
+ chaosGateCall,
380
+ ]
381
+ .map((f) => f.toString())
382
+ .join('\n');
383
+ //# sourceMappingURL=chaosGate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chaosGate.js","sourceRoot":"","sources":["../src/chaosGate.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;;;AAgEH,0CAuEC;AAOD,4CAMC;AAGD,wCAIC;AAGD,0CAUC;AAOD,wCA4BC;AAOD,8CAiBC;AAGD,4CAQC;AAUD,sCA+EC;AA3QD;;;GAGG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,MAAM,GAAG,GAAG;QACV,gBAAgB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,YAAY,EAAE,iBAAiB;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f,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;CACd;KACE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;KACxB,IAAI,CAAC,IAAI,CAAC,CAAA"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Verification probes for cloud provider credentials: AWS Bedrock and Google
3
+ * Vertex AI, whose cheapest authenticated call has to be signed per request.
4
+ *
5
+ * Still no network here: this builds the request (SigV4-signed, or carrying a
6
+ * freshly signed service-account assertion) with WebCrypto, which Node and
7
+ * browsers both provide, and the executors in the CLI and the control plane
8
+ * send it exactly as they send every other provider's probe.
9
+ *
10
+ * - **Bedrock, access key pair**: STS `GetCallerIdentity`, which any valid
11
+ * key may call — it proves the key, not its Bedrock permissions, which the
12
+ * first model call checks.
13
+ * <https://docs.aws.amazon.com/STS/latest/APIReference/API_GetCallerIdentity.html>
14
+ * - **Bedrock, API key**: `ListFoundationModels` with the key as a bearer
15
+ * token (Bedrock API keys work with Bedrock control-plane actions).
16
+ * <https://docs.aws.amazon.com/bedrock/latest/userguide/api-keys-use.html>
17
+ * - **Vertex AI**: the service account's OAuth token exchange — the key is
18
+ * valid when Google mints a token for it; project access is checked on the
19
+ * first model call. An `authorized_user` file is checked by its refresh
20
+ * grant.
21
+ *
22
+ * @module
23
+ */
24
+ import type { ProviderProbeRequest } from './providerVerification.js';
25
+ export interface SigV4Input {
26
+ method: string;
27
+ host: string;
28
+ path: string;
29
+ query?: Array<[string, string]>;
30
+ /** Headers to sign besides `host` and `x-amz-date`. */
31
+ headers?: Record<string, string>;
32
+ body: string;
33
+ accessKeyId: string;
34
+ secretAccessKey: string;
35
+ sessionToken?: string;
36
+ region: string;
37
+ service: string;
38
+ now: Date;
39
+ }
40
+ /**
41
+ * AWS Signature Version 4: the headers to add (`x-amz-date`,
42
+ * `x-amz-security-token` for temporary credentials, `authorization`).
43
+ * Held to AWS's published test-suite vectors in this package's tests.
44
+ */
45
+ export declare function sigv4Headers(i: SigV4Input): Promise<Record<string, string>>;
46
+ /** An RS256 JWT bearer assertion for Google's token endpoint. */
47
+ export declare function serviceAccountAssertion(clientEmail: string, privateKeyPem: string, privateKeyId: string | undefined, now: Date): Promise<string>;
48
+ export declare const GOOGLE_TOKEN_URI = "https://oauth2.googleapis.com/token";
49
+ /**
50
+ * The verification request for a Bedrock or Vertex AI credential, or `null`
51
+ * when `fields` are not a complete credential for one.
52
+ */
53
+ export declare function buildCloudVerificationProbe(provider: string, fields: Record<string, string>, now?: Date): Promise<ProviderProbeRequest | null>;
54
+ //# sourceMappingURL=cloudProbe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudProbe.d.ts","sourceRoot":"","sources":["../src/cloudProbe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAgB,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAiCnF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC/B,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,IAAI,CAAA;CACV;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA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