@desplega.ai/agent-swarm 2.7.10 → 2.8.1
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-pdy3qsvg.js +15 -0
- package/dist/{actions-b8aqhrsg.js → actions-pwjpn0j6.js} +19 -20
- package/dist/{amp-adapter-4c165vgn.js → amp-adapter-cq9jgj6x.js} +2 -3
- package/dist/{app-m9khefrh.js → app-cnfffgwg.js} +3 -3
- package/dist/{assistant-rh4v3ntz.js → assistant-kpn317y1.js} +21 -22
- package/dist/{boot-args-schema-hwkc8bzv.js → boot-args-schema-pbbnhmc3.js} +1 -1
- package/dist/{boot-reembed-fdyk55h4.js → boot-reembed-9m0ysxma.js} +1 -1
- package/dist/{boot-reembed-5y6yw9sj.js → boot-reembed-majbn53m.js} +1 -1
- package/dist/{boot-scrub-sweep-r5r8kqsn.js → boot-scrub-sweep-app8g8ym.js} +3 -3
- package/dist/{boot-seeds-8f9zt5cm.js → boot-seeds-pbtmvcjm.js} +4 -5
- package/dist/{claude-adapter-s5df247c.js → claude-adapter-wn1g3qp5.js} +7 -8
- package/dist/{claude-managed-adapter-h74d06yz.js → claude-managed-adapter-jh6c523j.js} +3 -3
- package/dist/{claude-managed-setup-9gsmwzyx.js → claude-managed-setup-pd47nzch.js} +6 -6
- package/dist/{claude-sdk-session-dq1j4nz9.js → claude-sdk-session-3a2a6589.js} +9066 -8818
- package/dist/{cli-n5yexkdg.js → cli-0b4zam62.js} +1 -0
- package/dist/{cli-5wfz00be.js → cli-0jzra9ad.js} +2 -2
- package/dist/{cli-zjphdj1a.js → cli-0ntbxyaa.js} +40 -18
- package/dist/{cli-yz7v0sh4.js → cli-1xh9a7hn.js} +4 -6
- package/dist/{cli-eqtfgfr6.js → cli-2gxeg5gr.js} +1 -1
- package/dist/{cli-hfkwwy1h.js → cli-2zp0et3v.js} +21 -2
- package/dist/{cli-6m6b4bep.js → cli-3rkdne1h.js} +2 -2
- package/dist/{cli-mr97t7cc.js → cli-4r05hnqa.js} +263 -14
- package/dist/{cli-jc1g9ndz.js → cli-5j88qqa8.js} +10 -5
- package/dist/{cli-xfjrc279.js → cli-5mrq3ake.js} +48 -14
- package/dist/{cli-an1knn2k.js → cli-6mma83xa.js} +5 -5
- package/dist/{cli-tph5wt3y.js → cli-6wj7p986.js} +1 -1
- package/dist/{cli-t73cas91.js → cli-7349va39.js} +8100 -7620
- package/dist/{cli-5xcb8gxq.js → cli-7b8sbmag.js} +8 -8
- package/dist/{cli-3xj33nrx.js → cli-7cp6aa1q.js} +10 -3
- package/dist/{cli-mp9aa8g5.js → cli-7p1kvkck.js} +6 -6
- package/dist/{cli-j7d73g1y.js → cli-7w69ne2f.js} +3035 -354
- package/dist/{cli-cr14kftt.js → cli-89cqnasv.js} +3 -3
- package/dist/{cli-w3bk0dgv.js → cli-8aes17e4.js} +2 -2
- package/dist/{cli-7wz05bx3.js → cli-93k32c37.js} +468 -745
- package/dist/{cli-eqk5p56g.js → cli-9vhebtjz.js} +9 -9
- package/dist/{cli-td33w98c.js → cli-9wngrawf.js} +10 -10
- package/dist/cli-a3b239vq.js +242 -0
- package/dist/{cli-kx4c8j05.js → cli-b085njxz.js} +63 -19
- package/dist/{cli-8ewkreqd.js → cli-b5rs97a6.js} +7 -9
- package/dist/{cli-bxz823sz.js → cli-b8e9nb04.js} +1 -1
- package/dist/{cli-nj3x45rw.js → cli-bb431xey.js} +52 -43
- package/dist/{cli-36wdfzgn.js → cli-bsywb58a.js} +8 -8
- package/dist/{cli-18qt3few.js → cli-cyhbbd1z.js} +1 -1
- package/dist/{cli-eb2azq8n.js → cli-d3p5vwbk.js} +9 -9
- package/dist/{cli-2tsfpc70.js → cli-dy32zecz.js} +1 -1
- package/dist/{cli-rjyghzg4.js → cli-g70vxtjh.js} +2 -2
- package/dist/{cli-55bkx8hh.js → cli-gax7fk3t.js} +1 -1
- package/dist/{cli-jg24scat.js → cli-jcpr5smb.js} +3 -3
- package/dist/{cli-n07eecjs.js → cli-jywyhqws.js} +3 -3
- package/dist/{cli-38yww4e9.js → cli-k0615eh8.js} +8 -8
- package/dist/{cli-3xddv0rk.js → cli-k26bkr9t.js} +5 -7
- package/dist/{cli-xd5ebp64.js → cli-k93bq1wq.js} +3 -3
- package/dist/{cli-f2zenhja.js → cli-kc7v1nfv.js} +1 -1
- package/dist/{cli-x9exydey.js → cli-m4dqmnbp.js} +1 -1
- package/dist/{cli-gpwhbgx0.js → cli-m9s2qff2.js} +57 -25
- package/dist/{cli-ybjdc978.js → cli-mrt48bx7.js} +7 -4
- package/dist/{cli-ttbqe3q4.js → cli-p1w18yhx.js} +1 -1
- package/dist/{cli-h49ejvmc.js → cli-pcad4cb1.js} +1 -1
- package/dist/{cli-tmft5dz2.js → cli-qmqk2yc2.js} +1 -1
- package/dist/{cli-g1px1g2e.js → cli-re4raaj0.js} +1 -1
- package/dist/{cli-xbtq4d6s.js → cli-sn7rtnj4.js} +12 -8
- package/dist/{cli-n9abj89w.js → cli-syybb0p1.js} +8 -8
- package/dist/{cli-v2fwbnsk.js → cli-tacge1w0.js} +6 -6
- package/dist/{cli-pyrxt9gw.js → cli-tk7cjj8h.js} +1 -1
- package/dist/{cli-xvymtmv4.js → cli-tqegb8eq.js} +3 -3
- package/dist/{cli-kf3pxxdg.js → cli-v1dv1r37.js} +1 -1
- package/dist/{cli-z9cs5m0w.js → cli-vbh10fqa.js} +12 -12
- package/dist/{cli-3xcwp3z8.js → cli-vj75tyaw.js} +3 -3
- package/dist/{cli-xncjscpm.js → cli-vqptjbr7.js} +50 -24
- package/dist/{cli-q581b386.js → cli-wk18cm92.js} +5 -5
- package/dist/{cli-4vwxp550.js → cli-x1wa213s.js} +1 -1
- package/dist/{cli-n9ftpys4.js → cli-x6t50dmw.js} +7 -7
- package/dist/{cli-jrp1dt73.js → cli-xzm9vcfg.js} +1 -1
- package/dist/{cli-16phend6.js → cli-yn2bbre9.js} +1 -1
- package/dist/{cli-rt0ag4x1.js → cli-yncmerje.js} +5 -5
- package/dist/{cli-0m7rtm11.js → cli-zcsw143p.js} +1 -1
- package/dist/cli.js +18 -18
- package/dist/{codex-adapter-yr60sme6.js → codex-adapter-nha71q3n.js} +5 -6
- package/dist/{codex-hook-fac6175r.js → codex-hook-h3vk6xzr.js} +1 -1
- package/dist/{codex-session-runner-pch8x584.js → codex-session-runner-ak9x1k1h.js} +5 -6
- package/dist/{commands-phjfbkv0.js → commands-f587qpq8.js} +3 -3
- package/dist/{controller-jkx994pz.js → controller-hxx8wwy1.js} +2 -2
- package/dist/{controllers-connect-c4448kwa.js → controllers-connect-k5sg9m9h.js} +20 -21
- package/dist/{cursor-adapter-ndebqnm8.js → cursor-adapter-n5nc3mfe.js} +1 -2
- package/dist/{db-ef32tbfc.js → db-amm8w15a.js} +10 -2
- package/dist/{db-ez6egt6v.js → db-nzf8zb5z.js} +3 -3
- package/dist/{devin-adapter-z46ep5ph.js → devin-adapter-xedz98zv.js} +1 -1
- package/dist/{dispatcher-g3tt9hs9.js → dispatcher-89zrts8f.js} +18 -19
- package/dist/{dsh-adapter-tcyn3099.js → dsh-adapter-nrhbrjz8.js} +1 -2
- package/dist/{easter-egg-3d-e36hk5td.js → easter-egg-3d-533knw22.js} +1 -1
- package/dist/{embedding-space-4kyh5qqj.js → embedding-space-ezwenjmj.js} +6 -6
- package/dist/{embeddings-6a8v4a6t.js → embeddings-np74ht6g.js} +1 -1
- package/dist/{execute-3cbg0twf.js → execute-b3mrb1mv.js} +1 -1
- package/dist/{external-channel-se646snz.js → external-channel-z46yx9d7.js} +2 -2
- package/dist/{fx-adapter-yw795hqq.js → fx-adapter-3q12snn6.js} +7 -8
- package/dist/{grok-adapter-ttmcss2j.js → grok-adapter-ahb1w033.js} +7 -8
- package/dist/handlers-vbww69re.js +32 -0
- package/dist/heartbeat-dt9qw9c8.js +43 -0
- package/dist/{hook-hq93y5ej.js → hook-8k6fbz9b.js} +5 -5
- package/dist/{hook-g3nhexsy.js → hook-jgcgygex.js} +6 -6
- package/dist/{http-5a9p4h6y.js → http-haw4r8ne.js} +284 -142
- package/dist/{index-0eny15vj.js → index-2skqtd76.js} +2 -2
- package/dist/{index-6haqt3v5.js → index-4a0670yh.js} +8917 -8476
- package/dist/index-4xwaf5th.js +32 -0
- package/dist/{index-3c5pxbge.js → index-5gk12my8.js} +1 -1
- package/dist/{index-w7em4ktq.js → index-d6wkh8ar.js} +2 -2
- package/dist/index-f0hcrs8e.js +33 -0
- package/dist/{index-rvccek1w.js → index-gjwaqaq8.js} +5 -5
- package/dist/{index-e5pfbsys.js → index-hjhfk3ra.js} +3 -3
- package/dist/{index-1qw6f2dc.js → index-khe3gp0k.js} +4 -4
- package/dist/index-s4ewdma4.js +37 -0
- package/dist/{index-hgn3c961.js → index-tez78qj3.js} +979 -36
- package/dist/{index-s72rqgsx.js → index-tvfafeyy.js} +1 -1
- package/dist/{keepalive-1j4n4dmk.js → keepalive-xn6s7rmg.js} +3 -3
- package/dist/lead-6ygbfhbh.js +70 -0
- package/dist/{maintenance-dmghacy5.js → maintenance-vdts800b.js} +1 -1
- package/dist/{node-je82wjet.js → node-4c5jqxr3.js} +1 -1
- package/dist/{oauth-refresh-sweep-yy06c03c.js → oauth-refresh-sweep-094c8wfk.js} +2 -2
- package/dist/{onboard-52f9t5dm.js → onboard-v99eh56m.js} +3 -3
- package/dist/{opencode-adapter-krnh9jkn.js → opencode-adapter-dsagkhtw.js} +5 -6
- package/dist/{otel-impl-xjqz6wjj.js → otel-impl-q7yr9yp0.js} +1 -1
- package/dist/{pi-mono-adapter-dbxyp0qv.js → pi-mono-adapter-546cd1cc.js} +9 -9
- package/dist/{pricing-refresh-ctdr74pd.js → pricing-refresh-7dh2yase.js} +2 -3
- package/dist/{rbac-roles-ehv8s10n.js → rbac-roles-mdmc96p4.js} +3 -3
- package/dist/{rbac-roles-q0gr8eyj.js → rbac-roles-npbmdh77.js} +4 -6
- package/dist/{registry-hpjfmcfz.js → registry-32b1mft6.js} +1 -1
- package/dist/{render-v2-5b6chvcq.js → render-v2-twhhwmms.js} +3 -3
- package/dist/{resume-5a5d2845.js → resume-5gsrjd5e.js} +6 -6
- package/dist/{runtime-khxszyfp.js → runtime-1hv06jsn.js} +1 -1
- package/dist/{session-access-gj0bjhqg.js → session-access-m191x30x.js} +4 -4
- package/dist/{session-source-backfill-2sy0krfk.js → session-source-backfill-nt923ask.js} +2 -2
- package/dist/{setup-7ssfakk1.js → setup-wv467afy.js} +1 -1
- package/dist/{virtual-modules-pjj0knwf.js → virtual-modules-gazyapte.js} +3 -3
- package/dist/{work-objects-bf3syvhq.js → work-objects-8zkrpy13.js} +21 -22
- package/dist/{worker-follow-up-38xevga6.js → worker-follow-up-cecqszem.js} +18 -19
- package/dist/worker-mz5z7kj0.js +70 -0
- package/openapi.json +334 -7
- package/package.json +5 -5
- package/src/apps/definition.ts +11 -0
- package/src/apps/store.ts +28 -8
- package/src/be/db/model-profiles.ts +147 -38
- package/src/be/db/tasks/read.ts +5 -1
- package/src/be/db/workflow-run-definitions.ts +117 -0
- package/src/be/db.ts +24 -3
- package/src/be/memory/constants.ts +14 -1
- package/src/be/memory/key-paths.ts +8 -0
- package/src/be/memory/providers/sqlite-store.ts +160 -10
- package/src/be/memory/task-learning.ts +79 -14
- package/src/be/memory/types.ts +24 -1
- package/src/be/migrations/279_backfill_learning_expiry.sql +15 -0
- package/src/be/migrations/281_model_profiles_pr2.sql +28 -0
- package/src/be/migrations/283_workflow_run_definitions.sql +14 -0
- package/src/be/model-profile-check.ts +284 -0
- package/src/be/model-tier-resolution.ts +112 -12
- package/src/be/multi-runtime.ts +27 -0
- package/src/be/runtime-pools/routing.ts +52 -4
- package/src/be/scripts/typecheck.ts +1 -0
- package/src/be/seed-scripts/catalog/dreaming-learnings.ts +552 -0
- package/src/be/seed-scripts/catalog/dreaming-memtax-create.ts +389 -14
- package/src/be/seed-scripts/catalog/dreaming-memtax.ts +6 -3
- package/src/be/seed-scripts/index.ts +9 -0
- package/src/be/steering.ts +8 -2
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/runner.ts +32 -1
- package/src/fs/provider.ts +17 -3
- package/src/heartbeat/heartbeat.ts +12 -1
- package/src/heartbeat/index.ts +1 -0
- package/src/http/agents.ts +56 -4
- package/src/http/apps.ts +3 -1
- package/src/http/config.ts +2 -6
- package/src/http/index.ts +2 -3
- package/src/http/model-profiles.ts +58 -10
- package/src/http/poll.ts +36 -3
- package/src/http/schedules.ts +42 -3
- package/src/http/tasks.ts +37 -12
- package/src/http/workflows.ts +15 -2
- package/src/prompts/session-templates.ts +1 -1
- package/src/providers/acp-targets.ts +11 -6
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-sdk-session.ts +132 -23
- package/src/providers/codex-skill-resolver.ts +10 -4
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/providers/devin-skill-resolver.ts +5 -5
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/scheduler/schedule-task.ts +1 -0
- package/src/scripts-runtime/eval-harness.ts +14 -1
- package/src/scripts-runtime/executors/types.ts +3 -0
- package/src/scripts-runtime/sdk-allowlist.ts +1 -0
- package/src/scripts-runtime/swarm-sdk.ts +18 -1
- package/src/scripts-runtime/types/stdlib.d.ts +1 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +1 -0
- package/src/server.ts +2 -0
- package/src/slack/app.ts +93 -0
- package/src/slack/inbound-dispatch.ts +18 -1
- package/src/slack/workspace-guard.ts +345 -0
- package/src/tasks/task-terminal-effects.ts +4 -0
- package/src/tasks/worker-follow-up.ts +102 -2
- package/src/tests/acp-adapter.test.ts +82 -0
- package/src/tests/apps-icon.test.ts +120 -0
- package/src/tests/chained-task-follow-up.test.ts +248 -0
- package/src/tests/check-pr-body.test.ts +40 -0
- package/src/tests/claude-sdk-lifecycle.test.ts +216 -1
- package/src/tests/claude-sdk-process.fixture.ts +57 -0
- package/src/tests/codex-skill-resolver.test.ts +31 -0
- package/src/tests/credentials-allowlist.test.ts +470 -0
- package/src/tests/db-task-read-contract.test.ts +5 -0
- package/src/tests/db-task-write-contract.test.ts +5 -0
- package/src/tests/deferred-wake-follow-up.test.ts +47 -0
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/dreaming-learnings.test.ts +1395 -0
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/explicit-model-validation.test.ts +2 -0
- package/src/tests/fs-provider.test.ts +42 -0
- package/src/tests/heartbeat.test.ts +28 -1
- package/src/tests/human-free-reclassify.test.ts +5 -1
- package/src/tests/list-endpoint-slimming.test.ts +17 -0
- package/src/tests/mcp-tools.test.ts +1 -1
- package/src/tests/migration-283-workflow-run-definitions.test.ts +69 -0
- package/src/tests/model-profile-check.test.ts +387 -0
- package/src/tests/model-profiles-api.test.ts +528 -1
- package/src/tests/profile-claim.test.ts +415 -3
- package/src/tests/profile-tier-alias.test.ts +382 -0
- package/src/tests/schedule-profile.test.ts +359 -0
- package/src/tests/script-connections.test.ts +6 -0
- package/src/tests/script-native-unawaited-drain.test.ts +167 -0
- package/src/tests/script-per-script-executor.test.ts +1 -0
- package/src/tests/scripts-sdk-bridge-tool-failure.test.ts +141 -0
- package/src/tests/seed-scripts.test.ts +2 -2
- package/src/tests/slack-inbound-receipts.test.ts +22 -2
- package/src/tests/slack-socket-ack.test.ts +16 -1
- package/src/tests/slack-workspace-guard.test.ts +905 -0
- package/src/tests/steering-core.test.ts +40 -0
- package/src/tests/store-progress-learning.test.ts +605 -20
- package/src/tests/tool-annotations.test.ts +1 -1
- package/src/tests/workflow-convergence.test.ts +46 -40
- package/src/tests/workflow-definition-pinning-recovery.test.ts +552 -0
- package/src/tests/workflow-definition-pinning.test.ts +645 -0
- package/src/tests/workflow-executors.test.ts +16 -7
- package/src/tests/workflow-foreach.test.ts +43 -20
- package/src/tests/workflow-notify-slack-ready.test.ts +161 -0
- package/src/tests/workflow-profile.test.ts +328 -0
- package/src/tools/app-upsert.ts +1 -1
- package/src/tools/memory-edit.ts +2 -1
- package/src/tools/model-profiles/check-model-profile.ts +63 -0
- package/src/tools/schedules/create-schedule.ts +45 -4
- package/src/tools/schedules/patch-schedule.ts +50 -4
- package/src/tools/schedules/update-schedule.ts +50 -4
- package/src/tools/script-run.ts +1 -1
- package/src/tools/send-task.ts +17 -2
- package/src/tools/store-progress.ts +15 -3
- package/src/tools/task-action.ts +9 -1
- package/src/tools/templates.ts +13 -0
- package/src/tools/tool-config.ts +2 -1
- package/src/tools/utils.ts +61 -4
- package/src/tools/workflows/create-workflow.ts +1 -1
- package/src/tools/workflows/retry-workflow-run.ts +1 -1
- package/src/tools/workflows/update-workflow.ts +10 -1
- package/src/types.ts +56 -1
- package/src/utils/credentials.ts +89 -12
- package/src/workflows/engine.ts +10 -1
- package/src/workflows/executors/agent-task.ts +21 -2
- package/src/workflows/executors/foreach.ts +4 -1
- package/src/workflows/executors/notify.ts +62 -6
- package/src/workflows/executors/sub-workflow.ts +1 -1
- package/src/workflows/executors/swarm-script.ts +4 -1
- package/src/workflows/foreach-driver.ts +8 -5
- package/src/workflows/limits.ts +2 -1
- package/src/workflows/model-validation.ts +27 -2
- package/src/workflows/patch-definition.ts +3 -1
- package/src/workflows/recovery.ts +6 -6
- package/src/workflows/resume.ts +9 -9
- package/src/workflows/retry-poller.ts +2 -2
- package/templates/skills/apps/SKILL.md +2 -0
- package/templates/skills/apps/content.md +2 -0
- package/templates/skills/code-quality/content.md +12 -0
- package/templates/skills/memory/content.md +8 -0
- package/templates/skills/scheduling/config.json +1 -1
- package/templates/skills/scheduling/content.md +2 -2
- package/templates/skills/swarm-docs/content.md +4 -0
- package/templates/skills/swarm-extensions/content.md +1 -1
- package/templates/skills/swarm-scripts/SKILL.md +2 -2
- package/templates/skills/swarm-scripts/content.md +2 -2
- package/templates/skills/work-on-task/SKILL.md +2 -0
- package/templates/skills/work-on-task/content.md +2 -0
- package/templates/workflows/dreaming/content.md +174 -7
- package/dist/acp-adapter-srfhs1s9.js +0 -16
- package/dist/cli-bzvs88tv.js +0 -339
- package/dist/cli-cyn9v8zr.js +0 -748
- package/dist/cli-ed6yqpf1.js +0 -779
- package/dist/handlers-17wha3ze.js +0 -33
- package/dist/heartbeat-gwewgdms.js +0 -42
- package/dist/index-8arwq8mw.js +0 -34
- package/dist/index-tpw054az.js +0 -38
- package/dist/index-waq75j2j.js +0 -31
- package/dist/lead-re73kdgc.js +0 -72
- package/dist/worker-r8mz7a65.js +0 -72
|
@@ -2,9 +2,11 @@ import { afterEach, beforeEach, describe, expect, spyOn, test } from "bun:test";
|
|
|
2
2
|
import { mkdtemp, readFile, realpath, rm } from "node:fs/promises";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
+
import { createSteeringDispatchState, pollAndDispatchSteering } from "../commands/runner";
|
|
5
6
|
import { ClaudeAdapter, getTaskFilePath } from "../providers/claude-adapter";
|
|
6
7
|
import { userClaudeMdExclude } from "../providers/claude-flag-settings";
|
|
7
8
|
import type { ProviderEvent, ProviderSessionConfig } from "../providers/types";
|
|
9
|
+
import type { SteeringMessage } from "../types";
|
|
8
10
|
import { CHILD_PROCESS_TEST_BUDGET_MS, runChild } from "./test-proc";
|
|
9
11
|
|
|
10
12
|
const fixturePath = join(import.meta.dir, "claude-sdk-process.fixture.ts");
|
|
@@ -18,7 +20,15 @@ async function temporaryDirectory(): Promise<string> {
|
|
|
18
20
|
|
|
19
21
|
function config(
|
|
20
22
|
directory: string,
|
|
21
|
-
mode:
|
|
23
|
+
mode:
|
|
24
|
+
| "queue"
|
|
25
|
+
| "cancel"
|
|
26
|
+
| "stderr-error"
|
|
27
|
+
| "redirect"
|
|
28
|
+
| "redirect-error"
|
|
29
|
+
| "redirect-cancel"
|
|
30
|
+
| "redirect-retry"
|
|
31
|
+
| "coalesce",
|
|
22
32
|
stateFile: string,
|
|
23
33
|
): ProviderSessionConfig {
|
|
24
34
|
return {
|
|
@@ -159,6 +169,211 @@ describe("Claude SDK production adapter lifecycle", () => {
|
|
|
159
169
|
{ timeout: CHILD_PROCESS_TEST_BUDGET_MS },
|
|
160
170
|
);
|
|
161
171
|
|
|
172
|
+
test(
|
|
173
|
+
"redirect waits for the interrupted result and serializes queue and completion-time input",
|
|
174
|
+
async () => {
|
|
175
|
+
const directory = await temporaryDirectory();
|
|
176
|
+
const stateFile = join(directory, "redirect-state.json");
|
|
177
|
+
let summaries = 0;
|
|
178
|
+
const session = await new ClaudeAdapter(async () => {
|
|
179
|
+
summaries++;
|
|
180
|
+
}).createSession(config(directory, "redirect", stateFile));
|
|
181
|
+
const events: ProviderEvent[] = [];
|
|
182
|
+
let late: Promise<unknown> | undefined;
|
|
183
|
+
session.onEvent((event) => {
|
|
184
|
+
events.push(event);
|
|
185
|
+
if (event.type === "message" && event.content === "accepted:queued") {
|
|
186
|
+
late = session.deliverSteering!({ mode: "queue", text: "completion-message" });
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
await waitForFile(stateFile);
|
|
190
|
+
expect(
|
|
191
|
+
await Promise.all([
|
|
192
|
+
session.deliverSteering!({ mode: "steer", text: "redirected" }),
|
|
193
|
+
session.deliverSteering!({ mode: "queue", text: "queued" }),
|
|
194
|
+
]),
|
|
195
|
+
).toEqual([
|
|
196
|
+
{ delivered: true, mode: "steer" },
|
|
197
|
+
{ delivered: true, mode: "queue" },
|
|
198
|
+
]);
|
|
199
|
+
const result = await session.waitForCompletion();
|
|
200
|
+
expect(await late).toEqual({ delivered: true, mode: "queue" });
|
|
201
|
+
expect(result).toMatchObject({
|
|
202
|
+
exitCode: 0,
|
|
203
|
+
isError: false,
|
|
204
|
+
output: "accepted:completion-message",
|
|
205
|
+
});
|
|
206
|
+
expect(result.cost).toMatchObject({ totalCostUsd: 0.004, numTurns: 4 });
|
|
207
|
+
expect(JSON.parse(await Bun.file(stateFile).text())).toMatchObject({
|
|
208
|
+
interrupts: 1,
|
|
209
|
+
userMessages: ["initial-message", "redirected", "queued", "completion-message"],
|
|
210
|
+
});
|
|
211
|
+
expect(events.filter((e) => e.type === "session_init")).toHaveLength(1);
|
|
212
|
+
expect(events.some((e) => e.type === "context_usage")).toBeTrue();
|
|
213
|
+
expect(summaries).toBe(1);
|
|
214
|
+
expect(await session.deliverSteering!({ mode: "steer", text: "too-late" })).toMatchObject({
|
|
215
|
+
delivered: false,
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
{ timeout: CHILD_PROCESS_TEST_BUDGET_MS },
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
test(
|
|
222
|
+
"a rejected interrupt does not deliver its text and later queue delivery still completes",
|
|
223
|
+
async () => {
|
|
224
|
+
const directory = await temporaryDirectory();
|
|
225
|
+
const stateFile = join(directory, "redirect-error.json");
|
|
226
|
+
const session = await new ClaudeAdapter(async () => {}).createSession(
|
|
227
|
+
config(directory, "redirect-error", stateFile),
|
|
228
|
+
);
|
|
229
|
+
try {
|
|
230
|
+
await waitForFile(stateFile);
|
|
231
|
+
expect(await session.deliverSteering!({ mode: "steer", text: "rejected" })).toMatchObject({
|
|
232
|
+
delivered: false,
|
|
233
|
+
});
|
|
234
|
+
expect(await session.deliverSteering!({ mode: "queue", text: "recovery" })).toEqual({
|
|
235
|
+
delivered: true,
|
|
236
|
+
mode: "queue",
|
|
237
|
+
});
|
|
238
|
+
expect((await session.waitForCompletion()).exitCode).toBe(0);
|
|
239
|
+
expect(JSON.parse(await Bun.file(stateFile).text()).userMessages).toEqual([
|
|
240
|
+
"initial-message",
|
|
241
|
+
"recovery",
|
|
242
|
+
]);
|
|
243
|
+
} finally {
|
|
244
|
+
await session.abort("test cleanup");
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
{ timeout: CHILD_PROCESS_TEST_BUDGET_MS },
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
test(
|
|
251
|
+
"cancellation during redirect rejects pending input and wins over interrupted completion",
|
|
252
|
+
async () => {
|
|
253
|
+
const directory = await temporaryDirectory();
|
|
254
|
+
const stateFile = join(directory, "redirect-cancel.json");
|
|
255
|
+
const session = await new ClaudeAdapter(async () => {}).createSession(
|
|
256
|
+
config(directory, "redirect-cancel", stateFile),
|
|
257
|
+
);
|
|
258
|
+
await waitForFile(stateFile);
|
|
259
|
+
const redirect = session.deliverSteering!({ mode: "steer", text: "must-not-arrive" });
|
|
260
|
+
const queued = session.deliverSteering!({ mode: "queue", text: "also-cancelled" });
|
|
261
|
+
await waitForFile(`${stateFile}.interrupt`);
|
|
262
|
+
await session.abort("cancel during redirect");
|
|
263
|
+
expect(await redirect).toMatchObject({ delivered: false });
|
|
264
|
+
expect(await queued).toMatchObject({ delivered: false });
|
|
265
|
+
expect(await session.waitForCompletion()).toMatchObject({
|
|
266
|
+
exitCode: 130,
|
|
267
|
+
errorCategory: "cancelled",
|
|
268
|
+
});
|
|
269
|
+
expect(JSON.parse(await Bun.file(stateFile).text()).userMessages).toEqual([
|
|
270
|
+
"initial-message",
|
|
271
|
+
]);
|
|
272
|
+
},
|
|
273
|
+
{ timeout: CHILD_PROCESS_TEST_BUDGET_MS },
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
test(
|
|
277
|
+
"a singular UUID result answers coalesced inputs and leaves a later input open",
|
|
278
|
+
async () => {
|
|
279
|
+
const directory = await temporaryDirectory();
|
|
280
|
+
const stateFile = join(directory, "coalesce.json");
|
|
281
|
+
const session = await new ClaudeAdapter(async () => {}).createSession(
|
|
282
|
+
config(directory, "coalesce", stateFile),
|
|
283
|
+
);
|
|
284
|
+
try {
|
|
285
|
+
await waitForFile(stateFile);
|
|
286
|
+
expect(await session.deliverSteering!({ mode: "queue", text: "second" })).toEqual({
|
|
287
|
+
delivered: true,
|
|
288
|
+
mode: "queue",
|
|
289
|
+
});
|
|
290
|
+
// The fixture's first result echoes only the initial id. "second" is
|
|
291
|
+
// still outstanding, so completion must not have closed the input.
|
|
292
|
+
expect(await session.deliverSteering!({ mode: "queue", text: "third" })).toEqual({
|
|
293
|
+
delivered: true,
|
|
294
|
+
mode: "queue",
|
|
295
|
+
});
|
|
296
|
+
const result = await Promise.race([
|
|
297
|
+
session.waitForCompletion(),
|
|
298
|
+
Bun.sleep(3_000).then(() => {
|
|
299
|
+
throw new Error("coalesced singular-UUID result left inputs unanswered");
|
|
300
|
+
}),
|
|
301
|
+
]);
|
|
302
|
+
expect(result.exitCode).toBe(0);
|
|
303
|
+
expect(JSON.parse(await Bun.file(stateFile).text()).userMessages).toEqual([
|
|
304
|
+
"initial-message",
|
|
305
|
+
"second",
|
|
306
|
+
"third",
|
|
307
|
+
]);
|
|
308
|
+
} finally {
|
|
309
|
+
await session.abort("coalesce test cleanup");
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
{ timeout: CHILD_PROCESS_TEST_BUDGET_MS },
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
test(
|
|
316
|
+
"SDK delivery-report retries retain steering IDs without interrupting or injecting twice",
|
|
317
|
+
async () => {
|
|
318
|
+
const directory = await temporaryDirectory();
|
|
319
|
+
const stateFile = join(directory, "redirect-retry.json");
|
|
320
|
+
const sessionConfig = config(directory, "redirect-retry", stateFile);
|
|
321
|
+
const session = await new ClaudeAdapter(async () => {}).createSession(sessionConfig);
|
|
322
|
+
try {
|
|
323
|
+
await waitForFile(stateFile);
|
|
324
|
+
const messages: SteeringMessage[] = (["queue", "steer"] as const).map((mode) => ({
|
|
325
|
+
id: crypto.randomUUID(),
|
|
326
|
+
taskId: sessionConfig.taskId,
|
|
327
|
+
mode,
|
|
328
|
+
body: `${mode} body`,
|
|
329
|
+
status: "pending",
|
|
330
|
+
source: "api",
|
|
331
|
+
createdByKind: "user",
|
|
332
|
+
createdAt: new Date().toISOString(),
|
|
333
|
+
}));
|
|
334
|
+
let failReport = true;
|
|
335
|
+
const reports: string[] = [];
|
|
336
|
+
const fetchImpl = (async (input: string | URL | Request) => {
|
|
337
|
+
const url = new URL(String(input));
|
|
338
|
+
if (url.pathname === "/api/steering-messages") return Response.json({ messages });
|
|
339
|
+
reports.push(url.pathname);
|
|
340
|
+
return new Response("{}", { status: failReport ? 503 : 200 });
|
|
341
|
+
}) as typeof fetch;
|
|
342
|
+
const api = {
|
|
343
|
+
apiUrl: "http://steering.test",
|
|
344
|
+
apiKey: "fixture",
|
|
345
|
+
agentId: sessionConfig.agentId,
|
|
346
|
+
};
|
|
347
|
+
const state = createSteeringDispatchState();
|
|
348
|
+
await expect(
|
|
349
|
+
pollAndDispatchSteering(api, sessionConfig.taskId, session, state, fetchImpl),
|
|
350
|
+
).rejects.toThrow("report failed");
|
|
351
|
+
// Promise.all rejects at the first failed report; let every active
|
|
352
|
+
// delivery settle before retrying the still-pending server rows.
|
|
353
|
+
while (state.inFlightMessageIds.size > 0) await Bun.sleep(10);
|
|
354
|
+
failReport = false;
|
|
355
|
+
await pollAndDispatchSteering(api, sessionConfig.taskId, session, state, fetchImpl);
|
|
356
|
+
await session.deliverSteering!({ mode: "queue", text: "finish" });
|
|
357
|
+
expect((await session.waitForCompletion()).exitCode).toBe(0);
|
|
358
|
+
const captured = JSON.parse(await Bun.file(stateFile).text());
|
|
359
|
+
expect(captured.interrupts).toBe(1);
|
|
360
|
+
expect(captured.userMessages).toHaveLength(4);
|
|
361
|
+
for (const message of messages) {
|
|
362
|
+
expect(
|
|
363
|
+
captured.userMessages.filter((text: string) => text.includes(message.id)),
|
|
364
|
+
).toHaveLength(1);
|
|
365
|
+
expect(captured.userMessages.find((text: string) => text.includes(message.id))).toContain(
|
|
366
|
+
message.body,
|
|
367
|
+
);
|
|
368
|
+
expect(reports.filter((path) => path.includes(message.id))).toHaveLength(2);
|
|
369
|
+
}
|
|
370
|
+
} finally {
|
|
371
|
+
await session.abort("retry test cleanup");
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
{ timeout: CHILD_PROCESS_TEST_BUDGET_MS },
|
|
375
|
+
);
|
|
376
|
+
|
|
162
377
|
test(
|
|
163
378
|
"merges caller --settings from additionalArgs and CLAUDE_BINARY into the SDK's one flag",
|
|
164
379
|
async () => {
|
|
@@ -85,6 +85,10 @@ function resultMessage(
|
|
|
85
85
|
queued_turn_count: queuedTurnCount,
|
|
86
86
|
uuid: crypto.randomUUID(),
|
|
87
87
|
session_id: sessionId,
|
|
88
|
+
user_message_uuid: userUuids[turn - 1],
|
|
89
|
+
// redirect-retry echoes only the singular id. A cumulative list would hide
|
|
90
|
+
// coalesced inputs that a real singular result leaves unanswered.
|
|
91
|
+
...(mode === "redirect-error" ? { user_message_uuids: userUuids } : {}),
|
|
88
92
|
};
|
|
89
93
|
}
|
|
90
94
|
|
|
@@ -154,7 +158,9 @@ function answerInitialize(requestId: string): void {
|
|
|
154
158
|
const decoder = new TextDecoder();
|
|
155
159
|
let buffer = "";
|
|
156
160
|
let initialized = false;
|
|
161
|
+
let interrupts = 0;
|
|
157
162
|
const userMessages: string[] = [];
|
|
163
|
+
const userUuids: string[] = [];
|
|
158
164
|
const argv = process.argv.slice(2);
|
|
159
165
|
|
|
160
166
|
if (mode === "cancel") {
|
|
@@ -171,6 +177,7 @@ async function handleLine(line: string): Promise<boolean> {
|
|
|
171
177
|
const message = JSON.parse(line) as {
|
|
172
178
|
type?: string;
|
|
173
179
|
request_id?: string;
|
|
180
|
+
uuid?: string;
|
|
174
181
|
request?: { subtype?: string };
|
|
175
182
|
message?: { content?: unknown };
|
|
176
183
|
};
|
|
@@ -182,6 +189,30 @@ async function handleLine(line: string): Promise<boolean> {
|
|
|
182
189
|
}
|
|
183
190
|
return false;
|
|
184
191
|
}
|
|
192
|
+
if (
|
|
193
|
+
message.type === "control_request" &&
|
|
194
|
+
message.request?.subtype === "interrupt" &&
|
|
195
|
+
mode?.startsWith("redirect")
|
|
196
|
+
) {
|
|
197
|
+
interrupts++;
|
|
198
|
+
writeMessage({
|
|
199
|
+
type: "control_response",
|
|
200
|
+
response: {
|
|
201
|
+
subtype: mode === "redirect-error" ? "error" : "success",
|
|
202
|
+
request_id: message.request_id,
|
|
203
|
+
...(mode === "redirect-error"
|
|
204
|
+
? { error: "fixture interrupt rejected" }
|
|
205
|
+
: { response: { still_queued: [] } }),
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
if (mode === "redirect-error") return false;
|
|
209
|
+
// Exercise the receipt/result gap. The redirect must not be sent into
|
|
210
|
+
// the interrupted turn, whose final result reports no queued work.
|
|
211
|
+
await writeStateFile(`${stateFile}.interrupt`, { interrupts });
|
|
212
|
+
await Bun.sleep(mode === "redirect-cancel" ? 500 : 30);
|
|
213
|
+
writeMessage(resultMessage("interrupted", 1, 0));
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
185
216
|
if (message.type !== "user") return false;
|
|
186
217
|
const content = message.message?.content;
|
|
187
218
|
const text =
|
|
@@ -200,6 +231,32 @@ async function handleLine(line: string): Promise<boolean> {
|
|
|
200
231
|
.join("")
|
|
201
232
|
: "";
|
|
202
233
|
userMessages.push(text);
|
|
234
|
+
userUuids.push(message.uuid ?? "");
|
|
235
|
+
|
|
236
|
+
if (mode === "coalesce") {
|
|
237
|
+
await writeStateFile(stateFile, { argv, userMessages });
|
|
238
|
+
if (userMessages.length === 2) {
|
|
239
|
+
// Singular echo of the first input. The second stays unanswered.
|
|
240
|
+
writeMessage(assistantMessage("partial", 1));
|
|
241
|
+
writeMessage(resultMessage("partial", 1, 0));
|
|
242
|
+
} else if (userMessages.length >= 3) {
|
|
243
|
+
// Singular echo of the last merged input, with no UUID list.
|
|
244
|
+
writeMessage(assistantMessage("coalesced", userMessages.length));
|
|
245
|
+
writeMessage(resultMessage("coalesced", userMessages.length, 0));
|
|
246
|
+
}
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (mode?.startsWith("redirect")) {
|
|
251
|
+
await writeStateFile(stateFile, { argv, userMessages, interrupts });
|
|
252
|
+
if (userMessages.length === 1) {
|
|
253
|
+
writeMessage(assistantMessage("working", 1));
|
|
254
|
+
} else if (mode !== "redirect-retry" || text === "finish") {
|
|
255
|
+
writeMessage(assistantMessage(`accepted:${text}`, userMessages.length));
|
|
256
|
+
writeMessage(resultMessage(`accepted:${text}`, userMessages.length, 0));
|
|
257
|
+
}
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
203
260
|
|
|
204
261
|
if (mode === "stderr-error") {
|
|
205
262
|
writeMessage(errorResultMessage());
|
|
@@ -13,6 +13,7 @@ import { tmpdir } from "node:os";
|
|
|
13
13
|
import { join } from "node:path";
|
|
14
14
|
import { prependContextPreamble } from "../commands/context-preamble";
|
|
15
15
|
import { resolveCodexPrompt } from "../providers/codex-skill-resolver";
|
|
16
|
+
import { resolveDevinPrompt } from "../providers/devin-skill-resolver";
|
|
16
17
|
import type { ProviderEvent } from "../providers/types";
|
|
17
18
|
|
|
18
19
|
/** Create a fresh tmp skills dir for each test to avoid cross-test leakage. */
|
|
@@ -165,4 +166,34 @@ describe("resolveCodexPrompt", () => {
|
|
|
165
166
|
expect(result.startsWith(skillBody)).toBe(true);
|
|
166
167
|
expect(result).toContain("User request: abc");
|
|
167
168
|
});
|
|
169
|
+
|
|
170
|
+
test("enforces 100,000-char default cap when MAX_SKILL_CHARS is non-finite, non-positive, or non-integer, and honors valid positive integer overrides", async () => {
|
|
171
|
+
const prev = process.env.MAX_SKILL_CHARS;
|
|
172
|
+
try {
|
|
173
|
+
const oversized = "x".repeat(100_050);
|
|
174
|
+
await writeSkill("huge-skill", oversized);
|
|
175
|
+
|
|
176
|
+
for (const badVal of ["Infinity", "-Infinity", "NaN", "0", "-50", "12.5", "not-a-number"]) {
|
|
177
|
+
process.env.MAX_SKILL_CHARS = badVal;
|
|
178
|
+
const codexRes = await resolveCodexPrompt("/huge-skill go", skillsDir);
|
|
179
|
+
expect(codexRes.startsWith("x".repeat(100_000) + "\n\n---\n\n")).toBe(true);
|
|
180
|
+
|
|
181
|
+
const devinRes = await resolveDevinPrompt("@skills:huge-skill go", skillsDir);
|
|
182
|
+
expect(devinRes.startsWith("x".repeat(100_000) + "\n\n---\n\n")).toBe(true);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
process.env.MAX_SKILL_CHARS = "120";
|
|
186
|
+
const customCodex = await resolveCodexPrompt("/huge-skill go", skillsDir);
|
|
187
|
+
expect(customCodex.startsWith("x".repeat(120) + "\n\n---\n\n")).toBe(true);
|
|
188
|
+
|
|
189
|
+
const customDevin = await resolveDevinPrompt("@skills:huge-skill go", skillsDir);
|
|
190
|
+
expect(customDevin.startsWith("x".repeat(120) + "\n\n---\n\n")).toBe(true);
|
|
191
|
+
} finally {
|
|
192
|
+
if (prev === undefined) {
|
|
193
|
+
delete process.env.MAX_SKILL_CHARS;
|
|
194
|
+
} else {
|
|
195
|
+
process.env.MAX_SKILL_CHARS = prev;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
});
|
|
168
199
|
});
|