@desplega.ai/agent-swarm 1.81.1 → 1.82.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 (92) hide show
  1. package/openapi.json +123 -1
  2. package/package.json +3 -2
  3. package/src/be/db.ts +603 -96
  4. package/src/be/migrations/069_agent_tasks_perf_indexes.sql +17 -0
  5. package/src/be/migrations/070_seed_state.sql +22 -0
  6. package/src/be/migrations/071_codex_oauth_pool.sql +8 -0
  7. package/src/be/migrations/072_task_attachments.sql +38 -0
  8. package/src/be/scripts/typecheck.ts +450 -7
  9. package/src/be/seed/index.ts +9 -0
  10. package/src/be/seed/registry.ts +18 -0
  11. package/src/be/seed/runner.ts +98 -0
  12. package/src/be/seed/state-db.ts +36 -0
  13. package/src/be/seed/types.ts +59 -0
  14. package/src/be/seed-scripts/catalog/date-resolve.ts +104 -0
  15. package/src/be/seed-scripts/catalog/fetch-readable.ts +77 -0
  16. package/src/be/seed-scripts/catalog/gh-pr-snapshot.ts +104 -0
  17. package/src/be/seed-scripts/catalog/group-count.ts +70 -0
  18. package/src/be/seed-scripts/catalog/json-query.ts +124 -0
  19. package/src/be/seed-scripts/catalog/linear-issue.ts +103 -0
  20. package/src/be/seed-scripts/catalog/memory-dedup-check.ts +61 -0
  21. package/src/be/seed-scripts/catalog/slack-thread-flatten.ts +86 -0
  22. package/src/be/seed-scripts/catalog/task-failure-audit.ts +87 -0
  23. package/src/be/seed-scripts/catalog/text-diff.ts +103 -0
  24. package/src/be/seed-scripts/index.ts +183 -0
  25. package/src/cli.tsx +2 -0
  26. package/src/commands/codex-login.ts +36 -6
  27. package/src/commands/runner.ts +133 -44
  28. package/src/http/agents.ts +7 -1
  29. package/src/http/index.ts +123 -74
  30. package/src/http/pages.ts +25 -5
  31. package/src/http/route-def.ts +63 -0
  32. package/src/http/schedules.ts +11 -2
  33. package/src/http/scripts.ts +10 -1
  34. package/src/http/sessions.ts +24 -3
  35. package/src/http/skills.ts +8 -1
  36. package/src/http/stats.ts +19 -0
  37. package/src/http/tasks.ts +13 -2
  38. package/src/http/utils.ts +44 -0
  39. package/src/http/workflows.ts +11 -1
  40. package/src/http.ts +2 -0
  41. package/src/otel-impl.ts +34 -4
  42. package/src/otel.ts +1 -3
  43. package/src/providers/claude-adapter.ts +61 -0
  44. package/src/providers/codex-adapter.ts +22 -1
  45. package/src/providers/codex-oauth/auth-json-fs.ts +52 -0
  46. package/src/providers/codex-oauth/auth-json.ts +3 -3
  47. package/src/providers/codex-oauth/storage.ts +81 -21
  48. package/src/providers/otel-env.ts +63 -0
  49. package/src/providers/types.ts +5 -0
  50. package/src/scripts-runtime/eval-harness.ts +70 -3
  51. package/src/scripts-runtime/executors/native.ts +19 -1
  52. package/src/scripts-runtime/executors/types.ts +17 -0
  53. package/src/scripts-runtime/loader.ts +2 -0
  54. package/src/server.ts +2 -0
  55. package/src/tests/claude-adapter-otel.test.ts +225 -0
  56. package/src/tests/codex-adapter-otel.test.ts +120 -0
  57. package/src/tests/codex-login.test.ts +142 -0
  58. package/src/tests/codex-oauth-adapter.test.ts +108 -0
  59. package/src/tests/codex-oauth-auth-json-fs.test.ts +112 -0
  60. package/src/tests/codex-oauth-storage.test.ts +262 -86
  61. package/src/tests/codex-pool.test.ts +284 -0
  62. package/src/tests/http-semconv-attributes.test.ts +92 -0
  63. package/src/tests/list-endpoint-slimming.test.ts +179 -0
  64. package/src/tests/mcp-tools-user.test.ts +48 -1
  65. package/src/tests/otel-env.test.ts +103 -0
  66. package/src/tests/otel-service-name.test.ts +55 -0
  67. package/src/tests/pagination-metrics.test.ts +165 -0
  68. package/src/tests/prompt-template-resolver.test.ts +1 -1
  69. package/src/tests/route-def-find-route.test.ts +106 -0
  70. package/src/tests/scripts-http.test.ts +110 -0
  71. package/src/tests/scripts-runtime.test.ts +1 -0
  72. package/src/tests/scripts-typecheck.test.ts +175 -0
  73. package/src/tests/seed-scripts.test.ts +220 -0
  74. package/src/tests/seed.test.ts +163 -0
  75. package/src/tests/send-task-requested-by.test.ts +154 -0
  76. package/src/tests/store-progress-attachments.test.ts +312 -0
  77. package/src/tests/workflow-http-v2.test.ts +16 -2
  78. package/src/tools/get-metrics.ts +46 -0
  79. package/src/tools/get-swarm.ts +10 -3
  80. package/src/tools/get-task-details.ts +15 -2
  81. package/src/tools/get-tasks.ts +22 -5
  82. package/src/tools/resolve-user.ts +25 -10
  83. package/src/tools/schedules/list-schedules.ts +15 -4
  84. package/src/tools/send-task.ts +16 -0
  85. package/src/tools/store-progress.ts +66 -4
  86. package/src/tools/tool-config.ts +2 -1
  87. package/src/tools/utils.ts +3 -1
  88. package/src/tools/workflows/list-workflows.ts +12 -3
  89. package/src/types.ts +128 -0
  90. package/src/utils/internal-ai/register-bedrock.ts +34 -0
  91. package/src/utils/secret-scrubber.ts +3 -0
  92. /package/src/be/{seed.ts → seed-prompt-templates.ts} +0 -0
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.81.1",
5
+ "version": "1.82.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": [
@@ -360,6 +360,7 @@
360
360
  },
