@nylorun/runtime 0.26.0-beta → 0.28.0-beta

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 (379) hide show
  1. package/CHANGELOG.md +171 -0
  2. package/README.md +18 -14
  3. package/dist/adapters/execution/restate.d.ts +15 -18
  4. package/dist/adapters/execution/restate.js +31 -27
  5. package/dist/adapters/replication/pgoutput.d.ts +1 -1
  6. package/dist/adapters/replication/pgoutput.js +3 -2
  7. package/dist/adapters/sandbox/local.js +8 -5
  8. package/dist/adapters/sandbox/virtual.js +2 -2
  9. package/dist/adapters/streams/s2.d.ts +1 -1
  10. package/dist/adapters/streams/s2.js +18 -14
  11. package/dist/api/a2a/card.d.ts +4 -3
  12. package/dist/api/a2a/card.js +4 -4
  13. package/dist/api/a2a/endpoint.js +3 -4
  14. package/dist/api/a2a/protocol.js +4 -0
  15. package/dist/api/a2a/routes.d.ts +2 -6
  16. package/dist/api/a2a/routes.js +30 -25
  17. package/dist/api/ag-ui/endpoint.js +2 -3
  18. package/dist/api/ag-ui/routes.js +8 -11
  19. package/dist/api/components.d.ts +6789 -3405
  20. package/dist/api/components.js +43 -30
  21. package/dist/api/gate/keys.js +7 -4
  22. package/dist/api/gate/routes.d.ts +6 -2
  23. package/dist/api/gate/routes.js +15 -11
  24. package/dist/api/http/app.js +9 -4
  25. package/dist/api/http/body.d.ts +17 -3
  26. package/dist/api/http/body.js +35 -7
  27. package/dist/api/http/respond.js +6 -2
  28. package/dist/api/http/routes/access.js +5 -4
  29. package/dist/api/http/routes/agent-manifests.d.ts +10 -0
  30. package/dist/api/http/routes/agent-manifests.js +135 -0
  31. package/dist/api/http/routes/agents.d.ts +11 -0
  32. package/dist/api/http/routes/agents.js +418 -0
  33. package/dist/api/http/routes/artifacts.js +21 -9
  34. package/dist/api/http/routes/coverage.d.ts +4 -4
  35. package/dist/api/http/routes/coverage.js +13 -7
  36. package/dist/api/http/routes/files.d.ts +2 -1
  37. package/dist/api/http/routes/files.js +31 -5
  38. package/dist/api/http/routes/mcp.js +3 -3
  39. package/dist/api/http/routes/me.d.ts +1 -1
  40. package/dist/api/http/routes/me.js +1 -2
  41. package/dist/api/http/routes/memories.d.ts +9 -0
  42. package/dist/api/http/routes/memories.js +152 -0
  43. package/dist/api/http/routes/reads.d.ts +10 -111
  44. package/dist/api/http/routes/reads.js +51 -29
  45. package/dist/api/http/routes/sessions.js +26 -54
  46. package/dist/api/http/routes/tenant.d.ts +2 -2
  47. package/dist/api/http/routes/tenant.js +77 -24
  48. package/dist/api/http/routes/triggers.d.ts +10 -0
  49. package/dist/api/http/routes/triggers.js +180 -0
  50. package/dist/api/inbound-files.d.ts +3 -9
  51. package/dist/api/inbound-files.js +18 -24
  52. package/dist/api/openapi.js +73 -47
  53. package/dist/artifacts/disk.d.ts +10 -14
  54. package/dist/artifacts/disk.js +99 -95
  55. package/dist/artifacts/files.d.ts +13 -4
  56. package/dist/artifacts/files.js +27 -9
  57. package/dist/artifacts/folder-upload.d.ts +75 -0
  58. package/dist/artifacts/folder-upload.js +263 -0
  59. package/dist/artifacts/folders.d.ts +14 -8
  60. package/dist/artifacts/folders.js +19 -11
  61. package/dist/artifacts/links.js +7 -6
  62. package/dist/artifacts/parts.d.ts +9 -14
  63. package/dist/artifacts/parts.js +11 -9
  64. package/dist/artifacts/pipe.d.ts +15 -0
  65. package/dist/artifacts/pipe.js +71 -0
  66. package/dist/artifacts/quota.d.ts +36 -0
  67. package/dist/artifacts/quota.js +44 -0
  68. package/dist/artifacts/service.d.ts +25 -1
  69. package/dist/artifacts/service.js +72 -27
  70. package/dist/blob/fs.js +2 -1
  71. package/dist/blob/s3.d.ts +6 -2
  72. package/dist/blob/s3.js +9 -7
  73. package/dist/blob/types.d.ts +1 -1
  74. package/dist/blob/types.js +1 -1
  75. package/dist/core/flow-host.d.ts +0 -1
  76. package/dist/core/limits.d.ts +11 -35
  77. package/dist/core/limits.js +5 -73
  78. package/dist/core/sandbox-routes.js +0 -1
  79. package/dist/core/turn-manifest.d.ts +1 -2
  80. package/dist/core/turn-manifest.js +4 -28
  81. package/dist/execution/memory.d.ts +8 -5
  82. package/dist/execution/memory.js +8 -6
  83. package/dist/execution/types.d.ts +1 -6
  84. package/dist/execution/types.js +0 -5
  85. package/dist/gates/contract.d.ts +3 -2
  86. package/dist/gates/contract.js +1 -1
  87. package/dist/gates/egress-credentials.js +5 -4
  88. package/dist/gates/egress.d.ts +13 -13
  89. package/dist/gates/egress.js +19 -21
  90. package/dist/gates/fixture-model.js +13 -2
  91. package/dist/gates/handler.d.ts +1 -3
  92. package/dist/gates/handler.js +4 -3
  93. package/dist/gates/http-client.d.ts +4 -3
  94. package/dist/gates/http-client.js +5 -7
  95. package/dist/gates/http-tool.d.ts +24 -4
  96. package/dist/gates/http-tool.js +41 -13
  97. package/dist/gates/in-process.d.ts +2 -1
  98. package/dist/gates/in-process.js +17 -9
  99. package/dist/gates/inflight.d.ts +2 -2
  100. package/dist/gates/inflight.js +3 -2
  101. package/dist/gates/journal.js +5 -7
  102. package/dist/gates/mcp-handler.d.ts +4 -3
  103. package/dist/gates/mcp-handler.js +15 -5
  104. package/dist/gates/meter.js +6 -5
  105. package/dist/gates/model-gate.d.ts +11 -2
  106. package/dist/gates/policy.d.ts +34 -6
  107. package/dist/gates/policy.js +66 -18
  108. package/dist/gates/provider-gate.d.ts +22 -0
  109. package/dist/gates/provider-gate.js +30 -0
  110. package/dist/gates/tool-calls.d.ts +1 -3
  111. package/dist/gates/tool-calls.js +2 -3
  112. package/dist/gates/tool-client.d.ts +1 -1
  113. package/dist/gates/tool-client.js +5 -6
  114. package/dist/gates/tool-contract.d.ts +8 -5
  115. package/dist/gates/tool-contract.js +1 -1
  116. package/dist/gates/tool-gate.d.ts +18 -7
  117. package/dist/gates/tool-gate.js +49 -7
  118. package/dist/harness/calls.d.ts +27 -25
  119. package/dist/harness/calls.js +40 -46
  120. package/dist/harness/executors.d.ts +10 -3
  121. package/dist/harness/executors.js +53 -23
  122. package/dist/harness/main.js +2 -2
  123. package/dist/harness/pod.d.ts +2 -2
  124. package/dist/harness/pod.js +7 -6
  125. package/dist/harness/run-tokens.d.ts +4 -1
  126. package/dist/harness/run-tokens.js +6 -2
  127. package/dist/harness/service.d.ts +17 -14
  128. package/dist/harness/service.js +21 -35
  129. package/dist/harness/setup.d.ts +0 -2
  130. package/dist/harness/setup.js +21 -15
  131. package/dist/harness/ws-client.d.ts +2 -2
  132. package/dist/harness/ws-client.js +7 -5
  133. package/dist/harness/ws-port.d.ts +3 -4
  134. package/dist/harness/ws-port.js +3 -4
  135. package/dist/harness-api/artifacts.d.ts +20 -0
  136. package/dist/harness-api/artifacts.js +478 -0
  137. package/dist/harness-api/in-process.d.ts +2 -2
  138. package/dist/harness-api/in-process.js +18 -16
  139. package/dist/harness-api/record.d.ts +10 -9
  140. package/dist/harness-api/record.js +113 -157
  141. package/dist/harness-api/renew.d.ts +1 -1
  142. package/dist/harness-api/renew.js +2 -2
  143. package/dist/harness-api/server.d.ts +1 -16
  144. package/dist/harness-api/server.js +86 -73
  145. package/dist/harness-api/start.d.ts +27 -5
  146. package/dist/harness-api/start.js +102 -19
  147. package/dist/harness-api/tool-journal.d.ts +15 -10
  148. package/dist/harness-api/tool-journal.js +26 -24
  149. package/dist/harness-api/workspace.d.ts +0 -4
  150. package/dist/harness-api/workspace.js +4 -47
  151. package/dist/harness-api/ws-server.js +10 -10
  152. package/dist/host/create-host.js +2 -3
  153. package/dist/host/execution.js +2 -3
  154. package/dist/host/gates.d.ts +2 -9
  155. package/dist/host/gates.js +15 -12
  156. package/dist/host/http.d.ts +2 -4
  157. package/dist/host/http.js +5 -29
  158. package/dist/host/main.js +10 -3
  159. package/dist/host/operate.js +12 -3
  160. package/dist/host/stack-config.d.ts +11 -0
  161. package/dist/host/stack-config.js +21 -1
  162. package/dist/index.d.ts +0 -1
  163. package/dist/index.js +0 -1
  164. package/dist/infra/index.js +2 -1
  165. package/dist/infra/readiness.d.ts +0 -2
  166. package/dist/infra/readiness.js +4 -3
  167. package/dist/keys/client.d.ts +1 -0
  168. package/dist/keys/client.js +2 -3
  169. package/dist/keys/contract.d.ts +0 -2
  170. package/dist/keys/contract.js +0 -2
  171. package/dist/keys/egress-ca.d.ts +0 -2
  172. package/dist/keys/egress-ca.js +2 -3
  173. package/dist/keys/keys.d.ts +15 -4
  174. package/dist/keys/keys.js +22 -1
  175. package/dist/keys/webhooks.d.ts +25 -0
  176. package/dist/keys/webhooks.js +62 -0
  177. package/dist/keys/x509.d.ts +8 -4
  178. package/dist/keys/x509.js +14 -5
  179. package/dist/management-openapi.json +3043 -1954
  180. package/dist/mcp/connect.d.ts +35 -26
  181. package/dist/mcp/connect.js +112 -141
  182. package/dist/mcp/pool.d.ts +27 -22
  183. package/dist/mcp/pool.js +34 -48
  184. package/dist/mcp/preview.d.ts +12 -5
  185. package/dist/mcp/preview.js +43 -26
  186. package/dist/mcp/snapshot.d.ts +35 -86
  187. package/dist/mcp/snapshot.js +93 -135
  188. package/dist/memory/service.d.ts +97 -0
  189. package/dist/memory/service.js +335 -0
  190. package/dist/memory/tool.d.ts +36 -0
  191. package/dist/memory/tool.js +84 -0
  192. package/dist/model/auth-store.js +5 -3
  193. package/dist/model/capabilities.d.ts +1 -1
  194. package/dist/model/catalog.d.ts +9 -36
  195. package/dist/model/catalog.js +6 -33
  196. package/dist/model/descriptor.d.ts +51 -0
  197. package/dist/model/descriptor.js +83 -0
  198. package/dist/model/models.d.ts +0 -3
  199. package/dist/model/models.js +3 -5
  200. package/dist/model/native-blocks.js +1 -1
  201. package/dist/model/pi-model.d.ts +16 -5
  202. package/dist/model/pi-model.js +86 -105
  203. package/dist/openapi.json +13653 -9986
  204. package/dist/reads/cursor.js +3 -1
  205. package/dist/reads/types.d.ts +3 -3
  206. package/dist/record/agent.d.ts +27 -0
  207. package/dist/record/agent.js +46 -0
  208. package/dist/record/append.d.ts +34 -2
  209. package/dist/record/append.js +50 -1
  210. package/dist/record/index.d.ts +2 -2
  211. package/dist/record/index.js +2 -2
  212. package/dist/redact.d.ts +1 -1
  213. package/dist/redact.js +3 -2
  214. package/dist/sandbox/egress-token.d.ts +3 -3
  215. package/dist/sandbox/egress-token.js +3 -3
  216. package/dist/sandbox/join.js +8 -7
  217. package/dist/sandbox/manager.d.ts +41 -41
  218. package/dist/sandbox/manager.js +112 -44
  219. package/dist/sandbox/placement.d.ts +2 -2
  220. package/dist/sandbox/placement.js +7 -10
  221. package/dist/sandbox/pods/client.d.ts +1 -10
  222. package/dist/sandbox/pods/client.js +8 -4
  223. package/dist/sandbox/pods/lifecycle.d.ts +25 -17
  224. package/dist/sandbox/pods/lifecycle.js +51 -29
  225. package/dist/sandbox/pods/network-gate.d.ts +4 -5
  226. package/dist/sandbox/pods/network-gate.js +7 -7
  227. package/dist/sandbox/pods/reconcile.js +14 -3
  228. package/dist/sandbox/pods/spec.js +8 -5
  229. package/dist/sandbox/policy.d.ts +7 -1
  230. package/dist/sandbox/policy.js +10 -3
  231. package/dist/sandbox/resolve.d.ts +11 -6
  232. package/dist/sandbox/resolve.js +19 -9
  233. package/dist/sandbox/setup.d.ts +6 -2
  234. package/dist/sandbox/setup.js +47 -14
  235. package/dist/sandbox/share.d.ts +5 -14
  236. package/dist/sandbox/share.js +5 -34
  237. package/dist/sandbox/skills.d.ts +7 -13
  238. package/dist/sandbox/skills.js +16 -31
  239. package/dist/sandbox/tenant-config.d.ts +2 -2
  240. package/dist/sandbox/tenant-config.js +4 -3
  241. package/dist/sandbox/tools.d.ts +7 -1
  242. package/dist/sandbox/tools.js +26 -26
  243. package/dist/sandbox/types.d.ts +10 -3
  244. package/dist/sandbox/types.js +9 -0
  245. package/dist/store/postgres/connect.d.ts +6 -5
  246. package/dist/store/postgres/connect.js +14 -11
  247. package/dist/store/postgres/control.js +13 -13
  248. package/dist/store/postgres/drizzle/0028_artifact_write_keys.sql +2 -0
  249. package/dist/store/postgres/drizzle/0029_protocol_15.sql +11 -0
  250. package/dist/store/postgres/drizzle/0030_protocol_15_runtime_block.sql +11 -0
  251. package/dist/store/postgres/drizzle/0031_protocol_15_mcp_snapshot.sql +8 -0
  252. package/dist/store/postgres/drizzle/0032_agents.sql +54 -0
  253. package/dist/store/postgres/drizzle/0033_agent_versions.sql +7 -0
  254. package/dist/store/postgres/drizzle/0034_protocol_17_session_queue.sql +13 -0
  255. package/dist/store/postgres/drizzle/0035_t4_triggers.sql +41 -0
  256. package/dist/store/postgres/drizzle/0036_t5_memories.sql +30 -0
  257. package/dist/store/postgres/drizzle/meta/_journal.json +63 -0
  258. package/dist/store/postgres/reads.js +17 -82
  259. package/dist/store/postgres/record-writer.d.ts +4 -4
  260. package/dist/store/postgres/record-writer.js +9 -9
  261. package/dist/store/postgres/schema.d.ts +1382 -151
  262. package/dist/store/postgres/schema.js +191 -37
  263. package/dist/store/postgres/store.js +384 -105
  264. package/dist/store/postgres/tenant.js +1 -2
  265. package/dist/store/types.d.ts +172 -57
  266. package/dist/store/types.js +0 -1
  267. package/dist/streams/relay/core.d.ts +3 -3
  268. package/dist/streams/relay/core.js +9 -10
  269. package/dist/tenant/advance.js +41 -39
  270. package/dist/tenant/agent-manifests.d.ts +72 -0
  271. package/dist/tenant/agent-manifests.js +359 -0
  272. package/dist/tenant/agent-versions.d.ts +126 -0
  273. package/dist/tenant/agent-versions.js +389 -0
  274. package/dist/tenant/agents.d.ts +230 -0
  275. package/dist/tenant/{environments.js → agents.js} +493 -328
  276. package/dist/tenant/auth.d.ts +1 -1
  277. package/dist/tenant/auth.js +3 -3
  278. package/dist/tenant/commands.d.ts +63 -2
  279. package/dist/tenant/commands.js +240 -90
  280. package/dist/tenant/context.d.ts +57 -33
  281. package/dist/tenant/context.js +6 -2
  282. package/dist/tenant/definition-files.d.ts +25 -4
  283. package/dist/tenant/definition-files.js +85 -47
  284. package/dist/tenant/effects.js +15 -51
  285. package/dist/tenant/ephemeral.js +2 -1
  286. package/dist/tenant/history.d.ts +1 -1
  287. package/dist/tenant/history.js +1 -1
  288. package/dist/tenant/host-token.d.ts +3 -3
  289. package/dist/tenant/host-token.js +11 -10
  290. package/dist/tenant/http.d.ts +5 -8
  291. package/dist/tenant/http.js +9 -0
  292. package/dist/tenant/identity-file.d.ts +29 -6
  293. package/dist/tenant/identity-file.js +45 -15
  294. package/dist/tenant/issuers.d.ts +5 -5
  295. package/dist/tenant/issuers.js +34 -26
  296. package/dist/tenant/jwt.d.ts +8 -2
  297. package/dist/tenant/jwt.js +10 -2
  298. package/dist/tenant/limits.d.ts +87 -0
  299. package/dist/tenant/limits.js +172 -0
  300. package/dist/tenant/memories.d.ts +38 -0
  301. package/dist/tenant/memories.js +119 -0
  302. package/dist/tenant/module.d.ts +4 -1
  303. package/dist/tenant/module.js +9 -8
  304. package/dist/tenant/outbound.d.ts +11 -14
  305. package/dist/tenant/outbound.js +10 -15
  306. package/dist/tenant/reset.js +2 -2
  307. package/dist/tenant/run-grants.d.ts +6 -0
  308. package/dist/tenant/run-grants.js +7 -2
  309. package/dist/tenant/run-token.d.ts +0 -4
  310. package/dist/tenant/run-token.js +6 -11
  311. package/dist/tenant/runtime-limits.d.ts +24 -0
  312. package/dist/tenant/runtime-limits.js +27 -0
  313. package/dist/tenant/runtime.d.ts +1 -1
  314. package/dist/tenant/runtime.js +38 -43
  315. package/dist/tenant/session-streams.js +7 -6
  316. package/dist/tenant/session.d.ts +1 -1
  317. package/dist/tenant/session.js +1 -1
  318. package/dist/tenant/sessions.d.ts +28 -45
  319. package/dist/tenant/sessions.js +89 -209
  320. package/dist/tenant/signing-keys.d.ts +1 -1
  321. package/dist/tenant/signing-keys.js +5 -6
  322. package/dist/tenant/status.js +10 -10
  323. package/dist/tenant/streams.js +18 -20
  324. package/dist/tenant/sweep.d.ts +1 -21
  325. package/dist/tenant/sweep.js +51 -51
  326. package/dist/tenant/transcript.d.ts +70 -23
  327. package/dist/tenant/transcript.js +28 -22
  328. package/dist/tenant/triggers.d.ts +143 -0
  329. package/dist/tenant/triggers.js +715 -0
  330. package/dist/tenant/turn-timing.d.ts +11 -1
  331. package/dist/tenant/turn-timing.js +3 -1
  332. package/dist/tenant/types.d.ts +9 -14
  333. package/dist/tenant/worker.d.ts +4 -10
  334. package/dist/tenant/worker.js +10 -14
  335. package/dist/traces/ids.js +5 -1
  336. package/dist/traces/map.d.ts +10 -7
  337. package/dist/traces/map.js +16 -12
  338. package/dist/traces/otlp.d.ts +3 -3
  339. package/dist/traces/otlp.js +5 -3
  340. package/dist/traces/projector.d.ts +9 -4
  341. package/dist/traces/projector.js +13 -7
  342. package/dist/traces/read.js +6 -1
  343. package/dist/tuning.d.ts +390 -0
  344. package/dist/tuning.js +677 -0
  345. package/dist/vault/headers.js +4 -2
  346. package/dist/vault/service.d.ts +13 -8
  347. package/dist/vault/service.js +61 -17
  348. package/dist/version.d.ts +1 -1
  349. package/dist/version.js +1 -1
  350. package/package.json +13 -12
  351. package/dist/api/http/routes/environment-manifests.d.ts +0 -9
  352. package/dist/api/http/routes/environment-manifests.js +0 -118
  353. package/dist/api/http/routes/environments.d.ts +0 -11
  354. package/dist/api/http/routes/environments.js +0 -332
  355. package/dist/artifacts/export.d.ts +0 -8
  356. package/dist/artifacts/export.js +0 -204
  357. package/dist/artifacts/media-types.d.ts +0 -30
  358. package/dist/artifacts/media-types.js +0 -137
  359. package/dist/artifacts/workspace.d.ts +0 -60
  360. package/dist/artifacts/workspace.js +0 -45
  361. package/dist/media.d.ts +0 -10
  362. package/dist/media.js +0 -58
  363. package/dist/record/environment.d.ts +0 -25
  364. package/dist/record/environment.js +0 -44
  365. package/dist/sandbox/runtime-tools.d.ts +0 -9
  366. package/dist/sandbox/runtime-tools.js +0 -16
  367. package/dist/sandbox/session-sandbox.d.ts +0 -16
  368. package/dist/sandbox/session-sandbox.js +0 -77
  369. package/dist/tenant/artifact-tool.d.ts +0 -13
  370. package/dist/tenant/artifact-tool.js +0 -243
  371. package/dist/tenant/environment-manifests.d.ts +0 -57
  372. package/dist/tenant/environment-manifests.js +0 -200
  373. package/dist/tenant/environments.d.ts +0 -174
  374. package/dist/tenant/skill-tool.d.ts +0 -20
  375. package/dist/tenant/skill-tool.js +0 -67
  376. package/dist/tenant/tool-results.d.ts +0 -57
  377. package/dist/tenant/tool-results.js +0 -298
  378. package/dist/tenant/tool-search.d.ts +0 -39
  379. package/dist/tenant/tool-search.js +0 -103
