@agentstep/agent-sdk 0.4.41 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +8 -8
  4. package/dist/backends/claude/wrapper-script.js +1 -1
  5. package/dist/backends/codex/args.js +1 -1
  6. package/dist/backends/codex/auth.js +6 -6
  7. package/dist/backends/codex/index.js +8 -8
  8. package/dist/backends/factory/args.js +1 -1
  9. package/dist/backends/factory/auth.js +6 -6
  10. package/dist/backends/factory/index.js +8 -8
  11. package/dist/backends/gemini/args.js +1 -1
  12. package/dist/backends/gemini/auth.js +6 -6
  13. package/dist/backends/gemini/index.js +8 -8
  14. package/dist/backends/opencode/args.js +1 -1
  15. package/dist/backends/opencode/auth.js +6 -6
  16. package/dist/backends/opencode/index.js +9 -9
  17. package/dist/backends/opencode/mcp.js +1 -1
  18. package/dist/backends/pi/args.js +1 -1
  19. package/dist/backends/pi/auth.js +6 -6
  20. package/dist/backends/pi/index.js +8 -8
  21. package/dist/backends/registry.js +25 -25
  22. package/dist/{chunk-L2RX552S.js → chunk-22OUZJAV.js} +3 -3
  23. package/dist/{chunk-XWWLMJXT.js → chunk-2YFS435Z.js} +6 -15
  24. package/dist/{chunk-W2NHS4IF.js → chunk-2YIMCZJK.js} +15 -19
  25. package/dist/{chunk-WCDWL6ED.js → chunk-2YZOIFVN.js} +49 -0
  26. package/dist/{chunk-2PPB644A.js → chunk-37C5BNVV.js} +1 -1
  27. package/dist/{chunk-RDGOGAQ5.js → chunk-3FLQ7KZP.js} +1 -1
  28. package/dist/{chunk-2RSL5SO7.js → chunk-3NKK4M23.js} +2 -2
  29. package/dist/{chunk-CHDQ3HIR.js → chunk-3S4CGFKJ.js} +5 -9
  30. package/dist/{chunk-H7UKW666.js → chunk-445EL6J5.js} +1 -1
  31. package/dist/{chunk-FP4E3QUS.js → chunk-4LHJJXH3.js} +2 -2
  32. package/dist/{chunk-ZFJPOQSY.js → chunk-4MKBT3KA.js} +69 -30
  33. package/dist/{chunk-ENGKR2JT.js → chunk-56XDLNEW.js} +1 -1
  34. package/dist/{chunk-Y6SFUNGO.js → chunk-57LAR6EM.js} +4 -4
  35. package/dist/{chunk-JZL4L54R.js → chunk-5M47X54D.js} +2 -2
  36. package/dist/{chunk-MHBLVGRF.js → chunk-5MERXOLJ.js} +4 -4
  37. package/dist/{chunk-E7DD7F7J.js → chunk-5U5LRAFJ.js} +2 -2
  38. package/dist/{chunk-MQQ44IGX.js → chunk-63AKPSCV.js} +3 -3
  39. package/dist/{chunk-T5VRE77P.js → chunk-6KWJASEO.js} +1 -1
  40. package/dist/{chunk-EUINGLHA.js → chunk-6RFQCFL2.js} +30 -20
  41. package/dist/{chunk-V5HWHJ4P.js → chunk-74E7GKUG.js} +1 -1
  42. package/dist/{chunk-DU7LSFQQ.js → chunk-7SY65LWY.js} +6 -9
  43. package/dist/{chunk-JCW3ZRES.js → chunk-A46RUKGA.js} +1 -1
  44. package/dist/{chunk-LZFB3HRK.js → chunk-AQB3P5ZP.js} +5 -10
  45. package/dist/{chunk-RP6WQ4IH.js → chunk-B5EY2VJC.js} +3 -3
  46. package/dist/{chunk-ZTH5JRZG.js → chunk-BCIFFAGW.js} +41 -10
  47. package/dist/{chunk-2Z2KAPUL.js → chunk-BJP5BIHE.js} +3 -3
  48. package/dist/{chunk-5EQJOUWM.js → chunk-C35ZTCBP.js} +2 -2
  49. package/dist/{chunk-OXWELRJL.js → chunk-CBPO2P4I.js} +101 -16
  50. package/dist/{chunk-HH4OXSOV.js → chunk-CE366H6Z.js} +5 -5
  51. package/dist/{chunk-C46UG6GQ.js → chunk-CKFJN5XK.js} +1 -1
  52. package/dist/{chunk-YBZJHDSE.js → chunk-COZG53R3.js} +2 -2
  53. package/dist/{chunk-SV2B3P6B.js → chunk-DBFPJSOY.js} +19 -17
  54. package/dist/{chunk-NQVRZAIX.js → chunk-DMMNAQUM.js} +2 -2
  55. package/dist/{chunk-JWH4OIBP.js → chunk-DRNZ24RF.js} +4 -4
  56. package/dist/{chunk-3FDE3BPB.js → chunk-EDUTIJAU.js} +9 -7
  57. package/dist/{chunk-5EKQBD2H.js → chunk-FCUXFLNK.js} +2 -2
  58. package/dist/{chunk-34EB622U.js → chunk-FYBHPBWY.js} +2 -2
  59. package/dist/{chunk-HOIDGDU5.js → chunk-GD3WXIHX.js} +1 -1
  60. package/dist/{chunk-6IYCBW4J.js → chunk-GIUB2OPA.js} +1 -1
  61. package/dist/{chunk-V7MTIMPB.js → chunk-GQYSSSVA.js} +3 -3
  62. package/dist/{chunk-X6IQ57SC.js → chunk-H6OT5GUL.js} +9 -5
  63. package/dist/{chunk-TPPLYCJF.js → chunk-HMOSAXVZ.js} +2 -2
  64. package/dist/{chunk-L5RW66H5.js → chunk-HVLYE4S5.js} +1 -1
  65. package/dist/{chunk-PIJKJNGB.js → chunk-HZZ6ZLKP.js} +4 -4
  66. package/dist/{chunk-AR2TM7CR.js → chunk-I26QP3A3.js} +1 -1
  67. package/dist/{chunk-D2TRWKVQ.js → chunk-I2WVMCYN.js} +80 -2
  68. package/dist/{chunk-JHGJG2Z2.js → chunk-IBYOMAZ3.js} +1 -1
  69. package/dist/{chunk-SUGSHXND.js → chunk-IEZFRNLC.js} +2 -2
  70. package/dist/{chunk-ZMJ4EP4C.js → chunk-ILHIHMO3.js} +7 -2
  71. package/dist/{chunk-FDBR634Z.js → chunk-IMPLRDOV.js} +6 -6
  72. package/dist/{chunk-ZYISLRS6.js → chunk-JWHSUEDE.js} +114 -37
  73. package/dist/{chunk-TH7WJLZC.js → chunk-KGBKIJPF.js} +3 -3
  74. package/dist/{chunk-3NK6YTA5.js → chunk-KUWJJD6O.js} +42 -8
  75. package/dist/{chunk-2I35VGHX.js → chunk-L35CBI7F.js} +2 -2
  76. package/dist/{chunk-KLN6HPYM.js → chunk-L3IACZ72.js} +1 -1
  77. package/dist/{chunk-MXOG5SAO.js → chunk-LIXSR7BG.js} +11 -14
  78. package/dist/{chunk-7GG3FEK2.js → chunk-MCWCRZM4.js} +4 -4
  79. package/dist/{chunk-V66YKIW6.js → chunk-MXMXJYN4.js} +5 -5
  80. package/dist/{chunk-GVPJL3XS.js → chunk-MZYJFU4K.js} +5 -5
  81. package/dist/{chunk-ZMNQ2YJ6.js → chunk-NBYCX6L4.js} +4 -4
  82. package/dist/{chunk-ZQXBHNEZ.js → chunk-NL4UNA53.js} +2 -2
  83. package/dist/{chunk-WQARLGBG.js → chunk-NRXTWATQ.js} +3 -3
  84. package/dist/{chunk-FXLUSECC.js → chunk-O56RNR7B.js} +1 -1
  85. package/dist/{chunk-3IV56JJW.js → chunk-P56WU3UT.js} +3 -2
  86. package/dist/{chunk-NQX7WBA4.js → chunk-PJYCPDV5.js} +14 -9
  87. package/dist/{chunk-R5T4LJSK.js → chunk-PZNAQBHQ.js} +2 -2
  88. package/dist/{chunk-32XS3Y6P.js → chunk-Q4XF3OBK.js} +8 -8
  89. package/dist/{chunk-IU457W7Q.js → chunk-QBJOYOVF.js} +2 -1
  90. package/dist/{chunk-C6AXM3M7.js → chunk-QJ6QQO6D.js} +3 -3
  91. package/dist/{chunk-2GIX4HAT.js → chunk-R6EXYBCT.js} +2 -2
  92. package/dist/{chunk-RVR6C22M.js → chunk-RT5S5KRX.js} +1 -1
  93. package/dist/{chunk-USYY3L7G.js → chunk-T3FQPTOA.js} +2 -2
  94. package/dist/{chunk-5IGBMS2U.js → chunk-T3HMVHDG.js} +1 -1
  95. package/dist/{chunk-RH4GKU52.js → chunk-T3IGOI6Z.js} +18 -3
  96. package/dist/{chunk-DAVYI5H4.js → chunk-T7BHW3CP.js} +23 -23
  97. package/dist/{chunk-QSUGIJWV.js → chunk-TG3S4RVJ.js} +4 -9
  98. package/dist/{chunk-IAF6VMPO.js → chunk-TPMZO6S2.js} +1 -1
  99. package/dist/{chunk-OGJUSGF7.js → chunk-UMRDMOB6.js} +1 -1
  100. package/dist/{chunk-KKCLTWG7.js → chunk-UMVZZQKD.js} +1 -1
  101. package/dist/{chunk-LAVHQCRP.js → chunk-UQ3LKJPM.js} +3 -3
  102. package/dist/{chunk-P26WOAA3.js → chunk-USIMPXUH.js} +1 -1
  103. package/dist/{chunk-Z25I7DRV.js → chunk-V5DH3OAC.js} +10 -5
  104. package/dist/{chunk-N3QIXC2B.js → chunk-VJWNFMMQ.js} +2 -2
  105. package/dist/{chunk-ZVXIZ2JD.js → chunk-VP527YC5.js} +35 -6
  106. package/dist/{chunk-6POQAFEC.js → chunk-W3JMIUHV.js} +1 -1
  107. package/dist/{chunk-V2R7RWVY.js → chunk-WDACZSRU.js} +1 -1
  108. package/dist/{chunk-FOOH6SCB.js → chunk-WU74DV5R.js} +2 -2
  109. package/dist/{chunk-6GP5IKXE.js → chunk-XSNJ7NT2.js} +1 -1
  110. package/dist/{chunk-S7W3KJYH.js → chunk-YYMUSVUI.js} +9 -4
  111. package/dist/{chunk-CREPPDHX.js → chunk-YZZHDZ7B.js} +1 -1
  112. package/dist/{chunk-LMNFIJ6M.js → chunk-ZWC5V2DB.js} +15 -15
  113. package/dist/{chunk-N76ZVITA.js → chunk-ZY2U24QP.js} +24 -14
  114. package/dist/config/index.js +5 -5
  115. package/dist/containers/client.js +6 -6
  116. package/dist/containers/exec.js +6 -6
  117. package/dist/containers/lifecycle.js +37 -37
  118. package/dist/containers/setup.js +9 -9
  119. package/dist/db/agents.js +8 -6
  120. package/dist/db/api_keys.js +5 -5
  121. package/dist/db/audit.js +3 -3
  122. package/dist/db/batch.js +10 -10
  123. package/dist/db/client.js +2 -2
  124. package/dist/db/credentials.js +3 -3
  125. package/dist/db/drizzle.js +4 -4
  126. package/dist/db/environments.js +6 -6
  127. package/dist/db/events.js +5 -5
  128. package/dist/db/files.js +5 -5
  129. package/dist/db/memory.js +5 -5
  130. package/dist/db/migrations.js +1 -1
  131. package/dist/db/proxy.js +5 -5
  132. package/dist/db/schema.js +1 -1
  133. package/dist/db/session-resources.js +5 -5
  134. package/dist/db/sessions.js +8 -7
  135. package/dist/db/sync.js +5 -5
  136. package/dist/db/tenants.js +3 -3
  137. package/dist/db/traces.js +5 -5
  138. package/dist/db/upstream_keys.js +3 -3
  139. package/dist/db/vaults.js +12 -8
  140. package/dist/handlers/agents.js +57 -53
  141. package/dist/handlers/api_keys.js +54 -54
  142. package/dist/handlers/audit.js +54 -54
  143. package/dist/handlers/batch.js +54 -54
  144. package/dist/handlers/credentials.js +54 -54
  145. package/dist/handlers/environments.js +54 -54
  146. package/dist/handlers/events.js +57 -57
  147. package/dist/handlers/files.js +54 -54
  148. package/dist/handlers/index.js +101 -93
  149. package/dist/handlers/license.js +53 -53
  150. package/dist/handlers/memory.js +54 -54
  151. package/dist/handlers/metrics.js +53 -53
  152. package/dist/handlers/models.js +54 -54
  153. package/dist/handlers/openapi.js +3 -3
  154. package/dist/handlers/providers.js +53 -53
  155. package/dist/handlers/resources.js +53 -53
  156. package/dist/handlers/sessions.js +56 -56
  157. package/dist/handlers/settings.js +53 -53
  158. package/dist/handlers/skills-write.js +53 -53
  159. package/dist/handlers/skills.js +54 -54
  160. package/dist/handlers/stream.js +53 -53
  161. package/dist/handlers/tenants.js +54 -54
  162. package/dist/handlers/threads.js +53 -53
  163. package/dist/handlers/traces.js +54 -54
  164. package/dist/handlers/upstream_keys.js +56 -56
  165. package/dist/handlers/vaults.js +57 -53
  166. package/dist/handlers/whoami.js +53 -53
  167. package/dist/http.js +56 -52
  168. package/dist/index.js +58 -58
  169. package/dist/init.js +49 -49
  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 +42 -42
  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 +38 -38
  191. package/dist/sessions/threads.js +42 -42
  192. package/dist/shutdown.js +39 -39
  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 +1 -1
  197. /package/dist/{chunk-WPK4ZPMG.js → chunk-JRQB3SHR.js} +0 -0
