@tangle-network/agent-runtime 0.75.1 → 0.77.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.
@@ -5,10 +5,10 @@ import {
5
5
  definePersona,
6
6
  runPersonified,
7
7
  worktreeFanout
8
- } from "./chunk-SA5GCF2X.js";
8
+ } from "./chunk-CEW5BMGN.js";
9
9
  import {
10
10
  createExecutorRegistry
11
- } from "./chunk-ZKMOIEOB.js";
11
+ } from "./chunk-RQYPH2QE.js";
12
12
  import {
13
13
  runAnalystLoop
14
14
  } from "./chunk-IODKUOBA.js";
@@ -196,4 +196,4 @@ export {
196
196
  runLoopRunnerCli,
197
197
  parseLoopRunnerArgv
198
198
  };
199
- //# sourceMappingURL=chunk-QKNBYHMK.js.map
199
+ //# sourceMappingURL=chunk-KKHMDE5I.js.map
@@ -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-ZKMOIEOB.js";
11
+ } from "./chunk-RQYPH2QE.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-MRWXCFV5.js.map
48
+ //# sourceMappingURL=chunk-LFL7K5FM.js.map
@@ -1737,19 +1737,19 @@ async function routerChatWithUsage(cfg, messages, opts) {
1737
1737
  const url = `${cfg.routerBaseUrl.replace(/\/$/, "")}/chat/completions`;
1738
1738
  const headers = { "content-type": "application/json", authorization: `Bearer ${cfg.routerKey}` };
1739
1739
  let temperature = opts?.temperature ?? 0.2;
1740
+ const body = () => ({
1741
+ model: cfg.model,
1742
+ messages,
1743
+ temperature,
1744
+ max_tokens: opts?.maxTokens ?? 8192
1745
+ });
1746
+ if (cfg.complete) return parseChatResult(await cfg.complete(body()), cfg.model);
1740
1747
  let lastErr = "";
1741
1748
  for (let attempt = 0; attempt < 5; attempt += 1) {
1742
1749
  const res = await fetch(url, {
1743
1750
  method: "POST",
1744
1751
  headers,
1745
- // max_tokens default is generous: THINKING models (kimi-k2.6) spend the budget on
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
- }),
1752
+ body: JSON.stringify(body()),
1753
1753
  ...opts?.signal ? { signal: opts.signal } : {}
1754
1754
  });
1755
1755
  if (res.ok) return parseChatResult(await res.json(), cfg.model);
@@ -1778,21 +1778,25 @@ function parseChatResult(json, model) {
1778
1778
  };
1779
1779
  }
1780
1780
  async function routerChatWithTools(cfg, messages, tools, opts) {
1781
- const res = await fetch(`${cfg.routerBaseUrl.replace(/\/$/, "")}/chat/completions`, {
1782
- method: "POST",
1783
- headers: { "content-type": "application/json", authorization: `Bearer ${cfg.routerKey}` },
1784
- body: JSON.stringify({
1785
- model: cfg.model,
1786
- messages,
1787
- tools,
1788
- tool_choice: opts?.toolChoice ?? "auto",
1789
- temperature: opts?.temperature ?? 0.3,
1790
- ...opts?.maxTokens ? { max_tokens: opts.maxTokens } : {}
1791
- }),
1792
- ...opts?.signal ? { signal: opts.signal } : {}
1793
- });
1794
- if (!res.ok) throw new Error(`router ${res.status}: ${(await res.text()).slice(0, 200)}`);
1795
- const data = await res.json();
1781
+ const body = {
1782
+ model: cfg.model,
1783
+ messages,
1784
+ tools,
1785
+ tool_choice: opts?.toolChoice ?? "auto",
1786
+ temperature: opts?.temperature ?? 0.3,
1787
+ ...opts?.maxTokens ? { max_tokens: opts.maxTokens } : {}
1788
+ };
1789
+ const raw = cfg.complete ? await cfg.complete(body) : await (async () => {
1790
+ const res = await fetch(`${cfg.routerBaseUrl.replace(/\/$/, "")}/chat/completions`, {
1791
+ method: "POST",
1792
+ headers: { "content-type": "application/json", authorization: `Bearer ${cfg.routerKey}` },
1793
+ body: JSON.stringify(body),
1794
+ ...opts?.signal ? { signal: opts.signal } : {}
1795
+ });
1796
+ if (!res.ok) throw new Error(`router ${res.status}: ${(await res.text()).slice(0, 200)}`);
1797
+ return res.json();
1798
+ })();
1799
+ const data = raw;
1796
1800
  const msg = data.choices?.[0]?.message;
1797
1801
  const toolCalls = (msg?.tool_calls ?? []).map((tc, i) => ({
1798
1802
  id: tc.id ?? `call_${i}`,
@@ -6227,4 +6231,4 @@ export {
6227
6231
  createInProcessTransport,
6228
6232
  serveCoordinationMcp
6229
6233
  };
6230
- //# sourceMappingURL=chunk-ZKMOIEOB.js.map
6234
+ //# sourceMappingURL=chunk-RQYPH2QE.js.map