@desplega.ai/agent-swarm 1.123.1 → 1.124.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +2 -1
  2. package/dist/{actions-3ntn8s3f.js → actions-z3d0fk7z.js} +5 -5
  3. package/dist/{app-pej7g57x.js → app-q2rc9tdr.js} +3 -3
  4. package/dist/{assistant-pxa36zjn.js → assistant-3stjq7fz.js} +8 -8
  5. package/dist/{boot-reembed-wdwde4vr.js → boot-reembed-5867whnb.js} +3 -3
  6. package/dist/{boot-reembed-ybq960bh.js → boot-reembed-v6r1df32.js} +4 -4
  7. package/dist/{boot-scrub-logs-ndqxg6e3.js → boot-scrub-logs-8b8jegk3.js} +2 -2
  8. package/dist/{cli-xv09zc8e.js → cli-0925phzv.js} +1 -1
  9. package/dist/{cli-256kb8p5.js → cli-2yr6edr7.js} +4 -4
  10. package/dist/{cli-x2hk4m81.js → cli-3z4q09tn.js} +54 -9
  11. package/dist/{cli-7yn0n4fp.js → cli-5jn6wnd9.js} +8 -8
  12. package/dist/{cli-82eq5zf5.js → cli-92bqgbgy.js} +1 -1
  13. package/dist/{cli-r07fhvsk.js → cli-dq2ssyf0.js} +5 -5
  14. package/dist/{cli-kqgkfpz7.js → cli-gkvf8d83.js} +1 -1
  15. package/dist/{cli-7qvpf14x.js → cli-gzjsamwc.js} +1 -1
  16. package/dist/{cli-333x50bh.js → cli-h89g0qrd.js} +1 -1
  17. package/dist/{cli-g4bfr1e7.js → cli-jp4mdj9d.js} +2 -2
  18. package/dist/{cli-2e5t0yjj.js → cli-kk58tg33.js} +7 -7
  19. package/dist/{cli-mb3gz7qr.js → cli-mcez7z4p.js} +1 -1
  20. package/dist/{cli-ca32n52j.js → cli-mmk5vagg.js} +2 -2
  21. package/dist/{cli-1kv5sydm.js → cli-p0ec4vv6.js} +1 -1
  22. package/dist/{cli-zvbxe7pf.js → cli-p0zgv8pj.js} +1 -1
  23. package/dist/{cli-mntyk3cr.js → cli-perb20ma.js} +1 -1
  24. package/dist/{cli-7rk0bbfr.js → cli-qf7acvyr.js} +2 -2
  25. package/dist/{cli-1cah98w1.js → cli-qwsagsmg.js} +1 -1
  26. package/dist/{cli-pjvdm39a.js → cli-sqv6c9b8.js} +5 -5
  27. package/dist/{cli-vw0acwe7.js → cli-vm20sh8d.js} +3 -3
  28. package/dist/{cli-sj43m5z0.js → cli-wn3m6q54.js} +3 -3
  29. package/dist/{cli-hgkf9zmd.js → cli-x268say8.js} +125 -58
  30. package/dist/{cli-0pmkqg1d.js → cli-y43n987v.js} +1 -1
  31. package/dist/{cli-qrnhnhma.js → cli-ykthjw29.js} +4 -4
  32. package/dist/{cli-k3yfwe8g.js → cli-zxb72ctk.js} +2 -2
  33. package/dist/cli.js +9 -9
  34. package/dist/{commands-5p0erxye.js → commands-sda76yn8.js} +2 -2
  35. package/dist/{db-yp9e9nvs.js → db-vn9e4rqj.js} +6 -2
  36. package/dist/{handlers-3hqw1dsr.js → handlers-xfja18ac.js} +8 -8
  37. package/dist/{hook-5981d59r.js → hook-2medrp47.js} +1 -1
  38. package/dist/{http-ek9ctgth.js → http-937pyjfc.js} +49 -39
  39. package/dist/{index-33eb3q08.js → index-2bqd2q9v.js} +11 -11
  40. package/dist/{index-8j9b86c9.js → index-gw4en7jg.js} +9 -9
  41. package/dist/{index-chcty242.js → index-knqczmnm.js} +10 -10
  42. package/dist/{index-1cnvzmh4.js → index-vah60vxp.js} +8 -8
  43. package/dist/{keepalive-rrvxy1fy.js → keepalive-20rd6hxh.js} +5 -5
  44. package/dist/{lead-jvw8b413.js → lead-7w2k3a49.js} +20 -20
  45. package/dist/{maintenance-3zjnr2wa.js → maintenance-p3x918yw.js} +4 -4
  46. package/dist/{oauth-refresh-sweep-vfhvqmby.js → oauth-refresh-sweep-shm0nzm4.js} +4 -4
  47. package/dist/{onboard-kvntqz8h.js → onboard-py9dnf54.js} +2 -2
  48. package/dist/{otel-impl-61tsn4bx.js → otel-impl-7yjkfg68.js} +1 -1
  49. package/dist/{pricing-refresh-jcp6ntbk.js → pricing-refresh-3snb6370.js} +4 -4
  50. package/dist/{rbac-roles-xcbab18x.js → rbac-roles-5e72bbpk.js} +3 -3
  51. package/dist/{rbac-roles-r3j4z9vs.js → rbac-roles-gqxdp8st.js} +4 -4
  52. package/dist/{seed-pricing-bd669a7j.js → seed-pricing-bg42d7h2.js} +3 -3
  53. package/dist/{setup-pg03xran.js → setup-nzk3kbbq.js} +2 -2
  54. package/dist/{worker-q5n4qwvq.js → worker-0p1jdzkm.js} +20 -20
  55. package/openapi.json +23 -1
  56. package/package.json +1 -1
  57. package/src/be/db.ts +81 -4
  58. package/src/be/scripts/typecheck.ts +8 -4
  59. package/src/be/seed-scripts/catalog/task-context-gathering.ts +1 -1
  60. package/src/http/workflows.ts +16 -4
  61. package/src/prompts/session-templates.ts +6 -3
  62. package/src/scripts-runtime/swarm-sdk.ts +10 -0
  63. package/src/scripts-runtime/types/stdlib.d.ts +4 -0
  64. package/src/scripts-runtime/types/swarm-sdk.d.ts +4 -0
  65. package/src/telemetry.ts +10 -7
  66. package/src/tests/mcp-tools.test.ts +2 -2
  67. package/src/tests/prompt-template-session.test.ts +7 -0
  68. package/src/tests/scripts-mcp-e2e.test.ts +51 -2
  69. package/src/tests/scripts-typecheck.test.ts +17 -0
  70. package/src/tests/sdk-allowlist.test.ts +34 -1
  71. package/src/tests/seed-scripts.test.ts +43 -0
  72. package/src/tests/swarm-tool-result-gate.test.ts +35 -0
  73. package/src/tests/task-tools-ctx.test.ts +29 -0
  74. package/src/tests/telemetry-init.test.ts +21 -24
  75. package/src/tests/workflow-http-v2.test.ts +116 -0
  76. package/src/tools/get-tasks.ts +40 -1
  77. package/src/tools/script-run.ts +2 -2
  78. package/src/tools/script-upsert.ts +2 -2
  79. package/src/tools/utils.ts +14 -8
  80. package/src/tools/workflows/list-workflow-runs.ts +95 -24