@@ -6,29 +6,29 @@ import {
6
6
  reconcileDockerOrphanSandboxes,
7
7
  reconcileOrphanSandboxes,
8
8
  releaseSession
9
- } from "./chunk-N76ZVITA.js";
9
+ } from "./chunk-ZY2U24QP.js";
10
10
  import {
11
11
  appendEvent,
12
12
  dropEmitter
13
- } from "./chunk-MHBLVGRF.js";
13
+ } from "./chunk-5MERXOLJ.js";
14
14
  import {
15
15
  archiveSession,
16
16
  getSessionRow,
17
17
  listIdleSessions,
18
18
  updateSessionStatus
19
- } from "./chunk-3NK6YTA5.js";
19
+ } from "./chunk-KUWJJD6O.js";
20
20
  import {
21
21
  resolveContainerProvider
22
- } from "./chunk-WPK4ZPMG.js";
22
+ } from "./chunk-JRQB3SHR.js";
23
23
  import {
24
24
  getEnvironment
25
- } from "./chunk-X6IQ57SC.js";
25
+ } from "./chunk-H6OT5GUL.js";
26
26
  import {
27
27
  expireWarm
28
28
  } from "./chunk-G7KUVNDY.js";
29
29
  import {
30
30
  getConfig
31
- } from "./chunk-V7MTIMPB.js";
31
+ } from "./chunk-GQYSSSVA.js";
32
32
  import {
33
33
  init_clock,
34
34
  nowMs
@@ -110,8 +110,10 @@ async function evictIdleSessions() {
110
110
  if (rt.inFlightRuns.has(sessionId)) return;
111
111
  const row = getSessionRow(sessionId);
112
112
  if (!row || row.status !== "idle" || row.archived_at != null) return;
113
+ const env = getEnvironment(row.environment_id);
114
+ const maxAge = env?.config?.idle_timeout_ms ?? cfg.sessionMaxAgeMs;
113
115
  const base = row.idle_since ?? row.created_at;
114
- if (base + cfg.sessionMaxAgeMs >= now) return;
116
+ if (base + maxAge >= now) return;
115
117
  await releaseSession(sessionId);
116
118
  appendEvent(sessionId, {
117
119
  type: "session.status_terminated",
@@ -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
  import {
18
18
  __esm,
19
19
  __export
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  markStopping
3
- } from "./chunk-3FDE3BPB.js";
3
+ } from "./chunk-EDUTIJAU.js";
4
4
  import {
5
5
  closeDb,
6
6
  init_client,
7
7
  syncDb
8
- } from "./chunk-6POQAFEC.js";
8
+ } from "./chunk-W3JMIUHV.js";
9
9
  import {
10
10
  getRuntime
11
11
  } from "./chunk-UYTSKFGK.js";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  jsonOk,
6
6
  routeWrap
7
- } from "./chunk-RH4GKU52.js";
7
+ } from "./chunk-T3IGOI6Z.js";
8
8
 
