@desplega.ai/agent-swarm 1.91.0 → 1.92.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 (114) hide show
  1. package/README.md +3 -2
  2. package/openapi.json +1005 -152
  3. package/package.json +6 -6
  4. package/plugin/skills/pages/SKILL.md +5 -2
  5. package/src/be/db.ts +662 -19
  6. package/src/be/memory/constants.ts +2 -1
  7. package/src/be/memory/providers/openai-embedding.ts +2 -5
  8. package/src/be/memory/providers/sqlite-store.ts +293 -76
  9. package/src/be/memory/types.ts +35 -0
  10. package/src/be/migrations/083_script_workflows.sql +51 -0
  11. package/src/be/migrations/084_script_run_journal_duration.sql +5 -0
  12. package/src/be/migrations/085_script_runs_kind.sql +9 -0
  13. package/src/be/migrations/086_pages_default_authed.sql +64 -0
  14. package/src/be/migrations/087_skill_files.sql +19 -0
  15. package/src/be/modelsdev-cache.json +42310 -38617
  16. package/src/be/scripts/typecheck.ts +49 -0
  17. package/src/be/seed-scripts/catalog/boot-triage.ts +221 -0
  18. package/src/be/seed-scripts/catalog/catalog-report.ts +457 -0
  19. package/src/be/seed-scripts/catalog/compound-insights.ts +310 -6
  20. package/src/be/seed-scripts/catalog/gh-pr-snapshot.ts +1 -1
  21. package/src/be/seed-scripts/catalog/memory-eval.ts +1059 -0
  22. package/src/be/seed-scripts/catalog/ops-catalog-audit.ts +506 -0
  23. package/src/be/seed-scripts/catalog/schedule-health.ts +78 -2
  24. package/src/be/seed-scripts/catalog/task-context-gathering.ts +92 -0
  25. package/src/be/seed-scripts/catalog/task-failure-audit.ts +48 -1
  26. package/src/be/seed-scripts/catalog/tool-usage.ts +6 -3
  27. package/src/be/seed-scripts/index.ts +51 -5
  28. package/src/be/seed-skills/index.ts +3 -3
  29. package/src/be/skill-sync.ts +91 -7
  30. package/src/be/swarm-config-guard.ts +17 -0
  31. package/src/commands/runner.ts +49 -4
  32. package/src/heartbeat/templates.ts +20 -16
  33. package/src/http/db-query.ts +20 -5
  34. package/src/http/index.ts +51 -7
  35. package/src/http/mcp-user.ts +23 -0
  36. package/src/http/mcp.ts +58 -0
  37. package/src/http/memory.ts +58 -0
  38. package/src/http/pages.ts +1 -1
  39. package/src/http/script-runs.ts +557 -0
  40. package/src/http/scripts.ts +39 -2
  41. package/src/http/skills.ts +225 -0
  42. package/src/prompts/session-templates.ts +24 -4
  43. package/src/providers/claude-adapter.ts +107 -28
  44. package/src/script-workflows/executor.ts +110 -0
  45. package/src/script-workflows/harness.ts +73 -0
  46. package/src/script-workflows/label-lint.ts +51 -0
  47. package/src/script-workflows/limits.ts +22 -0
  48. package/src/script-workflows/supervisor.ts +139 -0
  49. package/src/script-workflows/workflow-ctx.ts +209 -0
  50. package/src/scripts-runtime/sdk-allowlist.ts +4 -0
  51. package/src/scripts-runtime/swarm-sdk.ts +13 -0
  52. package/src/scripts-runtime/types/stdlib.d.ts +61 -0
  53. package/src/scripts-runtime/types/swarm-sdk.d.ts +61 -0
  54. package/src/server.ts +4 -0
  55. package/src/slack/handlers.ts +11 -4
  56. package/src/slack/message-text.ts +98 -0
  57. package/src/slack/thread-buffer.ts +5 -3
  58. package/src/tests/claude-adapter-binary.test.ts +271 -74
  59. package/src/tests/create-page-tool.test.ts +19 -2
  60. package/src/tests/db-query.test.ts +28 -0
  61. package/src/tests/error-tracker.test.ts +121 -0
  62. package/src/tests/harness-provider-resolution.test.ts +33 -0
  63. package/src/tests/heartbeat-checklist.test.ts +36 -0
  64. package/src/tests/mcp-tools.test.ts +6 -0
  65. package/src/tests/mcp-transport-gc.test.ts +58 -0
  66. package/src/tests/memory-health-endpoint.test.ts +78 -0
  67. package/src/tests/memory-store.test.ts +221 -1
  68. package/src/tests/pages-http.test.ts +20 -2
  69. package/src/tests/pages-storage.test.ts +26 -0
  70. package/src/tests/prompt-template-session.test.ts +34 -5
  71. package/src/tests/script-runs-http.test.ts +278 -0
  72. package/src/tests/script-workflows-label-lint.test.ts +43 -0
  73. package/src/tests/script-workflows-runtime-e2e.test.ts +170 -0
  74. package/src/tests/scripts-mcp-e2e.test.ts +102 -2
  75. package/src/tests/seed-scripts.test.ts +468 -3
  76. package/src/tests/skill-files-http.test.ts +171 -0
  77. package/src/tests/skill-files.test.ts +162 -0
  78. package/src/tests/skill-get-file-tool.test.ts +110 -0
  79. package/src/tests/skill-sync.test.ts +125 -6
  80. package/src/tests/slack-message-text.test.ts +250 -0
  81. package/src/tests/system-default-skills.test.ts +40 -0
  82. package/src/tools/create-page.ts +2 -2
  83. package/src/tools/db-query.ts +16 -6
  84. package/src/tools/script-runs.ts +123 -0
  85. package/src/tools/skills/index.ts +1 -0
  86. package/src/tools/skills/skill-get-file.ts +80 -0
  87. package/src/tools/slack-read.ts +12 -3
  88. package/src/tools/tool-config.ts +6 -2
  89. package/src/types.ts +72 -0
  90. package/src/utils/error-tracker.ts +40 -1
  91. package/src/utils/internal-ai/complete-structured.ts +10 -4
  92. package/src/workflows/executors/raw-llm.ts +76 -59
  93. package/templates/schedules/daily-blocker-digest/content.md +68 -54
  94. package/templates/schedules/daily-compounding-reflection/content.md +4 -4
  95. package/templates/schedules/daily-hn-briefing/content.md +5 -5
  96. package/templates/schedules/daily-workflow-health-audit/content.md +6 -6
  97. package/templates/schedules/gtm-weekly-review/content.md +9 -9
  98. package/templates/schedules/weekly-dependabot-triage/content.md +24 -20
  99. package/templates/skills/agentmail-sending/content.md +6 -7
  100. package/templates/skills/desloppify/content.md +8 -9
  101. package/templates/skills/jira-interaction/content.md +25 -33
  102. package/templates/skills/kapso-whatsapp/content.md +29 -30
  103. package/templates/skills/linear-interaction/content.md +8 -9
  104. package/templates/skills/pages/content.md +205 -55
  105. package/templates/skills/profile-corruption-escalation/content.md +44 -85
  106. package/templates/skills/script-workflows/config.json +14 -0
  107. package/templates/skills/script-workflows/content.md +68 -0
  108. package/templates/skills/sprite-cli/content.md +4 -5
  109. package/templates/skills/swarm-scripts/content.md +2 -3
  110. package/templates/skills/turso-interaction/content.md +14 -17
  111. package/templates/skills/workflow-iterate/content.md +38 -391
  112. package/templates/skills/x-api-interactions/content.md +4 -6
  113. package/templates/skills/scheduled-task-resilience/config.json +0 -14
  114. package/templates/skills/scheduled-task-resilience/content.md +0 -95
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.91.0",
5
+ "version": "1.92.1",
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": [
@@ -2332,15 +2332,18 @@
2332
2332
  "minLength": 1,
