@desplega.ai/agent-swarm 2.13.4 → 2.13.5
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-tbt61zkm.js +17 -0
- package/dist/{acp-targets-zrk9k0n7.js → acp-targets-w8dbs4nr.js} +7 -7
- package/dist/{actions-acqqj9jn.js → actions-8zrcbjrx.js} +26 -26
- package/dist/{agent-fs-provision-zmaykqnd.js → agent-fs-provision-cbt2ttds.js} +4 -4
- package/dist/{amp-adapter-a7ts8tmw.js → amp-adapter-8x6zp8w4.js} +2 -2
- package/dist/{anthropic-messages-88b7s3n9.js → anthropic-messages-vdd1zmha.js} +10 -10
- package/dist/{app-tmwa442h.js → app-zfa9dwjw.js} +6 -6
- package/dist/{approval-notifications-6psaaaye.js → approval-notifications-rv92zmza.js} +7 -7
- package/dist/{assistant-564v6emv.js → assistant-q7s7rm1q.js} +24 -24
- package/dist/{boot-args-schema-n099e0f2.js → boot-args-schema-g27kpzr1.js} +1 -1
- package/dist/{boot-reembed-epvg4fp9.js → boot-reembed-1mjs52nt.js} +1 -1
- package/dist/{boot-reembed-chx66qfk.js → boot-reembed-m62dpdkg.js} +1 -1
- package/dist/{boot-scrub-sweep-dhkfp0a7.js → boot-scrub-sweep-ss1vcamw.js} +2 -2
- package/dist/{boot-seeds-m74fc07r.js → boot-seeds-hwnvgbb3.js} +4 -4
- package/dist/{boxd-451q55ys.js → boxd-y0szhp0g.js} +1 -1
- package/dist/{claude-adapter-hw63yj3j.js → claude-adapter-0rjmbhjk.js} +7 -7
- package/dist/{claude-managed-adapter-z5s7fx6p.js → claude-managed-adapter-6k032agg.js} +3 -3
- package/dist/{claude-managed-setup-wee1762m.js → claude-managed-setup-6czvve8q.js} +4 -4
- package/dist/{claude-sdk-session-cktyqkpk.js → claude-sdk-session-pr0znb81.js} +12667 -11881
- package/dist/{cli-0fgvnb0x.js → cli-0qt3epg4.js} +3 -3
- package/dist/{cli-ka48vpev.js → cli-19d6v8er.js} +3 -3
- package/dist/{cli-zexwhj3f.js → cli-1jq2em7b.js} +3 -3
- package/dist/{cli-5rgm8p39.js → cli-2wzkvfgm.js} +2 -2
- package/dist/{cli-x2cem5vy.js → cli-34fygf87.js} +2 -2
- package/dist/{cli-tsc3pdfd.js → cli-3860pmrq.js} +3 -3
- package/dist/{cli-hhtbandk.js → cli-3vw6dd4g.js} +2 -2
- package/dist/{cli-qzz6tz8s.js → cli-4gaf3tx5.js} +1 -1
- package/dist/{cli-9ah37a8a.js → cli-55h8m1x3.js} +8 -5
- package/dist/{cli-7gbff32z.js → cli-5n9w2xzx.js} +1 -1
- package/dist/{cli-p436yrzp.js → cli-5tq15aa7.js} +1 -1
- package/dist/{cli-jyhbvdga.js → cli-5web09sb.js} +2 -2
- package/dist/{cli-3zrwrnz7.js → cli-69zzpjgh.js} +1 -1
- package/dist/{cli-7g3fg4gf.js → cli-6msnpj1z.js} +6 -6
- package/dist/{cli-azj9t1f9.js → cli-7r9tvk8v.js} +41 -3
- package/dist/{cli-4fpa0zns.js → cli-7ypg8hka.js} +3 -3
- package/dist/{cli-8cas2xvp.js → cli-887vhew6.js} +2 -2
- package/dist/{cli-t0jmkcah.js → cli-8pd1t17c.js} +7 -7
- package/dist/{cli-h9d3sdnc.js → cli-94mxerrp.js} +1 -1
- package/dist/{cli-bv4vvnmg.js → cli-9n6g14vs.js} +2 -2
- package/dist/{cli-5ashycw3.js → cli-abby987g.js} +2 -2
- package/dist/{cli-kj84fqxz.js → cli-avax5mp9.js} +1 -1
- package/dist/{cli-ea7nz50q.js → cli-b42yfn17.js} +11 -11
- package/dist/{cli-ysv0k1we.js → cli-b9ygp1kz.js} +1 -1
- package/dist/{cli-3bxrrh53.js → cli-bvamr9g0.js} +2 -2
- package/dist/{cli-gse7bp3z.js → cli-ced4azn1.js} +10 -9
- package/dist/{cli-7by7vp6m.js → cli-cmbb2t8a.js} +2 -2
- package/dist/{cli-0p76my9q.js → cli-cp163xga.js} +10 -10
- package/dist/{cli-jzerrzgc.js → cli-ebpq3c5z.js} +8 -8
- package/dist/{cli-p3knvk62.js → cli-ehg90jd1.js} +113 -39
- package/dist/{cli-jg5txpm6.js → cli-emdfd8fh.js} +75 -1
- package/dist/{cli-d5pc8ep0.js → cli-evy3egte.js} +7 -7
- package/dist/{cli-60dwk8tx.js → cli-ewk3sg68.js} +2 -2
- package/dist/{cli-nc4pbwmp.js → cli-f7b9nyvk.js} +4 -4
- package/dist/{cli-29h5239w.js → cli-f9xw9pr4.js} +4 -4
- package/dist/{cli-3tzmh38q.js → cli-ffn0a515.js} +7 -7
- package/dist/{cli-dqgnbnxs.js → cli-grbngev5.js} +6 -1
- package/dist/{cli-cq4am6vg.js → cli-hd5bm1e1.js} +4 -4
- package/dist/{cli-akm6y2a8.js → cli-htb5bpz2.js} +1 -1
- package/dist/{cli-tr19nyn9.js → cli-j69pzrrz.js} +6 -6
- package/dist/{cli-hdhpdrka.js → cli-jdq3jmny.js} +3 -3
- package/dist/{cli-ja450998.js → cli-ks06cd0n.js} +1 -1
- package/dist/{cli-pz1dp12c.js → cli-kwj3131p.js} +1 -1
- package/dist/{cli-1vmhnncj.js → cli-m8f4379k.js} +3 -3
- package/dist/{cli-jbrc98qb.js → cli-n79j1vxc.js} +2 -2
- package/dist/{cli-b768ek79.js → cli-nrt048ys.js} +1 -0
- package/dist/{cli-93n305hm.js → cli-pedm2kht.js} +1 -1
- package/dist/{cli-eds5xnsz.js → cli-phmy14hb.js} +2 -2
- package/dist/{cli-n1kjs58m.js → cli-prz1p3ft.js} +3 -3
- package/dist/{cli-pz1nq5xm.js → cli-q1h041y8.js} +3 -3
- package/dist/{cli-cah298e5.js → cli-q41qar56.js} +104 -119
- package/dist/{cli-4pbwg7sn.js → cli-qmx8bnt4.js} +1 -1
- package/dist/{cli-944w9wb4.js → cli-qrvk9nka.js} +18 -13
- package/dist/{cli-gtj12v95.js → cli-r3dxpmyt.js} +1 -1
- package/dist/{cli-phdzn699.js → cli-ryem5cfq.js} +7 -7
- package/dist/{cli-49aq3cyn.js → cli-s8dhq7rj.js} +4 -4
- package/dist/{cli-fkpnx3vf.js → cli-sejvnjvw.js} +3 -2
- package/dist/{cli-m1sns1da.js → cli-srre41gb.js} +2 -2
- package/dist/{cli-5rxsb3wq.js → cli-t0n9svkb.js} +3 -3
- package/dist/{cli-tzw1jr2t.js → cli-t879ww0y.js} +2 -2
- package/dist/{cli-xwsm6xkr.js → cli-tgc1kgg3.js} +1 -1
- package/dist/{cli-404am6f3.js → cli-tt7dkwjj.js} +6 -6
- package/dist/{cli-zjdhrzm0.js → cli-tvyt8w6n.js} +2 -2
- package/dist/{cli-hyqksecw.js → cli-v09eza21.js} +9 -9
- package/dist/{cli-rv3y60bt.js → cli-vbge4rsp.js} +4 -4
- package/dist/{cli-bzcwwebm.js → cli-vcpyttcw.js} +1 -1
- package/dist/{cli-904wk98s.js → cli-wzecestt.js} +338 -98
- package/dist/{cli-gkv0r2hq.js → cli-x2adbg4j.js} +70 -8
- package/dist/{cli-4q2c8rxw.js → cli-z3x7h79n.js} +12 -6
- package/dist/{cli-s33bzmk0.js → cli-z40t85ms.js} +1 -1
- package/dist/{cli-rmgvwcmy.js → cli-zbbtp02a.js} +98 -21
- package/dist/{cli-3xqad83h.js → cli-zntvmqmm.js} +1 -1
- package/dist/{cli-zhwjdhjr.js → cli-zxa1vmx7.js} +1 -1
- package/dist/{cli-50wa8k4h.js → cli-zy9bb22b.js} +1 -2
- package/dist/{cli-ts5yv7dn.js → cli-zzq96q57.js} +123 -33
- package/dist/cli.js +18 -18
- package/dist/{codex-adapter-2fs2c0n6.js → codex-adapter-bn7eaxk5.js} +6 -6
- package/dist/{codex-hook-jxjv6dy5.js → codex-hook-nnmezjg9.js} +2 -2
- package/dist/{codex-session-runner-r55tmx4c.js → codex-session-runner-j1e9hffc.js} +6 -6
- package/dist/{commands-0mxdy9x8.js → commands-amhpafrr.js} +3 -3
- package/dist/{controller-g3vkfhr4.js → controller-tw7g10j2.js} +3 -3
- package/dist/{controllers-connect-4wdmncqt.js → controllers-connect-2ssqz7f4.js} +23 -23
- package/dist/{core-gsvj5f3z.js → core-bwp98v4w.js} +21 -21
- package/dist/{cursor-adapter-t9qb96q2.js → cursor-adapter-d6knjmwa.js} +1 -1
- package/dist/{db-487vvyv9.js → db-fd6xxm77.js} +3 -3
- package/dist/{db-76p7w3gr.js → db-sc59379z.js} +2 -2
- package/dist/{dispatcher-64rp6w67.js → dispatcher-a2gdqz8c.js} +21 -21
- package/dist/{dsh-adapter-8abzqk5c.js → dsh-adapter-43ygwqn7.js} +1 -1
- package/dist/{e2b-dc8f6ctq.js → e2b-cn7cvjqy.js} +1 -1
- package/dist/{e2b-3ykbe805.js → e2b-qnxyfea6.js} +1 -1
- package/dist/{easter-egg-3d-jrrwyf55.js → easter-egg-3d-a0pphy71.js} +1 -1
- package/dist/{embedding-space-001hhhpk.js → embedding-space-qepzrach.js} +6 -6
- package/dist/{embeddings-esj19cnw.js → embeddings-d7vr881x.js} +1 -1
- package/dist/{execute-301hkxqg.js → execute-6afts2bn.js} +1 -1
- package/dist/{external-channel-w10e2j05.js → external-channel-881zq1x4.js} +2 -2
- package/dist/fx-adapter-cr2hq17y.js +20 -0
- package/dist/{grok-adapter-3a0ezfee.js → grok-adapter-ayddnbsc.js} +9 -9
- package/dist/handlers-7ghs84x2.js +41 -0
- package/dist/{heartbeat-tbrj7vhq.js → heartbeat-4c022m6a.js} +24 -24
- package/dist/{hook-3am1sq68.js → hook-4k84x499.js} +5 -5
- package/dist/{hook-tx917rqw.js → hook-a7eh6zty.js} +7 -7
- package/dist/{http-3rmemtqy.js → http-6aw5wanc.js} +180 -94
- package/dist/index-dtt0d634.js +44 -0
- package/dist/index-hmszyqkk.js +42 -0
- package/dist/index-j6rm1rtn.js +39 -0
- package/dist/{index-aetfyx6p.js → index-rwwhsmjg.js} +1 -1
- package/dist/{index-s7xtvc0f.js → index-xhad0n8m.js} +1 -1
- package/dist/{index-2jw11t8s.js → index-yq9hhhhy.js} +25 -25
- package/dist/{index-gfnq66t1.js → index-z2g9469g.js} +202 -17
- package/dist/{keepalive-9px3t7qj.js → keepalive-zhbmztqw.js} +4 -4
- package/dist/lead-g2j4q39z.js +83 -0
- package/dist/{maintenance-vwqjwst6.js → maintenance-rsp0591h.js} +1 -1
- package/dist/{node-2wfcey7d.js → node-0as4n1ef.js} +3 -3
- package/dist/{node-zd6shky9.js → node-dhxbt01p.js} +3 -3
- package/dist/{node-z67yjre7.js → node-rxte5hc6.js} +290 -70
- package/dist/{node-hjn5n1yp.js → node-t0ct2zpw.js} +3 -5
- package/dist/{oauth-refresh-sweep-yqry3wn4.js → oauth-refresh-sweep-w3cqmxq7.js} +3 -3
- package/dist/{object-webhooks-8s1wtths.js → object-webhooks-331hay92.js} +7 -7
- package/dist/{onboard-hb8czx0p.js → onboard-n2w80m2n.js} +3 -3
- package/dist/{opencode-adapter-djd6m6dk.js → opencode-adapter-z98127cz.js} +6 -6
- package/dist/{otel-impl-2ymwyczz.js → otel-impl-xsk35tvf.js} +1 -1
- package/dist/{pending-nxavtvx7.js → pending-2e6trkxd.js} +22 -22
- package/dist/{pi-mono-adapter-d2cpmcy4.js → pi-mono-adapter-wh6yndtm.js} +8 -8
- package/dist/{pricing-refresh-1yz8jkqv.js → pricing-refresh-9355dj1t.js} +2 -2
- package/dist/{rbac-roles-dbpx0x9v.js → rbac-roles-58y3m912.js} +3 -3
- package/dist/{rbac-roles-7s6m31xw.js → rbac-roles-8eajw4s6.js} +2 -2
- package/dist/{render-v2-7y20rjrn.js → render-v2-7gskkmd4.js} +6 -6
- package/dist/{resume-wz546x47.js → resume-0drnmpja.js} +9 -9
- package/dist/{runtime-cb5bd9tz.js → runtime-d2tcmqte.js} +1 -1
- package/dist/{session-access-4vcft8kq.js → session-access-0ztys6bd.js} +5 -5
- package/dist/{session-source-backfill-57b50tpw.js → session-source-backfill-cdm5s046.js} +2 -2
- package/dist/{setup-e1tevjyj.js → setup-pqwb9tcc.js} +1 -1
- package/dist/thread-buffer-epx3san4.js +42 -0
- package/dist/{tree-visibility-07wf1nct.js → tree-visibility-rwz67mje.js} +2 -2
- package/dist/{user-merge-jobs-n20qpv6s.js → user-merge-jobs-mxrhamwt.js} +3 -3
- package/dist/{virtual-modules-6fxmn1yv.js → virtual-modules-71y1gsmg.js} +3 -3
- package/dist/{work-objects-eg7y48pe.js → work-objects-3k4ykt9j.js} +24 -24
- package/dist/worker-09gqn9xy.js +83 -0
- package/dist/{worker-follow-up-jnvnnf2b.js → worker-follow-up-y0h64xpr.js} +21 -21
- package/openapi.json +387 -6
- package/package.json +4 -4
- package/src/apps/sync.ts +20 -5
- package/src/azure-devops/boards-sync.ts +1 -1
- package/src/be/db/slack-trees.ts +12 -1
- package/src/be/db/tasks/read.ts +25 -1
- package/src/be/db/tasks/write.ts +47 -12
- package/src/be/db/users/avatar.ts +12 -0
- package/src/be/db.ts +78 -5
- package/src/be/migrations/344_user_avatar.sql +4 -0
- package/src/be/migrations/345_task_status_kind.sql +6 -0
- package/src/be/primitives/object-embed.ts +2 -2
- package/src/be/primitives/objects.ts +2 -2
- package/src/be/runtime-pools/supervisor.ts +1 -0
- package/src/be/scripts/typecheck.ts +1 -1
- package/src/be/swarm-config-guard.ts +4 -0
- package/src/bitbucket/handlers.ts +1 -1
- package/src/commands/credential-outcome-report.ts +96 -0
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/runner.ts +49 -3
- package/src/event-waits/github.ts +39 -6
- package/src/event-waits/index.ts +4 -2
- package/src/event-waits/types.ts +10 -3
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/github/app.ts +177 -13
- package/src/github/handlers.ts +7 -2
- package/src/github/pull-request-state.ts +100 -11
- package/src/gitlab/handlers.ts +2 -2
- package/src/heartbeat/heartbeat.ts +6 -1
- package/src/http/api-keys.ts +26 -0
- package/src/http/asset-key-write.ts +45 -0
- package/src/http/assets.ts +4 -3
- package/src/http/github-token.ts +27 -6
- package/src/http/pages.ts +4 -10
- package/src/http/schedules.ts +6 -6
- package/src/http/sessions.ts +7 -2
- package/src/http/tasks.ts +23 -5
- package/src/http/users.ts +5 -0
- package/src/http/webhooks.ts +19 -1
- package/src/http/workflows.ts +5 -10
- package/src/integrations/chat-sdk/commands.ts +3 -1
- package/src/jira/sync.ts +1 -1
- package/src/linear/sync.ts +5 -3
- package/src/prompts/session-templates.ts +1 -0
- package/src/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-adapter.ts +5 -0
- package/src/providers/claude-sdk-session.ts +5 -0
- package/src/providers/runtime-dependencies.ts +1 -1
- package/src/scheduler/deferred-task-waits.ts +74 -13
- package/src/scripts-runtime/swarm-sdk.ts +8 -1
- package/src/scripts-runtime/types/stdlib.d.ts +8 -1
- package/src/scripts-runtime/types/swarm-extension.d.ts +19 -2
- package/src/scripts-runtime/types/swarm-sdk.d.ts +8 -1
- package/src/slack/actions.ts +1 -1
- package/src/slack/render-v2.ts +148 -7
- package/src/tests/api-drain-worker-e2e.test.ts +0 -2
- package/src/tests/approval-auto-cancellation-migration.test.ts +8 -19
- package/src/tests/approval-card-resolution.test.ts +2 -17
- package/src/tests/approval-requests-notifications.test.ts +41 -27
- package/src/tests/approval-requests.test.ts +137 -369
- package/src/tests/apps-sync-engine.test.ts +5 -3
- package/src/tests/apps-table-filters-migration.test.ts +44 -25
- package/src/tests/bitbucket-handlers.test.ts +2 -0
- package/src/tests/chat-sdk-commands.test.ts +1 -0
- package/src/tests/claude-adapter.test.ts +35 -0
- package/src/tests/codex-adapter.test.ts +3 -92
- package/src/tests/codex-gpt6-release.test.ts +0 -9
- package/src/tests/codex-oauth-credential-info.test.ts +35 -18
- package/src/tests/codex-oauth.test.ts +0 -6
- package/src/tests/codex-pool.test.ts +5 -214
- package/src/tests/codex-rate-limit-parse.test.ts +0 -7
- package/src/tests/codex-swarm-events.test.ts +11 -54
- package/src/tests/db-client-busy-retry.test.ts +49 -16
- package/src/tests/defer-task.test.ts +1 -0
- package/src/tests/e2e-shards.test.ts +9 -9
- package/src/tests/enabled-tools.test.ts +0 -2
- package/src/tests/fixtures/base-prompt-baseline.json +6 -6
- package/src/tests/github-app-worker-auth-helper.test.ts +147 -1
- package/src/tests/gitlab-handlers.test.ts +2 -0
- package/src/tests/heartbeat-jev-gate.test.ts +9 -241
- package/src/tests/heartbeat-reroute-decision.test.ts +2 -0
- package/src/tests/heartbeat-supersede-resume.test.ts +2 -0
- package/src/tests/heartbeat.test.ts +1 -0
- package/src/tests/key-usage-selection.test.ts +302 -0
- package/src/tests/memory-e2e.test.ts +34 -103
- package/src/tests/memory-key-paths.test.ts +5 -0
- package/src/tests/memory-rater-llm.test.ts +33 -149
- package/src/tests/memory-store.test.ts +24 -125
- package/src/tests/memory.test.ts +31 -100
- package/src/tests/merge-gate-detect-changes.test.ts +108 -2
- package/src/tests/otel-service-name.test.ts +0 -9
- package/src/tests/otel-session-cost-metrics.test.ts +1 -38
- package/src/tests/pool-session-logs.test.ts +8 -42
- package/src/tests/pre-push-affected-tests.test.ts +106 -0
- package/src/tests/prompt-template-session.test.ts +3 -0
- package/src/tests/runner-api-drain.test.ts +2 -17
- package/src/tests/runner-terminal-window-report.test.ts +132 -0
- package/src/tests/runtime-supervisor-failures.test.ts +1 -0
- package/src/tests/sandboxed-process.test.ts +26 -21
- package/src/tests/schedule-http-triage-tools.test.ts +12 -9
- package/src/tests/scheduled-tasks.test.ts +14 -51
- package/src/tests/script-executor-conformance.test.ts +4 -48
- package/src/tests/script-executor-quickjs-pool.test.ts +9 -7
- package/src/tests/script-native-startup.test.ts +21 -25
- package/src/tests/secret-rules.test.ts +4 -2
- package/src/tests/session-logs.test.ts +1 -260
- package/src/tests/slack-render-v2.test.ts +5 -148
- package/src/tests/task-cascade-fail.test.ts +1 -0
- package/src/tests/task-supersede-resume.test.ts +1 -0
- package/src/tests/test-proc.ts +5 -2
- package/src/tests/window-stream-reporter.test.ts +122 -0
- package/src/tests/workflow-agent-task-retry.test.ts +1 -3
- package/src/tests/workflow-cascade-cancel.test.ts +1 -0
- package/src/tests/workflow-retry-v2.test.ts +34 -43
- package/src/tests/workflow-retry-validation.test.ts +8 -48
- package/src/tests/worktree-reaper.test.ts +2 -2
- package/src/tools/cancel-task.ts +2 -2
- package/src/tools/defer-task.ts +7 -2
- package/src/tools/get-task-details.ts +8 -4
- package/src/tools/get-tasks.ts +13 -2
- package/src/tools/manage-user.ts +9 -0
- package/src/tools/store-progress.ts +5 -3
- package/src/types.ts +93 -0
- package/src/utils/constants.ts +12 -0
- package/src/utils/credentials.ts +42 -5
- package/src/utils/error-tracker.ts +6 -0
- package/src/utils/key-usage.ts +114 -0
- package/src/utils/sandboxed-process.ts +1 -0
- package/src/workflows/resume.ts +5 -2
- package/templates/skills/apps/SKILL.md +2 -0
- package/templates/skills/apps/content.md +2 -0
- package/templates/skills/boards-and-sheets/content.md +4 -2
- package/templates/skills/pages/content.md +7 -0
- package/templates/skills/swarm-docs/content.md +1 -0
- package/templates/skills/swarm-scripts/SKILL.md +1 -0
- package/templates/skills/swarm-scripts/content.md +1 -0
- package/dist/acp-adapter-mr4temec.js +0 -17
- package/dist/fx-adapter-4sjrbdne.js +0 -20
- package/dist/handlers-ef3k11hb.js +0 -41
- package/dist/index-e6bq0exk.js +0 -42
- package/dist/index-hf2k1vge.js +0 -39
- package/dist/index-taxmejj3.js +0 -44
- package/dist/lead-5vt6f174.js +0 -83
- package/dist/thread-buffer-686pa1p1.js +0 -42
- package/dist/worker-4vp616ms.js +0 -83
- package/src/tests/apps-table-selection-migration.test.ts +0 -95
- package/src/tests/extensions-example-heartbeat-remediate.test.ts +0 -69
- package/src/tests/extensions-example-rewrite-and-suppress.test.ts +0 -70
|
@@ -292,7 +292,6 @@ describe("agent-task node.retry on task failure", () => {
|
|
|
292
292
|
teardownResumeListener?.();
|
|
293
293
|
try {
|
|
294
294
|
await failTask(first.id, "superseded_workflow_task");
|
|
295
|
-
await new Promise((r) => setTimeout(r, 20));
|
|
296
295
|
await recoverIncompleteRuns(registry);
|
|
297
296
|
} finally {
|
|
298
297
|
teardownResumeListener = setupWorkflowResumeListener(workflowEventBus, registry);
|
|
@@ -344,6 +343,7 @@ describe("implicit retry for a superseded task on a node without retry", () => {
|
|
|
344
343
|
expect(cut.workflowRunStepId).toBeFalsy();
|
|
345
344
|
// A cut with a queued retry is not a real failure.
|
|
346
345
|
expect(cut.status).toBe("superseded");
|
|
346
|
+
expect(cut.statusKind).toBe("workflow_retry");
|
|
347
347
|
expect(cut.failureReason).toBe(SUPERSEDED_WORKFLOW_TASK_REASON);
|
|
348
348
|
// It never gets a resume: the heartbeat orphan repair must not see it.
|
|
349
349
|
const orphans = await getSupersededTasksWithoutResume(
|
|
@@ -429,7 +429,6 @@ describe("implicit retry for a superseded task on a node without retry", () => {
|
|
|
429
429
|
teardownResumeListener?.();
|
|
430
430
|
try {
|
|
431
431
|
await failTask(first.id, SUPERSEDED_WORKFLOW_TASK_REASON);
|
|
432
|
-
await new Promise((r) => setTimeout(r, 20));
|
|
433
432
|
await recoverIncompleteRuns(registry);
|
|
434
433
|
} finally {
|
|
435
434
|
teardownResumeListener = setupWorkflowResumeListener(workflowEventBus, registry);
|
|
@@ -478,7 +477,6 @@ describe("a cut the workflow carries on without", () => {
|
|
|
478
477
|
teardownResumeListener?.();
|
|
479
478
|
try {
|
|
480
479
|
await failTask(cut.id, SUPERSEDED_WORKFLOW_TASK_REASON);
|
|
481
|
-
await new Promise((r) => setTimeout(r, 20));
|
|
482
480
|
await recoverIncompleteRuns(registry);
|
|
483
481
|
} finally {
|
|
484
482
|
teardownResumeListener = setupWorkflowResumeListener(workflowEventBus, registry);
|
|
@@ -314,6 +314,7 @@ describe("cascade cancel", () => {
|
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
expect((await getTaskById(task!.id))?.status).toBe("cancelled");
|
|
317
|
+
expect((await getTaskById(task!.id))?.statusKind).toBe("workflow");
|
|
317
318
|
// A cancelled task is never handed to a worker.
|
|
318
319
|
expect(await startTask(task!.id)).toBeNull();
|
|
319
320
|
});
|
|
@@ -446,26 +446,25 @@ describe("Workflow Retry v2 (Phase 4)", () => {
|
|
|
446
446
|
],
|
|
447
447
|
});
|
|
448
448
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
449
|
+
try {
|
|
450
|
+
const runId = await startWorkflowExecution(workflow, {}, registry);
|
|
451
|
+
const steps = await getWorkflowRunStepsByRunId(runId);
|
|
452
|
+
const step = steps.find((s) => s.nodeId === "n1")!;
|
|
453
|
+
expect(step.status).toBe("failed");
|
|
454
|
+
expect(step.nextRetryAt).toBeTruthy();
|
|
455
|
+
expect(step.retryCount).toBe(1);
|
|
452
456
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
);
|
|
465
|
-
const retryable = await getRetryableSteps();
|
|
466
|
-
expect(retryable.length).toBeGreaterThanOrEqual(1);
|
|
467
|
-
const ourStep = retryable.find((s) => s.runId === runId);
|
|
468
|
-
expect(ourStep).toBeTruthy();
|
|
457
|
+
await waitUntil(
|
|
458
|
+
async () => (await getRetryableSteps()).some((s) => s.runId === runId),
|
|
459
|
+
() => `step n1 of run ${runId} never became retryable`,
|
|
460
|
+
);
|
|
461
|
+
const retryable = await getRetryableSteps();
|
|
462
|
+
const ourStep = retryable.find((s) => s.runId === runId);
|
|
463
|
+
expect(ourStep).toBeTruthy();
|
|
464
|
+
} finally {
|
|
465
|
+
// Retire the queued retry before later pollers use the shared executor counter.
|
|
466
|
+
await deleteWorkflow(workflow.id);
|
|
467
|
+
}
|
|
469
468
|
});
|
|
470
469
|
|
|
471
470
|
test("retry limit respected (does not retry past maxRetries)", async () => {
|
|
@@ -488,32 +487,24 @@ describe("Workflow Retry v2 (Phase 4)", () => {
|
|
|
488
487
|
failCounter = 0;
|
|
489
488
|
const runId = await startWorkflowExecution(workflow, {}, registry);
|
|
490
489
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
// maxRetries=1, so 1 < 1 is false => no retry => run fails.
|
|
497
|
-
// Wait, let me re-check: the engine passes currentRetryCount (from existing step, which is 0
|
|
498
|
-
// on first attempt), and checkpoint does retryCount + 1 = 1, then checks 0 < 1 = true,
|
|
499
|
-
// so it DOES retry once.
|
|
500
|
-
const steps = await getWorkflowRunStepsByRunId(runId);
|
|
501
|
-
const step = steps.find((s) => s.nodeId === "n1")!;
|
|
490
|
+
const [initial] = await getWorkflowRunStepsByRunId(runId);
|
|
491
|
+
expect(initial?.status).toBe("failed");
|
|
492
|
+
expect(initial?.retryCount).toBe(1);
|
|
493
|
+
expect(initial?.nextRetryAt).toBeTruthy();
|
|
494
|
+
expect(failCounter).toBe(1);
|
|
502
495
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
const updatedRun = await waitForRunStatus(runId, "failed");
|
|
509
|
-
expect(updatedRun.status).toBe("failed");
|
|
510
|
-
} finally {
|
|
511
|
-
stopRetryPoller();
|
|
512
|
-
}
|
|
513
|
-
} else {
|
|
514
|
-
// Already terminal
|
|
515
|
-
expect(run!.status).toBe("failed");
|
|
496
|
+
startRetryPoller(registry, 10);
|
|
497
|
+
try {
|
|
498
|
+
await waitForRunStatus(runId, "failed");
|
|
499
|
+
} finally {
|
|
500
|
+
stopRetryPoller();
|
|
516
501
|
}
|
|
502
|
+
|
|
503
|
+
const [exhausted] = await getWorkflowRunStepsByRunId(runId);
|
|
504
|
+
expect(exhausted?.status).toBe("failed");
|
|
505
|
+
expect(exhausted?.retryCount).toBe(1);
|
|
506
|
+
expect(exhausted?.nextRetryAt).toBeUndefined();
|
|
507
|
+
expect(failCounter).toBe(2);
|
|
517
508
|
});
|
|
518
509
|
|
|
519
510
|
test("a tick in flight when the poller stops does not schedule another", async () => {
|
|
@@ -170,8 +170,8 @@ afterAll(async () => {
|
|
|
170
170
|
|
|
171
171
|
// ─── Tests ───────────────────────────────────────────────────
|
|
172
172
|
|
|
173
|
-
describe("
|
|
174
|
-
test("
|
|
173
|
+
describe("Workflow validation and retries", () => {
|
|
174
|
+
test("validation failure on retry exhausts the retry policy", async () => {
|
|
175
175
|
validateCallCount = 0;
|
|
176
176
|
validateAlwaysPass = false;
|
|
177
177
|
|
|
@@ -205,9 +205,7 @@ describe("Retry Poller — Validation on Retry", () => {
|
|
|
205
205
|
expect(step1.status).toBe("failed");
|
|
206
206
|
expect(step1.nextRetryAt).toBeTruthy();
|
|
207
207
|
// Validation was called during the initial execution
|
|
208
|
-
expect(validateCallCount).
|
|
209
|
-
|
|
210
|
-
const validationCountAfterInitial = validateCallCount;
|
|
208
|
+
expect(validateCallCount).toBe(1);
|
|
211
209
|
|
|
212
210
|
// Run the poller until the run fails (validation always fails, retries exhausted)
|
|
213
211
|
startRetryPoller(registry, 10);
|
|
@@ -217,48 +215,10 @@ describe("Retry Poller — Validation on Retry", () => {
|
|
|
217
215
|
stopRetryPoller();
|
|
218
216
|
}
|
|
219
217
|
|
|
220
|
-
|
|
221
|
-
expect(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
test("retry succeeds and validation passes → step checkpointed, run completes", async () => {
|
|
225
|
-
validateCallCount = 0;
|
|
226
|
-
// First call: fail, subsequent calls: pass
|
|
227
|
-
// We use the validateAlwaysPass flag to simulate this
|
|
228
|
-
validateAlwaysPass = false;
|
|
229
|
-
|
|
230
|
-
// Node produces value=100 (>50, so validation passes)
|
|
231
|
-
const workflow = await makeWorkflow({
|
|
232
|
-
nodes: [
|
|
233
|
-
{
|
|
234
|
-
id: "n1",
|
|
235
|
-
type: "number-gen",
|
|
236
|
-
config: { value: 100 },
|
|
237
|
-
// Add a node-level retry to force initial failure via a trick:
|
|
238
|
-
// We'll use the engine's normal path but manually mark the step
|
|
239
|
-
// for retry to test the poller's validation path.
|
|
240
|
-
validation: {
|
|
241
|
-
executor: "validate",
|
|
242
|
-
config: { prompt: "Is result > 50?" },
|
|
243
|
-
mustPass: true,
|
|
244
|
-
retry: {
|
|
245
|
-
strategy: "static",
|
|
246
|
-
maxRetries: 3,
|
|
247
|
-
baseDelayMs: 10,
|
|
248
|
-
maxDelayMs: 10,
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
],
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
// Execute — value=100, so validation passes on first try, run completes
|
|
256
|
-
const runId = await startWorkflowExecution(workflow, {}, registry);
|
|
257
|
-
|
|
258
|
-
// Should complete immediately since validation passes
|
|
259
|
-
const run = await getWorkflowRun(runId);
|
|
260
|
-
expect(run!.status).toBe("completed");
|
|
261
|
-
expect(validateCallCount).toBeGreaterThanOrEqual(1);
|
|
218
|
+
const [exhausted] = await getWorkflowRunStepsByRunId(runId);
|
|
219
|
+
expect(exhausted?.retryCount).toBe(2);
|
|
220
|
+
expect(exhausted?.nextRetryAt).toBeUndefined();
|
|
221
|
+
expect(validateCallCount).toBe(3);
|
|
262
222
|
});
|
|
263
223
|
|
|
264
224
|
test('retried script-like node routes to "pass" once validation passes', async () => {
|
|
@@ -305,7 +265,7 @@ describe("Retry Poller — Validation on Retry", () => {
|
|
|
305
265
|
expect(nodeIds).not.toContain("on-fail");
|
|
306
266
|
});
|
|
307
267
|
|
|
308
|
-
test("validation
|
|
268
|
+
test("initial mandatory validation failure fails the step and run without retry", async () => {
|
|
309
269
|
validateCallCount = 0;
|
|
310
270
|
validateAlwaysPass = false;
|
|
311
271
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, mock, test } from "bun:test";
|
|
2
2
|
import { execFile } from "node:child_process";
|
|
3
|
-
import { mkdir, mkdtemp, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
3
|
+
import { mkdir, mkdtemp, readdir, realpath, rm, stat, writeFile } from "node:fs/promises";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { promisify } from "node:util";
|
|
@@ -92,7 +92,7 @@ async function worktreeOfEndedTask(
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
beforeEach(async () => {
|
|
95
|
-
root = await mkdtemp(join(tmpdir(), "worktree-reaper-"));
|
|
95
|
+
root = await realpath(await mkdtemp(join(tmpdir(), "worktree-reaper-")));
|
|
96
96
|
repo = join(root, "repo");
|
|
97
97
|
const origin = join(root, "origin.git");
|
|
98
98
|
await execFileAsync("git", ["init", "-q", "--bare", "-b", "main", origin], { env: gitEnv() });
|
package/src/tools/cancel-task.ts
CHANGED
|
@@ -93,7 +93,7 @@ export async function cancelTaskHandler(
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
const cancelled = await cancelTask(taskId, reason);
|
|
96
|
+
const cancelled = await cancelTask(taskId, reason, { statusKind: "agent" });
|
|
97
97
|
|
|
98
98
|
if (!cancelled) {
|
|
99
99
|
return {
|
|
@@ -126,7 +126,7 @@ export async function cancelTaskHandler(
|
|
|
126
126
|
const ownershipError = assertOwnsTask(ctx, existingTask, "task.cancel.own");
|
|
127
127
|
if (ownershipError) return ownershipError;
|
|
128
128
|
|
|
129
|
-
const cancelled = await cancelTask(taskId, reason);
|
|
129
|
+
const cancelled = await cancelTask(taskId, reason, { statusKind: "user" });
|
|
130
130
|
|
|
131
131
|
if (!cancelled) {
|
|
132
132
|
return {
|
package/src/tools/defer-task.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
type ExternalEventAdapter,
|
|
21
21
|
getExternalEventAdapter,
|
|
22
22
|
matchKeyOf,
|
|
23
|
+
toConfirmResult,
|
|
23
24
|
} from "@/event-waits";
|
|
24
25
|
import {
|
|
25
26
|
MAX_PENDING_EVENT_WAITS_PER_AGENT,
|
|
@@ -77,8 +78,11 @@ async function admitExternalWait(
|
|
|
77
78
|
}
|
|
78
79
|
if (adapter.confirm) {
|
|
79
80
|
try {
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
const already = toConfirmResult(await adapter.confirm(event, match));
|
|
82
|
+
if (already.happened) {
|
|
83
|
+
return {
|
|
84
|
+
error: `${target} already happened${already.detail ? ` (${already.detail})` : ""}; read its result instead of deferring.`,
|
|
85
|
+
};
|
|
82
86
|
}
|
|
83
87
|
} catch (error) {
|
|
84
88
|
return {
|
|
@@ -544,6 +548,7 @@ export const registerDeferTaskTool = (server: McpServer) => {
|
|
|
544
548
|
const completed = await completeTask(taskId, terminalOutput, {
|
|
545
549
|
addTags: ["deferred"],
|
|
546
550
|
deferredAt: new Date().toISOString(),
|
|
551
|
+
statusKind: "deferred",
|
|
547
552
|
});
|
|
548
553
|
if (!completed) {
|
|
549
554
|
// Another writer terminally completed/failed/cancelled this task
|
|
@@ -77,6 +77,7 @@ export const looseAgentTaskOutputSchema = z.looseObject({
|
|
|
77
77
|
lastUpdatedAt: z.string().optional(),
|
|
78
78
|
finishedAt: z.string().optional(),
|
|
79
79
|
notifiedAt: z.string().optional(),
|
|
80
|
+
statusKind: z.string().optional(),
|
|
80
81
|
failureReason: z.string().optional(),
|
|
81
82
|
output: z.string().optional(),
|
|
82
83
|
progress: z.string().optional(),
|
|
@@ -468,10 +469,13 @@ export async function getTaskDetailsHandler(
|
|
|
468
469
|
? ` Fitted to the size budget; include ${JSON.stringify(reducedParts)} for the rest.`
|
|
469
470
|
: "";
|
|
470
471
|
|
|
471
|
-
return toolOk(
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
472
|
+
return toolOk(
|
|
473
|
+
`Task "${taskId}" (${task.status}${task.statusKind ? `, ${task.statusKind}` : ""}) details retrieved.${fitNote}`,
|
|
474
|
+
{
|
|
475
|
+
details: JSON.stringify(data),
|
|
476
|
+
data,
|
|
477
|
+
},
|
|
478
|
+
);
|
|
475
479
|
}
|
|
476
480
|
|
|
477
481
|
export const registerGetTaskDetailsTool = (server: McpServer) => {
|
package/src/tools/get-tasks.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
toolOk,
|
|
10
10
|
} from "@/tools/utils";
|
|
11
11
|
import type { AgentTask, AgentTaskSummary } from "@/types";
|
|
12
|
-
import { AgentTaskStatusSchema, AssetKeySchema } from "@/types";
|
|
12
|
+
import { AgentTaskStatusSchema, AssetKeySchema, TaskStatusKindSchema } from "@/types";
|
|
13
13
|
|
|
14
14
|
const TaskSummarySchema = z.looseObject({
|
|
15
15
|
id: z.string().optional(),
|
|
@@ -20,6 +20,8 @@ const TaskSummarySchema = z.looseObject({
|
|
|
20
20
|
task: z.string().optional(),
|
|
21
21
|
taskPreview: z.string().optional(),
|
|
22
22
|
status: AgentTaskStatusSchema.optional(),
|
|
23
|
+
// Plain string, not the enum: a kind added later must not fail validation.
|
|
24
|
+
statusKind: z.string().optional(),
|
|
23
25
|
taskType: z.string().optional(),
|
|
24
26
|
tags: z.array(z.string()).optional(),
|
|
25
27
|
priority: z.number().optional(),
|
|
@@ -35,6 +37,10 @@ export const getTasksInputSchema = z.object({
|
|
|
35
37
|
status: AgentTaskStatusSchema.optional().describe(
|
|
36
38
|
"Filter by task status (unassigned, offered, pending, in_progress, completed, failed).",
|
|
37
39
|
),
|
|
40
|
+
statusKind: TaskStatusKindSchema.optional().describe(
|
|
41
|
+
// Static text: scripts/generate-mcp-docs.ts resolves only literal interpolations.
|
|
42
|
+
"Filter by why the task ended. Pair with status, e.g. status 'failed' + statusKind 'error' (crash, rate limit, exit code) vs 'agent' (the agent chose to fail).",
|
|
43
|
+
),
|
|
38
44
|
mineOnly: z.boolean().optional().describe("Only return tasks assigned to you."),
|
|
39
45
|
unassigned: z.boolean().optional().describe("Only return unassigned tasks in the pool."),
|
|
40
46
|
offeredToMe: z
|
|
@@ -108,6 +114,7 @@ function renderTaskSummaries(
|
|
|
108
114
|
task?: string;
|
|
109
115
|
taskPreview?: string;
|
|
110
116
|
status?: string;
|
|
117
|
+
statusKind?: string;
|
|
111
118
|
priority?: number;
|
|
112
119
|
}>,
|
|
113
120
|
): string {
|
|
@@ -118,7 +125,7 @@ function renderTaskSummaries(
|
|
|
118
125
|
const rows = tasks.map((task) => {
|
|
119
126
|
const cells = [
|
|
120
127
|
task.id,
|
|
121
|
-
task.status,
|
|
128
|
+
task.statusKind ? `${task.status} (${task.statusKind})` : task.status,
|
|
122
129
|
task.priority,
|
|
123
130
|
task.agentId,
|
|
124
131
|
task.taskPreview ?? task.task,
|
|
@@ -132,6 +139,7 @@ export async function getTasksHandler(
|
|
|
132
139
|
ctx: ToolCtx,
|
|
133
140
|
{
|
|
134
141
|
status,
|
|
142
|
+
statusKind,
|
|
135
143
|
mineOnly,
|
|
136
144
|
unassigned,
|
|
137
145
|
offeredToMe,
|
|
@@ -154,6 +162,7 @@ export async function getTasksHandler(
|
|
|
154
162
|
// agent-specific shortcuts like mineOnly/offeredToMe.
|
|
155
163
|
const taskFilters = {
|
|
156
164
|
status,
|
|
165
|
+
statusKind,
|
|
157
166
|
agentId: ctx.kind === "owner" && mineOnly ? (agentId ?? undefined) : undefined,
|
|
158
167
|
unassigned: ctx.kind === "owner" ? unassigned : undefined,
|
|
159
168
|
offeredTo: ctx.kind === "owner" && offeredToMe ? (agentId ?? undefined) : undefined,
|
|
@@ -182,6 +191,7 @@ export async function getTasksHandler(
|
|
|
182
191
|
agentId: t.agentId,
|
|
183
192
|
...(includeFull ? { task: t.task } : { taskPreview: t.task }),
|
|
184
193
|
status: t.status,
|
|
194
|
+
statusKind: t.statusKind,
|
|
185
195
|
taskType: t.taskType,
|
|
186
196
|
tags: t.tags,
|
|
187
197
|
priority: t.priority,
|
|
@@ -196,6 +206,7 @@ export async function getTasksHandler(
|
|
|
196
206
|
// Build filter description for message
|
|
197
207
|
const filters: string[] = [];
|
|
198
208
|
if (status) filters.push(`status='${status}'`);
|
|
209
|
+
if (statusKind) filters.push(`statusKind='${statusKind}'`);
|
|
199
210
|
if (ctx.kind === "owner" && mineOnly) filters.push("mine only");
|
|
200
211
|
if (ctx.kind === "owner" && unassigned) filters.push("unassigned");
|
|
201
212
|
if (ctx.kind === "owner" && offeredToMe) filters.push("offered to me");
|
package/src/tools/manage-user.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "@/be/users";
|
|
20
20
|
import { can } from "@/rbac";
|
|
21
21
|
import { createToolRegistrar, swarmToolOutputSchema, toolErr, toolOk } from "@/tools/utils";
|
|
22
|
+
import { UserAvatarSchema } from "@/types";
|
|
22
23
|
|
|
23
24
|
// Loose mirror of UserSchema for tool output: every field optional, no
|
|
24
25
|
// datetime format pins.
|
|
@@ -34,6 +35,7 @@ const userOutputShape = z.looseObject({
|
|
|
34
35
|
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
35
36
|
dailyBudgetUsd: z.number().nullable().optional(),
|
|
36
37
|
status: z.enum(["invited", "active", "suspended"]).optional(),
|
|
38
|
+
avatar: z.looseObject({}).nullable().optional(),
|
|
37
39
|
createdAt: z.string().optional(),
|
|
38
40
|
lastUpdatedAt: z.string().optional(),
|
|
39
41
|
});
|
|
@@ -84,6 +86,11 @@ const InputSchema = z.object({
|
|
|
84
86
|
.nullable()
|
|
85
87
|
.optional()
|
|
86
88
|
.describe("Free-form JSON metadata (null clears the field)"),
|
|
89
|
+
avatar: UserAvatarSchema.nullable()
|
|
90
|
+
.optional()
|
|
91
|
+
.describe(
|
|
92
|
+
"Custom avatar, one of: { type: 'lucide', icon: '<kebab-case-lucide-name>', color?: '#RRGGBB' }; { type: 'url', url: 'https://…' } (https image, no credentials); { type: 'agent-fs', path: '/users/<id>/avatar.png', orgId?, driveId? } (an image in agent-fs; pass both IDs or neither for the swarm drive). Pass null to reset to initials.",
|
|
93
|
+
),
|
|
87
94
|
comms: z
|
|
88
95
|
.object({
|
|
89
96
|
tone: z.string().nullable().optional(),
|
|
@@ -206,6 +213,7 @@ export const registerManageUserTool = (server: McpServer) => {
|
|
|
206
213
|
timezone: input.timezone,
|
|
207
214
|
dailyBudgetUsd: input.dailyBudgetUsd ?? undefined,
|
|
208
215
|
status: input.status,
|
|
216
|
+
avatar: input.avatar,
|
|
209
217
|
metadata,
|
|
210
218
|
});
|
|
211
219
|
for (const ident of input.identities ?? []) {
|
|
@@ -268,6 +276,7 @@ export const registerManageUserTool = (server: McpServer) => {
|
|
|
268
276
|
timezone: input.timezone,
|
|
269
277
|
dailyBudgetUsd: input.dailyBudgetUsd,
|
|
270
278
|
status: input.status,
|
|
279
|
+
avatar: input.avatar,
|
|
271
280
|
metadata,
|
|
272
281
|
});
|
|
273
282
|
if (!updated) return null;
|
|
@@ -671,7 +671,7 @@ export const registerStoreProgressTool = (server: McpServer) => {
|
|
|
671
671
|
|
|
672
672
|
// Handle status change
|
|
673
673
|
if (status === "completed") {
|
|
674
|
-
const result = await completeTask(taskId, output);
|
|
674
|
+
const result = await completeTask(taskId, output, { statusKind: "agent" });
|
|
675
675
|
if (result && uiSpecToStore) await upsertTaskUiSpec(taskId, uiSpecToStore);
|
|
676
676
|
if (result) {
|
|
677
677
|
updatedTask = result;
|
|
@@ -704,7 +704,9 @@ export const registerStoreProgressTool = (server: McpServer) => {
|
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
706
|
} else if (status === "failed") {
|
|
707
|
-
const result = await failTask(taskId, failureReason ?? "Unknown failure"
|
|
707
|
+
const result = await failTask(taskId, failureReason ?? "Unknown failure", {
|
|
708
|
+
statusKind: "agent",
|
|
709
|
+
});
|
|
708
710
|
if (result) {
|
|
709
711
|
updatedTask = result;
|
|
710
712
|
|
|
@@ -735,7 +737,7 @@ export const registerStoreProgressTool = (server: McpServer) => {
|
|
|
735
737
|
}
|
|
736
738
|
}
|
|
737
739
|
} else if (status === "skipped") {
|
|
738
|
-
const result = await skipTask(taskId, skipReason
|
|
740
|
+
const result = await skipTask(taskId, skipReason!, { statusKind: "agent" });
|
|
739
741
|
if (result) {
|
|
740
742
|
updatedTask = result;
|
|
741
743
|
if (existingTask.agentId) {
|
package/src/types.ts
CHANGED
|
@@ -353,6 +353,80 @@ export function isTerminalTaskStatus(status: string): status is TerminalTaskStat
|
|
|
353
353
|
return (TERMINAL_TASK_STATUSES as readonly string[]).includes(status);
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
/**
|
|
357
|
+
* Why a task reached its terminal status, stored in `agent_tasks.statusKind`.
|
|
358
|
+
* It refines `status` and never replaces it: every reader of `status` keeps
|
|
359
|
+
* working, and a NULL kind (rows written before the column existed) means
|
|
360
|
+
* unknown. The values are validated here, not by a DB CHECK, so a new kind
|
|
361
|
+
* is one entry in this registry and needs no migration.
|
|
362
|
+
*
|
|
363
|
+
* - `agent`: the agent decided (store-progress, the cancel-task tool).
|
|
364
|
+
* - `error`: the system gave up on the run (runner exit, crash, provider
|
|
365
|
+
* error, stall, provisioning, reboot) without the agent deciding.
|
|
366
|
+
* - `cascade`: a task it depends on ended without completing.
|
|
367
|
+
* - `external`: a tracker or VCS event ended it (PR merged, issue deleted).
|
|
368
|
+
* - `runner`: the runner wrapper finished it after the session ended.
|
|
369
|
+
* - `deferred`: defer-task completed it and a wake-up task continues it.
|
|
370
|
+
* - `user`: a person ended it from the dashboard, Slack, chat or a tracker.
|
|
371
|
+
* - `workflow`: the workflow engine ended it (run or step cancelled).
|
|
372
|
+
* - `system`: the heartbeat ended it as housekeeping.
|
|
373
|
+
* - superseded kinds mirror `ResumeReasonSchema`, plus `workflow_retry` for a
|
|
374
|
+
* workflow step the engine queued a retry for.
|
|
375
|
+
*/
|
|
376
|
+
export const TASK_STATUS_KINDS = {
|
|
377
|
+
completed: ["agent", "runner", "deferred"],
|
|
378
|
+
failed: ["agent", "error", "cascade", "external"],
|
|
379
|
+
cancelled: ["user", "agent", "workflow", "external", "system"],
|
|
380
|
+
skipped: ["agent", "runner"],
|
|
381
|
+
superseded: [
|
|
382
|
+
"graceful_shutdown",
|
|
383
|
+
"context_limits",
|
|
384
|
+
"manual_supersede",
|
|
385
|
+
"crash_recovery",
|
|
386
|
+
"provider_fallback",
|
|
387
|
+
"workflow_retry",
|
|
388
|
+
],
|
|
389
|
+
} as const satisfies Record<TerminalTaskStatus, readonly string[]>;
|
|
390
|
+
|
|
391
|
+
/** The kinds valid for one terminal status, e.g. `TaskStatusKindFor<"failed">`. */
|
|
392
|
+
export type TaskStatusKindFor<S extends TerminalTaskStatus> = (typeof TASK_STATUS_KINDS)[S][number];
|
|
393
|
+
export type TaskStatusKind = TaskStatusKindFor<TerminalTaskStatus>;
|
|
394
|
+
|
|
395
|
+
// Literal list so scripts/generate-mcp-docs.ts can render the values; the
|
|
396
|
+
// assertion below fails tsc when it drifts from TASK_STATUS_KINDS.
|
|
397
|
+
export const TaskStatusKindSchema = z.enum([
|
|
398
|
+
"agent",
|
|
399
|
+
"runner",
|
|
400
|
+
"deferred",
|
|
401
|
+
"error",
|
|
402
|
+
"cascade",
|
|
403
|
+
"external",
|
|
404
|
+
"user",
|
|
405
|
+
"workflow",
|
|
406
|
+
"system",
|
|
407
|
+
"graceful_shutdown",
|
|
408
|
+
"context_limits",
|
|
409
|
+
"manual_supersede",
|
|
410
|
+
"crash_recovery",
|
|
411
|
+
"provider_fallback",
|
|
412
|
+
"workflow_retry",
|
|
413
|
+
]);
|
|
414
|
+
type TaskStatusKindSchemaMatchesRegistry = [TaskStatusKind] extends [
|
|
415
|
+
z.infer<typeof TaskStatusKindSchema>,
|
|
416
|
+
]
|
|
417
|
+
? [z.infer<typeof TaskStatusKindSchema>] extends [TaskStatusKind]
|
|
418
|
+
? true
|
|
419
|
+
: false
|
|
420
|
+
: false;
|
|
421
|
+
true satisfies TaskStatusKindSchemaMatchesRegistry;
|
|
422
|
+
|
|
423
|
+
export function isTaskStatusKindFor<S extends TerminalTaskStatus>(
|
|
424
|
+
status: S,
|
|
425
|
+
kind: string | null | undefined,
|
|
426
|
+
): kind is TaskStatusKindFor<S> {
|
|
427
|
+
return (TASK_STATUS_KINDS[status] as readonly string[]).includes(kind ?? "");
|
|
428
|
+
}
|
|
429
|
+
|
|
356
430
|
/**
|
|
357
431
|
* Every status that is not terminal, derived so a new status lands here unless
|
|
358
432
|
* it is added to `TERMINAL_TASK_STATUSES`. Open tasks are a handful of rows,
|
|
@@ -853,6 +927,9 @@ export const AgentTaskSchema = z
|
|
|
853
927
|
notifiedAt: z.iso.datetime().optional(),
|
|
854
928
|
|
|
855
929
|
// Completion data
|
|
930
|
+
statusKind: TaskStatusKindSchema.optional().describe(
|
|
931
|
+
"Why the task reached its terminal status, e.g. `failed` + `agent` (the agent chose to fail) vs `failed` + `error` (rate limit, crash, exit code). Absent while open and on rows finished before the field existed.",
|
|
932
|
+
),
|
|
856
933
|
failureReason: z.string().optional(),
|
|
857
934
|
output: z.string().optional(),
|
|
858
935
|
progress: z.string().optional(),
|
|
@@ -1255,6 +1332,12 @@ export const UserSchema = z
|
|
|
1255
1332
|
// user's rows into the target. Such a user cannot authenticate, and
|
|
1256
1333
|
// identity lookups resolve to the target. Absent once the job deletes it.
|
|
1257
1334
|
mergedIntoUserId: z.string().nullable().optional(),
|
|
1335
|
+
// Custom avatar, same shapes as an agent's. Null/missing = initials.
|
|
1336
|
+
// Migration 344 adds the column.
|
|
1337
|
+
avatar: z
|
|
1338
|
+
.lazy(() => UserAvatarSchema)
|
|
1339
|
+
.nullable()
|
|
1340
|
+
.optional(),
|
|
1258
1341
|
createdAt: z.iso.datetime(),
|
|
1259
1342
|
lastUpdatedAt: z.iso.datetime(),
|
|
1260
1343
|
})
|
|
@@ -1548,6 +1631,10 @@ export type MediaIcon = z.infer<typeof MediaIconSchema>;
|
|
|
1548
1631
|
export const AgentAvatarSchema = MediaIconSchema;
|
|
1549
1632
|
export type AgentAvatar = MediaIcon;
|
|
1550
1633
|
|
|
1634
|
+
// User avatars accept the same shapes as agent avatars.
|
|
1635
|
+
export const UserAvatarSchema = MediaIconSchema;
|
|
1636
|
+
export type UserAvatar = MediaIcon;
|
|
1637
|
+
|
|
1551
1638
|
/**
|
|
1552
1639
|
* Icon shown for an app on the dashboard Apps page: a lucide glyph, an https
|
|
1553
1640
|
* image link, or an image in agent-fs.
|
|
@@ -2020,6 +2107,11 @@ export const ResumeReasonSchema = z.enum([
|
|
|
2020
2107
|
"provider_fallback", // Provider error; the resume runs the next fallback profile
|
|
2021
2108
|
]);
|
|
2022
2109
|
export type ResumeReason = z.infer<typeof ResumeReasonSchema>;
|
|
2110
|
+
// A supersede stores its resume reason as the task's statusKind: a new reason
|
|
2111
|
+
// must also be a `superseded` entry in TASK_STATUS_KINDS (compile error here).
|
|
2112
|
+
const _resumeReasonsAreSupersededKinds: readonly TaskStatusKindFor<"superseded">[] =
|
|
2113
|
+
ResumeReasonSchema.options;
|
|
2114
|
+
void _resumeReasonsAreSupersededKinds;
|
|
2023
2115
|
|
|
2024
2116
|
export const AgentLogSchema = z
|
|
2025
2117
|
.object({
|
|
@@ -3515,6 +3607,7 @@ export type AgentTaskSummary = Pick<
|
|
|
3515
3607
|
| "createdAt"
|
|
3516
3608
|
| "lastUpdatedAt"
|
|
3517
3609
|
| "finishedAt"
|
|
3610
|
+
| "statusKind"
|
|
3518
3611
|
| "peakContextPercent"
|
|
3519
3612
|
| "totalCostUsd"
|
|
3520
3613
|
>;
|
package/src/utils/constants.ts
CHANGED
|
@@ -221,6 +221,18 @@ export function buildAgentFsLiveUrl(opts: AgentFsFileRef): string | null {
|
|
|
221
221
|
return route ? `${live}/file/~/${route}${agentFsFileLinkQuery(live)}` : null;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
+
/**
|
|
225
|
+
* A people-facing link to an agent-fs file, on the base from
|
|
226
|
+
* {@link resolveAgentFsLinkBase} (`attachment`): Comb in the dashboard when
|
|
227
|
+
* `APP_URL` is set and Comb is on, else the live app. Null like
|
|
228
|
+
* {@link buildAgentFsLiveUrl}.
|
|
229
|
+
*/
|
|
230
|
+
export function buildAgentFsFileLink(opts: AgentFsFileRef): string | null {
|
|
231
|
+
const route = agentFsFileRoute(opts);
|
|
232
|
+
const base = resolveAgentFsLinkBase("attachment");
|
|
233
|
+
return route ? `${base}/file/~/${route}${agentFsFileLinkQuery(base)}` : null;
|
|
234
|
+
}
|
|
235
|
+
|
|
224
236
|
export interface CombState {
|
|
225
237
|
enabled: boolean;
|
|
226
238
|
/** An explicit `COMB_ENABLED` decided it; otherwise the unset default did. */
|