@tangle-network/agent-runtime 0.52.0 → 0.54.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.
- package/README.md +27 -16
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +5 -3
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/analyst-loop.js +2 -2
- package/dist/{chunk-COAVO6QB.js → chunk-2BDXWZUC.js} +5 -34
- package/dist/chunk-2BDXWZUC.js.map +1 -0
- package/dist/chunk-A73RADPB.js +281 -0
- package/dist/chunk-A73RADPB.js.map +1 -0
- package/dist/chunk-FRBWCJLP.js +396 -0
- package/dist/chunk-FRBWCJLP.js.map +1 -0
- package/dist/chunk-GRAGM4MC.js +72 -0
- package/dist/chunk-GRAGM4MC.js.map +1 -0
- package/dist/{chunk-2OU7ZQPD.js → chunk-JTH2FPCK.js} +3248 -456
- package/dist/chunk-JTH2FPCK.js.map +1 -0
- package/dist/{chunk-V2K35HF2.js → chunk-KJH62YEK.js} +2 -2
- package/dist/{chunk-HNUXAZIJ.js → chunk-P5OKDSLB.js} +2 -2
- package/dist/{chunk-GSUO5QS6.js → chunk-VLF5RHEQ.js} +2 -5
- package/dist/{chunk-GSUO5QS6.js.map → chunk-VLF5RHEQ.js.map} +1 -1
- package/dist/{chunk-7JITYN6T.js → chunk-XRYEZPR6.js} +18 -2
- package/dist/chunk-XRYEZPR6.js.map +1 -0
- package/dist/{coder-_YCf3BAK.d.ts → coder-CEkUFv8h.d.ts} +1 -1
- package/dist/{types-5MGt5KTY.d.ts → coordination-BMzskrUR.d.ts} +268 -2
- package/dist/{kb-gate-CHAyt4aI.d.ts → delegates-BPLIl8EC.d.ts} +491 -566
- package/dist/{delegation-profile-1GbW5yA3.d.ts → delegation-profile-Bvfro2m1.d.ts} +28 -2
- package/dist/index.d.ts +7 -7
- package/dist/index.js +25 -80
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +475 -5
- package/dist/intelligence.js +547 -3
- package/dist/intelligence.js.map +1 -1
- package/dist/kb-gate-CuzMYGYM.d.ts +76 -0
- package/dist/{loop-runner-bin-DFUNgpeK.d.ts → loop-runner-bin-BGpVVyXp.d.ts} +6 -27
- package/dist/loop-runner-bin.d.ts +5 -5
- package/dist/loop-runner-bin.js +6 -5
- package/dist/loops.d.ts +8 -5
- package/dist/loops.js +32 -8
- package/dist/mcp/bin.js +94 -30
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +10 -273
- package/dist/mcp/index.js +45 -365
- package/dist/mcp/index.js.map +1 -1
- package/dist/{openai-tools-D4HLDWgw.d.ts → openai-tools-CoeLQ7Uo.d.ts} +1 -1
- package/dist/profiles.d.ts +2 -2
- package/dist/profiles.js +4 -4
- package/dist/router-client-30Y_pca8.d.ts +120 -0
- package/dist/{run-loop-BIineL1T.d.ts → run-loop-DluzfJ2h.d.ts} +1 -1
- package/dist/runtime.d.ts +429 -131
- package/dist/runtime.js +32 -8
- package/dist/topology.d.ts +54 -1
- package/dist/topology.js +222 -0
- package/dist/topology.js.map +1 -1
- package/dist/{types-BEQsBhOE.d.ts → types-C8rNlxfV.d.ts} +6 -5
- package/dist/workflow.d.ts +2 -2
- package/dist/workflow.js +4 -2
- package/dist/workflow.js.map +1 -1
- package/package.json +5 -5
- package/skills/agent-runtime-adoption/SKILL.md +54 -46
- package/skills/build-with-agent-runtime/SKILL.md +12 -8
- package/skills/loop-writer/SKILL.md +9 -1
- package/skills/supervise/SKILL.md +24 -0
- package/dist/chunk-2OU7ZQPD.js.map +0 -1
- package/dist/chunk-4JI4BCBI.js +0 -623
- package/dist/chunk-4JI4BCBI.js.map +0 -1
- package/dist/chunk-7JITYN6T.js.map +0 -1
- package/dist/chunk-7SP2OVYZ.js +0 -908
- package/dist/chunk-7SP2OVYZ.js.map +0 -1
- package/dist/chunk-BERLUBAP.js +0 -1356
- package/dist/chunk-BERLUBAP.js.map +0 -1
- package/dist/chunk-COAVO6QB.js.map +0 -1
- package/dist/driver-DLI1io57.d.ts +0 -221
- /package/dist/{chunk-V2K35HF2.js.map → chunk-KJH62YEK.js.map} +0 -0
- /package/dist/{chunk-HNUXAZIJ.js.map → chunk-P5OKDSLB.js.map} +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one router chat client: direct OpenAI-compatible completions through the
|
|
3
|
+
* Tangle router — the cheapest dial, no sandbox. Three layers: `routerChatWithUsage`
|
|
4
|
+
* (chat-only), `routerChatWithTools` (one completion with function tools), and
|
|
5
|
+
* `routerToolLoop` (the off-box agentic loop over tool-calling). Shared by the
|
|
6
|
+
* built-in executors and the bench/lab harnesses.
|
|
7
|
+
*
|
|
8
|
+
* Reports REAL token usage so the backend-integrity guard sees a real backend.
|
|
9
|
+
* Returns `undefined` usage when the provider omitted it — never a fabricated 0
|
|
10
|
+
* (a phantom 0 reads as a free call downstream, which the gate would act on).
|
|
11
|
+
*/
|
|
12
|
+
interface RouterConfig {
|
|
13
|
+
routerBaseUrl: string;
|
|
14
|
+
routerKey: string;
|
|
15
|
+
model: string;
|
|
16
|
+
}
|
|
17
|
+
interface RouterChatResult {
|
|
18
|
+
content: string;
|
|
19
|
+
/** REAL usage, or undefined when the provider reported none. */
|
|
20
|
+
usage?: {
|
|
21
|
+
input: number;
|
|
22
|
+
output: number;
|
|
23
|
+
};
|
|
24
|
+
/** Derived from usage via `estimateCost` when the model is priced; else undefined. */
|
|
25
|
+
costUsd?: number;
|
|
26
|
+
}
|
|
27
|
+
declare function routerChatWithUsage(cfg: RouterConfig, messages: Array<{
|
|
28
|
+
role: string;
|
|
29
|
+
content: string;
|
|
30
|
+
}>, opts?: {
|
|
31
|
+
temperature?: number;
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
maxTokens?: number;
|
|
34
|
+
}): Promise<RouterChatResult>;
|
|
35
|
+
/** A tool-call the model emitted (provider-neutral; mirrors the runtime's ToolCallRequest). */
|
|
36
|
+
interface RouterToolCall {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
/** Raw JSON arguments string as emitted by the model. */
|
|
40
|
+
arguments: string;
|
|
41
|
+
}
|
|
42
|
+
interface RouterChatToolsResult {
|
|
43
|
+
content: string | null;
|
|
44
|
+
toolCalls: RouterToolCall[];
|
|
45
|
+
usage?: {
|
|
46
|
+
input: number;
|
|
47
|
+
output: number;
|
|
48
|
+
};
|
|
49
|
+
costUsd?: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A router completion WITH tool-calling — the operator driver's LLM seam. Passes OpenAI-shape
|
|
53
|
+
* `messages` (system/user/assistant-with-tool_calls/tool roles) + function `tools`, and returns the
|
|
54
|
+
* assistant text plus the tool calls the model wants run. Same fail-loud + real-usage discipline as
|
|
55
|
+
* `routerChatWithUsage`. `tool_choice: 'auto'` lets the model decide; the driver loops on the result.
|
|
56
|
+
*/
|
|
57
|
+
declare function routerChatWithTools(cfg: RouterConfig, messages: ReadonlyArray<Record<string, unknown>>, tools: ReadonlyArray<{
|
|
58
|
+
type: 'function';
|
|
59
|
+
function: {
|
|
60
|
+
name: string;
|
|
61
|
+
description?: string;
|
|
62
|
+
parameters: unknown;
|
|
63
|
+
};
|
|
64
|
+
}>, opts?: {
|
|
65
|
+
temperature?: number;
|
|
66
|
+
signal?: AbortSignal;
|
|
67
|
+
toolChoice?: 'auto' | 'required' | 'none';
|
|
68
|
+
maxTokens?: number;
|
|
69
|
+
}): Promise<RouterChatToolsResult>;
|
|
70
|
+
interface ToolSpec {
|
|
71
|
+
type: 'function';
|
|
72
|
+
function: {
|
|
73
|
+
name: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
parameters: unknown;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
interface RouterToolLoopResult {
|
|
79
|
+
/** The model's final assistant text (the turn where it stopped calling tools, or the budget turn). */
|
|
80
|
+
final: string;
|
|
81
|
+
/** Inference turns spent (≤ maxTurns) — the equal-budget unit vs random@k. */
|
|
82
|
+
turns: number;
|
|
83
|
+
toolCalls: number;
|
|
84
|
+
/** The behavior trace: each tool call + its result, in order. What a trace-analyst
|
|
85
|
+
* steerer reads (behavior, never the verdict) to diagnose + redirect the next shot. */
|
|
86
|
+
toolTrace: Array<{
|
|
87
|
+
name: string;
|
|
88
|
+
args: string;
|
|
89
|
+
result: string;
|
|
90
|
+
}>;
|
|
91
|
+
usage: {
|
|
92
|
+
input: number;
|
|
93
|
+
output: number;
|
|
94
|
+
};
|
|
95
|
+
/** The full conversation after the loop (seed + every assistant/tool turn). Lets a caller
|
|
96
|
+
* CARRY the messages into the next shot (depth continuation) and read the trajectory. */
|
|
97
|
+
messages: Array<Record<string, unknown>>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The tool-using router backend: a real agentic loop OVER the Tangle router (which
|
|
101
|
+
* supports tool-calling), off-box — no sandbox. Each turn is one router completion
|
|
102
|
+
* with `tools`; if the model emits tool_calls, `execute` runs them on the host and
|
|
103
|
+
* their results are folded back as `tool` messages; the loop repeats until the
|
|
104
|
+
* model answers without a tool call or the turn budget is hit. One turn = one
|
|
105
|
+
* inference call, so `maxTurns` is the equal-compute unit against random@k.
|
|
106
|
+
*
|
|
107
|
+
* This is the depth substrate for agentic gates (the worker ACTS, observes the real
|
|
108
|
+
* result, and continues) that the chat-only `routerChatWithUsage` cannot express.
|
|
109
|
+
*/
|
|
110
|
+
declare function routerToolLoop(cfg: RouterConfig, system: string, user: string, tools: ReadonlyArray<ToolSpec>, execute: (name: string, args: Record<string, unknown>) => Promise<string>, opts?: {
|
|
111
|
+
maxTurns?: number;
|
|
112
|
+
temperature?: number;
|
|
113
|
+
signal?: AbortSignal;
|
|
114
|
+
maxTokens?: number;
|
|
115
|
+
/** Seed the loop with an existing conversation (depth continuation) instead of
|
|
116
|
+
* `[system, user]`. When set, `system`/`user` are ignored. The array is copied. */
|
|
117
|
+
initialMessages?: ReadonlyArray<Record<string, unknown>>;
|
|
118
|
+
}): Promise<RouterToolLoopResult>;
|
|
119
|
+
|
|
120
|
+
export { type RouterConfig as R, type ToolSpec as T, type RouterChatResult as a, type RouterChatToolsResult as b, type RouterToolCall as c, type RouterToolLoopResult as d, routerChatWithUsage as e, routerToolLoop as f, routerChatWithTools as r };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SandboxInstance } from '@tangle-network/sandbox';
|
|
2
|
-
import { D as Driver, A as AgentRunSpec, O as OutputAdapter, V as Validator, E as ExecCtx, I as Iteration, L as LoopWinner, a as LoopLineageOptions, S as SandboxClient, b as LoopResult } from './types-
|
|
2
|
+
import { D as Driver, A as AgentRunSpec, O as OutputAdapter, V as Validator, E as ExecCtx, I as Iteration, L as LoopWinner, a as LoopLineageOptions, S as SandboxClient, b as LoopResult } from './types-C8rNlxfV.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @experimental
|