2333
2333
  "maxLength": 10000
2334
2334
  },
2335
+ "query": {
2336
+ "type": "string",
2337
+ "minLength": 1,
2338
+ "maxLength": 10000,
2339
+ "description": "Deprecated runtime alias for sql."
2340
+ },
2335
2341
  "params": {
2336
2342
  "type": "array",
2337
2343
  "items": {},
2338
2344
  "default": []
2339
2345
  }
2340
- },
2341
- "required": [
2342
- "sql"
2343
- ]
2346
+ }
2344
2347
  }
2345
2348
  }
2346
2349
  }
@@ -4257,6 +4260,24 @@
4257
4260
  }
4258
4261
  }
4259
4262
  },
4263
+ "/api/memory/health": {
4264
+ "get": {
4265
+ "summary": "Report memory vector index health and retrieval mode",
4266
+ "tags": [
4267
+ "Memory"
4268
+ ],
4269
+ "security": [
4270
+ {
4271
+ "bearerAuth": []
4272
+ }
4273
+ ],
4274
+ "responses": {
4275
+ "200": {
4276
+ "description": "Memory vector index health"
4277
+ }
4278
+ }
4279
+ }
4280
+ },
4260
4281
  "/api/memory/{id}": {
4261
4282
  "delete": {
4262
4283
  "summary": "Delete a single memory by ID (debug/admin)",
@@ -4596,7 +4617,8 @@
4596
4617
  "public",
4597
4618
  "authed",
4598
4619
  "password"
4599
- ]
4620
+ ],
4621
+ "default": "authed"
4600
4622
  },
4601
4623
  "password": {
4602
4624
  "type": "string",
@@ -4615,7 +4637,6 @@
4615
4637
  "required": [
4616
4638
  "title",
4617
4639
  "contentType",
4618
- "authMode",
4619
4640
  "body"
4620
4641
  ]
4621
4642
  }
@@ -7123,11 +7144,13 @@
7123
7144
  }
7124
7145
  }
7125
7146
  },
