@agentstep/agent-sdk 0.4.28 → 0.4.30

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 (177) hide show
  1. package/dist/auth/middleware.js +7 -7
  2. package/dist/backends/claude/args.js +5 -5
  3. package/dist/backends/claude/index.js +7 -7
  4. package/dist/backends/claude/tool-bridge.js +3 -1
  5. package/dist/backends/codex/auth.js +5 -5
  6. package/dist/backends/codex/index.js +6 -6
  7. package/dist/backends/factory/auth.js +5 -5
  8. package/dist/backends/factory/index.js +6 -6
  9. package/dist/backends/gemini/auth.js +5 -5
  10. package/dist/backends/gemini/index.js +6 -6
  11. package/dist/backends/opencode/auth.js +5 -5
  12. package/dist/backends/opencode/index.js +6 -6
  13. package/dist/backends/pi/auth.js +5 -5
  14. package/dist/backends/pi/index.js +6 -6
  15. package/dist/backends/registry.js +18 -18
  16. package/dist/{chunk-TY3HD5I5.js → chunk-2DRBKIGQ.js} +1 -1
  17. package/dist/{chunk-ATGDKD4W.js → chunk-2JKOYBUO.js} +1 -1
  18. package/dist/{chunk-4IFVESQO.js → chunk-3KLJGU75.js} +17 -14
  19. package/dist/{chunk-ZP5VMV5O.js → chunk-46XURNM7.js} +4 -4
  20. package/dist/{chunk-P525BPB2.js → chunk-4B7PQTTS.js} +6 -6
  21. package/dist/{chunk-5GZEX4HV.js → chunk-4C7XJI2V.js} +1 -1
  22. package/dist/chunk-4FDEJHH7.js +128 -0
  23. package/dist/{chunk-R5OZHLAD.js → chunk-4PVPM2WC.js} +1 -1
  24. package/dist/{chunk-O45IQUWS.js → chunk-5NBZZZKH.js} +2 -2
  25. package/dist/{chunk-S3SKODVV.js → chunk-5QTDZQ2H.js} +4 -4
  26. package/dist/{chunk-JNHADPQ3.js → chunk-65XR7JU6.js} +11 -5
  27. package/dist/{chunk-X2CAT5MN.js → chunk-67D4I5AE.js} +1 -1
  28. package/dist/{chunk-EHCGLMPC.js → chunk-6EQZSMIZ.js} +1 -1
  29. package/dist/{chunk-HQACDTN4.js → chunk-6VENJOPG.js} +5 -5
  30. package/dist/{chunk-VHZML3D5.js → chunk-7DSZOBSQ.js} +2 -2
  31. package/dist/{chunk-VIGJQU6V.js → chunk-7GNSB22P.js} +3 -3
  32. package/dist/{chunk-4TF2EKVQ.js → chunk-7UJ2PIXJ.js} +2 -2
  33. package/dist/{chunk-NUINUAXO.js → chunk-7V277COF.js} +2 -2
  34. package/dist/{chunk-4RNCKCDV.js → chunk-AP2N4R6D.js} +1 -1
  35. package/dist/{chunk-WJUWZKRP.js → chunk-AXISFTHX.js} +2 -2
  36. package/dist/{chunk-JDELTTHV.js → chunk-BBYQMNGK.js} +1 -1
  37. package/dist/{chunk-FEHDZT7I.js → chunk-BJK4SGWG.js} +2 -2
  38. package/dist/{chunk-4WMYJM36.js → chunk-BKBC43KV.js} +1 -1
  39. package/dist/{chunk-CGPTH3JC.js → chunk-BQOFXJSK.js} +3 -3
  40. package/dist/{chunk-PF6W4L5F.js → chunk-BSVZAXLI.js} +11 -8
  41. package/dist/{chunk-UO2N4Q3V.js → chunk-CL3DUJRJ.js} +7 -4
  42. package/dist/{chunk-UZJI64HR.js → chunk-DL2BACWC.js} +12 -9
  43. package/dist/{chunk-B7L5XD24.js → chunk-DNV6JZLZ.js} +1 -1
  44. package/dist/{chunk-AU2DTTBR.js → chunk-EFCCO74P.js} +8 -5
  45. package/dist/{chunk-EF5QCTEQ.js → chunk-EFDAVLKN.js} +1 -1
  46. package/dist/{chunk-WFIMX3HG.js → chunk-EIR2TG5I.js} +1 -1
  47. package/dist/{chunk-F3M4HKEJ.js → chunk-EN3ICYTL.js} +9 -9
  48. package/dist/{chunk-Y2KDIPCT.js → chunk-F3BVYYRX.js} +5 -5
  49. package/dist/{chunk-ZMMDLKR3.js → chunk-FGQFNIRI.js} +3 -3
  50. package/dist/{chunk-DNGLD7VN.js → chunk-FIJTBRZ5.js} +1 -1
  51. package/dist/{chunk-AMWWPUSK.js → chunk-H3O7QBOQ.js} +1 -1
  52. package/dist/{chunk-AYNYP3G3.js → chunk-H62LRJJP.js} +19 -18
  53. package/dist/{chunk-FRDJNX6Z.js → chunk-H7Z4BWRI.js} +2 -2
  54. package/dist/{chunk-I44FSUBC.js → chunk-HA5FIXGQ.js} +1 -1
  55. package/dist/{chunk-NWW4246M.js → chunk-HEDK5J34.js} +1 -1
  56. package/dist/{chunk-M4CTE7EH.js → chunk-HF6HORZZ.js} +2 -2
  57. package/dist/{chunk-34BN2SJC.js → chunk-HFBC2TOG.js} +2 -2
  58. package/dist/{chunk-DO4WVWW7.js → chunk-IFXD4DH5.js} +1 -1
  59. package/dist/{chunk-ATTHVKNE.js → chunk-JN3G4Y4L.js} +4 -4
  60. package/dist/{chunk-ZQGJKPPY.js → chunk-JSKZXF5J.js} +31 -6
  61. package/dist/{chunk-Y2J7CAME.js → chunk-JYUJQHPR.js} +3 -3
  62. package/dist/{chunk-HLNTWWAZ.js → chunk-KA33M67F.js} +2 -2
  63. package/dist/{chunk-T45NOW43.js → chunk-L43UD7PK.js} +1 -1
  64. package/dist/{chunk-3QIIJADA.js → chunk-LOAFGJWC.js} +2 -2
  65. package/dist/{chunk-DWAA3F5Y.js → chunk-LR4TA74O.js} +15 -15
  66. package/dist/{chunk-MJ5J57UJ.js → chunk-M36DF445.js} +1 -1
  67. package/dist/{chunk-MHQXDTJB.js → chunk-NC4FHDIP.js} +1 -1
  68. package/dist/{chunk-NIOWKTIF.js → chunk-NT2AI5IE.js} +1 -1
  69. package/dist/{chunk-5D5P37FY.js → chunk-NZATVUV2.js} +1 -1
  70. package/dist/{chunk-ES5VD2ML.js → chunk-PFWTQ43U.js} +1 -1
  71. package/dist/{chunk-SVYLMMBI.js → chunk-QV5WI73T.js} +19 -6
  72. package/dist/{chunk-I5ZA45YL.js → chunk-QWGJS6V6.js} +4 -4
  73. package/dist/{chunk-YCXELHKG.js → chunk-REGPK5NG.js} +1 -1
  74. package/dist/{chunk-NUO56TF7.js → chunk-S5HVHCAK.js} +2 -2
  75. package/dist/{chunk-SXE7H3VK.js → chunk-SLAOS6JN.js} +1 -1
  76. package/dist/{chunk-NXRJ7Z4G.js → chunk-SW75SNDB.js} +1 -1
  77. package/dist/{chunk-JK5TPJHH.js → chunk-SXTHM67U.js} +1 -1
  78. package/dist/{chunk-NWFYV2VI.js → chunk-TRGHIMCR.js} +4 -4
  79. package/dist/{chunk-BMPB7XJH.js → chunk-TRQX5AIZ.js} +4 -4
  80. package/dist/{chunk-JEI7I3EH.js → chunk-TXUUUO5R.js} +2 -2
  81. package/dist/{chunk-P6NCA7G5.js → chunk-TZZMVXFM.js} +4 -4
  82. package/dist/{chunk-ND7BRD6B.js → chunk-UF3NB27E.js} +8 -8
  83. package/dist/{chunk-36VCC3BY.js → chunk-ULJVEN67.js} +3 -3
  84. package/dist/{chunk-UXMCHRGA.js → chunk-ULQOJ3WO.js} +2 -2
  85. package/dist/{chunk-B2JLKTBJ.js → chunk-VC25NYHW.js} +1 -1
  86. package/dist/{chunk-CCE6MVB3.js → chunk-VMILIALE.js} +18 -15
  87. package/dist/chunk-VUADJZRV.js +212 -0
  88. package/dist/{chunk-ADK2TYO4.js → chunk-WHV4YUQB.js} +1 -1
  89. package/dist/{chunk-AWHHLOWE.js → chunk-WP5EWNGJ.js} +4 -4
  90. package/dist/{chunk-HDSLSNN5.js → chunk-X2EEOO6Q.js} +5 -5
  91. package/dist/{chunk-AQXCXWAZ.js → chunk-XQEMI2MI.js} +1 -1
  92. package/dist/{chunk-OWP537VU.js → chunk-XTTHH5MF.js} +1 -1
  93. package/dist/{chunk-2BDD6OHG.js → chunk-XUNTHJIE.js} +7 -0
  94. package/dist/{chunk-BZ6HFTHU.js → chunk-YGTC5UP5.js} +1 -1
  95. package/dist/{chunk-YGAHGTVZ.js → chunk-YIOKUA23.js} +2 -2
  96. package/dist/{chunk-YY3NF45U.js → chunk-YTC6ST5T.js} +5 -5
  97. package/dist/config/index.js +4 -4
  98. package/dist/containers/client.js +5 -5
  99. package/dist/containers/exec.js +5 -5
  100. package/dist/containers/lifecycle.js +30 -30
  101. package/dist/containers/setup.js +7 -7
  102. package/dist/db/agents.js +5 -5
  103. package/dist/db/api_keys.js +4 -4
  104. package/dist/db/audit.js +3 -3
  105. package/dist/db/batch.js +9 -9
  106. package/dist/db/client.js +2 -2
  107. package/dist/db/credentials.js +3 -3
  108. package/dist/db/drizzle.js +3 -3
  109. package/dist/db/environments.js +5 -5
  110. package/dist/db/events.js +4 -4
  111. package/dist/db/files.js +4 -4
  112. package/dist/db/memory.js +4 -4
  113. package/dist/db/migrations.js +1 -1
  114. package/dist/db/proxy.js +4 -4
  115. package/dist/db/session-resources.js +4 -4
  116. package/dist/db/sessions.js +6 -6
  117. package/dist/db/sync.js +4 -4
  118. package/dist/db/tenants.js +3 -3
  119. package/dist/db/traces.js +4 -4
  120. package/dist/db/upstream_keys.js +3 -3
  121. package/dist/db/vaults.js +5 -5
  122. package/dist/handlers/agents.js +45 -45
  123. package/dist/handlers/api_keys.js +46 -46
  124. package/dist/handlers/audit.js +46 -46
  125. package/dist/handlers/batch.js +46 -46
  126. package/dist/handlers/credentials.js +46 -46
  127. package/dist/handlers/environments.js +46 -46
  128. package/dist/handlers/events.js +49 -49
  129. package/dist/handlers/files.js +46 -46
  130. package/dist/handlers/index.js +81 -81
  131. package/dist/handlers/license.js +45 -45
  132. package/dist/handlers/memory.js +46 -46
  133. package/dist/handlers/metrics.js +45 -45
  134. package/dist/handlers/models.js +46 -46
  135. package/dist/handlers/providers.js +45 -45
  136. package/dist/handlers/resources.js +45 -45
  137. package/dist/handlers/sessions.js +48 -48
  138. package/dist/handlers/settings.js +45 -45
  139. package/dist/handlers/skills-write.js +45 -45
  140. package/dist/handlers/skills.js +46 -46
  141. package/dist/handlers/stream.js +45 -45
  142. package/dist/handlers/tenants.js +46 -46
  143. package/dist/handlers/threads.js +45 -45
  144. package/dist/handlers/traces.js +46 -46
  145. package/dist/handlers/upstream_keys.js +48 -48
  146. package/dist/handlers/vaults.js +45 -45
  147. package/dist/handlers/whoami.js +45 -45
  148. package/dist/http.js +44 -44
  149. package/dist/index.js +48 -48
  150. package/dist/init.js +41 -41
  151. package/dist/lib/model-registry.js +5 -5
  152. package/dist/lib/skills-cache.js +5 -5
  153. package/dist/observability/otlp.js +11 -11
  154. package/dist/observability/redactor.js +7 -7
  155. package/dist/providers/fly.js +4 -4
  156. package/dist/providers/modal.js +4 -4
  157. package/dist/providers/registry.js +1 -1
  158. package/dist/providers/resolve-secrets.js +6 -6
  159. package/dist/providers/sprites.js +6 -6
  160. package/dist/providers/upstream-keys.js +10 -10
  161. package/dist/providers/vercel.js +4 -4
  162. package/dist/proxy/forward.js +5 -5
  163. package/dist/queue/index.js +5 -5
  164. package/dist/sessions/bus.js +9 -9
  165. package/dist/sessions/driver.js +34 -34
  166. package/dist/sessions/grader.js +4 -4
  167. package/dist/sessions/secrets.js +7 -7
  168. package/dist/sessions/sweeper.js +31 -31
  169. package/dist/sessions/threads.js +34 -34
  170. package/dist/shutdown.js +32 -32
  171. package/dist/sync/anthropic.js +9 -9
  172. package/dist/sync/container-file-sync.js +5 -5
  173. package/dist/sync/file-sync.js +16 -16
  174. package/package.json +1 -1
  175. package/dist/chunk-ALVC7G6R.js +0 -187
  176. package/dist/chunk-JLZO6TQL.js +0 -131
  177. /package/dist/{chunk-QUJNG4RA.js → chunk-C6JEPQ7T.js} +0 -0
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-XBHDQK4Z.js";
7
7
  import {
8
8
  getConfig
9
- } from "./chunk-EF5QCTEQ.js";
9
+ } from "./chunk-EFDAVLKN.js";
10
10
 
