@tangle-network/agent-runtime 0.76.0 → 0.78.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/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/{chunk-MRWXCFV5.js → chunk-OL2SEETC.js} +2 -2
- package/dist/{chunk-ZKMOIEOB.js → chunk-OLPH6W3J.js} +66 -24
- package/dist/chunk-OLPH6W3J.js.map +1 -0
- package/dist/{chunk-QKNBYHMK.js → chunk-QJ6BWENI.js} +3 -3
- package/dist/{chunk-SA5GCF2X.js → chunk-YHS6I2IS.js} +177 -24
- package/dist/chunk-YHS6I2IS.js.map +1 -0
- package/dist/{coordination-c_7Olmtq.d.ts → coordination-Csxsy39a.d.ts} +3 -3
- package/dist/index.d.ts +6 -6
- package/dist/index.js +4 -4
- package/dist/intelligence.d.ts +2 -2
- package/dist/{loop-runner-bin-Dbtg787n.d.ts → loop-runner-bin-BTMpf1oY.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +4 -4
- package/dist/loop-runner-bin.js +3 -3
- package/dist/loops.d.ts +189 -12
- package/dist/loops.js +8 -2
- package/dist/mcp/bin.js +1 -1
- package/dist/mcp/index.d.ts +7 -7
- package/dist/mcp/index.js +3 -3
- package/dist/{openai-tools-D5tcirFF.d.ts → openai-tools-B-3v06BE.d.ts} +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{router-client-C7kp_ECN.d.ts → router-client-CMAWGv1h.d.ts} +8 -0
- package/dist/{types-B-jWSfcu.d.ts → types-BF-MEsQB.d.ts} +21 -0
- package/dist/{worktree-CDxqwxGo.d.ts → worktree-DH_Y0brm.d.ts} +1 -1
- package/dist/{worktree-fanout-CljF1L2v.d.ts → worktree-fanout-DGC7jS7i.d.ts} +2 -2
- package/package.json +5 -8
- package/dist/chunk-SA5GCF2X.js.map +0 -1
- package/dist/chunk-ZKMOIEOB.js.map +0 -1
- /package/dist/{chunk-MRWXCFV5.js.map → chunk-OL2SEETC.js.map} +0 -0
- /package/dist/{chunk-QKNBYHMK.js.map → chunk-QJ6BWENI.js.map} +0 -0
package/dist/agent.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _tangle_network_agent_eval from '@tangle-network/agent-eval';
|
|
2
2
|
import { TraceAnalystKindSpec, AnalystFinding } from '@tangle-network/agent-eval';
|
|
3
3
|
import { A as ArtifactKind, C as CandidateGenerator, P as PromotionGate } from './generator-YkAQrOoD.js';
|
|
4
|
-
import { a as RuntimeStreamEvent, S as SandboxClient, b as OutputAdapter, A as AgentRunSpec } from './types-
|
|
4
|
+
import { a as RuntimeStreamEvent, S as SandboxClient, b as OutputAdapter, A as AgentRunSpec } from './types-BF-MEsQB.js';
|
|
5
5
|
import { A as AgentSurfaces } from './improvement-adapter-CioiEE2z.js';
|
|
6
6
|
export { C as CreateSurfaceImprovementAdapterOpts, D as DraftPatchInput, a as DraftPatchOutput, R as ResolvedSurface, S as SurfaceImprovementEdit, b as SurfaceValidationIssue, c as createSurfaceImprovementAdapter, r as renderSurfaceIssues, d as resolveSubjectPath, v as validateSurfaces } from './improvement-adapter-CioiEE2z.js';
|
|
7
7
|
import { K as KnowledgeAdapter, a as RunAnalystLoopResult } from './types-BC3bZpH0.js';
|
package/dist/agent.js
CHANGED
package/dist/analyst-loop.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TraceAnalystByteBudgets, TraceAnalysisStore } from '@tangle-network/agent-eval';
|
|
2
|
-
import { I as Iteration } from './types-
|
|
2
|
+
import { I as Iteration } from './types-BF-MEsQB.js';
|
|
3
3
|
import { R as RunAnalystLoopOpts, a as RunAnalystLoopResult } from './types-BC3bZpH0.js';
|
|
4
4
|
export { A as AnalystLoopEvent, b as AnalystRegistryLike, c as AnalystRegistryStreamingLike, d as AutoApplyPolicy, F as FindingsStoreLike, I as ImprovementAdapter, e as ImprovementEditBatch, f as ImprovementReport, K as KnowledgeAdapter, g as KnowledgeProposalBatch, h as KnowledgeReport } from './types-BC3bZpH0.js';
|
|
5
5
|
import '@tangle-network/sandbox';
|
|
@@ -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-OLPH6W3J.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-OL2SEETC.js.map
|
|
@@ -930,6 +930,20 @@ async function executeIteration(args) {
|
|
|
930
930
|
const events = [];
|
|
931
931
|
for await (const event of stream) {
|
|
932
932
|
events.push(event);
|
|
933
|
+
if (args.ctx.onSandboxEvent) {
|
|
934
|
+
try {
|
|
935
|
+
const observerEvent = cloneEventForObserver(event);
|
|
936
|
+
const result = args.ctx.onSandboxEvent(observerEvent, {
|
|
937
|
+
iterationIndex: args.item.index,
|
|
938
|
+
agentRunName: slot.agentRunName
|
|
939
|
+
});
|
|
940
|
+
if (result && typeof result.then === "function") {
|
|
941
|
+
void result.then(void 0, () => {
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
} catch {
|
|
945
|
+
}
|
|
946
|
+
}
|
|
933
947
|
const llmCall = extractLlmCallEvent(event, slot.agentRunName);
|
|
934
948
|
if (llmCall) {
|
|
935
949
|
slot.costUsd += llmCall.costUsd ?? 0;
|
|
@@ -1206,6 +1220,30 @@ async function emitTrace(emitter, event) {
|
|
|
1206
1220
|
if (!emitter) return;
|
|
1207
1221
|
await emitter.emit(event);
|
|
1208
1222
|
}
|
|
1223
|
+
function cloneEventForObserver(event) {
|
|
1224
|
+
try {
|
|
1225
|
+
return structuredClone(event);
|
|
1226
|
+
} catch {
|
|
1227
|
+
return copyPlainSpine(event, /* @__PURE__ */ new WeakMap());
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
function copyPlainSpine(value, seen) {
|
|
1231
|
+
if (value === null || typeof value !== "object") return value;
|
|
1232
|
+
const existing = seen.get(value);
|
|
1233
|
+
if (existing !== void 0) return existing;
|
|
1234
|
+
if (Array.isArray(value)) {
|
|
1235
|
+
const copy2 = [];
|
|
1236
|
+
seen.set(value, copy2);
|
|
1237
|
+
for (const item of value) copy2.push(copyPlainSpine(item, seen));
|
|
1238
|
+
return copy2;
|
|
1239
|
+
}
|
|
1240
|
+
const proto = Object.getPrototypeOf(value);
|
|
1241
|
+
if (proto !== Object.prototype && proto !== null) return {};
|
|
1242
|
+
const copy = {};
|
|
1243
|
+
seen.set(value, copy);
|
|
1244
|
+
for (const [key, v] of Object.entries(value)) copy[key] = copyPlainSpine(v, seen);
|
|
1245
|
+
return copy;
|
|
1246
|
+
}
|
|
1209
1247
|
function hashJson(value) {
|
|
1210
1248
|
let str;
|
|
1211
1249
|
try {
|
|
@@ -1737,19 +1775,19 @@ async function routerChatWithUsage(cfg, messages, opts) {
|
|
|
1737
1775
|
const url = `${cfg.routerBaseUrl.replace(/\/$/, "")}/chat/completions`;
|
|
1738
1776
|
const headers = { "content-type": "application/json", authorization: `Bearer ${cfg.routerKey}` };
|
|
1739
1777
|
let temperature = opts?.temperature ?? 0.2;
|
|
1778
|
+
const body = () => ({
|
|
1779
|
+
model: cfg.model,
|
|
1780
|
+
messages,
|
|
1781
|
+
temperature,
|
|
1782
|
+
max_tokens: opts?.maxTokens ?? 8192
|
|
1783
|
+
});
|
|
1784
|
+
if (cfg.complete) return parseChatResult(await cfg.complete(body()), cfg.model);
|
|
1740
1785
|
let lastErr = "";
|
|
1741
1786
|
for (let attempt = 0; attempt < 5; attempt += 1) {
|
|
1742
1787
|
const res = await fetch(url, {
|
|
1743
1788
|
method: "POST",
|
|
1744
1789
|
headers,
|
|
1745
|
-
|
|
1746
|
-
// reasoning_content first — a small router default yields EMPTY content.
|
|
1747
|
-
body: JSON.stringify({
|
|
1748
|
-
model: cfg.model,
|
|
1749
|
-
messages,
|
|
1750
|
-
temperature,
|
|
1751
|
-
max_tokens: opts?.maxTokens ?? 8192
|
|
1752
|
-
}),
|
|
1790
|
+
body: JSON.stringify(body()),
|
|
1753
1791
|
...opts?.signal ? { signal: opts.signal } : {}
|
|
1754
1792
|
});
|
|
1755
1793
|
if (res.ok) return parseChatResult(await res.json(), cfg.model);
|
|
@@ -1778,21 +1816,25 @@ function parseChatResult(json, model) {
|
|
|
1778
1816
|
};
|
|
1779
1817
|
}
|
|
1780
1818
|
async function routerChatWithTools(cfg, messages, tools, opts) {
|
|
1781
|
-
const
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1819
|
+
const body = {
|
|
1820
|
+
model: cfg.model,
|
|
1821
|
+
messages,
|
|
1822
|
+
tools,
|
|
1823
|
+
tool_choice: opts?.toolChoice ?? "auto",
|
|
1824
|
+
temperature: opts?.temperature ?? 0.3,
|
|
1825
|
+
...opts?.maxTokens ? { max_tokens: opts.maxTokens } : {}
|
|
1826
|
+
};
|
|
1827
|
+
const raw = cfg.complete ? await cfg.complete(body) : await (async () => {
|
|
1828
|
+
const res = await fetch(`${cfg.routerBaseUrl.replace(/\/$/, "")}/chat/completions`, {
|
|
1829
|
+
method: "POST",
|
|
1830
|
+
headers: { "content-type": "application/json", authorization: `Bearer ${cfg.routerKey}` },
|
|
1831
|
+
body: JSON.stringify(body),
|
|
1832
|
+
...opts?.signal ? { signal: opts.signal } : {}
|
|
1833
|
+
});
|
|
1834
|
+
if (!res.ok) throw new Error(`router ${res.status}: ${(await res.text()).slice(0, 200)}`);
|
|
1835
|
+
return res.json();
|
|
1836
|
+
})();
|
|
1837
|
+
const data = raw;
|
|
1796
1838
|
const msg = data.choices?.[0]?.message;
|
|
1797
1839
|
const toolCalls = (msg?.tool_calls ?? []).map((tc, i) => ({
|
|
1798
1840
|
id: tc.id ?? `call_${i}`,
|
|
@@ -6227,4 +6269,4 @@ export {
|
|
|
6227
6269
|
createInProcessTransport,
|
|
6228
6270
|
serveCoordinationMcp
|
|
6229
6271
|
};
|
|
6230
|
-
//# sourceMappingURL=chunk-
|
|
6272
|
+
//# sourceMappingURL=chunk-OLPH6W3J.js.map
|