@agentstep/agent-sdk 0.4.39 → 0.5.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 (197) hide show
  1. package/dist/auth/middleware.js +8 -8
  2. package/dist/backends/claude/args.js +6 -6
  3. package/dist/backends/claude/index.js +7 -7
  4. package/dist/backends/codex/args.js +1 -1
  5. package/dist/backends/codex/auth.js +6 -6
  6. package/dist/backends/codex/index.js +8 -8
  7. package/dist/backends/factory/args.js +1 -1
  8. package/dist/backends/factory/auth.js +6 -6
  9. package/dist/backends/factory/index.js +8 -8
  10. package/dist/backends/gemini/args.js +1 -1
  11. package/dist/backends/gemini/auth.js +6 -6
  12. package/dist/backends/gemini/index.js +8 -8
  13. package/dist/backends/opencode/args.js +1 -1
  14. package/dist/backends/opencode/auth.js +6 -6
  15. package/dist/backends/opencode/index.js +9 -9
  16. package/dist/backends/opencode/mcp.js +1 -1
  17. package/dist/backends/pi/args.js +1 -1
  18. package/dist/backends/pi/auth.js +6 -6
  19. package/dist/backends/pi/index.js +8 -8
  20. package/dist/backends/registry.js +24 -24
  21. package/dist/{chunk-L2RX552S.js → chunk-22OUZJAV.js} +3 -3
  22. package/dist/{chunk-PIJKJNGB.js → chunk-24IDJ7LY.js} +4 -4
  23. package/dist/{chunk-WCDWL6ED.js → chunk-2YZOIFVN.js} +49 -0
  24. package/dist/{chunk-RDGOGAQ5.js → chunk-3FLQ7KZP.js} +1 -1
  25. package/dist/{chunk-ZQXBHNEZ.js → chunk-3PA4NXRP.js} +2 -2
  26. package/dist/{chunk-FZFICXAN.js → chunk-3XGUMXGR.js} +2 -2
  27. package/dist/{chunk-H7UKW666.js → chunk-445EL6J5.js} +1 -1
  28. package/dist/{chunk-2RSL5SO7.js → chunk-4D345E27.js} +2 -2
  29. package/dist/{chunk-D6ZQXOSQ.js → chunk-4RDILRIO.js} +5 -5
  30. package/dist/{chunk-MHBLVGRF.js → chunk-5MERXOLJ.js} +4 -4
  31. package/dist/{chunk-E7DD7F7J.js → chunk-5U5LRAFJ.js} +2 -2
  32. package/dist/{chunk-34EB622U.js → chunk-64IQEPSD.js} +2 -2
  33. package/dist/{chunk-ENGKR2JT.js → chunk-6CVQDSTS.js} +1 -1
  34. package/dist/{chunk-T5VRE77P.js → chunk-6KWJASEO.js} +1 -1
  35. package/dist/{chunk-W2NHS4IF.js → chunk-6QZ23WRF.js} +15 -19
  36. package/dist/{chunk-DU7LSFQQ.js → chunk-7SY65LWY.js} +6 -9
  37. package/dist/{chunk-C46UG6GQ.js → chunk-A6VORSKD.js} +1 -1
  38. package/dist/{chunk-3FDE3BPB.js → chunk-AB7MPL3H.js} +6 -6
  39. package/dist/{chunk-RP6WQ4IH.js → chunk-AJL3T5JS.js} +3 -3
  40. package/dist/{chunk-KKCLTWG7.js → chunk-AXBM7HAR.js} +1 -1
  41. package/dist/{chunk-ZTH5JRZG.js → chunk-BCIFFAGW.js} +41 -10
  42. package/dist/{chunk-OXWELRJL.js → chunk-CBPO2P4I.js} +101 -16
  43. package/dist/{chunk-32XS3Y6P.js → chunk-CLSGNQ7J.js} +8 -8
  44. package/dist/{chunk-SV2B3P6B.js → chunk-DBFPJSOY.js} +19 -17
  45. package/dist/{chunk-JWH4OIBP.js → chunk-DJZSPWG2.js} +4 -4
  46. package/dist/{chunk-JZL4L54R.js → chunk-DKLHYSPW.js} +2 -2
  47. package/dist/{chunk-NQVRZAIX.js → chunk-DMMNAQUM.js} +2 -2
  48. package/dist/{chunk-Y6SFUNGO.js → chunk-EOJ66GY7.js} +4 -4
  49. package/dist/{chunk-EUINGLHA.js → chunk-EWIWVXXP.js} +30 -20
  50. package/dist/{chunk-5EKQBD2H.js → chunk-FCUXFLNK.js} +2 -2
  51. package/dist/{chunk-LAVHQCRP.js → chunk-FSQ4HGHX.js} +3 -3
  52. package/dist/{chunk-WQARLGBG.js → chunk-GCQDNUS2.js} +3 -3
  53. package/dist/{chunk-MXOG5SAO.js → chunk-GFSRNOPI.js} +11 -14
  54. package/dist/{chunk-S7W3KJYH.js → chunk-GIMDS46L.js} +9 -4
  55. package/dist/{chunk-FP4E3QUS.js → chunk-GLKWJESP.js} +2 -2
  56. package/dist/{chunk-FDBR634Z.js → chunk-GV6GUSCP.js} +6 -6
  57. package/dist/{chunk-X6IQ57SC.js → chunk-H6OT5GUL.js} +9 -5
  58. package/dist/{chunk-TPPLYCJF.js → chunk-HMOSAXVZ.js} +2 -2
  59. package/dist/{chunk-L5RW66H5.js → chunk-HVLYE4S5.js} +1 -1
  60. package/dist/{chunk-RVR6C22M.js → chunk-HWR2HYQJ.js} +1 -1
  61. package/dist/{chunk-HH4OXSOV.js → chunk-HY3T4YJV.js} +5 -5
  62. package/dist/{chunk-AR2TM7CR.js → chunk-I26QP3A3.js} +1 -1
  63. package/dist/{chunk-D2TRWKVQ.js → chunk-I2WVMCYN.js} +80 -2
  64. package/dist/{chunk-JHGJG2Z2.js → chunk-IBYOMAZ3.js} +1 -1
  65. package/dist/{chunk-SUGSHXND.js → chunk-IEZFRNLC.js} +2 -2
  66. package/dist/{chunk-ZMJ4EP4C.js → chunk-ILHIHMO3.js} +7 -2
  67. package/dist/{chunk-XWWLMJXT.js → chunk-IRW7AYTP.js} +6 -15
  68. package/dist/{chunk-N76ZVITA.js → chunk-JFOHGHW5.js} +9 -9
  69. package/dist/{chunk-DAVYI5H4.js → chunk-JLUCJMAQ.js} +23 -23
  70. package/dist/{chunk-GVPJL3XS.js → chunk-JP7Y3TKK.js} +5 -5
  71. package/dist/{chunk-TH7WJLZC.js → chunk-KGBKIJPF.js} +3 -3
  72. package/dist/{chunk-MQQ44IGX.js → chunk-KKAJC3Z2.js} +3 -3
  73. package/dist/{chunk-3NK6YTA5.js → chunk-KUWJJD6O.js} +42 -8
  74. package/dist/{chunk-2GIX4HAT.js → chunk-L26TVIB6.js} +2 -2
  75. package/dist/{chunk-KLN6HPYM.js → chunk-L3IACZ72.js} +1 -1
  76. package/dist/{chunk-C6AXM3M7.js → chunk-LQP6XGFU.js} +2 -2
  77. package/dist/{chunk-JX627GQF.js → chunk-MAJWADF7.js} +2 -2
  78. package/dist/{chunk-7GG3FEK2.js → chunk-MCWCRZM4.js} +4 -4
  79. package/dist/{chunk-JCW3ZRES.js → chunk-MQBMXAPU.js} +1 -1
  80. package/dist/{chunk-CREPPDHX.js → chunk-NDTIDWBE.js} +1 -1
  81. package/dist/{chunk-5EQJOUWM.js → chunk-NHAYKVXG.js} +2 -2
  82. package/dist/{chunk-FXLUSECC.js → chunk-NKQVOAWN.js} +1 -1
  83. package/dist/{chunk-ZYISLRS6.js → chunk-OKT2J4ZB.js} +114 -37
  84. package/dist/{chunk-P3PHXVMA.js → chunk-OSNMIPHV.js} +54 -8
  85. package/dist/{chunk-ZFJPOQSY.js → chunk-OZFSKR2W.js} +69 -30
  86. package/dist/{chunk-3IV56JJW.js → chunk-P56WU3UT.js} +3 -2
  87. package/dist/{chunk-NQX7WBA4.js → chunk-PJYCPDV5.js} +14 -9
  88. package/dist/{chunk-LMNFIJ6M.js → chunk-PN3AWRMX.js} +15 -15
  89. package/dist/{chunk-ZMNQ2YJ6.js → chunk-PNZF7HIU.js} +3 -3
  90. package/dist/{chunk-R5T4LJSK.js → chunk-PZNAQBHQ.js} +2 -2
  91. package/dist/{chunk-RH4GKU52.js → chunk-QTXAWC5J.js} +18 -3
  92. package/dist/{chunk-2I35VGHX.js → chunk-R3QHLKJG.js} +2 -2
  93. package/dist/{chunk-OGJUSGF7.js → chunk-R6EEBWM3.js} +1 -1
  94. package/dist/{chunk-V66YKIW6.js → chunk-RYJXSXCV.js} +5 -5
  95. package/dist/{chunk-CHDQ3HIR.js → chunk-S7DFMJR5.js} +5 -9
  96. package/dist/{chunk-V2R7RWVY.js → chunk-STJNO6SL.js} +1 -1
  97. package/dist/{chunk-USYY3L7G.js → chunk-T3FQPTOA.js} +2 -2
  98. package/dist/{chunk-5IGBMS2U.js → chunk-T3HMVHDG.js} +1 -1
  99. package/dist/{chunk-IAF6VMPO.js → chunk-TPMZO6S2.js} +1 -1
  100. package/dist/{chunk-P26WOAA3.js → chunk-TUEBRYPZ.js} +1 -1
  101. package/dist/{chunk-HOIDGDU5.js → chunk-TVODT2UR.js} +1 -1
  102. package/dist/{chunk-Z25I7DRV.js → chunk-V5DH3OAC.js} +10 -5
  103. package/dist/{chunk-ZVXIZ2JD.js → chunk-VP527YC5.js} +35 -6
  104. package/dist/{chunk-6POQAFEC.js → chunk-W3JMIUHV.js} +1 -1
  105. package/dist/{chunk-6IYCBW4J.js → chunk-WEC625LQ.js} +1 -1
  106. package/dist/{chunk-V7MTIMPB.js → chunk-X6QIWZ33.js} +2 -2
  107. package/dist/{chunk-6GP5IKXE.js → chunk-XSNJ7NT2.js} +1 -1
  108. package/dist/{chunk-LZFB3HRK.js → chunk-XTKTIFHC.js} +5 -10
  109. package/dist/{chunk-QSUGIJWV.js → chunk-YMCS6AB7.js} +4 -9
  110. package/dist/{chunk-FOOH6SCB.js → chunk-YXOCKQZU.js} +2 -2
  111. package/dist/{chunk-2PPB644A.js → chunk-Z4LFLXRR.js} +1 -1
  112. package/dist/{chunk-N3QIXC2B.js → chunk-Z6VZYRVN.js} +2 -2
  113. package/dist/config/index.js +5 -5
  114. package/dist/containers/client.js +6 -6
  115. package/dist/containers/exec.js +6 -6
  116. package/dist/containers/lifecycle.js +36 -36
  117. package/dist/containers/setup.js +8 -8
  118. package/dist/db/agents.js +8 -6
  119. package/dist/db/api_keys.js +5 -5
  120. package/dist/db/audit.js +3 -3
  121. package/dist/db/batch.js +10 -10
  122. package/dist/db/client.js +2 -2
  123. package/dist/db/credentials.js +3 -3
  124. package/dist/db/drizzle.js +4 -4
  125. package/dist/db/environments.js +6 -6
  126. package/dist/db/events.js +5 -5
  127. package/dist/db/files.js +5 -5
  128. package/dist/db/memory.js +5 -5
  129. package/dist/db/migrations.js +1 -1
  130. package/dist/db/proxy.js +5 -5
  131. package/dist/db/schema.js +1 -1
  132. package/dist/db/session-resources.js +5 -5
  133. package/dist/db/sessions.js +8 -7
  134. package/dist/db/sync.js +5 -5
  135. package/dist/db/tenants.js +3 -3
  136. package/dist/db/traces.js +5 -5
  137. package/dist/db/upstream_keys.js +3 -3
  138. package/dist/db/vaults.js +12 -8
  139. package/dist/handlers/agents.js +56 -52
  140. package/dist/handlers/api_keys.js +53 -53
  141. package/dist/handlers/audit.js +53 -53
  142. package/dist/handlers/batch.js +53 -53
  143. package/dist/handlers/credentials.js +53 -53
  144. package/dist/handlers/environments.js +53 -53
  145. package/dist/handlers/events.js +56 -56
  146. package/dist/handlers/files.js +53 -53
  147. package/dist/handlers/index.js +101 -93
  148. package/dist/handlers/license.js +52 -52
  149. package/dist/handlers/memory.js +53 -53
  150. package/dist/handlers/metrics.js +52 -52
  151. package/dist/handlers/models.js +53 -53
  152. package/dist/handlers/openapi.js +3 -3
  153. package/dist/handlers/providers.js +52 -52
  154. package/dist/handlers/resources.js +52 -52
  155. package/dist/handlers/sessions.js +55 -55
  156. package/dist/handlers/settings.js +52 -52
  157. package/dist/handlers/skills-write.js +52 -52
  158. package/dist/handlers/skills.js +53 -53
  159. package/dist/handlers/stream.js +52 -52
  160. package/dist/handlers/tenants.js +53 -53
  161. package/dist/handlers/threads.js +52 -52
  162. package/dist/handlers/traces.js +53 -53
  163. package/dist/handlers/ui.js +1 -1
  164. package/dist/handlers/upstream_keys.js +55 -55
  165. package/dist/handlers/vaults.js +56 -52
  166. package/dist/handlers/whoami.js +52 -52
  167. package/dist/http.js +55 -51
  168. package/dist/index.js +57 -57
  169. package/dist/init.js +48 -48
  170. package/dist/lib/model-registry.js +6 -6
  171. package/dist/lib/skills-cache.js +6 -6
  172. package/dist/observability/otlp.js +12 -12
  173. package/dist/observability/redactor.js +8 -8
  174. package/dist/openapi/schemas.js +3 -1
  175. package/dist/openapi/spec.js +2 -2
  176. package/dist/providers/fly.js +5 -5
  177. package/dist/providers/modal.js +5 -5
  178. package/dist/providers/registry.js +1 -1
  179. package/dist/providers/resolve-secrets.js +7 -7
  180. package/dist/providers/sprites.js +7 -7
  181. package/dist/providers/upstream-keys.js +12 -11
  182. package/dist/providers/vercel.js +5 -5
  183. package/dist/proxy/forward.js +6 -6
  184. package/dist/queue/index.js +6 -6
  185. package/dist/sessions/bus.js +10 -10
  186. package/dist/sessions/driver.js +41 -41
  187. package/dist/sessions/grader.js +5 -5
  188. package/dist/sessions/mcp-auth.js +1 -1
  189. package/dist/sessions/secrets.js +8 -8
  190. package/dist/sessions/sweeper.js +37 -37
  191. package/dist/sessions/threads.js +41 -41
  192. package/dist/shutdown.js +38 -38
  193. package/dist/sync/anthropic.js +11 -11
  194. package/dist/sync/container-file-sync.js +6 -6
  195. package/dist/sync/file-sync.js +17 -17
  196. package/package.json +2 -2
  197. /package/dist/{chunk-WPK4ZPMG.js → chunk-UE6DNLSV.js} +0 -0
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-XBHDQK4Z.js";
7
7
  import {
8
8
  getConfig
9
- } from "./chunk-V7MTIMPB.js";
9
+ } from "./chunk-X6QIWZ33.js";
10
10
 