11
11
  // src/backends/claude/args.ts
12
12
  function buildClaudeArgs(input) {
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  resolveVaultSecrets
3
- } from "./chunk-DO4WVWW7.js";
3
+ } from "./chunk-IFXD4DH5.js";
4
4
  import {
5
5
  dockerProvider
6
6
  } from "./chunk-RMZRSYIJ.js";
7
7
  import {
8
8
  appendEvent
9
- } from "./chunk-BMPB7XJH.js";
9
+ } from "./chunk-TRQX5AIZ.js";
10
10
  import {
11
11
  getSession,
12
12
  getSessionRow,
13
13
  setSessionSandbox
14
- } from "./chunk-I5ZA45YL.js";
14
+ } from "./chunk-QWGJS6V6.js";
15
15
  import {
16
16
  deleteSprite,
17
17
  listSprites
18
- } from "./chunk-YCXELHKG.js";
18
+ } from "./chunk-REGPK5NG.js";
19
19
  import {
20
20
  allSessionSandboxes,
21
21
  countInEnv,
@@ -24,20 +24,20 @@ import {
24
24
  } from "./chunk-EFOIR7R3.js";
25
25
  import {
26
26
  resolveContainerProvider
27
- } from "./chunk-QUJNG4RA.js";
27
+ } from "./chunk-C6JEPQ7T.js";
28
28
  import {
29
29
  getEnvironment,
30
30
  getEnvironmentRow
31
- } from "./chunk-NUO56TF7.js";
31
+ } from "./chunk-S5HVHCAK.js";
32
32
  import {
33
33
  getAgent
34
- } from "./chunk-JEI7I3EH.js";
34
+ } from "./chunk-TXUUUO5R.js";
35
35
  import {
36
36
  resolveBackend
37
- } from "./chunk-P525BPB2.js";
37
+ } from "./chunk-4B7PQTTS.js";
38
38
  import {
39
39
  getConfig
40
- } from "./chunk-EF5QCTEQ.js";
40
+ } from "./chunk-EFDAVLKN.js";
41
41
  import {
42
42
  init_clock,
43
43
  nowMs
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  onAfterCommit
3
- } from "./chunk-BMPB7XJH.js";
3
+ } from "./chunk-TRQX5AIZ.js";
4
4
  import {
5
5
  getSessionRow
6
- } from "./chunk-I5ZA45YL.js";
6
+ } from "./chunk-QWGJS6V6.js";
7
7
  import {
8
8
  listEventsByTrace
9
- } from "./chunk-O45IQUWS.js";
9
+ } from "./chunk-5NBZZZKH.js";
10
10
  import {
11
11
  getAgent
12
- } from "./chunk-JEI7I3EH.js";
12
+ } from "./chunk-TXUUUO5R.js";
13
13
  import {
14
14
  getConfig
15
- } from "./chunk-EF5QCTEQ.js";
15
+ } from "./chunk-EFDAVLKN.js";
16
16
 