7126
- "/api/session-logs": {
7147
+ "/api/script-runs": {
7127
7148
  "post": {
7128
- "summary": "Store session logs",
7149
+ "operationId": "script_runs_create",
7150
+ "summary": "Launch a durable script workflow run",
7151
+ "description": "Foundation endpoint for Script Workflows v1. In PR 1 it persists the run and returns its dashboard URL; spawning is added by the supervisor PR.",
7129
7152
  "tags": [
7130
- "Session Data"
7153
+ "Script Runs"
7131
7154
  ],
7132
7155
  "security": [
7133
7156
  {
@@ -7140,32 +7163,31 @@
7140
7163
  "schema": {
7141
7164
  "type": "object",
7142
7165
  "properties": {
7143
- "sessionId": {
7166
+ "source": {
7144
7167
  "type": "string",
7145
7168
  "minLength": 1
7146
7169
  },
7147
- "iteration": {
7148
- "type": "integer",
7149
- "minimum": 1
7170
+ "args": {},
7171
+ "background": {
7172
+ "type": "boolean",
7173
+ "default": true
7150
7174
  },
7151
- "lines": {
7152
- "type": "array",
7153
- "items": {
7154
- "type": "string"
7155
- },
7156
- "minItems": 1
7175
+ "idempotencyKey": {
7176
+ "type": "string",
7177
+ "minLength": 1,
7178
+ "maxLength": 200
7157
7179
  },
7158
- "taskId": {
7159
- "type": "string"
7180
+ "scriptName": {
7181
+ "type": "string",
7182
+ "minLength": 1,
7183
+ "maxLength": 200
7160
7184
  },
7161
- "cli": {
7185
+ "requestedByUserId": {
7162
7186
  "type": "string"
7163
7187
  }
7164
7188
  },
7165
7189
  "required": [
7166
- "sessionId",
7167
- "iteration",
7168
- "lines"
7190
+ "source"
7169
7191
  ]
7170
7192
  }
7171
7193
  }
@@ -7173,19 +7195,24 @@
7173
7195
  },
7174
7196
  "responses": {
7175
7197
  "201": {
7176
- "description": "Logs stored"
7198
+ "description": "Script run created"
7177
7199
  },
7178
7200
  "400": {
7179
- "description": "Validation error"
7201
+ "description": "Validation or label-lint failure"
7202
+ },
7203
+ "409": {
7204
+ "description": "Existing idempotent run returned"
7205
+ },
7206
+ "429": {
7207
+ "description": "Script run concurrency cap reached"
7180
7208
  }
7181
7209
  }
7182
- }
7183
- },
7184
- "/api/tasks/{taskId}/session-logs": {
7210
+ },
7185
7211
  "get": {
7186
- "summary": "Get session logs for a task",
7212
+ "operationId": "script_runs_list",
7213
+ "summary": "List script workflow runs",
7187
7214
  "tags": [
7188
- "Session Data"
7215
+ "Script Runs"
7189
7216
  ],
7190
7217
  "security": [
7191
7218
  {
@@ -7193,143 +7220,97 @@
7193
7220
  }
7194
7221
  ],
7195
7222
  "parameters": [
7223
+ {
7224
+ "schema": {
7225
+ "type": "string",
7226
+ "enum": [
7227
+ "running",
7228
+ "paused",
7229
+ "completed",
7230
+ "failed",
7231
+ "cancelled",
7232
+ "aborted_limit"
7233
+ ]
7234
+ },
7235
+ "required": false,
7236
+ "name": "status",
7237
+ "in": "query"
7238
+ },
7196
7239
  {
7197
7240
  "schema": {
7198
7241
  "type": "string"
7199
7242
  },
7200
- "required": true,
7201
- "name": "taskId",
7202
- "in": "path"
7243
+ "required": false,
7244
+ "name": "agentId",
7245
+ "in": "query"
7203
7246
  },
7204
7247
  {
7205
7248
  "schema": {
7206
7249
  "type": "integer",
7207
7250
  "minimum": 1,
7208
- "maximum": 1000
7251
+ "maximum": 500
7209
7252
  },
7210
7253
  "required": false,
7211
7254
  "name": "limit",
7212
7255
  "in": "query"
7256
+ },
7257
+ {
7258
+ "schema": {
7259
+ "type": [
7260
+ "integer",
7261
+ "null"
7262
+ ],
7263
+ "minimum": 0
7264
+ },
7265
+ "required": false,
7266
+ "name": "offset",
7267
+ "in": "query"
7213
7268
  }
7214
7269
  ],
7215
7270
  "responses": {
7216
7271
  "200": {
7217
- "description": "Session logs"
7218
- },
7219
- "404": {
7220
- "description": "Task not found"
7272
+ "description": "Paginated script run list"
7221
7273
  }
7222
7274
  }
7223
7275
  }
7224
7276
  },
7225
- "/api/session-costs": {
7226
- "post": {
7227
- "summary": "Store session cost record",
7277
+ "/api/script-runs/{id}": {
7278
+ "get": {
7279
+ "operationId": "script_runs_get",
7280
+ "summary": "Get a script workflow run with journal",
7228
7281
  "tags": [
7229
- "Session Data"
7282
+ "Script Runs"
7230
7283
  ],
7231
7284
  "security": [
7232
7285
  {
7233
7286
  "bearerAuth": []
7234
7287
  }
7235
7288
  ],
7236
- "requestBody": {
7237
- "content": {
7238
- "application/json": {
7239
- "schema": {
7240
- "type": "object",
7241
- "properties": {
7242
- "sessionId": {
7243
- "type": "string",
7244
- "minLength": 1
7245
- },
7246
- "agentId": {
7247
- "type": "string",
7248
- "minLength": 1
7249
- },
7250
- "totalCostUsd": {
7251
- "type": "number"
7252
- },
7253
- "taskId": {
7254
- "type": "string"
7255
- },
7256
- "inputTokens": {
7257
- "type": "integer"
7258
- },
7259
- "outputTokens": {
7260
- "type": "integer"
7261
- },
7262
- "cacheReadTokens": {
7263
- "type": "integer"
7264
- },
7265
- "cacheWriteTokens": {
7266
- "type": [
7267
- "integer",
7268
- "null"
7269
- ]
7270
- },
7271
- "reasoningOutputTokens": {
7272
- "type": "integer",
7273
- "minimum": 0
7274
- },
7275
- "thinkingTokens": {
7276
- "type": "integer",
7277
- "minimum": 0
7278
- },
7279
- "durationMs": {
7280
- "type": "integer"
7281
- },
7282
- "numTurns": {
7283
- "type": [
7284
- "integer",
7285
- "null"
7286
- ]
7287
- },
7288
- "model": {
7289
- "type": "string"
7290
- },
7291
- "isError": {
7292
- "type": "boolean"
7293
- },
7294
- "provider": {
7295
- "type": "string",
7296
- "enum": [
7297
- "claude",
7298
- "claude-managed",
7299
- "codex",
7300
- "pi",
7301
- "opencode",
7302
- "devin",
7303
- "gemini"
7304
- ]
7305
- },
7306
- "createdAt": {
7307
- "type": "integer",
7308
- "minimum": 0
7309
- }
7310
- },
7311
- "required": [
7312
- "sessionId",
7313
- "agentId",
7314
- "totalCostUsd"
7315
- ]
7316
- }
7317
- }
7289
+ "parameters": [
7290
+ {
7291
+ "schema": {
7292
+ "type": "string",
7293
+ "format": "uuid"
7294
+ },
7295
+ "required": true,
7296
+ "name": "id",
7297
+ "in": "path"
7318
7298
  }
7319
- },
7299
+ ],
7320
7300
  "responses": {
7321
- "201": {
7322
- "description": "Cost record stored"
7301
+ "200": {
7302
+ "description": "Script run detail"
7323
7303
  },
7324
- "400": {
7325
- "description": "Validation error"
7304
+ "404": {
7305
+ "description": "Script run not found"
7326
7306
  }
7327
7307
  }
7328
7308
  },
7329
- "get": {
7330
- "summary": "Query session costs with filters",
7309
+ "delete": {
7310
+ "operationId": "script_runs_cancel",
7311
+ "summary": "Cancel a script workflow run",
7331
7312
  "tags": [
7332
- "Session Data"
7313
+ "Script Runs"
7333
7314
  ],
7334
7315
  "security": [
7335
7316
  {
@@ -7339,32 +7320,653 @@
7339
7320
  "parameters": [
7340
7321
  {
7341
7322
  "schema": {
7342
- "type": "string"
7323
+ "type": "string",
7324
+ "format": "uuid"
7343
7325
  },
7344
- "required": false,
7345
- "name": "agentId",
7346
- "in": "query"
7326
+ "required": true,
7327
+ "name": "id",
7328
+ "in": "path"
7329
+ }
7330
+ ],
7331
+ "responses": {
7332
+ "204": {
7333
+ "description": "Script run cancelled, or already terminal"
7347
7334
  },
7335
+ "404": {
7336
+ "description": "Script run not found"
7337
+ }
7338
+ }
7339
+ }
7340
+ },
7341
+ "/api/internal/script-runs/{runId}/steps/{stepKey}": {
7342
+ "get": {
7343
+ "operationId": "script_runs_internal_step_get",
7344
+ "summary": "Get a script run journal step",
7345
+ "tags": [
7346
+ "Script Runs"
7347
+ ],
7348
+ "security": [
7348
7349
  {
7349
- "schema": {
7350
- "type": "string"
7351
- },
7352
- "required": false,
7353
- "name": "taskId",
7354
- "in": "query"
7355
- },
7350
+ "bearerAuth": []
7351
+ }
7352
+ ],
7353
+ "parameters": [
7356
7354
  {
7357
7355
  "schema": {
7358
- "type": "string"
7356
+ "type": "string",
7357
+ "format": "uuid"
7359
7358
  },
7360
- "required": false,
7361
- "name": "startDate",
7362
- "in": "query"
7359
+ "required": true,
7360
+ "name": "runId",
7361
+ "in": "path"
7363
7362
  },
7364
7363
  {
7365
7364
  "schema": {
7366
- "type": "string"
7367
- },
7365
+ "type": "string",
7366
+ "minLength": 1
7367
+ },
7368
+ "required": true,
7369
+ "name": "stepKey",
7370
+ "in": "path"
7371
+ }
7372
+ ],
7373
+ "responses": {
7374
+ "200": {
7375
+ "description": "Journal step found"
7376
+ },
7377
+ "404": {
7378
+ "description": "Journal step not found"
7379
+ }
7380
+ }
7381
+ }
7382
+ },
7383
+ "/api/internal/script-runs/{runId}/steps": {
7384
+ "post": {
7385
+ "operationId": "script_runs_internal_step_create",
7386
+ "summary": "Write a script run journal step",
7387
+ "tags": [
7388
+ "Script Runs"
7389
+ ],
7390
+ "security": [
7391
+ {
7392
+ "bearerAuth": []
7393
+ }
7394
+ ],
7395
+ "parameters": [
7396
+ {
7397
+ "schema": {
7398
+ "type": "string",
7399
+ "format": "uuid"
7400
+ },
7401
+ "required": true,
7402
+ "name": "runId",
7403
+ "in": "path"
7404
+ }
7405
+ ],
7406
+ "requestBody": {
7407
+ "content": {
7408
+ "application/json": {
7409
+ "schema": {
7410
+ "type": "object",
7411
+ "properties": {
7412
+ "stepKey": {
7413
+ "type": "string",
7414
+ "minLength": 1
7415
+ },
7416
+ "stepType": {
7417
+ "type": "string",
7418
+ "minLength": 1
7419
+ },
7420
+ "config": {},
7421
+ "status": {
7422
+ "type": "string",
7423
+ "enum": [
7424
+ "completed",
7425
+ "failed"
7426
+ ]
7427
+ },
7428
+ "result": {},
7429
+ "error": {
7430
+ "type": "string"
7431
+ },
7432
+ "durationMs": {
7433
+ "type": "integer",
7434
+ "minimum": 0
7435
+ }
7436
+ },
7437
+ "required": [
7438
+ "stepKey",
7439
+ "stepType",
7440
+ "status"
7441
+ ]
7442
+ }
7443
+ }
7444
+ }
7445
+ },
7446
+ "responses": {
7447
+ "201": {
7448
+ "description": "Journal step written"
7449
+ },
7450
+ "404": {
7451
+ "description": "Script run not found"
7452
+ }
7453
+ }
7454
+ }
7455
+ },
7456
+ "/api/internal/script-runs/{runId}/heartbeat": {
7457
+ "post": {
7458
+ "operationId": "script_runs_internal_heartbeat",
7459
+ "summary": "Record a script run heartbeat",
7460
+ "tags": [
7461
+ "Script Runs"
7462
+ ],
7463
+ "security": [
7464
+ {
7465
+ "bearerAuth": []
7466
+ }
7467
+ ],
7468
+ "parameters": [
7469
+ {
7470
+ "schema": {
7471
+ "type": "string",
7472
+ "format": "uuid"
7473
+ },
7474
+ "required": true,
7475
+ "name": "runId",
7476
+ "in": "path"
7477
+ }
7478
+ ],
7479
+ "responses": {
7480
+ "204": {
7481
+ "description": "Heartbeat recorded"
7482
+ },
7483
+ "404": {
7484
+ "description": "Script run not found"
7485
+ }
7486
+ }
7487
+ }
7488
+ },
7489
+ "/api/internal/script-runs/{runId}/status": {
7490
+ "post": {
7491
+ "operationId": "script_runs_internal_status",
7492
+ "summary": "Update script run status from subprocess",
7493
+ "tags": [
7494
+ "Script Runs"
7495
+ ],
7496
+ "security": [
7497
+ {
7498
+ "bearerAuth": []
7499
+ }
7500
+ ],
7501
+ "parameters": [
7502
+ {
7503
+ "schema": {
7504
+ "type": "string",
7505
+ "format": "uuid"
7506
+ },
7507
+ "required": true,
7508
+ "name": "runId",
7509
+ "in": "path"
7510
+ }
7511
+ ],
7512
+ "requestBody": {
7513
+ "content": {
7514
+ "application/json": {
7515
+ "schema": {
7516
+ "oneOf": [
7517
+ {
7518
+ "type": "object",
7519
+ "properties": {
7520
+ "status": {
7521
+ "type": "string",
7522
+ "enum": [
7523
+ "completed"
7524
+ ]
7525
+ },
7526
+ "output": {}
7527
+ },
7528
+ "required": [
7529
+ "status"
7530
+ ]
7531
+ },
7532
+ {
7533
+ "type": "object",
7534
+ "properties": {
7535
+ "status": {
7536
+ "type": "string",
7537
+ "enum": [
7538
+ "failed"
7539
+ ]
7540
+ },
7541
+ "error": {
7542
+ "type": "string"
7543
+ }
7544
+ },
7545
+ "required": [
7546
+ "status"
7547
+ ]
7548
+ },
7549
+ {
7550
+ "type": "object",
7551
+ "properties": {
7552
+ "status": {
7553
+ "type": "string",
7554
+ "enum": [
7555
+ "paused"
7556
+ ]
7557
+ }
7558
+ },
7559
+ "required": [
7560
+ "status"
7561
+ ]
7562
+ }
7563
+ ]
7564
+ }
7565
+ }
7566
+ }
7567
+ },
7568
+ "responses": {
7569
+ "204": {
7570
+ "description": "Status updated"
7571
+ },
7572
+ "404": {
7573
+ "description": "Script run not found"
7574
+ }
7575
+ }
7576
+ }
7577
+ },
7578
+ "/api/internal/raw-llm": {
7579
+ "post": {
7580
+ "operationId": "script_runs_internal_raw_llm",
7581
+ "summary": "Execute a raw LLM call for a script workflow",
7582
+ "tags": [
7583
+ "Script Runs"
7584
+ ],
7585
+ "security": [
7586
+ {
7587
+ "bearerAuth": []
7588
+ }
7589
+ ],
7590
+ "requestBody": {
7591
+ "content": {
7592
+ "application/json": {
7593
+ "schema": {
7594
+ "type": "object",
7595
+ "properties": {
7596
+ "prompt": {
7597
+ "type": "string"
7598
+ },
7599
+ "model": {
7600
+ "type": "string"
7601
+ },
7602
+ "schema": {
7603
+ "type": "object",
7604
+ "additionalProperties": {}
7605
+ },
7606
+ "fallbackPort": {
7607
+ "type": "string"
7608
+ }
7609
+ },
7610
+ "required": [
7611
+ "prompt"
7612
+ ]
7613
+ }
7614
+ }
7615
+ }
7616
+ },
7617
+ "responses": {
7618
+ "200": {
7619
+ "description": "LLM call completed"
7620
+ },
7621
+ "500": {
7622
+ "description": "LLM call failed"
7623
+ }
7624
+ }
7625
+ }
7626
+ },
7627
+ "/api/internal/script-runs/{runId}/agent-task": {
7628
+ "post": {
7629
+ "operationId": "script_runs_internal_agent_task",
7630
+ "summary": "Create or wait for a script workflow agent task step",
7631
+ "tags": [
7632
+ "Script Runs"
7633
+ ],
7634
+ "security": [
7635
+ {
7636
+ "bearerAuth": []
7637
+ }
7638
+ ],
7639
+ "parameters": [
7640
+ {
7641
+ "schema": {
7642
+ "type": "string",
7643
+ "format": "uuid"
7644
+ },
7645
+ "required": true,
7646
+ "name": "runId",
7647
+ "in": "path"
7648
+ }
7649
+ ],
7650
+ "requestBody": {
7651
+ "content": {
7652
+ "application/json": {
7653
+ "schema": {
7654
+ "type": "object",
7655
+ "properties": {
7656
+ "stepKey": {
7657
+ "type": "string",
7658
+ "minLength": 1
7659
+ },
7660
+ "template": {
7661
+ "type": "string"
7662
+ },
7663
+ "task": {
7664
+ "type": "string"
7665
+ },
7666
+ "agentId": {
7667
+ "type": "string",
7668
+ "format": "uuid"
7669
+ },
7670
+ "tags": {
7671
+ "type": "array",
7672
+ "items": {
7673
+ "type": "string"
7674
+ }
7675
+ },
7676
+ "priority": {
7677
+ "type": "integer",
7678
+ "minimum": 0,
7679
+ "maximum": 100
7680
+ },
7681
+ "offerMode": {
7682
+ "type": "boolean"
7683
+ },
7684
+ "dir": {
7685
+ "type": "string",
7686
+ "minLength": 1
7687
+ },
7688
+ "vcsRepo": {
7689
+ "type": "string",
7690
+ "minLength": 1
7691
+ },
7692
+ "model": {
7693
+ "type": "string",
7694
+ "minLength": 1
7695
+ },
7696
+ "parentTaskId": {
7697
+ "type": "string",
7698
+ "format": "uuid"
7699
+ },
7700
+ "requestedByUserId": {
7701
+ "type": "string"
7702
+ },
7703
+ "outputSchema": {
7704
+ "type": "object",
7705
+ "additionalProperties": {}
7706
+ }
7707
+ },
7708
+ "required": [
7709
+ "stepKey"
7710
+ ]
7711
+ }
7712
+ }
7713
+ }
7714
+ },
7715
+ "responses": {
7716
+ "200": {
7717
+ "description": "Agent task completed"
7718
+ },
7719
+ "202": {
7720
+ "description": "Agent task created or still running"
7721
+ },
7722
+ "404": {
7723
+ "description": "Script run not found"
7724
+ }
7725
+ }
7726
+ }
7727
+ },
7728
+ "/api/session-logs": {
7729
+ "post": {
7730
+ "summary": "Store session logs",
7731
+ "tags": [
7732
+ "Session Data"
7733
+ ],
7734
+ "security": [
7735
+ {
7736
+ "bearerAuth": []
7737
+ }
7738
+ ],
7739
+ "requestBody": {
7740
+ "content": {
7741
+ "application/json": {
7742
+ "schema": {
7743
+ "type": "object",
7744
+ "properties": {
7745
+ "sessionId": {
7746
+ "type": "string",
7747
+ "minLength": 1
7748
+ },
7749
+ "iteration": {
7750
+ "type": "integer",
7751
+ "minimum": 1
7752
+ },
7753
+ "lines": {
7754
+ "type": "array",
7755
+ "items": {
7756
+ "type": "string"
7757
+ },
7758
+ "minItems": 1
7759
+ },
7760
+ "taskId": {
7761
+ "type": "string"
7762
+ },
7763
+ "cli": {
7764
+ "type": "string"
7765
+ }
7766
+ },
7767
+ "required": [
7768
+ "sessionId",
7769
+ "iteration",
7770
+ "lines"
7771
+ ]
7772
+ }
7773
+ }
7774
+ }
7775
+ },
7776
+ "responses": {
7777
+ "201": {
7778
+ "description": "Logs stored"
7779
+ },
7780
+ "400": {
7781
+ "description": "Validation error"
7782
+ }
7783
+ }
7784
+ }
7785
+ },
7786
+ "/api/tasks/{taskId}/session-logs": {
7787
+ "get": {
7788
+ "summary": "Get session logs for a task",
7789
+ "tags": [
7790
+ "Session Data"
7791
+ ],
7792
+ "security": [
7793
+ {
7794
+ "bearerAuth": []
7795
+ }
7796
+ ],
7797
+ "parameters": [
7798
+ {
7799
+ "schema": {
7800
+ "type": "string"
7801
+ },
7802
+ "required": true,
7803
+ "name": "taskId",
7804
+ "in": "path"
7805
+ },
7806
+ {
7807
+ "schema": {
7808
+ "type": "integer",
7809
+ "minimum": 1,
7810
+ "maximum": 1000
7811
+ },
7812
+ "required": false,
7813
+ "name": "limit",
7814
+ "in": "query"
7815
+ }
7816
+ ],
7817
+ "responses": {
7818
+ "200": {
7819
+ "description": "Session logs"
7820
+ },
7821
+ "404": {
7822
+ "description": "Task not found"
7823
+ }
7824
+ }
7825
+ }
7826
+ },
7827
+ "/api/session-costs": {
7828
+ "post": {
7829
+ "summary": "Store session cost record",
7830
+ "tags": [
7831
+ "Session Data"
7832
+ ],
7833
+ "security": [
7834
+ {
7835
+ "bearerAuth": []
7836
+ }
7837
+ ],
7838
+ "requestBody": {
7839
+ "content": {
7840
+ "application/json": {
7841
+ "schema": {
7842
+ "type": "object",
7843
+ "properties": {
7844
+ "sessionId": {
7845
+ "type": "string",
7846
+ "minLength": 1
7847
+ },
7848
+ "agentId": {
7849
+ "type": "string",
7850
+ "minLength": 1
7851
+ },
7852
+ "totalCostUsd": {
7853
+ "type": "number"
7854
+ },
7855
+ "taskId": {
7856
+ "type": "string"
7857
+ },
7858
+ "inputTokens": {
7859
+ "type": "integer"
7860
+ },
7861
+ "outputTokens": {
7862
+ "type": "integer"
7863
+ },
7864
+ "cacheReadTokens": {
7865
+ "type": "integer"
7866
+ },
7867
+ "cacheWriteTokens": {
7868
+ "type": [
7869
+ "integer",
7870
+ "null"
7871
+ ]
7872
+ },
7873
+ "reasoningOutputTokens": {
7874
+ "type": "integer",
7875
+ "minimum": 0
7876
+ },
7877
+ "thinkingTokens": {
7878
+ "type": "integer",
7879
+ "minimum": 0
7880
+ },
7881
+ "durationMs": {
7882
+ "type": "integer"
7883
+ },
7884
+ "numTurns": {
7885
+ "type": [
7886
+ "integer",
7887
+ "null"
7888
+ ]
7889
+ },
7890
+ "model": {
7891
+ "type": "string"
7892
+ },
7893
+ "isError": {
7894
+ "type": "boolean"
7895
+ },
7896
+ "provider": {
7897
+ "type": "string",
7898
+ "enum": [
7899
+ "claude",
7900
+ "claude-managed",
7901
+ "codex",
7902
+ "pi",
7903
+ "opencode",
7904
+ "devin",
7905
+ "gemini"
7906
+ ]
7907
+ },
7908
+ "createdAt": {
7909
+ "type": "integer",
7910
+ "minimum": 0
7911
+ }
7912
+ },
7913
+ "required": [
7914
+ "sessionId",
7915
+ "agentId",
7916
+ "totalCostUsd"
7917
+ ]
7918
+ }
7919
+ }
7920
+ }
7921
+ },
7922
+ "responses": {
7923
+ "201": {
7924
+ "description": "Cost record stored"
7925
+ },
7926
+ "400": {
7927
+ "description": "Validation error"
7928
+ }
7929
+ }
7930
+ },
7931
+ "get": {
7932
+ "summary": "Query session costs with filters",
7933
+ "tags": [
7934
+ "Session Data"
7935
+ ],
7936
+ "security": [
7937
+ {
7938
+ "bearerAuth": []
7939
+ }
7940
+ ],
7941
+ "parameters": [
7942
+ {
7943
+ "schema": {
7944
+ "type": "string"
7945
+ },
7946
+ "required": false,
7947
+ "name": "agentId",
7948
+ "in": "query"
7949
+ },
7950
+ {
7951
+ "schema": {
7952
+ "type": "string"
7953
+ },
7954
+ "required": false,
7955
+ "name": "taskId",
7956
+ "in": "query"
7957
+ },
7958
+ {
7959
+ "schema": {
7960
+ "type": "string"
7961
+ },
7962
+ "required": false,
7963
+ "name": "startDate",
7964
+ "in": "query"
7965
+ },
7966
+ {
7967
+ "schema": {
7968
+ "type": "string"
7969
+ },
7368
7970
  "required": false,
7369
7971
  "name": "endDate",
7370
7972
  "in": "query"
@@ -7808,6 +8410,257 @@
7808
8410
  }
7809
8411
  }
7810
8412
  },
8413
+ "/api/skills/{id}/files": {
8414
+ "get": {
8415
+ "summary": "List bundled files for a skill",
8416
+ "description": "Returns a manifest of bundled skill files without file content.",
8417
+ "tags": [
8418
+ "Skills"
8419
+ ],
8420
+ "security": [
8421
+ {
8422
+ "bearerAuth": []
8423
+ }
8424
+ ],
8425
+ "parameters": [
8426
+ {
8427
+ "schema": {
8428
+ "type": "string"
8429
+ },
8430
+ "required": true,
8431
+ "name": "id",
8432
+ "in": "path"
8433
+ }
8434
+ ],
8435
+ "responses": {
8436
+ "200": {
8437
+ "description": "Skill file manifest"
8438
+ },
8439
+ "404": {
8440
+ "description": "Skill not found"
8441
+ }
8442
+ }
8443
+ },
8444
+ "post": {
8445
+ "summary": "Bulk upsert bundled files for a skill",
8446
+ "tags": [
8447
+ "Skills"
8448
+ ],
8449
+ "security": [
8450
+ {
8451
+ "bearerAuth": []
8452
+ }
8453
+ ],
8454
+ "parameters": [
8455
+ {
8456
+ "schema": {
8457
+ "type": "string"
8458
+ },
8459
+ "required": true,
8460
+ "name": "id",
8461
+ "in": "path"
8462
+ }
8463
+ ],
8464
+ "requestBody": {
8465
+ "content": {
8466
+ "application/json": {
8467
+ "schema": {
8468
+ "type": "object",
8469
+ "properties": {
8470
+ "files": {
8471
+ "type": "array",
8472
+ "items": {
8473
+ "type": "object",
8474
+ "properties": {
8475
+ "content": {
8476
+ "type": "string"
8477
+ },
8478
+ "mimeType": {
8479
+ "type": "string"
8480
+ },
8481
+ "isBinary": {
8482
+ "type": "boolean"
8483
+ },
8484
+ "size": {
8485
+ "type": "integer",
8486
+ "minimum": 0
8487
+ },
8488
+ "path": {
8489
+ "type": "string",
8490
+ "minLength": 1
8491
+ }
8492
+ },
8493
+ "required": [
8494
+ "content",
8495
+ "path"
8496
+ ]
8497
+ },
8498
+ "maxItems": 100
8499
+ }
8500
+ },
8501
+ "required": [
8502
+ "files"
8503
+ ]
8504
+ }
8505
+ }
8506
+ }
8507
+ },
8508
+ "responses": {
8509
+ "200": {
8510
+ "description": "Skill files upserted"
8511
+ },
8512
+ "400": {
8513
+ "description": "Validation error"
8514
+ },
8515
+ "404": {
8516
+ "description": "Skill not found"
8517
+ }
8518
+ }
8519
+ }
8520
+ },
8521
+ "/api/skills/{id}/files/{path}": {
8522
+ "get": {
8523
+ "summary": "Get a bundled skill file",
8524
+ "tags": [
8525
+ "Skills"
8526
+ ],
8527
+ "security": [
8528
+ {
8529
+ "bearerAuth": []
8530
+ }
8531
+ ],
8532
+ "parameters": [
8533
+ {
8534
+ "schema": {
8535
+ "type": "string"
8536
+ },
8537
+ "required": true,
8538
+ "name": "id",
8539
+ "in": "path"
8540
+ },
8541
+ {
8542
+ "schema": {
8543
+ "type": "string"
8544
+ },
8545
+ "required": true,
8546
+ "name": "path",
8547
+ "in": "path"
8548
+ }
8549
+ ],
8550
+ "responses": {
8551
+ "200": {
8552
+ "description": "Skill file"
8553
+ },
8554
+ "404": {
8555
+ "description": "Skill or file not found"
8556
+ }
8557
+ }
8558
+ },
8559
+ "put": {
8560
+ "summary": "Upsert a bundled skill file",
8561
+ "tags": [
8562
+ "Skills"
8563
+ ],
8564
+ "security": [
8565
+ {
8566
+ "bearerAuth": []
8567
+ }
8568
+ ],
8569
+ "parameters": [
8570
+ {
8571
+ "schema": {
8572
+ "type": "string"
8573
+ },
8574
+ "required": true,
8575
+ "name": "id",
8576
+ "in": "path"
8577
+ },
8578
+ {
8579
+ "schema": {
8580
+ "type": "string"
8581
+ },
8582
+ "required": true,
8583
+ "name": "path",
8584
+ "in": "path"
8585
+ }
8586
+ ],
8587
+ "requestBody": {
8588
+ "content": {
8589
+ "application/json": {
8590
+ "schema": {
8591
+ "type": "object",
8592
+ "properties": {
8593
+ "content": {
8594
+ "type": "string"
8595
+ },
8596
+ "mimeType": {
8597
+ "type": "string"
8598
+ },
8599
+ "isBinary": {
8600
+ "type": "boolean"
8601
+ },
8602
+ "size": {
8603
+ "type": "integer",
8604
+ "minimum": 0
8605
+ }
8606
+ },
8607
+ "required": [
8608
+ "content"
8609
+ ]
8610
+ }
8611
+ }
8612
+ }
8613
+ },
8614
+ "responses": {
8615
+ "200": {
8616
+ "description": "Skill file upserted"
8617
+ },
8618
+ "400": {
8619
+ "description": "Validation error"
8620
+ },
8621
+ "404": {
8622
+ "description": "Skill not found"
8623
+ }
8624
+ }
8625
+ },
8626
+ "delete": {
8627
+ "summary": "Delete a bundled skill file",
8628
+ "tags": [
8629
+ "Skills"
8630
+ ],
8631
+ "security": [
8632
+ {
8633
+ "bearerAuth": []
8634
+ }
8635
+ ],
8636
+ "parameters": [
8637
+ {
8638
+ "schema": {
8639
+ "type": "string"
8640
+ },
8641
+ "required": true,
8642
+ "name": "id",
8643
+ "in": "path"
8644
+ },
8645
+ {
8646
+ "schema": {
8647
+ "type": "string"
8648
+ },
8649
+ "required": true,
8650
+ "name": "path",
8651
+ "in": "path"
8652
+ }
8653
+ ],
8654
+ "responses": {
8655
+ "200": {
8656
+ "description": "Skill file deleted"
8657
+ },
8658
+ "404": {
8659
+ "description": "Skill or file not found"
8660
+ }
8661
+ }
8662
+ }
8663
+ },
7811
8664
  "/api/skills/{id}/install": {
7812
8665
  "post": {
7813
8666
  "summary": "Install skill for an agent",