@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
package/src/slack/render-v2.ts
CHANGED
|
@@ -63,6 +63,7 @@ import {
|
|
|
63
63
|
splitSlackSectionText,
|
|
64
64
|
} from "./blocks";
|
|
65
65
|
import { buildAskClosure, type ClosureState, closureState } from "./closure";
|
|
66
|
+
import { getChannelExternality } from "./external-channel";
|
|
66
67
|
import {
|
|
67
68
|
completedStatusIcon,
|
|
68
69
|
iconPrefix,
|
|
@@ -1179,6 +1180,121 @@ async function isSlackContinuation(task: AgentTask): Promise<boolean> {
|
|
|
1179
1180
|
);
|
|
1180
1181
|
}
|
|
1181
1182
|
|
|
1183
|
+
/** Lead review tasks the engine creates when a worker finishes or a session resumes. */
|
|
1184
|
+
const SLACK_LEAD_FOLLOW_UP_TYPES = new Set(["follow-up", "resume"]);
|
|
1185
|
+
/** Guards the ancestor walk against a corrupt parent cycle or a pathological chain. */
|
|
1186
|
+
const SLACK_ANCESTOR_WALK_LIMIT = 50;
|
|
1187
|
+
|
|
1188
|
+
/** True when `task`'s parent chain holds a task a person started in Slack. */
|
|
1189
|
+
async function hasSlackAskAncestor(
|
|
1190
|
+
task: AgentTask,
|
|
1191
|
+
threadTasks: readonly AgentTask[],
|
|
1192
|
+
): Promise<boolean> {
|
|
1193
|
+
const byId = new Map(threadTasks.map((candidate) => [candidate.id, candidate]));
|
|
1194
|
+
const seen = new Set<string>([task.id]);
|
|
1195
|
+
let parentId = task.parentTaskId;
|
|
1196
|
+
while (parentId && !seen.has(parentId) && seen.size <= SLACK_ANCESTOR_WALK_LIMIT) {
|
|
1197
|
+
seen.add(parentId);
|
|
1198
|
+
const parent = byId.get(parentId) ?? (await getTaskById(parentId));
|
|
1199
|
+
if (!parent) return false;
|
|
1200
|
+
if (parent.source === "slack") return true;
|
|
1201
|
+
parentId = parent.parentTaskId;
|
|
1202
|
+
}
|
|
1203
|
+
return false;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* A Lead follow-up (worker completion) or resume task in a tree a person
|
|
1208
|
+
* started in Slack is "eligible": its output is the answer the thread waits
|
|
1209
|
+
* for, so it gets an outcome card like the ask did. Before this, the thread
|
|
1210
|
+
* stayed silent until someone asked "status?". A Lead follow-up with Slack
|
|
1211
|
+
* context but no Slack ask in its parent chain is an "orphan": it posts
|
|
1212
|
+
* nothing, and its card is settled so the thread does not wait on it.
|
|
1213
|
+
*/
|
|
1214
|
+
async function classifyLeadFollowUp(
|
|
1215
|
+
task: AgentTask,
|
|
1216
|
+
threadTasks: readonly AgentTask[],
|
|
1217
|
+
): Promise<"none" | "eligible" | "orphan"> {
|
|
1218
|
+
if (
|
|
1219
|
+
task.source !== "system" ||
|
|
1220
|
+
!SLACK_LEAD_FOLLOW_UP_TYPES.has(task.taskType ?? "") ||
|
|
1221
|
+
!task.slackChannelId ||
|
|
1222
|
+
!task.slackThreadTs ||
|
|
1223
|
+
!task.agentId ||
|
|
1224
|
+
!(await getAgentById(task.agentId))?.isLead
|
|
1225
|
+
) {
|
|
1226
|
+
return "none";
|
|
1227
|
+
}
|
|
1228
|
+
return (await hasSlackAskAncestor(task, threadTasks)) ? "eligible" : "orphan";
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* Settles a Lead follow-up's card as abandoned without posting anything, so
|
|
1233
|
+
* slackThreadHasOutcomeWork stops counting it and the thread can close.
|
|
1234
|
+
*/
|
|
1235
|
+
async function settleLeadFollowUpWithoutCard(task: AgentTask, reason: string): Promise<void> {
|
|
1236
|
+
if (!task.slackChannelId || !task.slackThreadTs) return;
|
|
1237
|
+
// A bound card is a stream Slack already holds; it keeps its own bounded
|
|
1238
|
+
// recovery. A pending one has no bound message, so it is settled here.
|
|
1239
|
+
const card = await getSlackOutcomeMessage(task.id);
|
|
1240
|
+
if (card && !isPendingSlackMessage(card)) return;
|
|
1241
|
+
await reserveSlackMessage({
|
|
1242
|
+
contextKey:
|
|
1243
|
+
task.contextKey ??
|
|
1244
|
+
slackContextKey({ channelId: task.slackChannelId, threadTs: task.slackThreadTs }),
|
|
1245
|
+
channelId: task.slackChannelId,
|
|
1246
|
+
threadTs: task.slackThreadTs,
|
|
1247
|
+
kind: "outcome",
|
|
1248
|
+
taskId: task.id,
|
|
1249
|
+
});
|
|
1250
|
+
await abandonSlackOutcomeDelivery(task.id, reason);
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* Gates a new outcome card for a Lead follow-up; every other task passes.
|
|
1255
|
+
* No card when the Lead already answered with `slack-reply` (it would repeat
|
|
1256
|
+
* that answer), when the delegation child pass owns the card, or when Slack
|
|
1257
|
+
* does not confirm the channel is internal: a Slack Connect channel is a
|
|
1258
|
+
* customer's, and posting there needs a person's explicit yes. An external
|
|
1259
|
+
* verdict settles the card as abandoned so the thread can close.
|
|
1260
|
+
*/
|
|
1261
|
+
async function mayPostLeadFollowUpCard(
|
|
1262
|
+
task: AgentTask,
|
|
1263
|
+
threadTasks: readonly AgentTask[],
|
|
1264
|
+
ownerAskId: ReadonlyMap<string, string>,
|
|
1265
|
+
delegationActivatedAt: string | null,
|
|
1266
|
+
): Promise<boolean> {
|
|
1267
|
+
if (task.source !== "system" || !SLACK_LEAD_FOLLOW_UP_TYPES.has(task.taskType ?? "")) {
|
|
1268
|
+
return true;
|
|
1269
|
+
}
|
|
1270
|
+
if ((await getTaskById(task.id))?.slackReplySent ?? task.slackReplySent) {
|
|
1271
|
+
// A reservation left by a failed delivery would keep the thread open.
|
|
1272
|
+
if (await getSlackOutcomeMessage(task.id)) {
|
|
1273
|
+
await settleLeadFollowUpWithoutCard(task, "slack_reply_sent: Lead follow-up not posted");
|
|
1274
|
+
}
|
|
1275
|
+
return false;
|
|
1276
|
+
}
|
|
1277
|
+
const askId = ownerAskId.get(task.id);
|
|
1278
|
+
const ownerAsk = askId ? threadTasks.find((candidate) => candidate.id === askId) : undefined;
|
|
1279
|
+
if (
|
|
1280
|
+
delegationActivatedAt !== null &&
|
|
1281
|
+
ownerAsk &&
|
|
1282
|
+
ownerAsk.createdAt >= delegationActivatedAt &&
|
|
1283
|
+
isChildCardCandidate(task, delegationActivatedAt)
|
|
1284
|
+
) {
|
|
1285
|
+
return false;
|
|
1286
|
+
}
|
|
1287
|
+
const app = getSlackApp();
|
|
1288
|
+
if (!app || !task.slackChannelId || !task.slackThreadTs) return false;
|
|
1289
|
+
const externality = await getChannelExternality(app.client, task.slackChannelId);
|
|
1290
|
+
if (externality === "external") {
|
|
1291
|
+
// "unknown" is not settled: it retries on the next tick.
|
|
1292
|
+
await settleLeadFollowUpWithoutCard(task, "external_channel: Lead follow-up not posted");
|
|
1293
|
+
return false;
|
|
1294
|
+
}
|
|
1295
|
+
return externality === "internal";
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1182
1298
|
/**
|
|
1183
1299
|
* True when `task` is a candidate for its own child result card (plan
|
|
1184
1300
|
* section 3.4, rules 1-4, 3, and part of rule 6). Callers still need the
|
|
@@ -1216,12 +1332,15 @@ export async function slackDelegationOwnsChildCard(task: AgentTask): Promise<boo
|
|
|
1216
1332
|
return !!ownerAsk && ownerAsk.createdAt >= delegationActivatedAt;
|
|
1217
1333
|
}
|
|
1218
1334
|
|
|
1219
|
-
async function taskNeedsDirectOutcome(
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
);
|
|
1335
|
+
async function taskNeedsDirectOutcome(
|
|
1336
|
+
task: AgentTask,
|
|
1337
|
+
activatedAt: string,
|
|
1338
|
+
leadFollowUp: "none" | "eligible" | "orphan",
|
|
1339
|
+
): Promise<boolean> {
|
|
1340
|
+
if (task.createdAt < activatedAt) return false;
|
|
1341
|
+
if (task.source === "slack") return isAskOutcomeStatus(task.status);
|
|
1342
|
+
if (!isOutcomeStatus(task.status)) return false;
|
|
1343
|
+
return leadFollowUp === "eligible" || (await isSlackContinuation(task));
|
|
1225
1344
|
}
|
|
1226
1345
|
|
|
1227
1346
|
/**
|
|
@@ -2072,10 +2191,32 @@ async function processSlackThread(
|
|
|
2072
2191
|
|
|
2073
2192
|
for (const task of tasks) {
|
|
2074
2193
|
if (!isSlackRenderV2Enabled()) return "stop";
|
|
2075
|
-
|
|
2194
|
+
const leadFollowUp = isOutcomeStatus(task.status)
|
|
2195
|
+
? await classifyLeadFollowUp(task, tasks)
|
|
2196
|
+
: "none";
|
|
2197
|
+
if (
|
|
2198
|
+
leadFollowUp === "orphan" &&
|
|
2199
|
+
isOutcomeStatus(task.status) &&
|
|
2200
|
+
!task.slackReplySent &&
|
|
2201
|
+
task.createdAt >= activatedAt &&
|
|
2202
|
+
!endedBefore(task, outcomeWindow.finishedAfter)
|
|
2203
|
+
) {
|
|
2204
|
+
// The reconcile SQL cannot walk the parent chain, so it counts this one.
|
|
2205
|
+
await settleLeadFollowUpWithoutCard(task, "no_slack_ask: Lead follow-up not posted");
|
|
2206
|
+
continue;
|
|
2207
|
+
}
|
|
2208
|
+
if (!(await taskNeedsDirectOutcome(task, activatedAt, leadFollowUp))) continue;
|
|
2076
2209
|
const card = await getSlackOutcomeMessage(task.id);
|
|
2077
2210
|
if (card && isSettledSlackMessage(card)) continue;
|
|
2078
2211
|
if (await isAnsweredByDeferralCard(task, tasks)) continue;
|
|
2212
|
+
// A pending card has no bound Slack message, so its retry would create
|
|
2213
|
+
// the first one: it passes the same gate as a new card.
|
|
2214
|
+
if (
|
|
2215
|
+
(!card || isPendingSlackMessage(card)) &&
|
|
2216
|
+
!(await mayPostLeadFollowUpCard(task, tasks, ownerAskId, delegationActivatedAt))
|
|
2217
|
+
) {
|
|
2218
|
+
continue;
|
|
2219
|
+
}
|
|
2079
2220
|
const deferByClosure =
|
|
2080
2221
|
task.source === "slack" &&
|
|
2081
2222
|
delegationEnabled &&
|
|
@@ -229,8 +229,6 @@ describe("API drain with a real worker", () => {
|
|
|
229
229
|
|
|
230
230
|
try {
|
|
231
231
|
await waitForTask(taskId, (task) => task.status === "in_progress");
|
|
232
|
-
// Give the runner a few ping iterations with the task in flight.
|
|
233
|
-
await Bun.sleep(2_000);
|
|
234
232
|
|
|
235
233
|
const signalledAt = Date.now();
|
|
236
234
|
sut.process.kill("SIGTERM");
|
|
@@ -16,20 +16,8 @@ async function removeDb(): Promise<void> {
|
|
|
16
16
|
|
|
17
17
|
afterEach(removeDb);
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
id
|
|
21
|
-
status: string;
|
|
22
|
-
resolvedBy: string | null;
|
|
23
|
-
resolvedAt: string | null;
|
|
24
|
-
resolutionReason: string | null;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
function readRows(db: Database): Row[] {
|
|
28
|
-
return db
|
|
29
|
-
.query<Row, []>(
|
|
30
|
-
"SELECT id, status, resolvedBy, resolvedAt, resolutionReason FROM approval_requests ORDER BY id",
|
|
31
|
-
)
|
|
32
|
-
.all();
|
|
19
|
+
function readRows(db: Database) {
|
|
20
|
+
return db.query("SELECT * FROM approval_requests ORDER BY id").all();
|
|
33
21
|
}
|
|
34
22
|
|
|
35
23
|
describe("migration 166 approval auto-cancellation index", () => {
|
|
@@ -38,7 +26,7 @@ describe("migration 166 approval auto-cancellation index", () => {
|
|
|
38
26
|
const db = new Database(DB_PATH, { create: true });
|
|
39
27
|
try {
|
|
40
28
|
runMigrations(db);
|
|
41
|
-
//
|
|
29
|
+
// Replay migration 166 on the current schema with its index removed.
|
|
42
30
|
db.run("DROP INDEX idx_approval_requests_pending_created");
|
|
43
31
|
db.run("DELETE FROM _migrations WHERE version = 166");
|
|
44
32
|
db.run(`INSERT INTO approval_requests
|
|
@@ -73,13 +61,14 @@ describe("migration 166 approval auto-cancellation index", () => {
|
|
|
73
61
|
]),
|
|
74
62
|
);
|
|
75
63
|
|
|
76
|
-
const
|
|
64
|
+
const indexSql = db
|
|
77
65
|
.query<{ sql: string }, []>(
|
|
78
|
-
"SELECT sql FROM sqlite_master WHERE type = '
|
|
66
|
+
"SELECT sql FROM sqlite_master WHERE type = 'index' AND name = 'idx_approval_requests_pending_created'",
|
|
79
67
|
)
|
|
80
68
|
.get()?.sql;
|
|
81
|
-
expect(
|
|
82
|
-
|
|
69
|
+
expect(indexSql?.replace(/\s+/g, " ").trim()).toBe(
|
|
70
|
+
"CREATE INDEX idx_approval_requests_pending_created ON approval_requests(createdAt) WHERE status = 'pending' AND expiresAt IS NULL",
|
|
71
|
+
);
|
|
83
72
|
|
|
84
73
|
const insert = (id: string, status: string) =>
|
|
85
74
|
db.run(
|
|
@@ -137,6 +137,7 @@ describe("resolved approval Slack card", () => {
|
|
|
137
137
|
await settle(1);
|
|
138
138
|
|
|
139
139
|
expect(updates).toHaveLength(1);
|
|
140
|
+
expect(posts).toHaveLength(0);
|
|
140
141
|
const call = updates[0]!;
|
|
141
142
|
expect(call.channel).toBe("C0CHAN");
|
|
142
143
|
expect(call.ts).toBe("1700000000.000100");
|
|
@@ -153,14 +154,6 @@ describe("resolved approval Slack card", () => {
|
|
|
153
154
|
expect(text).not.toContain("Approval Required");
|
|
154
155
|
});
|
|
155
156
|
|
|
156
|
-
test("rejected: header names the responder", async () => {
|
|
157
|
-
const approval = await createPosted();
|
|
158
|
-
await resolveApprovalRequest(approval.id, { status: "rejected", resolvedBy: "operator" });
|
|
159
|
-
await settle(1);
|
|
160
|
-
expect(updates).toHaveLength(1);
|
|
161
|
-
expect(cardText(updates[0]!)).toContain("❌ *Rejected by operator*");
|
|
162
|
-
});
|
|
163
|
-
|
|
164
157
|
for (const status of ["approved", "rejected"] as const) {
|
|
165
158
|
for (const identity of ["email", "name", "unknown", "missing"] as const) {
|
|
166
159
|
test(`${status}: operator vote displays ${identity} claim`, async () => {
|
|
@@ -199,7 +192,7 @@ describe("resolved approval Slack card", () => {
|
|
|
199
192
|
: `operator key (as ${user.name})`;
|
|
200
193
|
expect(updates).toHaveLength(1);
|
|
201
194
|
expect(cardText(updates[0]!)).toContain(
|
|
202
|
-
|
|
195
|
+
`${status === "approved" ? "✅ *Approved" : "❌ *Rejected"} by ${expected}*`,
|
|
203
196
|
);
|
|
204
197
|
expect(resolved?.resolvedBy).toBe("operator");
|
|
205
198
|
expect(resolved?.approvals?.[1]?.responder).toBe("operator");
|
|
@@ -391,12 +384,4 @@ describe("resolved approval Slack card", () => {
|
|
|
391
384
|
expect(posts).toHaveLength(1);
|
|
392
385
|
expect(posts[0]!).toMatchObject({ channel: botDm("U0NEW"), thread_ts: "1700000000.000200" });
|
|
393
386
|
});
|
|
394
|
-
|
|
395
|
-
test("a stored channelId or a channel target is edited in place", async () => {
|
|
396
|
-
await resolveApprovalRequest((await createPosted()).id, { status: "approved" });
|
|
397
|
-
await settle(1);
|
|
398
|
-
expect(updates).toHaveLength(1);
|
|
399
|
-
expect(updates[0]!.channel).toBe("C0CHAN");
|
|
400
|
-
expect(posts).toHaveLength(0);
|
|
401
|
-
});
|
|
402
387
|
});
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
afterAll,
|
|
3
|
+
afterEach,
|
|
4
|
+
beforeAll,
|
|
5
|
+
beforeEach,
|
|
6
|
+
describe,
|
|
7
|
+
expect,
|
|
8
|
+
mock,
|
|
9
|
+
spyOn,
|
|
10
|
+
test,
|
|
11
|
+
} from "bun:test";
|
|
2
12
|
import { unlink } from "node:fs/promises";
|
|
3
13
|
import { createServer as createHttpServer, type Server } from "node:http";
|
|
4
14
|
|
|
@@ -21,6 +31,7 @@ import {
|
|
|
21
31
|
} from "../be/db";
|
|
22
32
|
import { handleApprovalRequests } from "../http/approval-requests";
|
|
23
33
|
import { resetExternalChannelStateForTesting } from "../slack/external-channel";
|
|
34
|
+
import * as approvalNotifications from "../workflows/approval-notifications";
|
|
24
35
|
import { listenOnFreePort } from "./test-net";
|
|
25
36
|
|
|
26
37
|
const TEST_DB_PATH = "./test-approval-requests-notifications.sqlite";
|
|
@@ -30,9 +41,15 @@ let baseUrl = "";
|
|
|
30
41
|
let leadId = "";
|
|
31
42
|
let workerId = "";
|
|
32
43
|
let originalBlockExternalChannels: string | undefined;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
44
|
+
let dispatch: ReturnType<
|
|
45
|
+
typeof spyOn<typeof approvalNotifications, "dispatchApprovalNotifications">
|
|
46
|
+
>;
|
|
47
|
+
|
|
48
|
+
async function postRequest(
|
|
49
|
+
body: Record<string, unknown>,
|
|
50
|
+
agentId: string | null,
|
|
51
|
+
): Promise<Response> {
|
|
52
|
+
const response = await fetch(`${baseUrl}/api/approval-requests`, {
|
|
36
53
|
method: "POST",
|
|
37
54
|
headers: {
|
|
38
55
|
"Content-Type": "application/json",
|
|
@@ -45,6 +62,8 @@ function postRequest(body: Record<string, unknown>, agentId: string | null): Pro
|
|
|
45
62
|
...body,
|
|
46
63
|
}),
|
|
47
64
|
});
|
|
65
|
+
await Promise.all(dispatch.mock.results.map((result) => result.value));
|
|
66
|
+
return response;
|
|
48
67
|
}
|
|
49
68
|
|
|
50
69
|
async function createRequest(body: Record<string, unknown>, agentId = leadId): Promise<string> {
|
|
@@ -54,13 +73,6 @@ async function createRequest(body: Record<string, unknown>, agentId = leadId): P
|
|
|
54
73
|
return json.approvalRequest.id;
|
|
55
74
|
}
|
|
56
75
|
|
|
57
|
-
async function waitFor(check: () => Promise<boolean>): Promise<void> {
|
|
58
|
-
for (let i = 0; i < 100; i++) {
|
|
59
|
-
if (await check()) return;
|
|
60
|
-
await Bun.sleep(10);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
76
|
describe("POST /api/approval-requests notifications", () => {
|
|
65
77
|
beforeAll(async () => {
|
|
66
78
|
try {
|
|
@@ -96,6 +108,7 @@ describe("POST /api/approval-requests notifications", () => {
|
|
|
96
108
|
});
|
|
97
109
|
|
|
98
110
|
beforeEach(() => {
|
|
111
|
+
dispatch = spyOn(approvalNotifications, "dispatchApprovalNotifications");
|
|
99
112
|
originalBlockExternalChannels = process.env.SLACK_BLOCK_EXTERNAL_CHANNELS;
|
|
100
113
|
postMessage.mockClear();
|
|
101
114
|
conversationsInfo.mockClear();
|
|
@@ -103,11 +116,17 @@ describe("POST /api/approval-requests notifications", () => {
|
|
|
103
116
|
delete process.env.SLACK_BLOCK_EXTERNAL_CHANNELS;
|
|
104
117
|
});
|
|
105
118
|
|
|
106
|
-
afterEach(() => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
119
|
+
afterEach(async () => {
|
|
120
|
+
try {
|
|
121
|
+
await Promise.allSettled(dispatch.mock.results.map((result) => result.value));
|
|
122
|
+
} finally {
|
|
123
|
+
dispatch.mockRestore();
|
|
124
|
+
if (originalBlockExternalChannels === undefined) {
|
|
125
|
+
delete process.env.SLACK_BLOCK_EXTERNAL_CHANNELS;
|
|
126
|
+
} else {
|
|
127
|
+
process.env.SLACK_BLOCK_EXTERNAL_CHANNELS = originalBlockExternalChannels;
|
|
128
|
+
}
|
|
129
|
+
resetExternalChannelStateForTesting();
|
|
111
130
|
}
|
|
112
131
|
});
|
|
113
132
|
|
|
@@ -118,12 +137,7 @@ describe("POST /api/approval-requests notifications", () => {
|
|
|
118
137
|
notifications: [{ channel: "slack", target: "C123" }],
|
|
119
138
|
});
|
|
120
139
|
|
|
121
|
-
|
|
122
|
-
const row = await getApprovalRequestById(id);
|
|
123
|
-
const channels = row?.notificationChannels as Array<{ messageTs?: string }> | null;
|
|
124
|
-
return Boolean(channels?.[0]?.messageTs);
|
|
125
|
-
});
|
|
126
|
-
|
|
140
|
+
expect(dispatch).toHaveBeenCalledTimes(1);
|
|
127
141
|
expect(postMessage).toHaveBeenCalledTimes(1);
|
|
128
142
|
const args = postMessage.mock.calls[0]![0];
|
|
129
143
|
expect(args.channel).toBe("C123");
|
|
@@ -143,9 +157,8 @@ describe("POST /api/approval-requests notifications", () => {
|
|
|
143
157
|
|
|
144
158
|
test("posts nothing without notifications", async () => {
|
|
145
159
|
const id = await createRequest({});
|
|
146
|
-
await Bun.sleep(50);
|
|
147
|
-
|
|
148
160
|
expect(postMessage).not.toHaveBeenCalled();
|
|
161
|
+
expect(dispatch).toHaveBeenCalledTimes(0);
|
|
149
162
|
expect((await getApprovalRequestById(id))?.notificationChannels).toBeNull();
|
|
150
163
|
});
|
|
151
164
|
|
|
@@ -153,7 +166,7 @@ describe("POST /api/approval-requests notifications", () => {
|
|
|
153
166
|
const id = await createRequest({
|
|
154
167
|
notifications: [{ channel: "email", target: "ops@example.com" }],
|
|
155
168
|
});
|
|
156
|
-
|
|
169
|
+
expect(dispatch).toHaveBeenCalledTimes(1);
|
|
157
170
|
|
|
158
171
|
expect(postMessage).not.toHaveBeenCalled();
|
|
159
172
|
expect((await getApprovalRequestById(id))?.notificationChannels).toEqual([
|
|
@@ -172,6 +185,7 @@ describe("POST /api/approval-requests notifications", () => {
|
|
|
172
185
|
expect(res.status).toBe(403);
|
|
173
186
|
expect((await listApprovalRequests()).length).toBe(before);
|
|
174
187
|
}
|
|
188
|
+
expect(dispatch).not.toHaveBeenCalled();
|
|
175
189
|
expect(postMessage).not.toHaveBeenCalled();
|
|
176
190
|
});
|
|
177
191
|
|
|
@@ -180,6 +194,7 @@ describe("POST /api/approval-requests notifications", () => {
|
|
|
180
194
|
{ notifications: [{ channel: "email", target: "ops@example.com" }] },
|
|
181
195
|
workerId,
|
|
182
196
|
);
|
|
197
|
+
expect(dispatch).toHaveBeenCalledTimes(1);
|
|
183
198
|
});
|
|
184
199
|
|
|
185
200
|
test("skips a channel shared with another org when the external-channel block is on", async () => {
|
|
@@ -187,8 +202,7 @@ describe("POST /api/approval-requests notifications", () => {
|
|
|
187
202
|
conversationsInfo.mockImplementationOnce(async () => ({ channel: { is_ext_shared: true } }));
|
|
188
203
|
|
|
189
204
|
const id = await createRequest({ notifications: [{ channel: "slack", target: "CEXT" }] });
|
|
190
|
-
|
|
191
|
-
await Bun.sleep(50);
|
|
205
|
+
expect(dispatch).toHaveBeenCalledTimes(1);
|
|
192
206
|
|
|
193
207
|
expect(conversationsInfo).toHaveBeenCalledWith({ channel: "CEXT" });
|
|
194
208
|
expect(postMessage).not.toHaveBeenCalled();
|