@desplega.ai/agent-swarm 1.166.0 → 1.167.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/acp-adapter-zpvy6321.js +34 -0
- package/dist/{actions-qz3m692w.js → actions-fq2zrwtf.js} +25 -25
- package/dist/{amp-adapter-j1xbmsqz.js → amp-adapter-5gbk7501.js} +4 -4
- package/dist/{anthropic-messages-hst62ws9.js → anthropic-messages-13yn502s.js} +4 -4
- package/dist/{app-43vrdmv8.js → app-nctetn1e.js} +10 -9
- package/dist/{assistant-ertffmka.js → assistant-0aq8gjvj.js} +26 -26
- package/dist/{azure-openai-responses-mh8tvf78.js → azure-openai-responses-9st34pfz.js} +5 -5
- package/dist/{boot-reembed-998jtpdg.js → boot-reembed-1ze5853n.js} +9 -8
- package/dist/{boot-reembed-s7k7c6v2.js → boot-reembed-fmp5ww69.js} +9 -8
- package/dist/{boot-scrub-sweep-nepsk4t1.js → boot-scrub-sweep-cbp8xd4e.js} +10 -9
- package/dist/{boot-seeds-vvzs1zhk.js → boot-seeds-22tx8a53.js} +12 -11
- package/dist/{claude-adapter-2zvmekrp.js → claude-adapter-0jhgeh1d.js} +24 -22
- package/dist/{claude-managed-adapter-s49wbk8t.js → claude-managed-adapter-tzwxy803.js} +4 -4
- package/dist/{claude-managed-setup-cvhqq8qn.js → claude-managed-setup-nrhfx5b0.js} +3 -3
- package/dist/{claude-sdk-session-kkbxtw5q.js → claude-sdk-session-wh77rh83.js} +22 -22
- package/dist/{cli-zsh093hk.js → cli-014vns2y.js} +63 -1
- package/dist/{cli-qvfk83fy.js → cli-13xwcqvj.js} +2 -2
- package/dist/{cli-dw2q9f7g.js → cli-1yrcfa5s.js} +4 -4
- package/dist/{cli-jvj6a0cv.js → cli-577bxkf6.js} +27 -17
- package/dist/{cli-zy7vwsne.js → cli-5qkcdv8c.js} +16 -9
- package/dist/{cli-cwxhbf43.js → cli-5t5my0h8.js} +85 -2
- package/dist/{cli-y59h2pk9.js → cli-69egj654.js} +1 -1
- package/dist/{cli-68r1j4sg.js → cli-6bpvv8h4.js} +3 -3
- package/dist/{cli-cpfmqz3n.js → cli-6qxmjpem.js} +5 -5
- package/dist/{cli-aqcey741.js → cli-6vfz44sr.js} +1 -1
- package/dist/{cli-32bca7nr.js → cli-7avy4v8w.js} +1 -1
- package/dist/{cli-f2n17zhp.js → cli-7mhy3ths.js} +21 -18
- package/dist/{cli-q38n4bq0.js → cli-95zs84qw.js} +3 -3
- package/dist/cli-a35hzdve.js +33 -0
- package/dist/{cli-x3x0qwky.js → cli-bxqez1p0.js} +51 -23
- package/dist/{cli-gt8azyet.js → cli-c2tpw9ck.js} +1 -1
- package/dist/{cli-ecknp7p1.js → cli-c8r99akr.js} +10 -10
- package/dist/{cli-3qn4r334.js → cli-cexctgn5.js} +20 -14
- package/dist/{cli-vzc73wet.js → cli-cf2vgn9d.js} +87 -69
- package/dist/{cli-ng97fjq7.js → cli-cmxkbzzs.js} +33 -7
- package/dist/{cli-nexwh8zg.js → cli-g7k7zbcz.js} +12 -5
- package/dist/{cli-nvvfd8bq.js → cli-jbzbr36n.js} +4091 -3793
- package/dist/{cli-3ddybbbx.js → cli-jvmtxqtc.js} +26 -14
- package/dist/{cli-pkke6geq.js → cli-km4x66j0.js} +83 -65
- package/dist/{cli-j2jbr8af.js → cli-kw0jcfje.js} +1 -1
- package/dist/{cli-8t229cmr.js → cli-m7vmeepg.js} +30 -17
- package/dist/{cli-yshaazs1.js → cli-mkdsy1nq.js} +62 -20
- package/dist/{cli-b0f70z24.js → cli-mn8qkd8v.js} +1 -1
- package/dist/{cli-0qjcsxgz.js → cli-mxry91sa.js} +30 -9
- package/dist/cli-nkqjj42q.js +104 -0
- package/dist/{cli-rggdq8wq.js → cli-p8rt8spp.js} +3 -3
- package/dist/{cli-v2a8x45d.js → cli-pkj1w46r.js} +10 -5
- package/dist/cli-q1vnz8wv.js +96 -0
- package/dist/{cli-fj86xr3c.js → cli-qd97v6z2.js} +2 -2
- package/dist/{cli-66zh26sp.js → cli-qzmzwegq.js} +57 -17
- package/dist/{cli-p4ztb80h.js → cli-r7eeddkq.js} +13 -8
- package/dist/{cli-8ssjez7e.js → cli-rhy7z1rp.js} +22 -11
- package/dist/{cli-4mevd1hf.js → cli-s9y81s7j.js} +5 -5
- package/dist/{cli-h3x613ze.js → cli-tc5zec7v.js} +6 -6
- package/dist/{cli-ttbsse3f.js → cli-tmhsxhb8.js} +1 -1
- package/dist/{cli-0nhdwxd5.js → cli-tx2zvn23.js} +3 -3
- package/dist/{cli-mwegs4af.js → cli-ty4bzkqr.js} +3 -3
- package/dist/{cli-ysnyhws9.js → cli-v1pwxreq.js} +54 -51
- package/dist/{cli-feh3dkah.js → cli-v1w7pbd8.js} +2 -1
- package/dist/{cli-10zmp1p7.js → cli-vr5avem2.js} +27 -32
- package/dist/{cli-bzr0ftht.js → cli-wnb9b2g3.js} +19 -0
- package/dist/{cli-df56tqdw.js → cli-wydz3feg.js} +108 -57
- package/dist/{cli-krqm5f11.js → cli-xezn9nkh.js} +16 -13
- package/dist/{cli-8kt0bmgx.js → cli-xf713zz0.js} +2 -2
- package/dist/{cli-x7kpr72a.js → cli-y0kjpfm9.js} +2 -2
- package/dist/{cli-6zcfw0x7.js → cli-y195hv1a.js} +1 -1
- package/dist/{cli-fn697bnt.js → cli-ykt8f7va.js} +21 -8
- package/dist/{cli-4r1sjfc4.js → cli-ymmc1zxg.js} +8 -8
- package/dist/{cli-8kgvmkak.js → cli-ypgba1a8.js} +1 -1
- package/dist/{cli-rsy933yz.js → cli-z1dqhc9y.js} +30 -19
- package/dist/{cli-qbksc292.js → cli-zy39d433.js} +2 -0
- package/dist/cli.js +26 -26
- package/dist/{cloudflare-workers-ai-system-one-tt484t61.js → cloudflare-workers-ai-system-one-sta45jf9.js} +7 -5
- package/dist/{codex-adapter-dw1wxqt8.js → codex-adapter-cgesnjkr.js} +18 -18
- package/dist/{codex-login-terbdsqq.js → codex-login-g1cyt5zm.js} +1 -1
- package/dist/{codex-session-runner-3cgb8y1g.js → codex-session-runner-8kd7ddhr.js} +18 -18
- package/dist/{commands-mhxam6z2.js → commands-h6zaaxym.js} +9 -8
- package/dist/{cursor-adapter-2qda3st7.js → cursor-adapter-v8mm6bp5.js} +5 -5
- package/dist/{db-sjks418k.js → db-qg3myn53.js} +9 -8
- package/dist/{dispatcher-1es759rn.js → dispatcher-7vnwj9qw.js} +24 -24
- package/dist/{dsh-adapter-bek4cyw9.js → dsh-adapter-tz6hfp5r.js} +5 -5
- package/dist/{easter-egg-3d-mtpnw06s.js → easter-egg-3d-66zxervv.js} +2 -2
- package/dist/{execute-s4ccjq3n.js → execute-h4jgevyw.js} +61 -11
- package/dist/{google-generative-ai-d6nphg3q.js → google-generative-ai-b8zxrpax.js} +5 -5
- package/dist/{google-vertex-cpshkref.js → google-vertex-nrdd697t.js} +5 -5
- package/dist/{grok-adapter-ar9cw9jg.js → grok-adapter-jdt2dz2s.js} +18 -8
- package/dist/{handlers-1gkbhktr.js → handlers-2qtkpncr.js} +27 -27
- package/dist/{hook-ds2zxq9v.js → hook-51yfcgsv.js} +42 -31
- package/dist/{hook-vxa3tcsy.js → hook-qnbdgwvd.js} +14 -14
- package/dist/{http-3h21z9md.js → http-jsmtag08.js} +320 -98
- package/dist/{index-9b65j1m5.js → index-2t9kesn1.js} +9 -8
- package/dist/{index-dkfxpkmm.js → index-bt8wkv1w.js} +25 -25
- package/dist/{index-f8xnqrye.js → index-cx1sb9bq.js} +33 -24
- package/dist/{index-bn6cy8ps.js → index-ekywyv2v.js} +24 -24
- package/dist/{index-n99fycq7.js → index-t4g06w93.js} +24 -24
- package/dist/{keepalive-3xspa9jw.js → keepalive-4aezx4bj.js} +11 -10
- package/dist/{lead-6qphc124.js → lead-r44bkpm5.js} +47 -47
- package/dist/{llama-cpp-classify-tgj35k8d.js → llama-cpp-classify-6erb7wwv.js} +3 -1
- package/dist/{maintenance-0teem1bb.js → maintenance-grz5jrzh.js} +9 -8
- package/dist/{mistral-conversations-8445ddjn.js → mistral-conversations-059y51zt.js} +4 -4
- package/dist/{node-9sg7ajby.js → node-qm9eb6z0.js} +1 -1
- package/dist/{oauth-refresh-sweep-sh9q25xp.js → oauth-refresh-sweep-wm4ctjfj.js} +10 -9
- package/dist/{onboard-54qmnqxe.js → onboard-v60zgqf0.js} +2 -2
- package/dist/{openai-codex-responses-9ynm88zy.js → openai-codex-responses-jzxkta9b.js} +8 -7
- package/dist/{openai-completions-nhqwjmaw.js → openai-completions-663yncfq.js} +4 -4
- package/dist/openai-decisions-vj9nkpf8.js +162 -0
- package/dist/{openai-responses-xx1c4kgm.js → openai-responses-m3g43rrt.js} +5 -5
- package/dist/{opencode-adapter-wjfa2wvd.js → opencode-adapter-yjyqynzf.js} +7 -7
- package/dist/{openrouter-images-8yx3487g.js → openrouter-images-kr60n6b9.js} +1 -1
- package/dist/{otel-impl-ycqzp2a1.js → otel-impl-ghh4dyf8.js} +1 -1
- package/dist/{pi-messages-vxdt8v7j.js → pi-messages-xszk613n.js} +1 -1
- package/dist/{pi-mono-adapter-e77e9zst.js → pi-mono-adapter-0eg8kw2c.js} +68 -51
- package/dist/{pricing-refresh-atnkngqs.js → pricing-refresh-mjrqvnvw.js} +11 -10
- package/dist/{rbac-roles-j78wdksm.js → rbac-roles-axv4d74x.js} +10 -9
- package/dist/{rbac-roles-9pjphh9q.js → rbac-roles-fd5tskj9.js} +9 -8
- package/dist/{render-v2-pxjs49fx.js → render-v2-k50j33qd.js} +10 -9
- package/dist/{runtime-v2t1r79e.js → runtime-h9ha1mq6.js} +4 -4
- package/dist/{setup-ymej0xtx.js → setup-4syh0pd2.js} +2 -2
- package/dist/{typesafe-system-one-datfr82p.js → typesafe-system-one-e988vty7.js} +7 -5
- package/dist/{virtual-modules-wm8mxdxx.js → virtual-modules-ftr9kwe8.js} +11 -11
- package/dist/{work-objects-3nh4ymzb.js → work-objects-jcdbg8rr.js} +27 -27
- package/dist/{worker-qa9fkz5s.js → worker-x8j8c9sx.js} +47 -47
- package/openapi.json +1 -1
- package/package.json +8 -8
- package/src/be/memory/providers/openai-embedding.ts +7 -2
- package/src/be/memory/raters/llm-summarizer.ts +7 -2
- package/src/be/modelsdev-cache.json +61 -0
- package/src/be/seed-pricing.ts +84 -53
- package/src/be/swarm-config-guard.ts +13 -0
- package/src/commands/provider-credentials.ts +28 -5
- package/src/commands/runner.ts +7 -12
- package/src/heartbeat/heartbeat.ts +91 -19
- package/src/hooks/hook.ts +72 -27
- package/src/http/mcp.ts +5 -0
- package/src/http/onboarding.ts +2 -0
- package/src/providers/acp-targets.ts +9 -4
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-adapter.ts +26 -0
- package/src/providers/codex-adapter.ts +30 -3
- package/src/providers/codex-oauth/auth-json.ts +21 -4
- package/src/providers/codex-oauth/types.ts +2 -0
- package/src/providers/dsh-adapter.ts +10 -1
- package/src/providers/grok-adapter.ts +18 -2
- package/src/providers/opencode-adapter.ts +21 -5
- package/src/providers/pi-mono-extension.ts +56 -25
- package/src/providers/pricing-sources.md +2 -0
- package/src/server.ts +63 -3
- package/src/tests/acp-adapter.test.ts +152 -12
- package/src/tests/ci-unit-test-report.test.ts +73 -0
- package/src/tests/claude-default-route.test.ts +75 -0
- package/src/tests/claude-hook-output.test.ts +233 -0
- package/src/tests/codex-adapter-pool-auth-revalidate.test.ts +4 -2
- package/src/tests/codex-adapter.test.ts +166 -26
- package/src/tests/codex-oauth-auth-timestamps.test.ts +76 -0
- package/src/tests/codex-oauth.test.ts +4 -1
- package/src/tests/context-window.test.ts +2 -2
- package/src/tests/credential-check.test.ts +51 -1
- package/src/tests/dsh-adapter.test.ts +23 -1
- package/src/tests/enabled-tools.test.ts +269 -0
- package/src/tests/entrypoint-codex-oauth-seed.test.ts +12 -0
- package/src/tests/grok-adapter.test.ts +13 -0
- package/src/tests/haiku-5-5-pricing.test.ts +38 -0
- package/src/tests/heartbeat-checklist.test.ts +158 -1
- package/src/tests/onboarding.test.ts +44 -0
- package/src/tests/opencode-adapter.test.ts +66 -3
- package/src/tests/opencode-plugin.test.ts +37 -0
- package/src/tests/openrouter-attribution-call-sites.test.ts +204 -0
- package/src/tests/openrouter-base-url.test.ts +30 -39
- package/src/tests/pi-mono-extension.test.ts +161 -2
- package/src/tests/pricing-refresh.test.ts +70 -1
- package/src/tests/reasoning-effort.test.ts +3 -1
- package/src/tests/telemetry-trigger.test.ts +12 -1
- package/src/tests/workflow-llm.test.ts +14 -0
- package/src/tests/workflow-system-one-decision-providers.test.ts +33 -0
- package/src/tools/request-human-input.ts +7 -2
- package/src/utils/enabled-tools.ts +27 -0
- package/src/utils/internal-ai/complete-structured.ts +11 -3
- package/src/utils/openrouter-base-url.ts +23 -0
- package/src/workflows/executors/raw-llm.ts +1 -0
- package/src/workflows/executors/system-one-decision.ts +2 -0
- package/src/workflows/executors/validate.ts +1 -0
- package/src/workflows/executors/workflow-llm.ts +9 -2
- package/templates/skills/agent-browser/SKILL.md +2 -0
- package/templates/skills/agent-browser/content.md +2 -0
- package/templates/skills/code-quality/content.md +1 -0
- package/templates/skills/heartbeat-runbook/content.md +1 -1
- package/templates/skills/work-on-task/SKILL.md +4 -0
- package/templates/skills/work-on-task/content.md +4 -0
- package/templates/skills/workflow-iterate/content.md +9 -0
- package/dist/acp-adapter-yzfxn8vj.js +0 -23
- package/dist/cli-3dpj7atn.js +0 -11
- package/dist/cli-gvcgmx69.js +0 -183
- package/dist/{cli-jhm6hzjn.js → cli-mxvnnv5q.js} +7 -7
- package/dist/{codex-hook-d2rkvf39.js → codex-hook-15dgc4cb.js} +1 -1
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ACPAdapter,
|
|
3
|
-
applyConfiguredOptions,
|
|
4
|
-
sanitizeAcpConfigOptions,
|
|
5
|
-
toAcpMcpServers
|
|
6
|
-
} from "./cli-3qn4r334.js";
|
|
7
|
-
import"./cli-32bca7nr.js";
|
|
8
|
-
import"./cli-tng3131n.js";
|
|
9
|
-
import"./cli-zp67qg5x.js";
|
|
10
|
-
import"./cli-ttbsse3f.js";
|
|
11
|
-
import"./cli-dpvkp2et.js";
|
|
12
|
-
import"./cli-zt3w1cn1.js";
|
|
13
|
-
import"./cli-zsh093hk.js";
|
|
14
|
-
import"./cli-w5e1d1vv.js";
|
|
15
|
-
import"./cli-4r1sjfc4.js";
|
|
16
|
-
import"./cli-wt7ccy4r.js";
|
|
17
|
-
import"./cli-bc05qbss.js";
|
|
18
|
-
export {
|
|
19
|
-
ACPAdapter,
|
|
20
|
-
applyConfiguredOptions,
|
|
21
|
-
sanitizeAcpConfigOptions,
|
|
22
|
-
toAcpMcpServers
|
|
23
|
-
};
|
package/dist/cli-3dpj7atn.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// src/utils/openrouter-base-url.ts
|
|
2
|
-
var DEFAULT_OPENROUTER_BASE_URL = "https://openrouter.ai/api/v1";
|
|
3
|
-
function getOpenRouterBaseUrl(env = process.env) {
|
|
4
|
-
const raw = env.OPENROUTER_BASE_URL;
|
|
5
|
-
if (typeof raw === "string" && raw.trim().length > 0) {
|
|
6
|
-
return raw.trim().replace(/\/+$/, "");
|
|
7
|
-
}
|
|
8
|
-
return DEFAULT_OPENROUTER_BASE_URL;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { DEFAULT_OPENROUTER_BASE_URL, getOpenRouterBaseUrl };
|
package/dist/cli-gvcgmx69.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
retryProviderRequest
|
|
3
|
-
} from "./cli-qbksc292.js";
|
|
4
|
-
import {
|
|
5
|
-
formatProviderError,
|
|
6
|
-
normalizeProviderError
|
|
7
|
-
} from "./cli-6map995v.js";
|
|
8
|
-
import {
|
|
9
|
-
headersToRecord,
|
|
10
|
-
providerHeadersToRecord
|
|
11
|
-
} from "./cli-7kyk9jr3.js";
|
|
12
|
-
import {
|
|
13
|
-
calculateCost
|
|
14
|
-
} from "./cli-nexwh8zg.js";
|
|
15
|
-
|
|
16
|
-
// node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js
|
|
17
|
-
function httpError(label, response, body) {
|
|
18
|
-
const error = new Error(`${label} returned ${response.status}`);
|
|
19
|
-
error.status = response.status;
|
|
20
|
-
error.headers = response.headers;
|
|
21
|
-
error.body = body;
|
|
22
|
-
return error;
|
|
23
|
-
}
|
|
24
|
-
function timeoutError(timeoutMs) {
|
|
25
|
-
const error = new Error(`Request timed out after ${timeoutMs}ms`);
|
|
26
|
-
error.name = "TimeoutError";
|
|
27
|
-
error.status = undefined;
|
|
28
|
-
error.headers = undefined;
|
|
29
|
-
error.body = "";
|
|
30
|
-
return error;
|
|
31
|
-
}
|
|
32
|
-
function isRecord(value) {
|
|
33
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
34
|
-
}
|
|
35
|
-
function requiredNumber(label, value, field) {
|
|
36
|
-
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
37
|
-
throw new Error(`${label} returned an invalid ${field}`);
|
|
38
|
-
}
|
|
39
|
-
return value;
|
|
40
|
-
}
|
|
41
|
-
function probabilities(label, value, id) {
|
|
42
|
-
if (!isRecord(value))
|
|
43
|
-
throw new Error(`${label} returned invalid probabilities for ${id}`);
|
|
44
|
-
return Object.fromEntries(Object.entries(value).map(([key, probability]) => [
|
|
45
|
-
key,
|
|
46
|
-
requiredNumber(label, probability, `probability for ${id}.${key}`)
|
|
47
|
-
]));
|
|
48
|
-
}
|
|
49
|
-
function parseAnswers(label, value, context) {
|
|
50
|
-
if (!isRecord(value))
|
|
51
|
-
throw new Error(`${label} returned an unexpected response`);
|
|
52
|
-
const answers = [];
|
|
53
|
-
for (const [id, question] of Object.entries(context.questions)) {
|
|
54
|
-
const answer = value[id];
|
|
55
|
-
if (!isRecord(answer))
|
|
56
|
-
throw new Error(`${label} did not return an answer for ${id}`);
|
|
57
|
-
if (question.type === "choice") {
|
|
58
|
-
if (answer.type !== "choice" || typeof answer.choice !== "string") {
|
|
59
|
-
throw new Error(`${label} did not return a choice answer for ${id}`);
|
|
60
|
-
}
|
|
61
|
-
answers.push([
|
|
62
|
-
id,
|
|
63
|
-
{
|
|
64
|
-
type: "choice",
|
|
65
|
-
choice: answer.choice,
|
|
66
|
-
probabilities: probabilities(label, answer.probabilities, id),
|
|
67
|
-
confidence: requiredNumber(label, answer.confidence, `confidence for ${id}`)
|
|
68
|
-
}
|
|
69
|
-
]);
|
|
70
|
-
} else if (question.type === "score") {
|
|
71
|
-
if (answer.type !== "score")
|
|
72
|
-
throw new Error(`${label} did not return a score answer for ${id}`);
|
|
73
|
-
answers.push([
|
|
74
|
-
id,
|
|
75
|
-
{
|
|
76
|
-
type: "score",
|
|
77
|
-
score: requiredNumber(label, answer.score, `score for ${id}`),
|
|
78
|
-
confidence: requiredNumber(label, answer.confidence, `confidence for ${id}`)
|
|
79
|
-
}
|
|
80
|
-
]);
|
|
81
|
-
} else {
|
|
82
|
-
if (answer.type !== "noul")
|
|
83
|
-
throw new Error(`${label} did not return a bool answer for ${id}`);
|
|
84
|
-
answers.push([
|
|
85
|
-
id,
|
|
86
|
-
{
|
|
87
|
-
type: "bool",
|
|
88
|
-
probability: requiredNumber(label, answer.noul, `probability for ${id}`)
|
|
89
|
-
}
|
|
90
|
-
]);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return Object.fromEntries(answers);
|
|
94
|
-
}
|
|
95
|
-
function tokenCount(value) {
|
|
96
|
-
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
|
|
97
|
-
}
|
|
98
|
-
function parseUsage(value, model) {
|
|
99
|
-
if (!isRecord(value) || value.input_tokens === undefined && value.output_tokens === undefined)
|
|
100
|
-
return;
|
|
101
|
-
const input = tokenCount(value.input_tokens);
|
|
102
|
-
const output = tokenCount(value.output_tokens);
|
|
103
|
-
const usage = {
|
|
104
|
-
input,
|
|
105
|
-
output,
|
|
106
|
-
cacheRead: 0,
|
|
107
|
-
cacheWrite: 0,
|
|
108
|
-
totalTokens: input + output,
|
|
109
|
-
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
|
|
110
|
-
};
|
|
111
|
-
calculateCost(model, usage);
|
|
112
|
-
return usage;
|
|
113
|
-
}
|
|
114
|
-
function wireRequest(context) {
|
|
115
|
-
return {
|
|
116
|
-
state: context.state,
|
|
117
|
-
questions: Object.fromEntries(Object.entries(context.questions).map(([id, question]) => [
|
|
118
|
-
id,
|
|
119
|
-
question.type === "bool" ? { ...question, type: "noul" } : question
|
|
120
|
-
]))
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
function requestHeaders(model, apiKey, optionsHeaders) {
|
|
124
|
-
return providerHeadersToRecord({ authorization: `Bearer ${apiKey}`, "content-type": "application/json" }, model.headers, optionsHeaders) ?? {};
|
|
125
|
-
}
|
|
126
|
-
async function classifySystemOne(transport, model, context, options) {
|
|
127
|
-
const output = {
|
|
128
|
-
api: model.api,
|
|
129
|
-
provider: model.provider,
|
|
130
|
-
model: model.id,
|
|
131
|
-
answers: {},
|
|
132
|
-
stopReason: "stop",
|
|
133
|
-
timestamp: Date.now()
|
|
134
|
-
};
|
|
135
|
-
try {
|
|
136
|
-
if (model.api !== transport.api)
|
|
137
|
-
throw new Error(`Unsupported classifier API: ${model.api}`);
|
|
138
|
-
if (!options?.apiKey)
|
|
139
|
-
throw new Error(`No API key for provider: ${model.provider}`);
|
|
140
|
-
const apiKey = options.apiKey;
|
|
141
|
-
let payload = transport.payload(model, wireRequest(context));
|
|
142
|
-
const transformed = await options.onPayload?.(payload, model);
|
|
143
|
-
if (transformed !== undefined)
|
|
144
|
-
payload = transformed;
|
|
145
|
-
const requestFetch = options.fetch ?? globalThis.fetch;
|
|
146
|
-
const { response, body } = await retryProviderRequest(async () => {
|
|
147
|
-
const timeoutSignal = options.timeoutMs !== undefined ? AbortSignal.timeout(options.timeoutMs) : undefined;
|
|
148
|
-
const signal = options.signal && timeoutSignal ? AbortSignal.any([options.signal, timeoutSignal]) : options.signal ?? timeoutSignal;
|
|
149
|
-
try {
|
|
150
|
-
const next = await requestFetch(transport.url(model), {
|
|
151
|
-
method: "POST",
|
|
152
|
-
headers: requestHeaders(model, apiKey, options.headers),
|
|
153
|
-
body: JSON.stringify(payload),
|
|
154
|
-
signal
|
|
155
|
-
});
|
|
156
|
-
if (!next.ok)
|
|
157
|
-
throw httpError(transport.label, next, await next.text());
|
|
158
|
-
return { response: next, body: await next.json() };
|
|
159
|
-
} catch (error) {
|
|
160
|
-
if (timeoutSignal?.aborted && !options.signal?.aborted)
|
|
161
|
-
throw timeoutError(options.timeoutMs);
|
|
162
|
-
throw error;
|
|
163
|
-
}
|
|
164
|
-
}, {
|
|
165
|
-
maxRetries: options.maxRetries ?? 2,
|
|
166
|
-
maxRetryDelayMs: options.maxRetryDelayMs,
|
|
167
|
-
signal: options.signal
|
|
168
|
-
});
|
|
169
|
-
await options.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);
|
|
170
|
-
const result = transport.output(body);
|
|
171
|
-
const usage = parseUsage(result.usage, model);
|
|
172
|
-
if (usage)
|
|
173
|
-
output.usage = usage;
|
|
174
|
-
output.answers = parseAnswers(transport.label, result.answers, context);
|
|
175
|
-
return output;
|
|
176
|
-
} catch (error) {
|
|
177
|
-
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
178
|
-
output.errorMessage = formatProviderError(normalizeProviderError(error), `${transport.label} error`);
|
|
179
|
-
return output;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export { isRecord, classifySystemOne };
|
|
@@ -9,13 +9,6 @@ import {
|
|
|
9
9
|
getSlackConfiguration,
|
|
10
10
|
init_config
|
|
11
11
|
} from "./cli-dmtrxqhg.js";
|
|
12
|
-
import {
|
|
13
|
-
MAX_PROFILE_FILE_LENGTH,
|
|
14
|
-
buildAgentFsLiveUrl,
|
|
15
|
-
buildCombFileUrl,
|
|
16
|
-
getAppUrl,
|
|
17
|
-
init_constants
|
|
18
|
-
} from "./cli-gd4favx9.js";
|
|
19
12
|
import {
|
|
20
13
|
init_templates
|
|
21
14
|
} from "./cli-agamgm0p.js";
|
|
@@ -23,6 +16,13 @@ import {
|
|
|
23
16
|
init_resolver,
|
|
24
17
|
resolveTemplateAsync
|
|
25
18
|
} from "./cli-5c2j5yvx.js";
|
|
19
|
+
import {
|
|
20
|
+
MAX_PROFILE_FILE_LENGTH,
|
|
21
|
+
buildAgentFsLiveUrl,
|
|
22
|
+
buildCombFileUrl,
|
|
23
|
+
getAppUrl,
|
|
24
|
+
init_constants
|
|
25
|
+
} from "./cli-gd4favx9.js";
|
|
26
26
|
import {
|
|
27
27
|
init_secret_scrubber,
|
|
28
28
|
scrubSecrets
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
isSteeringEnabled
|
|
14
14
|
} from "./cli-7mm2r1kp.js";
|
|
15
15
|
import"./cli-g5erf0zt.js";
|
|
16
|
+
import"./cli-5c2j5yvx.js";
|
|
16
17
|
import {
|
|
17
18
|
getMcpBaseUrl,
|
|
18
19
|
init_constants
|
|
19
20
|
} from "./cli-gd4favx9.js";
|
|
20
|
-
import"./cli-5c2j5yvx.js";
|
|
21
21
|
import"./cli-ej6gbxfb.js";
|
|
22
22
|
import"./cli-bc05qbss.js";
|
|
23
23
|
|