@desplega.ai/agent-swarm 1.90.0 → 1.92.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 (96) hide show
  1. package/README.md +2 -1
  2. package/openapi.json +803 -150
  3. package/package.json +5 -5
  4. package/src/artifact-sdk/server.ts +2 -1
  5. package/src/be/db.ts +337 -1
  6. package/src/be/memory/providers/sqlite-store.ts +6 -1
  7. package/src/be/memory/types.ts +1 -0
  8. package/src/be/migrations/083_script_workflows.sql +51 -0
  9. package/src/be/modelsdev-cache.json +42352 -38595
  10. package/src/be/scripts/typecheck.ts +181 -1
  11. package/src/be/seed-scripts/catalog/compound-insights.ts +398 -0
  12. package/src/be/seed-scripts/catalog/ops-catalog-audit.ts +911 -0
  13. package/src/be/seed-scripts/catalog/schedule-health.ts +73 -0
  14. package/src/be/seed-scripts/catalog/smart-recall.ts +65 -0
  15. package/src/be/seed-scripts/catalog/task-context-gathering.ts +92 -0
  16. package/src/be/seed-scripts/catalog/tool-usage.ts +59 -0
  17. package/src/be/seed-scripts/index.ts +54 -0
  18. package/src/be/seed-skills/index.ts +7 -0
  19. package/src/be/swarm-config-guard.ts +17 -0
  20. package/src/commands/artifact.ts +3 -2
  21. package/src/commands/profile-sync.ts +310 -0
  22. package/src/commands/runner.ts +134 -3
  23. package/src/hooks/hook.ts +32 -9
  24. package/src/http/db-query.ts +20 -5
  25. package/src/http/index.ts +57 -0
  26. package/src/http/integrations.ts +6 -1
  27. package/src/http/mcp-bridge.ts +117 -0
  28. package/src/http/mcp-oauth.ts +97 -39
  29. package/src/http/memory.ts +5 -2
  30. package/src/http/openapi.ts +2 -2
  31. package/src/http/pages-public.ts +10 -11
  32. package/src/http/pages.ts +7 -11
  33. package/src/http/script-runs.ts +555 -0
  34. package/src/http/scripts.ts +24 -1
  35. package/src/http/utils.ts +11 -4
  36. package/src/jira/app.ts +2 -3
  37. package/src/jira/webhook-lifecycle.ts +2 -1
  38. package/src/linear/app.ts +2 -3
  39. package/src/prompts/session-templates.ts +24 -4
  40. package/src/providers/claude-adapter.ts +86 -13
  41. package/src/script-workflows/executor.ts +110 -0
  42. package/src/script-workflows/harness.ts +73 -0
  43. package/src/script-workflows/label-lint.ts +51 -0
  44. package/src/script-workflows/limits.ts +22 -0
  45. package/src/script-workflows/supervisor.ts +139 -0
  46. package/src/script-workflows/workflow-ctx.ts +205 -0
  47. package/src/scripts-runtime/executors/native.ts +1 -0
  48. package/src/scripts-runtime/sdk-allowlist.ts +124 -0
  49. package/src/scripts-runtime/swarm-sdk.ts +198 -3
  50. package/src/scripts-runtime/types/stdlib.d.ts +287 -0
  51. package/src/scripts-runtime/types/swarm-sdk.d.ts +287 -0
  52. package/src/server.ts +2 -0
  53. package/src/slack/handlers.ts +11 -4
  54. package/src/slack/message-text.ts +98 -0
  55. package/src/slack/thread-buffer.ts +5 -3
  56. package/src/tests/claude-adapter-binary.test.ts +147 -4
  57. package/src/tests/claude-adapter-otel.test.ts +85 -1
  58. package/src/tests/db-query.test.ts +28 -0
  59. package/src/tests/error-tracker.test.ts +121 -0
  60. package/src/tests/harness-provider-resolution.test.ts +33 -0
  61. package/src/tests/hook-registration-nudge.test.ts +69 -0
  62. package/src/tests/mcp-oauth-manual-client.test.ts +213 -0
  63. package/src/tests/mcp-tools.test.ts +6 -0
  64. package/src/tests/pages-public-html.test.ts +41 -0
  65. package/src/tests/pages-public-json-redirect.test.ts +37 -2
  66. package/src/tests/profile-sync.test.ts +282 -0
  67. package/src/tests/prompt-template-session.test.ts +34 -5
  68. package/src/tests/script-runs-http.test.ts +278 -0
  69. package/src/tests/script-workflows-label-lint.test.ts +43 -0
  70. package/src/tests/script-workflows-runtime-e2e.test.ts +170 -0
  71. package/src/tests/scripts-mcp-e2e.test.ts +49 -2
  72. package/src/tests/scripts-runtime.test.ts +33 -0
  73. package/src/tests/seed-scripts.test.ts +347 -2
  74. package/src/tests/slack-message-text.test.ts +250 -0
  75. package/src/tests/system-default-skills.test.ts +40 -0
  76. package/src/tools/create-metric.ts +2 -3
  77. package/src/tools/create-page.ts +3 -6
  78. package/src/tools/db-query.ts +16 -6
  79. package/src/tools/memory-rate.ts +2 -1
  80. package/src/tools/memory-search.ts +1 -0
  81. package/src/tools/register-kapso-number.ts +2 -4
  82. package/src/tools/request-human-input.ts +2 -1
  83. package/src/tools/script-common.ts +2 -4
  84. package/src/tools/script-run.ts +7 -0
  85. package/src/tools/script-runs.ts +123 -0
  86. package/src/tools/slack-read.ts +12 -3
  87. package/src/tools/tool-config.ts +4 -1
  88. package/src/types.ts +52 -0
  89. package/src/utils/constants.ts +58 -8
  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/skills/pages/content.md +205 -55
  94. package/templates/skills/script-workflows/config.json +14 -0
  95. package/templates/skills/script-workflows/content.md +68 -0
  96. package/templates/skills/swarm-scripts/content.md +45 -7
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.90.0",
5
+ "version": "1.92.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": [
@@ -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
  }