11
11
  // src/backends/claude/args.ts
12
12
  function buildClaudeArgs(input) {
@@ -37,7 +37,7 @@ Your custom tools are: ${toolList}. Call them by these exact names \u2014 do not
37
37
  }
38
38
  argv.push("--system-prompt", systemPrompt);
39
39
  if (input.agent.model) {
40
- argv.push("--model", input.agent.model);
40
+ argv.push("--model", input.agent.model.id);
41
41
  }
42
42
  const mcpToolNames = Array.from(tools.customToolNames).map(
43
43
  (name) => `mcp__tool-bridge__${name}`
@@ -52,10 +52,15 @@ Your custom tools are: ${toolList}. Call them by these exact names \u2014 do not
52
52
  if (input.agent.model_config?.speed === "fast") {
53
53
  argv.push("--fast");
54
54
  }
55
- if (input.agent.mcp_servers && Object.keys(input.agent.mcp_servers).length > 0) {
55
+ if (input.agent.mcp_servers && input.agent.mcp_servers.length > 0) {
56
+ const mcpRecord = {};
57
+ for (const s of input.agent.mcp_servers) {
58
+ const { name, ...rest } = s;
59
+ mcpRecord[name] = rest;
60
+ }
56
61
  argv.push(
57
62
  "--mcp-config",
58
- JSON.stringify({ mcpServers: input.agent.mcp_servers })
63
+ JSON.stringify({ mcpServers: mcpRecord })
59
64
  );
60
65
  }
61
66
  return argv;
@@ -8,14 +8,14 @@ import {
8
8
  import {
9
9
  jsonOk,
10
10
  routeWrap
11
- } from "./chunk-RH4GKU52.js";
11
+ } from "./chunk-QTXAWC5J.js";
12
12
  import {
13
13
  snapshotApiMetrics
14
14
  } from "./chunk-D2XITRN6.js";
15
15
  import {
16
16
  getDb,
17
17
  init_client
18
- } from "./chunk-6POQAFEC.js";
18
+ } from "./chunk-W3JMIUHV.js";
19
19
  import {
20
20
  badRequest
21
21
  } from "./chunk-EZYKRG4W.js";
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  piBackend
3
- } from "./chunk-5EQJOUWM.js";
3
+ } from "./chunk-NHAYKVXG.js";
4
4
  import {
5
5
  opencodeBackend
6
- } from "./chunk-MQQ44IGX.js";
6
+ } from "./chunk-KKAJC3Z2.js";
7
7
  import {
8
8
  factoryBackend
9
- } from "./chunk-2GIX4HAT.js";
9
+ } from "./chunk-L26TVIB6.js";
10
10
  import {
11
11
  geminiBackend
12
- } from "./chunk-JZL4L54R.js";
12
+ } from "./chunk-DKLHYSPW.js";
13
13
  import {
14
14
  codexBackend
15
- } from "./chunk-2I35VGHX.js";
15
+ } from "./chunk-R3QHLKJG.js";
16
16
  import {
17
17
  claudeBackend
18
- } from "./chunk-ZMNQ2YJ6.js";
18
+ } from "./chunk-PNZF7HIU.js";
19
19
 
