@desplega.ai/agent-swarm 1.85.0 → 1.86.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 (93) hide show
  1. package/README.md +1 -0
  2. package/openapi.json +1 -1
  3. package/package.json +8 -6
  4. package/src/be/db.ts +44 -0
  5. package/src/be/migrations/078_backfill_gpt_5_5_pricing.sql +15 -0
  6. package/src/be/modelsdev-cache.json +152028 -0
  7. package/src/be/modelsdev-cache.ts +46 -0
  8. package/src/be/seed-pricing.ts +7 -44
  9. package/src/cli.tsx +12 -2
  10. package/src/commands/codex-session-runner.ts +132 -0
  11. package/src/commands/credential-wait.ts +2 -2
  12. package/src/commands/provider-credentials.ts +10 -5
  13. package/src/commands/runner.ts +3 -3
  14. package/src/prompts/base-prompt.ts +49 -3
  15. package/src/providers/claude-adapter.ts +83 -2
  16. package/src/providers/claude-managed-models.ts +18 -2
  17. package/src/providers/codex-adapter.ts +417 -97
  18. package/src/providers/codex-models.ts +9 -2
  19. package/src/providers/index.ts +28 -19
  20. package/src/providers/pricing-sources.md +7 -4
  21. package/src/providers/swarm-events-shared.ts +14 -0
  22. package/src/slack/HEURISTICS.md +5 -1
  23. package/src/slack/handlers.test.ts +35 -0
  24. package/src/slack/handlers.ts +79 -2
  25. package/src/tests/base-prompt.test.ts +46 -8
  26. package/src/tests/claude-managed-adapter.test.ts +4 -4
  27. package/src/tests/codex-adapter-otel.test.ts +4 -4
  28. package/src/tests/codex-adapter.test.ts +20 -7
  29. package/src/tests/codex-swarm-events.test.ts +35 -0
  30. package/src/tests/context-window.test.ts +1 -0
  31. package/src/tests/credential-check.test.ts +48 -29
  32. package/src/tests/entrypoint-config-env-export.test.ts +81 -0
  33. package/src/tests/follow-up-redelivery-guard.test.ts +165 -0
  34. package/src/tests/migration-046-budgets.test.ts +6 -5
  35. package/src/tests/pricing-routes.test.ts +6 -5
  36. package/src/tests/provider-adapter.test.ts +10 -10
  37. package/src/tests/provider-command-format.test.ts +4 -4
  38. package/src/tests/session-costs-codex-recompute.test.ts +25 -0
  39. package/src/tools/send-task.ts +30 -9
  40. package/src/utils/context-window.ts +1 -0
  41. package/templates/schedules/daily-blocker-digest/config.json +13 -0
  42. package/templates/schedules/daily-blocker-digest/content.md +150 -0
  43. package/templates/schedules/daily-compounding-reflection/config.json +21 -0
  44. package/templates/schedules/daily-compounding-reflection/content.md +210 -0
  45. package/templates/schedules/daily-hn-briefing/config.json +13 -0
  46. package/templates/schedules/daily-hn-briefing/content.md +97 -0
  47. package/templates/schedules/daily-workflow-health-audit/config.json +13 -0
  48. package/templates/schedules/daily-workflow-health-audit/content.md +189 -0
  49. package/templates/schedules/gtm-weekly-review/config.json +13 -0
  50. package/templates/schedules/gtm-weekly-review/content.md +58 -0
  51. package/templates/schedules/weekly-dependabot-triage/config.json +13 -0
  52. package/templates/schedules/weekly-dependabot-triage/content.md +45 -0
  53. package/templates/schema.ts +26 -0
  54. package/templates/skills/agentmail-sending/config.json +13 -0
  55. package/templates/skills/agentmail-sending/content.md +48 -0
  56. package/templates/skills/artifacts/config.json +13 -0
  57. package/templates/skills/artifacts/content.md +87 -0
  58. package/templates/skills/browser-use-cloud/config.json +13 -0
  59. package/templates/skills/browser-use-cloud/content.md +155 -0
  60. package/templates/skills/desloppify/config.json +13 -0
  61. package/templates/skills/desloppify/content.md +201 -0
  62. package/templates/skills/exa-search/config.json +13 -0
  63. package/templates/skills/exa-search/content.md +106 -0
  64. package/templates/skills/jira-interaction/config.json +13 -0
  65. package/templates/skills/jira-interaction/content.md +252 -0
  66. package/templates/skills/kapso-whatsapp/config.json +13 -0
  67. package/templates/skills/kapso-whatsapp/content.md +369 -0
  68. package/templates/skills/kv-storage/config.json +13 -0
  69. package/templates/skills/kv-storage/content.md +111 -0
  70. package/templates/skills/linear-interaction/config.json +20 -0
  71. package/templates/skills/linear-interaction/content.md +230 -0
  72. package/templates/skills/pages/config.json +18 -0
  73. package/templates/skills/pages/content.md +85 -0
  74. package/templates/skills/profile-corruption-escalation/config.json +13 -0
  75. package/templates/skills/profile-corruption-escalation/content.md +105 -0
  76. package/templates/skills/scheduled-task-resilience/config.json +13 -0
  77. package/templates/skills/scheduled-task-resilience/content.md +95 -0
  78. package/templates/skills/sprite-cli/config.json +13 -0
  79. package/templates/skills/sprite-cli/content.md +133 -0
  80. package/templates/skills/turso-interaction/config.json +13 -0
  81. package/templates/skills/turso-interaction/content.md +192 -0
  82. package/templates/skills/workflow-iterate/config.json +18 -0
  83. package/templates/skills/workflow-iterate/content.md +399 -0
  84. package/templates/skills/workflow-structured-output/config.json +13 -0
  85. package/templates/skills/workflow-structured-output/content.md +101 -0
  86. package/templates/skills/x-api-interactions/config.json +13 -0
  87. package/templates/skills/x-api-interactions/content.md +109 -0
  88. package/templates/workflows/autopilot/config.json +13 -0
  89. package/templates/workflows/autopilot/content.md +58 -0
  90. package/templates/workflows/linear-drain-loop/config.json +21 -0
  91. package/templates/workflows/linear-drain-loop/content.md +72 -0
  92. package/templates/workflows/ralph-loop/config.json +13 -0
  93. package/templates/workflows/ralph-loop/content.md +75 -0