package/README.md CHANGED
@@ -136,7 +136,8 @@ Check [our templates](https://templates.agent-swarm.dev) for a quick start.
136
136
  - **Scripts as external APIs** — expose a saved script as a public `POST /api/x/script/<id>` endpoint with optional bearer auth, typed input validation, and per-endpoint usage tracking. [Guide →](https://docs.agent-swarm.dev/docs/guides/scripts-external-apis)
137
137
  - **Typed script API connections** — lead-managed OpenAPI, GraphQL, and MCP connections generate `ctx.api.*` / `ctx.mcp.*` clients for scripts, with credential bindings and OAuth-backed auth kept server-side. [Guide →](https://docs.agent-swarm.dev/docs/guides/script-connections)
138
138
  - **E2B-backed eval harness** — run a scenario × harness-config matrix against real swarm stacks, capture transcripts/artifacts, and grade outcomes with deterministic checks plus LLM or agentic judges. [Guide →](https://docs.agent-swarm.dev/docs/guides/evals-harness)
139
- - **Harness & LLM agnostic** — run with Claude Code, Claude Bridge, OpenAI Codex, pi-mono (Anthropic, OpenRouter, or Amazon Bedrock), Devin, Claude Managed Agents, raw LLMs, or opencode. Route every OpenRouter-backed harness, workflow, and summarizer through an OpenAI-compatible gateway with `OPENROUTER_BASE_URL`. Tasks, schedules, and workflow agent-task nodes can use portable `modelTier` intent (`smol`, `regular`, `smart`, `ultra`), and operators can set per-agent reasoning effort (`off` → `max`, where supported) without changing task payloads. [Harness config →](https://docs.agent-swarm.dev/docs/guides/harness-configuration) · [Add a new provider →](https://docs.agent-swarm.dev/docs/guides/harness-providers)
139
+ - **Harness & LLM agnostic** — run with Claude Code, Claude Bridge, OpenAI Codex, pi-mono (Anthropic, OpenRouter, or Amazon Bedrock), Devin, Claude Managed Agents, raw LLMs, or opencode. The dashboard model picker follows a live models.dev catalog (with a bundled snapshot fallback), so newly released provider models appear without a redeploy. Route every OpenRouter-backed harness, workflow, and summarizer through an OpenAI-compatible gateway with `OPENROUTER_BASE_URL`. Tasks, schedules, and workflow agent-task nodes can use portable `modelTier` intent (`smol`, `regular`, `smart`, `ultra`), and operators can set per-agent reasoning effort (`off` → `max`, where supported) without changing task payloads. [Harness config →](https://docs.agent-swarm.dev/docs/guides/harness-configuration) · [Add a new provider →](https://docs.agent-swarm.dev/docs/guides/harness-providers)
140
+ - **Published release artifacts** — every release publishes multi-architecture API, full-worker, and slim-worker images alongside versioned E2B templates, the npm CLI package, and the Helm chart. [Artifact inventory →](https://docs.agent-swarm.dev/docs/guides/published-artifacts)
140
141
  - **OpenTelemetry traces plus OTLP cost/token metrics** — export API + worker traces and finalized session cost/token counters through the same OTLP pipeline for dashboarding in SigNoz, Datadog, Tempo, or another compatible backend. [Observability →](https://docs.agent-swarm.dev/docs/guides/observability-opentelemetry)
141
142
  - **Follow-up continuity across all harnesses** — child tasks inherit a bounded prior-task context preamble built from the task chain, so continuity survives restarts and works the same across every provider. [Task lifecycle →](https://docs.agent-swarm.dev/docs/concepts/task-lifecycle)
142
143
  - **Skills & MCP servers** — reusable procedural knowledge, bundled skill reference files, and per-agent MCP servers with scope cascade. [MCP tools →](https://docs.agent-swarm.dev/docs/reference/mcp-tools)
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  resolveSlackUserId
3
- } from "./cli-g4bfr1e7.js";
4
- import"./cli-xv09zc8e.js";
3
+ } from "./cli-jp4mdj9d.js";
4
+ import"./cli-0925phzv.js";
5
5
  import {
6
6
  createTaskWithSiblingAwareness
7
- } from "./cli-1cah98w1.js";
7
+ } from "./cli-qwsagsmg.js";
8
8
  import {
9
9
  buildCancelledBlocks,
10
10
  getTaskLink
@@ -19,9 +19,9 @@ import {
19
19
  init_context_key,
20
20
  init_db,
21
21
  slackContextKey
22
- } from "./cli-x2hk4m81.js";
22
+ } from "./cli-3z4q09tn.js";
23
23
  import"./cli-z2zcxes1.js";
24
- import"./cli-zvbxe7pf.js";
24
+ import"./cli-p0zgv8pj.js";
25
25
  import"./cli-4j2mrzag.js";
26
26
  import"./cli-bw80ck94.js";
27
27
  import"./cli-xz9aq0rf.js";
@@ -3,15 +3,15 @@ import {
3
3
  initSlackApp,
4
4
  startSlackApp,
5
5
  stopSlackApp
6
- } from "./cli-r07fhvsk.js";
6
+ } from "./cli-dq2ssyf0.js";
7
7
  import"./cli-rkndnn90.js";
8
8
  import"./cli-b0p7rfnd.js";
9
9
  import"./cli-5ncdb7ff.js";
10
10
  import"./cli-wspgs9bt.js";
11
11
  import"./cli-dh55d5fg.js";
12
- import"./cli-x2hk4m81.js";
12
+ import"./cli-3z4q09tn.js";
13
13
  import"./cli-z2zcxes1.js";
14
- import"./cli-zvbxe7pf.js";
14
+ import"./cli-p0zgv8pj.js";
15
15
  import"./cli-4j2mrzag.js";
16
16
  import"./cli-bw80ck94.js";
17
17
  import"./cli-xz9aq0rf.js";
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  bufferThreadMessage,
3
3
  wasEventSeen
4
- } from "./cli-pjvdm39a.js";
4
+ } from "./cli-sqv6c9b8.js";
5
5
  import {
6
6
  hasOtherUserMention
7
- } from "./cli-82eq5zf5.js";
7
+ } from "./cli-92bqgbgy.js";
8
8
  import {
9
9
  resolveSlackUserId,
10
10
  rewriteSlackMentions
11
- } from "./cli-g4bfr1e7.js";
12
- import"./cli-xv09zc8e.js";
11
+ } from "./cli-jp4mdj9d.js";
12
+ import"./cli-0925phzv.js";
13
13
  import {
14
14
  createTaskWithSiblingAwareness
15
- } from "./cli-1cah98w1.js";
15
+ } from "./cli-qwsagsmg.js";
16
16
  import {
17
17
  require_dist
18
- } from "./cli-r07fhvsk.js";
18
+ } from "./cli-dq2ssyf0.js";
19
19
  import"./cli-rkndnn90.js";
