@desplega.ai/agent-swarm 1.126.1 → 1.127.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +2 -2
  2. package/dist/{actions-pr0awmcg.js → actions-7rtnkgg1.js} +7 -7
  3. package/dist/{app-kbzfgyey.js → app-nzapk6n4.js} +4 -4
  4. package/dist/{assistant-vr8arc5z.js → assistant-1c7eeqqe.js} +9 -9
  5. package/dist/{boot-reembed-psn36zf1.js → boot-reembed-eaxtqx5j.js} +5 -5
  6. package/dist/{boot-reembed-cg7df7q1.js → boot-reembed-eqpz4ebp.js} +4 -4
  7. package/dist/{boot-scrub-logs-5kmrkcjw.js → boot-scrub-logs-60kp18hr.js} +3 -3
  8. package/dist/{cli-5z2z3g6b.js → cli-11zvyap7.js} +6 -6
  9. package/dist/{cli-ft5t0yrn.js → cli-44d54bm6.js} +4 -4
  10. package/dist/{cli-jmgyb1eq.js → cli-6xkssbn6.js} +2 -2
  11. package/dist/{cli-wv0crj18.js → cli-8hhc59nf.js} +1 -1
  12. package/dist/{cli-4yz5rd62.js → cli-9885yxs8.js} +1 -1
  13. package/dist/{cli-hqvf4ed9.js → cli-eej290tp.js} +1 -1
  14. package/dist/{cli-bj4ra6x8.js → cli-hb2h4hc3.js} +1 -1
  15. package/dist/{cli-afhc1avq.js → cli-hp4q2958.js} +1 -1
  16. package/dist/{cli-c4f49bv5.js → cli-hzad20bp.js} +3 -3
  17. package/dist/{cli-gs7g55h5.js → cli-jr44d2f1.js} +23 -9
  18. package/dist/{cli-y1d8824j.js → cli-p8zkbans.js} +1 -1
  19. package/dist/{cli-5x6g59th.js → cli-peycqz69.js} +1 -1
  20. package/dist/{cli-sg9et3f3.js → cli-qak9hhat.js} +2 -2
  21. package/dist/{cli-vj5dhwap.js → cli-qbd5m8kt.js} +2 -2
  22. package/dist/{cli-nh38ds38.js → cli-qg64w6q1.js} +2 -2
  23. package/dist/{cli-cq3vdb5f.js → cli-qjm63te9.js} +1 -1
  24. package/dist/{cli-jgtghmhz.js → cli-rhc2487d.js} +129 -69
  25. package/dist/{cli-90yzwka4.js → cli-sffrtgtc.js} +1 -1
  26. package/dist/{cli-7btwpbce.js → cli-t3sr2z92.js} +2 -2
  27. package/dist/{cli-p8kqdvay.js → cli-tb21ewy8.js} +8 -8
  28. package/dist/{cli-da6r73tg.js → cli-tfev56s0.js} +1 -1
  29. package/dist/{cli-6tqz94c0.js → cli-tzv26pr3.js} +4 -4
  30. package/dist/{cli-jvrynjae.js → cli-w7rwwnna.js} +22 -5
  31. package/dist/{cli-dwab6m0t.js → cli-wd6tzh2d.js} +2 -2
  32. package/dist/{cli-m7z29jt3.js → cli-xgzbt8q8.js} +2 -2
  33. package/dist/{cli-1fv0qxms.js → cli-ypk1wk3w.js} +4 -4
  34. package/dist/{cli-bm3pgsh5.js → cli-zqyfszjt.js} +9 -6
  35. package/dist/cli.js +10 -10
  36. package/dist/{codex-hook-5tdxqhpe.js → codex-hook-tyqm0gpy.js} +2 -2
  37. package/dist/{commands-wcpgyfg0.js → commands-xvga3ah5.js} +3 -3
  38. package/dist/{db-r6eqntx8.js → db-8pexw8am.js} +5 -3
  39. package/dist/{handlers-1mp32c7k.js → handlers-qyd621jc.js} +9 -9
  40. package/dist/{hook-mnzsezsa.js → hook-qc7d1699.js} +1 -1
  41. package/dist/{http-r4e6xg5v.js → http-5k8re84v.js} +61 -40
  42. package/dist/{index-fvjh1s6f.js → index-64qfkqge.js} +11 -11
  43. package/dist/{index-9xt5q3wx.js → index-6gf66ffb.js} +8 -8
  44. package/dist/{index-h9a2rjqz.js → index-9fh62krd.js} +10 -10
  45. package/dist/{index-tcy3cyxb.js → index-b5jcnrdd.js} +12 -12
  46. package/dist/{keepalive-0ag082m0.js → keepalive-rqtqvpxe.js} +6 -6
  47. package/dist/{lead-w0kvabkf.js → lead-snxq89qj.js} +22 -22
  48. package/dist/{maintenance-mafpkbhv.js → maintenance-hsq6ghnr.js} +5 -5
  49. package/dist/{oauth-refresh-sweep-4an3rn3k.js → oauth-refresh-sweep-xmtzyzm3.js} +5 -5
  50. package/dist/{onboard-4ew5r5fs.js → onboard-rt17y72c.js} +2 -2
  51. package/dist/{otel-impl-63fy87ma.js → otel-impl-07m8p1v4.js} +1 -1
  52. package/dist/{pricing-refresh-fj513s7s.js → pricing-refresh-r1xrd9b4.js} +5 -5
  53. package/dist/{rbac-roles-0c1cy3k3.js → rbac-roles-hrey7893.js} +5 -5
  54. package/dist/{rbac-roles-yqc4kcjr.js → rbac-roles-zcktkbdr.js} +4 -4
  55. package/dist/{render-v2-t2nzvdtf.js → render-v2-fg7gvz0p.js} +4 -4
  56. package/dist/{seed-pricing-5f9jgqs9.js → seed-pricing-r16hf66b.js} +4 -4
  57. package/dist/{setup-t8ve3zjz.js → setup-1b40we1g.js} +2 -2
  58. package/dist/{worker-rsc6tw0v.js → worker-k8ptcfv7.js} +22 -22
  59. package/openapi.json +16 -1
  60. package/package.json +1 -1
  61. package/src/be/db.ts +37 -2
  62. package/src/commands/runner.ts +8 -0
  63. package/src/http/tasks.ts +38 -1
  64. package/src/prompts/session-templates.ts +3 -3
  65. package/src/scripts-runtime/swarm-sdk.ts +1 -0
  66. package/src/slack/render-v2.ts +24 -2
  67. package/src/tasks/terminal-result-guard.ts +121 -0
  68. package/src/tests/http-api-integration.test.ts +77 -0
  69. package/src/tests/prompt-template-session.test.ts +16 -1
  70. package/src/tests/runner-fallback-output.test.ts +31 -2
  71. package/src/tests/sdk-allowlist.test.ts +36 -0
  72. package/src/tests/slack-render-v2.test.ts +137 -0
  73. package/src/tests/store-progress-attachments-handler.test.ts +5 -2
  74. package/src/tests/task-cancellation.test.ts +2 -2
  75. package/src/tests/task-cascade-fail.test.ts +9 -9
  76. package/src/tests/task-completion-idempotency.test.ts +289 -10
  77. package/src/tests/task-pause-resume.test.ts +15 -15
  78. package/src/tests/tasks-requested-by-filter.test.ts +211 -0
  79. package/src/tools/slack-reply.ts +1 -1
  80. package/src/tools/store-progress.ts +49 -44