20
20
  // src/backends/registry.ts
21
21
  var BACKENDS = {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_TENANT_ID
3
- } from "./chunk-AR2TM7CR.js";
3
+ } from "./chunk-I26QP3A3.js";
4
4
  import {
5
5
  init_ids,
6
6
  newId
@@ -13,10 +13,10 @@ import {
13
13
  import {
14
14
  getDrizzle,
15
15
  init_drizzle
16
- } from "./chunk-R5T4LJSK.js";
16
+ } from "./chunk-PZNAQBHQ.js";
17
17
  import {
18
18
  schema_exports
19
- } from "./chunk-ZMJ4EP4C.js";
19
+ } from "./chunk-ILHIHMO3.js";
20
20
 
21
21
  // src/db/environments.ts
22
22
  init_drizzle();
@@ -25,6 +25,7 @@ init_clock();
25
25
  import { eq, and, isNull, lt, gt, sql } from "drizzle-orm";
26
26
  function hydrate(row) {
27
27
  return {
28
+ type: "environment",
28
29
  id: row.id,
29
30
  name: row.name,
30
31
  description: row.description ?? null,
@@ -33,6 +34,7 @@ function hydrate(row) {
33
34
  state: row.state,
34
35
  state_message: row.state_message,
35
36
  created_at: toIso(row.created_at),
37
+ updated_at: toIso(row.updated_at),
36
38
  archived_at: row.archived_at ? toIso(row.archived_at) : null
37
39
  };
38
40
  }
@@ -48,7 +50,8 @@ function createEnvironment(input) {
48
50
  metadata_json: JSON.stringify(input.metadata ?? {}),
49
51
  tenant_id: input.tenant_id ?? DEFAULT_TENANT_ID,
50
52
  state: "preparing",
51
- created_at: now
53
+ created_at: now,
54
+ updated_at: now
52
55
  }).run();
