@desplega.ai/agent-swarm 1.152.2 → 1.154.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 +2 -2
- package/dist/{acp-adapter-pfeje2v5.js → acp-adapter-eb2aj8xy.js} +4 -4
- package/dist/{actions-0sttc7f5.js → actions-kpnwp1kz.js} +31 -27
- package/dist/{anthropic-messages-2y8nktar.js → anthropic-messages-9vqsbznt.js} +112 -84
- package/dist/{app-p8teva95.js → app-zk1apkf6.js} +10 -7
- package/dist/{assistant-r45jnsrt.js → assistant-kwq4y50q.js} +32 -28
- package/dist/{azure-openai-responses-f38x2avq.js → azure-openai-responses-04qwdwfq.js} +27 -13
- package/dist/{boot-reembed-je26h5y7.js → boot-reembed-22hd3jjn.js} +9 -7
- package/dist/{boot-reembed-1qmybsd4.js → boot-reembed-qe168424.js} +10 -8
- package/dist/{boot-scrub-logs-gte3h1mm.js → boot-scrub-logs-pkdpsrjd.js} +7 -5
- package/dist/{claude-adapter-csc1mzka.js → claude-adapter-3fx90nww.js} +18 -16
- package/dist/{claude-managed-adapter-dsmkcrjy.js → claude-managed-adapter-ea2aga6w.js} +3 -3
- package/dist/{claude-sdk-session-fcd6f078.js → claude-sdk-session-z7fahf1k.js} +18 -16
- package/dist/{cli-r2fpe7cx.js → cli-00w2c66p.js} +61 -55
- package/dist/{cli-wbyk465z.js → cli-09y3tjxz.js} +1 -1
- package/dist/{cli-ht5rs63n.js → cli-0e31nm4n.js} +16 -7
- package/dist/cli-0x5qzvkg.js +4279 -0
- package/dist/{cli-d3p82erb.js → cli-18amys3y.js} +9 -9
- package/dist/{cli-4ahpr4sw.js → cli-1jpjafw4.js} +5 -5
- package/dist/{cli-jbmc0r7r.js → cli-243tzws8.js} +1 -1
- package/dist/{cli-ch38q5z4.js → cli-24k806sc.js} +6789 -2542
- package/dist/cli-3bkz2p7j.js +2828 -0
- package/dist/cli-3er6gcsn.js +1849 -0
- package/dist/cli-4k7jazkq.js +3339 -0
- package/dist/{cli-c4eeb5q2.js → cli-5b6b62tz.js} +1 -1
- package/dist/{cli-qd65dvr6.js → cli-5vs0nh43.js} +65 -44
- package/dist/{cli-z3wkng35.js → cli-6r3cgpk2.js} +224 -156
- package/dist/{cli-pgj4a5fb.js → cli-71cj99hx.js} +4 -3
- package/dist/cli-8sea27q4.js +14075 -0
- package/dist/{cli-jvy9qgjs.js → cli-913yakhv.js} +22 -7
- package/dist/{cli-pf9q3696.js → cli-927erqqt.js} +5 -2
- package/dist/cli-95jnpnqg.js +230 -0
- package/dist/{cli-wpv5rgg2.js → cli-abp3g4ax.js} +15 -2
- package/dist/{cli-ckz5t2hb.js → cli-acy6bfhr.js} +10 -7
- package/dist/{cli-4yc5d8fk.js → cli-avkd6mqv.js} +50 -0
- package/dist/{cli-8wrympd7.js → cli-bzr0ftht.js} +26 -7
- package/dist/{cli-qn042eh7.js → cli-c1v10xb2.js} +194 -1913
- package/dist/cli-cgj4hc12.js +18902 -0
- package/dist/{cli-2nnd56zt.js → cli-e0pg4zeh.js} +3 -2
- package/dist/{cli-r84ctdxn.js → cli-e31ehqwy.js} +2 -2
- package/dist/{cli-gphgnvpf.js → cli-e3229na9.js} +3 -3
- package/dist/{cli-gpqcs935.js → cli-e3cyf59d.js} +2 -2
- package/dist/{cli-s25avqg9.js → cli-e781c6f9.js} +1 -0
- package/dist/{cli-s2qjdd6z.js → cli-eetrvv91.js} +1 -1
- package/dist/{cli-j4nv2wqy.js → cli-fdzg6jhf.js} +10 -4
- package/dist/{cli-fm4ytsdk.js → cli-g2h29qar.js} +2 -2
- package/dist/{cli-zvgj5zg8.js → cli-ge67p080.js} +302 -3497
- package/dist/cli-h38x0qhg.js +6912 -0
- package/dist/{cli-9xvdm3bx.js → cli-h60qfasa.js} +742 -278
- package/dist/{cli-jew3jda5.js → cli-hws0vn86.js} +2 -2
- package/dist/{cli-j8dggbcr.js → cli-k0g1sjzm.js} +23 -31
- package/dist/{cli-xw7vak96.js → cli-kp3qs53m.js} +5 -5
- package/dist/{cli-rgvp6r2x.js → cli-mcnhgnn1.js} +193 -4
- package/dist/{cli-zvkq5csn.js → cli-myaxtgh8.js} +7 -6
- package/dist/{cli-56h18ng2.js → cli-n62atwh9.js} +1 -1
- package/dist/cli-n7h1kqpf.js +29 -0
- package/dist/{cli-fmy65jdn.js → cli-pf1v8xhb.js} +7 -5
- package/dist/{cli-xy1cchaf.js → cli-q85qhckh.js} +238 -11
- package/dist/{cli-3bpzj8me.js → cli-r1d3dzt6.js} +2 -2
- package/dist/{pi-mono-adapter-jcqt71cg.js → cli-rxkqvngf.js} +67343 -101083
- package/dist/{cli-kj76p1ez.js → cli-scwq51gn.js} +13 -7
- package/dist/{cli-b9dd0h3k.js → cli-stwsmd6k.js} +3 -2
- package/dist/{cli-c2mk1kgf.js → cli-v4en75c5.js} +8 -1
- package/dist/{cli-z61ykvam.js → cli-wg04s9kr.js} +4 -3
- package/dist/cli-yn0a417a.js +4069 -0
- package/dist/{cli-zfzznn7c.js → cli-ytxs7mn1.js} +26 -2
- package/dist/{cli-4j8k1m4w.js → cli-zt1227k1.js} +1162 -192
- package/dist/cli.js +28 -35
- package/dist/{codex-adapter-fxmpsabw.js → codex-adapter-ttdm995v.js} +12 -11
- package/dist/{codex-hook-8jexc34x.js → codex-hook-8gx7bcz0.js} +3 -3
- package/dist/{codex-session-runner-rr1e47ea.js → codex-session-runner-3v8nh4c8.js} +12 -11
- package/dist/{commands-0f5rxz51.js → commands-1cxwbhhq.js} +7 -5
- package/dist/{db-r3jxf3wy.js → db-y9zwsr79.js} +25 -5
- package/dist/{dispatcher-06vph6q4.js → dispatcher-9m9zss36.js} +30 -26
- package/dist/dsh-adapter-gsb2qqf9.js +19 -0
- package/dist/{e2b-413b8t4v.js → e2b-93x1k0j5.js} +6 -7
- package/dist/{google-generative-ai-ndjmj5fa.js → google-generative-ai-gwwrnzqn.js} +33 -73
- package/dist/{google-vertex-fr665tqs.js → google-vertex-5wfawpwz.js} +38 -68
- package/dist/{handlers-0hgtc910.js → handlers-36fm1bwn.js} +33 -29
- package/dist/{hook-9kvrv1er.js → hook-pntw4r8h.js} +12 -10
- package/dist/{hook-fbfhkat3.js → hook-vwq8y26p.js} +13 -11
- package/dist/{http-xbyx8k5j.js → http-20jesakk.js} +357 -261
- package/dist/{index-jsw3aynb.js → index-6artrehg.js} +30 -26
- package/dist/{cli-pdz9qde4.js → index-9ch1n761.js} +10 -11
- package/dist/{index-rnyahfn5.js → index-9n5z2492.js} +30 -26
- package/dist/{index-66xz5e9j.js → index-h5gs261z.js} +521 -9
- package/dist/{index-tfsdxyv6.js → index-j5wrf1yw.js} +40 -25
- package/dist/{index-2sp0384z.js → index-kkeftv5h.js} +738 -21
- package/dist/{index-sgk50mbg.js → index-m2xqpz5r.js} +31 -27
- package/dist/{index-gpfn1741.js → index-m9ks8a7t.js} +9 -7
- package/dist/index-w097eg0x.js +5 -0
- package/dist/jiti-loader-b4837mtm.js +34 -0
- package/dist/jiti-static-loader-q2g5ds0y.js +31267 -0
- package/dist/{keepalive-s3xpr7sw.js → keepalive-pwxvxd2c.js} +9 -7
- package/dist/{lead-rq4n5r16.js → lead-m789wqa3.js} +46 -41
- package/dist/{maintenance-f0atj1ab.js → maintenance-bvg6w7e2.js} +10 -8
- package/dist/{mistral-conversations-qhr84ph3.js → mistral-conversations-zx0kn554.js} +24 -18
- package/dist/{node-x1g4v0pq.js → node-5qtycf6a.js} +16 -11
- package/dist/{oauth-refresh-sweep-q0t3bxre.js → oauth-refresh-sweep-6v4bd737.js} +8 -6
- package/dist/{onboard-br5j1kch.js → onboard-snckpcj1.js} +115 -35
- package/dist/{openai-codex-responses-wy6a43wd.js → openai-codex-responses-4vjqzvjp.js} +33 -27
- package/dist/{openai-completions-32rdwmze.js → openai-completions-pxsmym7g.js} +52 -64
- package/dist/{openai-responses-6xwf7bzg.js → openai-responses-tmn0rqp0.js} +23 -24
- package/dist/{opencode-adapter-28axqa09.js → opencode-adapter-qbmv4tpy.js} +6 -6
- package/dist/{otel-impl-vdqge2nt.js → otel-impl-e0ytens5.js} +4 -4
- package/dist/{pi-messages-b1mbr6gp.js → pi-messages-txpjj39q.js} +3 -3
- package/dist/pi-mono-adapter-c4ggemhz.js +1316 -0
- package/dist/{pricing-refresh-hb3691fd.js → pricing-refresh-52g2ywrw.js} +9 -7
- package/dist/{rbac-roles-t78xt39b.js → rbac-roles-5455kfdn.js} +8 -6
- package/dist/{rbac-roles-jh280k9g.js → rbac-roles-hbf0xa52.js} +9 -7
- package/dist/{render-v2-7p8r2ymg.js → render-v2-npm8xdzh.js} +16 -9
- package/dist/{seed-pricing-hf889enh.js → seed-pricing-650wbr1n.js} +8 -6
- package/dist/{setup-w6mb03jv.js → setup-k1mew5rf.js} +4 -5
- package/dist/virtual-modules-2q5b2pk4.js +54 -0
- package/dist/{work-objects-nt8gy1kj.js → work-objects-2ea3kvwg.js} +33 -29
- package/dist/{worker-dwy617t0.js → worker-ec6hvc4m.js} +46 -41
- package/openapi.json +109 -16
- package/package.json +7 -6
- package/plugin/opencode-plugins/lib/memory-raters.ts +7 -0
- package/src/be/automation-preflight.ts +6 -4
- package/src/be/db/agents.ts +75 -2
- package/src/be/db/tasks/read.ts +2 -0
- package/src/be/db/tasks/write.ts +7 -1
- package/src/be/db.ts +140 -18
- package/src/be/extensions/db.ts +35 -4
- package/src/be/memory/raters/llm.ts +2 -6
- package/src/be/memory/raters/noop.ts +2 -3
- package/src/be/memory/raters/registry.ts +4 -10
- package/src/be/migrations/157_defer_provenance_and_marker.sql +27 -0
- package/src/be/models-catalog.ts +2 -0
- package/src/be/modelsdev-cache.json +213 -0
- package/src/be/rbac-audit.ts +2 -0
- package/src/be/seed/agent-fs-provision.ts +23 -0
- package/src/be/seed-pricing.ts +3 -1
- package/src/be/swarm-config-guard.ts +1 -0
- package/src/commands/onboard/compose-generator.ts +16 -1
- package/src/commands/onboard/env-generator.ts +14 -1
- package/src/commands/onboard/manifest.ts +1 -0
- package/src/commands/onboard/steps/integration-slack.tsx +56 -16
- package/src/commands/onboard/steps/review.tsx +5 -0
- package/src/commands/onboard/types.ts +6 -0
- package/src/commands/onboard.tsx +5 -1
- package/src/commands/provider-credentials.ts +14 -2
- package/src/commands/runner.ts +18 -2
- package/src/extensions/identity.ts +15 -7
- package/src/extensions/lifecycle.ts +15 -21
- package/src/hooks/codex-hook.ts +7 -1
- package/src/http/agents.ts +12 -4
- package/src/http/config.ts +1 -1
- package/src/http/core.ts +5 -3
- package/src/http/extensions.ts +108 -34
- package/src/http/poll.ts +7 -0
- package/src/http/schedules.ts +10 -0
- package/src/http/script-runs.ts +35 -26
- package/src/http/status.ts +24 -11
- package/src/http/tasks.ts +6 -1
- package/src/prompts/base-prompt.ts +15 -7
- package/src/prompts/memories.ts +5 -7
- package/src/prompts/session-templates.ts +3 -2
- package/src/prompts/steering-delivery.ts +2 -0
- package/src/providers/claude-managed-models.ts +8 -0
- package/src/providers/codex-adapter.ts +3 -6
- package/src/providers/codex-models.ts +15 -1
- package/src/providers/dsh-adapter.ts +248 -0
- package/src/providers/index.ts +5 -1
- package/src/providers/modelsdev-reasoning.json +50 -0
- package/src/providers/pi-mono-extension.ts +2 -5
- package/src/rbac/legacy-policy.ts +15 -1
- package/src/rbac/types.ts +2 -0
- package/src/server.ts +7 -1
- package/src/slack/ack.ts +43 -8
- package/src/slack/app.ts +32 -10
- package/src/slack/config.ts +29 -0
- package/src/slack/handlers.ts +7 -1
- package/src/slack/render-v2.ts +186 -17
- package/src/slack/responses.ts +1 -3
- package/src/slack/task-output.ts +66 -8
- package/src/slack/thread-buffer.ts +27 -3
- package/src/telemetry.ts +2 -3
- package/src/tests/agent-fs-provision-seeder.test.ts +56 -2
- package/src/tests/agents-harness-provider.test.ts +19 -0
- package/src/tests/agents-list-model-display.test.ts +60 -1
- package/src/tests/base-prompt.test.ts +25 -0
- package/src/tests/claude-managed-adapter.test.ts +6 -0
- package/src/tests/codex-gpt6-release.test.ts +97 -0
- package/src/tests/codex-steering-hook.test.ts +2 -2
- package/src/tests/config-api-only-keys.test.ts +9 -0
- package/src/tests/context-window.test.ts +1 -0
- package/src/tests/db-task-read-contract.test.ts +9 -0
- package/src/tests/db-task-write-contract.test.ts +9 -0
- package/src/tests/defer-task.test.ts +115 -16
- package/src/tests/dsh-adapter.test.ts +276 -0
- package/src/tests/e2e-nightly-report.test.ts +3 -3
- package/src/tests/e2e-redact.test.ts +2 -0
- package/src/tests/env-flag.test.ts +6 -0
- package/src/tests/extension-agent-visibility.test.ts +474 -0
- package/src/tests/extensions-db.test.ts +41 -0
- package/src/tests/extensions-http.test.ts +148 -4
- package/src/tests/extensions-lifecycle.test.ts +21 -1
- package/src/tests/extensions-mcp-tools.test.ts +9 -5
- package/src/tests/fetch-resolved-env.test.ts +43 -0
- package/src/tests/internal-ai/complete-structured.test.ts +32 -9
- package/src/tests/internal-ai/credentials.test.ts +4 -4
- package/src/tests/internal-ai/models.test.ts +20 -0
- package/src/tests/memory-rate-tool.test.ts +7 -10
- package/src/tests/memory-rater-defaults.test.ts +23 -0
- package/src/tests/memory-rater-e2e.test.ts +2 -3
- package/src/tests/migration-046-budgets.test.ts +2 -0
- package/src/tests/model-control.test.ts +2 -2
- package/src/tests/onboard-compose.test.ts +14 -0
- package/src/tests/onboard-env.test.ts +17 -0
- package/src/tests/onboard-manifest.test.ts +12 -0
- package/src/tests/opus-5-5-registry.test.ts +48 -0
- package/src/tests/pricing-refresh.test.ts +1 -1
- package/src/tests/pricing-routes.test.ts +15 -3
- package/src/tests/provider-registration.test.ts +5 -2
- package/src/tests/rbac-admission-e2e.test.ts +54 -0
- package/src/tests/rbac-e2e-helpers.ts +2 -0
- package/src/tests/rbac-engine.test.ts +32 -0
- package/src/tests/rbac-wire-e2e.test.ts +33 -0
- package/src/tests/reasoning-effort.test.ts +8 -0
- package/src/tests/reload-config.test.ts +33 -0
- package/src/tests/script-connections.test.ts +3 -0
- package/src/tests/session-costs-model-key-normalize.test.ts +1 -0
- package/src/tests/slack-config.test.ts +136 -0
- package/src/tests/slack-mode-lifecycle.test.ts +69 -0
- package/src/tests/slack-render-v2.test.ts +446 -16
- package/src/tests/slack-steering.test.ts +69 -1
- package/src/tests/slack-task-output.test.ts +33 -12
- package/src/tests/status.test.ts +22 -2
- package/src/tests/steering-core.test.ts +35 -0
- package/src/tests/steering-delivery.test.ts +39 -0
- package/src/tests/steering-transport.test.ts +2 -2
- package/src/tests/task-tool-preload-mcp.test.ts +3 -1
- package/src/tests/telemetry-init.test.ts +18 -0
- package/src/tests/workflow-live-recovery.test.ts +126 -0
- package/src/tests/workflow-llm.test.ts +3 -3
- package/src/tools/defer-task.ts +64 -26
- package/src/tools/extension-common.ts +4 -0
- package/src/tools/extension-install.ts +1 -1
- package/src/tools/extension-list.ts +4 -3
- package/src/tools/join-swarm.ts +1 -1
- package/src/tools/schedules/create-schedule.ts +11 -1
- package/src/tools/schedules/patch-schedule.ts +5 -0
- package/src/tools/schedules/update-schedule.ts +5 -0
- package/src/tools/send-task.ts +6 -0
- package/src/tools/utils.ts +1 -1
- package/src/types.ts +30 -8
- package/src/utils/context-window.ts +1 -0
- package/src/utils/credentials.ts +8 -0
- package/src/utils/internal-ai/complete-structured.ts +8 -0
- package/src/utils/internal-ai/models.ts +5 -5
- package/src/utils/memory-raters.ts +3 -0
- package/src/workflows/engine.ts +28 -0
- package/src/workflows/recovery.ts +7 -4
- package/templates/schedules/daily-status-report/content.md +25 -12
- package/templates/schedules/daily-workflow-health-audit/content.md +1 -1
- package/templates/skills/swarm-extensions/content.md +9 -5
- package/dist/cli-4wppfkcm.js +0 -16384
- package/dist/cli-55qrx3q8.js +0 -6041
- package/dist/cli-cg4vnyh4.js +0 -305
- package/dist/cli-jyetr64j.js +0 -52
- package/dist/cli-pp9ax9pa.js +0 -520
- package/dist/cli-qa66qaf0.js +0 -6076
- package/dist/cli-qghpvca2.js +0 -590
- package/dist/cli-rembwgt8.js +0 -861
- package/dist/cli-tcvj7j2r.js +0 -1971
- package/dist/cli-vfcth11k.js +0 -36
- package/dist/cli-w1d1bgkk.js +0 -1422
- package/dist/cli-y6x0gqtg.js +0 -5977
- package/dist/es5-tj3tn4jj.js +0 -844
- package/dist/index-1kq5hw2p.js +0 -467
- package/dist/index-1p8wdstt.js +0 -7
- package/dist/index-8fdjzb2f.js +0 -100
- package/dist/index-bxmwzbgw.js +0 -365
- package/dist/index-nzerxd5z.js +0 -7
- package/dist/index-pyymnzat.js +0 -1168
- package/dist/index-qv6atbab.js +0 -619
- package/dist/index-rja32qa7.js +0 -801
- package/dist/index-tzg5srfp.js +0 -211
- package/dist/index-vhncw983.js +0 -90
- package/dist/index-xk036zsk.js +0 -859
- package/dist/index-zyazbzcb.js +0 -6
- package/dist/{claude-managed-setup-48dwg9bv.js → claude-managed-setup-f5pmsyrp.js} +3 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
resolveSlackUserId,
|
|
2
3
|
rewriteSlackMentions
|
|
3
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-r1d3dzt6.js";
|
|
4
5
|
import {
|
|
5
6
|
bufferedFileFailures,
|
|
6
7
|
buildEffectiveText,
|
|
@@ -8,8 +9,9 @@ import {
|
|
|
8
9
|
createSlackTaskWithFiles,
|
|
9
10
|
extractSlackMessageText,
|
|
10
11
|
fetchSlackFiles,
|
|
12
|
+
findUserByExternalId,
|
|
11
13
|
notifySlackFileFailures
|
|
12
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-6r3cgpk2.js";
|
|
13
15
|
import {
|
|
14
16
|
buildBufferFlushBlocks,
|
|
15
17
|
ensureSlackThreadTree,
|
|
@@ -18,7 +20,7 @@ import {
|
|
|
18
20
|
getSlackApp,
|
|
19
21
|
isSlackRenderV2Enabled,
|
|
20
22
|
registerTreeMessage
|
|
21
|
-
} from "./cli-
|
|
23
|
+
} from "./cli-c1v10xb2.js";
|
|
22
24
|
import {
|
|
23
25
|
createLogEntry,
|
|
24
26
|
getAgentById,
|
|
@@ -31,11 +33,11 @@ import {
|
|
|
31
33
|
init_steering,
|
|
32
34
|
requestSteering,
|
|
33
35
|
slackContextKey
|
|
34
|
-
} from "./cli-
|
|
36
|
+
} from "./cli-ge67p080.js";
|
|
35
37
|
import {
|
|
36
38
|
init_steering_enabled,
|
|
37
39
|
isSteeringEnabled
|
|
38
|
-
} from "./cli-
|
|
40
|
+
} from "./cli-wg04s9kr.js";
|
|
39
41
|
import {
|
|
40
42
|
__callDispose,
|
|
41
43
|
__using
|
|
@@ -234,11 +236,20 @@ ${combinedText}`;
|
|
|
234
236
|
if (latestActiveTask) {
|
|
235
237
|
console.log(`[Slack] Dependency chaining: latest active task ${latestActiveTask.id} (status: ${latestActiveTask.status})`);
|
|
236
238
|
}
|
|
239
|
+
const requestedByUserId = app ? await resolveSlackUserId(app.client, originalRequesterId, {
|
|
240
|
+
sampleEventType: "buffered_thread_reply",
|
|
241
|
+
sampleContext: items[0].text
|
|
242
|
+
}) : (await findUserByExternalId("slack", originalRequesterId))?.id;
|
|
243
|
+
const nextSenderIndex = items.findIndex((item) => item.userId !== originalRequesterId);
|
|
244
|
+
const steeringItems = nextSenderIndex === -1 ? items : items.slice(0, nextSenderIndex);
|
|
237
245
|
const steering = files.length === 0 ? await requestSlackThreadSteering({
|
|
238
246
|
channelId,
|
|
239
247
|
threadTs,
|
|
240
|
-
message: combinedText
|
|
241
|
-
|
|
248
|
+
message: nextSenderIndex === -1 ? combinedText : await rewriteSlackMentions(steeringItems.map((item) => item.text).join(`
|
|
249
|
+
---
|
|
250
|
+
`), botUserId),
|
|
251
|
+
messageTimestamps: steeringItems.map((item) => item.ts),
|
|
252
|
+
requestedByUserId
|
|
242
253
|
}) : null;
|
|
243
254
|
if (steering) {
|
|
244
255
|
console.log(`[Slack] Buffer flushed → steering ${steering.result.outcome} for task ${steering.task.id}`);
|
|
@@ -259,6 +270,9 @@ ${combinedText}`;
|
|
|
259
270
|
}
|
|
260
271
|
}
|
|
261
272
|
}
|
|
273
|
+
if (nextSenderIndex !== -1) {
|
|
274
|
+
await slackFlush(items.slice(nextSenderIndex), key, immediate);
|
|
275
|
+
}
|
|
262
276
|
return;
|
|
263
277
|
}
|
|
264
278
|
const lead = await getLeadAgent();
|
|
@@ -279,6 +293,7 @@ ${description}` : description;
|
|
|
279
293
|
slackThreadTs: threadTs,
|
|
280
294
|
slackTriggerMessageTs: items.at(-1).ts,
|
|
281
295
|
slackUserId: originalRequesterId,
|
|
296
|
+
requestedByUserId,
|
|
282
297
|
dependsOn,
|
|
283
298
|
parentTaskId: mostRecentTask?.id,
|
|
284
299
|
contextKey: slackContextKey({ channelId, threadTs })
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getMemoryRaterNames
|
|
3
|
+
} from "./cli-3bkz2p7j.js";
|
|
4
|
+
|
|
1
5
|
// src/prompts/memories.ts
|
|
2
6
|
var SIMILARITY_THRESHOLD = 0.4;
|
|
3
7
|
var RATE_TOOL_HINT = `
|
|
@@ -26,8 +30,7 @@ ${memoryContext}
|
|
|
26
30
|
return prompt;
|
|
27
31
|
}
|
|
28
32
|
function isExplicitSelfRaterEnabled() {
|
|
29
|
-
|
|
30
|
-
return ratersEnabled.includes("explicit-self");
|
|
33
|
+
return getMemoryRaterNames().includes("explicit-self");
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
// src/utils/skill-fs-writer.ts
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveSlashSkillPrompt
|
|
3
|
+
} from "./cli-r94z9p1z.js";
|
|
4
|
+
import {
|
|
5
|
+
getOpenRouterBaseUrl
|
|
6
|
+
} from "./cli-3dpj7atn.js";
|
|
7
|
+
import {
|
|
8
|
+
detachedProcessGroup,
|
|
9
|
+
registerProcessGroup,
|
|
10
|
+
terminateProcessGroup
|
|
11
|
+
} from "./cli-y89t4nca.js";
|
|
12
|
+
import {
|
|
13
|
+
DEFAULT_MODEL_TIER_MAP,
|
|
14
|
+
init_types
|
|
15
|
+
} from "./cli-4k7jazkq.js";
|
|
16
|
+
import {
|
|
17
|
+
init_secret_scrubber,
|
|
18
|
+
registerVolatileSecret,
|
|
19
|
+
scrubSecrets
|
|
20
|
+
} from "./cli-r2ap2czm.js";
|
|
21
|
+
|
|
22
|
+
// src/providers/dsh-adapter.ts
|
|
23
|
+
init_types();
|
|
24
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
25
|
+
import { tmpdir } from "node:os";
|
|
26
|
+
import { join } from "node:path";
|
|
27
|
+
init_secret_scrubber();
|
|
28
|
+
var DSH_PACKAGE = "@deepseek-ai/dsh@0.1.7-alpha.2";
|
|
29
|
+
function checkDshCredentials(env) {
|
|
30
|
+
return env.DEEPSEEK_API_KEY?.trim() || env.OPENROUTER_API_KEY?.trim() ? { ready: true, missing: [], satisfiedBy: "env" } : {
|
|
31
|
+
ready: false,
|
|
32
|
+
missing: ["DEEPSEEK_API_KEY", "OPENROUTER_API_KEY"],
|
|
33
|
+
hint: "Set DEEPSEEK_API_KEY or OPENROUTER_API_KEY for dsh."
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
class DshSession {
|
|
38
|
+
proc;
|
|
39
|
+
directory;
|
|
40
|
+
sessionId;
|
|
41
|
+
listeners = [];
|
|
42
|
+
pending = [];
|
|
43
|
+
output;
|
|
44
|
+
failure;
|
|
45
|
+
stderr = "";
|
|
46
|
+
aborted = false;
|
|
47
|
+
completion;
|
|
48
|
+
constructor(proc, directory, prompt) {
|
|
49
|
+
this.proc = proc;
|
|
50
|
+
this.directory = directory;
|
|
51
|
+
this.completion = this.run(prompt);
|
|
52
|
+
}
|
|
53
|
+
onEvent(listener) {
|
|
54
|
+
this.listeners.push(listener);
|
|
55
|
+
for (const event of this.pending.splice(0))
|
|
56
|
+
listener(event);
|
|
57
|
+
}
|
|
58
|
+
emit(event) {
|
|
59
|
+
if (this.listeners.length === 0)
|
|
60
|
+
this.pending.push(event);
|
|
61
|
+
else
|
|
62
|
+
for (const listener of this.listeners)
|
|
63
|
+
listener(event);
|
|
64
|
+
}
|
|
65
|
+
consumeLine(line) {
|
|
66
|
+
if (!line.trim())
|
|
67
|
+
return;
|
|
68
|
+
const clean = scrubSecrets(line);
|
|
69
|
+
this.emit({ type: "raw_log", content: clean });
|
|
70
|
+
try {
|
|
71
|
+
const event = JSON.parse(clean);
|
|
72
|
+
if (event.type === "session" && typeof event.sessionId === "string") {
|
|
73
|
+
this.sessionId = event.sessionId;
|
|
74
|
+
this.emit({ type: "session_init", sessionId: event.sessionId, provider: "dsh" });
|
|
75
|
+
} else if (event.type === "text" && typeof event.text === "string") {
|
|
76
|
+
this.emit({ type: "message", role: "assistant", content: event.text });
|
|
77
|
+
} else if (event.type === "final" && typeof event.text === "string") {
|
|
78
|
+
this.output = event.text;
|
|
79
|
+
} else if (event.type === "error" && typeof event.message === "string") {
|
|
80
|
+
this.failure = event.message;
|
|
81
|
+
} else if (event.type === "status" && typeof event.phase === "string") {
|
|
82
|
+
this.emit({ type: "progress", message: event.phase });
|
|
83
|
+
if (event.phase === "turn_end" && event.reason?.kind !== "completed") {
|
|
84
|
+
this.failure = typeof event.reason?.error?.message === "string" ? event.reason.error.message : `dsh turn ended: ${event.reason?.kind ?? "unknown"}`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
} catch {
|
|
88
|
+
this.failure = "dsh emitted invalid JSON output";
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async readStdout() {
|
|
92
|
+
const decoder = new TextDecoder;
|
|
93
|
+
let buffer = "";
|
|
94
|
+
for await (const chunk of this.proc.stdout) {
|
|
95
|
+
buffer += decoder.decode(chunk, { stream: true });
|
|
96
|
+
let newline = buffer.indexOf(`
|
|
97
|
+
`);
|
|
98
|
+
while (newline >= 0) {
|
|
99
|
+
this.consumeLine(buffer.slice(0, newline));
|
|
100
|
+
buffer = buffer.slice(newline + 1);
|
|
101
|
+
newline = buffer.indexOf(`
|
|
102
|
+
`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
this.consumeLine(buffer + decoder.decode());
|
|
106
|
+
}
|
|
107
|
+
async readStderr() {
|
|
108
|
+
const decoder = new TextDecoder;
|
|
109
|
+
for await (const chunk of this.proc.stderr) {
|
|
110
|
+
const content = scrubSecrets(decoder.decode(chunk, { stream: true }));
|
|
111
|
+
this.stderr = (this.stderr + content).slice(-8000);
|
|
112
|
+
this.emit({ type: "raw_stderr", content });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async run(prompt) {
|
|
116
|
+
try {
|
|
117
|
+
const [exitCode] = await Promise.all([
|
|
118
|
+
this.proc.exited,
|
|
119
|
+
this.readStdout(),
|
|
120
|
+
this.readStderr(),
|
|
121
|
+
(async () => {
|
|
122
|
+
this.proc.stdin.write(prompt);
|
|
123
|
+
await this.proc.stdin.end();
|
|
124
|
+
})()
|
|
125
|
+
]);
|
|
126
|
+
const isError = this.aborted || exitCode !== 0 || !!this.failure || this.output === undefined;
|
|
127
|
+
const failureReason = isError ? this.aborted ? "dsh session aborted" : this.failure || this.stderr.trim() || `dsh exited ${exitCode} without a final result` : undefined;
|
|
128
|
+
if (failureReason)
|
|
129
|
+
this.emit({ type: "error", message: failureReason });
|
|
130
|
+
return {
|
|
131
|
+
exitCode: isError ? exitCode || 1 : 0,
|
|
132
|
+
sessionId: this.sessionId,
|
|
133
|
+
output: this.output,
|
|
134
|
+
isError,
|
|
135
|
+
failureReason
|
|
136
|
+
};
|
|
137
|
+
} catch (error) {
|
|
138
|
+
await terminateProcessGroup(this.proc.pid);
|
|
139
|
+
const failureReason = scrubSecrets(String(error));
|
|
140
|
+
this.emit({ type: "error", message: failureReason });
|
|
141
|
+
return { exitCode: 1, sessionId: this.sessionId, isError: true, failureReason };
|
|
142
|
+
} finally {
|
|
143
|
+
await rm(this.directory, { recursive: true, force: true });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
waitForCompletion() {
|
|
147
|
+
return this.completion;
|
|
148
|
+
}
|
|
149
|
+
async abort() {
|
|
150
|
+
this.aborted = true;
|
|
151
|
+
await terminateProcessGroup(this.proc.pid);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
class DshAdapter {
|
|
156
|
+
name = "dsh";
|
|
157
|
+
traits = {
|
|
158
|
+
hasMcp: false,
|
|
159
|
+
nativeSkillDiscovery: false,
|
|
160
|
+
hasLocalEnvironment: true,
|
|
161
|
+
steerModes: []
|
|
162
|
+
};
|
|
163
|
+
async createSession(config) {
|
|
164
|
+
const env = { ...process.env, ...config.env };
|
|
165
|
+
if (!checkDshCredentials(env).ready) {
|
|
166
|
+
throw new Error("dsh requires DEEPSEEK_API_KEY or OPENROUTER_API_KEY");
|
|
167
|
+
}
|
|
168
|
+
const model = config.model || DEFAULT_MODEL_TIER_MAP.dsh.regular;
|
|
169
|
+
const openrouter = model.startsWith("openrouter/");
|
|
170
|
+
const modelId = openrouter ? model.slice("openrouter/".length) : model;
|
|
171
|
+
const keyEnv = openrouter ? "OPENROUTER_API_KEY" : "DEEPSEEK_API_KEY";
|
|
172
|
+
if (!modelId.trim())
|
|
173
|
+
throw new Error("dsh requires a model ID after openrouter/");
|
|
174
|
+
if (!env[keyEnv]?.trim())
|
|
175
|
+
throw new Error(`dsh model ${model} requires ${keyEnv}`);
|
|
176
|
+
const binary = env.DSH_BINARY || Bun.which("dsh", { PATH: env.PATH });
|
|
177
|
+
if (!binary) {
|
|
178
|
+
throw new Error(`dsh CLI not found. Install ${DSH_PACKAGE} during image provisioning or set DSH_BINARY to a trusted executable.`);
|
|
179
|
+
}
|
|
180
|
+
registerVolatileSecret(env[keyEnv], keyEnv);
|
|
181
|
+
const prompt = await resolveSlashSkillPrompt(config.prompt, {
|
|
182
|
+
providerLabel: "dsh",
|
|
183
|
+
skillsDir: join(env.HOME ?? "/home/worker", ".agents", "skills")
|
|
184
|
+
});
|
|
185
|
+
const directory = await mkdtemp(join(tmpdir(), "swarm-dsh-"));
|
|
186
|
+
try {
|
|
187
|
+
const patchPath = join(directory, "patch.json");
|
|
188
|
+
await writeFile(patchPath, JSON.stringify([
|
|
189
|
+
{
|
|
190
|
+
id: "agent-default-model",
|
|
191
|
+
config: { provider: openrouter ? "openrouter" : "deepseek-official", model: modelId }
|
|
192
|
+
},
|
|
193
|
+
{ id: "system-prompt", config: { personaPrefix: config.systemPrompt } },
|
|
194
|
+
openrouter ? {
|
|
195
|
+
id: "llm-pi-ai",
|
|
196
|
+
config: {
|
|
197
|
+
providers: {
|
|
198
|
+
openrouter: {
|
|
199
|
+
apiKeyEnv: keyEnv,
|
|
200
|
+
baseURL: getOpenRouterBaseUrl(env),
|
|
201
|
+
api: "openai-completions",
|
|
202
|
+
models: [{ id: modelId }]
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
} : { id: "llm-deepseek", config: { apiKeyEnv: keyEnv } }
|
|
207
|
+
]), { mode: 384 });
|
|
208
|
+
const proc = registerProcessGroup(Bun.spawn([binary, "--profile", "headless", "--patch", patchPath, "--json", "-"], {
|
|
209
|
+
cwd: config.cwd,
|
|
210
|
+
env,
|
|
211
|
+
stdin: "pipe",
|
|
212
|
+
stdout: "pipe",
|
|
213
|
+
stderr: "pipe",
|
|
214
|
+
detached: detachedProcessGroup
|
|
215
|
+
}));
|
|
216
|
+
return new DshSession(proc, directory, prompt);
|
|
217
|
+
} catch (error) {
|
|
218
|
+
await rm(directory, { recursive: true, force: true });
|
|
219
|
+
throw error;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
async canResume(_sessionId) {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
formatCommand(commandName) {
|
|
226
|
+
return `/${commandName}`;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export { DSH_PACKAGE, checkDshCredentials, DshAdapter };
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getScriptMcpTypes,
|
|
5
5
|
listAppRecords,
|
|
6
6
|
require_typescript
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-pf1v8xhb.js";
|
|
8
8
|
import {
|
|
9
9
|
deleteSwarmConfigByKey,
|
|
10
10
|
getAgentById,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
getSwarmConfigs,
|
|
14
14
|
init_db,
|
|
15
15
|
upsertSwarmConfig
|
|
16
|
-
} from "./cli-
|
|
16
|
+
} from "./cli-ge67p080.js";
|
|
17
17
|
import {
|
|
18
18
|
init_secret_scrubber,
|
|
19
19
|
scrubSecrets
|
|
@@ -165,6 +165,7 @@ async function ensureAgentFsCredentialsForAgent(agentId) {
|
|
|
165
165
|
key: "AGENT_FS_API_KEY"
|
|
166
166
|
}))[0];
|
|
167
167
|
if (existing?.value) {
|
|
168
|
+
await syncAgentFsDisplayName(apiUrl, existing.value, agent.name);
|
|
168
169
|
return {
|
|
169
170
|
enabled: true,
|
|
170
171
|
created: false,
|
|
@@ -209,6 +210,7 @@ async function ensureAgentFsCredentialsForAgent(agentId) {
|
|
|
209
210
|
isSecret: true,
|
|
210
211
|
description: `agent-fs API key for ${email}`
|
|
211
212
|
});
|
|
213
|
+
await syncAgentFsDisplayName(apiUrl, apiKey, agent.name);
|
|
212
214
|
return {
|
|
213
215
|
enabled: true,
|
|
214
216
|
created: true,
|
|
@@ -218,6 +220,17 @@ async function ensureAgentFsCredentialsForAgent(agentId) {
|
|
|
218
220
|
driveId: shared.driveId
|
|
219
221
|
};
|
|
220
222
|
}
|
|
223
|
+
async function syncAgentFsDisplayName(apiUrl, apiKey, name) {
|
|
224
|
+
try {
|
|
225
|
+
await agentFsRequest(apiUrl, "/auth/profile", {
|
|
226
|
+
method: "PATCH",
|
|
227
|
+
headers: { authorization: `Bearer ${apiKey}` },
|
|
228
|
+
body: { displayName: name }
|
|
229
|
+
});
|
|
230
|
+
} catch (error) {
|
|
231
|
+
console.warn(scrubSecrets(`[agent-fs] display name sync skipped: ${error instanceof AgentFsRequestError ? `HTTP ${error.status}` : "request failed"}`));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
221
234
|
async function ensureSharedOrg(apiUrl, headers) {
|
|
222
235
|
const configured = await getConfigValue("AGENT_FS_DEFAULT_ORG_ID") || await getConfigValue("AGENT_FS_SHARED_ORG_ID");
|
|
223
236
|
if (configured)
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
instantFlush,
|
|
6
6
|
requestSlackThreadSteering,
|
|
7
7
|
wasEventSeen
|
|
8
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-913yakhv.js";
|
|
9
9
|
import {
|
|
10
10
|
enrichSlackUserEmail,
|
|
11
11
|
resolveSlackUserId,
|
|
12
12
|
rewriteSlackMentions
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-r1d3dzt6.js";
|
|
14
14
|
import {
|
|
15
15
|
TaskCreationBlockedError,
|
|
16
16
|
broadcastMatches,
|
|
@@ -23,14 +23,14 @@ import {
|
|
|
23
23
|
hasOtherUserMention,
|
|
24
24
|
notifySlackFileFailures,
|
|
25
25
|
routeMessage
|
|
26
|
-
} from "./cli-
|
|
26
|
+
} from "./cli-6r3cgpk2.js";
|
|
27
27
|
import {
|
|
28
28
|
ackSlackMessage,
|
|
29
29
|
buildTreeBlocks,
|
|
30
30
|
ensureSlackThreadTree,
|
|
31
31
|
isSlackRenderV2Enabled,
|
|
32
32
|
registerTreeMessage
|
|
33
|
-
} from "./cli-
|
|
33
|
+
} from "./cli-c1v10xb2.js";
|
|
34
34
|
import {
|
|
35
35
|
getAgentById,
|
|
36
36
|
getAgentWorkingOnThread,
|
|
@@ -40,13 +40,14 @@ import {
|
|
|
40
40
|
getTasksByAgentId,
|
|
41
41
|
init_context_key,
|
|
42
42
|
init_db,
|
|
43
|
+
isExtensionAgent,
|
|
43
44
|
reactionName,
|
|
44
45
|
slackContextKey
|
|
45
|
-
} from "./cli-
|
|
46
|
+
} from "./cli-ge67p080.js";
|
|
46
47
|
import {
|
|
47
48
|
init_resolver,
|
|
48
49
|
resolveTemplate
|
|
49
|
-
} from "./cli-
|
|
50
|
+
} from "./cli-wg04s9kr.js";
|
|
50
51
|
import {
|
|
51
52
|
init_env_flag,
|
|
52
53
|
isEnvFlagEnabled
|
|
@@ -370,7 +371,9 @@ function registerMessageHandler(app) {
|
|
|
370
371
|
const { target } = routeResult.data;
|
|
371
372
|
if (target.kind === "agent") {
|
|
372
373
|
const agent = await getAgentById(target.agentId);
|
|
373
|
-
if (agent) {
|
|
374
|
+
if (agent && isExtensionAgent(agent)) {
|
|
375
|
+
console.warn("[Slack] Extension selected an extension-identity agent. Using the built-in router:", scrubSecrets(target.agentId));
|
|
376
|
+
} else if (agent) {
|
|
374
377
|
matches = [{ agent, matchedText: "extension" }];
|
|
375
378
|
} else {
|
|
376
379
|
console.warn("[Slack] Extension selected an unknown agent. Using the built-in router:", scrubSecrets(target.agentId));
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
// src/providers/modelsdev-reasoning.json
|
|
2
2
|
var modelsdev_reasoning_default = {
|
|
3
3
|
anthropic: {
|
|
4
|
+
"claude-opus-5-5": {
|
|
5
|
+
id: "claude-opus-5-5",
|
|
6
|
+
reasoning: true,
|
|
7
|
+
reasoningOptions: [
|
|
8
|
+
{
|
|
9
|
+
type: "effort",
|
|
10
|
+
values: [
|
|
11
|
+
"low",
|
|
12
|
+
"medium",
|
|
13
|
+
"high",
|
|
14
|
+
"xhigh",
|
|
15
|
+
"max"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
4
20
|
"claude-sonnet-4-6": {
|
|
5
21
|
id: "claude-sonnet-4-6",
|
|
6
22
|
reasoning: true,
|
|
@@ -920,6 +936,40 @@ var modelsdev_reasoning_default = {
|
|
|
920
936
|
]
|
|
921
937
|
}
|
|
922
938
|
]
|
|
939
|
+
},
|
|
940
|
+
"gpt-6-sol": {
|
|
941
|
+
id: "gpt-6-sol",
|
|
942
|
+
reasoning: true,
|
|
943
|
+
reasoningOptions: [
|
|
944
|
+
{
|
|
945
|
+
type: "effort",
|
|
946
|
+
values: [
|
|
947
|
+
"none",
|
|
948
|
+
"low",
|
|
949
|
+
"medium",
|
|
950
|
+
"high",
|
|
951
|
+
"xhigh",
|
|
952
|
+
"max"
|
|
953
|
+
]
|
|
954
|
+
}
|
|
955
|
+
]
|
|
956
|
+
},
|
|
957
|
+
"gpt-6-luna": {
|
|
958
|
+
id: "gpt-6-luna",
|
|
959
|
+
reasoning: true,
|
|
960
|
+
reasoningOptions: [
|
|
961
|
+
{
|
|
962
|
+
type: "effort",
|
|
963
|
+
values: [
|
|
964
|
+
"none",
|
|
965
|
+
"low",
|
|
966
|
+
"medium",
|
|
967
|
+
"high",
|
|
968
|
+
"xhigh",
|
|
969
|
+
"max"
|
|
970
|
+
]
|
|
971
|
+
}
|
|
972
|
+
]
|
|
923
973
|
}
|
|
924
974
|
},
|
|
925
975
|
openrouter: {
|
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
// node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js
|
|
2
|
+
class FifoQueue {
|
|
3
|
+
incoming = [];
|
|
4
|
+
outgoing = [];
|
|
5
|
+
get length() {
|
|
6
|
+
return this.incoming.length + this.outgoing.length;
|
|
7
|
+
}
|
|
8
|
+
enqueue(value) {
|
|
9
|
+
this.incoming.push(value);
|
|
10
|
+
}
|
|
11
|
+
dequeue() {
|
|
12
|
+
if (this.outgoing.length === 0) {
|
|
13
|
+
while (this.incoming.length > 0) {
|
|
14
|
+
this.outgoing.push(this.incoming.pop());
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return this.outgoing.pop();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
2
21
|
class EventStream {
|
|
3
|
-
queue =
|
|
4
|
-
waiting =
|
|
22
|
+
queue = new FifoQueue;
|
|
23
|
+
waiting = new FifoQueue;
|
|
5
24
|
done = false;
|
|
6
25
|
finalResultPromise;
|
|
7
26
|
resolveFinalResult;
|
|
@@ -21,11 +40,11 @@ class EventStream {
|
|
|
21
40
|
this.done = true;
|
|
22
41
|
this.resolveFinalResult(this.extractResult(event));
|
|
23
42
|
}
|
|
24
|
-
const waiter = this.waiting.
|
|
43
|
+
const waiter = this.waiting.dequeue();
|
|
25
44
|
if (waiter) {
|
|
26
45
|
waiter({ value: event, done: false });
|
|
27
46
|
} else {
|
|
28
|
-
this.queue.
|
|
47
|
+
this.queue.enqueue(event);
|
|
29
48
|
}
|
|
30
49
|
}
|
|
31
50
|
end(result) {
|
|
@@ -34,18 +53,18 @@ class EventStream {
|
|
|
34
53
|
this.resolveFinalResult(result);
|
|
35
54
|
}
|
|
36
55
|
while (this.waiting.length > 0) {
|
|
37
|
-
const waiter = this.waiting.
|
|
56
|
+
const waiter = this.waiting.dequeue();
|
|
38
57
|
waiter({ value: undefined, done: true });
|
|
39
58
|
}
|
|
40
59
|
}
|
|
41
60
|
async* [Symbol.asyncIterator]() {
|
|
42
61
|
while (true) {
|
|
43
62
|
if (this.queue.length > 0) {
|
|
44
|
-
yield this.queue.
|
|
63
|
+
yield this.queue.dequeue();
|
|
45
64
|
} else if (this.done) {
|
|
46
65
|
return;
|
|
47
66
|
} else {
|
|
48
|
-
const result = await new Promise((resolve) => this.waiting.
|
|
67
|
+
const result = await new Promise((resolve) => this.waiting.enqueue(resolve));
|
|
49
68
|
if (result.done)
|
|
50
69
|
return;
|
|
51
70
|
yield result.value;
|