package/README.md CHANGED
@@ -146,7 +146,7 @@ Check [our templates](https://templates.agent-swarm.dev) for a quick start.
146
146
  - **Config-driven metrics dashboards** — define read-only SQL widgets, version them, and render them in the dashboard without shipping custom frontend code. [Metrics API →](https://docs.agent-swarm.dev/docs/api-reference/stats)
147
147
  - **DB-backed pages** — agents publish HTML or JSON pages (reports, dashboards, action specs) via `create_page`, remove stale pages with `delete-page`, and share them with public / authed / password modes, version history, view counters, diff helpers, and PDF export. [MCP tools → Pages](https://docs.agent-swarm.dev/docs/reference/mcp-tools#pages-tools)
148
148
  - **KV store** — Redis-like namespaced key/value store with auto-scoped context (Slack thread / PR / Linear issue / page). [MCP tools → KV](https://docs.agent-swarm.dev/docs/reference/mcp-tools#kv-tools)
149
- - **Real-time dashboard + task attachments** — monitor agents, tasks, and inter-agent chat; rename sessions inline; search a broad Lucide catalog to customize each agent's icon and color; filter Pages, Approval Requests, and workflow definitions with URL-backed search/facets; create tasks with uploaded files from the sessions composer; and preview task attachments inline above session prompts. [app.agent-swarm.dev →](https://app.agent-swarm.dev)
149
+ - **Real-time dashboard + task attachments** — monitor agents, tasks, and inter-agent chat; filter tasks by requester (including yourself or unattributed work); rename sessions inline; search a broad Lucide catalog to customize each agent's icon and color; filter Pages, Approval Requests, and workflow definitions with URL-backed search/facets; create tasks with uploaded files from the sessions composer; and preview task attachments inline above session prompts. [app.agent-swarm.dev →](https://app.agent-swarm.dev)
150
150
 
151
151
  ## Quick Start
152
152
 
@@ -221,7 +221,7 @@ Missing one? Ask the swarm to build it.
221
221
 
222
222
  ## Dashboard
223
223
 
224
- Real-time monitoring of agents, tasks, and inter-agent chat. Session titles can be renamed inline, and agent profiles can search hundreds of Lucide icons, pick a color, and retain deterministic defaults when no customization is set. Use the hosted version at [app.agent-swarm.dev](https://app.agent-swarm.dev), or run locally:
224
+ Real-time monitoring of agents, tasks, and inter-agent chat. The task list can be filtered by requester, including **Me** and **Unattributed**, while keeping the selection in the page URL. Session titles can be renamed inline, and agent profiles can search hundreds of Lucide icons, pick a color, and retain deterministic defaults when no customization is set. Use the hosted version at [app.agent-swarm.dev](https://app.agent-swarm.dev), or run locally:
225
225
 
226
226
  ```bash
227
227
  cd apps/ui && bun install && bun run dev
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  resolveSlackUserId
3
- } from "./cli-m7z29jt3.js";
4
- import"./cli-afhc1avq.js";
3
+ } from "./cli-xgzbt8q8.js";
4
+ import"./cli-hp4q2958.js";
5
5
  import {
6
6
  createTaskWithSiblingAwareness
7
- } from "./cli-bj4ra6x8.js";
7
+ } from "./cli-hb2h4hc3.js";
8
8
  import {
9
9
  buildCancelledBlocks,
10
10
  ensureSlackThreadTree,
11
11
  getTaskLink,
12
12
  isSlackRenderV2Enabled
13
- } from "./cli-gs7g55h5.js";
13
+ } from "./cli-jr44d2f1.js";
14
14
  import"./cli-rkndnn90.js";
15
15
  import"./cli-b0p7rfnd.js";
16
16
  import"./cli-wspgs9bt.js";
@@ -23,11 +23,11 @@ import {
23
23
  init_context_key,
24
24
  init_db,
25
25
  slackContextKey
26
- } from "./cli-jvrynjae.js";
27
- import"./cli-c4f49bv5.js";
26
+ } from "./cli-w7rwwnna.js";
27
+ import"./cli-hzad20bp.js";
28
28
  import"./cli-z2zcxes1.js";
29
29
  import"./cli-bw80ck94.js";
30
- import"./cli-wv0crj18.js";
30
+ import"./cli-8hhc59nf.js";
31
31
  import"./cli-4j2mrzag.js";
32
32
  import"./cli-xz9aq0rf.js";
33
33
  import"./cli-e15jhafb.js";
@@ -3,16 +3,16 @@ import {
3
3
  initSlackApp,
4
4
  startSlackApp,
5
5
  stopSlackApp
6
- } from "./cli-gs7g55h5.js";
6
+ } from "./cli-jr44d2f1.js";
7
7
  import"./cli-rkndnn90.js";
8
8
  import"./cli-b0p7rfnd.js";
9
9
  import"./cli-wspgs9bt.js";
10
10
  import"./cli-dh55d5fg.js";
11
- import"./cli-jvrynjae.js";
12
- import"./cli-c4f49bv5.js";
11
+ import"./cli-w7rwwnna.js";
12
+ import"./cli-hzad20bp.js";
13
13
  import"./cli-z2zcxes1.js";
14
14
  import"./cli-bw80ck94.js";
15
- import"./cli-wv0crj18.js";
15
+ import"./cli-8hhc59nf.js";
16
16
  import"./cli-4j2mrzag.js";
17
17
  import"./cli-xz9aq0rf.js";
18
18
  import"./cli-e15jhafb.js";
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  bufferThreadMessage,
3
3
  wasEventSeen
4
- } from "./cli-5z2z3g6b.js";
4
+ } from "./cli-11zvyap7.js";
5
5
  import {
6
6
  hasOtherUserMention
7
- } from "./cli-7btwpbce.js";
7
+ } from "./cli-t3sr2z92.js";
8
8
  import {
9
9
  resolveSlackUserId,
10
10
  rewriteSlackMentions
11
- } from "./cli-m7z29jt3.js";
12
- import"./cli-afhc1avq.js";
11
+ } from "./cli-xgzbt8q8.js";
12
+ import"./cli-hp4q2958.js";
13
13
  import {
14
14
  createTaskWithSiblingAwareness
15
- } from "./cli-bj4ra6x8.js";
15
+ } from "./cli-hb2h4hc3.js";
16
16
  import {
17
17
  ensureSlackThreadTree,
18
18
  isSlackRenderV2Enabled,
19
19
  require_dist
20
- } from "./cli-gs7g55h5.js";
20
+ } from "./cli-jr44d2f1.js";
21
21
  import"./cli-rkndnn90.js";
22
22
  import"./cli-b0p7rfnd.js";
23
23
  import"./cli-wspgs9bt.js";
@@ -29,16 +29,16 @@ import {
29
29
  init_context_key,
30
30
  init_db,
31
31
  slackContextKey
32
- } from "./cli-jvrynjae.js";
32
+ } from "./cli-w7rwwnna.js";
33
33
  import {
34
34
  init_env_flag,
35
35
  init_resolver,
36
36
  isEnvFlagEnabled,
37
37
  resolveTemplate
38
- } from "./cli-c4f49bv5.js";
38
+ } from "./cli-hzad20bp.js";
39
39
  import"./cli-z2zcxes1.js";
40
40
  import"./cli-bw80ck94.js";
41
- import"./cli-wv0crj18.js";
41
+ import"./cli-8hhc59nf.js";
42
42
  import"./cli-4j2mrzag.js";
43
43
  import"./cli-xz9aq0rf.js";
44
44
  import"./cli-e15jhafb.js";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  embedScript,
3
3
  embeddingProvider
4
- } from "./cli-dwab6m0t.js";
5
- import"./cli-90yzwka4.js";
4
+ } from "./cli-wd6tzh2d.js";
5
+ import"./cli-sffrtgtc.js";
6
6
  import"./cli-q25ejbyn.js";
7
7
  import {
8
8
  getDb,
9
9
  init_db
10
- } from "./cli-jvrynjae.js";
11
- import"./cli-c4f49bv5.js";
10
+ } from "./cli-w7rwwnna.js";
11
+ import"./cli-hzad20bp.js";
12
12
  import"./cli-z2zcxes1.js";
13
13
  import"./cli-bw80ck94.js";
14
- import"./cli-wv0crj18.js";
14
+ import"./cli-8hhc59nf.js";
15
15
  import"./cli-4j2mrzag.js";
16
16
  import"./cli-xz9aq0rf.js";
17
17
  import"./cli-p9swy5t3.js";
@@ -3,16 +3,16 @@ import {
3
3
  getEmbeddingProvider,
4
4
  getMemoryStore,
5
5
  init_constants
6
- } from "./cli-90yzwka4.js";
6
+ } from "./cli-sffrtgtc.js";
7
7
  import"./cli-q25ejbyn.js";
8
8
  import {
9
9
  getDb,
10
10
  init_db
11
- } from "./cli-jvrynjae.js";
12
- import"./cli-c4f49bv5.js";
11
+ } from "./cli-w7rwwnna.js";
12
+ import"./cli-hzad20bp.js";
13
13
  import"./cli-z2zcxes1.js";
14
14
  import"./cli-bw80ck94.js";
15
- import"./cli-wv0crj18.js";
15
+ import"./cli-8hhc59nf.js";
16
16
  import"./cli-4j2mrzag.js";
17
17
  import"./cli-xz9aq0rf.js";
18
18
  import"./cli-p9swy5t3.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-jvrynjae.js";
5
- import"./cli-c4f49bv5.js";
4
+ } from "./cli-w7rwwnna.js";
5
+ import"./cli-hzad20bp.js";
6
6
  import"./cli-z2zcxes1.js";
7
7
  import"./cli-bw80ck94.js";
8
- import"./cli-wv0crj18.js";
8
+ import"./cli-8hhc59nf.js";
9
9
  import {
10
10
  init_secret_scrubber,
11
11
  scrubSecrets
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  createAdditiveBuffer,
3
3
  extractSlackMessageText
4
- } from "./cli-7btwpbce.js";
4
+ } from "./cli-t3sr2z92.js";
5
5
  import {
6
6
  rewriteSlackMentions
7
- } from "./cli-m7z29jt3.js";
7
+ } from "./cli-xgzbt8q8.js";
8
8
  import {
9
9
  createTaskWithSiblingAwareness
10
- } from "./cli-bj4ra6x8.js";
10
+ } from "./cli-hb2h4hc3.js";
11
11
  import {
12
12
  buildBufferFlushBlocks,
13
13
  ensureSlackThreadTree,
14
14
  getSlackApp,
15
15
  isSlackRenderV2Enabled,
16
16
  registerTreeMessage
17
- } from "./cli-gs7g55h5.js";
17
+ } from "./cli-jr44d2f1.js";
18
18
  import {
19
19
  getLatestActiveTaskInThread,
20
20
  getLatestLeadTaskInThread,
@@ -25,13 +25,13 @@ import {
25
25
  init_steering,
26
26
  requestSteering,
27
27
  slackContextKey
28
- } from "./cli-jvrynjae.js";
28
+ } from "./cli-w7rwwnna.js";
29
29
  import {
30
30
  init_registry,
31
31
  init_steering_enabled,
32
32
  isSteeringEnabled,
33
33
  registerTemplate
34
- } from "./cli-c4f49bv5.js";
34
+ } from "./cli-hzad20bp.js";
35
35
 
36
36
  // src/slack/event-dedup.ts
37
37
  var DEFAULT_TTL_MS = 300000;
@@ -3,7 +3,7 @@ import {
3
3
  } from "./cli-jkhwmmgg.js";
4
4
  import {
5
5
  embedScript
6
- } from "./cli-dwab6m0t.js";
6
+ } from "./cli-wd6tzh2d.js";
7
7
  import {
8
8
  calculatePKCECodeChallenge,
9
9
  generateRandomCodeVerifier,
@@ -12,7 +12,7 @@ import {
12
12
  getOAuthAppById,
13
13
  updateAuthorizationTokens,
14
14
  upsertAuthorization
15
- } from "./cli-y1d8824j.js";
15
+ } from "./cli-p8zkbans.js";
16
16
  import {
17
17
  computeContentHash,
18
18
  decryptSecret,
@@ -28,11 +28,11 @@ import {
28
28
  normalizeDateRequired,
29
29
  placeholderForConfigKey,
30
30
  upsertSwarmConfig
31
- } from "./cli-jvrynjae.js";
31
+ } from "./cli-w7rwwnna.js";
32
32
  import {
33
33
  init_env_flag,
34
34
  isEnvFlagEnabled
35
- } from "./cli-c4f49bv5.js";
35
+ } from "./cli-hzad20bp.js";
36
36
  import {
37
37
  init_zod
38
38
  } from "./cli-bw80ck94.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  PermissionVerbSchema
3
- } from "./cli-5x6g59th.js";
3
+ } from "./cli-peycqz69.js";
4
4
  import {
5
5
  getDb,
6
6
  init_db
7
- } from "./cli-jvrynjae.js";
7
+ } from "./cli-w7rwwnna.js";
8
8
 
9
9
  // src/be/rbac-roles.ts
10
10
  init_db();
@@ -7,7 +7,7 @@ var package_default;
7
7
  var init_package = __esm(() => {
8
8
  package_default = {
9
9
  name: "@desplega.ai/agent-swarm",
10
- version: "1.126.1",
10
+ version: "1.127.1",
11
11
  description: "agent-swarm.dev — an open-source operating system for AI work: a lead agent breaks goals into tasks, routes them to specialized workers such as Claude Code or Codex, runs each worker in an isolated container, and preserves shared memory, tools, schedules, and review gates so delegated work compounds across sessions.",
12
12
  keywords: [
13
13
  "agent-swarm.dev",
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-jvrynjae.js";
4
+ } from "./cli-w7rwwnna.js";
5
5
 
6
6
  // src/be/seed-pricing.ts
7
7
  init_db();
@@ -11,7 +11,7 @@ import {
11
11
  markAuthorizationRefreshFailed,
12
12
  releaseOAuthRefreshLock,
13
13
  updateAuthorizationTokens
14
- } from "./cli-y1d8824j.js";
14
+ } from "./cli-p8zkbans.js";
15
15
  import {
16
16
  init_secret_scrubber,
17
17
  registerVolatileSecret,
@@ -3,7 +3,7 @@ import {
3
3
  getAgentById,
4
4
  getInProgressTasksByContextKey,
5
5
  init_db
6
- } from "./cli-jvrynjae.js";
6
+ } from "./cli-w7rwwnna.js";
7
7
 
8
8
  // src/tasks/sibling-awareness.ts
9
9
  init_db();
@@ -4,7 +4,7 @@ import {
4
4
  incrKv,
5
5
  init_db,
6
6
  upsertKv
7
- } from "./cli-jvrynjae.js";
7
+ } from "./cli-w7rwwnna.js";
8
8
 
9
9
  // src/be/users.ts
10
10
  init_db();
@@ -358,7 +358,7 @@ The system reads your \`/workspace/HEARTBEAT.md\` every 30 minutes. If it has co
358
358
 
359
359
  **Slack context inheritance:** For follow-up tasks using \`parentTaskId\`, Slack metadata (channelId, threadTs, userId) auto-inherits.
360
360
 
361
- **Slack provenance:** The engine owns the thread tree and top-level outcome cards. Do not relay worker output or routine completion receipts with \`slack-reply\`. Use Slack posting tools only when you explicitly choose to send a distinct agent-authored message.
361
+ **Slack provenance:** The engine owns the thread tree and top-level outcome cards. Use Slack posting tools only for a distinct agent-authored message, and prefer one reply per task over several. Do not relay worker output or post progress, receipt, or acknowledgment messages. Keep the message concrete and match its length to what the user asked for.
362
362
 
363
363
  **Slack standing orders:** If you maintain heartbeat standing orders, check Slack for unaddressed requests older than 1 hour when appropriate.
364
364
  `,
@@ -452,7 +452,7 @@ You may receive steering messages while this task is running. Each one arrives w
452
452
  defaultBody: `
453
453
  #### Slack Thread Updates
454
454
 
455
- This task originated from Slack (channel: \`{{slackChannelId}}\`). The engine automatically maintains the thread tree and publishes the top-level outcome card. Do not post routine start, completion, or failure receipts, and do not relay raw task output. Use \`slack-reply\` only when you explicitly choose to send a distinct agent-authored message.
455
+ This task originated from Slack (channel: \`{{slackChannelId}}\`). The engine automatically maintains the thread tree and publishes the top-level outcome card. Do not post progress, start, completion, failure, or acknowledgment messages, and do not relay raw task output. Use \`slack-reply\` only for a distinct agent-authored message; prefer one reply per task over several, keep it concrete, and match its length to what the user asked for.
456
456
  `,
457
457
  variables: [
458
458
  { name: "slackChannelId", description: "The Slack channel ID for the originating thread" },
@@ -760,7 +760,7 @@ Rules of the road:
760
760
  defaultBody: `
761
761
  #### Slack Thread Updates (scripts-only)
762
762
 
763
- This task originated from Slack (channel: \`{{slackChannelId}}\`). The engine automatically maintains the thread tree and publishes the top-level outcome card. Do not post routine start, completion, or failure receipts, and do not relay raw task output. If you explicitly choose to send a distinct agent-authored message, named Slack tools are not exposed in scripts-only mode, so use \`script-run\` with inline source calling \`ctx.swarm.slack_reply({ taskId, message })\` (your taskId carries the thread context).
763
+ This task originated from Slack (channel: \`{{slackChannelId}}\`). The engine automatically maintains the thread tree and publishes the top-level outcome card. Do not post progress, start, completion, failure, or acknowledgment messages, and do not relay raw task output. Send only a distinct agent-authored message; prefer one reply per task over several, keep it concrete, and match its length to what the user asked for. Named Slack tools are not exposed in scripts-only mode, so use \`script-run\` with inline source calling \`ctx.swarm.slack_reply({ taskId, message })\` (your taskId carries the thread context).
764
764
  `,
765
765
  variables: [
766
766
  { name: "slackChannelId", description: "The Slack channel ID for the originating thread" },
@@ -37,11 +37,11 @@ import {
37
37
  setSlackMessageTracking,
38
38
  slackContextKey,
39
39
  updateSlackMessageRecord
40
- } from "./cli-jvrynjae.js";
40
+ } from "./cli-w7rwwnna.js";
41
41
  import {
42
42
  init_env_flag,
43
43
  isEnvFlagEnabled
44
- } from "./cli-c4f49bv5.js";
44
+ } from "./cli-hzad20bp.js";
45
45
  import {
46
46
  require_receiver,
47
47
  require_sender,
@@ -55405,13 +55405,13 @@ async function initSlackApp() {
55405
55405
  socketMode: true,
55406
55406
  logLevel: import_bolt.LogLevel.DEBUG
55407
55407
  });
55408
- const { registerMessageHandler } = await import("./handlers-1mp32c7k.js");
55409
- const { registerCommandHandler } = await import("./commands-wcpgyfg0.js");
55410
- const { registerActionHandlers } = await import("./actions-pr0awmcg.js");
55408
+ const { registerMessageHandler } = await import("./handlers-qyd621jc.js");
55409
+ const { registerCommandHandler } = await import("./commands-xvga3ah5.js");
55410
+ const { registerActionHandlers } = await import("./actions-7rtnkgg1.js");
55411
55411
  registerMessageHandler(app);
55412
55412
  registerCommandHandler(app);
55413
55413
  registerActionHandlers(app);
55414
- const { createAssistant } = await import("./assistant-vr8arc5z.js");
55414
+ const { createAssistant } = await import("./assistant-1c7eeqqe.js");
55415
55415
  app.assistant(createAssistant());
55416
55416
  return app;
55417
55417
  }
@@ -55420,7 +55420,7 @@ async function startSlackApp() {
55420
55420
  await initSlackApp();
55421
55421
  }
55422
55422
  if (app) {
55423
- const { isSlackRenderV2Enabled: isSlackRenderV2Enabled2 } = await import("./render-v2-t2nzvdtf.js");
55423
+ const { isSlackRenderV2Enabled: isSlackRenderV2Enabled2 } = await import("./render-v2-fg7gvz0p.js");
55424
55424
  if (isSlackRenderV2Enabled2())
55425
55425
  ensureSlackRenderV2Activation();
55426
55426
  await app.start();
@@ -55870,7 +55870,7 @@ function isOutcomeStatus(status) {
55870
55870
  function outcomeText(value, fallback) {
55871
55871
  return value?.trim() ? value : fallback;
55872
55872
  }
55873
- function outcomeContent(task) {
55873
+ function outcomeContent(task, slackReplySent) {
55874
55874
  if (task.status === "failed") {
55875
55875
  return `❌ **Failed**
55876
55876
 
@@ -55881,6 +55881,10 @@ ${outcomeText(task.failureReason, "Task failed.")}`;
55881
55881
 
55882
55882
  ${outcomeText(task.failureReason, "Task was cancelled.")}`;
55883
55883
  }
55884
+ if (slackReplySent && task.status === "completed") {
55885
+ const agentName = task.agentId ? getAgentById(task.agentId)?.name ?? "Agent" : "Agent";
55886
+ return `✅ ${agentName} completed`;
55887
+ }
55884
55888
  return `✅
55885
55889
 
55886
55890
  ${outcomeText(task.output, "Task completed.")}`;
@@ -56000,7 +56004,8 @@ async function streamOutcomeCard(task, tree) {
56000
56004
  const tasks = getSlackTasksInThread(task.slackChannelId, task.slackThreadTs);
56001
56005
  const duration = formatV2Duration(new Date(task.createdAt), terminalEnd(task, new Date));
56002
56006
  const attachment = attachmentLine(getTaskAttachments(task.id));
56003
- const content = outcomeContent(task);
56007
+ const slackReplySent = getTaskById(task.id)?.slackReplySent ?? task.slackReplySent;
56008
+ const content = outcomeContent(task, slackReplySent);
56004
56009
  const presentation = outcomePresentation(task, content, attachment);
56005
56010
  if (!presentation)
56006
56011
  throw new Error(`Outcome presentation is empty for task ${task.id}`);
@@ -56029,8 +56034,10 @@ async function streamOutcomeCard(task, tree) {
56029
56034
  outcome = reserved.record;
56030
56035
  reservationWasCreated = reserved.created;
56031
56036
  }
56037
+ let streamedFreshContent = false;
56032
56038
  if (isPendingSlackMessage(outcome)) {
56033
56039
  const reconciled = reservationWasCreated ? undefined : await findReservedSlackMessage(app2.client, outcome, presentation);
56040
+ streamedFreshContent = !reconciled;
56034
56041
  const started = reconciled ?? await callSlackWithRetry(app2.client, "chat.startStream", startPayload);
56035
56042
  if (typeof started.ts !== "string" || !started.ts) {
56036
56043
  throw new Error("Slack did not return a timestamp for the outcome stream");
@@ -56042,6 +56049,13 @@ async function streamOutcomeCard(task, tree) {
56042
56049
  throw new Error("Failed to persist the outcome stream timestamp");
56043
56050
  outcome = persisted;
56044
56051
  }
56052
+ if (!streamedFreshContent) {
56053
+ await callSlackWithRetry(app2.client, "chat.update", {
56054
+ channel: task.slackChannelId,
56055
+ ts: outcome.ts,
56056
+ text: presentation
56057
+ });
56058
+ }
56045
56059
  try {
56046
56060
  await callSlackWithRetry(app2.client, "chat.stopStream", {
56047
56061
  channel: task.slackChannelId,
@@ -7,7 +7,7 @@ import {
7
7
  init_date_utils,
8
8
  init_db,
9
9
  normalizeDateRequired
10
- } from "./cli-jvrynjae.js";
10
+ } from "./cli-w7rwwnna.js";
11
11
 
12
12
  // src/be/db-queries/oauth.ts
13
13
  init_crypto();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  init_env_flag,
3
3
  isEnvFlagEnabled
4
- } from "./cli-c4f49bv5.js";
4
+ } from "./cli-hzad20bp.js";
5
5
  import {
6
6
  init_zod
7
7
  } from "./cli-bw80ck94.js";
@@ -2,7 +2,7 @@ import {
2
2
  getScriptApiTypes,
3
3
  getScriptMcpTypes,
4
4
  require_typescript
5
- } from "./cli-ft5t0yrn.js";
5
+ } from "./cli-44d54bm6.js";
6
6
  import {
7
7
  deleteSwarmConfigByKey,
8
8
  getAgentById,
@@ -11,7 +11,7 @@ import {
11
11
  getSwarmConfigs,
12
12
  init_db,
13
13
  upsertSwarmConfig
14
- } from "./cli-jvrynjae.js";
14
+ } from "./cli-w7rwwnna.js";
15
15
  import {
16
16
  init_secret_scrubber,
17
17
  scrubSecrets
@@ -16,13 +16,13 @@ import {
16
16
  init_db,
17
17
  init_templates1 as init_templates,
18
18
  normalizeDateRequired
19
- } from "./cli-jvrynjae.js";
19
+ } from "./cli-w7rwwnna.js";
20
20
  import {
21
21
  init_env_flag,
22
22
  init_resolver,
23
23
  isEnvFlagEnabled,
24
24
  resolveTemplate
25
- } from "./cli-c4f49bv5.js";
25
+ } from "./cli-hzad20bp.js";
26
26
 
27
27
  // src/be/db-queries/tracker.ts
28
28
  init_date_utils();
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  buildModelsDevSeedRows,
3
3
  loadModelsDevCache
4
- } from "./cli-4yz5rd62.js";
4
+ } from "./cli-9885yxs8.js";
5
5
  import {
6
6
  createLogEntry,
7
7
  getActivePricingRow,
8
8
  getDb,
9
9
  init_db,
10
10
  insertPricingRow
11
- } from "./cli-jvrynjae.js";
11
+ } from "./cli-w7rwwnna.js";
12
12
  import {
13
13
  init_secret_scrubber,
14
14
  scrubSecrets
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  init_package,
3
3
  package_default
4
- } from "./cli-wv0crj18.js";
4
+ } from "./cli-8hhc59nf.js";
5
5
 
6
6
  // src/commands/shared/client-config.ts
7
7
  init_package();