@desplega.ai/agent-swarm 1.52.1 → 1.53.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 (43) hide show
  1. package/openapi.json +1517 -488
  2. package/package.json +5 -2
  3. package/src/be/db.ts +530 -0
  4. package/src/be/events.ts +322 -0
  5. package/src/be/migrations/021_events.sql +24 -0
  6. package/src/be/migrations/022_context_usage.sql +34 -0
  7. package/src/be/migrations/023_mcp_servers.sql +44 -0
  8. package/src/commands/runner.ts +348 -1
  9. package/src/http/context.ts +118 -0
  10. package/src/http/events.ts +188 -0
  11. package/src/http/index.ts +6 -0
  12. package/src/http/mcp-servers.ts +364 -0
  13. package/src/http/tasks.ts +33 -0
  14. package/src/linear/outbound.ts +8 -1
  15. package/src/linear/sync.ts +3 -0
  16. package/src/oauth/ensure-token.ts +50 -0
  17. package/src/prompts/base-prompt.ts +7 -0
  18. package/src/providers/claude-adapter.ts +156 -15
  19. package/src/providers/pi-mono-adapter.ts +68 -0
  20. package/src/providers/pi-mono-extension.ts +56 -2
  21. package/src/providers/pi-mono-mcp-client.ts +10 -1
  22. package/src/providers/types.ts +14 -1
  23. package/src/server.ts +19 -0
  24. package/src/tests/context-window.test.ts +66 -0
  25. package/src/tests/ensure-token.test.ts +170 -0
  26. package/src/tests/events-db.test.ts +314 -0
  27. package/src/tests/events-http.test.ts +267 -0
  28. package/src/tests/prompt-template-remaining.test.ts +5 -5
  29. package/src/tests/tool-annotations.test.ts +2 -2
  30. package/src/tests/vcs-tracking.test.ts +176 -0
  31. package/src/tests/workflow-executors.test.ts +8 -1
  32. package/src/tools/mcp-servers/index.ts +7 -0
  33. package/src/tools/mcp-servers/mcp-server-create.ts +138 -0
  34. package/src/tools/mcp-servers/mcp-server-delete.ts +72 -0
  35. package/src/tools/mcp-servers/mcp-server-get.ts +80 -0
  36. package/src/tools/mcp-servers/mcp-server-install.ts +110 -0
  37. package/src/tools/mcp-servers/mcp-server-list.ts +67 -0
  38. package/src/tools/mcp-servers/mcp-server-uninstall.ts +71 -0
  39. package/src/tools/mcp-servers/mcp-server-update.ts +120 -0
  40. package/src/tools/tool-config.ts +9 -0
  41. package/src/types.ts +153 -0
  42. package/src/utils/context-window.ts +41 -0
  43. package/src/workflows/executors/base.ts +9 -1
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.52.0",
5
+ "version": "1.52.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": [
@@ -1179,6 +1179,138 @@
1179
1179
  }
1180
1180
  }
1181
1181
  },
1182
+ "/api/tasks/{id}/context": {
1183
+ "post": {
1184
+ "summary": "Record a context usage snapshot for a task",
1185
+ "tags": [
1186
+ "Tasks"
1187
+ ],
1188
+ "security": [
1189
+ {
1190
+ "bearerAuth": []
1191
+ }
1192
+ ],
1193
+ "parameters": [
1194
+ {
1195
+ "schema": {
1196
+ "type": "string"
1197
+ },
1198
+ "required": true,
1199
+ "name": "id",
1200
+ "in": "path"
1201
+ }
1202
+ ],
1203
+ "requestBody": {
1204
+ "content": {
1205
+ "application/json": {
1206
+ "schema": {
1207
+ "type": "object",
1208
+ "properties": {
1209
+ "eventType": {
1210
+ "type": "string",
1211
+ "enum": [
1212
+ "progress",
1213
+ "compaction",
1214
+ "completion"
1215
+ ]
1216
+ },
1217
+ "sessionId": {
1218
+ "type": "string"
1219
+ },
1220
+ "contextUsedTokens": {
1221
+ "type": "integer",
1222
+ "minimum": 0
1223
+ },
1224
+ "contextTotalTokens": {
1225
+ "type": "integer",
1226
+ "minimum": 0
1227
+ },
1228
+ "contextPercent": {
1229
+ "type": "number",
1230
+ "minimum": 0,
1231
+ "maximum": 100
1232
+ },
1233
+ "compactTrigger": {
1234
+ "type": "string",
1235
+ "enum": [
1236
+ "auto",
1237
+ "manual"
1238
+ ]
1239
+ },
1240
+ "preCompactTokens": {
1241
+ "type": "integer",
1242
+ "minimum": 0
1243
+ },
1244
+ "cumulativeInputTokens": {
1245
+ "type": "integer",
1246
+ "minimum": 0
1247
+ },
1248
+ "cumulativeOutputTokens": {
1249
+ "type": "integer",
1250
+ "minimum": 0
1251
+ }
1252
+ },
1253
+ "required": [
1254
+ "eventType",
1255
+ "sessionId"
1256
+ ]
1257
+ }
1258
+ }
1259
+ }
1260
+ },
1261
+ "responses": {
1262
+ "200": {
1263
+ "description": "Snapshot recorded"
1264
+ },
1265
+ "400": {
1266
+ "description": "Validation error"
1267
+ },
1268
+ "404": {
1269
+ "description": "Task not found"
1270
+ }
1271
+ }
1272
+ },
1273
+ "get": {
1274
+ "summary": "Get context usage history for a task",
1275
+ "tags": [
1276
+ "Tasks"
1277
+ ],
1278
+ "security": [
1279
+ {
1280
+ "bearerAuth": []
1281
+ }
1282
+ ],
1283
+ "parameters": [
1284
+ {
1285
+ "schema": {
1286
+ "type": "string"
1287
+ },
1288
+ "required": true,
1289
+ "name": "id",
1290
+ "in": "path"
1291
+ },
1292
+ {
1293
+ "schema": {
1294
+ "type": "integer",
1295
+ "minimum": 1,
1296
+ "maximum": 500,
1297
+ "default": 100
1298
+ },
1299
+ "required": false,
1300
+ "name": "limit",
1301
+ "in": "query"
1302
+ }
1303
+ ],
1304
+ "responses": {
1305
+ "200": {
1306
+ "description": "Context snapshot history"
1307
+ },
1308
+ "404": {
1309
+ "description": "Task not found"
1310
+ }
1311
+ }
1312
+ }
1313
+ },
1182
1314
  "/api/db-query": {
1183
1315
  "post": {
1184
1316
  "summary": "Execute a read-only SQL query",
@@ -1813,11 +1945,11 @@
1813
1945
  }
1814
1946
  }
1815
1947
  },