package/README.md CHANGED
@@ -124,6 +124,7 @@ Check [our templates](https://templates.agent-swarm.dev) for a quick start.
124
124
  - **Workflow engine with Human-in-the-Loop** — DAG-based automation with approval gates, retries, and structured I/O. [Workflows →](https://docs.agent-swarm.dev/docs/concepts/workflows)
125
125
  - **Scheduled & recurring tasks** — cron-based automation for standing work. [Scheduling →](https://docs.agent-swarm.dev/docs/concepts/scheduling)
126
126
  - **Harness & LLM agnostic** — run with Claude Code, OpenAI Codex, pi-mono, Devin, Claude Managed Agents, raw LLMs, or opencode. [Harness config →](https://docs.agent-swarm.dev/docs/guides/harness-configuration) · [Add a new provider →](https://docs.agent-swarm.dev/docs/guides/harness-providers)
127
+ - **Follow-up continuity across all harnesses** — child tasks inherit bounded prior-task context even on providers without native session resume, while resumable providers still reuse prior sessions when possible. [Task lifecycle →](https://docs.agent-swarm.dev/docs/concepts/task-lifecycle)
127
128
  - **Skills & MCP servers** — reusable procedural knowledge and per-agent MCP servers with scope cascade. [MCP tools →](https://docs.agent-swarm.dev/docs/reference/mcp-tools)
128
129
  - **DB-backed pages** — agents publish HTML or JSON pages (reports, dashboards, action specs) via the `create_page` MCP tool 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)
129
130
  - **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)
package/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Agent Swarm API",
5
- "version": "1.85.0",
5
+ "version": "1.86.0",
6
6
  "description": "Multi-agent orchestration API for Claude Code, Codex, and Gemini CLI. Enables task distribution, agent communication, and service discovery.\n\nMCP tools are documented separately in [MCP.md](./MCP.md)."
7
7
  },
8
8
  "servers": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desplega.ai/agent-swarm",
3
- "version": "1.85.0",
3
+ "version": "1.86.0",
4
4
  "description": "Multi-agent orchestration for Claude Code, Codex, Gemini CLI, and other AI coding assistants",
5
5
  "license": "MIT",
6
6
  "author": "desplega.sh <contact@desplega.sh>",
@@ -45,6 +45,8 @@
45
45
  "tsc:check": "bun tsc --noEmit",
46
46
  "check:db-boundary": "bash scripts/check-db-boundary.sh",
47
47
  "check:api-key-boundary": "bash scripts/check-api-key-boundary.sh",
48
+ "sync-chart-version": "bun scripts/sync-chart-version.ts",
49
+ "check-chart-version": "bun scripts/sync-chart-version.ts --check-if-package-version-changed",
48
50
  "cli": "bun src/cli.tsx",
49
51
  "hook": "bun src/hooks/hook.ts",
50
52
  "claude": "bun src/cli.tsx claude",
@@ -108,12 +110,12 @@
108
110
  "@desplega.ai/localtunnel": "^2.2.0",
109
111
  "@inkjs/ui": "^2.0.0",
110
112
  "@linear/sdk": "^77.0.0",
111
- "@earendil-works/pi-agent-core": "^0.75.5",
112
- "@earendil-works/pi-ai": "^0.75.5",
113
- "@earendil-works/pi-coding-agent": "^0.75.5",
113
+ "@earendil-works/pi-agent-core": "^0.76.0",
114
+ "@earendil-works/pi-ai": "^0.76.0",
115
+ "@earendil-works/pi-coding-agent": "^0.76.0",
114
116
  "@modelcontextprotocol/sdk": "^1.25.1",
115
- "@openai/codex-sdk": "^0.133.0",
116
- "@opencode-ai/sdk": "^1.15.10",
117
+ "@openai/codex-sdk": "^0.135.0",
118
+ "@opencode-ai/sdk": "^1.15.12",
117
119
  "@openfort/openfort-node": "^0.9.1",
118
120
  "@opentelemetry/api": "^1.9.1",
119
121
  "@opentelemetry/exporter-trace-otlp-http": "^0.218.0",
package/src/be/db.ts CHANGED
@@ -1875,6 +1875,50 @@ export function findCompletedTaskInThread(
1875
1875
  return row ? rowToAgentTask(row) : null;
1876
1876
  }
1877
1877
 
1878
+ /**
1879
+ * Find the most recent CANCELLED task in a Slack thread. Used by the
1880
+ * follow-up re-delegation guard so a cancellation (worker SIGTERM,
1881
+ * runner-side abort, swarm-events tool-loop abort) doesn't permanently
1882
+ * jam re-dispatch when an earlier sibling task in the same thread also
1883
+ * completed.
1884
+ *
1885
+ * Matches both:
1886
+ * - `status = 'cancelled'` (the canonical terminal state from cancelTask)
1887
+ * - `status = 'failed'` with a failureReason that starts with "cancelled"
1888
+ * or "exit 130" or contains "cancelled" (the codex-adapter abort path
1889
+ * emits `failureReason: "cancelled"` and exits 130).
1890
+ */
1891
+ export function findRecentCancelledTaskInThread(
1892
+ channelId: string,
1893
+ threadTs: string,
1894
+ windowMinutes: number,
1895
+ ): AgentTask | null {
1896
+ const since = new Date(Date.now() - windowMinutes * 60 * 1000).toISOString();
1897
+ const row = getDb()
1898
+ .prepare<AgentTaskRow, [string, string, string]>(
1899
+ `SELECT * FROM agent_tasks
1900
+ WHERE slackChannelId = ?
1901
+ AND slackThreadTs = ?
1902
+ AND lastUpdatedAt > ?
1903
+ AND (
1904
+ status = 'cancelled'
1905
+ OR (
1906
+ status = 'failed'
1907
+ AND failureReason IS NOT NULL
1908
+ AND (
1909
+ failureReason LIKE 'cancelled%'
1910
+ OR failureReason LIKE 'exit 130%'
1911
+ OR failureReason LIKE '%cancelled%'
1912
+ )
1913
+ )
1914
+ )
1915
+ ORDER BY lastUpdatedAt DESC
1916
+ LIMIT 1`,
1917
+ )
1918
+ .get(channelId, threadTs, since);
1919
+ return row ? rowToAgentTask(row) : null;
1920
+ }
1921
+
1878
1922
  export function completeTask(id: string, output?: string): AgentTask | null {
1879
1923
  const oldTask = getTaskById(id);
1880
1924
  if (!oldTask) return null;
@@ -0,0 +1,15 @@
1
+ -- 078_backfill_gpt_5_5_pricing.sql
2
+ -- Backfill Codex GPT-5.5 pricing into existing databases.
3
+ --
4
+ -- The vendored models.dev cache already contains gpt-5.5, and fresh server
5
+ -- boots seed it from src/be/seed-pricing.ts. Existing long-lived DBs can still
6
+ -- be missing those rows, which makes real gpt-5.5 Codex runs land as
7
+ -- costSource='unpriced'. Keep this migration idempotent so every environment
8
+ -- gets the baseline Standard-tier rates.
9
+
10
+ INSERT OR IGNORE INTO pricing
11
+ (provider, model, token_class, effective_from, price_per_million_usd, createdAt, lastUpdatedAt)
12
+ VALUES
13
+ ('codex', 'gpt-5.5', 'input', 0, 5.0, 0, 0),
14
+ ('codex', 'gpt-5.5', 'cached_input', 0, 0.5, 0, 0),
15
+ ('codex', 'gpt-5.5', 'output', 0, 30.0, 0, 0);