53
56
  return getEnvironment(id);
54
57
  }
@@ -64,7 +67,8 @@ function updateEnvironment(id, updates) {
64
67
  name: newName,
65
68
  description: newDescription ?? null,
66
69
  config_json: newConfigJson,
67
- metadata_json: newMetadataJson
70
+ metadata_json: newMetadataJson,
71
+ updated_at: nowMs()
68
72
  }).where(eq(schema_exports.environments.id, id)).run();
69
73
  return getEnvironment(id);
70
74
  }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  listCredentialsWithTokens
3
- } from "./chunk-L5RW66H5.js";
3
+ } from "./chunk-HVLYE4S5.js";
4
4
  import {
5
5
  listEntries
6
- } from "./chunk-ZVXIZ2JD.js";
6
+ } from "./chunk-VP527YC5.js";
7
7
 
8
8
  // src/sessions/secrets.ts
9
9
  function loadSessionSecrets(vaultIds) {
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  getDb,
16
16
  init_client
17
- } from "./chunk-6POQAFEC.js";
17
+ } from "./chunk-W3JMIUHV.js";
18
18
 
19
19
  // src/db/credentials.ts
20
20
  init_client();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getConfig
3
- } from "./chunk-V7MTIMPB.js";
3
+ } from "./chunk-X6QIWZ33.js";
4
4
 
5
5
  // src/backends/pi/auth.ts