@@ -4105,6 +4108,24 @@
4105
4108
  "minimum": 1,
4106
4109
  "maximum": 20,
4107
4110
  "default": 5
4111
+ },
4112
+ "scope": {
4113
+ "type": "string",
4114
+ "enum": [
4115
+ "agent",
4116
+ "swarm",
4117
+ "all"
4118
+ ],
4119
+ "default": "all"
4120
+ },
4121
+ "source": {
4122
+ "type": "string",
4123
+ "enum": [
4124
+ "manual",
4125
+ "file_index",
4126
+ "session_summary",
4127
+ "task_completion"
4128
+ ]
4108
4129
  }
4109
4130
  },
4110
4131
  "required": [
@@ -7105,11 +7126,13 @@
7105
7126
  }
7106
7127
  }
7107
7128
  },
7108
- "/api/session-logs": {
7129
+ "/api/script-runs": {
7109
7130
  "post": {
7110
- "summary": "Store session logs",
7131
+ "operationId": "script_runs_create",
7132
+ "summary": "Launch a durable script workflow run",
7133
+ "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.",
7111
7134
  "tags": [
7112
- "Session Data"
7135
+ "Script Runs"
7113
7136
  ],
7114
7137
  "security": [
7115
7138
  {
@@ -7122,32 +7145,31 @@
7122
7145
  "schema": {
7123
7146
  "type": "object",
7124
7147
  "properties": {
7125
- "sessionId": {
7148
+ "source": {
7126
7149
  "type": "string",
7127
7150
  "minLength": 1
7128
7151
  },
7129
- "iteration": {
7130
- "type": "integer",
7131
- "minimum": 1
7152
+ "args": {},
7153
+ "background": {
7154
+ "type": "boolean",
7155
+ "default": true
7132
7156
  },
7133
- "lines": {
7134
- "type": "array",
7135
- "items": {
7136
- "type": "string"
7137
- },
7138
- "minItems": 1
7157
+ "idempotencyKey": {
7158
+ "type": "string",
7159
+ "minLength": 1,
7160
+ "maxLength": 200
7139
7161
  },
7140
- "taskId": {
7141
- "type": "string"
7162
+ "scriptName": {
7163
+ "type": "string",
7164
+ "minLength": 1,
7165
+ "maxLength": 200
7142
7166
  },
7143
- "cli": {
7167
+ "requestedByUserId": {
7144
7168
  "type": "string"
7145
7169
  }
7146
7170
  },
7147
7171
  "required": [
7148
- "sessionId",
7149
- "iteration",
7150
- "lines"
7172
+ "source"
7151
7173
  ]
7152
7174
  }
7153
7175
  }
@@ -7155,19 +7177,24 @@
7155
7177
  },
7156
7178
  "responses": {
7157
7179
  "201": {
7158
- "description": "Logs stored"
7180
+ "description": "Script run created"
7159
7181
  },
7160
7182
  "400": {
7161
- "description": "Validation error"
7183
+ "description": "Validation or label-lint failure"
7184
+ },
7185
+ "409": {
7186
+ "description": "Existing idempotent run returned"
7187
+ },
7188
+ "429": {
7189
+ "description": "Script run concurrency cap reached"
7162
7190
  }
7163
7191
  }
7164
- }
7165
- },
7166
- "/api/tasks/{taskId}/session-logs": {
7192
+ },
7167
7193
  "get": {
7168
- "summary": "Get session logs for a task",
7194
+ "operationId": "script_runs_list",
7195
+ "summary": "List script workflow runs",
7169
7196
  "tags": [
7170
- "Session Data"
7197
+ "Script Runs"
7171
7198
  ],
7172
7199
  "security": [
7173
7200
  {
@@ -7175,143 +7202,97 @@
7175
7202
  }
7176
7203
  ],
7177
7204
  "parameters": [
7205
+ {
7206
+ "schema": {
7207
+ "type": "string",
7208
+ "enum": [
7209
+ "running",
7210
+ "paused",
7211
+ "completed",
7212
+ "failed",
7213
+ "cancelled",
7214
+ "aborted_limit"
7215
+ ]
7216
+ },
7217
+ "required": false,
7218
+ "name": "status",
7219
+ "in": "query"
7220
+ },
7178
7221
  {
7179
7222
  "schema": {
7180
7223
  "type": "string"
7181
7224
  },
7182
- "required": true,
7183
- "name": "taskId",
7184
- "in": "path"
7225
+ "required": false,
7226
+ "name": "agentId",
7227
+ "in": "query"
7185
7228
  },
7186
7229
  {
7187
7230
  "schema": {
7188
7231
  "type": "integer",
7189
7232
  "minimum": 1,
7190
- "maximum": 1000
7233
+ "maximum": 500
7191
7234
  },
7192
7235
  "required": false,
7193
7236
  "name": "limit",
7194
7237
  "in": "query"
7238
+ },
7239
+ {
7240
+ "schema": {
7241
+ "type": [
7242
+ "integer",
7243
+ "null"
7244
+ ],
7245
+ "minimum": 0
7246
+ },
7247
+ "required": false,
7248
+ "name": "offset",
7249
+ "in": "query"
7195
7250
  }
7196
7251
  ],
7197
7252
  "responses": {
7198
7253
  "200": {
7199
- "description": "Session logs"
7200
- },
7201
- "404": {
7202
- "description": "Task not found"
7254
+ "description": "Paginated script run list"
7203
7255
  }
7204
7256
  }
7205
7257
  }
7206
7258
  },
7207
- "/api/session-costs": {
7208
- "post": {
7209
- "summary": "Store session cost record",
7259
+ "/api/script-runs/{id}": {
7260
+ "get": {
7261
+ "operationId": "script_runs_get",
7262
+ "summary": "Get a script workflow run with journal",
7210
7263
  "tags": [
7211
- "Session Data"
7264
+ "Script Runs"
7212
7265
  ],
7213
7266
  "security": [
7214
7267
  {
7215
7268
  "bearerAuth": []
7216
7269
  }
7217
7270
  ],
7218
- "requestBody": {
7219
- "content": {
7220
- "application/json": {
7221
- "schema": {
7222
- "type": "object",
7223
- "properties": {
7224
- "sessionId": {
7225
- "type": "string",
7226
- "minLength": 1
7227
- },
7228
- "agentId": {
7229
- "type": "string",
7230
- "minLength": 1
7231
- },
7232
- "totalCostUsd": {
7233
- "type": "number"
7234
- },
7235
- "taskId": {
7236
- "type": "string"
7237
- },
7238
- "inputTokens": {
7239
- "type": "integer"
7240
- },
7241
- "outputTokens": {
7242
- "type": "integer"
7243
- },
7244
- "cacheReadTokens": {
7245
- "type": "integer"
7246
- },
7247
- "cacheWriteTokens": {
7248
- "type": [
7249
- "integer",
7250
- "null"
7251
- ]
7252
- },
7253
- "reasoningOutputTokens": {
7254
- "type": "integer",
7255
- "minimum": 0
7256
- },
7257
- "thinkingTokens": {
7258
- "type": "integer",
7259
- "minimum": 0
7260
- },
7261
- "durationMs": {
7262
- "type": "integer"
7263
- },
7264
- "numTurns": {
7265
- "type": [
7266
- "integer",
7267
- "null"
7268
- ]
7269
- },
7270
- "model": {
7271
- "type": "string"
7272
- },
7273
- "isError": {
7274
- "type": "boolean"
7275
- },
7276
- "provider": {
7277
- "type": "string",
7278
- "enum": [
7279
- "claude",
7280
- "claude-managed",
7281
- "codex",
7282
- "pi",
7283
- "opencode",
7284
- "devin",
7285
- "gemini"
7286
- ]
7287
- },
7288
- "createdAt": {
7289
- "type": "integer",
7290
- "minimum": 0
7291
- }
7292
- },
7293
- "required": [
7294
- "sessionId",
7295
- "agentId",
7296
- "totalCostUsd"
7297
- ]
7298
- }
7299
- }
7271
+ "parameters": [
7272
+ {
7273
+ "schema": {
7274
+ "type": "string",
7275
+ "format": "uuid"
7276
+ },
7277
+ "required": true,
7278
+ "name": "id",
7279
+ "in": "path"
7300
7280
  }
7301
- },
7281
+ ],
7302
7282
  "responses": {
7303
- "201": {
7304
- "description": "Cost record stored"
7283
+ "200": {
7284
+ "description": "Script run detail"
7305
7285
  },
7306
- "400": {
7307
- "description": "Validation error"
7286
+ "404": {
7287
+ "description": "Script run not found"
7308
7288
  }
7309
7289
  }
7310
7290
  },
7311
- "get": {
7312
- "summary": "Query session costs with filters",
7291
+ "delete": {
7292
+ "operationId": "script_runs_cancel",
7293
+ "summary": "Cancel a script workflow run",
7313
7294
  "tags": [
7314
- "Session Data"
7295
+ "Script Runs"
7315
7296
  ],
7316
7297
  "security": [
7317
7298
  {
@@ -7321,32 +7302,649 @@
7321
7302
  "parameters": [
7322
7303
  {
7323
7304
  "schema": {
7324
- "type": "string"
7305
+ "type": "string",
7306
+ "format": "uuid"
7325
7307
  },
7326
- "required": false,
7327
- "name": "agentId",
7328
- "in": "query"
7308
+ "required": true,
7309
+ "name": "id",
7310
+ "in": "path"
7311
+ }
7312
+ ],
7313
+ "responses": {
7314
+ "204": {
7315
+ "description": "Script run cancelled, or already terminal"
7329
7316
  },
7317
+ "404": {
7318
+ "description": "Script run not found"
7319
+ }
7320
+ }
7321
+ }
7322
+ },
7323
+ "/api/internal/script-runs/{runId}/steps/{stepKey}": {
7324
+ "get": {
7325
+ "operationId": "script_runs_internal_step_get",
7326
+ "summary": "Get a script run journal step",
7327
+ "tags": [
7328
+ "Script Runs"
7329
+ ],
7330
+ "security": [
7330
7331
  {
7331
- "schema": {
7332
- "type": "string"
7333
- },
7334
- "required": false,
7335
- "name": "taskId",
7336
- "in": "query"
7337
- },
7332
+ "bearerAuth": []
7333
+ }
7334
+ ],
7335
+ "parameters": [
7338
7336
  {
7339
7337
  "schema": {
7340
- "type": "string"
7338
+ "type": "string",
7339
+ "format": "uuid"
7341
7340
  },
7342
- "required": false,
7343
- "name": "startDate",
7344
- "in": "query"
7341
+ "required": true,
7342
+ "name": "runId",
7343
+ "in": "path"
7345
7344
  },
7346
7345
  {
7347
7346
  "schema": {
7348
- "type": "string"
7349
- },
7347
+ "type": "string",
7348
+ "minLength": 1
7349
+ },
7350
+ "required": true,
7351
+ "name": "stepKey",
7352
+ "in": "path"
7353
+ }
7354
+ ],
7355
+ "responses": {
7356
+ "200": {
7357
+ "description": "Journal step found"
7358
+ },
7359
+ "404": {
7360
+ "description": "Journal step not found"
7361
+ }
7362
+ }
7363
+ }
7364
+ },
7365
+ "/api/internal/script-runs/{runId}/steps": {
7366
+ "post": {
7367
+ "operationId": "script_runs_internal_step_create",
7368
+ "summary": "Write a script run journal step",
7369
+ "tags": [
7370
+ "Script Runs"
7371
+ ],
7372
+ "security": [
7373
+ {
7374
+ "bearerAuth": []
7375
+ }
7376
+ ],
7377
+ "parameters": [
7378
+ {
7379
+ "schema": {
7380
+ "type": "string",
7381
+ "format": "uuid"
7382
+ },
7383
+ "required": true,
7384
+ "name": "runId",
7385
+ "in": "path"
7386
+ }
7387
+ ],
7388
+ "requestBody": {
7389
+ "content": {
7390
+ "application/json": {
7391
+ "schema": {
7392
+ "type": "object",
7393
+ "properties": {
7394
+ "stepKey": {
7395
+ "type": "string",
7396
+ "minLength": 1
7397
+ },
7398
+ "stepType": {
7399
+ "type": "string",
7400
+ "minLength": 1
7401
+ },
7402
+ "config": {},
7403
+ "status": {
7404
+ "type": "string",
7405
+ "enum": [
7406
+ "completed",
7407
+ "failed"
7408
+ ]
7409
+ },
7410
+ "result": {},
7411
+ "error": {
7412
+ "type": "string"
7413
+ }
7414
+ },
7415
+ "required": [
7416
+ "stepKey",
7417
+ "stepType",
7418
+ "status"
7419
+ ]
7420
+ }
7421
+ }
7422
+ }
7423
+ },
7424
+ "responses": {
7425
+ "201": {
7426
+ "description": "Journal step written"
7427
+ },
7428
+ "404": {
7429
+ "description": "Script run not found"
7430
+ }
7431
+ }
7432
+ }
7433
+ },
7434
+ "/api/internal/script-runs/{runId}/heartbeat": {
7435
+ "post": {
7436
+ "operationId": "script_runs_internal_heartbeat",
7437
+ "summary": "Record a script run heartbeat",
7438
+ "tags": [
7439
+ "Script Runs"
7440
+ ],
7441
+ "security": [
7442
+ {
7443
+ "bearerAuth": []
7444
+ }
7445
+ ],
7446
+ "parameters": [
7447
+ {
7448
+ "schema": {
7449
+ "type": "string",
7450
+ "format": "uuid"
7451
+ },
7452
+ "required": true,
7453
+ "name": "runId",
7454
+ "in": "path"
7455
+ }
7456
+ ],
7457
+ "responses": {
7458
+ "204": {
7459
+ "description": "Heartbeat recorded"
7460
+ },
7461
+ "404": {
7462
+ "description": "Script run not found"
7463
+ }
7464
+ }
7465
+ }
7466
+ },
7467
+ "/api/internal/script-runs/{runId}/status": {
7468
+ "post": {
7469
+ "operationId": "script_runs_internal_status",
7470
+ "summary": "Update script run status from subprocess",
7471
+ "tags": [
7472
+ "Script Runs"
7473
+ ],
7474
+ "security": [
7475
+ {
7476
+ "bearerAuth": []
7477
+ }
7478
+ ],
7479
+ "parameters": [
7480
+ {
7481
+ "schema": {
7482
+ "type": "string",
7483
+ "format": "uuid"
7484
+ },
7485
+ "required": true,
7486
+ "name": "runId",
7487
+ "in": "path"
7488
+ }
7489
+ ],
7490
+ "requestBody": {
7491
+ "content": {
7492
+ "application/json": {
7493
+ "schema": {
7494
+ "oneOf": [
7495
+ {
7496
+ "type": "object",
7497
+ "properties": {
7498
+ "status": {
7499
+ "type": "string",
7500
+ "enum": [
7501
+ "completed"
7502
+ ]
7503
+ },
7504
+ "output": {}
7505
+ },
7506
+ "required": [
7507
+ "status"
7508
+ ]
7509
+ },
7510
+ {
7511
+ "type": "object",
7512
+ "properties": {
7513
+ "status": {
7514
+ "type": "string",
7515
+ "enum": [
7516
+ "failed"
7517
+ ]
7518
+ },
7519
+ "error": {
7520
+ "type": "string"
7521
+ }
7522
+ },
7523
+ "required": [
7524
+ "status"
7525
+ ]
7526
+ },
7527
+ {
7528
+ "type": "object",
7529
+ "properties": {
7530
+ "status": {
7531
+ "type": "string",
7532
+ "enum": [
7533
+ "paused"
7534
+ ]
7535
+ }
7536
+ },
7537
+ "required": [
7538
+ "status"
7539
+ ]
7540
+ }
7541
+ ]
7542
+ }
7543
+ }
7544
+ }
7545
+ },
7546
+ "responses": {
7547
+ "204": {
7548
+ "description": "Status updated"
7549
+ },
7550
+ "404": {
7551
+ "description": "Script run not found"
7552
+ }
7553
+ }
7554
+ }
7555
+ },
7556
+ "/api/internal/raw-llm": {
7557
+ "post": {
7558
+ "operationId": "script_runs_internal_raw_llm",
7559
+ "summary": "Execute a raw LLM call for a script workflow",
7560
+ "tags": [
7561
+ "Script Runs"
7562
+ ],
7563
+ "security": [
7564
+ {
7565
+ "bearerAuth": []
7566
+ }
7567
+ ],
7568
+ "requestBody": {
7569
+ "content": {
7570
+ "application/json": {
7571
+ "schema": {
7572
+ "type": "object",
7573
+ "properties": {
7574
+ "prompt": {
7575
+ "type": "string"
7576
+ },
7577
+ "model": {
7578
+ "type": "string"
7579
+ },
7580
+ "schema": {
7581
+ "type": "object",
7582
+ "additionalProperties": {}
7583
+ },
7584
+ "fallbackPort": {
7585
+ "type": "string"
7586
+ }
7587
+ },
7588
+ "required": [
7589
+ "prompt"
7590
+ ]
7591
+ }
7592
+ }
7593
+ }
7594
+ },
7595
+ "responses": {
7596
+ "200": {
7597
+ "description": "LLM call completed"
7598
+ },
7599
+ "500": {
7600
+ "description": "LLM call failed"
7601
+ }
7602
+ }
7603
+ }
7604
+ },
7605
+ "/api/internal/script-runs/{runId}/agent-task": {
7606
+ "post": {
7607
+ "operationId": "script_runs_internal_agent_task",
7608
+ "summary": "Create or wait for a script workflow agent task step",
7609
+ "tags": [
7610
+ "Script Runs"
7611
+ ],
7612
+ "security": [
7613
+ {
7614
+ "bearerAuth": []
7615
+ }
7616
+ ],
7617
+ "parameters": [
7618
+ {
7619
+ "schema": {
7620
+ "type": "string",
7621
+ "format": "uuid"
7622
+ },
7623
+ "required": true,
7624
+ "name": "runId",
7625
+ "in": "path"
7626
+ }
7627
+ ],
7628
+ "requestBody": {
7629
+ "content": {
7630
+ "application/json": {
7631
+ "schema": {
7632
+ "type": "object",
7633
+ "properties": {
7634
+ "stepKey": {
7635
+ "type": "string",
7636
+ "minLength": 1
7637
+ },
7638
+ "template": {
7639
+ "type": "string"
7640
+ },
7641
+ "task": {
7642
+ "type": "string"
7643
+ },
7644
+ "agentId": {
7645
+ "type": "string",
7646
+ "format": "uuid"
7647
+ },
7648
+ "tags": {
7649
+ "type": "array",
7650
+ "items": {
7651
+ "type": "string"
7652
+ }
7653
+ },
7654
+ "priority": {
7655
+ "type": "integer",
7656
+ "minimum": 0,
7657
+ "maximum": 100
7658
+ },
7659
+ "offerMode": {
7660
+ "type": "boolean"
7661
+ },
7662
+ "dir": {
7663
+ "type": "string",
7664
+ "minLength": 1
7665
+ },
7666
+ "vcsRepo": {
7667
+ "type": "string",
7668
+ "minLength": 1
7669
+ },
7670
+ "model": {
7671
+ "type": "string",
7672
+ "minLength": 1
7673
+ },
7674
+ "parentTaskId": {
7675
+ "type": "string",
7676
+ "format": "uuid"
7677
+ },
7678
+ "requestedByUserId": {
7679
+ "type": "string"
7680
+ },
7681
+ "outputSchema": {
7682
+ "type": "object",
7683
+ "additionalProperties": {}
7684
+ }
7685
+ },
7686
+ "required": [
7687
+ "stepKey"
7688
+ ]
7689
+ }
7690
+ }
7691
+ }
7692
+ },
7693
+ "responses": {
7694
+ "200": {
7695
+ "description": "Agent task completed"
7696
+ },
7697
+ "202": {
7698
+ "description": "Agent task created or still running"
7699
+ },
7700
+ "404": {
7701
+ "description": "Script run not found"
7702
+ }
7703
+ }
7704
+ }
7705
+ },
7706
+ "/api/session-logs": {
7707
+ "post": {
7708
+ "summary": "Store session logs",
7709
+ "tags": [
7710
+ "Session Data"
7711
+ ],
7712
+ "security": [
7713
+ {
7714
+ "bearerAuth": []
7715
+ }
7716
+ ],
7717
+ "requestBody": {
7718
+ "content": {
7719
+ "application/json": {
7720
+ "schema": {
7721
+ "type": "object",
7722
+ "properties": {
7723
+ "sessionId": {
7724
+ "type": "string",
7725
+ "minLength": 1
7726
+ },
7727
+ "iteration": {
7728
+ "type": "integer",
7729
+ "minimum": 1
7730
+ },
7731
+ "lines": {
7732
+ "type": "array",
7733
+ "items": {
7734
+ "type": "string"
7735
+ },
7736
+ "minItems": 1
7737
+ },
7738
+ "taskId": {
7739
+ "type": "string"
7740
+ },
7741
+ "cli": {
7742
+ "type": "string"
7743
+ }
7744
+ },
7745
+ "required": [
7746
+ "sessionId",
7747
+ "iteration",
7748
+ "lines"
7749
+ ]
7750
+ }
7751
+ }
7752
+ }
7753
+ },
7754
+ "responses": {
7755
+ "201": {
7756
+ "description": "Logs stored"
7757
+ },
7758
+ "400": {
7759
+ "description": "Validation error"
7760
+ }
7761
+ }
7762
+ }
7763
+ },
7764
+ "/api/tasks/{taskId}/session-logs": {
7765
+ "get": {
7766
+ "summary": "Get session logs for a task",
7767
+ "tags": [
7768
+ "Session Data"
7769
+ ],
7770
+ "security": [
7771
+ {
7772
+ "bearerAuth": []
7773
+ }
7774
+ ],
7775
+ "parameters": [
7776
+ {
7777
+ "schema": {
7778
+ "type": "string"
7779
+ },
7780
+ "required": true,
7781
+ "name": "taskId",
7782
+ "in": "path"
7783
+ },
7784
+ {
7785
+ "schema": {
7786
+ "type": "integer",
7787
+ "minimum": 1,
7788
+ "maximum": 1000
7789
+ },
7790
+ "required": false,
7791
+ "name": "limit",
7792
+ "in": "query"
7793
+ }
7794
+ ],
7795
+ "responses": {
7796
+ "200": {
7797
+ "description": "Session logs"
7798
+ },
7799
+ "404": {
7800
+ "description": "Task not found"
7801
+ }
7802
+ }
7803
+ }
7804
+ },
7805
+ "/api/session-costs": {
7806
+ "post": {
7807
+ "summary": "Store session cost record",
7808
+ "tags": [
7809
+ "Session Data"
7810
+ ],
7811
+ "security": [
7812
+ {
7813
+ "bearerAuth": []
7814
+ }
7815
+ ],
7816
+ "requestBody": {
7817
+ "content": {
7818
+ "application/json": {
7819
+ "schema": {
7820
+ "type": "object",
7821
+ "properties": {
7822
+ "sessionId": {
7823
+ "type": "string",
7824
+ "minLength": 1
7825
+ },
7826
+ "agentId": {
7827
+ "type": "string",
7828
+ "minLength": 1
7829
+ },
7830
+ "totalCostUsd": {
7831
+ "type": "number"
7832
+ },
7833
+ "taskId": {
7834
+ "type": "string"
7835
+ },
7836
+ "inputTokens": {
7837
+ "type": "integer"
7838
+ },
7839
+ "outputTokens": {
7840
+ "type": "integer"
7841
+ },
7842
+ "cacheReadTokens": {
7843
+ "type": "integer"
7844
+ },
7845
+ "cacheWriteTokens": {
7846
+ "type": [
7847
+ "integer",
7848
+ "null"
7849
+ ]
7850
+ },
7851
+ "reasoningOutputTokens": {
7852
+ "type": "integer",
7853
+ "minimum": 0
7854
+ },
7855
+ "thinkingTokens": {
7856
+ "type": "integer",
7857
+ "minimum": 0
7858
+ },
7859
+ "durationMs": {
7860
+ "type": "integer"
7861
+ },
7862
+ "numTurns": {
7863
+ "type": [
7864
+ "integer",
7865
+ "null"
7866
+ ]
7867
+ },
7868
+ "model": {
7869
+ "type": "string"
7870
+ },
7871
+ "isError": {
7872
+ "type": "boolean"
7873
+ },
7874
+ "provider": {
7875
+ "type": "string",
7876
+ "enum": [
7877
+ "claude",
7878
+ "claude-managed",
7879
+ "codex",
7880
+ "pi",
7881
+ "opencode",
7882
+ "devin",
7883
+ "gemini"
7884
+ ]
7885
+ },
7886
+ "createdAt": {
7887
+ "type": "integer",
7888
+ "minimum": 0
7889
+ }
7890
+ },
7891
+ "required": [
7892
+ "sessionId",
7893
+ "agentId",
7894
+ "totalCostUsd"
7895
+ ]
7896
+ }
7897
+ }
7898
+ }
7899
+ },
7900
+ "responses": {
7901
+ "201": {
7902
+ "description": "Cost record stored"
7903
+ },
7904
+ "400": {
7905
+ "description": "Validation error"
7906
+ }
7907
+ }
7908
+ },
7909
+ "get": {
7910
+ "summary": "Query session costs with filters",
7911
+ "tags": [
7912
+ "Session Data"
7913
+ ],
7914
+ "security": [
7915
+ {
7916
+ "bearerAuth": []
7917
+ }
7918
+ ],
7919
+ "parameters": [
7920
+ {
7921
+ "schema": {
7922
+ "type": "string"
7923
+ },
7924
+ "required": false,
7925
+ "name": "agentId",
7926
+ "in": "query"
7927
+ },
7928
+ {
7929
+ "schema": {
7930
+ "type": "string"
7931
+ },
7932
+ "required": false,
7933
+ "name": "taskId",
7934
+ "in": "query"
7935
+ },
7936
+ {
7937
+ "schema": {
7938
+ "type": "string"
7939
+ },
7940
+ "required": false,
7941
+ "name": "startDate",
7942
+ "in": "query"
7943
+ },
7944
+ {
7945
+ "schema": {
7946
+ "type": "string"
7947
+ },
7350
7948
  "required": false,
7351
7949
  "name": "endDate",
7352
7950
  "in": "query"
@@ -8152,6 +8750,10 @@
8152
8750
  "workspace-rw"
8153
8751
  ],
8154
8752
  "default": "none"
8753
+ },
8754
+ "idempotencyKey": {
8755
+ "type": "string",
8756
+ "maxLength": 200
8155
8757
  }
8156
8758
  }
8157
8759
  }
@@ -8321,6 +8923,57 @@
8321
8923
  }
8322
8924
  }
8323
8925
  },
8926
+ "/api/mcp-bridge": {
8927
+ "post": {
8928
+ "summary": "Generic MCP tool proxy for the scripts SDK bridge",
8929
+ "tags": [
8930
+ "Scripts"
8931
+ ],
8932
+ "security": [
8933
+ {
8934
+ "bearerAuth": []
8935
+ }
8936
+ ],
8937
+ "requestBody": {
8938
+ "content": {
8939
+ "application/json": {
8940
+ "schema": {
8941
+ "type": "object",
8942
+ "properties": {
8943
+ "tool": {
8944
+ "type": "string",
8945
+ "minLength": 1,
8946
+ "maxLength": 200
8947
+ },
8948
+ "args": {
8949
+ "type": "object",
8950
+ "additionalProperties": {},
8951
+ "default": {}
8952
+ }
8953
+ },
8954
+ "required": [
8955
+ "tool"
8956
+ ]
8957
+ }
8958
+ }
8959
+ }
8960
+ },
8961
+ "responses": {
8962
+ "200": {
8963
+ "description": "Tool result"
8964
+ },
8965
+ "400": {
8966
+ "description": "Invalid tool name or args"
8967
+ },
8968
+ "403": {
8969
+ "description": "Tool not in SDK allowlist"
8970
+ },
8971
+ "404": {
8972
+ "description": "Tool not found"
8973
+ }
8974
+ }
8975
+ }
8976
+ },
8324
8977
  "/api/mcp-oauth/{mcpServerId}/metadata": {
8325
8978
  "get": {
8326
8979
  "summary": "Probe OAuth metadata (PRMD + AS) for an MCP server",