9
9
  // src/handlers/license.ts
10
10
  function handleGetLicense(request) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getConfig
3
- } from "./chunk-V7MTIMPB.js";
3
+ } from "./chunk-GQYSSSVA.js";
4
4
 
5
5
  // src/backends/codex/auth.ts
6
6
  function buildCodexAuthEnv() {
@@ -5,10 +5,10 @@ import {
5
5
  import {
6
6
  getDrizzle,
7
7
  init_drizzle
8
- } from "./chunk-R5T4LJSK.js";
8
+ } from "./chunk-PZNAQBHQ.js";
9
9
  import {
10
10
  schema_exports
11
- } from "./chunk-ZMJ4EP4C.js";
11
+ } from "./chunk-ILHIHMO3.js";
12
12
 
13
13
  // src/config/index.ts
14
14
  init_drizzle();
@@ -45,7 +45,7 @@ function loadConfig() {
45
45
  spriteTimeoutMs: num(process.env.SPRITE_TIMEOUT_MS, 3e4),
46
46
  concurrency: num(process.env.CONCURRENCY, 4),
47
47
  maxSandboxesPerEnv: num(process.env.MAX_SANDBOXES_PER_ENV, 8),
48
- sessionMaxAgeMs: num(process.env.SESSION_MAX_AGE_MS, 7 * 24 * 3600 * 1e3),
48
+ sessionMaxAgeMs: num(process.env.SESSION_MAX_AGE_MS, 3600 * 1e3),
49
49
  sweeperIntervalMs: num(process.env.SWEEPER_INTERVAL_MS, 6e4),
50
50
  otlpEndpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || process.env.OTLP_ENDPOINT || readSetting("otlp_endpoint") || void 0,
51
51
  otlpAuthorization: process.env.OTEL_EXPORTER_OTLP_HEADERS_AUTHORIZATION || process.env.OTLP_AUTHORIZATION || readSetting("otlp_authorization") || void 0,
@@ -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,16 +1,16 @@
1
1
  import {
2
2
  disableUpstreamKey,
3
3
  selectNextUpstreamKey
4
- } from "./chunk-H7UKW666.js";
4
+ } from "./chunk-445EL6J5.js";
5
5
  import {
6
6
  listEntries
7
- } from "./chunk-ZVXIZ2JD.js";
7
+ } from "./chunk-VP527YC5.js";
8
8
  import {
9
9
  getSession
10
- } from "./chunk-3NK6YTA5.js";
10
+ } from "./chunk-KUWJJD6O.js";
11
11
  import {
12
12
  getConfig
13
- } from "./chunk-V7MTIMPB.js";
13
+ } from "./chunk-GQYSSSVA.js";
14
14
 
15
15
  // src/providers/upstream-keys.ts
16
16
  var CONSECUTIVE_FAIL_THRESHOLD = 3;
@@ -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(),
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  piBackend
3
- } from "./chunk-5EQJOUWM.js";
3
+ } from "./chunk-C35ZTCBP.js";
4
4
  import {
5
5
  opencodeBackend
6
- } from "./chunk-MQQ44IGX.js";
6
+ } from "./chunk-63AKPSCV.js";
7
7
  import {
8
8
  factoryBackend
9
- } from "./chunk-2GIX4HAT.js";
9
+ } from "./chunk-R6EXYBCT.js";
10
10
  import {
11
11
  geminiBackend
12
- } from "./chunk-JZL4L54R.js";
12
+ } from "./chunk-5M47X54D.js";
13
13
  import {
14
14
  codexBackend
15
- } from "./chunk-2I35VGHX.js";
15
+ } from "./chunk-L35CBI7F.js";
16
16
  import {
17
17
  claudeBackend
18
- } from "./chunk-ZMNQ2YJ6.js";
18
+ } from "./chunk-NBYCX6L4.js";
19
19
 
20
20
  // src/backends/registry.ts
21
21
  var BACKENDS = {