@desplega.ai/agent-swarm 2.7.9 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-adapter-t949vbbp.js +15 -0
- package/dist/{actions-g563mbn2.js → actions-7e9czc7s.js} +19 -19
- package/dist/{amp-adapter-q61w05eb.js → amp-adapter-gv6cbb7d.js} +2 -3
- package/dist/app-b9fbkp9v.js +20 -0
- package/dist/{assistant-p477rjwj.js → assistant-wjb7v4c7.js} +22 -22
- package/dist/{boot-args-schema-h4qj462e.js → boot-args-schema-2t37e0fe.js} +1 -1
- package/dist/{boot-reembed-n1ehfbsw.js → boot-reembed-a35nkyr1.js} +1 -1
- package/dist/{boot-reembed-qw4mc0pt.js → boot-reembed-gka3zas7.js} +1 -1
- package/dist/{boot-scrub-sweep-9w9jp4sm.js → boot-scrub-sweep-65sdnp6c.js} +3 -3
- package/dist/{boot-seeds-qdaf3sdy.js → boot-seeds-x42tzytw.js} +4 -5
- package/dist/{claude-adapter-348p5hx9.js → claude-adapter-v221b2fd.js} +7 -8
- package/dist/{claude-managed-adapter-h74d06yz.js → claude-managed-adapter-29eq09wd.js} +2 -2
- package/dist/{claude-managed-setup-7787fxtp.js → claude-managed-setup-9m6450zk.js} +2 -2
- package/dist/{claude-sdk-session-hbszbt8a.js → claude-sdk-session-0q0ptaba.js} +9066 -8818
- package/dist/{cli-n5yexkdg.js → cli-0b4zam62.js} +1 -0
- package/dist/{cli-21159vea.js → cli-0jzra9ad.js} +2 -2
- package/dist/{cli-eqtfgfr6.js → cli-2gxeg5gr.js} +1 -1
- package/dist/{cli-k70e3x9e.js → cli-2wnq8jkz.js} +9 -9
- package/dist/{cli-cvs2r2vq.js → cli-2zp0et3v.js} +59 -6
- package/dist/{cli-650zv9q9.js → cli-334z18y3.js} +4 -4
- package/dist/{cli-12xyjhws.js → cli-3rkdne1h.js} +2 -2
- package/dist/{cli-2a8py3sx.js → cli-4txa0ter.js} +5 -7
- package/dist/{cli-jc1g9ndz.js → cli-5j88qqa8.js} +10 -5
- package/dist/{cli-xfjrc279.js → cli-5mrq3ake.js} +48 -14
- package/dist/{cli-v3cf1ts9.js → cli-6t09sdhy.js} +3 -3
- package/dist/{cli-qzt90yze.js → cli-6wxjceza.js} +8 -8
- package/dist/{cli-9aezs55w.js → cli-7b8sbmag.js} +8 -8
- package/dist/{cli-3xj33nrx.js → cli-7cp6aa1q.js} +10 -3
- package/dist/{cli-jfx48xrj.js → cli-7p1kvkck.js} +6 -6
- package/dist/{cli-b932gexn.js → cli-8aes17e4.js} +2 -2
- package/dist/{cli-3tqcamp6.js → cli-8fknbnhw.js} +14 -13
- package/dist/{cli-587857ys.js → cli-8kzasymh.js} +3 -3
- package/dist/{cli-sgs5k6yd.js → cli-a7wvp2km.js} +1 -1
- package/dist/{cli-varqt4d1.js → cli-abejgen1.js} +69 -22
- package/dist/{cli-rwymrnaz.js → cli-bsywb58a.js} +8 -8
- package/dist/{cli-btc9cb4c.js → cli-c55z5chy.js} +4 -6
- package/dist/{cli-ms5m5r1y.js → cli-deefvewm.js} +1 -1
- package/dist/{cli-p17970qv.js → cli-ee0b971j.js} +3 -3
- package/dist/cli-f3vq58d2.js +242 -0
- package/dist/{cli-3xcwp3z8.js → cli-ffhtssbp.js} +2 -2
- package/dist/{cli-hwprv9e4.js → cli-g70vxtjh.js} +2 -2
- package/dist/{cli-4t0fmf3z.js → cli-gxkx0zzp.js} +1 -1
- package/dist/{cli-neyag5p6.js → cli-h38x262p.js} +3365 -429
- package/dist/{cli-2ccpqyyf.js → cli-j790gp2w.js} +105 -22
- package/dist/{cli-f2zenhja.js → cli-kc7v1nfv.js} +1 -1
- package/dist/{cli-vxh6acp7.js → cli-m23zjcy2.js} +10 -10
- package/dist/{cli-y8nbefpb.js → cli-m28atx8q.js} +12 -10
- package/dist/{cli-serm8zrx.js → cli-m4dqmnbp.js} +1 -1
- package/dist/{cli-ybjdc978.js → cli-mrt48bx7.js} +7 -4
- package/dist/{cli-y5rbvxhc.js → cli-n515ex5z.js} +14 -14
- package/dist/{cli-ypff1qwp.js → cli-n9ftpys4.js} +7 -7
- package/dist/{cli-605nn699.js → cli-p1bq50aa.js} +894 -226
- package/dist/{cli-qkdmz8c8.js → cli-p1w18yhx.js} +1 -1
- package/dist/{cli-xk879m3k.js → cli-p2gfst4m.js} +52 -43
- package/dist/{cli-sya22y84.js → cli-pasjcnmj.js} +12 -12
- package/dist/{cli-0whpms1z.js → cli-qa4wdgsy.js} +5 -5
- package/dist/{cli-ejkvvqbe.js → cli-qfedvmcr.js} +50 -24
- package/dist/{cli-tqq0hspb.js → cli-qmqk2yc2.js} +1 -1
- package/dist/{cli-qmd3mse0.js → cli-qsnnd04k.js} +1 -1
- package/dist/{cli-agyaeef4.js → cli-qwca7s44.js} +3 -3
- package/dist/{cli-fayav105.js → cli-rfywm85n.js} +724 -792
- package/dist/{cli-zgv8gxgs.js → cli-rmmpt0wm.js} +6 -6
- package/dist/{cli-hae9j8sv.js → cli-rzsy6nc6.js} +12 -8
- package/dist/{cli-btf6fw39.js → cli-s7t6p9my.js} +1 -1
- package/dist/{cli-cseh6f8w.js → cli-sdtt3men.js} +1 -1
- package/dist/{cli-9r5gtwjr.js → cli-tk7cjj8h.js} +197 -2
- package/dist/{cli-q26b9wre.js → cli-tph5wt3y.js} +4 -4
- package/dist/{cli-gce09r66.js → cli-tqegb8eq.js} +3 -3
- package/dist/{cli-kf3pxxdg.js → cli-v1dv1r37.js} +1 -1
- package/dist/{cli-09kmfkmq.js → cli-wcg8x116.js} +1 -1
- package/dist/{cli-mnrkgg60.js → cli-wk18cm92.js} +5 -5
- package/dist/{cli-p0m0p34z.js → cli-x1wa213s.js} +3 -3
- package/dist/{cli-jrp1dt73.js → cli-xzm9vcfg.js} +1 -1
- package/dist/{cli-715t1gx6.js → cli-y97qxcfx.js} +9 -9
- package/dist/{cli-bc779n4v.js → cli-yq3zak69.js} +1 -1
- package/dist/cli.js +17 -17
- package/dist/{codex-adapter-ysq6bzha.js → codex-adapter-30j9bpzd.js} +5 -6
- package/dist/{codex-hook-fac6175r.js → codex-hook-h3vk6xzr.js} +1 -1
- package/dist/{codex-session-runner-qakzfx93.js → codex-session-runner-8vp57v8w.js} +5 -6
- package/dist/{commands-rs7hkv9r.js → commands-bngnz9g7.js} +3 -3
- package/dist/{controller-r5x9bg6e.js → controller-hxx8wwy1.js} +2 -2
- package/dist/{controllers-connect-498hrxvk.js → controllers-connect-e2b4gyxc.js} +20 -20
- package/dist/{cursor-adapter-d46qszer.js → cursor-adapter-n5nc3mfe.js} +1 -2
- package/dist/{db-s13dqhr6.js → db-bgm7vkc0.js} +3 -3
- package/dist/{db-pm96nhdb.js → db-c6np41ca.js} +12 -2
- package/dist/{devin-adapter-z46ep5ph.js → devin-adapter-xedz98zv.js} +1 -1
- package/dist/{dispatcher-j3h81t7m.js → dispatcher-jnybck15.js} +18 -18
- package/dist/{dsh-adapter-rw0d5rc4.js → dsh-adapter-nrhbrjz8.js} +1 -2
- package/dist/{easter-egg-3d-qtgfxgze.js → easter-egg-3d-533knw22.js} +1 -1
- package/dist/{embedding-space-xh8p4q4x.js → embedding-space-crsm2zp0.js} +6 -6
- package/dist/{embeddings-wp745m91.js → embeddings-e7z3f27f.js} +1 -1
- package/dist/{execute-2fzb9z74.js → execute-b3mrb1mv.js} +1 -1
- package/dist/{external-channel-ys21h3sy.js → external-channel-m77wf5z3.js} +2 -2
- package/dist/{fx-adapter-vz0b9z3g.js → fx-adapter-b6w0kf56.js} +7 -8
- package/dist/{google-generative-ai-ytpgncx9.js → google-generative-ai-h7s3e9kk.js} +1 -1
- package/dist/{google-vertex-tqhze5j7.js → google-vertex-fhxaafzw.js} +1 -1
- package/dist/{grok-adapter-spea7zkj.js → grok-adapter-4sqtebdk.js} +7 -8
- package/dist/handlers-kdjcyzdj.js +32 -0
- package/dist/heartbeat-xgb036sx.js +43 -0
- package/dist/{hook-amcj4s10.js → hook-5h02c9ga.js} +6 -6
- package/dist/{hook-bc6n49qn.js → hook-xsk1jbha.js} +5 -5
- package/dist/{http-7374brv5.js → http-txe7qhvn.js} +448 -165
- package/dist/{index-pxn30mse.js → index-0eny15vj.js} +8 -8
- package/dist/{index-5a9jtqde.js → index-0rvk3vd4.js} +46 -46
- package/dist/{index-fvzke5kx.js → index-1qw6f2dc.js} +10 -10
- package/dist/{index-q5cmtbz5.js → index-4a0670yh.js} +15939 -14244
- package/dist/index-835xdgnm.js +33 -0
- package/dist/index-d469300x.js +37 -0
- package/dist/{index-h7f61sy9.js → index-e5pfbsys.js} +3 -3
- package/dist/{index-hsad2t3r.js → index-m5gx1xd6.js} +38 -38
- package/dist/{index-5fx3b3kw.js → index-rvccek1w.js} +9 -9
- package/dist/index-rzqwp11g.js +32 -0
- package/dist/{index-w4m9z29z.js → index-tvfafeyy.js} +1 -1
- package/dist/{index-c9y31ytf.js → index-vk63emp7.js} +979 -35
- package/dist/{index-514d9pf6.js → index-w7em4ktq.js} +8 -8
- package/dist/{index-p4hjwbvw.js → index-ysvbhg5m.js} +1 -1
- package/dist/{keepalive-wy29kbrg.js → keepalive-4zsrce78.js} +3 -3
- package/dist/lead-yqt47dkr.js +70 -0
- package/dist/{maintenance-h2ds9w6c.js → maintenance-86jvartk.js} +1 -1
- package/dist/{oauth-refresh-sweep-q7mtbyp3.js → oauth-refresh-sweep-j52kg9pr.js} +2 -2
- package/dist/{onboard-vw8r2fdw.js → onboard-c2aj5p8q.js} +3 -3
- package/dist/{opencode-adapter-mtb0953j.js → opencode-adapter-dsagkhtw.js} +5 -6
- package/dist/{otel-impl-j42czw3r.js → otel-impl-yyy203z8.js} +1 -1
- package/dist/{pi-mono-adapter-zk8pg9jr.js → pi-mono-adapter-546cd1cc.js} +9 -9
- package/dist/{pricing-refresh-x7nhv23d.js → pricing-refresh-1rgzqyzz.js} +2 -3
- package/dist/{rbac-roles-9044425x.js → rbac-roles-e70xfeyj.js} +4 -6
- package/dist/{rbac-roles-bzvee6cf.js → rbac-roles-q89qe8er.js} +3 -3
- package/dist/{registry-hpjfmcfz.js → registry-32b1mft6.js} +1 -1
- package/dist/{render-v2-t7bn4skz.js → render-v2-k6tt107q.js} +9 -4
- package/dist/{resume-x94gemep.js → resume-cnnrjfxa.js} +6 -6
- package/dist/{runtime-breq6fmv.js → runtime-1hv06jsn.js} +1 -1
- package/dist/{session-access-q7dmqjvt.js → session-access-xkxkjw3n.js} +4 -4
- package/dist/{session-source-backfill-440ysamr.js → session-source-backfill-1d5pdwww.js} +2 -2
- package/dist/{setup-07n4727s.js → setup-se8q7gkc.js} +1 -1
- package/dist/{virtual-modules-z5h6mcyf.js → virtual-modules-gazyapte.js} +3 -3
- package/dist/{work-objects-pnq5y534.js → work-objects-1kxnbzy5.js} +22 -22
- package/dist/{worker-follow-up-7z1gfkr8.js → worker-follow-up-zqm8apt4.js} +18 -18
- package/dist/worker-j6xxtq7p.js +70 -0
- package/openapi.json +334 -7
- package/package.json +4 -4
- package/src/apps/catalog.generated.json +55 -0
- package/src/apps/definition.ts +11 -0
- package/src/apps/page-validator.ts +19 -0
- package/src/apps/store.ts +28 -8
- package/src/assets/key.ts +77 -4
- package/src/be/db/model-profiles.ts +147 -38
- package/src/be/db/session-labels.ts +57 -0
- package/src/be/db/session-tree.ts +51 -7
- package/src/be/db/slack-trees.ts +146 -0
- package/src/be/db/tasks/read.ts +107 -8
- package/src/be/db/workflow-run-definitions.ts +117 -0
- package/src/be/db-client.ts +8 -2
- package/src/be/db.ts +119 -87
- package/src/be/event-loop-lag.ts +146 -0
- package/src/be/mcp-overflow-sweep.ts +2 -1
- 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 +199 -18
- package/src/be/memory/task-learning.ts +79 -14
- package/src/be/memory/types.ts +24 -1
- package/src/be/migrations/278_slack_render_v2_reconcile.sql +108 -0
- 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/be/swarm-config-guard.ts +2 -0
- package/src/commands/context-preamble.ts +258 -0
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/runner.ts +32 -1
- package/src/extensions/catalog.generated.json +3 -3
- package/src/fs/provider.ts +17 -3
- package/src/heartbeat/heartbeat.ts +17 -5
- 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/core.ts +9 -3
- package/src/http/index.ts +12 -9
- package/src/http/memory.ts +9 -4
- 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/sessions.ts +16 -3
- package/src/http/tasks.ts +37 -12
- package/src/http/utils.ts +18 -0
- package/src/http/webhooks.ts +48 -0
- package/src/http/workflows.ts +15 -2
- package/src/integrations/chat-sdk/commands.ts +167 -31
- package/src/integrations/chat-sdk/inbound.ts +10 -8
- package/src/integrations/chat-sdk/message-text.ts +117 -0
- 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/scheduler/scheduler.ts +4 -1
- package/src/scripts-runtime/executors/quickjs-runner.ts +2 -0
- package/src/scripts-runtime/executors/quickjs-structured-clone.ts +180 -0
- package/src/scripts-runtime/quickjs-compat.ts +0 -1
- 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 +425 -10
- package/src/slack/handlers.ts +9 -2
- package/src/slack/inbound-dispatch.ts +18 -1
- package/src/slack/index.ts +7 -1
- package/src/slack/lifecycle-lock.ts +29 -0
- package/src/slack/render-v2.ts +424 -212
- package/src/slack/socket-fence.ts +64 -0
- package/src/slack/watcher.ts +42 -8
- 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/apps-schema-form.test.ts +151 -0
- package/src/tests/chained-task-follow-up.test.ts +248 -0
- package/src/tests/chat-sdk-commands.test.ts +359 -2
- package/src/tests/chat-sdk-inbound.test.ts +20 -0
- package/src/tests/chat-sdk-slack.test.ts +189 -1
- 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-client-busy-retry.test.ts +69 -18
- package/src/tests/db-client.test.ts +26 -1
- package/src/tests/db-task-read-contract.test.ts +7 -0
- package/src/tests/db-task-write-contract.test.ts +6 -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/event-loop-lag.test.ts +184 -0
- package/src/tests/explicit-model-validation.test.ts +2 -0
- package/src/tests/extensions-example-comms-adherence-gate.test.ts +115 -0
- package/src/tests/fs-provider.test.ts +42 -0
- package/src/tests/github-webhook-early-ack.test.ts +144 -0
- package/src/tests/heartbeat.test.ts +28 -1
- package/src/tests/http-api-integration.test.ts +2 -0
- package/src/tests/http-log-scrubbing.test.ts +68 -2
- package/src/tests/human-free-reclassify.test.ts +5 -1
- package/src/tests/kv-storage.test.ts +92 -1
- package/src/tests/list-endpoint-slimming.test.ts +17 -0
- package/src/tests/memory-key-paths.test.ts +57 -0
- package/src/tests/memory-retrieval-purge.test.ts +19 -0
- 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/quickjs-compat.test.ts +1 -1
- package/src/tests/runner-context-preamble.test.ts +552 -0
- package/src/tests/schedule-profile.test.ts +359 -0
- package/src/tests/script-connections.test.ts +9 -0
- package/src/tests/script-executor-conformance.test.ts +188 -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/sessions-tree.test.ts +133 -2
- package/src/tests/slack-app-icon.test.ts +4 -0
- package/src/tests/slack-dm-implicit-mention.test.ts +236 -0
- package/src/tests/slack-file-tools-attachments.test.ts +1 -0
- package/src/tests/slack-inbound-receipts.test.ts +22 -2
- package/src/tests/slack-read-boundaries.test.ts +4 -3
- package/src/tests/slack-render-v2-query-plans.test.ts +262 -3
- package/src/tests/slack-render-v2-reconcile.test.ts +201 -0
- package/src/tests/slack-socket-ack.test.ts +16 -1
- package/src/tests/slack-socket-watchdog.test.ts +748 -0
- 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/vcs-identity-inheritance.test.ts +85 -0
- 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/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 +77 -11
- 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/extensions/comms-adherence-gate/README.md +25 -0
- package/templates/extensions/comms-adherence-gate/hooks.ts +100 -11
- package/templates/extensions/comms-adherence-gate/manifest.json +1 -1
- package/templates/skills/apps/SKILL.md +9 -0
- package/templates/skills/apps/content.md +9 -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 +1 -1
- package/templates/skills/swarm-scripts/content.md +1 -1
- 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-dn4gdsgr.js +0 -16
- package/dist/app-a66ssc4k.js +0 -17
- package/dist/cli-530hkwdy.js +0 -779
- package/dist/cli-a0657jmf.js +0 -339
- package/dist/cli-cyn9v8zr.js +0 -748
- package/dist/handlers-crckt5dq.js +0 -32
- package/dist/heartbeat-8phn1kdq.js +0 -41
- package/dist/index-4x08sjtk.js +0 -30
- package/dist/index-8ybffts4.js +0 -37
- package/dist/index-nfy4kkg5.js +0 -33
- package/dist/lead-zdqxsvjn.js +0 -71
- package/dist/worker-y62rvvq3.js +0 -71
- package/dist/{cli-gxy8y1dt.js → cli-8bpgbr8k.js} +3 -3
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
import { getChatThreadResetAt } from "./commands";
|
|
36
36
|
import { type ChatAddressedReason, formatChatHeaderFacts, readChatMessageFacts } from "./facts";
|
|
37
37
|
import { errorMessage } from "./logger";
|
|
38
|
+
import { chatMessageText } from "./message-text";
|
|
38
39
|
import { emitChatMessageSent, postChatMessage } from "./outbound";
|
|
39
40
|
import {
|
|
40
41
|
chatAdapterReacts,
|
|
@@ -123,7 +124,7 @@ export async function handleChatInbound(
|
|
|
123
124
|
messageId: message.id,
|
|
124
125
|
});
|
|
125
126
|
|
|
126
|
-
let text = stripBotMention(message
|
|
127
|
+
let text = stripBotMention(chatMessageText(message), thread.adapter);
|
|
127
128
|
const immediate = /^!now\b/i.test(text);
|
|
128
129
|
if (immediate) text = text.replace(/^!now\s*/i, "").trim();
|
|
129
130
|
const attachments = message.attachments ?? [];
|
|
@@ -314,18 +315,19 @@ async function getChatThreadContext(
|
|
|
314
315
|
for (const m of thread.recentMessages) byId.set(m.id, m);
|
|
315
316
|
return [...byId.values()]
|
|
316
317
|
.sort((a, b) => a.metadata.dateSent.getTime() - b.metadata.dateSent.getTime())
|
|
317
|
-
.
|
|
318
|
-
.filter((m) =>
|
|
318
|
+
.map((m) => ({ m, text: chatMessageText(m) }))
|
|
319
|
+
.filter(({ m, text }) => !exclude.has(m.id) && text.trim() !== "")
|
|
320
|
+
.filter(({ m }) => since === null || m.metadata.dateSent.getTime() > since.getTime())
|
|
319
321
|
.slice(-THREAD_CONTEXT_LIMIT)
|
|
320
|
-
.map((m) => {
|
|
322
|
+
.map(({ m, text }) => {
|
|
321
323
|
if (m.author.isMe || m.author.isBot === true) {
|
|
322
324
|
const truncated =
|
|
323
|
-
|
|
324
|
-
? `${
|
|
325
|
-
:
|
|
325
|
+
text.length > AGENT_MESSAGE_TRUNCATE
|
|
326
|
+
? `${text.slice(0, AGENT_MESSAGE_TRUNCATE)}...`
|
|
327
|
+
: text;
|
|
326
328
|
return `[Agent]: ${truncated}`;
|
|
327
329
|
}
|
|
328
|
-
return `${m.author.userName || m.author.fullName || m.author.userId}: ${
|
|
330
|
+
return `${m.author.userName || m.author.fullName || m.author.userId}: ${text}`;
|
|
329
331
|
})
|
|
330
332
|
.join("\n");
|
|
331
333
|
} catch (error) {
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type Message, tableToAscii } from "chat";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The text of a chat message as the user wrote it.
|
|
5
|
+
*
|
|
6
|
+
* `message.text` is the SDK's plain rendering: link URLs, code fences, inline
|
|
7
|
+
* code and emphasis are gone, and the agent would work from that.
|
|
8
|
+
* `message.formatted` is the same content as an mdast tree, which keeps them.
|
|
9
|
+
* This renders that tree back to markdown: `[text](url)` for a Slack
|
|
10
|
+
* `<url|text>`, fenced blocks, `code`. Text nodes come out as typed.
|
|
11
|
+
* `stringifyMarkdown` is no fit: it escapes `_`, `[` and friends, so `snake_case`
|
|
12
|
+
* would reach the agent as `snake\_case` and `@my_bot !now` would stop matching
|
|
13
|
+
* the mention and command checks.
|
|
14
|
+
*
|
|
15
|
+
* Telegram, Discord and Slack all fill `formatted`. A message without it (a
|
|
16
|
+
* stored or foreign shape) falls back to the plain text.
|
|
17
|
+
*/
|
|
18
|
+
export function chatMessageText(message: Pick<Message, "text" | "formatted">): string {
|
|
19
|
+
try {
|
|
20
|
+
const rendered = message.formatted ? renderBlocks(message.formatted).trim() : "";
|
|
21
|
+
if (rendered) return rendered;
|
|
22
|
+
} catch {
|
|
23
|
+
// Fall through to the plain text.
|
|
24
|
+
}
|
|
25
|
+
return message.text ?? "";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type MdNode = {
|
|
29
|
+
type: string;
|
|
30
|
+
value?: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
alt?: string | null;
|
|
33
|
+
lang?: string | null;
|
|
34
|
+
depth?: number;
|
|
35
|
+
ordered?: boolean | null;
|
|
36
|
+
start?: number | null;
|
|
37
|
+
children?: MdNode[];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Block children are separated by a blank line, as in the source. */
|
|
41
|
+
function renderBlocks(node: MdNode): string {
|
|
42
|
+
return (node.children ?? []).map(render).join("\n\n");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function renderInline(node: MdNode): string {
|
|
46
|
+
return (node.children ?? []).map(render).join("");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** A code span needs a fence longer than any backtick run inside it. */
|
|
50
|
+
function inlineCode(value: string): string {
|
|
51
|
+
const longest = Math.max(0, ...(value.match(/`+/g) ?? []).map((run) => run.length));
|
|
52
|
+
const fence = "`".repeat(longest + 1);
|
|
53
|
+
const pad = value.startsWith("`") || value.endsWith("`") ? " " : "";
|
|
54
|
+
return `${fence}${pad}${value}${pad}${fence}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function codeBlock(value: string, lang: string | null | undefined): string {
|
|
58
|
+
const longest = Math.max(2, ...(value.match(/`{3,}/gm) ?? []).map((run) => run.length));
|
|
59
|
+
const fence = "`".repeat(longest + 1);
|
|
60
|
+
return `${fence}${lang ?? ""}\n${value}\n${fence}`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function renderList(node: MdNode): string {
|
|
64
|
+
const start = node.start ?? 1;
|
|
65
|
+
return (node.children ?? [])
|
|
66
|
+
.map((item, index) => {
|
|
67
|
+
const marker = node.ordered ? `${start + index}. ` : "- ";
|
|
68
|
+
const pad = " ".repeat(marker.length);
|
|
69
|
+
const [first = "", ...rest] = (item.children ?? []).map(render).join("\n").split("\n");
|
|
70
|
+
return [`${marker}${first}`, ...rest.map((line) => (line ? pad + line : line))].join("\n");
|
|
71
|
+
})
|
|
72
|
+
.join("\n");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function render(node: MdNode): string {
|
|
76
|
+
switch (node.type) {
|
|
77
|
+
case "text":
|
|
78
|
+
case "html":
|
|
79
|
+
return node.value ?? "";
|
|
80
|
+
case "inlineCode":
|
|
81
|
+
return inlineCode(node.value ?? "");
|
|
82
|
+
case "code":
|
|
83
|
+
return codeBlock(node.value ?? "", node.lang);
|
|
84
|
+
case "link": {
|
|
85
|
+
const label = renderInline(node);
|
|
86
|
+
return !label || label === node.url ? (node.url ?? "") : `[${label}](${node.url ?? ""})`;
|
|
87
|
+
}
|
|
88
|
+
case "image":
|
|
89
|
+
return ``;
|
|
90
|
+
case "strong":
|
|
91
|
+
return `**${renderInline(node)}**`;
|
|
92
|
+
case "emphasis":
|
|
93
|
+
return `_${renderInline(node)}_`;
|
|
94
|
+
case "delete":
|
|
95
|
+
return `~~${renderInline(node)}~~`;
|
|
96
|
+
case "break":
|
|
97
|
+
return "\n";
|
|
98
|
+
case "thematicBreak":
|
|
99
|
+
return "---";
|
|
100
|
+
case "heading":
|
|
101
|
+
return `${"#".repeat(node.depth ?? 1)} ${renderInline(node)}`;
|
|
102
|
+
case "blockquote":
|
|
103
|
+
return renderBlocks(node)
|
|
104
|
+
.split("\n")
|
|
105
|
+
.map((line) => `> ${line}`.trimEnd())
|
|
106
|
+
.join("\n");
|
|
107
|
+
case "list":
|
|
108
|
+
return renderList(node);
|
|
109
|
+
case "table":
|
|
110
|
+
return codeBlock(tableToAscii(node as never), null);
|
|
111
|
+
case "paragraph":
|
|
112
|
+
return renderInline(node);
|
|
113
|
+
default:
|
|
114
|
+
// Unknown node: keep what it holds rather than drop it.
|
|
115
|
+
return node.children ? renderBlocks(node) : (node.value ?? "");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -182,7 +182,7 @@ registerTemplate({
|
|
|
182
182
|
## Memory
|
|
183
183
|
|
|
184
184
|
Memories from past sessions are in your task message. Read them before you start. For a wider search, run the \`task-context-gathering\` script with the task ID and two to four queries.
|
|
185
|
-
|
|
185
|
+
Pass a fix, pattern or gotcha the next agent needs as \`learning\` on a \`store-progress\` call before the task ends: line 1 a title, line 2 the rule ("When X, do Y"), never a status line. Completed task outputs are stored for you.
|
|
186
186
|
You MUST use the \`memory\` skill before you store, edit, or delete a memory.
|
|
187
187
|
`,
|
|
188
188
|
variables: [],
|
|
@@ -161,14 +161,18 @@ function copyEnvKeys(
|
|
|
161
161
|
|
|
162
162
|
function parseStringArray(value: string | undefined): string[] {
|
|
163
163
|
if (!value?.trim()) return [];
|
|
164
|
+
let parsed: unknown;
|
|
164
165
|
try {
|
|
165
|
-
|
|
166
|
-
if (Array.isArray(parsed) && parsed.every((entry) => typeof entry === "string")) {
|
|
167
|
-
return parsed;
|
|
168
|
-
}
|
|
166
|
+
parsed = JSON.parse(value);
|
|
169
167
|
} catch {
|
|
170
168
|
// Accept comma-separated values for hand-authored environment config.
|
|
171
169
|
}
|
|
170
|
+
if (Array.isArray(parsed)) {
|
|
171
|
+
if (!parsed.every((entry) => typeof entry === "string")) {
|
|
172
|
+
throw new AcpTargetResolutionError("ACP_TARGET_ENV_KEYS must be a JSON array of strings.");
|
|
173
|
+
}
|
|
174
|
+
return parsed;
|
|
175
|
+
}
|
|
172
176
|
return value
|
|
173
177
|
.split(",")
|
|
174
178
|
.map((entry) => entry.trim())
|
|
@@ -423,7 +427,7 @@ const copilotTargetProfile: AcpTargetProfile = {
|
|
|
423
427
|
},
|
|
424
428
|
};
|
|
425
429
|
|
|
426
|
-
/** Qwen Code's `--auth-type` choices (0.26.
|
|
430
|
+
/** Qwen Code's `--auth-type` choices (0.26.7). `qwen-oauth` needs a browser, so it is left out. */
|
|
427
431
|
const QWEN_AUTH_TYPES = ["openai", "openai-responses", "anthropic", "gemini", "vertex-ai"] as const;
|
|
428
432
|
|
|
429
433
|
// Qwen Code is a Gemini CLI fork: QWEN_SYSTEM_MD replaces its built-in prompt
|
|
@@ -475,7 +479,8 @@ const qwenTargetProfile: AcpTargetProfile = {
|
|
|
475
479
|
/**
|
|
476
480
|
* Kiro CLI reads its prompt from a Kiro agent config, not from a flag or an
|
|
477
481
|
* env var, so the swarm system prompt is not injected (as with OpenCode).
|
|
478
|
-
* Kiro
|
|
482
|
+
* Kiro advertises no ACP config options (checked on 2.29.1), so the model
|
|
483
|
+
* rides on argv as `--model`, which `kiro-cli acp` still accepts in 3.0.0.
|
|
479
484
|
*/
|
|
480
485
|
const kiroTargetProfile: AcpTargetProfile = {
|
|
481
486
|
target: "kiro",
|
|
@@ -45,7 +45,7 @@ import type {
|
|
|
45
45
|
* default; the image installs exactly this version and the per-task settings
|
|
46
46
|
* set `amp.updates.mode: "disabled"`. Bump it deliberately, with a live run.
|
|
47
47
|
*/
|
|
48
|
-
export const AMP_PACKAGE = "@ampcode/cli@0.0.
|
|
48
|
+
export const AMP_PACKAGE = "@ampcode/cli@0.0.1793804260-g12625e";
|
|
49
49
|
|
|
50
50
|
/** MCP server name. Amp exposes its tools as `agent_swarm` / `store_progress` (dashes become underscores). */
|
|
51
51
|
const AMP_MCP_SERVER_NAME = "agent-swarm";
|
|
@@ -101,12 +101,13 @@ export class ClaudeInputQueue implements AsyncIterable<SDKUserMessage> {
|
|
|
101
101
|
return this.entries.length + this.inFlight;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
enqueue(text: string): Promise<void> {
|
|
104
|
+
enqueue(text: string, uuid = crypto.randomUUID()): Promise<void> {
|
|
105
105
|
if (this.closed) return Promise.reject(new Error("Claude SDK input is closed"));
|
|
106
106
|
return new Promise((accepted, rejected) => {
|
|
107
107
|
this.entries.push({
|
|
108
108
|
message: {
|
|
109
109
|
type: "user",
|
|
110
|
+
uuid,
|
|
110
111
|
message: { role: "user", content: text },
|
|
111
112
|
parent_tool_use_id: null,
|
|
112
113
|
},
|
|
@@ -323,6 +324,13 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
323
324
|
private aborted = false;
|
|
324
325
|
private abortReason = "cancelled";
|
|
325
326
|
private acceptingInput = true;
|
|
327
|
+
private deliveryTail: Promise<unknown> = Promise.resolve();
|
|
328
|
+
private pendingDeliveries = 0;
|
|
329
|
+
private turnActive = true;
|
|
330
|
+
private resultWaiters = new Set<() => void>();
|
|
331
|
+
private completionCandidate = false;
|
|
332
|
+
private unansweredInputs = new Set<string>();
|
|
333
|
+
private inputResultIdsSupported = false;
|
|
326
334
|
private errorTracker = new SessionErrorTracker();
|
|
327
335
|
private shutdownPromise: Promise<void> | undefined;
|
|
328
336
|
/** Keeps the session heartbeat fresh while Claude idles on background tasks. */
|
|
@@ -334,7 +342,7 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
334
342
|
this.contextWindowSize = getContextWindowSize(options.model);
|
|
335
343
|
this.transcript = [`User: ${scrubSecrets(options.config.prompt)}`];
|
|
336
344
|
if (options.queueSteeringSupported) {
|
|
337
|
-
this.deliverSteering = (delivery) => this.
|
|
345
|
+
this.deliverSteering = (delivery) => this.deliverLiveSteering(delivery);
|
|
338
346
|
}
|
|
339
347
|
this.completionPromise = this.run();
|
|
340
348
|
}
|
|
@@ -360,6 +368,9 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
360
368
|
this.aborted = true;
|
|
361
369
|
this.acceptingInput = false;
|
|
362
370
|
this.abortReason = scrubSecrets(reason ?? "cancelled");
|
|
371
|
+
this.input.close(this.abortReason);
|
|
372
|
+
for (const resolve of this.resultWaiters) resolve();
|
|
373
|
+
this.resultWaiters.clear();
|
|
363
374
|
const interrupt = this.query?.interrupt();
|
|
364
375
|
if (interrupt) {
|
|
365
376
|
await Promise.race([interrupt.catch(() => undefined), Bun.sleep(SDK_INTERRUPT_TIMEOUT_MS)]);
|
|
@@ -369,22 +380,80 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
369
380
|
await this.shutdownAfterSdkGrace();
|
|
370
381
|
}
|
|
371
382
|
|
|
372
|
-
private
|
|
383
|
+
private deliverLiveSteering(delivery: SteerDelivery): Promise<SteerDeliveryResult> {
|
|
384
|
+
// Reserve before yielding: a result can arrive while an interrupt or an
|
|
385
|
+
// earlier delivery is awaiting its control response.
|
|
373
386
|
if (!this.acceptingInput || this.aborted) {
|
|
374
|
-
return { delivered: false, reason: "Claude SDK session has completed" };
|
|
387
|
+
return Promise.resolve({ delivered: false, reason: "Claude SDK session has completed" });
|
|
375
388
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
389
|
+
this.pendingDeliveries++;
|
|
390
|
+
const operation = this.deliveryTail.then(async (): Promise<SteerDeliveryResult> => {
|
|
391
|
+
try {
|
|
392
|
+
if (!this.acceptingInput || this.aborted) {
|
|
393
|
+
throw new Error("Claude SDK session has completed");
|
|
394
|
+
}
|
|
395
|
+
if (delivery.mode === "steer" && this.turnActive && this.query) {
|
|
396
|
+
// The control receipt precedes the interrupted result. Wait for both
|
|
397
|
+
// before writing the redirect, so that result cannot close its input.
|
|
398
|
+
// interrupt() preserves messages already queued inside Claude.
|
|
399
|
+
let release!: () => void;
|
|
400
|
+
const result = new Promise<void>((resolve) => {
|
|
401
|
+
release = resolve;
|
|
402
|
+
this.resultWaiters.add(resolve);
|
|
403
|
+
});
|
|
404
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
405
|
+
try {
|
|
406
|
+
await Promise.race([
|
|
407
|
+
Promise.all([this.query.interrupt(), result]),
|
|
408
|
+
new Promise<never>((_, reject) => {
|
|
409
|
+
timer = setTimeout(
|
|
410
|
+
() => reject(new Error("Claude SDK redirect timed out")),
|
|
411
|
+
10_000,
|
|
412
|
+
);
|
|
413
|
+
}),
|
|
414
|
+
]);
|
|
415
|
+
} finally {
|
|
416
|
+
clearTimeout(timer);
|
|
417
|
+
this.resultWaiters.delete(release);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
if (!this.acceptingInput || this.aborted) {
|
|
421
|
+
throw new Error("Claude SDK session has completed");
|
|
422
|
+
}
|
|
423
|
+
this.completionCandidate = false;
|
|
424
|
+
this.turnActive = true;
|
|
425
|
+
const uuid = crypto.randomUUID();
|
|
426
|
+
this.unansweredInputs.add(uuid);
|
|
427
|
+
try {
|
|
428
|
+
await this.input.enqueue(delivery.text, uuid);
|
|
429
|
+
} catch (error) {
|
|
430
|
+
this.unansweredInputs.delete(uuid);
|
|
431
|
+
throw error;
|
|
432
|
+
}
|
|
433
|
+
this.transcript.push(`User: ${scrubSecrets(delivery.text)}`);
|
|
434
|
+
return { delivered: true, mode: delivery.mode };
|
|
435
|
+
} catch (error) {
|
|
436
|
+
return { delivered: false, reason: scrubSecrets(String(error)) };
|
|
437
|
+
} finally {
|
|
438
|
+
this.pendingDeliveries--;
|
|
439
|
+
this.maybeCloseInput();
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
this.deliveryTail = operation;
|
|
443
|
+
return operation;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
private maybeCloseInput(): void {
|
|
447
|
+
if (
|
|
448
|
+
!this.completionCandidate ||
|
|
449
|
+
this.pendingDeliveries > 0 ||
|
|
450
|
+
this.input.pendingCount > 0 ||
|
|
451
|
+
this.unansweredInputs.size > 0
|
|
452
|
+
) {
|
|
453
|
+
return;
|
|
381
454
|
}
|
|
382
|
-
|
|
383
|
-
this.
|
|
384
|
-
await this.input.enqueue(text);
|
|
385
|
-
return { delivered: true, mode: "queue" };
|
|
386
|
-
} catch (error) {
|
|
387
|
-
return { delivered: false, reason: scrubSecrets(String(error)) };
|
|
455
|
+
if (!this.backgroundKeepalive.holdInputForBackgroundWork(() => this.closeInput())) {
|
|
456
|
+
this.closeInput();
|
|
388
457
|
}
|
|
389
458
|
}
|
|
390
459
|
|
|
@@ -420,8 +489,49 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
420
489
|
return this.shutdownPromise;
|
|
421
490
|
}
|
|
422
491
|
|
|
492
|
+
/**
|
|
493
|
+
* A singular `user_message_uuid` names the last message merged into the turn.
|
|
494
|
+
* Every unanswered input enqueued at or before it was coalesced into that
|
|
495
|
+
* turn and is not echoed on its own. Inputs enqueued after it stay open.
|
|
496
|
+
*/
|
|
497
|
+
private answerCoalescedThrough(lastUuid: string): void {
|
|
498
|
+
if (!this.unansweredInputs.has(lastUuid)) return;
|
|
499
|
+
for (const uuid of [...this.unansweredInputs]) {
|
|
500
|
+
this.unansweredInputs.delete(uuid);
|
|
501
|
+
if (uuid === lastUuid) return;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
private noteAnsweredInputs(result: SDKResultMessage): void {
|
|
506
|
+
const listed = result.user_message_uuids;
|
|
507
|
+
if (listed && listed.length > 0) {
|
|
508
|
+
this.inputResultIdsSupported = true;
|
|
509
|
+
for (const uuid of listed) this.unansweredInputs.delete(uuid);
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
if (result.user_message_uuid) {
|
|
513
|
+
this.inputResultIdsSupported = true;
|
|
514
|
+
this.answerCoalescedThrough(result.user_message_uuid);
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
if (!this.inputResultIdsSupported) {
|
|
518
|
+
// Older executables do not echo input UUIDs. Preserve their existing
|
|
519
|
+
// queued_turn_count completion contract.
|
|
520
|
+
this.unansweredInputs.clear();
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
423
524
|
private handleMessage(message: SDKMessage): boolean {
|
|
424
525
|
const json = message as ClaudeProtocolMessage;
|
|
526
|
+
if (json.type === "result") {
|
|
527
|
+
const result = message as SDKResultMessage;
|
|
528
|
+
this.noteAnsweredInputs(result);
|
|
529
|
+
this.turnActive = (result.queued_turn_count ?? 0) > 0 || this.unansweredInputs.size > 0;
|
|
530
|
+
for (const resolve of this.resultWaiters) resolve();
|
|
531
|
+
this.resultWaiters.clear();
|
|
532
|
+
} else if (json.type === "assistant" && !json.parent_tool_use_id) {
|
|
533
|
+
this.turnActive = true;
|
|
534
|
+
}
|
|
425
535
|
this.backgroundKeepalive.observe(json);
|
|
426
536
|
const normalized = normalizeClaudeMessage(json, {
|
|
427
537
|
taskId: this.options.config.taskId,
|
|
@@ -462,7 +572,9 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
462
572
|
let terminalError: unknown;
|
|
463
573
|
let stderrOutput = "";
|
|
464
574
|
|
|
465
|
-
|
|
575
|
+
const initialUuid = crypto.randomUUID();
|
|
576
|
+
this.unansweredInputs.add(initialUuid);
|
|
577
|
+
void this.input.enqueue(config.prompt, initialUuid).catch(() => {});
|
|
466
578
|
try {
|
|
467
579
|
const executable = resolveClaudeSdkExecutable(
|
|
468
580
|
this.options.claudeBinaryArgv[0] ?? "claude",
|
|
@@ -529,13 +641,8 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
529
641
|
const isResult = this.handleMessage(message);
|
|
530
642
|
if (!isResult) continue;
|
|
531
643
|
terminalResult = message as SDKResultMessage;
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
// it settles closes input.
|
|
535
|
-
if (!this.backgroundKeepalive.holdInputForBackgroundWork(() => this.closeInput())) {
|
|
536
|
-
this.closeInput();
|
|
537
|
-
}
|
|
538
|
-
}
|
|
644
|
+
this.completionCandidate = (terminalResult.queued_turn_count ?? 0) === 0;
|
|
645
|
+
this.maybeCloseInput();
|
|
539
646
|
}
|
|
540
647
|
} catch (error) {
|
|
541
648
|
terminalError = error;
|
|
@@ -544,6 +651,8 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
544
651
|
this.emit({ type: "error", message, category: "sdk_transport" });
|
|
545
652
|
}
|
|
546
653
|
} finally {
|
|
654
|
+
for (const resolve of this.resultWaiters) resolve();
|
|
655
|
+
this.resultWaiters.clear();
|
|
547
656
|
this.backgroundKeepalive.stop();
|
|
548
657
|
this.acceptingInput = false;
|
|
549
658
|
this.input.close();
|
|
@@ -30,7 +30,12 @@ import type { ProviderEvent } from "./types";
|
|
|
30
30
|
*/
|
|
31
31
|
const SLASH_COMMAND_REGEX = /^\/([a-z0-9:_-]+)(?:\s+(.*))?$/;
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const DEFAULT_MAX_SKILL_CHARS = 100_000;
|
|
34
|
+
|
|
35
|
+
export function getMaxSkillChars(): number {
|
|
36
|
+
const parsed = Number(process.env.MAX_SKILL_CHARS);
|
|
37
|
+
return Number.isInteger(parsed) && parsed > 0 ? parsed : DEFAULT_MAX_SKILL_CHARS;
|
|
38
|
+
}
|
|
34
39
|
|
|
35
40
|
/**
|
|
36
41
|
* Resolve the default skills directory for Codex.
|
|
@@ -128,12 +133,13 @@ export async function resolveSlashSkillPrompt(
|
|
|
128
133
|
return prompt;
|
|
129
134
|
}
|
|
130
135
|
|
|
131
|
-
|
|
136
|
+
const maxSkillChars = getMaxSkillChars();
|
|
137
|
+
if (skillContent.length > maxSkillChars) {
|
|
132
138
|
opts.emit?.({
|
|
133
139
|
type: "raw_stderr",
|
|
134
|
-
content: `[${opts.providerLabel}] skill resolver: SKILL.md for /${commandName} exceeds ${
|
|
140
|
+
content: `[${opts.providerLabel}] skill resolver: SKILL.md for /${commandName} exceeds ${maxSkillChars} chars (${skillContent.length}), truncating\n`,
|
|
135
141
|
});
|
|
136
|
-
skillContent = skillContent.slice(0,
|
|
142
|
+
skillContent = skillContent.slice(0, maxSkillChars);
|
|
137
143
|
}
|
|
138
144
|
|
|
139
145
|
if (opts.stripFrontmatter) {
|
|
@@ -35,7 +35,7 @@ import type {
|
|
|
35
35
|
} from "./types";
|
|
36
36
|
|
|
37
37
|
/** Pinned in package.json and Dockerfile.worker; bump all three together. */
|
|
38
|
-
export const CURSOR_SDK_VERSION = "1.
|
|
38
|
+
export const CURSOR_SDK_VERSION = "1.3.1";
|
|
39
39
|
|
|
40
40
|
/** MCP server name; Cursor reports its tools as `mcp` calls with this `providerIdentifier`. */
|
|
41
41
|
const CURSOR_MCP_SERVER_NAME = "agent-swarm";
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { join } from "node:path";
|
|
16
|
+
import { getMaxSkillChars } from "./codex-skill-resolver";
|
|
16
17
|
import type { ProviderEvent } from "./types";
|
|
17
18
|
|
|
18
19
|
/**
|
|
@@ -24,8 +25,6 @@ import type { ProviderEvent } from "./types";
|
|
|
24
25
|
*/
|
|
25
26
|
const SKILL_COMMAND_REGEX = /^@skills:([a-z0-9:_-]+)(?:\s+(.*))?$/;
|
|
26
27
|
|
|
27
|
-
const MAX_SKILL_CHARS = Number(process.env.MAX_SKILL_CHARS) || 100_000;
|
|
28
|
-
|
|
29
28
|
/**
|
|
30
29
|
* Default skills directory — `plugin/pi-skills/` relative to the project root.
|
|
31
30
|
*
|
|
@@ -97,12 +96,13 @@ export async function resolveDevinPrompt(
|
|
|
97
96
|
return prompt;
|
|
98
97
|
}
|
|
99
98
|
|
|
100
|
-
|
|
99
|
+
const maxSkillChars = getMaxSkillChars();
|
|
100
|
+
if (skillContent.length > maxSkillChars) {
|
|
101
101
|
emit?.({
|
|
102
102
|
type: "raw_stderr",
|
|
103
|
-
content: `[devin] skill resolver: SKILL.md for @skills:${commandName} exceeds ${
|
|
103
|
+
content: `[devin] skill resolver: SKILL.md for @skills:${commandName} exceeds ${maxSkillChars} chars (${skillContent.length}), truncating\n`,
|
|
104
104
|
});
|
|
105
|
-
skillContent = skillContent.slice(0,
|
|
105
|
+
skillContent = skillContent.slice(0, maxSkillChars);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// Assemble the user-request body: trailing args from the @skills: line (if any),
|
|
@@ -37,7 +37,7 @@ import type {
|
|
|
37
37
|
} from "./types";
|
|
38
38
|
|
|
39
39
|
// npm's `latest` is older and lacks the JSON/stdin contract used here.
|
|
40
|
-
export const DSH_PACKAGE = "@deepseek-ai/dsh@0.2.2-
|
|
40
|
+
export const DSH_PACKAGE = "@deepseek-ai/dsh@0.2.2-rc.1";
|
|
41
41
|
|
|
42
42
|
export function checkDshCredentials(env: Record<string, string | undefined>): CredStatus {
|
|
43
43
|
return env.DEEPSEEK_API_KEY?.trim() || env.OPENROUTER_API_KEY?.trim()
|
|
@@ -73,6 +73,7 @@ export async function prepareStandaloneScheduleTask(
|
|
|
73
73
|
routingSource: schedule.targetAgentId ? "engine_default" : undefined,
|
|
74
74
|
model: schedule.model,
|
|
75
75
|
modelTier: schedule.modelTier,
|
|
76
|
+
profile: schedule.profile,
|
|
76
77
|
scheduleId: schedule.id,
|
|
77
78
|
source: "schedule",
|
|
78
79
|
requestedByUserId: schedule.createdBy,
|
|
@@ -34,6 +34,7 @@ import { getExecutorRegistry as getWorkflowExecutorRegistry } from "@/workflows"
|
|
|
34
34
|
import { startWorkflowExecution } from "@/workflows/engine";
|
|
35
35
|
import type { ExecutorRegistry } from "@/workflows/executors/registry";
|
|
36
36
|
import { handleScheduleTrigger } from "@/workflows/triggers";
|
|
37
|
+
import { withLoopPath } from "../be/event-loop-lag";
|
|
37
38
|
import { ensure } from "../utils/business-use";
|
|
38
39
|
import { scrubObject, scrubSecrets } from "../utils/secret-scrubber";
|
|
39
40
|
|
|
@@ -579,7 +580,9 @@ export function startScheduler(
|
|
|
579
580
|
.then(async () => {
|
|
580
581
|
if (schedulerRun !== run) return;
|
|
581
582
|
schedulerInterval = setInterval(() => {
|
|
582
|
-
void processSchedules().catch((err) =>
|
|
583
|
+
void withLoopPath("scheduler.poll", () => processSchedules()).catch((err) =>
|
|
584
|
+
console.error("[Scheduler] Poll failed:", err),
|
|
585
|
+
);
|
|
583
586
|
}, intervalMs);
|
|
584
587
|
await processSchedules();
|
|
585
588
|
})
|
|
@@ -14,6 +14,7 @@ import { table } from "../stdlib/table";
|
|
|
14
14
|
import { SwarmConfig } from "../swarm-config";
|
|
15
15
|
import { bundleForQuickJS, USER_SCRIPT_FILE } from "./quickjs-bundle";
|
|
16
16
|
import { SANDBOX_EPILOGUE, SANDBOX_PRELUDE } from "./quickjs-prelude";
|
|
17
|
+
import { SANDBOX_STRUCTURED_CLONE } from "./quickjs-structured-clone";
|
|
17
18
|
import { SANDBOX_WEB_SHIMS } from "./quickjs-web-shims";
|
|
18
19
|
import type { SourceMapReader } from "./sourcemap";
|
|
19
20
|
import type {
|
|
@@ -661,6 +662,7 @@ async function evaluateJob(
|
|
|
661
662
|
const ok =
|
|
662
663
|
evaluate(init, "swarm-init.js") &&
|
|
663
664
|
evaluate(SANDBOX_WEB_SHIMS, "swarm-web-shims.js") &&
|
|
665
|
+
evaluate(SANDBOX_STRUCTURED_CLONE, "swarm-structured-clone.js") &&
|
|
664
666
|
evaluate(SANDBOX_PRELUDE, "swarm-prelude.js") &&
|
|
665
667
|
evaluate(bundle.code, BUNDLE_FILE) &&
|
|
666
668
|
evaluate(SANDBOX_EPILOGUE, "swarm-epilogue.js");
|