@desplega.ai/agent-swarm 1.126.0 → 1.127.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/README.md +3 -3
- package/dist/{actions-d1tjdh0n.js → actions-644n22m6.js} +7 -7
- package/dist/{anthropic-messages-61yp6b2e.js → anthropic-messages-1hwa97nn.js} +13 -6
- package/dist/{app-ffsw31vc.js → app-ny0gj6kg.js} +4 -4
- package/dist/{assistant-12w1vmep.js → assistant-gj8b3c00.js} +9 -9
- package/dist/{azure-openai-responses-nm27pz8s.js → azure-openai-responses-ggmzdxgy.js} +8 -4
- package/dist/{boot-reembed-t2d2rh45.js → boot-reembed-5ca9kv94.js} +4 -4
- package/dist/{boot-reembed-75rqqjwq.js → boot-reembed-xkbsbxxn.js} +5 -5
- package/dist/{boot-scrub-logs-4jw99mma.js → boot-scrub-logs-669xsqq1.js} +3 -3
- package/dist/{cli-kac1ydpq.js → cli-2e10g9r7.js} +2 -2
- package/dist/{cli-hqhteex6.js → cli-4gfwmxa8.js} +2 -2
- package/dist/{cli-x1d3nde4.js → cli-4ww6rhhg.js} +2 -2
- package/dist/{cli-wbnafws1.js → cli-5j8hafqh.js} +13 -3
- package/dist/{cli-0r0ptcrs.js → cli-68jy5v0w.js} +1 -1
- package/dist/{cli-pt92nxjq.js → cli-6b41m0f8.js} +102 -63
- package/dist/{cli-we156bmz.js → cli-6nh2qxvh.js} +1 -1
- package/dist/{cli-pfm8xda2.js → cli-9f6yb8vh.js} +1760 -1778
- package/dist/{cli-tghs3hsp.js → cli-b696veeb.js} +6 -6
- package/dist/{cli-ytwc7xaa.js → cli-bepzsbrb.js} +4 -4
- package/dist/{cli-1ah4kk37.js → cli-bs2awjtx.js} +1 -1
- package/dist/{cli-cxv6qn43.js → cli-bwx9h2cj.js} +2 -2
- package/dist/{cli-f5xgj0qj.js → cli-c64x8s7t.js} +2 -2
- package/dist/{cli-dy6stbsb.js → cli-dhb6rmf6.js} +23 -9
- package/dist/{cli-e1n0zwt0.js → cli-dw20rn0d.js} +19 -7
- package/dist/{cli-79bkv8ts.js → cli-emcj32bv.js} +10 -10
- package/dist/{cli-dcs1trts.js → cli-h0yddy4n.js} +11 -6
- package/dist/{cli-c4f49bv5.js → cli-hzad20bp.js} +3 -3
- package/dist/{cli-crh7y20p.js → cli-jqqq7zhc.js} +1 -1
- package/dist/{cli-93s1546d.js → cli-k6nzt9hv.js} +1 -1
- package/dist/{cli-7jpfcxc3.js → cli-n09s3zaf.js} +8 -8
- package/dist/{cli-rxpp0nh7.js → cli-nftx594v.js} +4 -4
- package/dist/{cli-5x6g59th.js → cli-peycqz69.js} +1 -1
- package/dist/{cli-rjzy70kt.js → cli-rdhfg33j.js} +1 -1
- package/dist/{cli-bcnc6e63.js → cli-sh9vv838.js} +1 -1
- package/dist/{cli-da6r73tg.js → cli-tfev56s0.js} +1 -1
- package/dist/{cli-3jrdwnn9.js → cli-v2tr6amf.js} +1 -1
- package/dist/{cli-x0e0yvnq.js → cli-vgexpfsr.js} +1 -0
- package/dist/{cli-ccjwgarc.js → cli-w10fkrf1.js} +10 -4
- package/dist/{cli-h6ra5f26.js → cli-wa4p03nz.js} +33 -5
- package/dist/{cli-ft8nfdxh.js → cli-x883h2ky.js} +1 -1
- package/dist/{cli-e78k3wa4.js → cli-xg5g50w0.js} +4 -4
- package/dist/{cli-fvwbwdy5.js → cli-xt6r7vgw.js} +1 -1
- package/dist/{cli-n17fvf28.js → cli-ynppb182.js} +2 -2
- package/dist/{cli-rf389mcx.js → cli-yy56svjs.js} +2 -2
- package/dist/cli.js +33 -21
- package/dist/{codex-adapter-sp9yabpn.js → codex-adapter-tp9k7xqg.js} +4 -4
- package/dist/{codex-hook-5tdxqhpe.js → codex-hook-tyqm0gpy.js} +2 -2
- package/dist/{codex-session-runner-0t6ea8k5.js → codex-session-runner-6c2zds78.js} +4 -4
- package/dist/{commands-ng43advk.js → commands-jasxqcmp.js} +3 -3
- package/dist/{db-88c5558e.js → db-wkqh4pk7.js} +7 -3
- package/dist/{google-generative-ai-t9x7whn7.js → google-generative-ai-307e5dq6.js} +13 -5
- package/dist/{google-vertex-wgfyjt61.js → google-vertex-btp9zq4e.js} +13 -5
- package/dist/{handlers-h1dq9fk2.js → handlers-jtp4gkw3.js} +9 -9
- package/dist/{hook-tee64naq.js → hook-yw7b5qpr.js} +4 -4
- package/dist/{http-64bahaxw.js → http-821k8pmw.js} +109 -79
- package/dist/{index-3dw79tc1.js → index-acdakscd.js} +10 -10
- package/dist/{index-xqtq55kv.js → index-fwv94k2a.js} +12 -12
- package/dist/{index-qg6w95vp.js → index-j0m3pjgx.js} +8 -8
- package/dist/{index-8gyn6r7c.js → index-qsjkh0ad.js} +11 -11
- package/dist/{keepalive-9m7pbtda.js → keepalive-4kr014zc.js} +6 -6
- package/dist/{lead-xchw2d7x.js → lead-cvh88580.js} +26 -26
- package/dist/{maintenance-646gavgb.js → maintenance-mnbj2wpg.js} +5 -5
- package/dist/{mistral-conversations-2tq2yx9e.js → mistral-conversations-3yjpaa7k.js} +48 -42
- package/dist/{oauth-refresh-sweep-pqv9fc5c.js → oauth-refresh-sweep-feh6w9a0.js} +5 -5
- package/dist/{onboard-c8cbtc78.js → onboard-22n94r81.js} +2 -2
- package/dist/{openai-codex-responses-ngg70d19.js → openai-codex-responses-yd2x7kp4.js} +15 -5
- package/dist/{openai-completions-9bs2av96.js → openai-completions-f4edtpd8.js} +17 -9
- package/dist/{openai-responses-v2844ch1.js → openai-responses-xke4h8fx.js} +10 -6
- package/dist/{openrouter-images-dgq98729.js → openrouter-images-qv4vbkrr.js} +3 -2
- package/dist/{otel-impl-tvfxyms7.js → otel-impl-2qdetxze.js} +1 -1
- package/dist/{pi-messages-xac57dw1.js → pi-messages-68qm6bwq.js} +2 -2
- package/dist/{pi-mono-adapter-hk4t5xyb.js → pi-mono-adapter-6r7nb9yr.js} +837 -584
- package/dist/{pricing-refresh-epsr16d4.js → pricing-refresh-zjq4hrdx.js} +5 -5
- package/dist/{rbac-roles-sy7wmbvb.js → rbac-roles-335afb7w.js} +5 -5
- package/dist/{rbac-roles-94xwpkaw.js → rbac-roles-4nr41yak.js} +4 -4
- package/dist/{render-v2-jmpxnxhh.js → render-v2-hy2jyz5n.js} +4 -4
- package/dist/{seed-pricing-b822y9hh.js → seed-pricing-pbc479ga.js} +4 -4
- package/dist/{setup-4h48h6b0.js → setup-qrfd6aae.js} +2 -2
- package/dist/{worker-xk216rp2.js → worker-6cyvsr2y.js} +26 -26
- package/openapi.json +10 -1
- package/package.json +19 -7
- package/src/be/db.ts +51 -2
- package/src/http/script-runs.ts +6 -3
- package/src/http/tasks.ts +11 -0
- package/src/prompts/session-templates.ts +3 -3
- package/src/script-workflows/label-lint.ts +97 -35
- package/src/slack/render-v2.ts +24 -2
- package/src/tests/prompt-template-session.test.ts +16 -1
- package/src/tests/script-runs-http.test.ts +90 -5
- package/src/tests/script-workflows-label-lint.test.ts +88 -0
- package/src/tests/slack-render-v2.test.ts +137 -0
- package/src/tests/store-progress-attachments-handler.test.ts +5 -2
- package/src/tests/task-cancellation.test.ts +2 -2
- package/src/tests/task-cascade-fail.test.ts +9 -9
- package/src/tests/task-completion-idempotency.test.ts +289 -10
- package/src/tests/task-pause-resume.test.ts +15 -15
- package/src/tests/tasks-requested-by-filter.test.ts +211 -0
- package/src/tools/kv/kv-set.ts +1 -1
- package/src/tools/slack-reply.ts +1 -1
- package/src/tools/store-progress.ts +112 -35
package/README.md
CHANGED
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
</a>
|
|
41
41
|
</p>
|
|
42
42
|
|
|
43
|
-
> **
|
|
43
|
+
> **agent-swarm.dev is an open-source operating system for AI work: a lead agent breaks goals into tasks, routes them to specialized workers such as Claude Code or Codex, runs each worker in an isolated container, and preserves shared memory, tools, schedules, and review gates so delegated work compounds across sessions.**
|
|
44
44
|
|
|
45
45
|
> AI-Native · Compounds · Presence · Harness & LLM-Agnostic · Your Infra · Your Memory ·
|
|
46
46
|
|
|
47
47
|
## What it does
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
agent-swarm.dev runs a team of AI agents that coordinate autonomously. A **lead agent** receives tasks (from Slack, GitHub, GitLab, Linear, Jira, email, or the API), breaks them down, and delegates to **worker agents** running in isolated environments (Docker). Workers execute tasks, ship solutions, and write their learnings back to a shared memory so the whole swarm gets smarter every session.
|
|
50
50
|
|
|
51
51
|
You can run agents for Marketing, Product, UX, Engineering, Support, Operations, HR, Finance, or any role you can think of. A centralized Lead coordinates them, and they share the learnings horizontally. That's the true difference between [*AI First*](https://www.pleasedontdeploy.com/i/197193364/ai-first) and [*AI Native*](https://www.pleasedontdeploy.com/i/197193364/third-the-ai-native-metamorphosis).
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
agent-swarm.dev is the shared cloud brain and muscle that makes your whole company better every day.
|
|
54
54
|
|
|
55
55
|
Sometimes humans are the blocker. We can help you. Contact us [contact@desplega.sh](mailto:contact@desplega.sh).
|
|
56
56
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveSlackUserId
|
|
3
|
-
} from "./cli-
|
|
4
|
-
import"./cli-
|
|
3
|
+
} from "./cli-ynppb182.js";
|
|
4
|
+
import"./cli-68jy5v0w.js";
|
|
5
5
|
import {
|
|
6
6
|
createTaskWithSiblingAwareness
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-x883h2ky.js";
|
|
8
8
|
import {
|
|
9
9
|
buildCancelledBlocks,
|
|
10
10
|
ensureSlackThreadTree,
|
|
11
11
|
getTaskLink,
|
|
12
12
|
isSlackRenderV2Enabled
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-dhb6rmf6.js";
|
|
14
14
|
import"./cli-rkndnn90.js";
|
|
15
15
|
import"./cli-b0p7rfnd.js";
|
|
16
16
|
import"./cli-wspgs9bt.js";
|
|
@@ -23,11 +23,11 @@ import {
|
|
|
23
23
|
init_context_key,
|
|
24
24
|
init_db,
|
|
25
25
|
slackContextKey
|
|
26
|
-
} from "./cli-
|
|
27
|
-
import"./cli-
|
|
26
|
+
} from "./cli-wa4p03nz.js";
|
|
27
|
+
import"./cli-hzad20bp.js";
|
|
28
28
|
import"./cli-z2zcxes1.js";
|
|
29
29
|
import"./cli-bw80ck94.js";
|
|
30
|
-
import"./cli-
|
|
30
|
+
import"./cli-dw20rn0d.js";
|
|
31
31
|
import"./cli-4j2mrzag.js";
|
|
32
32
|
import"./cli-xz9aq0rf.js";
|
|
33
33
|
import"./cli-e15jhafb.js";
|
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
clampMaxTokensToContext,
|
|
22
22
|
resolveJsonSchemaStrictSampling,
|
|
23
23
|
transformMessages
|
|
24
|
-
} from "./cli-
|
|
24
|
+
} from "./cli-vgexpfsr.js";
|
|
25
25
|
import {
|
|
26
26
|
calculateCost
|
|
27
|
-
} from "./cli-
|
|
27
|
+
} from "./cli-w10fkrf1.js";
|
|
28
28
|
import {
|
|
29
29
|
sanitizeSurrogates
|
|
30
30
|
} from "./cli-y2apkfe2.js";
|
|
@@ -5131,7 +5131,7 @@ var stream = (model, context, options) => {
|
|
|
5131
5131
|
totalTokens: 0,
|
|
5132
5132
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
|
|
5133
5133
|
},
|
|
5134
|
-
stopReason: "
|
|
5134
|
+
stopReason: "pending",
|
|
5135
5135
|
timestamp: Date.now()
|
|
5136
5136
|
};
|
|
5137
5137
|
try {
|
|
@@ -5153,7 +5153,7 @@ var stream = (model, context, options) => {
|
|
|
5153
5153
|
}
|
|
5154
5154
|
const cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);
|
|
5155
5155
|
const cacheSessionId = cacheRetention === "none" ? undefined : options?.sessionId;
|
|
5156
|
-
const created = createClient(model, apiKey, options?.interleavedThinking ?? true, shouldUseFineGrainedToolStreamingBeta(model, context), options?.headers, copilotDynamicHeaders, cacheSessionId);
|
|
5156
|
+
const created = createClient(model, apiKey, options?.interleavedThinking ?? true, shouldUseFineGrainedToolStreamingBeta(model, context), options?.headers, options?.fetch, copilotDynamicHeaders, cacheSessionId);
|
|
5157
5157
|
client = created.client;
|
|
5158
5158
|
isOAuth = created.isOAuthToken;
|
|
5159
5159
|
}
|
|
@@ -5303,6 +5303,7 @@ var stream = (model, context, options) => {
|
|
|
5303
5303
|
}
|
|
5304
5304
|
} else if (event.type === "message_delta") {
|
|
5305
5305
|
if (event.delta.stop_reason) {
|
|
5306
|
+
output.rawStopReason = event.delta.stop_reason;
|
|
5306
5307
|
const stopReasonResult = mapStopReason(event.delta.stop_reason, event.delta.stop_details);
|
|
5307
5308
|
output.stopReason = stopReasonResult.stopReason;
|
|
5308
5309
|
if (stopReasonResult.errorMessage) {
|
|
@@ -5334,6 +5335,9 @@ var stream = (model, context, options) => {
|
|
|
5334
5335
|
if (options?.signal?.aborted) {
|
|
5335
5336
|
throw new Error("Request was aborted");
|
|
5336
5337
|
}
|
|
5338
|
+
if (output.stopReason === "pending") {
|
|
5339
|
+
throw new Error("Anthropic stream ended without a stop reason");
|
|
5340
|
+
}
|
|
5337
5341
|
if (output.stopReason === "aborted" || output.stopReason === "error") {
|
|
5338
5342
|
throw new Error(output.errorMessage || "An unknown error occurred");
|
|
5339
5343
|
}
|
|
@@ -5394,7 +5398,7 @@ var streamSimple = (model, context, options) => {
|
|
|
5394
5398
|
function isOAuthToken(apiKey) {
|
|
5395
5399
|
return apiKey.includes("sk-ant-oat");
|
|
5396
5400
|
}
|
|
5397
|
-
function createClient(model, apiKey, interleavedThinking, useFineGrainedToolStreamingBeta, optionsHeaders, dynamicHeaders, sessionId) {
|
|
5401
|
+
function createClient(model, apiKey, interleavedThinking, useFineGrainedToolStreamingBeta, optionsHeaders, fetch2, dynamicHeaders, sessionId) {
|
|
5398
5402
|
const needsInterleavedBeta = interleavedThinking && model.compat?.forceAdaptiveThinking !== true;
|
|
5399
5403
|
const betaFeatures = [];
|
|
5400
5404
|
if (useFineGrainedToolStreamingBeta) {
|
|
@@ -5409,6 +5413,7 @@ function createClient(model, apiKey, interleavedThinking, useFineGrainedToolStre
|
|
|
5409
5413
|
authToken: apiKey ?? null,
|
|
5410
5414
|
baseURL: model.baseUrl,
|
|
5411
5415
|
dangerouslyAllowBrowser: true,
|
|
5416
|
+
fetch: fetch2,
|
|
5412
5417
|
defaultHeaders: mergeHeaders({
|
|
5413
5418
|
accept: "application/json",
|
|
5414
5419
|
"anthropic-dangerous-direct-browser-access": "true",
|
|
@@ -5423,6 +5428,7 @@ function createClient(model, apiKey, interleavedThinking, useFineGrainedToolStre
|
|
|
5423
5428
|
authToken: apiKey,
|
|
5424
5429
|
baseURL: model.baseUrl,
|
|
5425
5430
|
dangerouslyAllowBrowser: true,
|
|
5431
|
+
fetch: fetch2,
|
|
5426
5432
|
defaultHeaders: mergeHeaders({
|
|
5427
5433
|
accept: "application/json",
|
|
5428
5434
|
"anthropic-dangerous-direct-browser-access": "true",
|
|
@@ -5444,6 +5450,7 @@ function createClient(model, apiKey, interleavedThinking, useFineGrainedToolStre
|
|
|
5444
5450
|
authToken: null,
|
|
5445
5451
|
baseURL: model.baseUrl,
|
|
5446
5452
|
dangerouslyAllowBrowser: true,
|
|
5453
|
+
fetch: fetch2,
|
|
5447
5454
|
defaultHeaders
|
|
5448
5455
|
});
|
|
5449
5456
|
return { client, isOAuthToken: false };
|
|
@@ -5742,7 +5749,7 @@ function mapStopReason(reason, stopDetails) {
|
|
|
5742
5749
|
case "stop_sequence":
|
|
5743
5750
|
return { stopReason: "stop" };
|
|
5744
5751
|
case "sensitive":
|
|
5745
|
-
return { stopReason: "error" };
|
|
5752
|
+
return { stopReason: "error", errorMessage: "Provider stopped with: sensitive" };
|
|
5746
5753
|
default:
|
|
5747
5754
|
throw new Error(`Unhandled stop reason: ${reason}`);
|
|
5748
5755
|
}
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
initSlackApp,
|
|
4
4
|
startSlackApp,
|
|
5
5
|
stopSlackApp
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-dhb6rmf6.js";
|
|
7
7
|
import"./cli-rkndnn90.js";
|
|
8
8
|
import"./cli-b0p7rfnd.js";
|
|
9
9
|
import"./cli-wspgs9bt.js";
|
|
10
10
|
import"./cli-dh55d5fg.js";
|
|
11
|
-
import"./cli-
|
|
12
|
-
import"./cli-
|
|
11
|
+
import"./cli-wa4p03nz.js";
|
|
12
|
+
import"./cli-hzad20bp.js";
|
|
13
13
|
import"./cli-z2zcxes1.js";
|
|
14
14
|
import"./cli-bw80ck94.js";
|
|
15
|
-
import"./cli-
|
|
15
|
+
import"./cli-dw20rn0d.js";
|
|
16
16
|
import"./cli-4j2mrzag.js";
|
|
17
17
|
import"./cli-xz9aq0rf.js";
|
|
18
18
|
import"./cli-e15jhafb.js";
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bufferThreadMessage,
|
|
3
3
|
wasEventSeen
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-b696veeb.js";
|
|
5
5
|
import {
|
|
6
6
|
hasOtherUserMention
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-yy56svjs.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveSlackUserId,
|
|
10
10
|
rewriteSlackMentions
|
|
11
|
-
} from "./cli-
|
|
12
|
-
import"./cli-
|
|
11
|
+
} from "./cli-ynppb182.js";
|
|
12
|
+
import"./cli-68jy5v0w.js";
|
|
13
13
|
import {
|
|
14
14
|
createTaskWithSiblingAwareness
|
|
15
|
-
} from "./cli-
|
|
15
|
+
} from "./cli-x883h2ky.js";
|
|
16
16
|
import {
|
|
17
17
|
ensureSlackThreadTree,
|
|
18
18
|
isSlackRenderV2Enabled,
|
|
19
19
|
require_dist
|
|
20
|
-
} from "./cli-
|
|
20
|
+
} from "./cli-dhb6rmf6.js";
|
|
21
21
|
import"./cli-rkndnn90.js";
|
|
22
22
|
import"./cli-b0p7rfnd.js";
|
|
23
23
|
import"./cli-wspgs9bt.js";
|
|
@@ -29,16 +29,16 @@ import {
|
|
|
29
29
|
init_context_key,
|
|
30
30
|
init_db,
|
|
31
31
|
slackContextKey
|
|
32
|
-
} from "./cli-
|
|
32
|
+
} from "./cli-wa4p03nz.js";
|
|
33
33
|
import {
|
|
34
34
|
init_env_flag,
|
|
35
35
|
init_resolver,
|
|
36
36
|
isEnvFlagEnabled,
|
|
37
37
|
resolveTemplate
|
|
38
|
-
} from "./cli-
|
|
38
|
+
} from "./cli-hzad20bp.js";
|
|
39
39
|
import"./cli-z2zcxes1.js";
|
|
40
40
|
import"./cli-bw80ck94.js";
|
|
41
|
-
import"./cli-
|
|
41
|
+
import"./cli-dw20rn0d.js";
|
|
42
42
|
import"./cli-4j2mrzag.js";
|
|
43
43
|
import"./cli-xz9aq0rf.js";
|
|
44
44
|
import"./cli-e15jhafb.js";
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
convertResponsesMessages,
|
|
3
3
|
convertResponsesTools,
|
|
4
4
|
processResponsesStream
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-5j8hafqh.js";
|
|
6
6
|
import {
|
|
7
7
|
clampOpenAIPromptCacheKey
|
|
8
8
|
} from "./cli-mrptpp86.js";
|
|
@@ -24,10 +24,10 @@ import {
|
|
|
24
24
|
import {
|
|
25
25
|
buildBaseOptions,
|
|
26
26
|
createGrammarToolInputProperties
|
|
27
|
-
} from "./cli-
|
|
27
|
+
} from "./cli-vgexpfsr.js";
|
|
28
28
|
import {
|
|
29
29
|
clampThinkingLevel
|
|
30
|
-
} from "./cli-
|
|
30
|
+
} from "./cli-w10fkrf1.js";
|
|
31
31
|
import"./cli-y2apkfe2.js";
|
|
32
32
|
import {
|
|
33
33
|
AssistantMessageEventStream
|
|
@@ -84,7 +84,7 @@ var stream = (model, context, options) => {
|
|
|
84
84
|
totalTokens: 0,
|
|
85
85
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
|
|
86
86
|
},
|
|
87
|
-
stopReason: "
|
|
87
|
+
stopReason: "pending",
|
|
88
88
|
timestamp: Date.now()
|
|
89
89
|
};
|
|
90
90
|
try {
|
|
@@ -115,6 +115,9 @@ var stream = (model, context, options) => {
|
|
|
115
115
|
if (options?.signal?.aborted) {
|
|
116
116
|
throw new Error("Request was aborted");
|
|
117
117
|
}
|
|
118
|
+
if (output.stopReason === "pending") {
|
|
119
|
+
throw new Error("Azure OpenAI Responses stream ended without a stop reason");
|
|
120
|
+
}
|
|
118
121
|
if (output.stopReason === "aborted" || output.stopReason === "error") {
|
|
119
122
|
throw new Error("An unknown error occurred");
|
|
120
123
|
}
|
|
@@ -195,6 +198,7 @@ function createClient(model, apiKey, options) {
|
|
|
195
198
|
apiKey,
|
|
196
199
|
apiVersion,
|
|
197
200
|
dangerouslyAllowBrowser: true,
|
|
201
|
+
fetch: options?.fetch,
|
|
198
202
|
defaultHeaders: headers,
|
|
199
203
|
baseURL: baseUrl
|
|
200
204
|
});
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
getEmbeddingProvider,
|
|
4
4
|
getMemoryStore,
|
|
5
5
|
init_constants
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-jqqq7zhc.js";
|
|
7
7
|
import"./cli-q25ejbyn.js";
|
|
8
8
|
import {
|
|
9
9
|
getDb,
|
|
10
10
|
init_db
|
|
11
|
-
} from "./cli-
|
|
12
|
-
import"./cli-
|
|
11
|
+
} from "./cli-wa4p03nz.js";
|
|
12
|
+
import"./cli-hzad20bp.js";
|
|
13
13
|
import"./cli-z2zcxes1.js";
|
|
14
14
|
import"./cli-bw80ck94.js";
|
|
15
|
-
import"./cli-
|
|
15
|
+
import"./cli-dw20rn0d.js";
|
|
16
16
|
import"./cli-4j2mrzag.js";
|
|
17
17
|
import"./cli-xz9aq0rf.js";
|
|
18
18
|
import"./cli-p9swy5t3.js";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
embedScript,
|
|
3
3
|
embeddingProvider
|
|
4
|
-
} from "./cli-
|
|
5
|
-
import"./cli-
|
|
4
|
+
} from "./cli-bwx9h2cj.js";
|
|
5
|
+
import"./cli-jqqq7zhc.js";
|
|
6
6
|
import"./cli-q25ejbyn.js";
|
|
7
7
|
import {
|
|
8
8
|
getDb,
|
|
9
9
|
init_db
|
|
10
|
-
} from "./cli-
|
|
11
|
-
import"./cli-
|
|
10
|
+
} from "./cli-wa4p03nz.js";
|
|
11
|
+
import"./cli-hzad20bp.js";
|
|
12
12
|
import"./cli-z2zcxes1.js";
|
|
13
13
|
import"./cli-bw80ck94.js";
|
|
14
|
-
import"./cli-
|
|
14
|
+
import"./cli-dw20rn0d.js";
|
|
15
15
|
import"./cli-4j2mrzag.js";
|
|
16
16
|
import"./cli-xz9aq0rf.js";
|
|
17
17
|
import"./cli-p9swy5t3.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDb,
|
|
3
3
|
init_db
|
|
4
|
-
} from "./cli-
|
|
5
|
-
import"./cli-
|
|
4
|
+
} from "./cli-wa4p03nz.js";
|
|
5
|
+
import"./cli-hzad20bp.js";
|
|
6
6
|
import"./cli-z2zcxes1.js";
|
|
7
7
|
import"./cli-bw80ck94.js";
|
|
8
|
-
import"./cli-
|
|
8
|
+
import"./cli-dw20rn0d.js";
|
|
9
9
|
import {
|
|
10
10
|
init_secret_scrubber,
|
|
11
11
|
scrubSecrets
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildModelsDevSeedRows,
|
|
3
3
|
loadModelsDevCache
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-xt6r7vgw.js";
|
|
5
5
|
import {
|
|
6
6
|
createLogEntry,
|
|
7
7
|
getActivePricingRow,
|
|
8
8
|
getDb,
|
|
9
9
|
init_db,
|
|
10
10
|
insertPricingRow
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-wa4p03nz.js";
|
|
12
12
|
import {
|
|
13
13
|
init_secret_scrubber,
|
|
14
14
|
scrubSecrets
|
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
init_db,
|
|
17
17
|
init_templates1 as init_templates,
|
|
18
18
|
normalizeDateRequired
|
|
19
|
-
} from "./cli-
|
|
19
|
+
} from "./cli-wa4p03nz.js";
|
|
20
20
|
import {
|
|
21
21
|
init_env_flag,
|
|
22
22
|
init_resolver,
|
|
23
23
|
isEnvFlagEnabled,
|
|
24
24
|
resolveTemplate
|
|
25
|
-
} from "./cli-
|
|
25
|
+
} from "./cli-hzad20bp.js";
|
|
26
26
|
|
|
27
27
|
// src/be/db-queries/tracker.ts
|
|
28
28
|
init_date_utils();
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
resolveGrammarConstrainedSampling,
|
|
11
11
|
resolveJsonSchemaStrictSampling,
|
|
12
12
|
transformMessages
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-vgexpfsr.js";
|
|
14
14
|
import {
|
|
15
15
|
calculateCost
|
|
16
|
-
} from "./cli-
|
|
16
|
+
} from "./cli-w10fkrf1.js";
|
|
17
17
|
import {
|
|
18
18
|
sanitizeSurrogates
|
|
19
19
|
} from "./cli-y2apkfe2.js";
|
|
@@ -289,6 +289,11 @@ async function processResponsesStream(openaiStream, output, stream, model, optio
|
|
|
289
289
|
let sawTerminalResponseEvent = false;
|
|
290
290
|
const outputSlots = new Map;
|
|
291
291
|
const reasoningBlocksById = new Map;
|
|
292
|
+
const applyMessagePhaseStopReason = (item) => {
|
|
293
|
+
if (item.type === "message" && item.phase === "final_answer") {
|
|
294
|
+
output.stopReason = "stop";
|
|
295
|
+
}
|
|
296
|
+
};
|
|
292
297
|
const getSlot = (outputIndex, type) => {
|
|
293
298
|
const slot = outputSlots.get(outputIndex);
|
|
294
299
|
return slot?.type === type ? slot : undefined;
|
|
@@ -317,6 +322,7 @@ async function processResponsesStream(openaiStream, output, stream, model, optio
|
|
|
317
322
|
return slot;
|
|
318
323
|
}
|
|
319
324
|
if (item.type === "message") {
|
|
325
|
+
applyMessagePhaseStopReason(item);
|
|
320
326
|
const block = { type: "text", text: "" };
|
|
321
327
|
output.content.push(block);
|
|
322
328
|
const slot = { type: "text", block, contentIndex: output.content.length - 1 };
|
|
@@ -411,7 +417,9 @@ async function processResponsesStream(openaiStream, output, stream, model, optio
|
|
|
411
417
|
const serviceTier = options.resolveServiceTier ? options.resolveServiceTier(response?.service_tier, options.serviceTier) : response?.service_tier ?? options.serviceTier;
|
|
412
418
|
options.applyServiceTierPricing(output.usage, serviceTier);
|
|
413
419
|
}
|
|
414
|
-
|
|
420
|
+
const status = response?.status;
|
|
421
|
+
output.rawStopReason = status;
|
|
422
|
+
output.stopReason = mapStopReason(status);
|
|
415
423
|
if (output.content.some((b) => b.type === "toolCall") && output.stopReason === "stop") {
|
|
416
424
|
output.stopReason = "toolUse";
|
|
417
425
|
}
|
|
@@ -511,6 +519,7 @@ async function processResponsesStream(openaiStream, output, stream, model, optio
|
|
|
511
519
|
pushToolCallDelta(slot, appendCustomToolCallInput(slot.block, event.input, true));
|
|
512
520
|
} else if (event.type === "response.output_item.done") {
|
|
513
521
|
const item = event.item;
|
|
522
|
+
applyMessagePhaseStopReason(item);
|
|
514
523
|
const slot = getOrCreateSlot(event.output_index, item);
|
|
515
524
|
if (item.type === "reasoning" && slot?.type === "thinking") {
|
|
516
525
|
const summaryText = item.summary?.map((s) => s.text).join(`
|
|
@@ -566,6 +575,7 @@ async function processResponsesStream(openaiStream, output, stream, model, optio
|
|
|
566
575
|
throw new Error(`Error Code ${event.code}: ${event.message}` || "Unknown error");
|
|
567
576
|
} else if (event.type === "response.failed") {
|
|
568
577
|
sawTerminalResponseEvent = true;
|
|
578
|
+
output.rawStopReason = event.response?.status;
|
|
569
579
|
const error = event.response?.error;
|
|
570
580
|
const details = event.response?.incomplete_details;
|
|
571
581
|
const msg = error ? `${error.code || "unknown"}: ${error.message || "no message"}` : details?.reason ? `incomplete: ${details.reason}` : "Unknown error (no error details in response)";
|