17
17
  // src/observability/otlp.ts
18
18
  import { createHash } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  forwardToAnthropic
3
- } from "./chunk-T45NOW43.js";
3
+ } from "./chunk-L43UD7PK.js";
4
4
  import {
5
5
  isAnthropicApiKey,
6
6
  isPassthroughAllowedPath
@@ -8,10 +8,10 @@ import {
8
8
  import {
9
9
  findByRawKey,
10
10
  hydratePermissions
11
- } from "./chunk-ADK2TYO4.js";
11
+ } from "./chunk-WHV4YUQB.js";
12
12
  import {
13
13
  getConfig
14
- } from "./chunk-EF5QCTEQ.js";
14
+ } from "./chunk-EFDAVLKN.js";
15
15
  import {
16
16
  unauthorized
17
17
  } from "./chunk-EZYKRG4W.js";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  buildOpencodeAuthEnv,
6
6
  validateOpencodeRuntime
7
- } from "./chunk-B2JLKTBJ.js";
7
+ } from "./chunk-VC25NYHW.js";
8
8
  import {
9
9
  buildOpencodeConfigEnv
10
10
  } from "./chunk-Z25I7DRV.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readSetting
3
- } from "./chunk-EF5QCTEQ.js";
3
+ } from "./chunk-EFDAVLKN.js";
4
4
 