20
20
  import"./cli-b0p7rfnd.js";
21
21
  import"./cli-5ncdb7ff.js";
@@ -32,9 +32,9 @@ import {
32
32
  isEnvFlagEnabled,
33
33
  resolveTemplate,
34
34
  slackContextKey
35
- } from "./cli-x2hk4m81.js";
35
+ } from "./cli-3z4q09tn.js";
36
36
  import"./cli-z2zcxes1.js";
37
- import"./cli-zvbxe7pf.js";
37
+ import"./cli-p0zgv8pj.js";
38
38
  import"./cli-4j2mrzag.js";
39
39
  import"./cli-bw80ck94.js";
40
40
  import"./cli-xz9aq0rf.js";
@@ -3,14 +3,14 @@ import {
3
3
  getEmbeddingProvider,
4
4
  getMemoryStore,
5
5
  init_constants
6
- } from "./cli-1kv5sydm.js";
6
+ } from "./cli-p0ec4vv6.js";
7
7
  import"./cli-q25ejbyn.js";
8
8
  import {
9
9
  getDb,
10
10
  init_db
11
- } from "./cli-x2hk4m81.js";
11
+ } from "./cli-3z4q09tn.js";
12
12
  import"./cli-z2zcxes1.js";
13
- import"./cli-zvbxe7pf.js";
13
+ import"./cli-p0zgv8pj.js";
14
14
  import"./cli-4j2mrzag.js";
15
15
  import"./cli-bw80ck94.js";
16
16
  import"./cli-xz9aq0rf.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  embedScript,
3
3
  embeddingProvider
4
- } from "./cli-ca32n52j.js";
5
- import"./cli-1kv5sydm.js";
4
+ } from "./cli-mmk5vagg.js";
5
+ import"./cli-p0ec4vv6.js";
6
6
  import"./cli-q25ejbyn.js";
7
7
  import {
8
8
  getDb,
9
9
  init_db
10
- } from "./cli-x2hk4m81.js";
10
+ } from "./cli-3z4q09tn.js";
11
11
  import"./cli-z2zcxes1.js";
