@armoriq/sdk-dev 0.2.13 → 0.2.15
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.
- package/README.md +3 -3
- package/dist/_build_env.d.ts +26 -0
- package/dist/_build_env.d.ts.map +1 -0
- package/dist/_build_env.js +59 -0
- package/dist/_build_env.js.map +1 -0
- package/dist/client.d.ts +0 -13
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +65 -30
- package/dist/client.js.map +1 -1
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js.map +1 -0
- package/dist/exceptions.d.ts +4 -2
- package/dist/exceptions.d.ts.map +1 -1
- package/dist/exceptions.js +6 -2
- package/dist/exceptions.js.map +1 -1
- package/dist/models.d.ts +0 -2
- package/dist/models.d.ts.map +1 -1
- package/package.json +2 -7
- package/dist/cli/commands/login.d.ts +0 -4
- package/dist/cli/commands/login.d.ts.map +0 -1
- package/dist/cli/commands/login.js +0 -221
- package/dist/cli/commands/login.js.map +0 -1
- package/dist/cli/commands/logout.d.ts +0 -2
- package/dist/cli/commands/logout.d.ts.map +0 -1
- package/dist/cli/commands/logout.js +0 -14
- package/dist/cli/commands/logout.js.map +0 -1
- package/dist/cli/commands/whoami.d.ts +0 -2
- package/dist/cli/commands/whoami.d.ts.map +0 -1
- package/dist/cli/commands/whoami.js +0 -22
- package/dist/cli/commands/whoami.js.map +0 -1
- package/dist/cli/credentials.d.ts.map +0 -1
- package/dist/cli/credentials.js.map +0 -1
- package/dist/cli/index.d.ts +0 -3
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -33
- package/dist/cli/index.js.map +0 -1
- package/dist/integrations/anthropic.d.ts +0 -18
- package/dist/integrations/anthropic.d.ts.map +0 -1
- package/dist/integrations/anthropic.js +0 -27
- package/dist/integrations/anthropic.js.map +0 -1
- package/dist/integrations/crewai.d.ts +0 -68
- package/dist/integrations/crewai.d.ts.map +0 -1
- package/dist/integrations/crewai.js +0 -178
- package/dist/integrations/crewai.js.map +0 -1
- package/dist/integrations/google-adk.d.ts +0 -72
- package/dist/integrations/google-adk.d.ts.map +0 -1
- package/dist/integrations/google-adk.js +0 -260
- package/dist/integrations/google-adk.js.map +0 -1
- package/dist/integrations/index.d.ts +0 -29
- package/dist/integrations/index.d.ts.map +0 -1
- package/dist/integrations/index.js +0 -37
- package/dist/integrations/index.js.map +0 -1
- package/dist/integrations/langchain.d.ts +0 -20
- package/dist/integrations/langchain.d.ts.map +0 -1
- package/dist/integrations/langchain.js +0 -28
- package/dist/integrations/langchain.js.map +0 -1
- package/dist/integrations/openai.d.ts +0 -19
- package/dist/integrations/openai.d.ts.map +0 -1
- package/dist/integrations/openai.js +0 -28
- package/dist/integrations/openai.js.map +0 -1
- package/dist/plan-builder.d.ts +0 -36
- package/dist/plan-builder.d.ts.map +0 -1
- package/dist/plan-builder.js +0 -98
- package/dist/plan-builder.js.map +0 -1
- package/dist/session.d.ts +0 -152
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -547
- package/dist/session.js.map +0 -1
- /package/dist/{cli/credentials.d.ts → credentials.d.ts} +0 -0
- /package/dist/{cli/credentials.js → credentials.js} +0 -0
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ArmorIQ — LangChain integration. (Coming Soon)
|
|
4
|
-
*
|
|
5
|
-
* Planned surface mirrors the Python SDK's ArmorIQLangChain (currently
|
|
6
|
-
* stubbed in Python too). When implemented, this will wrap LangChain.js
|
|
7
|
-
* `StructuredTool` / `Tool` instances so their `invoke()` routes through
|
|
8
|
-
* the Armoriq proxy via ArmorIQSession.
|
|
9
|
-
*
|
|
10
|
-
* Requires: `npm install @langchain/core langchain`
|
|
11
|
-
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.ArmorIQLangChain = void 0;
|
|
14
|
-
class ArmorIQLangChain {
|
|
15
|
-
constructor(_options) {
|
|
16
|
-
try {
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
18
|
-
require('@langchain/core');
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
throw new Error('@langchain/core is not installed.\n' +
|
|
22
|
-
'Install it with: npm install @langchain/core langchain');
|
|
23
|
-
}
|
|
24
|
-
throw new Error('ArmorIQ LangChain integration is not yet implemented.');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.ArmorIQLangChain = ArmorIQLangChain;
|
|
28
|
-
//# sourceMappingURL=langchain.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"langchain.js","sourceRoot":"","sources":["../../src/integrations/langchain.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAUH,MAAa,gBAAgB;IAC3B,YAAY,QAAiC;QAC3C,IAAI,CAAC;YACH,8DAA8D;YAC9D,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CACb,qCAAqC;gBACnC,wDAAwD,CAC3D,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;CACF;AAbD,4CAaC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ArmorIQ — OpenAI integration. (Coming Soon)
|
|
3
|
-
*
|
|
4
|
-
* Mirrors the Python SDK's ArmorIQOpenAI stub. When implemented, this
|
|
5
|
-
* will wrap the OpenAI SDK's tool-call dispatch (and/or the OpenAI
|
|
6
|
-
* Agents runtime) so tool calls route through the Armoriq proxy via
|
|
7
|
-
* ArmorIQSession.
|
|
8
|
-
*
|
|
9
|
-
* Requires: `npm install openai`
|
|
10
|
-
*/
|
|
11
|
-
import { ArmorIQClient } from '../client';
|
|
12
|
-
export interface ArmorIQOpenAIOptions {
|
|
13
|
-
armoriqClient: ArmorIQClient;
|
|
14
|
-
[key: string]: any;
|
|
15
|
-
}
|
|
16
|
-
export declare class ArmorIQOpenAI {
|
|
17
|
-
constructor(_options: ArmorIQOpenAIOptions);
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/integrations/openai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,qBAAa,aAAa;gBACZ,QAAQ,EAAE,oBAAoB;CAY3C"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ArmorIQ — OpenAI integration. (Coming Soon)
|
|
4
|
-
*
|
|
5
|
-
* Mirrors the Python SDK's ArmorIQOpenAI stub. When implemented, this
|
|
6
|
-
* will wrap the OpenAI SDK's tool-call dispatch (and/or the OpenAI
|
|
7
|
-
* Agents runtime) so tool calls route through the Armoriq proxy via
|
|
8
|
-
* ArmorIQSession.
|
|
9
|
-
*
|
|
10
|
-
* Requires: `npm install openai`
|
|
11
|
-
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.ArmorIQOpenAI = void 0;
|
|
14
|
-
class ArmorIQOpenAI {
|
|
15
|
-
constructor(_options) {
|
|
16
|
-
try {
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
18
|
-
require('openai');
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
throw new Error('openai is not installed.\n' +
|
|
22
|
-
'Install it with: npm install openai');
|
|
23
|
-
}
|
|
24
|
-
throw new Error('ArmorIQ OpenAI integration is not yet implemented.');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.ArmorIQOpenAI = ArmorIQOpenAI;
|
|
28
|
-
//# sourceMappingURL=openai.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/integrations/openai.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AASH,MAAa,aAAa;IACxB,YAAY,QAA8B;QACxC,IAAI,CAAC;YACH,8DAA8D;YAC9D,OAAO,CAAC,QAAQ,CAAC,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CACb,4BAA4B;gBAC1B,qCAAqC,CACxC,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;CACF;AAbD,sCAaC"}
|
package/dist/plan-builder.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plan-shape helpers used by ArmorIQSession and framework integrations.
|
|
3
|
-
*
|
|
4
|
-
* Most LLM frameworks surface tool calls as a flat list of
|
|
5
|
-
* `{ name, args }`. The SDK accepts that shape directly so plugin code
|
|
6
|
-
* doesn't have to hand-construct `{ goal, steps: [...] }` every time.
|
|
7
|
-
*/
|
|
8
|
-
import { ToolCall } from './models';
|
|
9
|
-
export interface ToolNameParser {
|
|
10
|
-
(toolName: string): {
|
|
11
|
-
mcp: string;
|
|
12
|
-
action: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export interface BuildPlanOptions {
|
|
16
|
-
goal?: string;
|
|
17
|
-
toolNameParser?: ToolNameParser;
|
|
18
|
-
defaultMcpName?: string;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Default tool-name convention: `<MCP>__<action>`. Matches the proxy's
|
|
22
|
-
* MCP gateway and the convention used by sdk-admin-agent.
|
|
23
|
-
* "Stripe__create_payment" -> { mcp: "Stripe", action: "create_payment" }
|
|
24
|
-
* "create_payment" -> uses defaultMcpName, else throws.
|
|
25
|
-
*/
|
|
26
|
-
export declare function defaultToolNameParser(defaultMcpName?: string): ToolNameParser;
|
|
27
|
-
/**
|
|
28
|
-
* Build a SDK-shaped plan dict from a flat list of tool calls.
|
|
29
|
-
*/
|
|
30
|
-
export declare function buildPlanFromToolCalls(toolCalls: ToolCall[], opts?: BuildPlanOptions): Record<string, any>;
|
|
31
|
-
/**
|
|
32
|
-
* Stable hash over a tool-calls list — used by the session to skip
|
|
33
|
-
* re-minting when the LLM re-emits the same plan in the same turn.
|
|
34
|
-
*/
|
|
35
|
-
export declare function hashToolCalls(toolCalls: ToolCall[]): string;
|
|
36
|
-
//# sourceMappingURL=plan-builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plan-builder.d.ts","sourceRoot":"","sources":["../src/plan-builder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,WAAW,cAAc;IAC7B,CAAC,QAAQ,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CACrD;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,cAAc,CAkB7E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,QAAQ,EAAE,EACrB,IAAI,GAAE,gBAAqB,GAC1B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAgBrB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,CAK3D"}
|
package/dist/plan-builder.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Plan-shape helpers used by ArmorIQSession and framework integrations.
|
|
4
|
-
*
|
|
5
|
-
* Most LLM frameworks surface tool calls as a flat list of
|
|
6
|
-
* `{ name, args }`. The SDK accepts that shape directly so plugin code
|
|
7
|
-
* doesn't have to hand-construct `{ goal, steps: [...] }` every time.
|
|
8
|
-
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
-
var ownKeys = function(o) {
|
|
27
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
-
var ar = [];
|
|
29
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
return ownKeys(o);
|
|
33
|
-
};
|
|
34
|
-
return function (mod) {
|
|
35
|
-
if (mod && mod.__esModule) return mod;
|
|
36
|
-
var result = {};
|
|
37
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
-
__setModuleDefault(result, mod);
|
|
39
|
-
return result;
|
|
40
|
-
};
|
|
41
|
-
})();
|
|
42
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.defaultToolNameParser = defaultToolNameParser;
|
|
44
|
-
exports.buildPlanFromToolCalls = buildPlanFromToolCalls;
|
|
45
|
-
exports.hashToolCalls = hashToolCalls;
|
|
46
|
-
const crypto = __importStar(require("crypto"));
|
|
47
|
-
/**
|
|
48
|
-
* Default tool-name convention: `<MCP>__<action>`. Matches the proxy's
|
|
49
|
-
* MCP gateway and the convention used by sdk-admin-agent.
|
|
50
|
-
* "Stripe__create_payment" -> { mcp: "Stripe", action: "create_payment" }
|
|
51
|
-
* "create_payment" -> uses defaultMcpName, else throws.
|
|
52
|
-
*/
|
|
53
|
-
function defaultToolNameParser(defaultMcpName) {
|
|
54
|
-
return (toolName) => {
|
|
55
|
-
const idx = toolName.indexOf('__');
|
|
56
|
-
if (idx === -1) {
|
|
57
|
-
if (!defaultMcpName) {
|
|
58
|
-
throw new Error(`Tool "${toolName}" is not namespaced as <MCP>__<action> and no defaultMcpName was set on the session.`);
|
|
59
|
-
}
|
|
60
|
-
return { mcp: defaultMcpName, action: toolName };
|
|
61
|
-
}
|
|
62
|
-
const mcp = toolName.slice(0, idx);
|
|
63
|
-
const action = toolName.slice(idx + 2);
|
|
64
|
-
if (!mcp || !action) {
|
|
65
|
-
throw new Error(`Tool "${toolName}" has a malformed MCP prefix.`);
|
|
66
|
-
}
|
|
67
|
-
return { mcp, action };
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Build a SDK-shaped plan dict from a flat list of tool calls.
|
|
72
|
-
*/
|
|
73
|
-
function buildPlanFromToolCalls(toolCalls, opts = {}) {
|
|
74
|
-
const parser = opts.toolNameParser ?? defaultToolNameParser(opts.defaultMcpName);
|
|
75
|
-
const steps = toolCalls.map((tc) => {
|
|
76
|
-
const { mcp, action } = parser(tc.name);
|
|
77
|
-
return {
|
|
78
|
-
action,
|
|
79
|
-
tool: action,
|
|
80
|
-
mcp,
|
|
81
|
-
params: tc.args ?? {},
|
|
82
|
-
description: `Call ${action} on ${mcp}`,
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
|
-
return {
|
|
86
|
-
goal: opts.goal ?? 'agent task',
|
|
87
|
-
steps,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Stable hash over a tool-calls list — used by the session to skip
|
|
92
|
-
* re-minting when the LLM re-emits the same plan in the same turn.
|
|
93
|
-
*/
|
|
94
|
-
function hashToolCalls(toolCalls) {
|
|
95
|
-
const canonical = JSON.stringify(toolCalls.map((tc) => ({ name: tc.name, args: tc.args ?? {} })));
|
|
96
|
-
return crypto.createHash('sha256').update(canonical, 'utf8').digest('hex');
|
|
97
|
-
}
|
|
98
|
-
//# sourceMappingURL=plan-builder.js.map
|
package/dist/plan-builder.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plan-builder.js","sourceRoot":"","sources":["../src/plan-builder.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBH,sDAkBC;AAKD,wDAmBC;AAMD,sCAKC;AAxED,+CAAiC;AAajC;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,cAAuB;IAC3D,OAAO,CAAC,QAAgB,EAAE,EAAE;QAC1B,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,cAAc,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CACb,SAAS,QAAQ,sFAAsF,CACxG,CAAC;YACJ,CAAC;YACD,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;QACnD,CAAC;Q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AAC;IACF,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC"}
|
package/dist/session.d.ts
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ArmorIQSession — the core primitive for framework integrations.
|
|
3
|
-
*
|
|
4
|
-
* Two modes:
|
|
5
|
-
*
|
|
6
|
-
* 1. Observe mode (default, new) — MCP stays on the agent side:
|
|
7
|
-
* await session.startPlan(toolCalls) // capture plan + mint token
|
|
8
|
-
* const decision = await session.enforce(toolName, toolArgs) // check policy
|
|
9
|
-
* // ... framework calls MCP directly ...
|
|
10
|
-
* await session.report(toolName, toolArgs, result) // audit
|
|
11
|
-
*
|
|
12
|
-
* 2. Proxy mode (legacy) — routes through the Armoriq proxy:
|
|
13
|
-
* await session.startPlan(toolCalls)
|
|
14
|
-
* return session.dispatch(toolName, toolArgs) // proxy handles everything
|
|
15
|
-
*/
|
|
16
|
-
import { ArmorIQClient } from './client';
|
|
17
|
-
import { IntentToken, ToolCall } from './models';
|
|
18
|
-
import { ToolNameParser } from './plan-builder';
|
|
19
|
-
export type SessionMode = 'local' | 'proxy';
|
|
20
|
-
export interface SessionOptions {
|
|
21
|
-
toolNameParser?: ToolNameParser;
|
|
22
|
-
defaultMcpName?: string;
|
|
23
|
-
validitySeconds?: number;
|
|
24
|
-
llm?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Where the policy decision is evaluated.
|
|
27
|
-
* - 'local' (default): SDK verifies the intent token signature in-process
|
|
28
|
-
* and evaluates the policy snapshot locally. NO network call to the
|
|
29
|
-
* proxy on the tool-call hot path.
|
|
30
|
-
* - 'proxy': SDK calls the proxy with enforce_only=true. Useful when
|
|
31
|
-
* you want centralized real-time policy decisions or shared rate limits.
|
|
32
|
-
*/
|
|
33
|
-
mode?: SessionMode;
|
|
34
|
-
}
|
|
35
|
-
export interface EnforceResult {
|
|
36
|
-
allowed: boolean;
|
|
37
|
-
action: 'allow' | 'block' | 'hold';
|
|
38
|
-
reason?: string;
|
|
39
|
-
delegationId?: string;
|
|
40
|
-
matchedPolicy?: string;
|
|
41
|
-
}
|
|
42
|
-
export interface ReportOptions {
|
|
43
|
-
status?: 'success' | 'failed' | 'error';
|
|
44
|
-
errorMessage?: string;
|
|
45
|
-
durationMs?: number;
|
|
46
|
-
isDelegated?: boolean;
|
|
47
|
-
delegatedBy?: string;
|
|
48
|
-
delegatedTo?: string;
|
|
49
|
-
}
|
|
50
|
-
export declare class ArmorIQSession {
|
|
51
|
-
private client;
|
|
52
|
-
private toolNameParser;
|
|
53
|
-
private defaultMcpName?;
|
|
54
|
-
private validitySeconds;
|
|
55
|
-
private llm;
|
|
56
|
-
private mode;
|
|
57
|
-
private stepIndex;
|
|
58
|
-
private currentPlanHash;
|
|
59
|
-
private currentTokenValue;
|
|
60
|
-
private mcpByAction;
|
|
61
|
-
private declaredTools;
|
|
62
|
-
private static publicKeyCache;
|
|
63
|
-
constructor(client: ArmorIQClient, opts?: SessionOptions);
|
|
64
|
-
/**
|
|
65
|
-
* Capture a plan from the LLM's tool calls and mint an intent token.
|
|
66
|
-
* Idempotent: if called again with the same tool-calls list (by SHA),
|
|
67
|
-
* skips the mint and returns the cached token.
|
|
68
|
-
*/
|
|
69
|
-
startPlan(toolCalls: ToolCall[], opts?: {
|
|
70
|
-
goal?: string;
|
|
71
|
-
}): Promise<IntentToken>;
|
|
72
|
-
/**
|
|
73
|
-
* Local-mode enforcement.
|
|
74
|
-
* Verifies the intent token's lifetime, plan-binding, and the
|
|
75
|
-
* policy snapshot — all in-process. NO network call to the proxy.
|
|
76
|
-
*
|
|
77
|
-
* Returns { allowed, action, reason }. Plugin uses this to short-
|
|
78
|
-
* circuit the framework's tool dispatch on a deny.
|
|
79
|
-
*/
|
|
80
|
-
enforceLocal(toolName: string, toolArgs: Record<string, unknown>): Promise<EnforceResult>;
|
|
81
|
-
/**
|
|
82
|
-
* Check policy for a tool call BEFORE the agent executes it.
|
|
83
|
-
* Calls POST /iap/enforce on the backend.
|
|
84
|
-
* Returns { allowed, action, reason }. The framework plugin uses this
|
|
85
|
-
* to block or let through — the MCP call itself happens on the agent side.
|
|
86
|
-
*/
|
|
87
|
-
enforce(toolName: string, toolArgs: Record<string, unknown>): Promise<EnforceResult>;
|
|
88
|
-
/**
|
|
89
|
-
* Report a tool execution to the audit log AFTER the agent calls the MCP.
|
|
90
|
-
* Calls POST /iap/audit on the backend.
|
|
91
|
-
*/
|
|
92
|
-
report(toolName: string, toolArgs: Record<string, unknown>, result: unknown, opts?: ReportOptions): Promise<void>;
|
|
93
|
-
/**
|
|
94
|
-
* [Proxy mode] Route a tool call through the Armoriq proxy.
|
|
95
|
-
* Returns the raw result so the framework can short-circuit
|
|
96
|
-
* its native dispatch. Use this when the proxy handles the
|
|
97
|
-
* upstream MCP connection (e.g. Claude Desktop, Cursor).
|
|
98
|
-
*/
|
|
99
|
-
dispatch(toolName: string, toolArgs: Record<string, unknown>): Promise<unknown>;
|
|
100
|
-
/**
|
|
101
|
-
* Mode-aware enforcement entry point. Plugins should call this and
|
|
102
|
-
* not branch themselves — `mode` on the session decides the path.
|
|
103
|
-
*
|
|
104
|
-
* Behavior by mode:
|
|
105
|
-
* - 'local' → allow / block ONLY. In-process, no network calls.
|
|
106
|
-
* A 'hold' threshold violation is reported as 'block'
|
|
107
|
-
* with an explanatory reason. Use proxy mode if you
|
|
108
|
-
* need delegation/approval workflows.
|
|
109
|
-
* - 'proxy' → allow / block / hold. The proxy resolves the hold
|
|
110
|
-
* via the delegation pipeline (request → approve → re-run).
|
|
111
|
-
*/
|
|
112
|
-
check(toolName: string, toolArgs: Record<string, unknown>, opts?: {
|
|
113
|
-
userEmail?: string;
|
|
114
|
-
}): Promise<EnforceResult>;
|
|
115
|
-
/**
|
|
116
|
-
* Handle a 'hold' decision: check for prior approval, otherwise
|
|
117
|
-
* create a delegation request. Returns either:
|
|
118
|
-
* - allowed: true (prior approval found within window)
|
|
119
|
-
* - allowed: false, action: 'hold', delegationId (request created or pending)
|
|
120
|
-
*/
|
|
121
|
-
private handleHold;
|
|
122
|
-
/**
|
|
123
|
-
* Best-effort extraction of an amount field from arbitrary tool args.
|
|
124
|
-
* Used as a FALLBACK when the platform hasn't declared per-tool
|
|
125
|
-
* metadata. Fully MCP-agnostic — only checks generic field names.
|
|
126
|
-
*/
|
|
127
|
-
private extractAmount;
|
|
128
|
-
/**
|
|
129
|
-
* Resolve the canonical "amount" for a tool call:
|
|
130
|
-
* 1. Try platform-declared tool metadata (amountFields + amountUnit)
|
|
131
|
-
* — same source the proxy uses (toolMetadata column on MCPServer,
|
|
132
|
-
* authored in the armorpay UI). MCP-specific units like 'cents'
|
|
133
|
-
* are normalized HERE, not in the SDK.
|
|
134
|
-
* 2. Fall back to the generic candidate-field extractor.
|
|
135
|
-
*/
|
|
136
|
-
private resolveCanonicalAmount;
|
|
137
|
-
/**
|
|
138
|
-
* Evaluate an amount-threshold rule from the policy snapshot against
|
|
139
|
-
* the tool args. Returns:
|
|
140
|
-
* - undefined if no threshold or amount-not-applicable
|
|
141
|
-
* - { allowed: false, action: 'block' } if amount > maxPerTransaction
|
|
142
|
-
* - { allowed: false, action: 'hold' } if amount > requireApprovalAbove
|
|
143
|
-
*/
|
|
144
|
-
private evaluateAmountThreshold;
|
|
145
|
-
/** Drop cached plan + token so the next startPlan() always mints fresh. */
|
|
146
|
-
reset(): void;
|
|
147
|
-
/** Inspect the currently held intent token (for debugging / audit). */
|
|
148
|
-
get currentToken(): IntentToken | null;
|
|
149
|
-
/** Current session mode ('local' default, 'proxy' opt-in). */
|
|
150
|
-
get currentMode(): SessionMode;
|
|
151
|
-
}
|
|
152
|
-
//# sourceMappingURL=session.d.ts.map
|
package/dist/session.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[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