5
5
  // src/lib/skills-cache.ts
6
6
  var DEFAULT_FEED_URL = "https://www.agentstep.com/v1/skills/feed";
@@ -21,24 +21,24 @@ import {
21
21
  } from "./chunk-72BKGVBE.js";
22
22
  import {
23
23
  loadSessionSecrets
24
- } from "./chunk-M4CTE7EH.js";
24
+ } from "./chunk-HF6HORZZ.js";
25
25
  import {
26
26
  isProxied
27
- } from "./chunk-NIOWKTIF.js";
27
+ } from "./chunk-NT2AI5IE.js";
28
28
  import {
29
29
  acquireForFirstTurn,
30
30
  installSkills,
31
31
  provisionResources,
32
32
  wrapProviderWithSecrets
33
- } from "./chunk-F3M4HKEJ.js";
33
+ } from "./chunk-EN3ICYTL.js";
34
34
  import {
35
35
  BLOCKED_ENV_KEYS,
36
36
  resolveVaultSecrets
37
- } from "./chunk-DO4WVWW7.js";
37
+ } from "./chunk-IFXD4DH5.js";
38
38
  import {
39
39
  appendEvent,
40
40
  appendEventsBatch
41
- } from "./chunk-BMPB7XJH.js";
41
+ } from "./chunk-TRQX5AIZ.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-I5ZA45YL.js";
52
+ } from "./chunk-QWGJS6V6.js";
53
53
  import {
54
54
  listEvents,
55
55
  markUserEventProcessed
56
- } from "./chunk-O45IQUWS.js";
56
+ } from "./chunk-5NBZZZKH.js";
57
57
  import {
58
58
  getBySession
59
59
  } from "./chunk-EFOIR7R3.js";