@@ -4,6 +4,7 @@
4
4
  * Runtime sets itself, so a credential can never replace them.
5
5
  */
6
6
  import { VaultError } from "./error.js";
7
+ import { hostTuning } from "../tuning.js";
7
8
  /** Headers the MCP transport and the HTTP tool call own. */
8
9
  const RESERVED_HEADERS = new Set([
9
10
  "host",
@@ -25,13 +26,14 @@ const RESERVED_HEADERS = new Set([
25
26
  export function credentialSecrets(headers, identity) {
26
27
  const skip = identity?.header.toLowerCase();
27
28
  const secrets = new Set();
29
+ const least = hostTuning().harness.scrubMinChars;
28
30
  for (const [name, value] of Object.entries(headers)) {
29
31
  if (name.toLowerCase() === skip)
30
32
  continue;
31
- if (value.length >= 8)
33
+ if (value.length >= least)
32
34
  secrets.add(value);
33
35
  const bearer = /^bearer\s+(\S+)\s*$/iu.exec(value)?.[1];
34
- if (bearer !== undefined && bearer.length >= 8)
36
+ if (bearer !== undefined && bearer.length >= least)
35
37
  secrets.add(bearer);
36
38
  }
37
39
  return [...secrets];
@@ -1,4 +1,4 @@
1
- import type { CredentialCoverage, CredentialCoverageRequest, CredentialIdentity, EnvironmentSecretView, HostModelProviderInfo, HostModelView, PutEnvironmentSecretRequest, PutHostModelRequest, CustomModelSettings, ModelInput, SelectHostModelRequest } from "@nylorun/core/contracts";
1
+ import type { CredentialCoverage, CredentialCoverageRequest, CredentialIdentity, EnvironmentSecretSlot, AgentSecretView, HostModelProviderInfo, HostModelView, PutAgentSecretRequest, PutHostModelRequest, CustomModelSettings, ModelInput, SelectHostModelRequest } from "@nylorun/core/contracts";
2
2
  import type { AgentManifest, WorkflowManifest } from "@nylorun/core/define";
3
3
  import type { SessionStore, Tx, VaultCredentialRow } from "../store/types.js";
4
4
  export declare const HOST_VAULT_ID = "host";
@@ -101,16 +101,16 @@ export declare class VaultService {
101
101
  dropped: string[];
102
102
  }>;
103
103
  /**
104
- * `PUT /v1/environments/{id}/secrets/{name}`: creates or replaces one credential. The same
104
+ * `PUT /v1/agents/{id}/secrets/{name}`: creates or replaces one credential. The same
105
105
  * name and type keeps the credential's id and re-seals its value and binding; another type
106
106
  * replaces it. Refused (`409 credential_conflict`) when another credential of the vault is
107
107
  * bound to one of its hosts or to its URL. Runs under the Environment row's lock, which also
108
108
  * orders it with session opens and deletes, and counts as the Environment's use.
109
109
  */
110
- putEnvironmentSecret(environmentId: string, name: string, body: PutEnvironmentSecretRequest, actor: string): Promise<EnvironmentSecretView>;
110
+ putEnvironmentSecret(environmentId: string, name: string, body: PutAgentSecretRequest, actor: string): Promise<AgentSecretView>;
111
111
  /** The Environment's secrets: names, types and bindings, never values. */
112
- listEnvironmentSecrets(environmentId: string): Promise<EnvironmentSecretView[]>;
113
- getEnvironmentSecret(environmentId: string, name: string): Promise<EnvironmentSecretView>;
112
+ listEnvironmentSecrets(environmentId: string): Promise<AgentSecretView[]>;
113
+ getEnvironmentSecret(environmentId: string, name: string): Promise<AgentSecretView>;
114
114
  deleteEnvironmentSecret(environmentId: string, name: string, actor: string): Promise<{
115
115
  id: string;
116
116
  }>;
@@ -154,9 +154,9 @@ export declare class VaultService {
154
154
  url: string;
155
155
  }): Promise<AuthorizeResult>;
156
156
  /**
157
- * What a session that names `request.environmentId` would send for each URL `manifest` names
158
- * (`credentialNeeds`), decided as `authorize` decides a call: the credential of the
159
- * Environment's vault bound to the URL. Reads no secret, writes no audit row.
157
+ * What a session on Agent `request.agentId` would send for each URL `manifest` (its manifest
158
+ * version's loop manifest) names (`credentialNeeds`), decided as `authorize` decides a call:
159
+ * the credential of the Agent's vault bound to the URL. Reads no secret, writes no audit row.
160
160
  */
161
161
  coverage(manifest: AgentManifest | WorkflowManifest, request: CredentialCoverageRequest): Promise<CredentialCoverage>;
162
162
  getHostModel(): Promise<HostModelView>;
@@ -204,4 +204,9 @@ type HostSecretPayload = {
204
204
  };
205
205
  export declare function modelBinding(row: VaultCredentialRow): ModelBinding;
206
206
  export declare function hostModelAad(provider: string, model: string): Buffer;
207
+ /**
208
+ * Whether the credential in `row` fills secret slot `slot` (D64): of the slot's type, with its
209
+ * binding (the hosts and header of an `environment_secret`, the URL of a `bearer` or `headers`).
210
+ */
211
+ export declare function slotHolds(slot: EnvironmentSecretSlot, row: Pick<VaultCredentialRow, "type" | "bindingJson">): boolean;
207
212
  export {};
@@ -18,11 +18,11 @@
18
18
  * sealEnvironmentSecretCopies(from, vaultId, slots | null): Promise<SealedSecretCopies>
19
19
  * insertEnvironmentSecretCopies(t: Tx, vaultId, from, actor, sealed): Promise<{ copied; dropped }>
20
20
  *
21
- * // Its secrets (`/v1/environments/{id}/secrets`): each opens its own transaction and writes its
21
+ * // Its secrets (`/v1/agents/{id}/secrets`): each opens its own transaction and writes its
22
22
  * // audit rows in it. A put needs the vault key, so callers reach it through `Keys`.
23
- * putEnvironmentSecret(environmentId, name, body: PutEnvironmentSecretRequest, actor): Promise<EnvironmentSecretView>
24
- * listEnvironmentSecrets(environmentId): Promise<EnvironmentSecretView[]>
25
- * getEnvironmentSecret(environmentId, name): Promise<EnvironmentSecretView>
23
+ * putEnvironmentSecret(environmentId, name, body: PutAgentSecretRequest, actor): Promise<AgentSecretView>
24
+ * listEnvironmentSecrets(environmentId): Promise<AgentSecretView[]>
25
+ * getEnvironmentSecret(environmentId, name): Promise<AgentSecretView>
26
26
  * deleteEnvironmentSecret(environmentId, name, actor): Promise<{ id: string }>
27
27
  *
28
28
  * // The shell's variables of a session's sandbox, in the caller's transaction (R2c).
@@ -231,7 +231,7 @@ export class VaultService {
231
231
  }
232
232
  // --- an Environment's secrets ----------------------------------------------------
233
233
  /**
234
- * `PUT /v1/environments/{id}/secrets/{name}`: creates or replaces one credential. The same
234
+ * `PUT /v1/agents/{id}/secrets/{name}`: creates or replaces one credential. The same
235
235
  * name and type keeps the credential's id and re-seals its value and binding; another type
236
236
  * replaces it. Refused (`409 credential_conflict`) when another credential of the vault is
237
237
  * bound to one of its hosts or to its URL. Runs under the Environment row's lock, which also
@@ -333,9 +333,12 @@ export class VaultService {
333
333
  if (!vault)
334
334
  return {};
335
335
  const environment = {};
336
+ const live = await liveFilter(t, environmentId);
336
337
  for (const row of await t.credentialsForVault(vault.id)) {
337
338
  if (row.type !== "environment_secret" && row.type !== "environment_variable")
338
339
  continue;
340
+ if (!live(row))
341
+ continue;
339
342
  const binding = JSON.parse(row.bindingJson);
340
343
  if (row.type === "environment_secret")
341
344
  environment[binding.secretName] = ENVIRONMENT_SECRET_SENTINEL;
@@ -398,8 +401,10 @@ export class VaultService {
398
401
  });
399
402
  return { result: { status: "refused", url, credentialIds: [], reason: "vault_missing" } };
400
403
  }
404
+ const live = await liveFilter(t, environmentId);
401
405
  const matches = (await t.credentialsForVault(vault.id))
402
406
  .filter(isUserCredential)
407
+ .filter(live)
403
408
  .filter((row) => bindingUrl(row) === url)
404
409
  .sort((a, b) => a.id.localeCompare(b.id));
405
410
  if (matches.length === 0)
@@ -466,18 +471,19 @@ export class VaultService {
466
471
  }
467
472
  // --- coverage --------------------------------------------------------------------
468
473
  /**
469
- * What a session that names `request.environmentId` would send for each URL `manifest` names
470
- * (`credentialNeeds`), decided as `authorize` decides a call: the credential of the
471
- * Environment's vault bound to the URL. Reads no secret, writes no audit row.
474
+ * What a session on Agent `request.agentId` would send for each URL `manifest` (its manifest
475
+ * version's loop manifest) names (`credentialNeeds`), decided as `authorize` decides a call:
476
+ * the credential of the Agent's vault bound to the URL. Reads no secret, writes no audit row.
472
477
  */
473
478
  async coverage(manifest, request) {
474
- const environmentId = request.environmentId;
479
+ const environmentId = request.agentId;
475
480
  return this.store.tx(async (t) => {
476
481
  const credentials = [];
477
- if (environmentId !== undefined) {
482
+ {
478
483
  const vault = await this.environmentVault(t, environmentId);
484
+ const live = await liveFilter(t, environmentId);
479
485
  for (const row of await t.credentialsForVault(vault.id))
480
- if (isUserCredential(row))
486
+ if (isUserCredential(row) && live(row))
481
487
  credentials.push({ row, url: bindingUrl(row) });
482
488
  }
483
489
  const entries = credentialNeeds(manifest).map((need) => {
@@ -495,7 +501,6 @@ export class VaultService {
495
501
  });
496
502
  return {
497
503
  agentId: request.agentId,
498
- environmentId: environmentId ?? null,
499
504
  complete: entries.every((entry) => entry.status === "covered"),
500
505
  entries,
501
506
  };
@@ -634,7 +639,7 @@ export class VaultService {
634
639
  ? await t.vaultOfEnvironment(environmentId)
635
640
  : undefined;
636
641
  if (!vault)
637
- throw new VaultError(404, "Environment not found");
642
+ throw new VaultError(404, "Agent not found");
638
643
  return vault;
639
644
  }
640
645
  async ensureHostVault(t) {
@@ -749,18 +754,18 @@ function bindingUrl(row) {
749
754
  /** Where a credential is, for coverage: never its value. */
750
755
  function coverageCredential(environmentId, row) {
751
756
  const via = JSON.parse(row.bindingJson).via;
752
- return { environmentId, name: row.name, ...(via === undefined ? {} : { via }) };
757
+ return { agentId: environmentId, name: row.name, ...(via === undefined ? {} : { via }) };
753
758
  }
754
759
  /** One coverage entry, with the sentence that says what the session would do. */
755
760
  function coverageEntry(need, url, credential, environmentId, invalid) {
756
761
  const required = need.kind === "http";
757
762
  const where = environmentId === undefined
758
- ? "Without an Environment, no credential is sent"
759
- : `Environment ${environmentId} holds no credential for this URL`;
763
+ ? "Without an Agent, no credential is sent"
764
+ : `Agent ${environmentId} holds no credential for this URL`;
760
765
  const message = invalid !== undefined
761
766
  ? `No credential can be bound to this URL (${invalid}).`
762
767
  : credential !== undefined
763
- ? `Sends '${credential.name}' from Environment ${credential.environmentId}${credential.via ? ` through ${credential.via}` : ""}.`
768
+ ? `Sends '${credential.name}' from Agent ${credential.agentId}${credential.via ? ` through ${credential.via}` : ""}.`
764
769
  : required
765
770
  ? `${where}: each call fails with http.credential.`
766
771
  : `${where}: the server is called without one, which only a public server accepts.`;
@@ -1027,6 +1032,45 @@ async function environmentSecretsFor(t, environmentId, host) {
1027
1032
  const vault = await t.vaultOfEnvironment(environmentId);
1028
1033
  if (!vault)
1029
1034
  return [];
1035
+ const live = await liveFilter(t, environmentId);
1030
1036
  return (await t.credentialsForVault(vault.id)).filter((row) => row.type === "environment_secret" &&
1037
+ live(row) &&
1031
1038
  (credentialBinding(row).allowedHosts ?? []).includes(lower));
1032
1039
  }
1040
+ /**
1041
+ * Whether the credential in `row` fills secret slot `slot` (D64): of the slot's type, with its
1042
+ * binding (the hosts and header of an `environment_secret`, the URL of a `bearer` or `headers`).
1043
+ */
1044
+ export function slotHolds(slot, row) {
1045
+ if (row.type !== slot.type)
1046
+ return false;
1047
+ const binding = JSON.parse(row.bindingJson);
1048
+ if (slot.type === "environment_variable")
1049
+ return true;
1050
+ if (slot.type === "environment_secret") {
1051
+ const hosts = (list) => canonical([...(list ?? [])].map((host) => host.toLowerCase()).sort());
1052
+ const inject = slot.inject ? { header: slot.inject.header, format: slot.inject.format } : null;
1053
+ return hosts(slot.allowedHosts) === hosts(binding.allowedHosts) && canonical(inject) === canonical(binding.inject ?? null);
1054
+ }
1055
+ try {
1056
+ return normalizeVaultUrl(slot.url) === binding.url;
1057
+ }
1058
+ catch {
1059
+ return false;
1060
+ }
1061
+ }
1062
+ /**
1063
+ * Which of Agent `environmentId`'s credentials are live (track T3, D73): with secret slots in the
1064
+ * runtime it applies, only those that fill a slot of the name (`slotHolds`). Another stays in the
1065
+ * vault, dormant: a slot the version dropped, or one whose binding changed until it gets a value
1066
+ * again. Without slots, every one.
1067
+ */
1068
+ async function liveFilter(t, environmentId) {
1069
+ const slots = (await t.environment(environmentId))?.applied.secrets;
1070
+ if (slots === undefined)
1071
+ return () => true;
1072
+ return (row) => {
1073
+ const slot = slots[row.name];
1074
+ return slot !== undefined && slotHolds(slot, row);
1075
+ };
1076
+ }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const RUNTIME_VERSION = "0.26.0-beta";
1
+ export declare const RUNTIME_VERSION = "0.28.0-beta";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // Kept in step with package.json by runtime/server/scripts/check-package.mjs, which runs in npm run check.
2
2
  // release:prepare also rewrites this when it bumps @nylorun/runtime.
3
- export const RUNTIME_VERSION = "0.26.0-beta";
3
+ export const RUNTIME_VERSION = "0.28.0-beta";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/runtime",
3
- "version": "0.26.0-beta",
3
+ "version": "0.28.0-beta",
4
4
  "description": "Nylorun Runtime: the agent execution Host on Postgres, Restate and S2, and model providers.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -61,17 +61,18 @@
61
61
  "dependencies": {
62
62
  "@ag-ui/core": "~1.0.2",
63
63
  "@asteasolutions/zod-to-openapi": "^9.1.0",
64
- "@earendil-works/pi-ai": "0.99.1",
65
- "@hono/node-server": "^2.1.3",
64
+ "@earendil-works/pi-ai": "1.2.0",
65
+ "@hono/node-server": "^2.1.5",
66
66
  "@hono/zod-openapi": "^1.6.3",
67
67
  "@modelcontextprotocol/sdk": "^1.32.1",
68
- "@nylorun/core": "0.22.0-beta",
69
- "@nylorun/harness": "0.27.1-beta",
70
- "@restatedev/restate-sdk": "1.17.2",
71
- "@restatedev/restate-sdk-clients": "1.17.2",
68
+ "@nylorun/core": "0.24.0-beta",
69
+ "@nylorun/harness": "0.29.0-beta",
70
+ "@restatedev/restate-sdk": "1.17.3",
71
+ "@restatedev/restate-sdk-clients": "1.17.3",
72
72
  "@s2-dev/streamstore": "0.28.0",
73
73
  "aws4fetch": "1.0.20",
74
- "drizzle-orm": "^0.45.3",
74
+ "croner": "^9.1.0",
75
+ "drizzle-orm": "^0.45.4",
75
76
  "hono": "^4.13.13",
76
77
  "jose": "^6.2.12",
77
78
  "just-bash": "3.6.0",
@@ -80,18 +81,18 @@
80
81
  "postgres": "^3.4.9",
81
82
  "ws": "^8.22.0",
82
83
  "yaml": "^2.9.1",
83
- "zod": "^4.6.5"
84
+ "zod": "^4.6.7"
84
85
  },
85
86
  "devDependencies": {
86
87
  "@a2a-js/sdk": "~1.3.0",
87
88
  "@ag-ui/client": "1.0.2",
88
- "@scalar/openapi-parser": "^0.29.11",
89
- "@types/node": "^26.6.4",
89
+ "@scalar/openapi-parser": "^0.29.13",
90
+ "@types/node": "^26.6.5",
90
91
  "@types/pg": "^8.23.1",
91
92
  "@types/ws": "^8.18.2",
92
93
  "@typescript/native": "npm:typescript@^7.0.2",
93
94
  "drizzle-kit": "^0.31.11",
94
95
  "typescript": "npm:@typescript/typescript6@^6.0.2",
95
- "vitest": "^5.0.2"
96
+ "vitest": "^5.0.4"
96
97
  }
97
98
  }
@@ -1,9 +0,0 @@
1
- /**
2
- * Environment manifests (`/v1/environment-manifests/**`, protocol 14, D63): save, read, list and
3
- * delete the named, versioned definitions Environments are made from. A save never changes an
4
- * Environment. Reading needs what reading an Environment needs; saving and deleting need
5
- * `environments:write`, from any client (Q12).
6
- */
7
- import type { OpenAPIHono } from "@hono/zod-openapi";
8
- import type { TenantEnv } from "../app.js";
9
- export declare function environmentManifestRoutes(api: OpenAPIHono<TenantEnv>): void;
@@ -1,118 +0,0 @@
1
- import { z } from "zod";
2
- import { isEnvironmentManifestName, PutEnvironmentManifestRequestSchema } from "@nylorun/core/contracts";
3
- import { DeleteEnvironmentManifestResponse, EnvironmentManifestPlan, EnvironmentManifestVersions, EnvironmentManifestView, ListEnvironmentManifestsResponse, PutEnvironmentManifestRequest, SaveEnvironmentManifestResponse, } from "../../components.js";
4
- import { fail } from "../../../tenant/http.js";
5
- import { deleteEnvironmentManifest, environmentManifestVersions, getEnvironmentManifest, listEnvironmentManifests, saveEnvironmentManifest, } from "../../../tenant/environment-manifests.js";
6
- import { readJson } from "../body.js";
7
- import { tenantRoute } from "../define.js";
8
- import { jsonResponse } from "../respond.js";
9
- const READ = {
10
- credentials: ["application", "subject", "token"],
11
- scopes: ["sessions:own", "environments:write"],
12
- };
13
- const WRITE = {
14
- credentials: ["application", "subject", "token"],
15
- scopes: ["environments:write"],
16
- };
17
- const json = (schema, description) => ({
18
- description,
19
- content: { "application/json": { schema } },
20
- });
21
- const namePath = z.object({
22
- name: z.string().meta({ description: "The environment manifest's name, such as `analyst-box`" }),
23
- });
24
- function nameOf(value) {
25
- if (!isEnvironmentManifestName(value))
26
- return fail(400, "An environment manifest's name is 1-64 letters, digits, '.', '_' and '-', starting with a letter or digit");
27
- return value;
28
- }
29
- function versionOf(value) {
30
- const version = Number(value);
31
- if (!Number.isInteger(version) || version < 1)
32
- return fail(400, "version is a positive integer");
33
- return version;
34
- }
35
- /** `If-Match: <version>` (or `"<version>"`), when sent. */
36
- function ifMatchOf(value) {
37
- if (value === undefined || value.trim() === "")
38
- return undefined;
39
- const version = Number(value.trim().replace(/^W\//, "").replace(/^"|"$/g, ""));
40
- if (!Number.isInteger(version) || version < 0)
41
- return fail(400, "If-Match is the version you read: a whole number, 0 for none yet");
42
- return version;
43
- }
44
- export function environmentManifestRoutes(api) {
45
- tenantRoute(api, READ, {
46
- method: "get",
47
- path: "/v1/environment-manifests",
48
- tags: ["Environment manifests"],
49
- summary: "List environment manifests",
50
- description: "Each manifest's latest version, by name, with how many Environments were made from it.",
51
- responses: { 200: json(ListEnvironmentManifestsResponse, "The manifests") },
52
- }, async (c) => jsonResponse(200, await listEnvironmentManifests(c.env.tenant)));
53
- tenantRoute(api, WRITE, {
54
- method: "put",
55
- path: "/v1/environment-manifests/{name}",
56
- tags: ["Environment manifests"],
57
- summary: "Save an environment manifest",
58
- description: "Saves the manifest as its next version, or answers the latest unchanged when nothing differs. No Environment changes: an Environment keeps the version it was made from, and a fork moves it to another (D63). `If-Match: <version>` refuses the save with `412 manifest_changed` when the latest version is no longer the one you read (`0` for a manifest that does not exist yet). With `?dryRun=true` the answer is the plan: the changes, every reason a save would be refused (`errors`), warnings, and how many Environments stay on older versions; nothing is saved. Clients drop a file's `$schema` before they send it.",
59
- request: {
60
- params: namePath,
61
- query: z.object({
62
- dryRun: z.enum(["true", "false"]).optional().meta({ description: "`true`: answer the plan and save nothing" }),
63
- }),
64
- body: { required: true, content: { "application/json": { schema: PutEnvironmentManifestRequest } } },
65
- },
66
- responses: {
67
- 200: json(z.union([SaveEnvironmentManifestResponse, EnvironmentManifestPlan]), "The version saved, or the plan with dryRun"),
68
- 400: { description: "The manifest breaks the Tenant's limits or names files the Runtime cannot use" },
69
- 412: { description: "If-Match named a version that is no longer the latest (`manifest_changed`)" },
70
- },
71
- }, async (c) => {
72
- const name = nameOf(c.req.param("name"));
73
- const body = PutEnvironmentManifestRequestSchema.parse(await readJson(c.req.raw));
74
- const ifMatch = ifMatchOf(c.req.header("if-match"));
75
- const options = ifMatch === undefined ? {} : { ifMatch };
76
- return jsonResponse(200, c.req.query("dryRun") === "true"
77
- ? await saveEnvironmentManifest(c.env.tenant, name, body, c.get("scope"), { ...options, dryRun: true })
78
- : await saveEnvironmentManifest(c.env.tenant, name, body, c.get("scope"), options));
79
- });
80
- tenantRoute(api, READ, {
81
- method: "get",
82
- path: "/v1/environment-manifests/{name}",
83
- tags: ["Environment manifests"],
84
- summary: "Get an environment manifest",
85
- description: "Its latest version.",
86
- request: { params: namePath },
87
- responses: { 200: json(EnvironmentManifestView, "The latest version") },
88
- }, async (c) => jsonResponse(200, await getEnvironmentManifest(c.env.tenant, nameOf(c.req.param("name")))));
89
- tenantRoute(api, READ, {
90
- method: "get",
91
- path: "/v1/environment-manifests/{name}/versions",
92
- tags: ["Environment manifests"],
93
- summary: "List an environment manifest's versions",
94
- description: "Every version, newest first, with who saved it and how many Environments were made from it.",
95
- request: { params: namePath },
96
- responses: { 200: json(EnvironmentManifestVersions, "The versions") },
97
- }, async (c) => jsonResponse(200, await environmentManifestVersions(c.env.tenant, nameOf(c.req.param("name")))));
98
- tenantRoute(api, READ, {
99
- method: "get",
100
- path: "/v1/environment-manifests/{name}/versions/{version}",
101
- tags: ["Environment manifests"],
102
- summary: "Get one version of an environment manifest",
103
- request: { params: namePath.extend({ version: z.string().meta({ description: "The version number" }) }) },
104
- responses: { 200: json(EnvironmentManifestView, "The version") },
105
- }, async (c) => jsonResponse(200, await getEnvironmentManifest(c.env.tenant, nameOf(c.req.param("name")), versionOf(c.req.param("version")))));
106
- tenantRoute(api, WRITE, {
107
- method: "delete",
108
- path: "/v1/environment-manifests/{name}",
109
- tags: ["Environment manifests"],
110
- summary: "Delete an environment manifest",
111
- description: "Deletes every version. Refused while any Environment was made from one (`409 manifest_in_use`).",
112
- request: { params: namePath },
113
- responses: {
114
- 200: json(DeleteEnvironmentManifestResponse, "Deleted, or there was none"),
115
- 409: { description: "An Environment was made from one of its versions (`manifest_in_use`)" },
116
- },
117
- }, async (c) => jsonResponse(200, await deleteEnvironmentManifest(c.env.tenant, nameOf(c.req.param("name")))));
118
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Environments (`/v1/environments/**`, protocol 11, D55, D56): create, find or change one by id,
3
- * read it, list them by label, read its lifecycle stream, stop, reset and delete it, and write
4
- * its vault's secrets. Ids may hold `/`, sent percent-encoded as one path segment
5
- * (`users%2Falice%2Fweb`). A token caller reaches only the ids its Environment grants match,
6
- * and changes them only with `environments:write`. Secret values are write-only: no route reads
7
- * one back.
8
- */
9
- import type { OpenAPIHono } from "@hono/zod-openapi";
10
- import type { TenantEnv } from "../app.js";
11
- export declare function environmentRoutes(api: OpenAPIHono<TenantEnv>): void;