6
6
  function buildPiAuthEnv() {
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-23UKWXJH.js";
7
7
  import {
8
8
  recordAudit
9
- } from "./chunk-KLN6HPYM.js";
9
+ } from "./chunk-L3IACZ72.js";
10
10
  import {
11
11
  COMMUNITY_LIMITS,
12
12
  hasFeature,
@@ -15,7 +15,7 @@ import {
15
15
  import {
16
16
  jsonOk,
17
17
  routeWrap
18
- } from "./chunk-RH4GKU52.js";
18
+ } from "./chunk-QTXAWC5J.js";
19
19
  import {
20
20
  createApiKey,
21
21
  getApiKeyById,
@@ -23,14 +23,14 @@ import {
23
23
  listApiKeys,
24
24
  revokeApiKey,
25
25
  updateApiKeyPermissions
26
- } from "./chunk-USYY3L7G.js";
26
+ } from "./chunk-T3FQPTOA.js";
27
27
  import {
28
28
  listSessionsByApiKey
29
- } from "./chunk-3NK6YTA5.js";
29
+ } from "./chunk-KUWJJD6O.js";
30
30
  import {
31
31
  getDb,
32
32
  init_client
33
- } from "./chunk-6POQAFEC.js";
33
+ } from "./chunk-W3JMIUHV.js";
34
34
  import {
35
35
  badRequest,
36
36
  forbidden,
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  getDb,
12
12
  init_client
13
- } from "./chunk-6POQAFEC.js";
13
+ } from "./chunk-W3JMIUHV.js";
14
14
 
15
15
  // src/db/tenants.ts
16
16
  init_client();
@@ -70,6 +70,7 @@ import {
70
70
  UpdateEnvironmentRequestSchema,
71
71
  UpdateMemoryRequestSchema,
72
72
  UpdateSessionRequestSchema,
73
+ UpdateVaultRequestSchema,
73
74
  UpstreamKeyDeletedResponseSchema,
74
75
  UpstreamKeyListResponseSchema,
75
76
  UpstreamKeySchema,
@@ -83,7 +84,7 @@ import {
83
84
  VaultListResponseSchema,
84
85
  VaultSchema,
85
86
  WhoamiResponseSchema
86
- } from "./chunk-OXWELRJL.js";
87
+ } from "./chunk-CBPO2P4I.js";
87
88
  import {
88
89
  registry
89
90
  } from "./chunk-7346CKTF.js";
@@ -212,6 +213,44 @@ registry.registerPath({
212
213
  ...ErrorResponses
213
214
  }
214
215
  });