361
361
  "get": {
362
362
  "summary": "List all agents",
363
+ "description": "Returns agents WITHOUT the six identity-markdown blobs (`claudeMd`/`soulMd`/`identityMd`/`toolsMd`/`heartbeatMd`/`setupScript`) by default — they bloat the list by ~16 KB/agent and the overview never renders them. Pass `fields=full` to restore them, or fetch a single agent via `GET /api/agents/{id}`.",
363
364
  "tags": [
364
365
  "Agents"
365
366
  ],
@@ -379,6 +380,18 @@
379
380
  "required": false,
380
381
  "name": "include",
381
382
  "in": "query"
383
+ },
384
+ {
385
+ "schema": {
386
+ "type": "string",
387
+ "enum": [
388
+ "full",
389
+ "slim"
390
+ ]
391
+ },
392
+ "required": false,
393
+ "name": "fields",
394
+ "in": "query"
382
395
  }
383
396
  ],
384
397
  "responses": {
@@ -4524,6 +4537,7 @@
4524
4537
  },
4525
4538
  "get": {
4526
4539
  "summary": "List pages",
4540
+ "description": "Returns pages WITHOUT the heavy `body` (the full HTML/JSON document) and `passwordHash` by default — list views never render the body. Pass `fields=full` to restore `body`. Fetch a full page via `GET /api/pages/{id}`.",
4527
4541
  "tags": [
4528
4542
  "Pages"
4529
4543
  ],
@@ -4563,6 +4577,18 @@
4563
4577
  "required": false,
4564
4578
  "name": "offset",
4565
4579
  "in": "query"
4580
+ },
4581
+ {
4582
+ "schema": {
4583
+ "type": "string",
4584
+ "enum": [
4585
+ "full",
4586
+ "slim"
4587
+ ]
4588
+ },
4589
+ "required": false,
4590
+ "name": "fields",
4591
+ "in": "query"
4566
4592
  }