60
60
  import {
61
61
  resolveContainerProvider
62
- } from "./chunk-QUJNG4RA.js";
62
+ } from "./chunk-C6JEPQ7T.js";
63
63
  import {
64
64
  getEnvironment
65
- } from "./chunk-NUO56TF7.js";
65
+ } from "./chunk-S5HVHCAK.js";
66
66
  import {
67
67
  getAgent
68
- } from "./chunk-JEI7I3EH.js";
68
+ } from "./chunk-TXUUUO5R.js";
69
69
  import {
70
70
  resolveBackend
71
- } from "./chunk-P525BPB2.js";
71
+ } from "./chunk-4B7PQTTS.js";
72
72
  import {
73
73
  PERMISSION_BRIDGE_PENDING_PATH,
74
74
  PERMISSION_BRIDGE_REQUEST_PATH,
@@ -78,13 +78,13 @@ import {
78
78
  TOOL_BRIDGE_PENDING_PATH,
79
79
  TOOL_BRIDGE_REQUEST_PATH,
80
80
  TOOL_BRIDGE_RESPONSE_PATH
81
- } from "./chunk-ALVC7G6R.js";
81
+ } from "./chunk-4FDEJHH7.js";
82
82
  import {
83
83
  resolveToolset
84
84
  } from "./chunk-XBHDQK4Z.js";
85
85
  import {
86
86
  getConfig
87
- } from "./chunk-EF5QCTEQ.js";
87
+ } from "./chunk-EFDAVLKN.js";
88
88
  import {
89
89
  init_clock,
90
90
  nowMs
@@ -101,11 +101,8 @@ import {
101
101
  init_errors();
102
102
  init_clock();
103
103
  function formatStopReason(reason, eventIds) {
104
- if (reason === "custom_tool_call" && eventIds?.length) {
105
- return { type: "requires_action", event_ids: eventIds };
106
- }
107
104
  if (reason === "custom_tool_call") {
108
- return { type: "requires_action" };
105
+ return { type: "requires_action", event_ids: eventIds ?? [] };
109
106
  }
110
107
  return { type: reason };
111
108
  }
@@ -277,6 +274,9 @@ async function runTurn(sessionId, inputs, _depth = 0, parentTrace) {
277
274
  if (freshSession?.resources && freshSession.resources.length > 0) {
278
275
  turnBuild.env.RESOURCES_DIR = "/tmp/resources";
279
276
  }
277
+ if (agent.engine === "claude" && !turnBuild.env.MCP_TIMEOUT) {
278
+ turnBuild.env.MCP_TIMEOUT = "30000";
279
+ }
280
280
  const MCP_KEY_RE = /^MCP_(AUTH|HEADER)_/i;
281
281
  for (const entry of vaultEntries) {
282
282
  if (!BLOCKED_ENV_KEYS.has(entry.key) && !MCP_KEY_RE.test(entry.key)) {
@@ -813,7 +813,8 @@ async function checkToolBridgeSentinel(sessionId, sandboxName, provider, secrets
813
813
  ["cat", TOOL_BRIDGE_REQUEST_PATH],
814
814
  { secrets }
815
815
  );
816
- request = JSON.parse(result.stdout);
816
+ const clean = result.stdout.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "");
817
+ request = JSON.parse(clean);
817
818
  } catch (err) {
818
819
  console.warn(`[driver] failed to read tool bridge request for ${sessionId}:`, err);
819
820
  return;
@@ -4,11 +4,11 @@ import {
4
4
  getSources,
5
5
  getStats,
6
6
  searchSkills
7
- } from "./chunk-AMWWPUSK.js";
7
+ } from "./chunk-H3O7QBOQ.js";
8
8
  import {
9
9
  jsonOk,
10
10
  routeWrap
11
- } from "./chunk-3QIIJADA.js";
11
+ } from "./chunk-LOAFGJWC.js";
12
12
 
13
13
  // src/handlers/skills.ts
14
14
  async function handleGetSkillsCatalog(request) {
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  buildPiAuthEnv,
6
6
  validatePiRuntime
7
- } from "./chunk-TY3HD5I5.js";
7
+ } from "./chunk-2DRBKIGQ.js";
8
8
  import {
9
9
  preparePiOnSandbox
10
10
  } from "./chunk-QYSDP6V5.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getConfig
3
- } from "./chunk-EF5QCTEQ.js";
3
+ } from "./chunk-EFDAVLKN.js";
4
4
 
