@tangle-network/agent-runtime 0.80.1 → 0.81.1
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/dist/agent.js +3 -3
- package/dist/{chunk-CR5MQUYO.js → chunk-35WXYO26.js} +2 -2
- package/dist/{chunk-XRKP3XW3.js → chunk-BPS254IE.js} +2 -2
- package/dist/{chunk-XRKP3XW3.js.map → chunk-BPS254IE.js.map} +1 -1
- package/dist/{chunk-3RAXZ6LB.js → chunk-D6GIWPKD.js} +65 -195
- package/dist/chunk-D6GIWPKD.js.map +1 -0
- package/dist/{chunk-KELG3Z5H.js → chunk-EAGRBFQF.js} +2 -2
- package/dist/{chunk-KNZ54YYO.js → chunk-OUGNIHDZ.js} +3 -3
- package/dist/{chunk-3TAQW75Y.js → chunk-VHJDS6OR.js} +78 -15
- package/dist/chunk-VHJDS6OR.js.map +1 -0
- package/dist/index.js +5 -5
- package/dist/intelligence.js +1 -1
- package/dist/loop-runner-bin.js +4 -4
- package/dist/loops.d.ts +2 -19
- package/dist/loops.js +3 -5
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-3RAXZ6LB.js.map +0 -1
- package/dist/chunk-3TAQW75Y.js.map +0 -1
- /package/dist/{chunk-CR5MQUYO.js.map → chunk-35WXYO26.js.map} +0 -0
- /package/dist/{chunk-KELG3Z5H.js.map → chunk-EAGRBFQF.js.map} +0 -0
- /package/dist/{chunk-KNZ54YYO.js.map → chunk-OUGNIHDZ.js.map} +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
DELEGATION_STATUS_DESCRIPTION,
|
|
9
9
|
DELEGATION_STATUS_INPUT_SCHEMA,
|
|
10
10
|
DELEGATION_STATUS_TOOL_NAME
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-VHJDS6OR.js";
|
|
12
12
|
|
|
13
13
|
// src/mcp/openai-tools.ts
|
|
14
14
|
function buildTool(name, description, parameters) {
|
|
@@ -45,4 +45,4 @@ export {
|
|
|
45
45
|
mcpToolsForRuntimeMcp,
|
|
46
46
|
mcpToolsForRuntimeMcpSubset
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
48
|
+
//# sourceMappingURL=chunk-EAGRBFQF.js.map
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
definePersona,
|
|
6
6
|
runPersonified,
|
|
7
7
|
worktreeFanout
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-D6GIWPKD.js";
|
|
9
9
|
import {
|
|
10
10
|
createExecutorRegistry
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-VHJDS6OR.js";
|
|
12
12
|
import {
|
|
13
13
|
runAnalystLoop
|
|
14
14
|
} from "./chunk-C2FZ6GR6.js";
|
|
@@ -196,4 +196,4 @@ export {
|
|
|
196
196
|
runLoopRunnerCli,
|
|
197
197
|
parseLoopRunnerArgv
|
|
198
198
|
};
|
|
199
|
-
//# sourceMappingURL=chunk-
|
|
199
|
+
//# sourceMappingURL=chunk-OUGNIHDZ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildLoopSpanNodes
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BPS254IE.js";
|
|
4
4
|
import {
|
|
5
5
|
addTokenUsage,
|
|
6
6
|
deleteBoxSafe,
|
|
@@ -2174,6 +2174,9 @@ function linkSignals(a, b) {
|
|
|
2174
2174
|
// src/runtime/supervise/runtime.ts
|
|
2175
2175
|
import { spawn as spawn3 } from "child_process";
|
|
2176
2176
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
2177
|
+
import { request as httpRequest } from "http";
|
|
2178
|
+
import { request as httpsRequest } from "https";
|
|
2179
|
+
import { Readable } from "stream";
|
|
2177
2180
|
import { estimateCost as estimateCost2, isModelPriced as isModelPriced2 } from "@tangle-network/agent-eval";
|
|
2178
2181
|
var routerSeamKey = "router";
|
|
2179
2182
|
var sandboxSeamKey = "sandbox";
|
|
@@ -2623,8 +2626,20 @@ function killWithGrace(proc, grace) {
|
|
|
2623
2626
|
}, grace);
|
|
2624
2627
|
});
|
|
2625
2628
|
}
|
|
2629
|
+
function bridgeCellModel(seamModel, ctx) {
|
|
2630
|
+
const create = ctx.seams.createOptions;
|
|
2631
|
+
const backend = create?.backend;
|
|
2632
|
+
const harness = backend?.type;
|
|
2633
|
+
const model = backend?.model?.model;
|
|
2634
|
+
if (!harness && !model) return seamModel;
|
|
2635
|
+
const h = harness ?? "";
|
|
2636
|
+
const m = model ?? seamModel;
|
|
2637
|
+
if (!h) return m;
|
|
2638
|
+
return m.startsWith(`${h}/`) ? m : `${h}/${m}`;
|
|
2639
|
+
}
|
|
2626
2640
|
var bridgeExecutor = (spec, ctx) => {
|
|
2627
|
-
const
|
|
2641
|
+
const base = readSeam(ctx, bridgeSeamKey, "bridge");
|
|
2642
|
+
const seam = { ...base, model: bridgeCellModel(base.model, ctx) };
|
|
2628
2643
|
if (!seam.bridgeUrl || !seam.bridgeBearer || !seam.model) {
|
|
2629
2644
|
throw new ValidationError(
|
|
2630
2645
|
"bridgeExecutor: BridgeSeam.bridgeUrl + bridgeBearer + model required"
|
|
@@ -2673,7 +2688,6 @@ var bridgeExecutor = (spec, ctx) => {
|
|
|
2673
2688
|
async function* streamBridgeSession(args) {
|
|
2674
2689
|
const { seam, inbox } = args;
|
|
2675
2690
|
const started = Date.now();
|
|
2676
|
-
const url = `${seam.bridgeUrl.replace(/\/$/, "")}/v1/chat/completions`;
|
|
2677
2691
|
const external = mergeAbortSignals(args.signal, args.controller.signal);
|
|
2678
2692
|
const tokens = zeroTokenUsage();
|
|
2679
2693
|
let usd = 0;
|
|
@@ -2710,21 +2724,17 @@ ${folded}` : folded;
|
|
|
2710
2724
|
};
|
|
2711
2725
|
let res;
|
|
2712
2726
|
try {
|
|
2713
|
-
res = await
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
authorization: `Bearer ${seam.bridgeBearer}`,
|
|
2718
|
-
"x-session-id": args.sessionId
|
|
2719
|
-
},
|
|
2720
|
-
body: JSON.stringify({
|
|
2727
|
+
res = await bridgeStreamPost(seam.bridgeUrl, {
|
|
2728
|
+
bearer: seam.bridgeBearer,
|
|
2729
|
+
sessionId: args.sessionId,
|
|
2730
|
+
body: {
|
|
2721
2731
|
model: seam.model,
|
|
2722
2732
|
stream: true,
|
|
2723
2733
|
session_id: args.sessionId,
|
|
2724
2734
|
...seam.cwd ? { cwd: seam.cwd } : {},
|
|
2725
2735
|
...seam.agentProfile ? { agent_profile: seam.agentProfile } : {},
|
|
2726
2736
|
messages
|
|
2727
|
-
}
|
|
2737
|
+
},
|
|
2728
2738
|
signal: turnController.signal
|
|
2729
2739
|
});
|
|
2730
2740
|
} catch (e) {
|
|
@@ -2781,6 +2791,59 @@ ${folded}` : folded;
|
|
|
2781
2791
|
spent
|
|
2782
2792
|
});
|
|
2783
2793
|
}
|
|
2794
|
+
function bridgeStreamPost(url, args) {
|
|
2795
|
+
const target = new URL(`${url.replace(/\/$/, "")}/v1/chat/completions`);
|
|
2796
|
+
const payload = JSON.stringify(args.body);
|
|
2797
|
+
const requestFn = target.protocol === "https:" ? httpsRequest : httpRequest;
|
|
2798
|
+
return new Promise((resolve, reject) => {
|
|
2799
|
+
if (args.signal.aborted) {
|
|
2800
|
+
reject(new DOMException("bridgeExecutor: aborted before request", "AbortError"));
|
|
2801
|
+
return;
|
|
2802
|
+
}
|
|
2803
|
+
const req = requestFn(
|
|
2804
|
+
target,
|
|
2805
|
+
{
|
|
2806
|
+
method: "POST",
|
|
2807
|
+
headers: {
|
|
2808
|
+
"content-type": "application/json",
|
|
2809
|
+
authorization: `Bearer ${args.bearer}`,
|
|
2810
|
+
"x-session-id": args.sessionId,
|
|
2811
|
+
"content-length": Buffer.byteLength(payload)
|
|
2812
|
+
},
|
|
2813
|
+
// No header/body idle timeout: a slow bridge is a live bridge; the abort
|
|
2814
|
+
// signal is the sole deadline.
|
|
2815
|
+
timeout: 0
|
|
2816
|
+
},
|
|
2817
|
+
(res) => {
|
|
2818
|
+
const status = res.statusCode ?? 0;
|
|
2819
|
+
const ok = status >= 200 && status < 300;
|
|
2820
|
+
const body = Readable.toWeb(res);
|
|
2821
|
+
resolve({
|
|
2822
|
+
ok,
|
|
2823
|
+
status,
|
|
2824
|
+
body,
|
|
2825
|
+
text: async () => {
|
|
2826
|
+
const chunks = [];
|
|
2827
|
+
for await (const c of res) chunks.push(c);
|
|
2828
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
2829
|
+
}
|
|
2830
|
+
});
|
|
2831
|
+
}
|
|
2832
|
+
);
|
|
2833
|
+
const onAbort = () => {
|
|
2834
|
+
req.destroy(new DOMException("bridgeExecutor: turn aborted", "AbortError"));
|
|
2835
|
+
};
|
|
2836
|
+
if (args.signal.aborted) onAbort();
|
|
2837
|
+
else args.signal.addEventListener("abort", onAbort, { once: true });
|
|
2838
|
+
req.on("error", (e) => {
|
|
2839
|
+
args.signal.removeEventListener("abort", onAbort);
|
|
2840
|
+
reject(e);
|
|
2841
|
+
});
|
|
2842
|
+
req.on("close", () => args.signal.removeEventListener("abort", onAbort));
|
|
2843
|
+
req.write(payload);
|
|
2844
|
+
req.end();
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2784
2847
|
async function* parseSseChatStream(body) {
|
|
2785
2848
|
const reader = body.getReader();
|
|
2786
2849
|
const decoder = new TextDecoder();
|
|
@@ -5360,7 +5423,7 @@ import { createServer } from "http";
|
|
|
5360
5423
|
|
|
5361
5424
|
// src/mcp/server.ts
|
|
5362
5425
|
import { createInterface } from "readline";
|
|
5363
|
-
import { Readable, Writable } from "stream";
|
|
5426
|
+
import { Readable as Readable2, Writable } from "stream";
|
|
5364
5427
|
|
|
5365
5428
|
// src/runtime/supervise/supervise.ts
|
|
5366
5429
|
function workerFromBackend(backend, deliverable) {
|
|
@@ -6248,7 +6311,7 @@ function writeResponse(output, response) {
|
|
|
6248
6311
|
}
|
|
6249
6312
|
function createInProcessTransport() {
|
|
6250
6313
|
const responses = [];
|
|
6251
|
-
const input = new
|
|
6314
|
+
const input = new Readable2({ read() {
|
|
6252
6315
|
} });
|
|
6253
6316
|
const output = new Writable({
|
|
6254
6317
|
write(chunk, _enc, cb) {
|
|
@@ -6527,4 +6590,4 @@ export {
|
|
|
6527
6590
|
createInProcessTransport,
|
|
6528
6591
|
serveCoordinationMcp
|
|
6529
6592
|
};
|
|
6530
|
-
//# sourceMappingURL=chunk-
|
|
6593
|
+
//# sourceMappingURL=chunk-VHJDS6OR.js.map
|