12
- import"./cli-zvbxe7pf.js";
12
+ import"./cli-p0zgv8pj.js";
13
13
  import"./cli-4j2mrzag.js";
14
14
  import"./cli-bw80ck94.js";
15
15
  import"./cli-xz9aq0rf.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-x2hk4m81.js";
4
+ } from "./cli-3z4q09tn.js";
5
5
  import"./cli-z2zcxes1.js";
6
- import"./cli-zvbxe7pf.js";
6
+ import"./cli-p0zgv8pj.js";
7
7
  import {
8
8
  init_secret_scrubber,
9
9
  scrubSecrets
@@ -4,7 +4,7 @@ import {
4
4
  incrKv,
5
5
  init_db,
6
6
  upsertKv
7
- } from "./cli-x2hk4m81.js";
7
+ } from "./cli-3z4q09tn.js";
8
8
 
9
9
  // src/be/users.ts
10
10
  init_db();
@@ -4,15 +4,15 @@ import {
4
4
  handleScheduleTrigger,
5
5
  runScript,
6
6
  startWorkflowExecution
7
- } from "./cli-2e5t0yjj.js";
7
+ } from "./cli-kk58tg33.js";
8
8
  import {
9
9
  getScript,
10
10
  getScriptApiConnectionDescriptors,
11
11
  getScriptMcpConnectionDescriptors
12
- } from "./cli-sj43m5z0.js";
12
+ } from "./cli-wn3m6q54.js";
13
13
  import {
14
14
  createTaskWithSiblingAwareness
15
- } from "./cli-1cah98w1.js";
15
+ } from "./cli-qwsagsmg.js";
16
16
  import {
17
17
  getDb,
18
18
  getDueScheduledTasks,
@@ -24,7 +24,7 @@ import {
24
24
  scheduleContextKey,
25
25
  telemetry,
26
26
  updateScheduledTask
27
- } from "./cli-x2hk4m81.js";
27
+ } from "./cli-3z4q09tn.js";
28
28
  import {
29
29
  __commonJS,
30
30
  __require,
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  init_package,
7
7
  package_default
8
- } from "./cli-zvbxe7pf.js";
8
+ } from "./cli-p0zgv8pj.js";
9
9
  import {
10
10
  init_secret_scrubber,
11
11
  scrubSecrets
@@ -685,8 +685,6 @@ async function initTelemetry(sourceId, getConfig, setConfig, options = {}) {
685
685
  const existingInstalledAt = await getConfig("telemetry_installed_at");
686
686
  if (existingInstalledAt) {
687
687
  installedAt = existingInstalledAt;
688
- } else if (generateIfMissing) {
689
- await tryPersistInstalledAt(setConfig);
690
688
  }
691
689
  } else if (generateIfMissing) {
692
690
  const candidateId = `install_${randomUUID().replace(/-/g, "").slice(0, 16)}`;
@@ -3480,20 +3478,23 @@ Use this to debug issues and propose improvements to your own infrastructure.
3480
3478
  defaultBody: `
3481
3479
  ### Script Authoring Contract (read BEFORE writing any script)
3482
3480
 
3483
- **Entry point — \`args\` FIRST, \`ctx\` SECOND.** A one-parameter \`function (ctx)\` still typechecks, but at runtime that parameter receives \`args\`, so every \`ctx.*\` access throws. This is the single most common cause of failed script runs.
3481
+ **Entry point — \`args\` FIRST, \`ctx\` SECOND.** A one-parameter \`function (ctx)\` can execute through \`script-run\`, but at runtime that parameter receives \`args\`, so every \`ctx.*\` access throws. \`script-upsert\` also rejects an untyped parameter under strict typechecking. This is the single most common cause of failed script runs.
3484
3482
 
3485
3483
  \`\`\`ts
3484
+ import type { ScriptContext } from "swarm-sdk";
3486
3485
  import * as z from "zod";
3487
3486
 
3488
3487
  export const argsSchema = z.object({ taskId: z.string(), limit: z.number().optional() });
3489
3488
 
3490
- export default async function (args: z.infer<typeof argsSchema>, ctx) {
3489
+ export default async function (args: z.infer<typeof argsSchema>, ctx: ScriptContext) {
3491
3490
  const res = await ctx.swarm.task_get({ taskId: args.taskId });
3492
- const task = res?.data ?? res;
3491
+ const task = ((res as { data?: unknown }).data ?? res) as { title?: string };
3493
3492
  return { title: task?.title };
3494
3493
  }
3495
3494
  \`\`\`
3496
3495
 
3496
+ **Typechecking:** inline source passed to \`script-run\` executes without a compile-time typecheck. \`script-upsert\` typechecks before saving, so import \`ScriptContext\` from \`"swarm-sdk"\` as shown above to make inline code promotion-safe. Use \`script-query-types\` for the authoritative SDK and stdlib declarations.
3497
+
3497
3498
  **What \`ctx\` actually holds for inline/named scripts (\`script-run\` / \`script-upsert\`) — nothing else:**
3498
3499
  - \`ctx.swarm.*\` — the swarm SDK: \`task_get\`, \`task_send\`, \`task_storeProgress\`, \`task_action\`, \`task_list\`, \`message_post\`, \`message_read\`, \`slack_reply\`, \`memory_search\`, \`kv_get\`/\`kv_set\`/\`kv_del\`/\`kv_incr\`/\`kv_list\`, \`swarm_get\`, \`agent_info\`, and more. Responses are usually wrapped — prefer \`res?.data ?? res\`.
3499
3500
  - \`ctx.swarm.config\` — \`apiKey\`, \`agentId\`, \`mcpBaseUrl\`, plus \`ctx.swarm.config.get("KEY")\` for user values. All are \`Redacted\` wrappers: they stringify to \`<redacted>\`, and you must never unwrap them into a return value, log line, or request body you build by hand.
@@ -4954,6 +4955,7 @@ __export(exports_db, {
4954
4955
  markInboxMessageDelegated: () => markInboxMessageDelegated,
4955
4956
  logQueries: () => logQueries,
4956
4957
  listWorkflows: () => listWorkflows,
4958
+ listWorkflowRunsPage: () => listWorkflowRunsPage,
4957
4959
  listWorkflowRuns: () => listWorkflowRuns,
4958
4960
  listUserFavorites: () => listUserFavorites,
4959
4961
  listTaskTemplates: () => listTaskTemplates,
@@ -5236,6 +5238,7 @@ __export(exports_db, {
5236
5238
  createApprovalRequest: () => createApprovalRequest,
5237
5239
  createAgentMailInboxMapping: () => createAgentMailInboxMapping,
5238
5240
  createAgent: () => createAgent,
5241
+ countWorkflowRuns: () => countWorkflowRuns,
5239
5242
  countSessions: () => countSessions,
5240
5243
  countScriptRuns: () => countScriptRuns,
5241
5244
  countScriptRunJournalSteps: () => countScriptRunJournalSteps,
@@ -9458,8 +9461,50 @@ function updateWorkflowRun(id, data) {
9458
9461
  }
9459
9462
  return run;
9460
9463
  }
9461
- function listWorkflowRuns(workflowId) {
9462
- return getDb().prepare("SELECT * FROM workflow_runs WHERE workflowId = ? ORDER BY startedAt DESC").all(workflowId).map(rowToWorkflowRun);
9464
+ function listWorkflowRuns(workflowId, options = {}) {
9465
+ const conditions = ["workflowId = ?"];
9466
+ const params = [workflowId];
9467
+ if (options.status) {
9468
+ conditions.push("status = ?");
9469
+ params.push(options.status);
9470
+ }
9471
+ let pagination = "";
9472
+ if (options.limit !== undefined) {
9473
+ pagination = " LIMIT ? OFFSET ?";
9474
+ params.push(options.limit, options.offset ?? 0);
9475
+ } else if (options.offset !== undefined) {
9476
+ pagination = " LIMIT -1 OFFSET ?";
9477
+ params.push(options.offset);
9478
+ }
9479
+ return getDb().prepare(`SELECT * FROM workflow_runs
9480
+ WHERE ${conditions.join(" AND ")}
9481
+ ORDER BY startedAt DESC, id DESC${pagination}`).all(...params).map(rowToWorkflowRun);
9482
+ }
9483
+ function countWorkflowRuns(workflowId, options = {}) {
9484
+ const conditions = ["workflowId = ?"];
9485
+ const params = [workflowId];
9486
+ if (options.status) {
9487
+ conditions.push("status = ?");
9488
+ params.push(options.status);
9489
+ }
9490
+ const row = getDb().prepare(`SELECT COUNT(*) AS count FROM workflow_runs WHERE ${conditions.join(" AND ")}`).get(...params);
9491
+ return row?.count ?? 0;
9492
+ }
9493
+ function listWorkflowRunsPage(workflowId, options) {
9494
+ const runs = listWorkflowRuns(workflowId, options);
9495
+ const total = countWorkflowRuns(workflowId, { status: options.status });
9496
+ const nextOffset = options.offset + runs.length;
9497
+ const hasMore = nextOffset < total;
9498
+ return {
9499
+ runs,
9500
+ page: {
9501
+ limit: options.limit,
9502
+ offset: options.offset,
9503
+ total,
9504
+ hasMore,
9505
+ ...hasMore ? { nextOffset } : {}
9506
+ }
9507
+ };
9463
9508
  }
9464
9509
  function rowToWorkflowRunStep(row) {
9465
9510
  return {
@@ -12159,4 +12204,4 @@ var init_db = __esm(() => {
12159
12204
  };
12160
12205
  });
12161
12206
 
12162
- export { normalizeAssetKey, parseAssetKey, canWriteAssetKey, init_key, interpolate, deepInterpolate, init_template, registerTemplate, getTemplateDefinition, getAllTemplateDefinitions, init_registry, configureHttpResolver, resolveTemplate, resolveTemplateAsync, init_resolver, slackContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, parseEnvFlag, isEnvFlagEnabled, init_env_flag, initTelemetry, telemetry, init_telemetry, AssetKeySchema, AssetEntityTypeSchema, ModelTierSchema, ReasoningEffortSchema, splitLegacyModelAlias, resolveTaskModelSelection, AgentTaskStatusSchema, isTerminalTaskStatus, AgentTaskSourceSchema, ProviderNameSchema, SteerModeSchema, SteeringSourceSchema, SteerOutcomeSchema, OnUnsupportedSchema, FollowUpConfigSchema, AttachmentInputSchema, InboxItemTypeSchema, InboxItemStatusSchema, FavoriteItemTypeSchema, TaskTemplateKindSchema, AgentStatusSchema, AgentAvatarSchema, AgentLatestModelSchema, AgentCredStatusSchema, ChannelTypeSchema, ServiceStatusSchema, ResumeReasonSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, ScheduledTaskTargetTypeSchema, SwarmConfigScopeSchema, RepoGuidelinesSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, PageContentTypeSchema, PageAuthModeSchema, MetricDefinitionSchema, MetricVersionSchema, WorkflowRunStatusSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, PromptTemplateScopeSchema, PromptTemplateStateSchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptApiAuthModeSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, KvValueTypeSchema, KvNamespaceSchema, KvKeySchema, init_types, setRequestAuth, getRequestAuth, getCurrentRequestAuth, init_request_auth_context, auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDate, normalizeDateRequired, init_date_utils, init_session_templates, init_templates, init_templates2 as init_templates1, isSteeringEnabled, init_steering_enabled, SteeringRequestError, isSteeringEnabled2 as isSteeringEnabled1, getTaskSteeringFields, promotePendingSteeringForTask, markSteeringUndeliverable, requestSteering, init_steering, isReservedConfigKey, reservedKeyError, validateConfigValue, init_swarm_config_guard, onTaskStarted, init_task_lifecycle_events, generateDefaultClaudeMd, generateDefaultSoulMd, generateDefaultIdentityMd, generateDefaultToolsMd, init_defaults, isSqliteVecAvailable, initDb, getDb, closeDb, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, agentQueries, updateAgentCredentialState, createAgent, getAgentById, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, taskQueries, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, getTaskById, markTaskSlackReplySent, setSlackMessageTracking, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, updateTaskClaudeSessionId, updateTaskTitle, updateTaskVcs, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getInProgressTasksByContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getLatestLeadTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, completeTask, failTask, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, insertTaskAttachment, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, createSteeringMessage, getSteeringMessagesForTask, getSteeringMessageById, getPendingSteeringForTask, getPendingSteeringForAgent, markSteeringDelivered, markSteeringHandled, markSteeringPromoted, cancelPendingSteeringForTask, hasPendingSteering, getAgentWithTasks, getAllAgentsWithTasks, logQueries, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, releaseStaleReviewingTasks, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, sessionLogQueries, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, getSessionCostSummary, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, upsertKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };
12207
+ export { normalizeAssetKey, parseAssetKey, canWriteAssetKey, init_key, interpolate, deepInterpolate, init_template, registerTemplate, getTemplateDefinition, getAllTemplateDefinitions, init_registry, configureHttpResolver, resolveTemplate, resolveTemplateAsync, init_resolver, slackContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, parseEnvFlag, isEnvFlagEnabled, init_env_flag, initTelemetry, telemetry, init_telemetry, AssetKeySchema, AssetEntityTypeSchema, ModelTierSchema, ReasoningEffortSchema, splitLegacyModelAlias, resolveTaskModelSelection, AgentTaskStatusSchema, isTerminalTaskStatus, AgentTaskSourceSchema, ProviderNameSchema, SteerModeSchema, SteeringSourceSchema, SteerOutcomeSchema, OnUnsupportedSchema, FollowUpConfigSchema, AttachmentInputSchema, InboxItemTypeSchema, InboxItemStatusSchema, FavoriteItemTypeSchema, TaskTemplateKindSchema, AgentStatusSchema, AgentAvatarSchema, AgentLatestModelSchema, AgentCredStatusSchema, ChannelTypeSchema, ServiceStatusSchema, ResumeReasonSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, ScheduledTaskTargetTypeSchema, SwarmConfigScopeSchema, RepoGuidelinesSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, PageContentTypeSchema, PageAuthModeSchema, MetricDefinitionSchema, MetricVersionSchema, WorkflowRunStatusSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, PromptTemplateScopeSchema, PromptTemplateStateSchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptApiAuthModeSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, KvValueTypeSchema, KvNamespaceSchema, KvKeySchema, init_types, setRequestAuth, getRequestAuth, getCurrentRequestAuth, init_request_auth_context, auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDate, normalizeDateRequired, init_date_utils, init_session_templates, init_templates, init_templates2 as init_templates1, isSteeringEnabled, init_steering_enabled, SteeringRequestError, isSteeringEnabled2 as isSteeringEnabled1, getTaskSteeringFields, promotePendingSteeringForTask, markSteeringUndeliverable, requestSteering, init_steering, isReservedConfigKey, reservedKeyError, validateConfigValue, init_swarm_config_guard, onTaskStarted, init_task_lifecycle_events, generateDefaultClaudeMd, generateDefaultSoulMd, generateDefaultIdentityMd, generateDefaultToolsMd, init_defaults, isSqliteVecAvailable, initDb, getDb, closeDb, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, agentQueries, updateAgentCredentialState, createAgent, getAgentById, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, taskQueries, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, getTaskById, markTaskSlackReplySent, setSlackMessageTracking, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, updateTaskClaudeSessionId, updateTaskTitle, updateTaskVcs, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getInProgressTasksByContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getLatestLeadTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, completeTask, failTask, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, insertTaskAttachment, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, createSteeringMessage, getSteeringMessagesForTask, getSteeringMessageById, getPendingSteeringForTask, getPendingSteeringForAgent, markSteeringDelivered, markSteeringHandled, markSteeringPromoted, cancelPendingSteeringForTask, hasPendingSteering, getAgentWithTasks, getAllAgentsWithTasks, logQueries, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, releaseStaleReviewingTasks, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, sessionLogQueries, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, getSessionCostSummary, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, countWorkflowRuns, listWorkflowRunsPage, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, upsertKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };
@@ -2,7 +2,7 @@ import {
2
2
  getScriptApiTypes,
3
3
  getScriptMcpTypes,
4
4
  require_typescript
5
- } from "./cli-sj43m5z0.js";
5
+ } from "./cli-wn3m6q54.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-x2hk4m81.js";
14
+ } from "./cli-3z4q09tn.js";
15
15
  import {
16
16
  init_secret_scrubber,
17
17
  scrubSecrets
@@ -457,7 +457,7 @@ export interface SwarmSdk {
457
457
  // --- workflows ---
458
458
  workflow_list(args?: { enabled?: boolean; includeFull?: boolean; consecutiveErrorsMin?: number; lastRunStatus?: "running" | "waiting" | "completed" | "failed" | "skipped" | "cancelled" }): Promise<unknown>;
459
459
  workflow_get(args: { id: string }): Promise<unknown>;
460
- workflow_listRuns(args: { workflowId: string; status?: "running" | "waiting" | "completed" | "failed" | "skipped" | "cancelled" }): Promise<unknown>;
460
+ workflow_listRuns(args: { workflowId: string; status?: "running" | "waiting" | "completed" | "failed" | "skipped" | "cancelled"; limit?: number; offset?: number }): Promise<unknown>;
461
461
  workflow_getRun(args: { id: string }): Promise<unknown>;
462
462
  // --- prompt templates ---
463
463
  prompt_list(args?: { eventType?: string; scope?: "global" | "agent" | "repo"; scopeId?: string; isDefault?: boolean }): Promise<unknown>;
@@ -650,6 +650,8 @@ export interface ScriptContext {
650
650
  * A swarm script's default export. \`args\` comes FIRST, \`ctx\` second — never swap them.
651
651
  *
652
652
  * @example
653
+ * import type { ScriptContext } from "swarm-sdk";
654
+ *
653
655
  * export default async function (args: { name: string }, ctx: ScriptContext) {
654
656
  * await ctx.logger.log(\`hello \${args.name}\`);
655
657
  * return { ok: true };
@@ -1161,17 +1163,15 @@ void _scriptMain;
1161
1163
  });
1162
1164
  if (diagnostics.length === 0)
1163
1165
  return { ok: true };
1164
- const formatted = import_typescript.default.formatDiagnosticsWithColorAndContext(diagnostics, {
1166
+ const formatHost = {
1165
1167
  getCanonicalFileName: (fileName) => fileName,
1166
1168
  getCurrentDirectory: () => "/virtual",
1167
1169
  getNewLine: () => `
1168
1170
  `
1169
- });
1171
+ };
1170
1172
  return {
1171
1173
  ok: false,
1172
- diagnostics: formatted.split(`
1173
-
1174
- `).filter(Boolean),
1174
+ diagnostics: diagnostics.map((diagnostic) => import_typescript.default.formatDiagnosticsWithColorAndContext([diagnostic], formatHost).trimEnd()),
1175
1175
  structured: diagnostics.map(toStructured)
1176
1176
  };
1177
1177
  }
@@ -5,7 +5,7 @@ import {
5
5
  init_db,
6
6
  init_env_flag,
7
7
  isEnvFlagEnabled
8
- } from "./cli-x2hk4m81.js";
8
+ } from "./cli-3z4q09tn.js";
9
9
 
10
10
  // src/slack/router.ts
11
11
  init_db();
@@ -30,7 +30,7 @@ import {
30
30
  init_db,
31
31
  markTaskSlackReplySent,
32
32
  setSlackMessageTracking
33
- } from "./cli-x2hk4m81.js";
33
+ } from "./cli-3z4q09tn.js";
34
34
  import {
35
35
  require_receiver,
36
36
  require_sender,
@@ -55070,13 +55070,13 @@ async function initSlackApp() {
55070
55070
  socketMode: true,
55071
55071
  logLevel: import_bolt.LogLevel.DEBUG
55072
55072
  });
55073
- const { registerMessageHandler } = await import("./handlers-3hqw1dsr.js");
55074
- const { registerCommandHandler } = await import("./commands-5p0erxye.js");
55075
- const { registerActionHandlers } = await import("./actions-3ntn8s3f.js");
55073
+ const { registerMessageHandler } = await import("./handlers-xfja18ac.js");
55074
+ const { registerCommandHandler } = await import("./commands-sda76yn8.js");
55075
+ const { registerActionHandlers } = await import("./actions-z3d0fk7z.js");
55076
55076
  registerMessageHandler(app);
55077
55077
  registerCommandHandler(app);
55078
55078
  registerActionHandlers(app);
55079
- const { createAssistant } = await import("./assistant-pxa36zjn.js");
55079
+ const { createAssistant } = await import("./assistant-3stjq7fz.js");
55080
55080
  app.assistant(createAssistant());
55081
55081
  return app;
55082
55082
  }
@@ -20,7 +20,7 @@ import {
20
20
  isEnvFlagEnabled,
21
21
  normalizeDateRequired,
22
22
  resolveTemplate
23
- } from "./cli-x2hk4m81.js";
23
+ } from "./cli-3z4q09tn.js";
24
24
 
25
25
  // src/be/db-queries/tracker.ts
26
26
  init_date_utils();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-x2hk4m81.js";
4
+ } from "./cli-3z4q09tn.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-mb3gz7qr.js";
14
+ } from "./cli-mcez7z4p.js";
15
15
  import {
16
16
  init_secret_scrubber,
17
17
  registerVolatileSecret,
@@ -4,12 +4,12 @@ import {
4
4
  linkIdentity,
5
5
  recordUnmappedIdentity,
6
6
  resolveIdentity
7
- } from "./cli-xv09zc8e.js";
7
+ } from "./cli-0925phzv.js";
8
8
  import {
9
9
  getKv,
10
10
  init_db,
11
11
  upsertKv
12
- } from "./cli-x2hk4m81.js";
12
+ } from "./cli-3z4q09tn.js";
13
13
 
14
14
  // src/slack/enrich.ts
15
15
  init_db();
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  ensureAuthorizationTokenOrThrow,
9
9
  oauthAppRowToProviderConfig
10
- } from "./cli-333x50bh.js";
10
+ } from "./cli-h89g0qrd.js";
11
11
  import {
12
12
  getScript,
13
13
  getScriptApiConnectionDescriptors,
@@ -15,15 +15,15 @@ import {
15
15
  getScriptVersion,
16
16
  listRelationalCredentialBindings,
17
17
  validateScriptImports
18
- } from "./cli-sj43m5z0.js";
18
+ } from "./cli-wn3m6q54.js";
19
19
  import {
20
20
  getAuthorizationById,
21
21
  getOAuthApp,
22
22
  getOAuthAppById
23
- } from "./cli-mb3gz7qr.js";
23
+ } from "./cli-mcez7z4p.js";
24
24
  import {
25
25
  withSiblingAwareness
26
- } from "./cli-1cah98w1.js";
26
+ } from "./cli-qwsagsmg.js";
27
27
  import {
28
28
  getAppUrl
29
29
  } from "./cli-dh55d5fg.js";
@@ -77,7 +77,7 @@ import {
77
77
  updateWorkflowRun,
78
78
  updateWorkflowRunStep,
79
79
  workflowContextKey
80
- } from "./cli-x2hk4m81.js";
80
+ } from "./cli-3z4q09tn.js";
81
81
  import {
82
82
  init_secret_scrubber,
83
83
  isSensitiveKey,
@@ -2627,7 +2627,7 @@ class HumanInTheLoopExecutor extends BaseExecutor {
2627
2627
  }
2628
2628
  if (notification.channel === "slack") {
2629
2629
  try {
2630
- const { getSlackApp } = await import("./app-pej7g57x.js");
2630
+ const { getSlackApp } = await import("./app-q2rc9tdr.js");
2631
2631
  const slackApp = getSlackApp();
2632
2632
  if (!slackApp) {
2633
2633
  console.warn("[HITL] Slack not initialized — cannot send notification");
@@ -2741,7 +2741,7 @@ class NotifyExecutor extends BaseExecutor {
2741
2741
  }
2742
2742
  }
2743
2743
  case "slack": {
2744
- const { getSlackApp } = await import("./app-pej7g57x.js");
2744
+ const { getSlackApp } = await import("./app-q2rc9tdr.js");
2745
2745
  const app = getSlackApp();
2746
2746
  if (!app) {
2747
2747
  return {
@@ -7,7 +7,7 @@ import {
7
7
  init_date_utils,
8
8
  init_db,
9
9
  normalizeDateRequired
10
- } from "./cli-x2hk4m81.js";
10
+ } from "./cli-3z4q09tn.js";
11
11
 
12
12
  // src/be/db-queries/oauth.ts
13
13
  init_crypto();
@@ -4,11 +4,11 @@ import {
4
4
  getEmbeddingProvider,
5
5
  init_embedding,
6
6
  serializeEmbedding
7
- } from "./cli-1kv5sydm.js";
7
+ } from "./cli-p0ec4vv6.js";
8
8
  import {
9
9
  getDb,
10
10
  init_db
11
- } from "./cli-x2hk4m81.js";
11
+ } from "./cli-3z4q09tn.js";
12
12
  import {
13
13
  init_secret_scrubber,
14
14
  scrubSecrets
@@ -6,7 +6,7 @@ import {
6
6
  getDb,
7
7
  init_db,
8
8
  isSqliteVecAvailable
9
- } from "./cli-x2hk4m81.js";
9
+ } from "./cli-3z4q09tn.js";
10
10
  import {
11
11
  __esm,
12
12
  __export,
@@ -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.123.1",
10
+ version: "1.124.0",
11
11
  description: "Multi-agent orchestration for Claude Code, Codex, Gemini CLI, and other AI coding assistants",
12
12
  license: "MIT",
13
13
  author: "desplega.sh <contact@desplega.sh>",
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  init_package,
3
3
  package_default
4
- } from "./cli-zvbxe7pf.js";
4
+ } from "./cli-p0zgv8pj.js";
5
5
 
6
6
  // src/commands/shared/client-config.ts
7
7
  init_package();
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  buildModelsDevSeedRows,
3
3
  loadModelsDevCache
4
- } from "./cli-7qvpf14x.js";
4
+ } from "./cli-gzjsamwc.js";
5
5
  import {
6
6
  createLogEntry,
7
7
  getActivePricingRow,
8
8
  getDb,
9
9
  init_db,
10
10
  insertPricingRow
11
- } from "./cli-x2hk4m81.js";
11
+ } from "./cli-3z4q09tn.js";
12
12
  import {
13
13
  init_secret_scrubber,
14
14
  scrubSecrets
@@ -3,7 +3,7 @@ import {
3
3
  getAgentById,
4
4
  getInProgressTasksByContextKey,
5
5
  init_db
6
- } from "./cli-x2hk4m81.js";
6
+ } from "./cli-3z4q09tn.js";
7
7
 
8
8
  // src/tasks/sibling-awareness.ts
9
9
  init_db();