@tangle-network/agent-runtime 0.80.0 → 0.80.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-QSO2TVDS.js → chunk-3RAXZ6LB.js} +69 -20
- package/dist/chunk-3RAXZ6LB.js.map +1 -0
- package/dist/{chunk-TPII5AU7.js → chunk-3TAQW75Y.js} +2 -2
- package/dist/{chunk-M3Y362RW.js → chunk-CR5MQUYO.js} +2 -2
- package/dist/{chunk-LLJRUTE7.js → chunk-KELG3Z5H.js} +2 -2
- package/dist/{chunk-DH72UOYR.js → chunk-KNZ54YYO.js} +3 -3
- package/dist/{chunk-3X53HYRW.js → chunk-XRKP3XW3.js} +2 -2
- package/dist/{chunk-3X53HYRW.js.map → chunk-XRKP3XW3.js.map} +1 -1
- package/dist/index.js +5 -5
- package/dist/intelligence.js +1 -1
- package/dist/loop-runner-bin.js +4 -4
- package/dist/loops.js +3 -3
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-QSO2TVDS.js.map +0 -1
- /package/dist/{chunk-TPII5AU7.js.map → chunk-3TAQW75Y.js.map} +0 -0
- /package/dist/{chunk-M3Y362RW.js.map → chunk-CR5MQUYO.js.map} +0 -0
- /package/dist/{chunk-LLJRUTE7.js.map → chunk-KELG3Z5H.js.map} +0 -0
- /package/dist/{chunk-DH72UOYR.js.map → chunk-KNZ54YYO.js.map} +0 -0
package/dist/agent.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-3RAXZ6LB.js";
|
|
2
2
|
import {
|
|
3
3
|
createSandboxForSpec
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-3TAQW75Y.js";
|
|
5
|
+
import "./chunk-XRKP3XW3.js";
|
|
6
6
|
import "./chunk-H7IBHAFT.js";
|
|
7
7
|
import {
|
|
8
8
|
mapSandboxEvent
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
settledToIteration,
|
|
15
15
|
supervise,
|
|
16
16
|
withDriverExecutor
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3TAQW75Y.js";
|
|
18
18
|
import {
|
|
19
19
|
addTokenUsage,
|
|
20
20
|
isAbortError,
|
|
@@ -555,6 +555,10 @@ ${rows}
|
|
|
555
555
|
</body></html>`;
|
|
556
556
|
}
|
|
557
557
|
|
|
558
|
+
// src/runtime/cli-bridge-sandbox-client.ts
|
|
559
|
+
import { request as httpRequest } from "http";
|
|
560
|
+
import { request as httpsRequest } from "https";
|
|
561
|
+
|
|
558
562
|
// src/runtime/inline-sandbox-client.ts
|
|
559
563
|
function isAsyncIterable(v) {
|
|
560
564
|
return typeof v === "object" && v !== null && Symbol.asyncIterator in v;
|
|
@@ -635,25 +639,70 @@ function resolveTarget(cfg, createOptions) {
|
|
|
635
639
|
);
|
|
636
640
|
return { harness, model };
|
|
637
641
|
}
|
|
638
|
-
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
signal
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
642
|
+
function bridgePost(url, bearer, bridgeModel, prompt, signal) {
|
|
643
|
+
const target = new URL(`${url.replace(/\/$/, "")}/v1/chat/completions`);
|
|
644
|
+
const body = JSON.stringify({ model: bridgeModel, messages: [{ role: "user", content: prompt }] });
|
|
645
|
+
const requestFn = target.protocol === "https:" ? httpsRequest : httpRequest;
|
|
646
|
+
return new Promise((resolve, reject) => {
|
|
647
|
+
if (signal.aborted) {
|
|
648
|
+
reject(new Error(`cli-bridge ${bridgeModel}: aborted before request`));
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
const req = requestFn(
|
|
652
|
+
target,
|
|
653
|
+
{
|
|
654
|
+
method: "POST",
|
|
655
|
+
headers: {
|
|
656
|
+
"content-type": "application/json",
|
|
657
|
+
authorization: `Bearer ${bearer}`,
|
|
658
|
+
"content-length": Buffer.byteLength(body)
|
|
659
|
+
},
|
|
660
|
+
// No header/body idle timeout: a slow bridge is a live bridge; the abort
|
|
661
|
+
// signal is the sole deadline.
|
|
662
|
+
timeout: 0
|
|
663
|
+
},
|
|
664
|
+
(res) => {
|
|
665
|
+
const chunks = [];
|
|
666
|
+
res.on("data", (c) => chunks.push(c));
|
|
667
|
+
res.on("end", () => {
|
|
668
|
+
const text = Buffer.concat(chunks).toString("utf8");
|
|
669
|
+
const status = res.statusCode ?? 0;
|
|
670
|
+
if (status < 200 || status >= 300) {
|
|
671
|
+
reject(new Error(`cli-bridge ${bridgeModel}: HTTP ${status} ${text.slice(0, 300)}`));
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
let j;
|
|
675
|
+
try {
|
|
676
|
+
j = JSON.parse(text);
|
|
677
|
+
} catch {
|
|
678
|
+
reject(new Error(`cli-bridge ${bridgeModel}: non-JSON body ${text.slice(0, 300)}`));
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
if (j.error) {
|
|
682
|
+
reject(new Error(`cli-bridge ${bridgeModel}: ${j.error.message}`));
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
resolve({
|
|
686
|
+
content: j.choices?.[0]?.message?.content ?? "",
|
|
687
|
+
input: j.usage?.prompt_tokens ?? 0,
|
|
688
|
+
output: j.usage?.completion_tokens ?? 0
|
|
689
|
+
});
|
|
690
|
+
});
|
|
691
|
+
}
|
|
648
692
|
);
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
693
|
+
const onAbort = () => {
|
|
694
|
+
req.destroy(
|
|
695
|
+
new Error(
|
|
696
|
+
`cli-bridge ${bridgeModel}: aborted (${BRIDGE_TIMEOUT_MS}ms deadline or upstream cancel)`
|
|
697
|
+
)
|
|
698
|
+
);
|
|
699
|
+
};
|
|
700
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
701
|
+
req.on("error", (e) => reject(new Error(`cli-bridge ${bridgeModel}: ${e.message}`)));
|
|
702
|
+
req.on("close", () => signal.removeEventListener("abort", onAbort));
|
|
703
|
+
req.write(body);
|
|
704
|
+
req.end();
|
|
705
|
+
});
|
|
657
706
|
}
|
|
658
707
|
function cliBridgeSandboxClient(cfg) {
|
|
659
708
|
if (!cfg.bearer) throw new Error("cliBridgeSandboxClient: bearer is required");
|
|
@@ -4785,4 +4834,4 @@ export {
|
|
|
4785
4834
|
computeFindingId,
|
|
4786
4835
|
makeFinding2 as makeFinding
|
|
4787
4836
|
};
|
|
4788
|
-
//# sourceMappingURL=chunk-
|
|
4837
|
+
//# sourceMappingURL=chunk-3RAXZ6LB.js.map
|