@armoriq/sdk-dev 0.2.13 → 0.2.14

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 (63) hide show
  1. package/README.md +3 -3
  2. package/dist/_build_env.d.ts +33 -0
  3. package/dist/_build_env.d.ts.map +1 -0
  4. package/dist/_build_env.js +47 -0
  5. package/dist/_build_env.js.map +1 -0
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +34 -12
  8. package/dist/client.js.map +1 -1
  9. package/dist/credentials.d.ts.map +1 -0
  10. package/dist/credentials.js.map +1 -0
  11. package/package.json +2 -7
  12. package/dist/cli/commands/login.d.ts +0 -4
  13. package/dist/cli/commands/login.d.ts.map +0 -1
  14. package/dist/cli/commands/login.js +0 -221
  15. package/dist/cli/commands/login.js.map +0 -1
  16. package/dist/cli/commands/logout.d.ts +0 -2
  17. package/dist/cli/commands/logout.d.ts.map +0 -1
  18. package/dist/cli/commands/logout.js +0 -14
  19. package/dist/cli/commands/logout.js.map +0 -1
  20. package/dist/cli/commands/whoami.d.ts +0 -2
  21. package/dist/cli/commands/whoami.d.ts.map +0 -1
  22. package/dist/cli/commands/whoami.js +0 -22
  23. package/dist/cli/commands/whoami.js.map +0 -1
  24. package/dist/cli/credentials.d.ts.map +0 -1
  25. package/dist/cli/credentials.js.map +0 -1
  26. package/dist/cli/index.d.ts +0 -3
  27. package/dist/cli/index.d.ts.map +0 -1
  28. package/dist/cli/index.js +0 -33
  29. package/dist/cli/index.js.map +0 -1
  30. package/dist/integrations/anthropic.d.ts +0 -18
  31. package/dist/integrations/anthropic.d.ts.map +0 -1
  32. package/dist/integrations/anthropic.js +0 -27
  33. package/dist/integrations/anthropic.js.map +0 -1
  34. package/dist/integrations/crewai.d.ts +0 -68
  35. package/dist/integrations/crewai.d.ts.map +0 -1
  36. package/dist/integrations/crewai.js +0 -178
  37. package/dist/integrations/crewai.js.map +0 -1
  38. package/dist/integrations/google-adk.d.ts +0 -72
  39. package/dist/integrations/google-adk.d.ts.map +0 -1
  40. package/dist/integrations/google-adk.js +0 -260
  41. package/dist/integrations/google-adk.js.map +0 -1
  42. package/dist/integrations/index.d.ts +0 -29
  43. package/dist/integrations/index.d.ts.map +0 -1
  44. package/dist/integrations/index.js +0 -37
  45. package/dist/integrations/index.js.map +0 -1
  46. package/dist/integrations/langchain.d.ts +0 -20
  47. package/dist/integrations/langchain.d.ts.map +0 -1
  48. package/dist/integrations/langchain.js +0 -28
  49. package/dist/integrations/langchain.js.map +0 -1
  50. package/dist/integrations/openai.d.ts +0 -19
  51. package/dist/integrations/openai.d.ts.map +0 -1
  52. package/dist/integrations/openai.js +0 -28
  53. package/dist/integrations/openai.js.map +0 -1
  54. package/dist/plan-builder.d.ts +0 -36
  55. package/dist/plan-builder.d.ts.map +0 -1
  56. package/dist/plan-builder.js +0 -98
  57. package/dist/plan-builder.js.map +0 -1
  58. package/dist/session.d.ts +0 -152
  59. package/dist/session.d.ts.map +0 -1
  60. package/dist/session.js +0 -547
  61. package/dist/session.js.map +0 -1
  62. /package/dist/{cli/credentials.d.ts → credentials.d.ts} +0 -0
  63. /package/dist/{cli/credentials.js → credentials.js} +0 -0
