@armoriq/sdk-dev 0.2.12 → 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.
- package/README.md +3 -3
- package/dist/_build_env.d.ts +33 -0
- package/dist/_build_env.d.ts.map +1 -0
- package/dist/_build_env.js +47 -0
- package/dist/_build_env.js.map +1 -0
- package/dist/client.d.ts +0 -30
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +52 -123
- package/dist/client.js.map +1 -1
- package/dist/credentials.d.ts +12 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +81 -0
- package/dist/credentials.js.map +1 -0
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -9
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +0 -36
- package/dist/models.d.ts.map +1 -1
- package/package.json +1 -45
- 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 -64
- package/dist/integrations/google-adk.d.ts.map +0 -1
- package/dist/integrations/google-adk.js +0 -170
- 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 -50
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -93
- package/dist/session.js.map +0 -1
package/dist/session.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ArmorIQSession — collapses the four-step framework-integration
|
|
4
|
-
* pattern into two calls.
|
|
5
|
-
*
|
|
6
|
-
* await session.startPlan(toolCalls) // capture plan + mint token
|
|
7
|
-
* return session.dispatch(toolName, args) // route through proxy
|
|
8
|
-
*
|
|
9
|
-
* Each framework adapter (ADK, LangChain, OpenAI Agents, Vercel AI
|
|
10
|
-
* SDK, etc.) wires its own hooks into these two methods and never has
|
|
11
|
-
* to think about plan shape, token threading, or cred-mode handling.
|
|
12
|
-
*/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.ArmorIQSession = void 0;
|
|
15
|
-
const plan_builder_1 = require("./plan-builder");
|
|
16
|
-
class ArmorIQSession {
|
|
17
|
-
client;
|
|
18
|
-
toolNameParser;
|
|
19
|
-
defaultMcpName;
|
|
20
|
-
validitySeconds;
|
|
21
|
-
llm;
|
|
22
|
-
currentPlanHash = null;
|
|
23
|
-
currentTokenValue = null;
|
|
24
|
-
mcpByAction = new Map();
|
|
25
|
-
constructor(client, opts = {}) {
|
|
26
|
-
this.client = client;
|
|
27
|
-
this.defaultMcpName = opts.defaultMcpName;
|
|
28
|
-
this.toolNameParser =
|
|
29
|
-
opts.toolNameParser ?? (0, plan_builder_1.defaultToolNameParser)(this.defaultMcpName);
|
|
30
|
-
this.validitySeconds = opts.validitySeconds ?? 3600;
|
|
31
|
-
this.llm = opts.llm ?? 'agent';
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Capture a plan from the LLM's tool calls and mint an intent token.
|
|
35
|
-
* Idempotent: if called again with the same tool-calls list (by SHA),
|
|
36
|
-
* skips the mint and returns the cached token.
|
|
37
|
-
*/
|
|
38
|
-
async startPlan(toolCalls, opts = {}) {
|
|
39
|
-
if (toolCalls.length === 0) {
|
|
40
|
-
throw new Error('startPlan called with no tool calls.');
|
|
41
|
-
}
|
|
42
|
-
const hash = (0, plan_builder_1.hashToolCalls)(toolCalls);
|
|
43
|
-
if (this.currentTokenValue && this.currentPlanHash === hash) {
|
|
44
|
-
return this.currentTokenValue;
|
|
45
|
-
}
|
|
46
|
-
const plan = (0, plan_builder_1.buildPlanFromToolCalls)(toolCalls, {
|
|
47
|
-
goal: opts.goal,
|
|
48
|
-
toolNameParser: this.toolNameParser,
|
|
49
|
-
defaultMcpName: this.defaultMcpName,
|
|
50
|
-
});
|
|
51
|
-
// Remember each action's MCP so dispatch() can resolve it without
|
|
52
|
-
// re-parsing the framework's tool name (which may differ).
|
|
53
|
-
this.mcpByAction.clear();
|
|
54
|
-
for (const step of plan.steps) {
|
|
55
|
-
this.mcpByAction.set(step.action, step.mcp);
|
|
56
|
-
}
|
|
57
|
-
const planCapture = this.client.capturePlan(this.llm, opts.goal ?? this.llm, plan);
|
|
58
|
-
const token = await this.client.getIntentToken(planCapture, undefined, this.validitySeconds);
|
|
59
|
-
this.currentPlanHash = hash;
|
|
60
|
-
this.currentTokenValue = token;
|
|
61
|
-
return token;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Route a tool call through the Armoriq proxy.
|
|
65
|
-
* Returns the raw `result` field so the framework can short-circuit
|
|
66
|
-
* its native dispatch by returning this value directly.
|
|
67
|
-
*/
|
|
68
|
-
async dispatch(toolName, toolArgs) {
|
|
69
|
-
if (!this.currentTokenValue) {
|
|
70
|
-
throw new Error(`dispatch("${toolName}") called before startPlan(). ` +
|
|
71
|
-
'Call startPlan(toolCalls) in your after-model hook first.');
|
|
72
|
-
}
|
|
73
|
-
const { mcp, action } = this.toolNameParser(toolName);
|
|
74
|
-
// Prefer the MCP recorded at plan-capture time when available — this
|
|
75
|
-
// covers cases where the framework hands us a slightly different
|
|
76
|
-
// tool name shape than what we parsed off the LLM response.
|
|
77
|
-
const resolvedMcp = this.mcpByAction.get(action) ?? mcp;
|
|
78
|
-
const result = await this.client.invoke(resolvedMcp, action, this.currentTokenValue, toolArgs);
|
|
79
|
-
return result.result;
|
|
80
|
-
}
|
|
81
|
-
/** Drop cached plan + token so the next startPlan() always mints fresh. */
|
|
82
|
-
reset() {
|
|
83
|
-
this.currentPlanHash = null;
|
|
84
|
-
this.currentTokenValue = null;
|
|
85
|
-
this.mcpByAction.clear();
|
|
86
|
-
}
|
|
87
|
-
/** Inspect the currently held intent token (for debugging / audit). */
|
|
88
|
-
get currentToken() {
|
|
89
|
-
return this.currentTokenValue;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.ArmorIQSession = ArmorIQSession;
|
|
93
|
-
//# sourceMappingURL=session.js.map
|
package/dist/session.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAIH,iDAKwB;AASxB,MAAa,cAAc;IACjB,MAAM,CAAgB;IACtB,cAAc,CAAiB;IAC/B,cAAc,CAAU;IACxB,eAAe,CAAS;IACxB,GAAG,CAAS;IAEZ,eAAe,GAAkB,IAAI,CAAC;IACtC,iBAAiB,GAAuB,IAAI,CAAC;IAC7C,WAAW,GAAwB,IAAI,GAAG,EAAE,CAAC;IAErD,YAAY,MAAqB,EAAE,OAAuB,EAAE;QAC1D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,IAAI,CAAC,cAAc;YACjB,IAAI,CAAC,cAAc,IAAI,IAAA,oCAAqB,EAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACpE,IAAI,CAAC,eAAe,GAAG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