216
+ registry.registerPath({
217
+ method: "post",
218
+ path: "/v1/agents/{id}/archive",
219
+ tags: ["Agents"],
220
+ summary: "Archive an agent (returns the archived agent)",
221
+ description: "Archives the agent and returns the full agent object with `archived_at` set.",
222
+ security: [{ ApiKey: [] }],
223
+ request: { params: z.object({ id: z.string() }) },
224
+ responses: {
225
+ 200: {
226
+ description: "Agent archived",
227
+ content: { "application/json": { schema: AgentSchema } }
228
+ },
229
+ ...ErrorResponses
230
+ }
231
+ });
232
+ registry.registerPath({
233
+ method: "get",
234
+ path: "/v1/agents/{id}/versions",
235
+ tags: ["Agents"],
236
+ summary: "List agent versions",
237
+ description: "Returns a paginated list of all versions of this agent, ordered by version number descending.",
238
+ security: [{ ApiKey: [] }],
239
+ request: {
240
+ params: z.object({ id: z.string() }),
241
+ query: z.object({
242
+ limit: z.coerce.number().int().min(1).max(100).optional(),
243
+ page: z.string().optional().describe("Cursor for pagination (base64url-encoded version number)")
244
+ })
245
+ },
246
+ responses: {
247
+ 200: {
248
+ description: "A page of agent versions",
249
+ content: { "application/json": { schema: AgentListResponseSchema } }
250
+ },
251
+ ...ErrorResponses
252
+ }
253
+ });
215
254
  registry.registerPath({
216
255
  method: "post",
217
256
  path: "/v1/environments",
@@ -359,7 +398,8 @@ registry.registerPath({
359
398
  agent_id: z.string().optional(),
360
399
  agent_version: z.coerce.number().int().optional(),
361
400
  environment_id: z.string().optional(),
362
- status: SessionStatusSchema.optional(),
401
+ status: SessionStatusSchema.optional().describe("Filter by single status (deprecated, use statuses)"),
402
+ statuses: z.string().optional().describe("Comma-separated or repeated status filter, e.g. statuses=idle,running"),
363
403
  "created_at[gt]": z.string().optional(),
364
404
  "created_at[gte]": z.string().optional(),
365
405
  "created_at[lt]": z.string().optional(),
@@ -754,6 +794,28 @@ registry.registerPath({
754
794
  ...ErrorResponses
755
795
  }
756
796
  });
797
+ registry.registerPath({
798
+ method: "post",
799
+ path: "/v1/vaults/{id}",
800
+ tags: ["Vaults"],
801
+ summary: "Update a vault",
802
+ description: "Updates vault display_name and/or metadata.",
803
+ security: [{ ApiKey: [] }],
804
+ request: {
805
+ params: z.object({ id: z.string() }),
806
+ body: {
807
+ required: true,
808
+ content: { "application/json": { schema: UpdateVaultRequestSchema } }
809
+ }
810
+ },
811
+ responses: {
812
+ 200: {
813
+ description: "Vault updated",
814
+ content: { "application/json": { schema: VaultSchema } }
815
+ },
816
+ ...ErrorResponses
817
+ }
818
+ });
757
819
  registry.registerPath({
758
820
  method: "delete",
759
821
  path: "/v1/vaults/{id}",
@@ -769,6 +831,22 @@ registry.registerPath({
769
831
  ...ErrorResponses
770
832
  }
771
833
  });
834
+ registry.registerPath({
835
+ method: "post",
836
+ path: "/v1/vaults/{id}/archive",
837
+ tags: ["Vaults"],
838
+ summary: "Archive a vault",
839
+ description: "Archives the vault and returns the full vault object with `archived_at` set.",
840
+ security: [{ ApiKey: [] }],
841
+ request: { params: z.object({ id: z.string() }) },
842
+ responses: {
843
+ 200: {
844
+ description: "Vault archived",
845
+ content: { "application/json": { schema: VaultSchema } }
846
+ },
847
+ ...ErrorResponses
848
+ }
849
+ });
772
850
  registry.registerPath({
773
851
  method: "post",
774
852
  path: "/v1/vaults/{id}/credentials",
@@ -11,7 +11,7 @@ function buildGeminiArgs(input) {
11
11
  args.push("--resume", input.backendSessionId);
12
12
  }
13
13
  if (input.agent.model) {
14
- args.push("--model", input.agent.model);
14
+ args.push("--model", input.agent.model.id);
15
15
  }
16
16
  return args;
17
17
  }
@@ -10,10 +10,10 @@ import {
10
10
  import {
11
11
  getDrizzle,
12
12
  init_drizzle
13
- } from "./chunk-R5T4LJSK.js";
13
+ } from "./chunk-PZNAQBHQ.js";
14
14
  import {
15
15
  schema_exports
16
- } from "./chunk-ZMJ4EP4C.js";
16
+ } from "./chunk-ILHIHMO3.js";
17
17
 
18
18
  // src/db/memory.ts
19
19
  init_drizzle();
@@ -57,6 +57,8 @@ var init_schema = __esm({
57
57
  id: text("id").primaryKey(),
58
58
  current_version: integer("current_version").notNull(),
59
59
  name: text("name").notNull(),
60
+ description: text("description"),
61
+ metadata_json: text("metadata_json").notNull().default("{}"),
60
62
  // v0.4 ALTER TABLE addition:
61
63
  fallback_json: text("fallback_json"),
62
64
  // v0.5 ALTER TABLE addition:
@@ -99,6 +101,7 @@ var init_schema = __esm({
99
101
  // v0.5 ALTER TABLE addition:
100
102
  tenant_id: text("tenant_id"),
101
103
  created_at: integer("created_at").notNull(),
104
+ updated_at: integer("updated_at").notNull(),
102
105
  archived_at: integer("archived_at")
103
106
  });
104
107
  sessions = sqliteTable("sessions", {
@@ -157,12 +160,14 @@ var init_schema = __esm({
157
160
  });
158
161
  vaults = sqliteTable("vaults", {
159
162
  id: text("id").primaryKey(),
160
- agent_id: text("agent_id").notNull(),
163
+ agent_id: text("agent_id"),
161
164
  name: text("name").notNull(),
165
+ metadata_json: text("metadata_json").notNull().default("{}"),
162
166
  // v0.5 ALTER TABLE addition:
163
167
  tenant_id: text("tenant_id"),
164
168
  created_at: integer("created_at").notNull(),
165
- updated_at: integer("updated_at").notNull()
169
+ updated_at: integer("updated_at").notNull(),
170
+ archived_at: integer("archived_at")
166
171
  });
167
172
  vaultEntries = sqliteTable("vault_entries", {
168
173
  vault_id: text("vault_id").notNull(),
@@ -12,15 +12,16 @@ import {
12
12
  listMemories,
13
13
  listMemoryStores,
14
14
  updateMemory
15
- } from "./chunk-SUGSHXND.js";
15
+ } from "./chunk-IEZFRNLC.js";
16
16
  import {
17
17
  jsonOk,
18
+ paginatedOk,
18
19
  routeWrap
19
- } from "./chunk-RH4GKU52.js";
20
+ } from "./chunk-QTXAWC5J.js";
20
21
  import {
21
22
  getDb,
22
23
  init_client
23
- } from "./chunk-6POQAFEC.js";
24
+ } from "./chunk-W3JMIUHV.js";
24
25
  import {
25
26
  badRequest,
26
27
  conflict,
@@ -75,12 +76,7 @@ function handleListMemoryStores(request) {
75
76
  agent_id: agentId,
76
77
  tenantFilter: tenantFilter(auth)
77
78
  });
78
- return jsonOk({
79
- data,
80
- has_more: data.length === requestedLimit,
81
- first_id: data.length > 0 ? data[0].id : null,
82
- last_id: data.length > 0 ? data[data.length - 1].id : null
83
- });
79
+ return paginatedOk(data, requestedLimit);
84
80
  });
85
81
  }
86
82
  function handleGetMemoryStore(request, id) {
@@ -121,12 +117,7 @@ function handleListMemories(request, storeId) {
121
117
  const url = new URL(req.url);
122
118
  const requestedLimit = Number(url.searchParams.get("limit") || "100");
123
119
  const data = listMemories(storeId);
124
- return jsonOk({
125
- data,
126
- has_more: data.length === requestedLimit,
127
- first_id: data.length > 0 ? data[0].id : null,
128
- last_id: data.length > 0 ? data[data.length - 1].id : null
129
- });
120
+ return paginatedOk(data, requestedLimit);
130
121
  });
131
122
  }
132
123
  function handleGetMemory(request, storeId, memId) {
@@ -3,19 +3,19 @@ import {
3
3
  } from "./chunk-4XXQAVKE.js";
4
4
  import {
5
5
  resolveVaultSecrets
6
- } from "./chunk-5IGBMS2U.js";
6
+ } from "./chunk-T3HMVHDG.js";
7
7
  import {
8
8
  appendEvent
9
- } from "./chunk-MHBLVGRF.js";
9
+ } from "./chunk-5MERXOLJ.js";
10
10
  import {
11
11
  getSession,
12
12
  getSessionRow,
13
13
  setSessionSandbox
14
- } from "./chunk-3NK6YTA5.js";
14
+ } from "./chunk-KUWJJD6O.js";
15
15
  import {
16
16
  deleteSprite,
17
17
  listSprites
18
- } from "./chunk-FXLUSECC.js";
18
+ } from "./chunk-NKQVOAWN.js";
19
19
  import {
20
20
  allSessionSandboxes,
21
21
  countInEnv,
@@ -24,12 +24,12 @@ import {
24
24
  } from "./chunk-EFOIR7R3.js";
25
25
  import {
26
26
  resolveContainerProvider
27
- } from "./chunk-WPK4ZPMG.js";
27
+ } from "./chunk-UE6DNLSV.js";
28
28
  import {
29
29
  getEnvironment,
30
30
  getEnvironmentRow,
31
31
  listEnvironments
32
- } from "./chunk-X6IQ57SC.js";
32
+ } from "./chunk-H6OT5GUL.js";
33
33
  import {
34
34
  addWarm,
35
35
  claimWarm,
@@ -40,13 +40,13 @@ import {
40
40
  } from "./chunk-G7KUVNDY.js";
41
41
  import {
42
42
  getAgent
43
- } from "./chunk-ZTH5JRZG.js";
43
+ } from "./chunk-BCIFFAGW.js";
44
44
  import {
45
45
  resolveBackend
46
- } from "./chunk-FDBR634Z.js";
46
+ } from "./chunk-GV6GUSCP.js";
47
47
  import {
48
48
  getConfig
49
- } from "./chunk-V7MTIMPB.js";
49
+ } from "./chunk-X6QIWZ33.js";
50
50
  import {
51
51
  init_clock,
52
52
  nowMs
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-H6TQGV4L.js";
13
13
  import {
14
14
  injectMcpAuthHeaders
15
- } from "./chunk-SV2B3P6B.js";
15
+ } from "./chunk-DBFPJSOY.js";
16
16
  import {
17
17
  incrementRetry,
18
18
  resetRetry,
@@ -21,24 +21,24 @@ import {
21
21
  } from "./chunk-72BKGVBE.js";
22
22
  import {
23
23
  loadSessionSecrets
24
- } from "./chunk-TPPLYCJF.js";
24
+ } from "./chunk-HMOSAXVZ.js";
25
25
  import {
26
26
  isProxied
27
- } from "./chunk-E7DD7F7J.js";
27
+ } from "./chunk-5U5LRAFJ.js";
28
28
  import {
29
29
  acquireForFirstTurn,
30
30
  installSkills,
31
31
  provisionResources,
32
32
  wrapProviderWithSecrets
33
- } from "./chunk-N76ZVITA.js";
33
+ } from "./chunk-JFOHGHW5.js";
34
34
  import {
35
35
  BLOCKED_ENV_KEYS,
36
36
  resolveVaultSecrets
37
- } from "./chunk-5IGBMS2U.js";
37
+ } from "./chunk-T3HMVHDG.js";
38
38
  import {
39
39
  appendEvent,
40
40
  appendEventsBatch
41
- } from "./chunk-MHBLVGRF.js";
41
+ } from "./chunk-5MERXOLJ.js";
42
42
  import {
43
43
  bumpSessionStats,
44
44
  getOutcomeCriteria,
@@ -49,26 +49,26 @@ import {
49
49
  setOutcomeCriteria,
50
50
  updateSessionMutable,
51
51
  updateSessionStatus
52
- } from "./chunk-3NK6YTA5.js";
52
+ } from "./chunk-KUWJJD6O.js";
53
53
  import {
54
54
  listEvents,
55
55
  markUserEventProcessed
56
- } from "./chunk-TH7WJLZC.js";
56
+ } from "./chunk-KGBKIJPF.js";
57
57
  import {
58
58
  getBySession
59
59
  } from "./chunk-EFOIR7R3.js";