5
5
  // src/backends/codex/auth.ts
6
6
  function buildCodexAuthEnv() {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  listCredentialsWithTokens
3
- } from "./chunk-ZQGJKPPY.js";
3
+ } from "./chunk-JSKZXF5J.js";
4
4
  import {
5
5
  listEntries
6
- } from "./chunk-VIGJQU6V.js";
6
+ } from "./chunk-7GNSB22P.js";
7
7
 
8
8
  // src/sessions/secrets.ts
9
9
  function loadSessionSecrets(vaultIds) {
@@ -8,14 +8,14 @@ import {
8
8
  import {
9
9
  jsonOk,
10
10
  routeWrap
11
- } from "./chunk-3QIIJADA.js";
11
+ } from "./chunk-LOAFGJWC.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-5GZEX4HV.js";
18
+ } from "./chunk-4C7XJI2V.js";
19
19
  import {
20
20
  badRequest
21
21
  } from "./chunk-EZYKRG4W.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listEntries
3
- } from "./chunk-VIGJQU6V.js";
3
+ } from "./chunk-7GNSB22P.js";
4
4
 
5
5
  // src/providers/resolve-secrets.ts
6
6
  var BLOCKED_ENV_KEYS = /* @__PURE__ */ new Set([
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  disableUpstreamKey,
3
3
  selectNextUpstreamKey
4
- } from "./chunk-BZ6HFTHU.js";
4
+ } from "./chunk-YGTC5UP5.js";
5
5
  import {
6
6
  listEntries
7
- } from "./chunk-VIGJQU6V.js";
7
+ } from "./chunk-7GNSB22P.js";
8
8
  import {
9
9
  getSession
10
- } from "./chunk-I5ZA45YL.js";
10
+ } from "./chunk-QWGJS6V6.js";
11
11
  import {
12
12
  getConfig
13
- } from "./chunk-EF5QCTEQ.js";
13
+ } from "./chunk-EFDAVLKN.js";
14
14
 
15
15
  // src/providers/upstream-keys.ts
16
16
  var CONSECUTIVE_FAIL_THRESHOLD = 3;
@@ -14,20 +14,36 @@ import {
14
14
  import {
15
15
  getDb,
16
16
  init_client
17
- } from "./chunk-5GZEX4HV.js";
17
+ } from "./chunk-4C7XJI2V.js";
18
18
 
19
19
  // src/db/credentials.ts
20
20
  init_client();
21
21
  init_ids();
22
22
  init_clock();
23
23
  function hydrate(row) {
24
+ if (row.auth_type === "mcp_oauth") {
25
+ return {
26
+ type: "vault_credential",
27
+ id: row.id,
28
+ vault_id: row.vault_id,
29
+ display_name: row.display_name,
30
+ auth: {
31
+ type: "mcp_oauth",
32
+ mcp_server_url: row.mcp_server_url,
33
+ expires_at: row.expires_at
34
+ },
35
+ created_at: toIso(row.created_at),
36
+ updated_at: toIso(row.updated_at),
37
+ archived_at: null
38
+ };
39
+ }
24
40
  return {
25
41
  type: "vault_credential",
26
42
  id: row.id,
27
43
  vault_id: row.vault_id,
28
44
  display_name: row.display_name,
29
45
  auth: {
30
- type: row.auth_type,
46
+ type: "static_bearer",
31
47
  mcp_server_url: row.mcp_server_url
32
48
  },
33
49
  created_at: toIso(row.created_at),
@@ -37,13 +53,14 @@ function hydrate(row) {
37
53
  }
38
54
  function createCredential(input) {
39
55
  const db = getDb();
40
- const id = newId("vcrd");
56
+ const id = newId("cred");
41
57
  const now = nowMs();
42
58
  const encrypted = encryptValue(input.token);
59
+ const refreshEncrypted = input.refresh_config ? encryptValue(JSON.stringify(input.refresh_config)) : null;
43
60
  db.prepare(
44
- `INSERT INTO vault_credentials (id, vault_id, display_name, auth_type, auth_token_encrypted, mcp_server_url, created_at, updated_at)
45
- VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
46
- ).run(id, input.vault_id, input.display_name, input.auth_type, encrypted, input.mcp_server_url ?? null, now, now);
61
+ `INSERT INTO vault_credentials (id, vault_id, display_name, auth_type, auth_token_encrypted, mcp_server_url, expires_at, refresh_config_encrypted, created_at, updated_at)
62
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
63
+ ).run(id, input.vault_id, input.display_name, input.auth_type, encrypted, input.mcp_server_url ?? null, input.expires_at ?? null, refreshEncrypted, now, now);
47
64
  return getCredential(id);
48
65
  }
49
66
  function getCredential(id) {
@@ -93,6 +110,14 @@ function updateCredential(id, input) {
93
110
  parts.push("mcp_server_url = ?");
94
111
  args.push(input.mcp_server_url);
95
112
  }
113
+ if (input.expires_at !== void 0) {
114
+ parts.push("expires_at = ?");
115
+ args.push(input.expires_at);
116
+ }
117
+ if (input.refresh_config !== void 0) {
118
+ parts.push("refresh_config_encrypted = ?");
119
+ args.push(input.refresh_config ? encryptValue(JSON.stringify(input.refresh_config)) : null);
120
+ }
96
121
  db.prepare(`UPDATE vault_credentials SET ${parts.join(", ")} WHERE id = ?`).run(...args, id);
97
122
  return getCredential(id);
98
123
  }
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  jsonOk,
3
3
  routeWrap
4
- } from "./chunk-3QIIJADA.js";
4
+ } from "./chunk-LOAFGJWC.js";
5
5
  import {
6
6
  resolveContainerProvider
7
- } from "./chunk-QUJNG4RA.js";
7
+ } from "./chunk-C6JEPQ7T.js";
8
8
  import {
9
9
  getConfig
10
- } from "./chunk-EF5QCTEQ.js";
10
+ } from "./chunk-EFDAVLKN.js";
11
11
 