4567
4593
  ],
4568
4594
  "responses": {
@@ -6731,6 +6757,7 @@
6731
6757
  },
6732
6758
  "get": {
6733
6759
  "summary": "List schedules",
6760
+ "description": "Returns schedules with the full `taskTemplate` replaced by a short `taskTemplatePreview` by default — list views never render the full template. Pass `fields=full` to restore `taskTemplate`. Fetch the full template via `GET /api/schedules/{id}`.",
6734
6761
  "tags": [
6735
6762
  "Schedules"
6736
6763
  ],
@@ -6783,6 +6810,18 @@
6783
6810
  "required": false,
6784
6811
  "name": "hideCompleted",
6785
6812
  "in": "query"
6813
+ },
6814
+ {
6815
+ "schema": {
6816
+ "type": "string",
6817
+ "enum": [
6818
+ "full",
6819
+ "slim"
6820
+ ]
6821
+ },
6822
+ "required": false,
6823
+ "name": "fields",
6824
+ "in": "query"
6786
6825
  }
6787
6826
  ],
6788
6827
  "responses": {
@@ -7312,6 +7351,7 @@
7312
7351
  "/api/sessions": {
7313
7352
  "get": {
7314
7353
  "summary": "List recent task sessions (root tasks + chain summary)",
7354
+ "description": "Each item's `root` is a slim task summary by default — the full `task` text is replaced with a bounded `taskPreview` and completion/integration blobs are dropped. Pass `fields=full` to restore the full root `AgentTask`. The full root + descendant chain are on `GET /api/sessions/{rootTaskId}`.",
7315
7355
  "tags": [
7316
7356
  "Sessions"
7317
7357
  ],
@@ -7367,6 +7407,18 @@
7367
7407
  "required": false,
7368
7408
  "name": "requestedByUserId",
7369
7409
  "in": "query"
7410
+ },
7411
+ {
7412
+ "schema": {
7413
+ "type": "string",
7414
+ "enum": [
7415
+ "full",
7416
+ "slim"
7417
+ ]
7418
+ },
7419
+ "required": false,
7420
+ "name": "fields",
7421
+ "in": "query"
7370
7422
  }
7371
7423
  ],
7372
7424
  "responses": {
@@ -7416,6 +7468,7 @@
7416
7468
  "/api/skills": {
7417
7469
  "get": {
7418
7470
  "summary": "List skills with optional filters",
7471
+ "description": "Returns skills WITHOUT the heavy `content` (full SKILL.md) by default — list views never render it. Pass `fields=full` to include `content` (e.g. for SDK consumers that read it from the list).",
7419
7472
  "tags": [
7420
7473
  "Skills"
7421
7474
  ],
@@ -7464,6 +7517,18 @@
7464
7517
  "required": false,
7465
7518
  "name": "search",
7466
7519
  "in": "query"
7520
+ },
7521
+ {
7522
+ "schema": {
7523
+ "type": "string",
7524
+ "enum": [
7525
+ "full",
7526
+ "slim"
7527
+ ]
7528
+ },
7529
+ "required": false,
7530
+ "name": "fields",
7531
+ "in": "query"
7467
7532
  }
7468
7533
  ],
7469
7534
  "responses": {
@@ -8931,6 +8996,25 @@
8931
8996
  }
8932
8997
  }
8933
8998
  },