package/dist/session.js DELETED
@@ -1,547 +0,0 @@
1
- "use strict";
2
- /**
3
- * ArmorIQSession — the core primitive for framework integrations.
4
- *
5
- * Two modes:
6
- *
7
- * 1. Observe mode (default, new) — MCP stays on the agent side:
8
- * await session.startPlan(toolCalls) // capture plan + mint token
9
- * const decision = await session.enforce(toolName, toolArgs) // check policy
10
- * // ... framework calls MCP directly ...
11
- * await session.report(toolName, toolArgs, result) // audit
12
- *
13
- * 2. Proxy mode (legacy) — routes through the Armoriq proxy:
14
- * await session.startPlan(toolCalls)
15
- * return session.dispatch(toolName, toolArgs) // proxy handles everything
16
- */
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.ArmorIQSession = void 0;
22
- const axios_1 = __importDefault(require("axios"));
23
- const models_1 = require("./models");
24
- const plan_builder_1 = require("./plan-builder");
25
- class ArmorIQSession {
26
- client;
27
- toolNameParser;
28
- defaultMcpName;
29
- validitySeconds;
30
- llm;
31
- mode;
32
- stepIndex = 0;
33
- currentPlanHash = null;
34
- currentTokenValue = null;
35
- mcpByAction = new Map();
36
- // Plan-binding: every tool the agent is allowed to invoke this turn.
37
- // Keys are BOTH the framework's tool name (e.g. "GitHub__search_repositories")
38
- // and the parsed action name (e.g. "search_repositories") so either matches.
39
- declaredTools = new Set();
40
- // Cached IAP public key per kid (one HTTP call per process per key).
41
- static publicKeyCache = new Map();
42
- constructor(client, opts = {}) {
43
- this.client = client;
44
- this.defaultMcpName = opts.defaultMcpName;
45
- this.toolNameParser =
46
- opts.toolNameParser ?? (0, plan_builder_1.defaultToolNameParser)(this.defaultMcpName);
47
- this.validitySeconds = opts.validitySeconds ?? 3600;
48
- this.llm = opts.llm ?? 'agent';
49
- this.mode = opts.mode ?? 'local';
50
- }
51
- /**
52
- * Capture a plan from the LLM's tool calls and mint an intent token.
53
- * Idempotent: if called again with the same tool-calls list (by SHA),
54
- * skips the mint and returns the cached token.
55
- */
56
- async startPlan(toolCalls, opts = {}) {
57
- if (toolCalls.length === 0) {
58
- throw new Error('startPlan called with no tool calls.');
59
- }
60
- const hash = (0, plan_builder_1.hashToolCalls)(toolCalls);
61
- if (this.currentTokenValue && this.currentPlanHash === hash) {
62
- return this.currentTokenValue;
63
- }
64
- const plan = (0, plan_builder_1.buildPlanFromToolCalls)(toolCalls, {
65
- goal: opts.goal,
66
- toolNameParser: this.toolNameParser,
67
- defaultMcpName: this.defaultMcpName,
68
- });
69
- this.mcpByAction.clear();
70
- this.declaredTools.clear();
71
- for (const step of plan.steps) {
72
- this.mcpByAction.set(step.action, step.mcp);
73
- // Plan-binding: record both the action name and the namespaced form
74
- this.declaredTools.add(step.action);
75
- this.declaredTools.add(`${step.mcp}__${step.action}`);
76
- }
77
- // Also record the original framework-supplied tool names verbatim
78
- for (const tc of toolCalls) {
79
- this.declaredTools.add(tc.name);
80
- }
81
- const planCapture = this.client.capturePlan(this.llm, opts.goal ?? this.llm, plan);
82
- const token = await this.client.getIntentToken(planCapture, undefined, this.validitySeconds);
83
- this.currentPlanHash = hash;
84
- this.currentTokenValue = token;
85
- this.stepIndex = 0;
86
- return token;
87
- }
88
- /**
89
- * Local-mode enforcement.
90
- * Verifies the intent token's lifetime, plan-binding, and the
91
- * policy snapshot — all in-process. NO network call to the proxy.
92
- *
93
- * Returns { allowed, action, reason }. Plugin uses this to short-
94
- * circuit the framework's tool dispatch on a deny.
95
- */
96
- async enforceLocal(toolName, toolArgs) {
97
- if (!this.currentTokenValue) {
98
- return {
99
- allowed: false,
100
- action: 'block',
101
- reason: 'No intent token — call startPlan() first',
102
- };
103
- }
104
- // 1. Token expiry
105
- if (models_1.IntentToken.isExpired(this.currentTokenValue)) {
106
- return { allowed: false, action: 'block', reason: 'token-expired' };
107
- }
108
- // 2. Plan-binding — tool must have been declared at startPlan() time
109
- const { mcp, action } = this.toolNameParser(toolName);
110
- const inPlan = this.declaredTools.has(toolName) ||
111
- this.declaredTools.has(action) ||
112
- this.declaredTools.has(`${mcp}__${action}`);
113
- if (!inPlan) {
114
- return {
115
- allowed: false,
116
- action: 'block',
117
- reason: `tool-not-in-plan: '${toolName}' was not declared in the captured plan`,
118
- };
119
- }
120
- const pv = this.currentTokenValue.policyValidation;
121
- const snapshot = this.currentTokenValue.policySnapshot;
122
- // Find the policy that ACTUALLY governs this tool by walking the
123
- // snapshot — `matched_policies` is the union for the whole plan
124
- // (may include unrelated MCPs' policies that ran in the same eval).
125
- // The policy whose allowedTools include this action OR which
126
- // explicitly mentions this tool in its rules is "ours".
127
- const ruleOf = (entry) => entry?.memberRule ?? entry?.clientRule ?? entry?.rules ?? entry;
128
- const governingEntry = Array.isArray(snapshot)
129
- ? snapshot.find((entry) => {
130
- const r = ruleOf(entry);
131
- if (!r)
132
- return false;
133
- const allowed = Array.isArray(r.allowedTools) ? r.allowedTools : [];
134
- // A policy "governs" this tool if either:
135
- // - the action is in its allowedTools (positive match)
136
- // - the action would have been in scope by tool prefix match
137
- // (some policies use namespaced names, e.g. "GitHub__search_*")
138
- if (allowed.includes(action) || allowed.includes(toolName))
139
- return true;
140
- if (allowed.some((t) => t === '*' || t.endsWith('/*') || t.endsWith('*')))
141
- return true;
142
- // Fall back to MCP/target name match if we can find one
143
- const target = (entry?.targetName || entry?.policyName || '').toLowerCase();
144
- return target.includes(mcp.toLowerCase());
145
- })
146
- : undefined;
147
- const governingRule = ruleOf(governingEntry);
148
- const governingPolicyName = governingEntry?.policyName;
149
- // For "tool not in allowedTools" we use the POLICY-LEVEL default
150
- // (defaultEnforcementAction, defaults to 'block'). The per-rule
151
- // enforcementAction is reserved for CONDITIONAL violations like
152
- // amount thresholds — a tool that isn't allowed at all can't be
153
- // approved through delegation, only blocked.
154
- const notAllowedAction = governingEntry?.defaultEnforcementAction ||
155
- pv?.default_enforcement_action ||
156
- 'block';
157
- // 3. denied_tools — explicit deny list from backend evaluation.
158
- // Only treat as a deny IF we found a governing policy for this tool.
159
- const deniedTools = pv?.denied_tools;
160
- if (Array.isArray(deniedTools)) {
161
- const denied = deniedTools.includes(toolName) || deniedTools.includes(action);
162
- if (denied) {
163
- const reasonFromBackend = pv?.denied_reasons?.find((r) => r.startsWith(`${action}:`) || r.startsWith(`${toolName}:`));
164
- const reason = reasonFromBackend ||
165
- (governingPolicyName
166
- ? `Tool '${action}' is denied by policy '${governingPolicyName}'`
167
- : `Tool '${action}' is denied by policy`);
168
- return {
169
- allowed: false,
170
- action: notAllowedAction === 'hold' ? 'hold' : 'block',
171
- reason,
172
- matchedPolicy: governingPolicyName,
173
- };
174
- }
175
- }
176
- // 4. Snapshot-based check using the governing policy.
177
- if (governingRule) {
178
- const allowed = Array.isArray(governingRule.allowedTools)
179
- ? governingRule.allowedTools
180
- : [];
181
- if (allowed.length > 0) {
182
- const wildcard = allowed.includes('*');
183
- const ok = wildcard ||
184
- allowed.includes(action) ||
185
- allowed.includes(toolName);
186
- if (!ok) {
187
- return {
188
- allowed: false,
189
- action: notAllowedAction === 'hold' ? 'hold' : 'block',
190
- reason: `Tool '${action}' is not in the allowed tools for policy '${governingPolicyName}'`,
191
- matchedPolicy: governingPolicyName,
192
- };
193
- }
194
- }
195
- }
196
- else if (Array.isArray(snapshot) && snapshot.length > 0) {
197
- // We have policies but none govern this tool — for an MCP that has
198
- // an explicit policy attached, this means "no rule allows it".
199
- // Don't false-positive on unrelated MCP policies though: only
200
- // block if `allowed_tools` from the backend is empty for this tool.
201
- const allowedTools = pv?.allowed_tools;
202
- if (Array.isArray(allowedTools) && allowedTools.length === 0) {
203
- return {
204
- allowed: false,
205
- action: 'block',
206
- reason: `Tool '${action}' is not allowed by any policy in scope`,
207
- };
208
- }
209
- }
210
- // 5. Threshold checks on the governing rule (e.g. amount limits).
211
- // Uses tool metadata declared on the platform (amountFields +
212
- // amountUnit, set in armorpay's tool-metadata UI) — NO MCP-
213
- // specific knowledge in the SDK itself.
214
- if (governingRule) {
215
- const decision = await this.evaluateAmountThreshold(governingRule, toolArgs, action, mcp);
216
- if (decision) {
217
- return { ...decision, matchedPolicy: governingPolicyName };
218
- }
219
- }
220
- return {
221
- allowed: true,
222
- action: 'allow',
223
- reason: 'Allowed by local policy evaluation',
224
- matchedPolicy: governingPolicyName,
225
- };
226
- }
227
- /**
228
- * Check policy for a tool call BEFORE the agent executes it.
229
- * Calls POST /iap/enforce on the backend.
230
- * Returns { allowed, action, reason }. The framework plugin uses this
231
- * to block or let through — the MCP call itself happens on the agent side.
232
- */
233
- async enforce(toolName, toolArgs) {
234
- if (!this.currentTokenValue) {
235
- throw new Error(`enforce("${toolName}") called before startPlan().`);
236
- }
237
- const { mcp, action } = this.toolNameParser(toolName);
238
- const resolvedMcp = this.mcpByAction.get(action) ?? mcp;
239
- // Plan-binding check (cheaper than a network call)
240
- const inPlan = this.declaredTools.has(toolName) ||
241
- this.declaredTools.has(action) ||
242
- this.declaredTools.has(`${resolvedMcp}__${action}`);
243
- if (!inPlan) {
244
- return {
245
- allowed: false,
246
- action: 'block',
247
- reason: `tool-not-in-plan: '${toolName}' was not declared in the captured plan`,
248
- };
249
- }
250
- try {
251
- const proxyEndpoint = this.client.defaultProxyEndpoint;
252
- const apiKey = this.client.apiKey;
253
- const response = await axios_1.default.post(`${proxyEndpoint}/invoke`, {
254
- enforce_only: true,
255
- mcp: resolvedMcp,
256
- tool: action,
257
- action,
258
- params: toolArgs,
259
- arguments: toolArgs,
260
- intent_token: this.currentTokenValue.rawToken,
261
- plan: this.currentTokenValue.rawToken?.plan,
262
- ...(this.currentTokenValue.policySnapshot
263
- ? { policy_snapshot: this.currentTokenValue.policySnapshot }
264
- : {}),
265
- }, {
266
- headers: {
267
- 'X-API-Key': apiKey,
268
- 'Content-Type': 'application/json',
269
- },
270
- timeout: 10000,
271
- });
272
- const data = response.data;
273
- return {
274
- allowed: data.allowed !== false,
275
- action: data.action || (data.allowed === false ? 'block' : 'allow'),
276
- reason: data.reason,
277
- delegationId: data.delegation_id,
278
- matchedPolicy: data.matched_policy,
279
- };
280
- }
281
- catch (err) {
282
- if (err.response?.status === 403) {
283
- const data = err.response.data || {};
284
- return {
285
- allowed: false,
286
- action: data.action || 'block',
287
- reason: data.reason || data.message || err.message,
288
- matchedPolicy: data.matched_policy,
289
- };
290
- }
291
- // On network error or 5xx, fail open with a warning
292
- console.warn(`[ArmorIQ] enforce() failed: ${err.message}. Allowing tool call.`);
293
- return { allowed: true, action: 'allow', reason: 'enforce-unavailable' };
294
- }
295
- }
296
- /**
297
- * Report a tool execution to the audit log AFTER the agent calls the MCP.
298
- * Calls POST /iap/audit on the backend.
299
- */
300
- async report(toolName, toolArgs, result, opts = {}) {
301
- const { mcp, action } = this.toolNameParser(toolName);
302
- const resolvedMcp = this.mcpByAction.get(action) ?? mcp;
303
- try {
304
- const backendEndpoint = this.client.backendEndpoint;
305
- const apiKey = this.client.apiKey;
306
- const token = this.currentTokenValue;
307
- await axios_1.default.post(`${backendEndpoint}/iap/audit`, {
308
- token: token?.jwtToken || token?.tokenId || 'unknown',
309
- plan_id: token?.planId || token?.tokenId || 'unknown',
310
- step_index: this.stepIndex,
311
- action,
312
- tool: action,
313
- mcp: resolvedMcp,
314
- input: toolArgs,
315
- output: typeof result === 'string' ? { text: result } : (result ?? {}),
316
- status: opts.status || 'success',
317
- error_message: opts.errorMessage,
318
- duration_ms: opts.durationMs,
319
- is_delegated: opts.isDelegated,
320
- delegated_by: opts.delegatedBy,
321
- delegated_to: opts.delegatedTo,
322
- executed_at: new Date().toISOString(),
323
- }, {
324
- headers: {
325
- 'X-API-Key': apiKey,
326
- 'Content-Type': 'application/json',
327
- },
328
- timeout: 5000,
329
- });
330
- }
331
- catch (err) {
332
- console.warn(`[ArmorIQ] report() failed: ${err.message}`);
333
- }
334
- this.stepIndex++;
335
- }
336
- /**
337
- * [Proxy mode] Route a tool call through the Armoriq proxy.
338
- * Returns the raw result so the framework can short-circuit
339
- * its native dispatch. Use this when the proxy handles the
340
- * upstream MCP connection (e.g. Claude Desktop, Cursor).
341
- */
342
- async dispatch(toolName, toolArgs) {
343
- if (!this.currentTokenValue) {
344
- throw new Error(`dispatch("${toolName}") called before startPlan().`);
345
- }
346
- const { mcp, action } = this.toolNameParser(toolName);
347
- const resolvedMcp = this.mcpByAction.get(action) ?? mcp;
348
- const result = await this.client.invoke(resolvedMcp, action, this.currentTokenValue, toolArgs);
349
- this.stepIndex++;
350
- return result.result;
351
- }
352
- /**
353
- * Mode-aware enforcement entry point. Plugins should call this and
354
- * not branch themselves — `mode` on the session decides the path.
355
- *
356
- * Behavior by mode:
357
- * - 'local' → allow / block ONLY. In-process, no network calls.
358
- * A 'hold' threshold violation is reported as 'block'
359
- * with an explanatory reason. Use proxy mode if you
360
- * need delegation/approval workflows.
361
- * - 'proxy' → allow / block / hold. The proxy resolves the hold
362
- * via the delegation pipeline (request → approve → re-run).
363
- */
364
- async check(toolName, toolArgs, opts = {}) {
365
- if (this.mode === 'local') {
366
- const decision = await this.enforceLocal(toolName, toolArgs);
367
- // Local mode is allow/block only — downgrade any 'hold' to 'block'
368
- // so the agent UX is clear: action requires a more permissive mode.
369
- if (decision.action === 'hold') {
370
- return {
371
- ...decision,
372
- action: 'block',
373
- reason: (decision.reason ?? 'requires approval') +
374
- ' — switch ARMORIQ_MODE=proxy to enable approval workflows for this action.',
375
- };
376
- }
377
- return decision;
378
- }
379
- // Proxy mode: full pipeline including hold + delegation.
380
- const decision = await this.enforce(toolName, toolArgs);
381
- if (decision.action !== 'hold')
382
- return decision;
383
- return this.handleHold(toolName, toolArgs, decision, opts);
384
- }
385
- /**
386
- * Handle a 'hold' decision: check for prior approval, otherwise
387
- * create a delegation request. Returns either:
388
- * - allowed: true (prior approval found within window)
389
- * - allowed: false, action: 'hold', delegationId (request created or pending)
390
- */
391
- async handleHold(toolName, toolArgs, holdDecision, opts = {}) {
392
- const userEmail = opts.userEmail ||
393
- this.client.userId ||
394
- 'unknown@armoriq';
395
- const { mcp, action } = this.toolNameParser(toolName);
396
- const resolvedMcp = this.mcpByAction.get(action) ?? mcp;
397
- // 1. Check if there's already an approved delegation for this
398
- // (user, tool, amount) within the approval window.
399
- const amount = this.extractAmount(toolArgs);
400
- try {
401
- const approved = await this.client.checkApprovedDelegation(userEmail, action, amount ?? 0);
402
- if (approved && approved.approved !== false) {
403
- // Mark used so a single approval = single execution
404
- try {
405
- if (approved.delegationId) {
406
- await this.client.markDelegationExecuted(userEmail, approved.delegationId);
407
- }
408
- }
409
- catch {
410
- // best-effort
411
- }
412
- return {
413
- allowed: true,
414
- action: 'allow',
415
- reason: `Allowed by approved delegation ${approved.delegationId ?? ''}`.trim(),
416
- delegationId: approved.delegationId,
417
- matchedPolicy: holdDecision.matchedPolicy,
418
- };
419
- }
420
- }
421
- catch {
422
- // backend unreachable — fall through to creating a new request
423
- }
424
- // 2. No prior approval → create a delegation request (visible in UI).
425
- let delegationId;
426
- try {
427
- const result = await this.client.createDelegationRequest({
428
- tool: action,
429
- action,
430
- arguments: toolArgs,
431
- amount,
432
- requesterEmail: userEmail,
433
- domain: resolvedMcp,
434
- planId: this.currentTokenValue?.planId,
435
- intentReference: this.currentTokenValue?.tokenId,
436
- merkleRoot: this.currentTokenValue?.rawToken?.merkle_root,
437
- reason: holdDecision.reason,
438
- });
439
- delegationId = result?.delegationId;
440
- }
441
- catch (err) {
442
- // If we can't create the request, still return the original block.
443
- console.warn(`[ArmorIQ] createDelegationRequest failed: ${err.message}`);
444
- }
445
- return {
446
- allowed: false,
447
- action: 'hold',
448
- reason: holdDecision.reason ?? 'Pending approval',
449
- delegationId,
450
- matchedPolicy: holdDecision.matchedPolicy,
451
- };
452
- }
453
- /**
454
- * Best-effort extraction of an amount field from arbitrary tool args.
455
- * Used as a FALLBACK when the platform hasn't declared per-tool
456
- * metadata. Fully MCP-agnostic — only checks generic field names.
457
- */
458
- extractAmount(args) {
459
- if (!args || typeof args !== 'object')
460
- return undefined;
461
- const candidates = ['amount', 'value', 'total', 'price', 'cost'];
462
- for (const k of candidates) {
463
- const v = args[k];
464
- if (v != null && !isNaN(Number(v)))
465
- return Number(v);
466
- }
467
- return undefined;
468
- }
469
- /**
470
- * Resolve the canonical "amount" for a tool call:
471
- * 1. Try platform-declared tool metadata (amountFields + amountUnit)
472
- * — same source the proxy uses (toolMetadata column on MCPServer,
473
- * authored in the armorpay UI). MCP-specific units like 'cents'
474
- * are normalized HERE, not in the SDK.
475
- * 2. Fall back to the generic candidate-field extractor.
476
- */
477
- async resolveCanonicalAmount(mcp, toolName, args) {
478
- try {
479
- const meta = await this.client.fetchToolMetadata(mcp);
480
- const toolMeta = meta?.toolMetadata?.[toolName];
481
- if (toolMeta?.amountFields?.length) {
482
- for (const field of toolMeta.amountFields) {
483
- const raw = args?.[field];
484
- if (raw == null || isNaN(Number(raw)))
485
- continue;
486
- const num = Number(raw);
487
- return toolMeta.amountUnit === 'cents' ? num / 100 : num;
488
- }
489
- }
490
- }
491
- catch {
492
- // metadata fetch failed — fall through to generic extraction
493
- }
494
- return this.extractAmount(args);
495
- }
496
- /**
497
- * Evaluate an amount-threshold rule from the policy snapshot against
498
- * the tool args. Returns:
499
- * - undefined if no threshold or amount-not-applicable
500
- * - { allowed: false, action: 'block' } if amount > maxPerTransaction
501
- * - { allowed: false, action: 'hold' } if amount > requireApprovalAbove
502
- */
503
- async evaluateAmountThreshold(rule, toolArgs, action, mcp) {
504
- const fin = rule?.financialRule?.amountThreshold ?? rule?.amountThreshold;
505
- if (!fin || typeof fin !== 'object')
506
- return undefined;
507
- const amount = await this.resolveCanonicalAmount(mcp, action, toolArgs);
508
- if (amount === undefined)
509
- return undefined;
510
- const currency = fin.currency || '';
511
- const maxPer = fin.maxPerTransaction;
512
- const reqApproval = fin.requireApprovalAbove;
513
- if (typeof maxPer === 'number' && amount > maxPer) {
514
- return {
515
- allowed: false,
516
- action: 'block',
517
- reason: `Amount ${amount} ${currency} exceeds maxPerTransaction (${maxPer})`.trim(),
518
- };
519
- }
520
- if (typeof reqApproval === 'number' && amount > reqApproval) {
521
- return {
522
- allowed: false,
523
- action: 'hold',
524
- reason: `Amount ${amount} ${currency} requires approval (threshold: ${reqApproval})`.trim(),
525
- };
526
- }
527
- return undefined;
528
- }
529
- /** Drop cached plan + token so the next startPlan() always mints fresh. */
530
- reset() {
531
- this.currentPlanHash = null;
532
- this.currentTokenValue = null;
533
- this.mcpByAction.clear();
534
- this.declaredTools.clear();
535
- this.stepIndex = 0;
536
- }
537
- /** Inspect the currently held intent token (for debugging / audit). */
538
- get currentToken() {
539
- return this.currentTokenValue;
540
- }
541
- /** Current session mode ('local' default, 'proxy' opt-in). */
542
- get currentMode() {
543
- return this.mode;
544
- }
545
- }
546
- exports.ArmorIQSession = ArmorIQSession;
547
- //# sourceMappingURL=session.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[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