12
12
  // src/handlers/providers.ts
13
13
  var LOCAL_PROVIDERS = ["docker", "apple-container", "podman"];
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  resolveContainerProvider
3
- } from "./chunk-QUJNG4RA.js";
3
+ } from "./chunk-C6JEPQ7T.js";
4
4
  import {
5
5
  getEnvironmentRow,
6
6
  updateEnvironmentState
7
- } from "./chunk-NUO56TF7.js";
7
+ } from "./chunk-S5HVHCAK.js";
8
8
  import {
9
9
  installClaudeWrapper
10
10
  } from "./chunk-IU457W7Q.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getConfig
3
- } from "./chunk-EF5QCTEQ.js";
3
+ } from "./chunk-EFDAVLKN.js";
4
4
  import {
5
5
  ApiError
6
6
  } from "./chunk-EZYKRG4W.js";
@@ -4,13 +4,13 @@ import {
4
4
  } from "./chunk-D2XITRN6.js";
5
5
  import {
6
6
  authenticateAndIntercept
7
- } from "./chunk-ZMMDLKR3.js";
7
+ } from "./chunk-FGQFNIRI.js";
8
8
  import {
9
9
  checkAndBump
10
10
  } from "./chunk-HVUWXUUI.js";
11
11
  import {
12
12
  ensureInitialized
13
- } from "./chunk-DWAA3F5Y.js";
13
+ } from "./chunk-LR4TA74O.js";
14
14
  import {
15
15
  captureException
16
16
  } from "./chunk-3MQ2FWXS.js";
@@ -1,59 +1,59 @@
1
1
  import {
2
2
  enqueueTurn
3
- } from "./chunk-AQXCXWAZ.js";
3
+ } from "./chunk-XQEMI2MI.js";
4
4
  import {
5
5
  runTurn
6
- } from "./chunk-AYNYP3G3.js";
6
+ } from "./chunk-H62LRJJP.js";
7
7
  import {
8
8
  installOtlpExporter
9
- } from "./chunk-Y2KDIPCT.js";
9
+ } from "./chunk-F3BVYYRX.js";
10
10
  import {
11
11
  redactAppendInput
12
- } from "./chunk-UXMCHRGA.js";
12
+ } from "./chunk-ULQOJ3WO.js";
13
13
  import {
14
14
  createApiKey,
15
15
  listApiKeys
16
- } from "./chunk-ADK2TYO4.js";
16
+ } from "./chunk-WHV4YUQB.js";
17
17
  import {
18
18
  initSentry
19
19
  } from "./chunk-3MQ2FWXS.js";
20
20
  import {
21
21
  installShutdownHandlers
22
- } from "./chunk-WJUWZKRP.js";
22
+ } from "./chunk-AXISFTHX.js";
23
23
  import {
24
24
  runSweep
25
- } from "./chunk-NWFYV2VI.js";
25
+ } from "./chunk-TRGHIMCR.js";
26
26
  import {
27
27
  reconcileDockerOrphanSandboxes,
28
28
  reconcileOrphanSandboxes
29
- } from "./chunk-F3M4HKEJ.js";
29
+ } from "./chunk-EN3ICYTL.js";
30
30
  import {
31
31
  appendEvent,
32
32
  installPayloadRedactor
33
- } from "./chunk-BMPB7XJH.js";
33
+ } from "./chunk-TRQX5AIZ.js";
34
34
  import {
35
35
  setSessionSandbox
36
- } from "./chunk-I5ZA45YL.js";
36
+ } from "./chunk-QWGJS6V6.js";
37
37
  import {
38
38
  readEnvValue,
39
39
  upsertEnvLine
40
40
  } from "./chunk-YPXI7Q2M.js";