8999
+ "/api/metrics": {
9000
+ "get": {
9001
+ "summary": "Lightweight swarm-wide counts",
9002
+ "description": "Single JSON object of cheap `COUNT(*)` metrics — tasks (by status), agents (by status), workflows (total + enabled), pages, active sessions, skills. Use this instead of fetching full list payloads just to count. Powers UI footers/sidebars and MCP context.",
9003
+ "tags": [
9004
+ "Stats"
9005
+ ],
9006
+ "security": [
9007
+ {
9008
+ "bearerAuth": []
9009
+ }
9010
+ ],
9011
+ "responses": {
9012
+ "200": {
9013
+ "description": "Swarm metrics counts"
9014
+ }
9015
+ }
9016
+ }
9017
+ },
8934
9018
  "/api/services": {
8935
9019
  "get": {
8936
9020
  "summary": "List all registered services",
@@ -9355,6 +9439,7 @@
9355
9439
  "/api/tasks": {
9356
9440
  "get": {
9357
9441
  "summary": "List tasks with filters",
9442
+ "description": "Returns tasks with the full `task` text replaced by a bounded `taskPreview` and completion/integration blobs dropped by default — list views only need the preview. Pass `fields=full` to restore the full `AgentTask`. Fetch a single task in full via `GET /api/tasks/{id}`.",
9358
9443
  "tags": [
9359
9444
  "Tasks"
9360
9445
  ],
@@ -9446,6 +9531,18 @@
9446
9531
  "required": false,
9447
9532
  "name": "offset",
9448
9533
  "in": "query"
9534
+ },
9535
+ {
9536
+ "schema": {
9537
+ "type": "string",
9538
+ "enum": [
9539
+ "full",
9540
+ "slim"
9541
+ ]
9542
+ },
9543
+ "required": false,
9544
+ "name": "fields",
9545
+ "in": "query"
9449
9546
  }
9450
9547
  ],
9451
9548
  "responses": {
@@ -9715,6 +9812,16 @@
9715
9812
  "required": true,
9716
9813
  "name": "id",
9717
9814
  "in": "path"
9815
+ },
9816
+ {
9817
+ "schema": {
9818
+ "type": "integer",
9819
+ "minimum": 1,
9820
+ "maximum": 1000
9821
+ },
9822
+ "required": false,
9823
+ "name": "logsLimit",
9824
+ "in": "query"
9718
9825
  }
9719
9826
  ],
9720
9827
  "responses": {
@@ -11223,6 +11330,7 @@
11223
11330
  "/api/workflows": {
11224
11331
  "get": {
11225
11332
  "summary": "List all workflows",
11333
+ "description": "Returns workflows WITHOUT the heavy `definition` (the full DAG) by default — the list view only needs a `nodeCount`, which is included. Pass `fields=full` to restore `definition` + trigger config. Fetch the full workflow via `GET /api/workflows/{id}`.",
11226
11334
  "tags": [
11227
11335
  "Workflows"
11228
11336
  ],
@@ -11231,6 +11339,20 @@
11231
11339
  "bearerAuth": []
11232
11340
  }
11233
11341
  ],
11342
+ "parameters": [
11343
+ {
11344
+ "schema": {
11345
+ "type": "string",
11346
+ "enum": [
11347
+ "full",
11348
+ "slim"
11349
+ ]
11350
+ },
11351
+ "required": false,
11352
+ "name": "fields",
11353
+ "in": "query"
11354
+ }
11355
+ ],
11234
11356
  "responses": {
11235
11357
  "200": {
11236
11358
  "description": "Workflow list"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desplega.ai/agent-swarm",
3
- "version": "1.81.1",
3
+ "version": "1.82.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>",
@@ -85,7 +85,8 @@
85
85
  "pm2-status": "pm2 status swarm-api swarm-ui swarm-lead swarm-worker",
86
86
  "seed": "bun scripts/seed.ts",
87
87
  "seed:clean": "bun scripts/seed.ts --clean",
88
- "seed:people": "bun scripts/seed-people.ts"
88
+ "seed:people": "bun scripts/seed-people.ts",
89
+ "seed:scripts": "bun scripts/seed-scripts.ts"
89
90
  },
90
91
  "devDependencies": {
91
92
  "@biomejs/biome": "^2.3.10",