60
60
  import {
61
61
  resolveContainerProvider
62
- } from "./chunk-WPK4ZPMG.js";
62
+ } from "./chunk-UE6DNLSV.js";
63
63
  import {
64
64
  getEnvironment
65
- } from "./chunk-X6IQ57SC.js";
65
+ } from "./chunk-H6OT5GUL.js";
66
66
  import {
67
67
  getAgent
68
- } from "./chunk-ZTH5JRZG.js";
68
+ } from "./chunk-BCIFFAGW.js";
69
69
  import {
70
70
  resolveBackend
71
- } from "./chunk-FDBR634Z.js";
71
+ } from "./chunk-GV6GUSCP.js";
72
72
  import {
73
73
  PERMISSION_BRIDGE_PENDING_PATH,
74
74
  PERMISSION_BRIDGE_REQUEST_PATH,
@@ -84,7 +84,7 @@ import {
84
84
  } from "./chunk-XBHDQK4Z.js";
85
85
  import {
86
86
  getConfig
87
- } from "./chunk-V7MTIMPB.js";
87
+ } from "./chunk-X6QIWZ33.js";
88
88
  import {
89
89
  init_clock,
90
90
  nowMs
@@ -259,7 +259,7 @@ async function runTurn(sessionId, inputs, _depth = 0, parentTrace) {
259
259
  updateSessionStatus(sessionId, "running");
260
260
  const turnStartMs = nowMs();
261
261
  emit("session.status_running", {}, { at: turnStartMs });
262
- emit("span.model_request_start", { model: agent.model }, { at: turnStartMs });
262
+ emit("span.model_request_start", { model: agent.model.id }, { at: turnStartMs });
263
263
  const promptText = inputs.filter((i) => i.kind === "text").map((i) => i.text).join("\n\n");
264
264
  const toolResults = inputs.filter((i) => i.kind === "tool_result").map((i) => ({
265
265
  custom_tool_use_id: i.custom_tool_use_id,
@@ -277,7 +277,7 @@ async function runTurn(sessionId, inputs, _depth = 0, parentTrace) {
277
277
  } catch (err) {
278
278
  const msg = err instanceof ApiError ? err.message : err instanceof Error ? err.message : String(err);
279
279
  const type = err instanceof ApiError ? err.type : "server_error";
280
- emit("span.model_request_end", { model: agent.model, model_usage: null, status: "error" });
280
+ emit("span.model_request_end", { model: agent.model.id, model_usage: null, status: "error" });
281
281
  emit("session.error", { error: { type, message: msg } });
282
282
  emit("session.status_idle", { stop_reason: formatStopReason("error") });
283
283
  updateSessionStatus(sessionId, "idle", "error");
@@ -298,7 +298,7 @@ async function runTurn(sessionId, inputs, _depth = 0, parentTrace) {
298
298
  }
299
299
  }
300
300
  }
301
- console.log(`[driver] ${sessionId} executing turn (engine: ${agent.engine}, model: ${agent.model})`);
301
+ console.log(`[driver] ${sessionId} executing turn (engine: ${agent.engine}, model: ${agent.model.id})`);
302
302
  const argv = [backend.wrapperPath, ...turnBuild.argv];
303
303
  const freshSession = getSession(sessionId);
304
304
  if (freshSession?.resources && freshSession.resources.length > 0) {
@@ -324,7 +324,7 @@ async function runTurn(sessionId, inputs, _depth = 0, parentTrace) {
324
324
  delete turnBuild.env.ANTHROPIC_API_KEY;
325
325
  }
326
326
  const ollamaCloudPrefixes = ["claude-", "gpt-", "o1-", "o3-", "o4-", "codex-", "chatgpt-", "gemini-"];
327
- const isOllamaModel = !agent.model.includes("/") && !ollamaCloudPrefixes.some((p) => agent.model.startsWith(p));
327
+ const isOllamaModel = !agent.model.id.includes("/") && !ollamaCloudPrefixes.some((p) => agent.model.id.startsWith(p));
328
328
  if (isOllamaModel) {
329
329
  let ollamaHostPort;
330
330
  if (!turnBuild.env.OLLAMA_HOST) {
@@ -424,7 +424,7 @@ ${turnBuild.stdin}`;
424
424
  } catch (err) {
425
425
  runtime.inFlightRuns.delete(sessionId);
426
426
  const msg = err instanceof Error ? err.message : String(err);
427
- emit("span.model_request_end", { model: agent.model, model_usage: null, status: "error" });
427
+ emit("span.model_request_end", { model: agent.model.id, model_usage: null, status: "error" });
428
428
  emit("session.error", { error: { type: "server_error", message: `exec failed: ${msg}` } });
429
429
  emit("session.status_idle", { stop_reason: formatStopReason("error") });
430
430
  updateSessionStatus(sessionId, "idle", "error");
@@ -539,7 +539,7 @@ ${turnBuild.stdin}`;
539
539
  await retryDelay(retry.delayMs);
540
540
  return runTurn(sessionId, inputs, _depth + 1, parentTrace);
541
541
  }
542
- emit("span.model_request_end", { model: agent.model, model_usage: null, status: "error" });
542
+ emit("span.model_request_end", { model: agent.model.id, model_usage: null, status: "error" });
543
543
  const retryStatus = classified.retryable ? "exhausted" : "terminal";
544
544
  emit("session.error", { error: buildErrorPayload(classified, retryStatus) });
545
545
  emit("session.status_idle", { stop_reason: formatStopReason("error") });
@@ -556,7 +556,7 @@ ${turnBuild.stdin}`;
556
556
  if (aborted) {
557
557
  const partial = translator.getTurnResult();
558
558
  emit("span.model_request_end", {
559
- model: agent.model,
559
+ model: agent.model.id,
560
560
  model_usage: partial?.usage ?? null,
561
561
  status: "interrupted"
562
562
  });
@@ -622,7 +622,7 @@ ${turnBuild.stdin}`;
622
622
  if (serverToolResult) {
623
623
  emit(
624
624
  "span.model_request_end",
625
- { model: agent.model, model_usage: result?.usage ?? null, status: "ok" },
625
+ { model: agent.model.id, model_usage: result?.usage ?? null, status: "ok" },
626
626
  { at: now }
627
627
  );
628
628
  emit("session.status_idle", { stop_reason: formatStopReason("custom_tool_call", customToolEventIds) }, { at: now });
@@ -659,7 +659,7 @@ ${turnBuild.stdin}`;
659
659
  }
660
660
  emit(
661
661
  "span.model_request_end",
662
- { model: agent.model, model_usage: result?.usage ?? null, status: "ok" },
662
+ { model: agent.model.id, model_usage: result?.usage ?? null, status: "ok" },
663
663
  { at: now }
664
664
  );
665
665
  const finalEventIds = stopReason === "custom_tool_call" ? listEvents(sessionId, { limit: 20, order: "desc" }).filter((e) => e.type === "agent.custom_tool_use").map((e) => e.id) : void 0;
@@ -691,7 +691,7 @@ ${turnBuild.stdin}`;
691
691
  const evaluation = await runGraderEvaluation(
692
692
  criteria.rubric,
693
693
  lastAgentText,
694
- agent.model
694
+ agent.model.id
695
695
  );
696
696
  if (evaluation.usage.input_tokens || evaluation.usage.output_tokens) {
697
697
  bumpSessionStats(sessionId, {}, {