41
41
  import {
42
42
  getLastUnprocessedUserMessage
43
- } from "./chunk-O45IQUWS.js";
43
+ } from "./chunk-5NBZZZKH.js";
44
44
  import {
45
45
  getBySession,
46
46
  register
47
47
  } from "./chunk-EFOIR7R3.js";
48
48
  import {
49
49
  resolveContainerProvider
50
- } from "./chunk-QUJNG4RA.js";
50
+ } from "./chunk-C6JEPQ7T.js";
51
51
  import {
52
52
  getEnvironment
53
- } from "./chunk-NUO56TF7.js";
53
+ } from "./chunk-S5HVHCAK.js";
54
54
  import {
55
55
  getConfig
56
- } from "./chunk-EF5QCTEQ.js";
56
+ } from "./chunk-EFDAVLKN.js";
57
57
  import {
58
58
  init_clock,
59
59
  nowMs
@@ -61,7 +61,7 @@ import {
61
61
  import {
62
62
  getDb,
63
63
  init_client
64
- } from "./chunk-5GZEX4HV.js";
64
+ } from "./chunk-4C7XJI2V.js";
65
65
  import {
66
66
  getRuntime
67
67
  } from "./chunk-UYTSKFGK.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getConfig
3
- } from "./chunk-EF5QCTEQ.js";
3
+ } from "./chunk-EFDAVLKN.js";
4
4
 
5
5
  // src/backends/gemini/auth.ts
6
6
  function buildGeminiAuthEnv() {
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  getDb,
16
16
  init_client
17
- } from "./chunk-5GZEX4HV.js";
17
+ } from "./chunk-4C7XJI2V.js";
18
18
 
19
19
  // src/db/audit.ts
20
20
  init_client();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDrizzle,
3
3
  init_drizzle
4
- } from "./chunk-SXE7H3VK.js";
4
+ } from "./chunk-SLAOS6JN.js";
5
5
  import {
6
6
  schema_exports
7
7
  } from "./chunk-LHHBOQUR.js";
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  buildFactoryAuthEnv,
15
15
  validateFactoryRuntime
16
- } from "./chunk-OWP537VU.js";
16
+ } from "./chunk-XTTHH5MF.js";
17
17
  import {
18
18
  wrapPromptWithSystem
19
19
  } from "./chunk-FVBDEOTZ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  routeWrap
3
- } from "./chunk-3QIIJADA.js";
3
+ } from "./chunk-LOAFGJWC.js";
4
4
  import {
5
5
  ApiError
6
6
  } from "./chunk-EZYKRG4W.js";
@@ -12,15 +12,15 @@ import {
12
12
  listMemories,
13
13
  listMemoryStores,
14
14
  updateMemory
15
- } from "./chunk-NUINUAXO.js";
15
+ } from "./chunk-7V277COF.js";
16
16
  import {
17
17
  jsonOk,
18
18
  routeWrap
19
- } from "./chunk-3QIIJADA.js";
19
+ } from "./chunk-LOAFGJWC.js";
20
20
  import {
21
21
  getDb,
22
22
  init_client
23
- } from "./chunk-5GZEX4HV.js";
23
+ } from "./chunk-4C7XJI2V.js";
24
24
  import {
25
25
  badRequest,
26
26
  conflict,
@@ -70,11 +70,17 @@ function handleListMemoryStores(request) {
70
70
  return routeWrap(request, async ({ auth, request: req }) => {
71
71
  const url = new URL(req.url);
72
72
  const agentId = url.searchParams.get("agent_id") ?? void 0;
73
+ const requestedLimit = Number(url.searchParams.get("limit") || "100");
73
74
  const data = listMemoryStores({
74
75
  agent_id: agentId,
75
76
  tenantFilter: tenantFilter(auth)
76
77
  });
77
- return jsonOk({ data });
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
+ });
78
84
  });
79
85
  }
80
86
  function handleGetMemoryStore(request, id) {
@@ -110,10 +116,17 @@ function handleCreateMemory(request, storeId) {
110
116
  });
111
117
  }
112
118
  function handleListMemories(request, storeId) {
113
- return routeWrap(request, async ({ auth }) => {
119
+ return routeWrap(request, async ({ auth, request: req }) => {
114
120
  loadStoreForCaller(auth, storeId);
121
+ const url = new URL(req.url);
122
+ const requestedLimit = Number(url.searchParams.get("limit") || "100");
115
123
  const data = listMemories(storeId);
116
- return jsonOk({ data });
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
+ });
117
130
  });
118
131
  }
119
132
  function handleGetMemory(request, storeId, memId) {