1816
- "/api/memory/index": {
1948
+ "/api/events": {
1817
1949
  "post": {
1818
- "summary": "Ingest content into memory system (async embedding)",
1950
+ "summary": "Store a single event",
1819
1951
  "tags": [
1820
- "Memory"
1952
+ "Events"
1821
1953
  ],
1822
1954
  "security": [
1823
1955
  {
@@ -1830,52 +1962,88 @@
1830
1962
  "schema": {
1831
1963
  "type": "object",
1832
1964
  "properties": {
1833
- "agentId": {
1834
- "type": "string",
1835
- "format": "uuid"
1836
- },
1837
- "content": {
1965
+ "category": {
1838
1966
  "type": "string",
1839
- "minLength": 1
1967
+ "enum": [
1968
+ "tool",
1969
+ "skill",
1970
+ "session",
1971
+ "api",
1972
+ "task",
1973
+ "workflow",
1974
+ "system"
1975
+ ]
1840
1976
  },
1841
- "name": {
1977
+ "event": {
1842
1978
  "type": "string",
1843
- "minLength": 1
1979
+ "enum": [
1980
+ "tool.start",
1981
+ "tool.end",
1982
+ "skill.invoke",
1983
+ "skill.complete",
1984
+ "session.start",
1985
+ "session.end",
1986
+ "session.resume",
1987
+ "session.cost",
1988
+ "api.request",
1989
+ "api.error",
1990
+ "task.poll",
1991
+ "task.assign",
1992
+ "task.timeout",
1993
+ "workflow.step.start",
1994
+ "workflow.step.end",
1995
+ "workflow.run.start",
1996
+ "workflow.run.end",
1997
+ "system.boot",
1998
+ "system.migration",
1999
+ "system.error"
2000
+ ]
1844
2001
  },
1845
- "scope": {
2002
+ "status": {
1846
2003
  "type": "string",
1847
2004
  "enum": [
1848
- "agent",
1849
- "swarm"
2005
+ "ok",
2006
+ "error",
2007
+ "timeout",
2008
+ "skipped"
1850
2009
  ]
1851
2010
  },
1852
2011
  "source": {
1853
2012
  "type": "string",
1854
2013
  "enum": [
1855
- "manual",
1856
- "file_index",
1857
- "session_summary",
1858
- "task_completion"
2014
+ "worker",
2015
+ "api",
2016
+ "hook",
2017
+ "scheduler",
2018
+ "cli"
1859
2019
  ]
1860
2020
  },
1861
- "sourceTaskId": {
1862
- "type": "string",
1863
- "format": "uuid"
2021
+ "agentId": {
2022
+ "type": "string"
1864
2023
  },
1865
- "sourcePath": {
2024
+ "taskId": {
1866
2025
  "type": "string"
1867
2026
  },
1868
- "tags": {
1869
- "type": "array",
1870
- "items": {
1871
- "type": "string"
1872
- }
2027
+ "sessionId": {
2028
+ "type": "string"
2029
+ },
2030
+ "parentEventId": {
2031
+ "type": "string"
2032
+ },
2033
+ "numericValue": {
2034
+ "type": "number"
2035
+ },
2036
+ "durationMs": {
2037
+ "type": "integer"
2038
+ },
2039
+ "data": {
2040
+ "type": "object",
2041
+ "additionalProperties": {}
1873
2042
  }
1874
2043
  },
1875
2044
  "required": [
1876
- "content",
1877
- "name",
1878
- "scope",
2045
+ "category",
2046
+ "event",
1879
2047
  "source"
1880
2048
  ]
1881
2049
  }
@@ -1883,65 +2051,18 @@
1883
2051
  }
1884
2052
  },
1885
2053
  "responses": {
1886
- "202": {
1887
- "description": "Content queued for embedding"
2054
+ "201": {
2055
+ "description": "Event stored"
1888
2056
  },
1889
2057
  "400": {
1890
2058
  "description": "Validation error"
1891
2059
  }
1892
2060
  }
1893
- }
1894
- },
1895
- "/api/memory/search": {
1896
- "post": {
1897
- "summary": "Search memories by natural language query",
1898
- "tags": [
1899
- "Memory"
1900
- ],
1901
- "security": [
1902
- {
1903
- "bearerAuth": []
1904
- }
1905
- ],
1906
- "requestBody": {
1907
- "content": {
1908
- "application/json": {
1909
- "schema": {
1910
- "type": "object",
1911
- "properties": {
1912
- "query": {
1913
- "type": "string",
1914
- "minLength": 1
1915
- },
1916
- "limit": {
1917
- "type": "integer",
1918
- "minimum": 1,
1919
- "maximum": 20,
1920
- "default": 5
1921
- }
1922
- },
1923
- "required": [
1924
- "query"
1925
- ]
1926
- }
1927
- }
1928
- }
1929
- },
1930
- "responses": {
1931
- "200": {
1932
- "description": "Search results"
1933
- },
1934
- "400": {
1935
- "description": "Missing query or agent ID"
1936
- }
1937
- }
1938
- }
1939
- },
1940
- "/api/prompt-templates/resolved": {
2061
+ },
1941
2062
  "get": {
1942
- "summary": "Resolve a prompt template for a given event type and scope chain",
2063
+ "summary": "Query events with filters",
1943
2064
  "tags": [
1944
- "PromptTemplates"
2065
+ "Events"
1945
2066
  ],
1946
2067
  "security": [
1947
2068
  {
@@ -1951,10 +2072,78 @@
1951
2072
  "parameters": [
1952
2073
  {
1953
2074
  "schema": {
1954
- "type": "string"
2075
+ "type": "string",
2076
+ "enum": [
2077
+ "tool",
2078
+ "skill",
2079
+ "session",
2080
+ "api",
2081
+ "task",
2082
+ "workflow",
2083
+ "system"
2084
+ ]
1955
2085
  },
1956
- "required": true,
1957
- "name": "eventType",
2086
+ "required": false,
2087
+ "name": "category",
2088
+ "in": "query"
2089
+ },
2090
+ {
2091
+ "schema": {
2092
+ "type": "string",
2093
+ "enum": [
2094
+ "tool.start",
2095
+ "tool.end",
2096
+ "skill.invoke",
2097
+ "skill.complete",
2098
+ "session.start",
2099
+ "session.end",
2100
+ "session.resume",
2101
+ "session.cost",
2102
+ "api.request",
2103
+ "api.error",
2104
+ "task.poll",
2105
+ "task.assign",
2106
+ "task.timeout",
2107
+ "workflow.step.start",
2108
+ "workflow.step.end",
2109
+ "workflow.run.start",
2110
+ "workflow.run.end",
2111
+ "system.boot",
2112
+ "system.migration",
2113
+ "system.error"
2114
+ ]
2115
+ },
2116
+ "required": false,
2117
+ "name": "event",
2118
+ "in": "query"
2119
+ },
2120
+ {
2121
+ "schema": {
2122
+ "type": "string",
2123
+ "enum": [
2124
+ "ok",
2125
+ "error",
2126
+ "timeout",
2127
+ "skipped"
2128
+ ]
2129
+ },
2130
+ "required": false,
2131
+ "name": "status",
2132
+ "in": "query"
2133
+ },
2134
+ {
2135
+ "schema": {
2136
+ "type": "string",
2137
+ "enum": [
2138
+ "worker",
2139
+ "api",
2140
+ "hook",
2141
+ "scheduler",
2142
+ "cli"
2143
+ ]
2144
+ },
2145
+ "required": false,
2146
+ "name": "source",
1958
2147
  "in": "query"
1959
2148
  },
1960
2149
  {
@@ -1970,43 +2159,56 @@
1970
2159
  "type": "string"
1971
2160
  },
1972
2161
  "required": false,
1973
- "name": "repoId",
2162
+ "name": "taskId",
1974
2163
  "in": "query"
1975
- }
1976
- ],
1977
- "responses": {
1978
- "200": {
1979
- "description": "Resolved template info"
1980
2164
  },
1981
- "400": {
1982
- "description": "Missing eventType"
1983
- }
1984
- }
1985
- }
1986
- },
1987
- "/api/prompt-templates/events": {
1988
- "get": {
1989
- "summary": "List all registered event types with their available variables",
1990
- "tags": [
1991
- "PromptTemplates"
1992
- ],
1993
- "security": [
1994
2165
  {
1995
- "bearerAuth": []
2166
+ "schema": {
2167
+ "type": "string"
2168
+ },
2169
+ "required": false,
2170
+ "name": "sessionId",
2171
+ "in": "query"
2172
+ },
2173
+ {
2174
+ "schema": {
2175
+ "type": "string"
2176
+ },
2177
+ "required": false,
2178
+ "name": "since",
2179
+ "in": "query"
2180
+ },
2181
+ {
2182
+ "schema": {
2183
+ "type": "string"
2184
+ },
2185
+ "required": false,
2186
+ "name": "until",
2187
+ "in": "query"
2188
+ },
2189
+ {
2190
+ "schema": {
2191
+ "type": "integer",
2192
+ "minimum": 1,
2193
+ "maximum": 1000
2194
+ },
2195
+ "required": false,
2196
+ "name": "limit",
2197
+ "in": "query"
1996
2198
  }
1997
2199
  ],
1998
2200
  "responses": {
1999
2201
  "200": {
2000
- "description": "List of event template definitions"
2202
+ "description": "List of events"
2001
2203
  }
2002
2204
  }
2003
2205
  }
2004
2206
  },
2005
- "/api/prompt-templates/preview": {
2207
+ "/api/events/batch": {
2006
2208
  "post": {
2007
- "summary": "Dry-run render a template with provided variables",
2209
+ "summary": "Store multiple events in a batch",
2008
2210
  "tags": [
2009
- "PromptTemplates"
2211
+ "Events"
2010
2212
  ],
2011
2213
  "security": [
2012
2214
  {
@@ -2019,27 +2221,110 @@
2019
2221
  "schema": {
2020
2222
  "type": "object",
2021
2223
  "properties": {
2022
- "eventType": {
2023
- "type": "string"
2024
- },
2025
- "body": {
2026
- "type": "string"
2027
- },
2028
- "variables": {
2029
- "type": "object",
2030
- "additionalProperties": {}
2224
+ "events": {
2225
+ "type": "array",
2226
+ "items": {
2227
+ "type": "object",
2228
+ "properties": {
2229
+ "category": {
2230
+ "type": "string",
2231
+ "enum": [
2232
+ "tool",
2233
+ "skill",
2234
+ "session",
2235
+ "api",
2236
+ "task",
2237
+ "workflow",
2238
+ "system"
2239
+ ]
2240
+ },
2241
+ "event": {
2242
+ "type": "string",
2243
+ "enum": [
2244
+ "tool.start",
2245
+ "tool.end",
2246
+ "skill.invoke",
2247
+ "skill.complete",
2248
+ "session.start",
2249
+ "session.end",
2250
+ "session.resume",
2251
+ "session.cost",
2252
+ "api.request",
2253
+ "api.error",
2254
+ "task.poll",
2255
+ "task.assign",
2256
+ "task.timeout",
2257
+ "workflow.step.start",
2258
+ "workflow.step.end",
2259
+ "workflow.run.start",
2260
+ "workflow.run.end",
2261
+ "system.boot",
2262
+ "system.migration",
2263
+ "system.error"
2264
+ ]
2265
+ },
2266
+ "status": {
2267
+ "type": "string",
2268
+ "enum": [
2269
+ "ok",
2270
+ "error",
2271
+ "timeout",
2272
+ "skipped"
2273
+ ]
2274
+ },
2275
+ "source": {
2276
+ "type": "string",
2277
+ "enum": [
2278
+ "worker",
2279
+ "api",
2280
+ "hook",
2281
+ "scheduler",
2282
+ "cli"
2283
+ ]
2284
+ },
2285
+ "agentId": {
2286
+ "type": "string"
2287
+ },
2288
+ "taskId": {
2289
+ "type": "string"
2290
+ },
2291
+ "sessionId": {
2292
+ "type": "string"
2293
+ },
2294
+ "parentEventId": {
2295
+ "type": "string"
2296
+ },
2297
+ "numericValue": {
2298
+ "type": "number"
2299
+ },
2300
+ "durationMs": {
2301
+ "type": "integer"
2302
+ },
2303
+ "data": {
2304
+ "type": "object",
2305
+ "additionalProperties": {}
2306
+ }
2307
+ },
2308
+ "required": [
2309
+ "category",
2310
+ "event",
2311
+ "source"
2312
+ ]
2313
+ },
2314
+ "minItems": 1,
2315
+ "maxItems": 500
2031
2316
  }
2032
2317
  },
2033
2318
  "required": [
2034
- "eventType"
2319
+ "events"
2035
2320
  ]
2036
2321
  }
2037
2322
  }
2038
2323
  }
2039
2324
  },
2040
2325
  "responses": {
2041
- "200": {
2042
- "description": "Rendered template preview"
2326
+ "201": {
2327
+ "description": "Events stored"
2043
2328
  },
2044
2329
  "400": {
2045
2330
  "description": "Validation error"
@@ -2047,11 +2332,103 @@
2047
2332
  }
2048
2333
  }
2049
2334
  },
2050
- "/api/prompt-templates/render": {
2335
+ "/api/events/counts": {
2336
+ "get": {
2337
+ "summary": "Get event counts grouped by event name",
2338
+ "tags": [
2339
+ "Events"
2340
+ ],
2341
+ "security": [
2342
+ {
2343
+ "bearerAuth": []
2344
+ }
2345
+ ],
2346
+ "parameters": [
2347
+ {
2348
+ "schema": {
2349
+ "type": "string",
2350
+ "enum": [
2351
+ "tool",
2352
+ "skill",
2353
+ "session",
2354
+ "api",
2355
+ "task",
2356
+ "workflow",
2357
+ "system"
2358
+ ]
2359
+ },
2360
+ "required": false,
2361
+ "name": "category",
2362
+ "in": "query"
2363
+ },
2364
+ {
2365
+ "schema": {
2366
+ "type": "string",
2367
+ "enum": [
2368
+ "worker",
2369
+ "api",
2370
+ "hook",
2371
+ "scheduler",
2372
+ "cli"
2373
+ ]
2374
+ },
2375
+ "required": false,
2376
+ "name": "source",
2377
+ "in": "query"
2378
+ },
2379
+ {
2380
+ "schema": {
2381
+ "type": "string"
2382
+ },
2383
+ "required": false,
2384
+ "name": "agentId",
2385
+ "in": "query"
2386
+ },
2387
+ {
2388
+ "schema": {
2389
+ "type": "string"
2390
+ },
2391
+ "required": false,
2392
+ "name": "taskId",
2393
+ "in": "query"
2394
+ },
2395
+ {
2396
+ "schema": {
2397
+ "type": "string"
2398
+ },
2399
+ "required": false,
2400
+ "name": "sessionId",
2401
+ "in": "query"
2402
+ },
2403
+ {
2404
+ "schema": {
2405
+ "type": "string"
2406
+ },
2407
+ "required": false,
2408
+ "name": "since",
2409
+ "in": "query"
2410
+ },
2411
+ {
2412
+ "schema": {
2413
+ "type": "string"
2414
+ },
2415
+ "required": false,
2416
+ "name": "until",
2417
+ "in": "query"
2418
+ }
2419
+ ],
2420
+ "responses": {
2421
+ "200": {
2422
+ "description": "Event counts"
2423
+ }
2424
+ }
2425
+ }
2426
+ },
2427
+ "/api/memory/index": {
2051
2428
  "post": {
2052
- "summary": "Full scope-aware template resolution with interpolation (used by workers via HTTP)",
2429
+ "summary": "Ingest content into memory system (async embedding)",
2053
2430
  "tags": [
2054
- "PromptTemplates"
2431
+ "Memory"
2055
2432
  ],
2056
2433
  "security": [
2057
2434
  {
@@ -2064,30 +2441,61 @@
2064
2441
  "schema": {
2065
2442
  "type": "object",
2066
2443
  "properties": {
2067
- "eventType": {
2068
- "type": "string"
2444
+ "agentId": {
2445
+ "type": "string",
2446
+ "format": "uuid"
2069
2447
  },
2070
- "variables": {
2071
- "type": "object",
2072
- "additionalProperties": {}
2448
+ "content": {
2449
+ "type": "string",
2450
+ "minLength": 1
2073
2451
  },
2074
- "agentId": {
2075
- "type": "string"
2452
+ "name": {
2453
+ "type": "string",
2454
+ "minLength": 1
2076
2455
  },
2077
- "repoId": {
2456
+ "scope": {
2457
+ "type": "string",
2458
+ "enum": [
2459
+ "agent",
2460
+ "swarm"
2461
+ ]
2462
+ },
2463
+ "source": {
2464
+ "type": "string",
2465
+ "enum": [
2466
+ "manual",
2467
+ "file_index",
2468
+ "session_summary",
2469
+ "task_completion"
2470
+ ]
2471
+ },
2472
+ "sourceTaskId": {
2473
+ "type": "string",
2474
+ "format": "uuid"
2475
+ },
2476
+ "sourcePath": {
2078
2477
  "type": "string"
2478
+ },
2479
+ "tags": {
2480
+ "type": "array",
2481
+ "items": {
2482
+ "type": "string"
2483
+ }
2079
2484
  }
2080
2485
  },
2081
2486
  "required": [
2082
- "eventType"
2487
+ "content",
2488
+ "name",
2489
+ "scope",
2490
+ "source"
2083
2491
  ]
2084
2492
  }
2085
2493
  }
2086
2494
  }
2087
2495
  },
2088
2496
  "responses": {
2089
- "200": {
2090
- "description": "Fully resolved and interpolated template"
2497
+ "202": {
2498
+ "description": "Content queued for embedding"
2091
2499
  },
2092
2500
  "400": {
2093
2501
  "description": "Validation error"
@@ -2095,39 +2503,36 @@
2095
2503
  }
2096
2504
  }
2097
2505
  },
2098
- "/api/prompt-templates/{id}/checkout": {
2506
+ "/api/memory/search": {
2099
2507
  "post": {
2100
- "summary": "Checkout a specific version of a prompt template from history",
2508
+ "summary": "Search memories by natural language query",
2101
2509
  "tags": [
2102
- "PromptTemplates"
2510
+ "Memory"
2103
2511
  ],
2104
2512
  "security": [
2105
2513
  {
2106
2514
  "bearerAuth": []
2107
2515
  }
2108
2516
  ],
2109
- "parameters": [
2110
- {
2111
- "schema": {
2112
- "type": "string"
2113
- },
2114
- "required": true,
2115
- "name": "id",
2116
- "in": "path"
2117
- }
2118
- ],
2119
2517
  "requestBody": {
2120
2518
  "content": {
2121
2519
  "application/json": {
2122
2520
  "schema": {
2123
2521
  "type": "object",
2124
2522
  "properties": {
2125
- "version": {
2126
- "type": "number"
2523
+ "query": {
2524
+ "type": "string",
2525
+ "minLength": 1
2526
+ },
2527
+ "limit": {
2528
+ "type": "integer",
2529
+ "minimum": 1,
2530
+ "maximum": 20,
2531
+ "default": 5
2127
2532
  }
2128
2533
  },
2129
2534
  "required": [
2130
- "version"
2535
+ "query"
2131
2536
  ]
2132
2537
  }
2133
2538
  }
@@ -2135,13 +2540,219 @@
2135
2540
  },
2136
2541
  "responses": {
2137
2542
  "200": {
2138
- "description": "Checked-out template"
2543
+ "description": "Search results"
2139
2544
  },
2140
2545
  "400": {
2141
- "description": "Validation error"
2142
- },
2143
- "404": {
2144
- "description": "Template or version not found"
2546
+ "description": "Missing query or agent ID"
2547
+ }
2548
+ }
2549
+ }
2550
+ },
2551
+ "/api/prompt-templates/resolved": {
2552
+ "get": {
2553
+ "summary": "Resolve a prompt template for a given event type and scope chain",
2554
+ "tags": [
2555
+ "PromptTemplates"
2556
+ ],
2557
+ "security": [
2558
+ {
2559
+ "bearerAuth": []
2560
+ }
2561
+ ],
2562
+ "parameters": [
2563
+ {
2564
+ "schema": {
2565
+ "type": "string"
2566
+ },
2567
+ "required": true,
2568
+ "name": "eventType",
2569
+ "in": "query"
2570
+ },
2571
+ {
2572
+ "schema": {
2573
+ "type": "string"
2574
+ },
2575
+ "required": false,
2576
+ "name": "agentId",
2577
+ "in": "query"
2578
+ },
2579
+ {
2580
+ "schema": {
2581
+ "type": "string"
2582
+ },
2583
+ "required": false,
2584
+ "name": "repoId",
2585
+ "in": "query"
2586
+ }
2587
+ ],
2588
+ "responses": {
2589
+ "200": {
2590
+ "description": "Resolved template info"
2591
+ },
2592
+ "400": {
2593
+ "description": "Missing eventType"
2594
+ }
2595
+ }
2596
+ }
2597
+ },
2598
+ "/api/prompt-templates/events": {
2599
+ "get": {
2600
+ "summary": "List all registered event types with their available variables",
2601
+ "tags": [
2602
+ "PromptTemplates"
2603
+ ],
2604
+ "security": [
2605
+ {
2606
+ "bearerAuth": []
2607
+ }
2608
+ ],
2609
+ "responses": {
2610
+ "200": {
2611
+ "description": "List of event template definitions"
2612
+ }
2613
+ }
2614
+ }
2615
+ },
2616
+ "/api/prompt-templates/preview": {
2617
+ "post": {
2618
+ "summary": "Dry-run render a template with provided variables",
2619
+ "tags": [
2620
+ "PromptTemplates"
2621
+ ],
2622
+ "security": [
2623
+ {
2624
+ "bearerAuth": []
2625
+ }
2626
+ ],
2627
+ "requestBody": {
2628
+ "content": {
2629
+ "application/json": {
2630
+ "schema": {
2631
+ "type": "object",
2632
+ "properties": {
2633
+ "eventType": {
2634
+ "type": "string"
2635
+ },
2636
+ "body": {
2637
+ "type": "string"
2638
+ },
2639
+ "variables": {
2640
+ "type": "object",
2641
+ "additionalProperties": {}
2642
+ }
2643
+ },
2644
+ "required": [
2645
+ "eventType"
2646
+ ]
2647
+ }
2648
+ }
2649
+ }
2650
+ },
2651
+ "responses": {
2652
+ "200": {
2653
+ "description": "Rendered template preview"
2654
+ },
2655
+ "400": {
2656
+ "description": "Validation error"
2657
+ }
2658
+ }
2659
+ }
2660
+ },
2661
+ "/api/prompt-templates/render": {
2662
+ "post": {
2663
+ "summary": "Full scope-aware template resolution with interpolation (used by workers via HTTP)",
2664
+ "tags": [
2665
+ "PromptTemplates"
2666
+ ],
2667
+ "security": [
2668
+ {
2669
+ "bearerAuth": []
2670
+ }
2671
+ ],
2672
+ "requestBody": {
2673
+ "content": {
2674
+ "application/json": {
2675
+ "schema": {
2676
+ "type": "object",
2677
+ "properties": {
2678
+ "eventType": {
2679
+ "type": "string"
2680
+ },
2681
+ "variables": {
2682
+ "type": "object",
2683
+ "additionalProperties": {}
2684
+ },
2685
+ "agentId": {
2686
+ "type": "string"
2687
+ },
2688
+ "repoId": {
2689
+ "type": "string"
2690
+ }
2691
+ },
2692
+ "required": [
2693
+ "eventType"
2694
+ ]
2695
+ }
2696
+ }
2697
+ }
2698
+ },
2699
+ "responses": {
2700
+ "200": {
2701
+ "description": "Fully resolved and interpolated template"
2702
+ },
2703
+ "400": {
2704
+ "description": "Validation error"
2705
+ }
2706
+ }
2707
+ }
2708
+ },
2709
+ "/api/prompt-templates/{id}/checkout": {
2710
+ "post": {
2711
+ "summary": "Checkout a specific version of a prompt template from history",
2712
+ "tags": [
2713
+ "PromptTemplates"
2714
+ ],
2715
+ "security": [
2716
+ {
2717
+ "bearerAuth": []
2718
+ }
2719
+ ],
2720
+ "parameters": [
2721
+ {
2722
+ "schema": {
2723
+ "type": "string"
2724
+ },
2725
+ "required": true,
2726
+ "name": "id",
2727
+ "in": "path"
2728
+ }
2729
+ ],
2730
+ "requestBody": {
2731
+ "content": {
2732
+ "application/json": {
2733
+ "schema": {
2734
+ "type": "object",
2735
+ "properties": {
2736
+ "version": {
2737
+ "type": "number"
2738
+ }
2739
+ },
2740
+ "required": [
2741
+ "version"
2742
+ ]
2743
+ }
2744
+ }
2745
+ }
2746
+ },
2747
+ "responses": {
2748
+ "200": {
2749
+ "description": "Checked-out template"
2750
+ },
2751
+ "400": {
2752
+ "description": "Validation error"
2753
+ },
2754
+ "404": {
2755
+ "description": "Template or version not found"
2145
2756
  }
2146
2757
  }
2147
2758
  }
@@ -3199,23 +3810,529 @@
3199
3810
  },
3200
3811
  "responses": {
3201
3812
  "200": {
3202
- "description": "Schedule updated"
3203
- },
3204
- "400": {
3205
- "description": "Validation error"
3813
+ "description": "Schedule updated"
3814
+ },
3815
+ "400": {
3816
+ "description": "Validation error"
3817
+ },
3818
+ "404": {
3819
+ "description": "Schedule not found"
3820
+ },
3821
+ "409": {
3822
+ "description": "Duplicate name"
3823
+ }
3824
+ }
3825
+ },
3826
+ "delete": {
3827
+ "summary": "Delete a schedule",
3828
+ "tags": [
3829
+ "Schedules"
3830
+ ],
3831
+ "security": [
3832
+ {
3833
+ "bearerAuth": []
3834
+ }
3835
+ ],
3836
+ "parameters": [
3837
+ {
3838
+ "schema": {
3839
+ "type": "string"
3840
+ },
3841
+ "required": true,
3842
+ "name": "id",
3843
+ "in": "path"
3844
+ }
3845
+ ],
3846
+ "responses": {
3847
+ "200": {
3848
+ "description": "Schedule deleted"
3849
+ },
3850
+ "404": {
3851
+ "description": "Schedule not found"
3852
+ }
3853
+ }
3854
+ }
3855
+ },
3856
+ "/api/session-logs": {
3857
+ "post": {
3858
+ "summary": "Store session logs",
3859
+ "tags": [
3860
+ "Session Data"
3861
+ ],
3862
+ "security": [
3863
+ {
3864
+ "bearerAuth": []
3865
+ }
3866
+ ],
3867
+ "requestBody": {
3868
+ "content": {
3869
+ "application/json": {
3870
+ "schema": {
3871
+ "type": "object",
3872
+ "properties": {
3873
+ "sessionId": {
3874
+ "type": "string",
3875
+ "minLength": 1
3876
+ },
3877
+ "iteration": {
3878
+ "type": "integer",
3879
+ "minimum": 1
3880
+ },
3881
+ "lines": {
3882
+ "type": "array",
3883
+ "items": {
3884
+ "type": "string"
3885
+ },
3886
+ "minItems": 1
3887
+ },
3888
+ "taskId": {
3889
+ "type": "string"
3890
+ },
3891
+ "cli": {
3892
+ "type": "string"
3893
+ }
3894
+ },
3895
+ "required": [
3896
+ "sessionId",
3897
+ "iteration",
3898
+ "lines"
3899
+ ]
3900
+ }
3901
+ }
3902
+ }
3903
+ },
3904
+ "responses": {
3905
+ "201": {
3906
+ "description": "Logs stored"
3907
+ },
3908
+ "400": {
3909
+ "description": "Validation error"
3910
+ }
3911
+ }
3912
+ }
3913
+ },
3914
+ "/api/tasks/{taskId}/session-logs": {
3915
+ "get": {
3916
+ "summary": "Get session logs for a task",
3917
+ "tags": [
3918
+ "Session Data"
3919
+ ],
3920
+ "security": [
3921
+ {
3922
+ "bearerAuth": []
3923
+ }
3924
+ ],
3925
+ "parameters": [
3926
+ {
3927
+ "schema": {
3928
+ "type": "string"
3929
+ },
3930
+ "required": true,
3931
+ "name": "taskId",
3932
+ "in": "path"
3933
+ }
3934
+ ],
3935
+ "responses": {
3936
+ "200": {
3937
+ "description": "Session logs"
3938
+ },
3939
+ "404": {
3940
+ "description": "Task not found"
3941
+ }
3942
+ }
3943
+ }
3944
+ },
3945
+ "/api/session-costs": {
3946
+ "post": {
3947
+ "summary": "Store session cost record",
3948
+ "tags": [
3949
+ "Session Data"
3950
+ ],
3951
+ "security": [
3952
+ {
3953
+ "bearerAuth": []
3954
+ }
3955
+ ],
3956
+ "requestBody": {
3957
+ "content": {
3958
+ "application/json": {
3959
+ "schema": {
3960
+ "type": "object",
3961
+ "properties": {
3962
+ "sessionId": {
3963
+ "type": "string",
3964
+ "minLength": 1
3965
+ },
3966
+ "agentId": {
3967
+ "type": "string",
3968
+ "minLength": 1
3969
+ },
3970
+ "totalCostUsd": {
3971
+ "type": "number"
3972
+ },
3973
+ "taskId": {
3974
+ "type": "string"
3975
+ },
3976
+ "inputTokens": {
3977
+ "type": "integer"
3978
+ },
3979
+ "outputTokens": {
3980
+ "type": "integer"
3981
+ },
3982
+ "cacheReadTokens": {
3983
+ "type": "integer"
3984
+ },
3985
+ "cacheWriteTokens": {
3986
+ "type": "integer"
3987
+ },
3988
+ "durationMs": {
3989
+ "type": "integer"
3990
+ },
3991
+ "numTurns": {
3992
+ "type": "integer"
3993
+ },
3994
+ "model": {
3995
+ "type": "string"
3996
+ },
3997
+ "isError": {
3998
+ "type": "boolean"
3999
+ }
4000
+ },
4001
+ "required": [
4002
+ "sessionId",
4003
+ "agentId",
4004
+ "totalCostUsd"
4005
+ ]
4006
+ }
4007
+ }
4008
+ }
4009
+ },
4010
+ "responses": {
4011
+ "201": {
4012
+ "description": "Cost record stored"
4013
+ },
4014
+ "400": {
4015
+ "description": "Validation error"
4016
+ }
4017
+ }
4018
+ },
4019
+ "get": {
4020
+ "summary": "Query session costs with filters",
4021
+ "tags": [
4022
+ "Session Data"
4023
+ ],
4024
+ "security": [
4025
+ {
4026
+ "bearerAuth": []
4027
+ }
4028
+ ],
4029
+ "parameters": [
4030
+ {
4031
+ "schema": {
4032
+ "type": "string"
4033
+ },
4034
+ "required": false,
4035
+ "name": "agentId",
4036
+ "in": "query"
4037
+ },
4038
+ {
4039
+ "schema": {
4040
+ "type": "string"
4041
+ },
4042
+ "required": false,
4043
+ "name": "taskId",
4044
+ "in": "query"
4045
+ },
4046
+ {
4047
+ "schema": {
4048
+ "type": "string"
4049
+ },
4050
+ "required": false,
4051
+ "name": "startDate",
4052
+ "in": "query"
4053
+ },
4054
+ {
4055
+ "schema": {
4056
+ "type": "string"
4057
+ },
4058
+ "required": false,
4059
+ "name": "endDate",
4060
+ "in": "query"
4061
+ },
4062
+ {
4063
+ "schema": {
4064
+ "type": "integer",
4065
+ "minimum": 1
4066
+ },
4067
+ "required": false,
4068
+ "name": "limit",
4069
+ "in": "query"
4070
+ }
4071
+ ],
4072
+ "responses": {
4073
+ "200": {
4074
+ "description": "Session costs"
4075
+ }
4076
+ }
4077
+ }
4078
+ },
4079
+ "/api/session-costs/summary": {
4080
+ "get": {
4081
+ "summary": "Aggregated session cost summary",
4082
+ "tags": [
4083
+ "Session Data"
4084
+ ],
4085
+ "security": [
4086
+ {
4087
+ "bearerAuth": []
4088
+ }
4089
+ ],
4090
+ "parameters": [
4091
+ {
4092
+ "schema": {
4093
+ "type": "string",
4094
+ "enum": [
4095
+ "day",
4096
+ "agent",
4097
+ "both"
4098
+ ]
4099
+ },
4100
+ "required": false,
4101
+ "name": "groupBy",
4102
+ "in": "query"
4103
+ },
4104
+ {
4105
+ "schema": {
4106
+ "type": "string"
4107
+ },
4108
+ "required": false,
4109
+ "name": "startDate",
4110
+ "in": "query"
4111
+ },
4112
+ {
4113
+ "schema": {
4114
+ "type": "string"
4115
+ },
4116
+ "required": false,
4117
+ "name": "endDate",
4118
+ "in": "query"
4119
+ },
4120
+ {
4121
+ "schema": {
4122
+ "type": "string"
4123
+ },
4124
+ "required": false,
4125
+ "name": "agentId",
4126
+ "in": "query"
4127
+ }
4128
+ ],
4129
+ "responses": {
4130
+ "200": {
4131
+ "description": "Cost summary"
4132
+ },
4133
+ "400": {
4134
+ "description": "Invalid groupBy"
4135
+ }
4136
+ }
4137
+ }
4138
+ },
4139
+ "/api/session-costs/dashboard": {
4140
+ "get": {
4141
+ "summary": "Cost today and month-to-date for dashboard",
4142
+ "tags": [
4143
+ "Session Data"
4144
+ ],
4145
+ "security": [
4146
+ {
4147
+ "bearerAuth": []
4148
+ }
4149
+ ],
4150
+ "responses": {
4151
+ "200": {
4152
+ "description": "Dashboard cost data"
4153
+ }
4154
+ }
4155
+ }
4156
+ },
4157
+ "/api/skills": {
4158
+ "get": {
4159
+ "summary": "List skills with optional filters",
4160
+ "tags": [
4161
+ "Skills"
4162
+ ],
4163
+ "security": [
4164
+ {
4165
+ "bearerAuth": []
4166
+ }
4167
+ ],
4168
+ "parameters": [
4169
+ {
4170
+ "schema": {
4171
+ "type": "string"
4172
+ },
4173
+ "required": false,
4174
+ "name": "type",
4175
+ "in": "query"
4176
+ },
4177
+ {
4178
+ "schema": {
4179
+ "type": "string"
4180
+ },
4181
+ "required": false,
4182
+ "name": "scope",
4183
+ "in": "query"
4184
+ },
4185
+ {
4186
+ "schema": {
4187
+ "type": "string"
4188
+ },
4189
+ "required": false,
4190
+ "name": "agentId",
4191
+ "in": "query"
4192
+ },
4193
+ {
4194
+ "schema": {
4195
+ "type": "string"
4196
+ },
4197
+ "required": false,
4198
+ "name": "enabled",
4199
+ "in": "query"
4200
+ },
4201
+ {
4202
+ "schema": {
4203
+ "type": "string"
4204
+ },
4205
+ "required": false,
4206
+ "name": "search",
4207
+ "in": "query"
4208
+ }
4209
+ ],
4210
+ "responses": {
4211
+ "200": {
4212
+ "description": "Skill list"
4213
+ }
4214
+ }
4215
+ },
4216
+ "post": {
4217
+ "summary": "Create a new skill",
4218
+ "tags": [
4219
+ "Skills"
4220
+ ],
4221
+ "security": [
4222
+ {
4223
+ "bearerAuth": []
4224
+ }
4225
+ ],
4226
+ "requestBody": {
4227
+ "content": {
4228
+ "application/json": {
4229
+ "schema": {
4230
+ "type": "object",
4231
+ "properties": {
4232
+ "content": {
4233
+ "type": "string",
4234
+ "minLength": 1
4235
+ },
4236
+ "type": {
4237
+ "type": "string"
4238
+ },
4239
+ "scope": {
4240
+ "type": "string"
4241
+ },
4242
+ "ownerAgentId": {
4243
+ "type": "string"
4244
+ }
4245
+ },
4246
+ "required": [
4247
+ "content"
4248
+ ]
4249
+ }
4250
+ }
4251
+ }
4252
+ },
4253
+ "responses": {
4254
+ "201": {
4255
+ "description": "Skill created"
4256
+ },
4257
+ "400": {
4258
+ "description": "Validation error"
4259
+ }
4260
+ }
4261
+ }
4262
+ },
4263
+ "/api/skills/{id}": {
4264
+ "get": {
4265
+ "summary": "Get skill by ID",
4266
+ "tags": [
4267
+ "Skills"
4268
+ ],
4269
+ "security": [
4270
+ {
4271
+ "bearerAuth": []
4272
+ }
4273
+ ],
4274
+ "parameters": [
4275
+ {
4276
+ "schema": {
4277
+ "type": "string"
4278
+ },
4279
+ "required": true,
4280
+ "name": "id",
4281
+ "in": "path"
4282
+ }
4283
+ ],
4284
+ "responses": {
4285
+ "200": {
4286
+ "description": "Skill details"
4287
+ },
4288
+ "404": {
4289
+ "description": "Skill not found"
4290
+ }
4291
+ }
4292
+ },
4293
+ "put": {
4294
+ "summary": "Update a skill",
4295
+ "tags": [
4296
+ "Skills"
4297
+ ],
4298
+ "security": [
4299
+ {
4300
+ "bearerAuth": []
4301
+ }
4302
+ ],
4303
+ "parameters": [
4304
+ {
4305
+ "schema": {
4306
+ "type": "string"
4307
+ },
4308
+ "required": true,
4309
+ "name": "id",
4310
+ "in": "path"
4311
+ }
4312
+ ],
4313
+ "requestBody": {
4314
+ "content": {
4315
+ "application/json": {
4316
+ "schema": {
4317
+ "type": "object",
4318
+ "additionalProperties": {}
4319
+ }
4320
+ }
4321
+ }
4322
+ },
4323
+ "responses": {
4324
+ "200": {
4325
+ "description": "Skill updated"
3206
4326
  },
3207
4327
  "404": {
3208
- "description": "Schedule not found"
3209
- },
3210
- "409": {
3211
- "description": "Duplicate name"
4328
+ "description": "Skill not found"
3212
4329
  }
3213
4330
  }
3214
4331
  },
3215
4332
  "delete": {
3216
- "summary": "Delete a schedule",
4333
+ "summary": "Delete a skill",
3217
4334
  "tags": [
3218
- "Schedules"
4335
+ "Skills"
3219
4336
  ],
3220
4337
  "security": [
3221
4338
  {
@@ -3234,77 +4351,67 @@
3234
4351
  ],
3235
4352
  "responses": {
3236
4353
  "200": {
3237
- "description": "Schedule deleted"
4354
+ "description": "Skill deleted"
3238
4355
  },
3239
4356
  "404": {
3240
- "description": "Schedule not found"
4357
+ "description": "Skill not found"
3241
4358
  }
3242
4359
  }
3243
4360
  }
3244
4361
  },
3245
- "/api/session-logs": {
4362
+ "/api/skills/{id}/install": {
3246
4363
  "post": {
3247
- "summary": "Store session logs",
4364
+ "summary": "Install skill for an agent",
3248
4365
  "tags": [
3249
- "Session Data"
4366
+ "Skills"
3250
4367
  ],
3251
4368
  "security": [
3252
4369
  {
3253
4370
  "bearerAuth": []
3254
4371
  }
3255
4372
  ],
4373
+ "parameters": [
4374
+ {
4375
+ "schema": {
4376
+ "type": "string"
4377
+ },
4378
+ "required": true,
4379
+ "name": "id",
4380
+ "in": "path"
4381
+ }
4382
+ ],
3256
4383
  "requestBody": {
3257
4384
  "content": {
3258
4385
  "application/json": {
3259
4386
  "schema": {
3260
4387
  "type": "object",
3261
4388
  "properties": {
3262
- "sessionId": {
3263
- "type": "string",
3264
- "minLength": 1
3265
- },
3266
- "iteration": {
3267
- "type": "integer",
3268
- "minimum": 1
3269
- },
3270
- "lines": {
3271
- "type": "array",
3272
- "items": {
3273
- "type": "string"
3274
- },
3275
- "minItems": 1
3276
- },
3277
- "taskId": {
3278
- "type": "string"
3279
- },
3280
- "cli": {
4389
+ "agentId": {
3281
4390
  "type": "string"
3282
4391
  }
3283
4392
  },
3284
4393
  "required": [
3285
- "sessionId",
3286
- "iteration",
3287
- "lines"
4394
+ "agentId"
3288
4395
  ]
3289
4396
  }
3290
4397
  }
3291
4398
  }
3292
4399
  },
3293
4400
  "responses": {
3294
- "201": {
3295
- "description": "Logs stored"
4401
+ "200": {
4402
+ "description": "Skill installed"
3296
4403
  },
3297
- "400": {
3298
- "description": "Validation error"
4404
+ "404": {
4405
+ "description": "Skill not found"
3299
4406
  }
3300
4407
  }
3301
4408
  }
3302
4409
  },
3303
- "/api/tasks/{taskId}/session-logs": {
3304
- "get": {
3305
- "summary": "Get session logs for a task",
4410
+ "/api/skills/{id}/install/{agentId}": {
4411
+ "delete": {
4412
+ "summary": "Uninstall skill for an agent",
3306
4413
  "tags": [
3307
- "Session Data"
4414
+ "Skills"
3308
4415
  ],
3309
4416
  "security": [
3310
4417
  {
@@ -3317,25 +4424,30 @@
3317
4424
  "type": "string"
3318
4425
  },
3319
4426
  "required": true,
3320
- "name": "taskId",
4427
+ "name": "id",
4428
+ "in": "path"
4429
+ },
4430
+ {
4431
+ "schema": {
4432
+ "type": "string"
4433
+ },
4434
+ "required": true,
4435
+ "name": "agentId",
3321
4436
  "in": "path"
3322
4437
  }
3323
4438
  ],
3324
4439
  "responses": {
3325
4440
  "200": {
3326
- "description": "Session logs"
3327
- },
3328
- "404": {
3329
- "description": "Task not found"
4441
+ "description": "Skill uninstalled"
3330
4442
  }
3331
4443
  }
3332
4444
  }
3333
4445
  },
3334
- "/api/session-costs": {
4446
+ "/api/skills/install-remote": {
3335
4447
  "post": {
3336
- "summary": "Store session cost record",
4448
+ "summary": "Install a remote skill from GitHub",
3337
4449
  "tags": [
3338
- "Session Data"
4450
+ "Skills"
3339
4451
  ],
3340
4452
  "security": [
3341
4453
  {
@@ -3348,49 +4460,21 @@
3348
4460
  "schema": {
3349
4461
  "type": "object",
3350
4462
  "properties": {
3351
- "sessionId": {
3352
- "type": "string",
3353
- "minLength": 1
3354
- },
3355
- "agentId": {
3356
- "type": "string",
3357
- "minLength": 1
3358
- },
3359
- "totalCostUsd": {
3360
- "type": "number"
3361
- },
3362
- "taskId": {
4463
+ "sourceRepo": {
3363
4464
  "type": "string"
3364
4465
  },
3365
- "inputTokens": {
3366
- "type": "integer"
3367
- },
3368
- "outputTokens": {
3369
- "type": "integer"
3370
- },
3371
- "cacheReadTokens": {
3372
- "type": "integer"
3373
- },
3374
- "cacheWriteTokens": {
3375
- "type": "integer"
3376
- },
3377
- "durationMs": {
3378
- "type": "integer"
3379
- },
3380
- "numTurns": {
3381
- "type": "integer"
4466
+ "sourcePath": {
4467
+ "type": "string"
3382
4468
  },
3383
- "model": {
4469
+ "scope": {
3384
4470
  "type": "string"
3385
4471
  },
3386
- "isError": {
4472
+ "isComplex": {
3387
4473
  "type": "boolean"
3388
4474
  }
3389
4475
  },
3390
4476
  "required": [
3391
- "sessionId",
3392
- "agentId",
3393
- "totalCostUsd"
4477
+ "sourceRepo"
3394
4478
  ]
3395
4479
  }
3396
4480
  }
@@ -3398,156 +4482,100 @@
3398
4482
  },
3399
4483
  "responses": {
3400
4484
  "201": {
3401
- "description": "Cost record stored"
4485
+ "description": "Remote skill installed"
3402
4486
  },
3403
4487
  "400": {
3404
- "description": "Validation error"
4488
+ "description": "Fetch failed"
3405
4489
  }
3406
4490
  }
3407
- },
3408
- "get": {
3409
- "summary": "Query session costs with filters",
4491
+ }
4492
+ },
4493
+ "/api/skills/sync-remote": {
4494
+ "post": {
4495
+ "summary": "Trigger remote skill sync",
3410
4496
  "tags": [
3411
- "Session Data"
4497
+ "Skills"
3412
4498
  ],
3413
4499
  "security": [
3414
4500
  {
3415
4501
  "bearerAuth": []
3416
4502
  }
3417
4503
  ],
3418
- "parameters": [
3419
- {
3420
- "schema": {
3421
- "type": "string"
3422
- },
3423
- "required": false,
3424
- "name": "agentId",
3425
- "in": "query"
3426
- },
3427
- {
3428
- "schema": {
3429
- "type": "string"
3430
- },
3431
- "required": false,
3432
- "name": "taskId",
3433
- "in": "query"
3434
- },
3435
- {
3436
- "schema": {
3437
- "type": "string"
3438
- },
3439
- "required": false,
3440
- "name": "startDate",
3441
- "in": "query"
3442
- },
3443
- {
3444
- "schema": {
3445
- "type": "string"
3446
- },
3447
- "required": false,
3448
- "name": "endDate",
3449
- "in": "query"
3450
- },
3451
- {
3452
- "schema": {
3453
- "type": "integer",
3454
- "minimum": 1
3455
- },
3456
- "required": false,
3457
- "name": "limit",
3458
- "in": "query"
4504
+ "requestBody": {
4505
+ "content": {
4506
+ "application/json": {
4507
+ "schema": {
4508
+ "type": "object",
4509
+ "properties": {
4510
+ "skillId": {
4511
+ "type": "string"
4512
+ },
4513
+ "force": {
4514
+ "type": "boolean"
4515
+ }
4516
+ }
4517
+ }
4518
+ }
3459
4519
  }
3460
- ],
4520
+ },
3461
4521
  "responses": {
3462
4522
  "200": {
3463
- "description": "Session costs"
4523
+ "description": "Sync results"
3464
4524
  }
3465
4525
  }
3466
4526
  }
3467
- },
3468
- "/api/session-costs/summary": {
3469
- "get": {
3470
- "summary": "Aggregated session cost summary",
3471
- "tags": [
3472
- "Session Data"
3473
- ],
3474
- "security": [
3475
- {
3476
- "bearerAuth": []
3477
- }
3478
- ],
3479
- "parameters": [
3480
- {
3481
- "schema": {
3482
- "type": "string",
3483
- "enum": [
3484
- "day",
3485
- "agent",
3486
- "both"
3487
- ]
3488
- },
3489
- "required": false,
3490
- "name": "groupBy",
3491
- "in": "query"
3492
- },
3493
- {
3494
- "schema": {
3495
- "type": "string"
3496
- },
3497
- "required": false,
3498
- "name": "startDate",
3499
- "in": "query"
3500
- },
3501
- {
3502
- "schema": {
3503
- "type": "string"
3504
- },
3505
- "required": false,
3506
- "name": "endDate",
3507
- "in": "query"
3508
- },
4527
+ },
4528
+ "/api/skills/sync-filesystem": {
4529
+ "post": {
4530
+ "summary": "Sync installed skills to agent filesystem",
4531
+ "tags": [
4532
+ "Skills"
4533
+ ],
4534
+ "security": [
3509
4535
  {
3510
- "schema": {
3511
- "type": "string"
3512
- },
3513
- "required": false,
3514
- "name": "agentId",
3515
- "in": "query"
4536
+ "bearerAuth": []
3516
4537
  }
3517
4538
  ],
3518
4539
  "responses": {
3519
4540
  "200": {
3520
- "description": "Cost summary"
3521
- },
3522
- "400": {
3523
- "description": "Invalid groupBy"
4541
+ "description": "Filesystem sync results"
3524
4542
  }
3525
4543
  }
3526
4544
  }
3527
4545
  },
3528
- "/api/session-costs/dashboard": {
4546
+ "/api/agents/{id}/skills": {
3529
4547
  "get": {
3530
- "summary": "Cost today and month-to-date for dashboard",
4548
+ "summary": "Get all skills installed for an agent",
3531
4549
  "tags": [
3532
- "Session Data"
4550
+ "Skills"
3533
4551
  ],
3534
4552
  "security": [
3535
4553
  {
3536
4554
  "bearerAuth": []
3537
4555
  }
3538
4556
  ],
4557
+ "parameters": [
4558
+ {
4559
+ "schema": {
4560
+ "type": "string"
4561
+ },
4562
+ "required": true,
4563
+ "name": "id",
4564
+ "in": "path"
4565
+ }
4566
+ ],
3539
4567
  "responses": {
3540
4568
  "200": {
3541
- "description": "Dashboard cost data"
4569
+ "description": "Agent skills list"
3542
4570
  }
3543
4571
  }
3544
4572
  }
3545
4573
  },
3546
- "/api/skills": {
4574
+ "/api/mcp-servers": {
3547
4575
  "get": {
3548
- "summary": "List skills with optional filters",
4576
+ "summary": "List MCP servers with optional filters",
3549
4577
  "tags": [
3550
- "Skills"
4578
+ "MCP Servers"
3551
4579
  ],
3552
4580
  "security": [
3553
4581
  {
@@ -3560,7 +4588,7 @@
3560
4588
  "type": "string"
3561
4589
  },
3562
4590
  "required": false,
3563
- "name": "type",
4591
+ "name": "scope",
3564
4592
  "in": "query"
3565
4593
  },
3566
4594
  {
@@ -3568,7 +4596,7 @@
3568
4596
  "type": "string"
3569
4597
  },
3570
4598
  "required": false,
3571
- "name": "scope",
4599
+ "name": "transport",
3572
4600
  "in": "query"
3573
4601
  },
3574
4602
  {
@@ -3576,7 +4604,7 @@
3576
4604
  "type": "string"
3577
4605
  },
3578
4606
  "required": false,
3579
- "name": "agentId",
4607
+ "name": "ownerAgentId",
3580
4608
  "in": "query"
3581
4609
  },
3582
4610
  {
@@ -3598,14 +4626,14 @@
3598
4626
  ],
3599
4627
  "responses": {
3600
4628
  "200": {
3601
- "description": "Skill list"
4629
+ "description": "MCP server list"
3602
4630
  }
3603
4631
  }
3604
4632
  },
3605
4633
  "post": {
3606
- "summary": "Create a new skill",
4634
+ "summary": "Create a new MCP server",
3607
4635
  "tags": [
3608
- "Skills"
4636
+ "MCP Servers"
3609
4637
  ],
3610
4638
  "security": [
3611
4639
  {
@@ -3618,11 +4646,19 @@
3618
4646
  "schema": {
3619
4647
  "type": "object",
3620
4648
  "properties": {
3621
- "content": {
4649
+ "name": {
3622
4650
  "type": "string",
3623
4651
  "minLength": 1
3624
4652
  },
3625
- "type": {
4653
+ "transport": {
4654
+ "type": "string",
4655
+ "enum": [
4656
+ "stdio",
4657
+ "http",
4658
+ "sse"
4659
+ ]
4660
+ },
4661
+ "description": {
3626
4662
  "type": "string"
3627
4663
  },
3628
4664
  "scope": {
@@ -3630,10 +4666,29 @@
3630
4666
  },
3631
4667
  "ownerAgentId": {
3632
4668
  "type": "string"
4669
+ },
4670
+ "command": {
4671
+ "type": "string"
4672
+ },
4673
+ "args": {
4674
+ "type": "string"
4675
+ },
4676
+ "url": {
4677
+ "type": "string"
4678
+ },
4679
+ "headers": {
4680
+ "type": "string"
4681
+ },
4682
+ "envConfigKeys": {
4683
+ "type": "string"
4684
+ },
4685
+ "headerConfigKeys": {
4686
+ "type": "string"
3633
4687
  }
3634
4688
  },
3635
4689
  "required": [
3636
- "content"
4690
+ "name",
4691
+ "transport"
3637
4692
  ]
3638
4693
  }
3639
4694
  }
@@ -3641,7 +4696,7 @@
3641
4696
  },
3642
4697
  "responses": {
3643
4698
  "201": {
3644
- "description": "Skill created"
4699
+ "description": "MCP server created"
3645
4700
  },
3646
4701
  "400": {
3647
4702
  "description": "Validation error"
@@ -3649,11 +4704,11 @@
3649
4704
  }
3650
4705
  }
3651
4706
  },
3652
- "/api/skills/{id}": {
4707
+ "/api/mcp-servers/{id}": {
3653
4708
  "get": {
3654
- "summary": "Get skill by ID",
4709
+ "summary": "Get MCP server by ID",
3655
4710
  "tags": [
3656
- "Skills"
4711
+ "MCP Servers"
3657
4712
  ],
3658
4713
  "security": [
3659
4714
  {
@@ -3672,17 +4727,17 @@
3672
4727
  ],
3673
4728
  "responses": {
3674
4729
  "200": {
3675
- "description": "Skill details"
4730
+ "description": "MCP server details"
3676
4731
  },
3677
4732
  "404": {
3678
- "description": "Skill not found"
4733
+ "description": "MCP server not found"
3679
4734
  }
3680
4735
  }
3681
4736
  },
3682
4737
  "put": {
3683
- "summary": "Update a skill",
4738
+ "summary": "Update an MCP server",
3684
4739
  "tags": [
3685
- "Skills"
4740
+ "MCP Servers"
3686
4741
  ],
3687
4742
  "security": [
3688
4743
  {
@@ -3711,17 +4766,17 @@
3711
4766
  },
3712
4767
  "responses": {
3713
4768
  "200": {
3714
- "description": "Skill updated"
4769
+ "description": "MCP server updated"
3715
4770
  },
3716
4771
  "404": {
3717
- "description": "Skill not found"
4772
+ "description": "MCP server not found"
3718
4773
  }
3719
4774
  }
3720
4775
  },
3721
4776
  "delete": {
3722
- "summary": "Delete a skill",
4777
+ "summary": "Delete an MCP server",
3723
4778
  "tags": [
3724
- "Skills"
4779
+ "MCP Servers"
3725
4780
  ],
3726
4781
  "security": [
3727
4782
  {
@@ -3740,19 +4795,19 @@
3740
4795
  ],
3741
4796
  "responses": {
3742
4797
  "200": {
3743
- "description": "Skill deleted"
4798
+ "description": "MCP server deleted"
3744
4799
  },
3745
4800
  "404": {
3746
- "description": "Skill not found"
4801
+ "description": "MCP server not found"
3747
4802
  }
3748
4803
  }
3749
4804
  }
3750
4805
  },
3751
- "/api/skills/{id}/install": {
4806
+ "/api/mcp-servers/{id}/install": {
3752
4807
  "post": {
3753
- "summary": "Install skill for an agent",
4808
+ "summary": "Install MCP server for an agent",
3754
4809
  "tags": [
3755
- "Skills"
4810
+ "MCP Servers"
3756
4811
  ],
3757
4812
  "security": [
3758
4813
  {
@@ -3788,19 +4843,19 @@
3788
4843
  },
3789
4844
  "responses": {
3790
4845
  "200": {
3791
- "description": "Skill installed"
4846
+ "description": "MCP server installed"
3792
4847
  },
3793
4848
  "404": {
3794
- "description": "Skill not found"
4849
+ "description": "MCP server not found"
3795
4850
  }
3796
4851
  }
3797
4852
  }
3798
4853
  },
3799
- "/api/skills/{id}/install/{agentId}": {
4854
+ "/api/mcp-servers/{id}/install/{agentId}": {
3800
4855
  "delete": {
3801
- "summary": "Uninstall skill for an agent",
4856
+ "summary": "Uninstall MCP server for an agent",
3802
4857
  "tags": [
3803
- "Skills"
4858
+ "MCP Servers"
3804
4859
  ],
3805
4860
  "security": [
3806
4861
  {
@@ -3827,116 +4882,16 @@
3827
4882
  ],
3828
4883
  "responses": {
3829
4884
  "200": {
3830
- "description": "Skill uninstalled"
3831
- }
3832
- }
3833
- }
3834
- },
3835
- "/api/skills/install-remote": {
3836
- "post": {
3837
- "summary": "Install a remote skill from GitHub",
3838
- "tags": [
3839
- "Skills"
3840
- ],
3841
- "security": [
3842
- {
3843
- "bearerAuth": []
3844
- }
3845
- ],
3846
- "requestBody": {
3847
- "content": {
3848
- "application/json": {
3849
- "schema": {
3850
- "type": "object",
3851
- "properties": {
3852
- "sourceRepo": {
3853
- "type": "string"
3854
- },
3855
- "sourcePath": {
3856
- "type": "string"
3857
- },
3858
- "scope": {
3859
- "type": "string"
3860
- },
3861
- "isComplex": {
3862
- "type": "boolean"
3863
- }
3864
- },
3865
- "required": [
3866
- "sourceRepo"
3867
- ]
3868
- }
3869
- }
3870
- }
3871
- },
3872
- "responses": {
3873
- "201": {
3874
- "description": "Remote skill installed"
3875
- },
3876
- "400": {
3877
- "description": "Fetch failed"
3878
- }
3879
- }
3880
- }
3881
- },
3882
- "/api/skills/sync-remote": {
3883
- "post": {
3884
- "summary": "Trigger remote skill sync",
3885
- "tags": [
3886
- "Skills"
3887
- ],
3888
- "security": [
3889
- {
3890
- "bearerAuth": []
3891
- }
3892
- ],
3893
- "requestBody": {
3894
- "content": {
3895
- "application/json": {
3896
- "schema": {
3897
- "type": "object",
3898
- "properties": {
3899
- "skillId": {
3900
- "type": "string"
3901
- },
3902
- "force": {
3903
- "type": "boolean"
3904
- }
3905
- }
3906
- }
3907
- }
3908
- }
3909
- },
3910
- "responses": {
3911
- "200": {
3912
- "description": "Sync results"
3913
- }
3914
- }
3915
- }
3916
- },
3917
- "/api/skills/sync-filesystem": {
3918
- "post": {
3919
- "summary": "Sync installed skills to agent filesystem",
3920
- "tags": [
3921
- "Skills"
3922
- ],
3923
- "security": [
3924
- {
3925
- "bearerAuth": []
3926
- }
3927
- ],
3928
- "responses": {
3929
- "200": {
3930
- "description": "Filesystem sync results"
4885
+ "description": "MCP server uninstalled"
3931
4886
  }
3932
4887
  }
3933
4888
  }
3934
4889
  },
3935
- "/api/agents/{id}/skills": {
4890
+ "/api/agents/{id}/mcp-servers": {
3936
4891
  "get": {
3937
- "summary": "Get all skills installed for an agent",
4892
+ "summary": "Get all MCP servers installed for an agent",
3938
4893
  "tags": [
3939
- "Skills"
4894
+ "MCP Servers"
3940
4895
  ],
3941
4896
  "security": [
3942
4897
  {
@@ -3951,11 +4906,19 @@
3951
4906
  "required": true,
3952
4907
  "name": "id",
3953
4908
  "in": "path"
4909
+ },
4910
+ {
4911
+ "schema": {
4912
+ "type": "string"
4913
+ },
4914
+ "required": false,
4915
+ "name": "resolveSecrets",
4916
+ "in": "query"
3954
4917
  }
3955
4918
  ],
3956
4919
  "responses": {
3957
4920
  "200": {
3958
- "description": "Agent skills list"
4921
+ "description": "Agent MCP servers list"
3959
4922
  }
3960
4923
  }
3961
4924
  }
@@ -4629,6 +5592,72 @@
4629
5592
  }
4630
5593
  }
4631
5594
  },
5595
+ "/api/tasks/{id}/vcs": {
5596
+ "patch": {
5597
+ "summary": "Update VCS (PR/MR) info for a task",
5598
+ "tags": [
5599
+ "Tasks"
5600
+ ],
5601
+ "security": [
5602
+ {
5603
+ "bearerAuth": []
5604
+ }
5605
+ ],
5606
+ "parameters": [
5607
+ {
5608
+ "schema": {
5609
+ "type": "string"
5610
+ },
5611
+ "required": true,
5612
+ "name": "id",
5613
+ "in": "path"
5614
+ }
5615
+ ],
5616
+ "requestBody": {
5617
+ "content": {
5618
+ "application/json": {
5619
+ "schema": {
5620
+ "type": "object",
5621
+ "properties": {
5622
+ "vcsProvider": {
5623
+ "type": "string",
5624
+ "enum": [
5625
+ "github",
5626
+ "gitlab"
5627
+ ]
5628
+ },
5629
+ "vcsRepo": {
5630
+ "type": "string"
5631
+ },
5632
+ "vcsNumber": {
5633
+ "type": "integer",
5634
+ "exclusiveMinimum": 0
5635
+ },
5636
+ "vcsUrl": {
5637
+ "type": "string",
5638
+ "format": "uri"
5639
+ }
5640
+ },
5641
+ "required": [
5642
+ "vcsProvider",
5643
+ "vcsRepo",
5644
+ "vcsNumber",
5645
+ "vcsUrl"
5646
+ ]
5647
+ }
5648
+ }
5649
+ }
5650
+ },
5651
+ "responses": {
5652
+ "200": {
5653
+ "description": "VCS info updated"
5654
+ },
5655
+ "404": {
5656
+ "description": "Task not found"
5657
+ }
5658
+ }
5659
+ }
5660
+ },
4632
5661
  "/api/trackers/linear/authorize": {
4633
5662
  "get": {
4634
5663
  "summary": "Redirect to Linear OAuth consent screen",