@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
|
@@ -2,6 +2,7 @@ import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
|
|
2
2
|
import { createServer, type Server } from "node:http";
|
|
3
3
|
import {
|
|
4
4
|
buildContextPreamble,
|
|
5
|
+
buildResumeContextPreamble,
|
|
5
6
|
CONTEXT_PREAMBLE_MAX_CHARS,
|
|
6
7
|
CONTEXT_PREAMBLE_MAX_TOKENS,
|
|
7
8
|
fetchTaskContextForPreamble,
|
|
@@ -15,12 +16,20 @@ const API_KEY = "example-test-key";
|
|
|
15
16
|
|
|
16
17
|
// In-memory task store for the mock server
|
|
17
18
|
const mockTasks: Record<string, TaskContextForPreamble> = {};
|
|
19
|
+
// Session-log rows served by /api/tasks/:id/session-logs
|
|
20
|
+
const mockSessionLogs: Record<string, { createdAt: string; content: string }[]> = {};
|
|
18
21
|
|
|
19
22
|
let server: Server;
|
|
20
23
|
|
|
21
24
|
beforeAll(async () => {
|
|
22
25
|
server = createServer((req, res) => {
|
|
23
26
|
const url = req.url ?? "";
|
|
27
|
+
const logsMatch = url.match(/^\/api\/tasks\/([^/?]+)\/session-logs/);
|
|
28
|
+
if (logsMatch) {
|
|
29
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
30
|
+
res.end(JSON.stringify({ logs: mockSessionLogs[logsMatch[1]] ?? [] }));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
24
33
|
const match = url.match(/^\/api\/tasks\/([^/?]+)/);
|
|
25
34
|
if (match) {
|
|
26
35
|
const id = match[1];
|
|
@@ -231,3 +240,546 @@ describe("buildContextPreamble", () => {
|
|
|
231
240
|
expect(CONTEXT_PREAMBLE_MAX_CHARS).toBe(8000);
|
|
232
241
|
});
|
|
233
242
|
});
|
|
243
|
+
|
|
244
|
+
describe("buildResumeContextPreamble interrupted tool call", () => {
|
|
245
|
+
const TASK_ID = "resume-parent";
|
|
246
|
+
let seq = 0;
|
|
247
|
+
|
|
248
|
+
function logLine(content: unknown) {
|
|
249
|
+
seq += 1;
|
|
250
|
+
return {
|
|
251
|
+
createdAt: `2026-11-03T10:00:${String(seq).padStart(2, "0")}.000Z`,
|
|
252
|
+
content: JSON.stringify(content),
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
const toolUse = (id: string, name: string, input: Record<string, unknown>) =>
|
|
256
|
+
logLine({
|
|
257
|
+
type: "assistant",
|
|
258
|
+
message: { content: [{ type: "tool_use", id, name, input }] },
|
|
259
|
+
});
|
|
260
|
+
const toolResult = (id: string) =>
|
|
261
|
+
logLine({
|
|
262
|
+
type: "user",
|
|
263
|
+
message: { content: [{ type: "tool_result", tool_use_id: id, content: "ok" }] },
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
async function preambleFor(logs: { createdAt: string; content: string }[]) {
|
|
267
|
+
seedTask({ id: TASK_ID, task: "Ship the fix", status: "failed" });
|
|
268
|
+
mockSessionLogs[TASK_ID] = logs;
|
|
269
|
+
const preamble = await buildResumeContextPreamble(API_URL, API_KEY, TASK_ID);
|
|
270
|
+
expect(preamble).toBeTruthy();
|
|
271
|
+
return preamble ?? "";
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
test("flags an unpaired last call before the task description", async () => {
|
|
275
|
+
const preamble = await preambleFor([
|
|
276
|
+
toolUse("toolu_1", "Bash", { command: "bun run check:local" }),
|
|
277
|
+
toolResult("toolu_1"),
|
|
278
|
+
toolUse("toolu_2", "Bash", { command: "git push origin fix/x" }),
|
|
279
|
+
]);
|
|
280
|
+
const line =
|
|
281
|
+
"Interrupted: Bash git push origin fix/x may have landed. Check its effect before calling it again.";
|
|
282
|
+
expect(preamble).toContain(line);
|
|
283
|
+
expect(preamble.indexOf(line)).toBeGreaterThan(
|
|
284
|
+
preamble.indexOf("## Resuming Interrupted Task"),
|
|
285
|
+
);
|
|
286
|
+
expect(preamble.indexOf(line)).toBeLessThan(preamble.indexOf("### Original Task Description"));
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
test("does not flag a call that got its result", async () => {
|
|
290
|
+
const preamble = await preambleFor([
|
|
291
|
+
toolUse("toolu_1", "Bash", { command: "git push origin fix/x" }),
|
|
292
|
+
toolResult("toolu_1"),
|
|
293
|
+
]);
|
|
294
|
+
expect(preamble).not.toContain("Interrupted:");
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
test("does not flag an unpaired read-only call", async () => {
|
|
298
|
+
const preamble = await preambleFor([
|
|
299
|
+
toolUse("toolu_1", "Bash", { command: "git push origin fix/x" }),
|
|
300
|
+
toolResult("toolu_1"),
|
|
301
|
+
toolUse("toolu_2", "Read", { file_path: "/workspace/src/a.ts" }),
|
|
302
|
+
]);
|
|
303
|
+
expect(preamble).not.toContain("Interrupted:");
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// One row shape per harness, copied from real session_logs rows (scrubbed;
|
|
307
|
+
// claude-managed from its adapter, which has no stored rows yet). Each case
|
|
308
|
+
// lists the unanswered call's rows and the row that answers it.
|
|
309
|
+
const raw = (content: unknown) => logLine(content);
|
|
310
|
+
const harnessCases: {
|
|
311
|
+
harness: string;
|
|
312
|
+
call: ReturnType<typeof logLine>[];
|
|
313
|
+
answer: ReturnType<typeof logLine>;
|
|
314
|
+
expected: string;
|
|
315
|
+
}[] = [
|
|
316
|
+
{
|
|
317
|
+
harness: "pi",
|
|
318
|
+
call: [
|
|
319
|
+
raw({
|
|
320
|
+
type: "assistant",
|
|
321
|
+
message: {
|
|
322
|
+
role: "assistant",
|
|
323
|
+
content: [
|
|
324
|
+
{
|
|
325
|
+
type: "tool_use",
|
|
326
|
+
id: "call_00_ET_abc",
|
|
327
|
+
name: "bash",
|
|
328
|
+
input: { command: "git push origin fix/x" },
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
},
|
|
332
|
+
}),
|
|
333
|
+
],
|
|
334
|
+
answer: raw({
|
|
335
|
+
type: "assistant",
|
|
336
|
+
message: {
|
|
337
|
+
role: "assistant",
|
|
338
|
+
content: [{ type: "tool_result", tool_use_id: "call_00_ET_abc", content: "ok" }],
|
|
339
|
+
},
|
|
340
|
+
}),
|
|
341
|
+
expected: "bash git push origin fix/x",
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
harness: "amp",
|
|
345
|
+
call: [
|
|
346
|
+
raw({
|
|
347
|
+
type: "assistant",
|
|
348
|
+
message: {
|
|
349
|
+
type: "message",
|
|
350
|
+
role: "assistant",
|
|
351
|
+
content: [
|
|
352
|
+
{
|
|
353
|
+
type: "tool_use",
|
|
354
|
+
id: "TU-034ap7w",
|
|
355
|
+
name: "shell_command",
|
|
356
|
+
input: { command: "gh pr comment 1 --body hi" },
|
|
357
|
+
},
|
|
358
|
+
],
|
|
359
|
+
},
|
|
360
|
+
}),
|
|
361
|
+
],
|
|
362
|
+
answer: raw({
|
|
363
|
+
type: "user",
|
|
364
|
+
message: {
|
|
365
|
+
role: "user",
|
|
366
|
+
content: [{ type: "tool_result", tool_use_id: "TU-034ap7w", content: "ok" }],
|
|
367
|
+
},
|
|
368
|
+
parent_tool_use_id: null,
|
|
369
|
+
}),
|
|
370
|
+
expected: "shell_command gh pr comment 1 --body hi",
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
harness: "codex",
|
|
374
|
+
call: [
|
|
375
|
+
raw({
|
|
376
|
+
type: "item.started",
|
|
377
|
+
item: {
|
|
378
|
+
id: "exec-9b08ea05",
|
|
379
|
+
type: "command_execution",
|
|
380
|
+
command: "/bin/bash -lc 'git push origin fix/x'",
|
|
381
|
+
aggregated_output: null,
|
|
382
|
+
exit_code: null,
|
|
383
|
+
status: "inProgress",
|
|
384
|
+
},
|
|
385
|
+
}),
|
|
386
|
+
],
|
|
387
|
+
answer: raw({
|
|
388
|
+
type: "item.completed",
|
|
389
|
+
item: {
|
|
390
|
+
id: "exec-9b08ea05",
|
|
391
|
+
type: "command_execution",
|
|
392
|
+
command: "/bin/bash -lc 'git push origin fix/x'",
|
|
393
|
+
aggregated_output: "ok",
|
|
394
|
+
exit_code: 0,
|
|
395
|
+
status: "completed",
|
|
396
|
+
},
|
|
397
|
+
}),
|
|
398
|
+
expected: "bash /bin/bash -lc 'git push origin fix/x'",
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
harness: "codex mcp",
|
|
402
|
+
call: [
|
|
403
|
+
raw({
|
|
404
|
+
type: "item.started",
|
|
405
|
+
item: {
|
|
406
|
+
id: "exec-26e02993",
|
|
407
|
+
type: "mcp_tool_call",
|
|
408
|
+
server: "agent-swarm",
|
|
409
|
+
tool: "send-task",
|
|
410
|
+
arguments: { task: "ship it" },
|
|
411
|
+
status: "inProgress",
|
|
412
|
+
result: null,
|
|
413
|
+
error: null,
|
|
414
|
+
},
|
|
415
|
+
}),
|
|
416
|
+
],
|
|
417
|
+
answer: raw({
|
|
418
|
+
type: "item.completed",
|
|
419
|
+
item: {
|
|
420
|
+
id: "exec-26e02993",
|
|
421
|
+
type: "mcp_tool_call",
|
|
422
|
+
server: "agent-swarm",
|
|
423
|
+
tool: "send-task",
|
|
424
|
+
arguments: { task: "ship it" },
|
|
425
|
+
status: "completed",
|
|
426
|
+
result: { content: [] },
|
|
427
|
+
error: null,
|
|
428
|
+
},
|
|
429
|
+
}),
|
|
430
|
+
expected: 'agent-swarm.send-task {"task":"ship it"}',
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
harness: "opencode",
|
|
434
|
+
call: [
|
|
435
|
+
raw({
|
|
436
|
+
type: "tool_start",
|
|
437
|
+
toolCallId: "call_1f8a83e2",
|
|
438
|
+
toolName: "shell",
|
|
439
|
+
args: { command: "git push origin fix/x" },
|
|
440
|
+
}),
|
|
441
|
+
],
|
|
442
|
+
answer: raw({
|
|
443
|
+
type: "tool_end",
|
|
444
|
+
toolCallId: "call_1f8a83e2",
|
|
445
|
+
toolName: "shell",
|
|
446
|
+
result: "ok",
|
|
447
|
+
}),
|
|
448
|
+
expected: "shell git push origin fix/x",
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
// grok and fx run through the same ACP adapter and store the same rows.
|
|
452
|
+
harness: "acp",
|
|
453
|
+
call: [
|
|
454
|
+
raw({
|
|
455
|
+
sessionId: "ses_f4fc",
|
|
456
|
+
update: {
|
|
457
|
+
toolCallId: "call_7d2aa750",
|
|
458
|
+
title: "bash",
|
|
459
|
+
kind: "execute",
|
|
460
|
+
status: "pending",
|
|
461
|
+
rawInput: { cwd: "/workspace" },
|
|
462
|
+
sessionUpdate: "tool_call",
|
|
463
|
+
},
|
|
464
|
+
}),
|
|
465
|
+
raw({
|
|
466
|
+
type: "tool_start",
|
|
467
|
+
toolCallId: "call_7d2aa750",
|
|
468
|
+
toolName: "bash",
|
|
469
|
+
args: { cwd: "/workspace" },
|
|
470
|
+
}),
|
|
471
|
+
raw({
|
|
472
|
+
sessionId: "ses_f4fc",
|
|
473
|
+
update: {
|
|
474
|
+
toolCallId: "call_7d2aa750",
|
|
475
|
+
kind: "execute",
|
|
476
|
+
status: "in_progress",
|
|
477
|
+
title: "git push origin fix/x",
|
|
478
|
+
rawInput: { command: "git push origin fix/x", cwd: "/workspace" },
|
|
479
|
+
sessionUpdate: "tool_call_update",
|
|
480
|
+
},
|
|
481
|
+
}),
|
|
482
|
+
],
|
|
483
|
+
answer: raw({
|
|
484
|
+
type: "tool_end",
|
|
485
|
+
toolCallId: "call_7d2aa750",
|
|
486
|
+
toolName: "git push origin fix/x",
|
|
487
|
+
result: { status: "completed", content: [] },
|
|
488
|
+
}),
|
|
489
|
+
expected: "bash git push origin fix/x",
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
harness: "claude-managed",
|
|
493
|
+
call: [
|
|
494
|
+
raw({
|
|
495
|
+
type: "agent.tool_use",
|
|
496
|
+
id: "sevt_tool_1",
|
|
497
|
+
name: "bash",
|
|
498
|
+
input: { command: "git push origin fix/x" },
|
|
499
|
+
}),
|
|
500
|
+
],
|
|
501
|
+
answer: raw({
|
|
502
|
+
type: "agent.tool_result",
|
|
503
|
+
id: "sevt_res_1",
|
|
504
|
+
tool_use_id: "sevt_tool_1",
|
|
505
|
+
content: [],
|
|
506
|
+
is_error: false,
|
|
507
|
+
}),
|
|
508
|
+
expected: "bash git push origin fix/x",
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
harness: "claude-managed mcp",
|
|
512
|
+
call: [
|
|
513
|
+
raw({
|
|
514
|
+
type: "agent.mcp_tool_use",
|
|
515
|
+
id: "sevt_mcp_1",
|
|
516
|
+
mcp_server_name: "agent-swarm",
|
|
517
|
+
name: "send-task",
|
|
518
|
+
input: { task: "ship it" },
|
|
519
|
+
}),
|
|
520
|
+
],
|
|
521
|
+
answer: raw({
|
|
522
|
+
type: "agent.mcp_tool_result",
|
|
523
|
+
id: "sevt_res_2",
|
|
524
|
+
mcp_tool_use_id: "sevt_mcp_1",
|
|
525
|
+
content: [],
|
|
526
|
+
is_error: false,
|
|
527
|
+
}),
|
|
528
|
+
expected: 'agent-swarm.send-task {"task":"ship it"}',
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
harness: "cursor",
|
|
532
|
+
call: [
|
|
533
|
+
raw({
|
|
534
|
+
type: "tool_call",
|
|
535
|
+
agent_id: "agent-883d",
|
|
536
|
+
run_id: "run-d9ad",
|
|
537
|
+
call_id: "toolu_0199Lz",
|
|
538
|
+
name: "mcp",
|
|
539
|
+
status: "running",
|
|
540
|
+
args: {
|
|
541
|
+
providerIdentifier: "agent-swarm",
|
|
542
|
+
toolName: "send-task",
|
|
543
|
+
args: { task: "ship it" },
|
|
544
|
+
},
|
|
545
|
+
}),
|
|
546
|
+
],
|
|
547
|
+
answer: raw({
|
|
548
|
+
type: "tool_call",
|
|
549
|
+
agent_id: "agent-883d",
|
|
550
|
+
run_id: "run-d9ad",
|
|
551
|
+
call_id: "toolu_0199Lz",
|
|
552
|
+
name: "mcp",
|
|
553
|
+
status: "completed",
|
|
554
|
+
result: { status: "success", value: { content: [] } },
|
|
555
|
+
}),
|
|
556
|
+
expected: 'mcp__agent-swarm__send-task {"task":"ship it"}',
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
harness: "dsh",
|
|
560
|
+
call: [
|
|
561
|
+
raw({
|
|
562
|
+
type: "tool_call",
|
|
563
|
+
callId: "call_cbebc13a",
|
|
564
|
+
tool: "bash",
|
|
565
|
+
input: { command: "git push origin fix/x" },
|
|
566
|
+
}),
|
|
567
|
+
],
|
|
568
|
+
answer: raw({
|
|
569
|
+
type: "tool_result",
|
|
570
|
+
callId: "call_cbebc13a",
|
|
571
|
+
status: "completed",
|
|
572
|
+
result: "ok",
|
|
573
|
+
}),
|
|
574
|
+
expected: "bash git push origin fix/x",
|
|
575
|
+
},
|
|
576
|
+
];
|
|
577
|
+
|
|
578
|
+
for (const c of harnessCases) {
|
|
579
|
+
test(`${c.harness}: flags an unanswered call`, async () => {
|
|
580
|
+
const preamble = await preambleFor(c.call);
|
|
581
|
+
expect(preamble).toContain(
|
|
582
|
+
`Interrupted: ${c.expected} may have landed. Check its effect before calling it again.`,
|
|
583
|
+
);
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
test(`${c.harness}: does not flag an answered call`, async () => {
|
|
587
|
+
const preamble = await preambleFor([...c.call, c.answer]);
|
|
588
|
+
expect(preamble).not.toContain("Interrupted:");
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
test("does not flag an unanswered lowercase read-only call (pi, opencode, acp)", async () => {
|
|
593
|
+
const preamble = await preambleFor([
|
|
594
|
+
toolUse("call_01_ET_read", "read", { path: "/workspace/a.ts" }),
|
|
595
|
+
]);
|
|
596
|
+
expect(preamble).not.toContain("Interrupted:");
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
// Parallel batches: a later call can answer before an earlier one.
|
|
600
|
+
const codexStart = (id: string, item: Record<string, unknown>) =>
|
|
601
|
+
raw({ type: "item.started", item: { id, status: "inProgress", ...item } });
|
|
602
|
+
const codexDone = (id: string, item: Record<string, unknown>) =>
|
|
603
|
+
raw({ type: "item.completed", item: { id, status: "completed", ...item } });
|
|
604
|
+
const parallelCases: {
|
|
605
|
+
name: string;
|
|
606
|
+
logs: () => ReturnType<typeof logLine>[];
|
|
607
|
+
expected: string | null;
|
|
608
|
+
}[] = [
|
|
609
|
+
{
|
|
610
|
+
name: "codex: start push, start search, complete search flags the push",
|
|
611
|
+
logs: () => [
|
|
612
|
+
codexStart("push", { type: "command_execution", command: "git push origin fix/x" }),
|
|
613
|
+
codexStart("search", { type: "web_search", query: "bun test" }),
|
|
614
|
+
codexDone("search", { type: "web_search", query: "bun test" }),
|
|
615
|
+
],
|
|
616
|
+
expected: "bash git push origin fix/x",
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
name: "codex: start push, start mcp comment, complete comment flags the push",
|
|
620
|
+
logs: () => [
|
|
621
|
+
codexStart("push", { type: "command_execution", command: "git push origin fix/x" }),
|
|
622
|
+
codexStart("comment", {
|
|
623
|
+
type: "mcp_tool_call",
|
|
624
|
+
server: "agent-swarm",
|
|
625
|
+
tool: "slack-reply",
|
|
626
|
+
arguments: { text: "hi" },
|
|
627
|
+
}),
|
|
628
|
+
codexDone("comment", { type: "mcp_tool_call", server: "agent-swarm", tool: "slack-reply" }),
|
|
629
|
+
],
|
|
630
|
+
expected: "bash git push origin fix/x",
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
name: "codex: two open side-effecting calls are both flagged in start order",
|
|
634
|
+
logs: () => [
|
|
635
|
+
codexStart("push", { type: "command_execution", command: "git push origin fix/x" }),
|
|
636
|
+
codexStart("comment", { type: "command_execution", command: "gh pr comment 1 --body hi" }),
|
|
637
|
+
],
|
|
638
|
+
expected: "bash git push origin fix/x; bash gh pr comment 1 --body hi",
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
name: "codex: a parallel batch answered out of order is not flagged",
|
|
642
|
+
logs: () => [
|
|
643
|
+
codexStart("push", { type: "command_execution", command: "git push origin fix/x" }),
|
|
644
|
+
codexStart("search", { type: "web_search", query: "bun test" }),
|
|
645
|
+
codexDone("search", { type: "web_search" }),
|
|
646
|
+
codexDone("push", { type: "command_execution" }),
|
|
647
|
+
],
|
|
648
|
+
expected: null,
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
name: "claude: one message with two calls, only the second answered, flags the first",
|
|
652
|
+
logs: () => [
|
|
653
|
+
logLine({
|
|
654
|
+
type: "assistant",
|
|
655
|
+
message: {
|
|
656
|
+
content: [
|
|
657
|
+
{ type: "tool_use", id: "toolu_a", name: "Bash", input: { command: "git push" } },
|
|
658
|
+
{ type: "tool_use", id: "toolu_b", name: "Grep", input: { pattern: "x" } },
|
|
659
|
+
],
|
|
660
|
+
},
|
|
661
|
+
}),
|
|
662
|
+
toolResult("toolu_b"),
|
|
663
|
+
],
|
|
664
|
+
expected: "Bash git push",
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
name: "opencode: start push, start read, end read flags the push",
|
|
668
|
+
logs: () => [
|
|
669
|
+
raw({
|
|
670
|
+
type: "tool_start",
|
|
671
|
+
toolCallId: "c1",
|
|
672
|
+
toolName: "shell",
|
|
673
|
+
args: { command: "git push" },
|
|
674
|
+
}),
|
|
675
|
+
raw({ type: "tool_start", toolCallId: "c2", toolName: "read", args: { path: "/a.ts" } }),
|
|
676
|
+
raw({ type: "tool_end", toolCallId: "c2", toolName: "read", result: "ok" }),
|
|
677
|
+
],
|
|
678
|
+
expected: "shell git push",
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
name: "claude-managed: use push, use mcp, mcp result flags the push",
|
|
682
|
+
logs: () => [
|
|
683
|
+
raw({ type: "agent.tool_use", id: "t1", name: "bash", input: { command: "git push" } }),
|
|
684
|
+
raw({
|
|
685
|
+
type: "agent.mcp_tool_use",
|
|
686
|
+
id: "t2",
|
|
687
|
+
mcp_server_name: "agent-swarm",
|
|
688
|
+
name: "send-task",
|
|
689
|
+
input: { task: "x" },
|
|
690
|
+
}),
|
|
691
|
+
raw({ type: "agent.mcp_tool_result", id: "r2", mcp_tool_use_id: "t2", content: [] }),
|
|
692
|
+
],
|
|
693
|
+
expected: "bash git push",
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
name: "dsh: call push, call read, read result flags the push",
|
|
697
|
+
logs: () => [
|
|
698
|
+
raw({ type: "tool_call", callId: "d1", tool: "bash", input: { command: "git push" } }),
|
|
699
|
+
raw({ type: "tool_call", callId: "d2", tool: "read", input: { path: "/a.ts" } }),
|
|
700
|
+
raw({ type: "tool_result", callId: "d2", status: "completed", result: "ok" }),
|
|
701
|
+
],
|
|
702
|
+
expected: "bash git push",
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
name: "cursor: repeated running rows on one call_id flag it once",
|
|
706
|
+
logs: () => [
|
|
707
|
+
raw({
|
|
708
|
+
type: "tool_call",
|
|
709
|
+
call_id: "k1",
|
|
710
|
+
name: "shell",
|
|
711
|
+
status: "running",
|
|
712
|
+
args: { command: "git push" },
|
|
713
|
+
}),
|
|
714
|
+
raw({
|
|
715
|
+
type: "tool_call",
|
|
716
|
+
call_id: "k1",
|
|
717
|
+
name: "shell",
|
|
718
|
+
status: "running",
|
|
719
|
+
args: { command: "git push" },
|
|
720
|
+
}),
|
|
721
|
+
raw({
|
|
722
|
+
type: "tool_call",
|
|
723
|
+
call_id: "k2",
|
|
724
|
+
name: "read",
|
|
725
|
+
status: "running",
|
|
726
|
+
args: { path: "/a" },
|
|
727
|
+
}),
|
|
728
|
+
raw({ type: "tool_call", call_id: "k2", name: "read", status: "completed" }),
|
|
729
|
+
],
|
|
730
|
+
expected: "shell git push",
|
|
731
|
+
},
|
|
732
|
+
];
|
|
733
|
+
|
|
734
|
+
for (const c of parallelCases) {
|
|
735
|
+
test(c.name, async () => {
|
|
736
|
+
const preamble = await preambleFor(c.logs());
|
|
737
|
+
if (c.expected === null) expect(preamble).not.toContain("Interrupted:");
|
|
738
|
+
else
|
|
739
|
+
expect(preamble).toContain(
|
|
740
|
+
`Interrupted: ${c.expected} may have landed. Check its effect before calling it again.`,
|
|
741
|
+
);
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
test("caps the flagged calls at the newest three", async () => {
|
|
746
|
+
const preamble = await preambleFor(
|
|
747
|
+
[1, 2, 3, 4].map((n) =>
|
|
748
|
+
codexStart(`c${n}`, { type: "command_execution", command: `gh pr comment ${n}` }),
|
|
749
|
+
),
|
|
750
|
+
);
|
|
751
|
+
expect(preamble).toContain(
|
|
752
|
+
"Interrupted: bash gh pr comment 2; bash gh pr comment 3; bash gh pr comment 4 may have landed.",
|
|
753
|
+
);
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
test("does not flag an open call from an earlier resume attempt", async () => {
|
|
757
|
+
seedTask({ id: "attempt-1", task: "Ship the fix", status: "failed" });
|
|
758
|
+
seedTask({
|
|
759
|
+
id: "attempt-2",
|
|
760
|
+
task: "Resume interrupted task",
|
|
761
|
+
status: "failed",
|
|
762
|
+
taskType: "resume",
|
|
763
|
+
parentTaskId: "attempt-1",
|
|
764
|
+
});
|
|
765
|
+
mockSessionLogs["attempt-1"] = [toolUse("toolu_old", "Bash", { command: "git push origin x" })];
|
|
766
|
+
mockSessionLogs["attempt-2"] = [
|
|
767
|
+
toolUse("toolu_new", "Bash", { command: "git status" }),
|
|
768
|
+
toolResult("toolu_new"),
|
|
769
|
+
];
|
|
770
|
+
const preamble = (await buildResumeContextPreamble(API_URL, API_KEY, "attempt-2")) ?? "";
|
|
771
|
+
expect(preamble).toContain("## Resuming Interrupted Task");
|
|
772
|
+
expect(preamble).not.toContain("Interrupted:");
|
|
773
|
+
});
|
|
774
|
+
|
|
775
|
+
test("redacts a token in the interrupted call's args", async () => {
|
|
776
|
+
const fakeToken = `ghp_${"a".repeat(36)}`;
|
|
777
|
+
const preamble = await preambleFor([
|
|
778
|
+
toolUse("toolu_1", "Bash", {
|
|
779
|
+
command: `curl -H 'Authorization: token ${fakeToken}' https://api.github.com/x`,
|
|
780
|
+
}),
|
|
781
|
+
]);
|
|
782
|
+
expect(preamble).toContain("Interrupted: Bash curl");
|
|
783
|
+
expect(preamble).not.toContain(fakeToken);
|
|
784
|
+
});
|
|
785
|
+
});
|