@jeffusion/bungee-core 6.19.3 → 6.19.4

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 (445) hide show
  1. package/dist/access-database.d.ts +22 -0
  2. package/dist/api/handlers/logs.d.ts +66 -0
  3. package/dist/api/handlers/stats.d.ts +50 -0
  4. package/dist/api/logs.d.ts +145 -0
  5. package/dist/api/types.d.ts +21 -0
  6. package/dist/{chunk-assets-swq50rh3.js → chunk-assets-vsan7gav.js} +11 -11
  7. package/dist/{chunk-body-capture-gtta9q26.js → chunk-body-capture-sbk6cdf9.js} +2 -2
  8. package/dist/{chunk-handler-ehkkxpnq.js → chunk-handler-9k6b95w4.js} +2 -2
  9. package/dist/{chunk-main-rcw37zhd.js → chunk-main-1p15rgq5.js} +1 -1
  10. package/dist/{chunk-main-10pgdbgn.js → chunk-main-2efrk1nt.js} +1 -1
  11. package/dist/{chunk-main-a4eygw79.js → chunk-main-d74e7qxc.js} +1 -1
  12. package/dist/{chunk-main-p5rpfk7t.js → chunk-main-gwaw6pxp.js} +1 -1
  13. package/dist/{chunk-main-25kbhd4n.js → chunk-main-mqgkewnx.js} +1 -1
  14. package/dist/{chunk-main-0w3jk2x4.js → chunk-main-qm1tgaka.js} +2 -2
  15. package/dist/{chunk-master-276v10xm.js → chunk-master-wtcfwd6g.js} +6 -6
  16. package/dist/{chunk-plugin-context-manager-nexyp0jb.js → chunk-plugin-context-manager-kabrbg0s.js} +1 -1
  17. package/dist/{chunk-plugin-manager-dvxc5w6p.js → chunk-plugin-manager-q1bt6xnw.js} +2 -2
  18. package/dist/{chunk-runtime-upgrade-sjxsa2r6.js → chunk-runtime-upgrade-rvm3d096.js} +3 -3
  19. package/dist/{chunk-runtime-qbfd9z3p.js → chunk-runtime-xmp308t7.js} +2 -2
  20. package/dist/{chunk-worker-5mdsmhte.js → chunk-worker-99q8qnj9.js} +9 -9
  21. package/dist/config-publication/admission-handoff.d.ts +13 -0
  22. package/dist/config-publication/coordinator-types.d.ts +176 -0
  23. package/dist/config-publication/current-startup.d.ts +26 -0
  24. package/dist/config-publication/drain-workers.d.ts +15 -0
  25. package/dist/config-publication/index.d.ts +6 -0
  26. package/dist/config-publication/master-coordinator.d.ts +45 -0
  27. package/dist/config-publication/master-messages.d.ts +2 -0
  28. package/dist/config-publication/message-fields.d.ts +20 -0
  29. package/dist/config-publication/messages.d.ts +3 -0
  30. package/dist/config-publication/process-cleanup.d.ts +30 -0
  31. package/dist/config-publication/process-identity.d.ts +14 -0
  32. package/dist/config-publication/process-termination.d.ts +7 -0
  33. package/dist/config-publication/publication-runner.d.ts +50 -0
  34. package/dist/config-publication/recovery-disposition.d.ts +17 -0
  35. package/dist/config-publication/types.d.ts +137 -0
  36. package/dist/config-publication/waiter-safety.d.ts +2 -0
  37. package/dist/config-publication/worker-messages.d.ts +2 -0
  38. package/dist/config-publication/worker-runtime-contract.d.ts +76 -0
  39. package/dist/config-publication/worker-runtime-plugins.d.ts +8 -0
  40. package/dist/config-publication/worker-runtime.d.ts +22 -0
  41. package/dist/config-publication/worker-wait.d.ts +44 -0
  42. package/dist/config-storage/active-publication.d.ts +37 -0
  43. package/dist/config-storage/aggregate.d.ts +4 -0
  44. package/dist/config-storage/async-config-repository.d.ts +125 -0
  45. package/dist/config-storage/commit-transaction.d.ts +13 -0
  46. package/dist/config-storage/compiler.d.ts +4 -0
  47. package/dist/config-storage/config-repository.d.ts +118 -0
  48. package/dist/config-storage/consistent-read.d.ts +2 -0
  49. package/dist/config-storage/content-hash.d.ts +17 -0
  50. package/dist/config-storage/cross-table-audit.d.ts +20 -0
  51. package/dist/config-storage/current-revision.d.ts +2 -0
  52. package/dist/config-storage/domain-validation.d.ts +5 -0
  53. package/dist/config-storage/expression-ast.d.ts +2 -0
  54. package/dist/config-storage/expression-call-policy.d.ts +2 -0
  55. package/dist/config-storage/expression-syntax.d.ts +2 -0
  56. package/dist/config-storage/gateway-target-validation.d.ts +5 -0
  57. package/dist/config-storage/global-scalars.d.ts +6 -0
  58. package/dist/config-storage/global-validation.d.ts +2 -0
  59. package/dist/config-storage/immutable-snapshot.d.ts +4 -0
  60. package/dist/config-storage/index.d.ts +21 -0
  61. package/dist/config-storage/json-preflight.d.ts +15 -0
  62. package/dist/config-storage/management-protection.d.ts +10 -0
  63. package/dist/config-storage/materialize.d.ts +3 -0
  64. package/dist/config-storage/menu-store.d.ts +12 -0
  65. package/dist/config-storage/migrations/baseline.d.ts +8 -0
  66. package/dist/config-storage/migrations/index.d.ts +8 -0
  67. package/dist/config-storage/migrations/management-protection.d.ts +2 -0
  68. package/dist/config-storage/migrations/plan.d.ts +9 -0
  69. package/dist/config-storage/migrations/prepared-worker-allocation.d.ts +2 -0
  70. package/dist/config-storage/migrations/publication-retirement.d.ts +3 -0
  71. package/dist/config-storage/migrations/publication-targets.d.ts +3 -0
  72. package/dist/config-storage/migrations/request-logs-default.d.ts +2 -0
  73. package/dist/config-storage/migrations/runtime-cutover.d.ts +2 -0
  74. package/dist/config-storage/migrations/service-references.d.ts +3 -0
  75. package/dist/config-storage/migrations/ui-menus.d.ts +2 -0
  76. package/dist/config-storage/migrations/websocket-connections.d.ts +2 -0
  77. package/dist/config-storage/migrations/websocket-message-size.d.ts +2 -0
  78. package/dist/config-storage/migrations/worker-launch-capacity.d.ts +2 -0
  79. package/dist/config-storage/modification-validation.d.ts +4 -0
  80. package/dist/config-storage/operation-records.d.ts +42 -0
  81. package/dist/config-storage/operation-relations.d.ts +6 -0
  82. package/dist/config-storage/operation-store.d.ts +12 -0
  83. package/dist/config-storage/persisted-json.d.ts +2 -0
  84. package/dist/config-storage/persisted-validation.d.ts +7 -0
  85. package/dist/config-storage/plugin-name.d.ts +2 -0
  86. package/dist/config-storage/plugin-schema.d.ts +16 -0
  87. package/dist/config-storage/policy-fields.d.ts +15 -0
  88. package/dist/config-storage/prepared-command.d.ts +14 -0
  89. package/dist/config-storage/read-materialization.d.ts +4 -0
  90. package/dist/config-storage/recovery-store.d.ts +21 -0
  91. package/dist/config-storage/relation-materialization.d.ts +30 -0
  92. package/dist/config-storage/repository-snapshot.d.ts +5 -0
  93. package/dist/config-storage/repository-types.d.ts +216 -0
  94. package/dist/config-storage/repository-validation.d.ts +6 -0
  95. package/dist/config-storage/request-logs-default.d.ts +5 -0
  96. package/dist/config-storage/retirement-store.d.ts +78 -0
  97. package/dist/config-storage/route-policy-validation.d.ts +2 -0
  98. package/dist/config-storage/runtime-config.d.ts +14 -0
  99. package/dist/config-storage/runtime-cutover.d.ts +13 -0
  100. package/dist/config-storage/runtime-recovery-budget.d.ts +35 -0
  101. package/dist/config-storage/schema-fingerprint.d.ts +5 -0
  102. package/dist/config-storage/schema.d.ts +2 -0
  103. package/dist/config-storage/service-policy-validation.d.ts +4 -0
  104. package/dist/config-storage/service-reference-upgrade.d.ts +4 -0
  105. package/dist/config-storage/serving-snapshot.d.ts +9 -0
  106. package/dist/config-storage/snapshot-validation.d.ts +3 -0
  107. package/dist/config-storage/sqlite-errors.d.ts +3 -0
  108. package/dist/config-storage/sqlite-query.d.ts +3 -0
  109. package/dist/config-storage/sqlite-version.d.ts +10 -0
  110. package/dist/config-storage/storage-protocol.d.ts +52 -0
  111. package/dist/config-storage/utf16.d.ts +2 -0
  112. package/dist/config-storage/validation.d.ts +31 -0
  113. package/dist/config-storage/worker-launch-store.d.ts +93 -0
  114. package/dist/config-worker/http-provider.d.ts +6 -0
  115. package/dist/config-worker/lifecycle.d.ts +84 -0
  116. package/dist/config-worker/private-transport.d.ts +31 -0
  117. package/dist/config-worker/process-environment.d.ts +38 -0
  118. package/dist/config-worker/rate-limit-provider.d.ts +31 -0
  119. package/dist/config-worker/runtime-dependencies.d.ts +12 -0
  120. package/dist/config-worker/snapshot-compiler.d.ts +5 -0
  121. package/dist/config-worker/supervised-process-entry.d.ts +8 -0
  122. package/dist/core-version.d.ts +1 -0
  123. package/dist/daemon-control/bootstrap.d.ts +41 -0
  124. package/dist/daemon-control/index.d.ts +1 -0
  125. package/dist/daemon-control/launch-identity.d.ts +26 -0
  126. package/dist/daemon-control/shutdown.d.ts +22 -0
  127. package/dist/data-admission/errors.d.ts +16 -0
  128. package/dist/data-admission/host.d.ts +92 -0
  129. package/dist/data-admission/keyed-state.d.ts +21 -0
  130. package/dist/data-admission/rpc.d.ts +40 -0
  131. package/dist/data-admission/worker.d.ts +66 -0
  132. package/dist/database-schema.d.ts +2 -0
  133. package/dist/expression-engine.d.ts +33 -0
  134. package/dist/gateway/admission-plugin.d.ts +7 -0
  135. package/dist/gateway/auxiliary-request.d.ts +7 -0
  136. package/dist/gateway/body-contracts.d.ts +39 -0
  137. package/dist/gateway/body-events.d.ts +58 -0
  138. package/dist/gateway/body-factory.d.ts +4 -0
  139. package/dist/gateway/body-observation-stream.d.ts +6 -0
  140. package/dist/gateway/body-plugin.d.ts +8 -0
  141. package/dist/gateway/body-resources.d.ts +37 -0
  142. package/dist/gateway/body-service.d.ts +116 -0
  143. package/dist/gateway/contracts.d.ts +196 -0
  144. package/dist/gateway/controlled-views.d.ts +5 -0
  145. package/dist/gateway/dispatch-plugin.d.ts +11 -0
  146. package/dist/gateway/dispatch-targets.d.ts +4 -0
  147. package/dist/gateway/forward-plugin.d.ts +136 -0
  148. package/dist/gateway/plugin.d.ts +23 -0
  149. package/dist/gateway/plugin.js +18 -18
  150. package/dist/gateway/request-log-contracts.d.ts +346 -0
  151. package/dist/gateway/request-log.d.ts +105 -0
  152. package/dist/gateway/request-plugin.d.ts +98 -0
  153. package/dist/gateway/request-rules-plugin.d.ts +61 -0
  154. package/dist/gateway/response-plugin.d.ts +34 -0
  155. package/dist/gateway/response-views.d.ts +33 -0
  156. package/dist/gateway/responses-websocket-session.d.ts +24 -0
  157. package/dist/gateway/retry-action.d.ts +7 -0
  158. package/dist/gateway/retry-plugin.d.ts +7 -0
  159. package/dist/gateway/routing-plugin.d.ts +11 -0
  160. package/dist/gateway/runtime.d.ts +15 -0
  161. package/dist/gateway/selection-plugin.d.ts +7 -0
  162. package/dist/gateway/sse-response.d.ts +6 -0
  163. package/dist/gateway/websocket-contracts.d.ts +71 -0
  164. package/dist/gateway/websocket-credential.d.ts +3 -0
  165. package/dist/gateway/websocket-plugin.d.ts +9 -0
  166. package/dist/hooks/impl.d.ts +119 -0
  167. package/dist/hooks/index.d.ts +7 -0
  168. package/dist/hooks/plugin-hooks.d.ts +308 -0
  169. package/dist/hooks/types.d.ts +130 -0
  170. package/dist/ingress/admission-registry.d.ts +56 -0
  171. package/dist/ingress/admission-set.d.ts +29 -0
  172. package/dist/ingress/index.d.ts +4 -0
  173. package/dist/ingress/master-controller.d.ts +278 -0
  174. package/dist/ingress/runtime.d.ts +29 -0
  175. package/dist/ingress/supervision-http.d.ts +118 -0
  176. package/dist/ingress.d.ts +5 -0
  177. package/dist/instance-lock.d.ts +2 -0
  178. package/dist/logger/access-log-writer.d.ts +120 -0
  179. package/dist/logger/body-capture.d.ts +21 -0
  180. package/dist/logger/body-log-redaction.d.ts +6 -0
  181. package/dist/logger/body-storage.d.ts +71 -0
  182. package/dist/logger/content-capture.d.ts +47 -0
  183. package/dist/logger/dated-log-files.d.ts +5 -0
  184. package/dist/logger/header-storage.d.ts +54 -0
  185. package/dist/logger/log-cleanup.d.ts +69 -0
  186. package/dist/logger/log-url.d.ts +2 -0
  187. package/dist/logger/request-logger.d.ts +308 -0
  188. package/dist/logger/transport-outcome.d.ts +25 -0
  189. package/dist/logger/websocket-body-capture.d.ts +26 -0
  190. package/dist/logger.d.ts +16 -0
  191. package/dist/main.d.ts +19 -0
  192. package/dist/main.js +8 -8
  193. package/dist/management-listener/index.d.ts +2 -0
  194. package/dist/management-listener/listener.d.ts +48 -0
  195. package/dist/management-listener/request-source.d.ts +4 -0
  196. package/dist/master-runtime/component-recovery.d.ts +40 -0
  197. package/dist/master-runtime/composition.d.ts +129 -0
  198. package/dist/master-runtime/configuration-recovery.d.ts +80 -0
  199. package/dist/master-runtime/control-api-body.d.ts +9 -0
  200. package/dist/master-runtime/control-api.d.ts +122 -0
  201. package/dist/master-runtime/error-chain.d.ts +9 -0
  202. package/dist/master-runtime/initialize-configuration.d.ts +4 -0
  203. package/dist/master-runtime/instance-lock.d.ts +25 -0
  204. package/dist/master-runtime/kernel-exit-timer.d.ts +7 -0
  205. package/dist/master-runtime/kernel-monotonic-clock.d.ts +15 -0
  206. package/dist/master-runtime/management-auth.d.ts +43 -0
  207. package/dist/master-runtime/master-plugin-catalog-api.d.ts +18 -0
  208. package/dist/master-runtime/master-stats.d.ts +52 -0
  209. package/dist/master-runtime/menu-api.d.ts +19 -0
  210. package/dist/master-runtime/observability-client.d.ts +49 -0
  211. package/dist/master-runtime/offline-recovery.d.ts +9 -0
  212. package/dist/master-runtime/offline-storage-session.d.ts +8 -0
  213. package/dist/master-runtime/plugin-journal-recovery.d.ts +28 -0
  214. package/dist/master-runtime/process-identity.d.ts +48 -0
  215. package/dist/master-runtime/process-options.d.ts +59 -0
  216. package/dist/master-runtime/publication-task-manager.d.ts +47 -0
  217. package/dist/master-runtime/reconcile-plugin-dependencies.d.ts +7 -0
  218. package/dist/master-runtime/recovery-prompt.d.ts +9 -0
  219. package/dist/master-runtime/route-body-plan.d.ts +31 -0
  220. package/dist/master-runtime/runtime-cleanup.d.ts +3 -0
  221. package/dist/master-runtime/runtime-contracts.d.ts +101 -0
  222. package/dist/master-runtime/runtime-evidence.d.ts +8 -0
  223. package/dist/master-runtime/runtime-status.d.ts +36 -0
  224. package/dist/master-runtime/runtime-supervisor.d.ts +30 -0
  225. package/dist/master-runtime/runtime-upgrade.d.ts +11 -0
  226. package/dist/master-runtime/runtime-upstreams.d.ts +14 -0
  227. package/dist/master-runtime/runtime.d.ts +23 -0
  228. package/dist/master-runtime/shutdown-diagnostics.d.ts +28 -0
  229. package/dist/master-runtime/signal-handlers.d.ts +18 -0
  230. package/dist/master-runtime/stopped-instance-lock.d.ts +6 -0
  231. package/dist/master-runtime/stopped-process.d.ts +2 -0
  232. package/dist/master-runtime/supervised-worker-client.d.ts +108 -0
  233. package/dist/master-runtime/supervised-worker-discovery.d.ts +41 -0
  234. package/dist/master-runtime/supervised-worker-factory.d.ts +298 -0
  235. package/dist/master-runtime/supervised-worker-process-adapter.d.ts +146 -0
  236. package/dist/master-runtime/worker-initialization-diagnostics.d.ts +18 -0
  237. package/dist/master.d.ts +2 -0
  238. package/dist/oauth-callback.d.ts +8 -0
  239. package/dist/plugin-artifact-contract.d.ts +4 -0
  240. package/dist/plugin-artifact-negotiation.d.ts +12 -0
  241. package/dist/plugin-artifact-types.d.ts +61 -0
  242. package/dist/plugin-context-manager.d.ts +91 -0
  243. package/dist/plugin-control/artifact-loader.d.ts +3 -0
  244. package/dist/plugin-control/contracts.d.ts +180 -0
  245. package/dist/plugin-control/host.d.ts +90 -0
  246. package/dist/plugin-control/index.d.ts +3 -0
  247. package/dist/plugin-control/master-invocation-projector.d.ts +52 -0
  248. package/dist/plugin-control/request-service-authority.d.ts +33 -0
  249. package/dist/plugin-control/secret-crypto.d.ts +13 -0
  250. package/dist/plugin-control/secret-store.d.ts +15 -0
  251. package/dist/plugin-dependencies.d.ts +30 -0
  252. package/dist/plugin-durable-state.d.ts +62 -0
  253. package/dist/plugin-extensions.d.ts +99 -0
  254. package/dist/plugin-logger.d.ts +17 -0
  255. package/dist/plugin-manifest-catalog/catalog.d.ts +28 -0
  256. package/dist/plugin-manifest-catalog/config-constraint-parser.d.ts +3 -0
  257. package/dist/plugin-manifest-catalog/config-default-validator.d.ts +3 -0
  258. package/dist/plugin-manifest-catalog/config-field-parser.d.ts +3 -0
  259. package/dist/plugin-manifest-catalog/config-field-references.d.ts +2 -0
  260. package/dist/plugin-manifest-catalog/index.d.ts +6 -0
  261. package/dist/plugin-manifest-catalog/manifest-filesystem.d.ts +9 -0
  262. package/dist/plugin-manifest-catalog/manifest-json.d.ts +1 -0
  263. package/dist/plugin-manifest-catalog/manifest-nested-parser.d.ts +11 -0
  264. package/dist/plugin-manifest-catalog/manifest-parser.d.ts +2 -0
  265. package/dist/plugin-manifest-catalog/manifest-semver.d.ts +4 -0
  266. package/dist/plugin-manifest-catalog/manifest-values.d.ts +6 -0
  267. package/dist/plugin-manifest-catalog/parse-utils.d.ts +19 -0
  268. package/dist/plugin-manifest-catalog/plugin-field-value.d.ts +3 -0
  269. package/dist/plugin-manifest-catalog/runtime-identity.d.ts +12 -0
  270. package/dist/plugin-manifest-catalog/types.d.ts +187 -0
  271. package/dist/plugin-path-resolver.d.ts +17 -0
  272. package/dist/plugin-registry.d.ts +165 -0
  273. package/dist/plugin-runtime-config.d.ts +10 -0
  274. package/dist/plugin-runtime-diff.d.ts +15 -0
  275. package/dist/plugin-runtime-orchestrator.d.ts +69 -0
  276. package/dist/plugin-runtime-state-machine.d.ts +78 -0
  277. package/dist/plugin-runtime-status.d.ts +29 -0
  278. package/dist/plugin-services/channels.d.ts +391 -0
  279. package/dist/plugin-services/command-journal.d.ts +234 -0
  280. package/dist/plugin-services/contracts.d.ts +23 -0
  281. package/dist/plugin-services/host-rpc.d.ts +268 -0
  282. package/dist/plugin-services/peer-broker.d.ts +351 -0
  283. package/dist/plugin-services/peer-channel-hub.d.ts +457 -0
  284. package/dist/plugin-services/peer-channel-protocol.d.ts +339 -0
  285. package/dist/plugin-services/peer-directory.d.ts +163 -0
  286. package/dist/plugin-services/peer-executor-proof.d.ts +13 -0
  287. package/dist/plugin-services/peer-frame.d.ts +65 -0
  288. package/dist/plugin-services/peer-journal.d.ts +25 -0
  289. package/dist/plugin-services/peer-protocol.d.ts +128 -0
  290. package/dist/plugin-services/peer-rpc-link.d.ts +218 -0
  291. package/dist/plugin-services/peer-rpc-mapping.d.ts +133 -0
  292. package/dist/plugin-services/peer-websocket.d.ts +146 -0
  293. package/dist/plugin-services/persistence.d.ts +166 -0
  294. package/dist/plugin-services/rpc-runtime.d.ts +227 -0
  295. package/dist/plugin-services/snapshot-store.d.ts +77 -0
  296. package/dist/plugin-services/wire-contract.d.ts +158 -0
  297. package/dist/plugin-services.d.ts +237 -0
  298. package/dist/plugin-state/client.d.ts +160 -0
  299. package/dist/plugin-state/message-size.d.ts +2 -0
  300. package/dist/plugin-state/operations.d.ts +4 -0
  301. package/dist/plugin-state/protocol.d.ts +40 -0
  302. package/dist/plugin-state/storage-rpc.d.ts +7 -0
  303. package/dist/plugin.types.d.ts +999 -0
  304. package/dist/plugins/anthropic-request-sanitizer/index.js +17 -17
  305. package/dist/plugins/anthropic-request-sanitizer/index.js.map +1 -1
  306. package/dist/plugins/anthropic-tool-name-transformer/index.js +17 -17
  307. package/dist/plugins/anthropic-tool-name-transformer/index.js.map +1 -1
  308. package/dist/plugins/chatgpt-oauth/control.js +24 -24
  309. package/dist/plugins/chatgpt-oauth/control.js.map +1 -1
  310. package/dist/plugins/chatgpt-oauth/index.js +23 -23
  311. package/dist/plugins/chatgpt-oauth/index.js.map +1 -1
  312. package/dist/plugins/codex-router/control.js +19 -19
  313. package/dist/plugins/codex-router/control.js.map +1 -1
  314. package/dist/plugins/codex-router/index.js +31 -31
  315. package/dist/plugins/codex-router/index.js.map +1 -1
  316. package/dist/plugins/deepseek-reasoning-fix/index.js +17 -17
  317. package/dist/plugins/deepseek-reasoning-fix/index.js.map +1 -1
  318. package/dist/plugins/key-access/control.js +18 -18
  319. package/dist/plugins/key-access/control.js.map +1 -1
  320. package/dist/plugins/key-access/index.js +19 -19
  321. package/dist/plugins/key-access/index.js.map +1 -1
  322. package/dist/plugins/key-access/ingress.js +18 -18
  323. package/dist/plugins/key-access/ingress.js.map +1 -1
  324. package/dist/plugins/key-rate-limit/control.js +3 -3
  325. package/dist/plugins/key-rate-limit/control.js.map +1 -1
  326. package/dist/plugins/key-rate-limit/index.js +18 -18
  327. package/dist/plugins/key-rate-limit/index.js.map +1 -1
  328. package/dist/plugins/key-rate-limit/ingress.js +2 -2
  329. package/dist/plugins/key-rate-limit/ingress.js.map +1 -1
  330. package/dist/plugins/llm-protocol-adapter/control.js +48 -48
  331. package/dist/plugins/llm-protocol-adapter/control.js.map +1 -1
  332. package/dist/plugins/llm-protocol-adapter/index.js +53 -53
  333. package/dist/plugins/llm-protocol-adapter/index.js.map +1 -1
  334. package/dist/plugins/llm-tps/control.js +5 -5
  335. package/dist/plugins/llm-tps/control.js.map +1 -1
  336. package/dist/plugins/llm-tps/index.js +20 -20
  337. package/dist/plugins/llm-tps/index.js.map +1 -1
  338. package/dist/plugins/model-mapping/control.js +4 -4
  339. package/dist/plugins/model-mapping/control.js.map +1 -1
  340. package/dist/plugins/model-mapping/index.js +19 -19
  341. package/dist/plugins/model-mapping/index.js.map +1 -1
  342. package/dist/plugins/models-dev/control.js +10 -10
  343. package/dist/plugins/models-dev/control.js.map +1 -1
  344. package/dist/plugins/models-dev/index.js +23 -23
  345. package/dist/plugins/models-dev/index.js.map +1 -1
  346. package/dist/plugins/request-body-redaction/control.js +2 -2
  347. package/dist/plugins/request-body-redaction/control.js.map +1 -1
  348. package/dist/plugins/request-body-redaction/index.js +21 -21
  349. package/dist/plugins/request-body-redaction/index.js.map +1 -1
  350. package/dist/plugins/request-logs/index.js +27 -27
  351. package/dist/plugins/request-logs/index.js.map +1 -1
  352. package/dist/plugins/request-logs/ingress.js +2 -2
  353. package/dist/plugins/request-logs/ingress.js.map +1 -1
  354. package/dist/plugins/signature-repair/index.js +17 -17
  355. package/dist/plugins/signature-repair/index.js.map +1 -1
  356. package/dist/plugins/sse-envelope.d.ts +3 -0
  357. package/dist/plugins/token-budget/control.js +19 -19
  358. package/dist/plugins/token-budget/control.js.map +1 -1
  359. package/dist/plugins/token-budget/index.js +19 -19
  360. package/dist/plugins/token-budget/index.js.map +1 -1
  361. package/dist/plugins/token-budget/ingress.js +2 -2
  362. package/dist/plugins/token-budget/ingress.js.map +1 -1
  363. package/dist/plugins/token-metering/index.js +30 -30
  364. package/dist/plugins/token-metering/index.js.map +1 -1
  365. package/dist/plugins/token-stats/control.js +22 -22
  366. package/dist/plugins/token-stats/control.js.map +1 -1
  367. package/dist/plugins/token-stats/index.js +22 -22
  368. package/dist/plugins/token-stats/index.js.map +1 -1
  369. package/dist/plugins/user-auth/control.js +21 -21
  370. package/dist/plugins/user-auth/control.js.map +1 -1
  371. package/dist/plugins/user-auth/index.js +17 -17
  372. package/dist/plugins/user-auth/index.js.map +1 -1
  373. package/dist/public-listener/admission-registry.d.ts +15 -0
  374. package/dist/public-listener/forwarding.d.ts +24 -0
  375. package/dist/public-listener/headers.d.ts +5 -0
  376. package/dist/public-listener/index.d.ts +4 -0
  377. package/dist/public-listener/listener.d.ts +21 -0
  378. package/dist/public-listener/websocket.d.ts +4 -0
  379. package/dist/rate-limit/http.d.ts +80 -0
  380. package/dist/rate-limit/index.d.ts +7 -0
  381. package/dist/rate-limit/json.d.ts +8 -0
  382. package/dist/rate-limit/profile.d.ts +46 -0
  383. package/dist/rate-limit/protocol.d.ts +104 -0
  384. package/dist/rate-limit/store.d.ts +61 -0
  385. package/dist/scoped-plugin-registry.d.ts +645 -0
  386. package/dist/supervision/index.d.ts +12 -0
  387. package/dist/supervision/process-lifetime-guard.d.ts +54 -0
  388. package/dist/supervision/protocol.d.ts +173 -0
  389. package/dist/supervision/state-repository.d.ts +15 -0
  390. package/dist/supervision/strict-json.d.ts +2 -0
  391. package/dist/supervision/worker-descriptor.d.ts +77 -0
  392. package/dist/supervision/worker-http.d.ts +135 -0
  393. package/dist/supervision/worker-runtime-snapshot.d.ts +64 -0
  394. package/dist/token-stats-window.d.ts +23 -0
  395. package/dist/ui/assets.d.ts +8 -0
  396. package/dist/ui/icon-resources.d.ts +28 -0
  397. package/dist/ui/menu-icons.d.ts +15 -0
  398. package/dist/ui/menu-layout.d.ts +10 -0
  399. package/dist/ui/plugin-sandbox-policy.d.ts +11 -0
  400. package/dist/ui/server.d.ts +10 -0
  401. package/dist/updates/archive-installer.d.ts +8 -0
  402. package/dist/updates/controller.d.ts +50 -0
  403. package/dist/updates/download.d.ts +8 -0
  404. package/dist/updates/installation.d.ts +26 -0
  405. package/dist/updates/names.d.ts +3 -0
  406. package/dist/updates/release.d.ts +23 -0
  407. package/dist/updates/restart.d.ts +13 -0
  408. package/dist/utils/config-validator.d.ts +40 -0
  409. package/dist/utils/endpoint-resolver.d.ts +20 -0
  410. package/dist/utils/expression-dependencies.d.ts +10 -0
  411. package/dist/utils/plugin-helpers.d.ts +46 -0
  412. package/dist/websocket/headers.d.ts +9 -0
  413. package/dist/websocket/index.d.ts +3 -0
  414. package/dist/websocket/message.d.ts +3 -0
  415. package/dist/websocket/observation.d.ts +36 -0
  416. package/dist/websocket/transport.d.ts +197 -0
  417. package/dist/worker/health/checker.d.ts +54 -0
  418. package/dist/worker/health/scheduler.d.ts +27 -0
  419. package/dist/worker/request/body-source.d.ts +1 -0
  420. package/dist/worker/request/context-builder.d.ts +78 -0
  421. package/dist/worker/request/context.d.ts +55 -0
  422. package/dist/worker/request/credential.d.ts +10 -0
  423. package/dist/worker/request/handler.d.ts +3 -0
  424. package/dist/worker/request/proxy.d.ts +4 -0
  425. package/dist/worker/request/response-detector.d.ts +9 -0
  426. package/dist/worker/request/snapshot.d.ts +18 -0
  427. package/dist/worker/response/attempt-observation.d.ts +24 -0
  428. package/dist/worker/response/processor.d.ts +4 -0
  429. package/dist/worker/response/streaming-response.d.ts +1 -0
  430. package/dist/worker/rules/deep-merge.d.ts +2 -0
  431. package/dist/worker/rules/modifier.d.ts +3 -0
  432. package/dist/worker/state/plugin-manager.d.ts +95 -0
  433. package/dist/worker/state/runtime-state.d.ts +90 -0
  434. package/dist/worker/types.d.ts +44 -0
  435. package/dist/worker/upstream/condition-filter.d.ts +31 -0
  436. package/dist/worker/upstream/failover-coordinator.d.ts +93 -0
  437. package/dist/worker/upstream/filter.d.ts +37 -0
  438. package/dist/worker/upstream/priority-group.d.ts +66 -0
  439. package/dist/worker/upstream/selector.d.ts +10 -0
  440. package/dist/worker/upstream/service-execution.d.ts +17 -0
  441. package/dist/worker/utils/jitter.d.ts +81 -0
  442. package/dist/worker/utils/slow-start.d.ts +67 -0
  443. package/dist/worker/utils/status-code-matcher.d.ts +10 -0
  444. package/dist/worker.d.ts +1 -0
  445. package/package.json +2 -2
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Plugin communication persistence (P3): durable records, atomic capacity
3
+ * reservations, and explicit retention governance. Host-only leaf module:
4
+ * `PluginCommunicationStore` owns the strict schema and the raw `Database`, and
5
+ * `forNamespace(plugin)` returns a frozen capability bound to one namespace
6
+ * (no other namespace, no connection). It backs host-mediated command receipts,
7
+ * reliable events, and large-object reuse; it is not a plugin shared database.
8
+ *
9
+ * Charging model (a conservative estimate, NOT a measured SQLite disk
10
+ * footprint): each persisted row is charged `entryOverheadBytes` (fixed row
11
+ * estimate) plus the UTF-8 length of its identifier text (namespace plus
12
+ * key/reservation id) plus its stored data bytes. A reservation pre-pays the
13
+ * worst case of BOTH the record row and the receipt row it can produce (key
14
+ * bounded by MAX_IDENTIFIER_BYTES, capacity supplied by the caller); `commit`
15
+ * releases the actual-vs-reserved difference, so a row can never grow past what
16
+ * was reserved. A zero-capacity reservation still carries a positive minimum
17
+ * charge, so it can always be replaced by a tombstone without exceeding quota.
18
+ * Reads never delete; only `collect`, `delete`, `ack`, and `forceRelease` do.
19
+ *
20
+ * `PluginCommunicationLimits` (notably `entryOverheadBytes`) is part of the
21
+ * on-disk accounting contract: reads recompute expected charges and report
22
+ * `corruption` on mismatch, so limits must stay stable across restarts.
23
+ */
24
+ import type { Database } from 'bun:sqlite';
25
+ export declare const PLUGIN_COMMUNICATION_SCHEMA_SQL = "\nCREATE TABLE IF NOT EXISTS plugin_communication_reservations (\n namespace TEXT NOT NULL, reservation_id TEXT NOT NULL,\n capacity_bytes INTEGER NOT NULL CHECK(capacity_bytes >= 0),\n charged_bytes INTEGER NOT NULL CHECK(charged_bytes >= 0),\n required INTEGER NOT NULL CHECK(required IN (0,1)),\n expires_at INTEGER, created_at INTEGER NOT NULL,\n PRIMARY KEY(namespace, reservation_id)\n) STRICT;\nCREATE TABLE IF NOT EXISTS plugin_communication_records (\n namespace TEXT NOT NULL, key TEXT NOT NULL,\n payload BLOB NOT NULL, metadata TEXT,\n payload_bytes INTEGER NOT NULL CHECK(payload_bytes >= 0),\n metadata_bytes INTEGER NOT NULL CHECK(metadata_bytes >= 0),\n charged_bytes INTEGER NOT NULL CHECK(charged_bytes >= 0),\n required INTEGER NOT NULL CHECK(required IN (0,1)),\n expires_at INTEGER, created_at INTEGER NOT NULL,\n PRIMARY KEY(namespace, key)\n) STRICT;\nCREATE TABLE IF NOT EXISTS plugin_communication_receipts (\n namespace TEXT NOT NULL, reservation_id TEXT NOT NULL, key TEXT NOT NULL,\n capacity_bytes INTEGER NOT NULL CHECK(capacity_bytes >= 0),\n charged_bytes INTEGER NOT NULL CHECK(charged_bytes >= 0),\n fingerprint TEXT NOT NULL,\n required INTEGER NOT NULL CHECK(required IN (0,1)),\n committed_at INTEGER NOT NULL,\n PRIMARY KEY(namespace, reservation_id)\n) STRICT;\nCREATE TABLE IF NOT EXISTS plugin_communication_tombstones (\n namespace TEXT NOT NULL, reservation_id TEXT NOT NULL,\n charged_bytes INTEGER NOT NULL CHECK(charged_bytes >= 0),\n cancelled_at INTEGER NOT NULL,\n PRIMARY KEY(namespace, reservation_id)\n) STRICT;\nCREATE INDEX IF NOT EXISTS idx_plugin_communication_records_expiry\n ON plugin_communication_records(namespace, required, expires_at);\nCREATE INDEX IF NOT EXISTS idx_plugin_communication_reservations_expiry\n ON plugin_communication_reservations(namespace, required, expires_at);\n";
26
+ export type CommunicationStoreErrorCode = 'invalid_input' | 'quota_exceeded' | 'overloaded' | 'reservation_conflict' | 'reservation_missing' | 'record_protected' | 'corruption' | 'storage_failure';
27
+ export declare class CommunicationStoreError extends Error {
28
+ readonly code: CommunicationStoreErrorCode;
29
+ readonly name = "CommunicationStoreError";
30
+ constructor(code: CommunicationStoreErrorCode);
31
+ }
32
+ export interface PluginCommunicationLimits {
33
+ readonly globalBudgetBytes?: number;
34
+ /** Slice of the global budget best-effort rows may never consume. */
35
+ readonly globalRequiredReserveBytes?: number;
36
+ readonly globalMaxRows?: number;
37
+ /** Slice of the global row cap best-effort rows may never consume. */
38
+ readonly globalRequiredRowReserve?: number;
39
+ readonly namespaceQuotaBytes?: number;
40
+ /** Slice of the namespace quota best-effort rows may never consume. */
41
+ readonly requiredReserveBytes?: number;
42
+ readonly maxRecordsPerNamespace?: number;
43
+ /** Slice of the namespace row cap best-effort rows may never consume. */
44
+ readonly requiredRowReserve?: number;
45
+ /** Maximum payload+metadata capacity a single record or reservation may hold. */
46
+ readonly maxRecordBytes?: number;
47
+ /** Fixed per-row estimate; not a measured SQLite disk footprint. */
48
+ readonly entryOverheadBytes?: number;
49
+ }
50
+ export interface CommunicationRetention {
51
+ readonly required: boolean;
52
+ /** Required records are durable; a required declaration must omit expiry. */
53
+ readonly expiresAt?: number | null;
54
+ }
55
+ export interface CommunicationReservation {
56
+ readonly id: string;
57
+ /** Declared payload+metadata capacity in bytes. */
58
+ readonly capacityBytes: number;
59
+ /** Store-computed total charge the reservation holds (capacity plus row charges). */
60
+ readonly chargedBytes: number;
61
+ readonly required: boolean;
62
+ readonly expiresAt: number | null;
63
+ }
64
+ export interface CommunicationReceipt {
65
+ readonly id: string;
66
+ readonly key: string;
67
+ readonly capacityBytes: number;
68
+ readonly chargedBytes: number;
69
+ readonly fingerprint: string;
70
+ readonly required: boolean;
71
+ readonly committedAt: number;
72
+ }
73
+ export interface CommunicationRecord {
74
+ readonly key: string;
75
+ readonly payload: Uint8Array;
76
+ readonly metadata: string | null;
77
+ readonly required: boolean;
78
+ readonly expiresAt: number | null;
79
+ readonly createdAt: number;
80
+ }
81
+ export interface CommunicationRecordSummary {
82
+ readonly key: string;
83
+ readonly payloadBytes: number;
84
+ readonly metadataBytes: number;
85
+ readonly chargedBytes: number;
86
+ readonly required: boolean;
87
+ readonly expiresAt: number | null;
88
+ readonly createdAt: number;
89
+ }
90
+ export interface CommunicationNamespaceStatus {
91
+ readonly namespace: string;
92
+ /** Durable rows plus prepaid row slots (two per live reservation). */
93
+ readonly recordCount: number;
94
+ /** Records + receipts + tombstones. */
95
+ readonly usedBytes: number;
96
+ /** Live reservations. */
97
+ readonly reservedBytes: number;
98
+ /** Payload + metadata bytes actually stored in records. */
99
+ readonly dataBytes: number;
100
+ readonly namespaceQuotaBytes: number;
101
+ readonly requiredReserveBytes: number;
102
+ readonly maxRecordsPerNamespace: number;
103
+ readonly requiredRowReserve: number;
104
+ readonly globalBudgetBytes: number;
105
+ readonly globalRequiredReserveBytes: number;
106
+ readonly globalUsedBytes: number;
107
+ readonly globalReservedBytes: number;
108
+ readonly globalMaxRows: number;
109
+ readonly globalRecordCount: number;
110
+ }
111
+ /**
112
+ * Same-connection raw mutator. Every method performs exactly one statement group
113
+ * and opens NO transaction of its own, so a caller can compose several writes
114
+ * into one atomic unit (either through {@link CommunicationNamespaceStore.transact}
115
+ * or from inside another store's transaction on the same database).
116
+ */
117
+ export interface CommunicationMutator {
118
+ get(key: string): CommunicationRecord | null;
119
+ /** Charges quota exactly like the public `put`, without opening a transaction. */
120
+ put(key: string, payload: Uint8Array, options: CommunicationRetention): CommunicationRecordSummary;
121
+ /** Removes a record (including a protected required one), without a transaction. */
122
+ ack(key: string): boolean;
123
+ list(limit?: number): readonly CommunicationRecordSummary[];
124
+ }
125
+ export interface CommunicationNamespaceStore {
126
+ readonly namespace: string;
127
+ get(key: string): CommunicationRecord | null;
128
+ /** Reserves `capacityBytes` of payload+metadata for a future commit under `id`. */
129
+ reserve(id: string, capacityBytes: number, options: CommunicationRetention): CommunicationReservation;
130
+ /** Consumes the reservation once; an idempotent retry must match the stored fingerprint exactly. */
131
+ commit(reservation: CommunicationReservation, key: string, payload: Uint8Array, metadata?: string | null): CommunicationReceipt;
132
+ /** Durable receipt for a committed id, or `null` when none exists. */
133
+ receipt(id: string): CommunicationReceipt | null;
134
+ cancel(id: string): boolean;
135
+ /** Atomic records-only write. Never creates a receipt or a replay id. */
136
+ put(key: string, payload: Uint8Array, options: CommunicationRetention): CommunicationRecordSummary;
137
+ delete(key: string): boolean;
138
+ /** Explicit host confirmation; removes even a protected required record. */
139
+ ack(key: string): boolean;
140
+ /**
141
+ * DANGEROUS host-only fence forget: releases a reservation, receipt, or
142
+ * tombstone so its id may be reused. Only call after an external
143
+ * expiry/sequence/caller fence proves the old operation can never replay;
144
+ * this method does NOT by itself make replay safe and is never exposed as a
145
+ * plugin context capability.
146
+ */
147
+ forceRelease(id: string): boolean;
148
+ collect(now: number, limit: number): number;
149
+ list(limit?: number): readonly CommunicationRecordSummary[];
150
+ status(): CommunicationNamespaceStatus;
151
+ /** Raw same-connection mutator; never opens a transaction. */
152
+ mutator(): CommunicationMutator;
153
+ /** Runs one composite mutation in a single immediate transaction. */
154
+ transact<Result>(run: (mutator: CommunicationMutator) => Result): Result;
155
+ }
156
+ export interface PluginCommunicationStoreOptions {
157
+ /** `false` skips schema creation for an already-initialized read-only reader. */
158
+ readonly setup?: boolean;
159
+ }
160
+ /** Owns the schema; hands out namespace-bound capabilities only. */
161
+ export declare class PluginCommunicationStore {
162
+ private readonly db;
163
+ private readonly limits;
164
+ constructor(db: Database, limits?: PluginCommunicationLimits, options?: PluginCommunicationStoreOptions);
165
+ forNamespace(plugin: string): CommunicationNamespaceStore;
166
+ }
@@ -0,0 +1,227 @@
1
+ import type { PluginServiceProcess, PluginServiceScope } from './contracts';
2
+ import { type InferRpcData, type RpcCallKind, type RpcCallPurpose, type RpcJson, type RpcMethodDefinition, type RpcServiceContract } from './wire-contract';
3
+ /** Deployment identity bound by the external host verifier's endpoint ref. */
4
+ export interface RpcEndpointBinding {
5
+ readonly endpoint: string;
6
+ readonly process: PluginServiceProcess;
7
+ readonly instance: string;
8
+ readonly generation: number;
9
+ readonly catalog: string;
10
+ readonly scope: PluginServiceScope;
11
+ readonly subject: string;
12
+ }
13
+ /** Logical call target, independent of the physical address and generation. */
14
+ export interface RpcInvokeTarget {
15
+ readonly provider: string;
16
+ readonly service: string;
17
+ readonly major: number;
18
+ readonly method: string;
19
+ }
20
+ /** Stable caller identity; the host admission callback decides authorization. */
21
+ export interface RpcCaller {
22
+ readonly subject: string;
23
+ readonly scope?: PluginServiceScope;
24
+ }
25
+ /** Opaque frozen capability minted by `register`; only a WeakMap-registered handle is accepted. */
26
+ export interface RpcEndpointHandle {
27
+ readonly __rpcEndpoint?: never;
28
+ }
29
+ /** Immutable admission input; the runtime snapshots and freezes these before calling `admit`. */
30
+ export interface RpcAdmissionRequest {
31
+ readonly target: RpcInvokeTarget;
32
+ readonly caller: RpcCaller;
33
+ /** Host-private concrete caller identity; never supplied by JSON or SDK call options. */
34
+ readonly callerToken?: object;
35
+ readonly purpose: RpcCallPurpose;
36
+ readonly operationId: string | null;
37
+ readonly commandAction?: RpcCommandAction;
38
+ }
39
+ export interface RpcAdmissionGrant<TCallee = unknown> {
40
+ readonly endpoint: RpcEndpointHandle;
41
+ readonly callee: TCallee;
42
+ /** Releases the real host lease; called exactly once per accepted or rejected attempt. */
43
+ readonly release: () => void;
44
+ /** Admission-owned lifetime identity also covers legacy internal calls without an input token. */
45
+ readonly callerToken?: object;
46
+ /** Trusted host permission for a bootstrap call to a registered-but-not-ready endpoint. */
47
+ readonly allowUnready?: boolean;
48
+ /** Host-verified existing request lease only; never enables new background work. */
49
+ readonly allowRetired?: boolean;
50
+ }
51
+ /** Must be synchronous: admission is atomic and checked on every request. */
52
+ export type RpcAdmission<TCallee = unknown> = (request: RpcAdmissionRequest) => RpcAdmissionGrant<TCallee> | null;
53
+ /** Process-local handler context; the signal is never serialized onto the wire. */
54
+ export interface RpcHandlerContext<TCallee = unknown> {
55
+ readonly endpoint: Readonly<RpcEndpointBinding & {
56
+ readonly service: string;
57
+ readonly version: number;
58
+ }>;
59
+ readonly caller: Readonly<RpcCaller>;
60
+ readonly method: string;
61
+ readonly kind: RpcCallKind;
62
+ readonly purpose: RpcCallPurpose;
63
+ readonly operationId: string | null;
64
+ readonly signal: AbortSignal;
65
+ readonly callee: TCallee;
66
+ /** Actual bounded invocation deadline, including caller and runtime limits. */
67
+ readonly deadlineAt?: number;
68
+ }
69
+ /** Derives typed handler signatures from a literal contract. */
70
+ export type RpcHandlerMap<M extends Record<string, RpcMethodDefinition>, TCallee = unknown> = {
71
+ readonly [K in keyof M]: (input: InferRpcData<M[K]['input']>, context: RpcHandlerContext<TCallee>) => InferRpcData<M[K]['output']> | Promise<InferRpcData<M[K]['output']>>;
72
+ };
73
+ export interface RpcCommandExecution<TCallee = unknown> {
74
+ readonly contract: RpcServiceContract;
75
+ readonly method: string;
76
+ readonly definition: RpcMethodDefinition;
77
+ readonly context: RpcHandlerContext<TCallee>;
78
+ readonly operationId: string;
79
+ readonly input: RpcJson;
80
+ /** Starts the real provider logic once; a repeated call returns the same promise. */
81
+ readonly executeBusiness: () => Promise<RpcJson>;
82
+ }
83
+ /**
84
+ * Host capability and the ONLY execution path for commands. This kernel invokes `execute` once
85
+ * and never retries. Durable deduplication, transactions, and cross-system exactly-once behavior
86
+ * are NOT implemented here: the P4 journal/CommandExecutor integration is still pending wiring.
87
+ */
88
+ export interface RpcCommandExecutor<TCallee = unknown> {
89
+ execute(execution: RpcCommandExecution<TCallee>): Promise<unknown>;
90
+ queryResult?(execution: Omit<RpcCommandExecution<TCallee>, 'executeBusiness'>): Promise<unknown>;
91
+ reconcile?(execution: Omit<RpcCommandExecution<TCallee>, 'executeBusiness'>): Promise<unknown>;
92
+ }
93
+ export type RpcCommandAction = 'execute' | 'query-result' | 'reconcile';
94
+ export type RpcInvocationErrorCode = 'unauthorized' | 'not_ready' | 'retired' | 'revoked' | 'unsupported_method' | 'wrong_purpose' | 'invalid_input' | 'invalid_output' | 'invalid_operation_id' | 'overloaded' | 'cancelled' | 'timeout' | 'unknown' | 'capability_unavailable' | 'closed' | 'failed' | 'conflict' | 'expired' | 'pending' | 'rejected' | 'missing' | 'storage_failure' | 'deadlock' | 'call_depth_exceeded';
95
+ /**
96
+ * Fixed-code error. It never stores a provider/admit cause, message, or payload: the code and
97
+ * the validated invocation's operation id are the only external data. Hosts log the original
98
+ * exception separately.
99
+ */
100
+ export declare class RpcInvocationError extends Error {
101
+ readonly name = "RpcInvocationError";
102
+ readonly code: RpcInvocationErrorCode;
103
+ readonly operationId: string | null;
104
+ constructor(code: RpcInvocationErrorCode, operationId?: string | null);
105
+ }
106
+ export interface RpcRuntimeLimits {
107
+ readonly maxEndpoints?: number;
108
+ readonly globalMaxInFlight?: number;
109
+ readonly endpointMaxInFlight?: number;
110
+ readonly callerMaxInFlight?: number;
111
+ readonly maxWaiters?: number;
112
+ readonly hardDeadlineMs?: number;
113
+ readonly drainTimeoutMs?: number;
114
+ }
115
+ export interface RpcInvokeRequest {
116
+ readonly target: RpcInvokeTarget;
117
+ readonly caller: RpcCaller;
118
+ /** Host-private lifetime identity, separate from the journal's stable logical caller. */
119
+ readonly callerToken?: object;
120
+ readonly purpose: RpcCallPurpose;
121
+ readonly input: unknown;
122
+ readonly operationId?: string | null;
123
+ readonly signal?: AbortSignal;
124
+ readonly timeoutMs?: number;
125
+ /** Host-owned absolute upper bound; never recomputed from a remaining duration. */
126
+ readonly deadlineAt?: number;
127
+ /** Narrower caller/parent header budget, combined with the method input limit. */
128
+ readonly maxInputBytes?: number;
129
+ /** Command control actions use the same target authorization, lease and deadline. */
130
+ readonly commandAction?: RpcCommandAction;
131
+ }
132
+ export interface RpcRuntimeStatus {
133
+ readonly closed: boolean;
134
+ readonly active: number;
135
+ readonly endpoints: number;
136
+ readonly waiters: number;
137
+ }
138
+ export interface RpcDrainResult {
139
+ readonly drained: boolean;
140
+ readonly active: number;
141
+ }
142
+ export interface RpcDisposeResult {
143
+ readonly disposed: boolean;
144
+ readonly active: number;
145
+ }
146
+ export interface RpcRuntimeOptions<TCallee = unknown> {
147
+ readonly admit: RpcAdmission<TCallee>;
148
+ readonly commandExecutor?: RpcCommandExecutor<TCallee>;
149
+ readonly hostLifetime?: AbortSignal;
150
+ readonly limits?: RpcRuntimeLimits;
151
+ }
152
+ /** Host transport only. A rejected terminal promise never proves remote work ended. */
153
+ export interface RpcProxyExecution {
154
+ readonly result: Promise<unknown>;
155
+ readonly terminal: Promise<void>;
156
+ }
157
+ export interface RpcProxyRequest<TCallee = unknown> {
158
+ readonly method: string;
159
+ readonly input: RpcJson;
160
+ readonly context: RpcHandlerContext<TCallee>;
161
+ readonly commandAction?: RpcCommandAction;
162
+ }
163
+ export type RpcProxyExecutor<TCallee = unknown> = (request: RpcProxyRequest<TCallee>) => RpcProxyExecution;
164
+ export declare class RpcServiceRuntime<TCallee = unknown> {
165
+ #private;
166
+ constructor(options: RpcRuntimeOptions<TCallee>);
167
+ /** Validates contract+handler, binds deployment identity, returns the opaque host-owned capability. */
168
+ register<const M extends Record<string, RpcMethodDefinition>>(options: {
169
+ readonly provider: string;
170
+ readonly binding: RpcEndpointBinding;
171
+ readonly contract: {
172
+ readonly id: string;
173
+ readonly version: number;
174
+ readonly methods: M;
175
+ };
176
+ readonly handler: RpcHandlerMap<M, TCallee>;
177
+ }): RpcEndpointHandle;
178
+ /** Remote commands execute their journal at the provider, never again at this proxy. */
179
+ registerProxy<const M extends Record<string, RpcMethodDefinition>>(options: {
180
+ readonly provider: string;
181
+ readonly binding: RpcEndpointBinding;
182
+ readonly contract: {
183
+ readonly id: string;
184
+ readonly version: number;
185
+ readonly methods: M;
186
+ };
187
+ readonly execute: RpcProxyExecutor<TCallee>;
188
+ }): RpcEndpointHandle;
189
+ markReady(handle: RpcEndpointHandle): boolean;
190
+ /** Stops new admissions immediately; already-accepted calls keep their lease until they finish. */
191
+ retire(handle: RpcEndpointHandle): boolean;
192
+ /** Rejects the old reference and settles in-flight callers; late replies are never delivered. */
193
+ revoke(handle: RpcEndpointHandle): boolean;
194
+ /** Host-only entire-endpoint drain/verified peer exit proof. A single-call ACK must NOT use this. */
195
+ confirmProxyEndpointStopped(handle: RpcEndpointHandle): boolean;
196
+ /** Small internal status; never exposed through a handler context. */
197
+ status(): RpcRuntimeStatus;
198
+ /**
199
+ * Read-only registered metadata for an endpoint handle owned by this runtime. It exposes
200
+ * only the immutable provider/binding/contract clone and never the handler, owner resource, or
201
+ * caller context. Foreign, forged, and released handles return null. Revoked but still-active
202
+ * records retain metadata until real work drains; admission still rejects their revocation.
203
+ */
204
+ endpointInfo(handle: RpcEndpointHandle): Readonly<{
205
+ readonly provider: string;
206
+ readonly binding: Readonly<RpcEndpointBinding>;
207
+ readonly contract: RpcServiceContract;
208
+ }> | null;
209
+ /** Bounded wait; a timeout reports the real active count and never claims disposal. */
210
+ drain(handle: RpcEndpointHandle, options?: {
211
+ readonly timeoutMs?: number;
212
+ }): Promise<RpcDrainResult>;
213
+ /** Canonical owner disposal also joins calls issued by owners without publications. */
214
+ drainOwner(callerSubject: string, handles: readonly RpcEndpointHandle[], options?: {
215
+ readonly timeoutMs?: number;
216
+ readonly callerToken?: object;
217
+ }): Promise<RpcDrainResult>;
218
+ /** Revocation settles callers but still retains actual work, capacity and leases. */
219
+ revokeCaller(callerSubject: string, callerToken?: object): void;
220
+ /** Closes admission, aborts callers, and bounded-joins real work without faking success. */
221
+ dispose(options?: {
222
+ readonly timeoutMs?: number;
223
+ }): Promise<RpcDisposeResult>;
224
+ invoke(request: RpcInvokeRequest): Promise<RpcJson>;
225
+ /** Host receiver obtains actual completion evidence, not merely the caller reply. */
226
+ invokeTracked(request: RpcInvokeRequest): RpcProxyExecution;
227
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Host-managed persistent atomic snapshot version store.
3
+ *
4
+ * A provider plugin (e.g. the future models-dev directory) gets versioned,
5
+ * immutable, digest-addressed snapshot bodies with bounded retention WITHOUT
6
+ * inventing its own chunking or widening the 1 MiB durable-command limit: the
7
+ * body is stored as bounded chunks in the host `plugin_communication_records`
8
+ * table (the audited v14 schema; no new table, no runtime DDL), and the version
9
+ * becomes visible atomically by flipping its meta + the current pointer.
10
+ *
11
+ * Durability/atomicity contract:
12
+ * - chunks are written first; a version is INVISIBLE until its meta row exists,
13
+ * so a crash mid-write leaves only unreachable chunks (reclaimed by `collect`);
14
+ * - the current pointer is flipped last, so a reader never observes a half-written
15
+ * body as current;
16
+ * - a returned source keeps the exact descriptor fixed and can `retain()`/`release()`
17
+ * the version; a retained version is never reclaimed, so an in-flight whole-body
18
+ * read can never have its bytes swapped or freed underneath it;
19
+ * - retention is explicit and bounded (`maxVersions`, `maxBytes`), and GC never
20
+ * touches the current version, a retained version, or a version whose chunks
21
+ * are still referenced.
22
+ */
23
+ import type { ChannelSnapshotDescriptor } from './peer-channel-protocol';
24
+ import type { PluginChannelSnapshotSource } from './peer-channel-hub';
25
+ import type { CommunicationNamespaceStore } from './persistence';
26
+ export interface HostSnapshotStoreOptions {
27
+ /** Descriptor owner identity (usually the providing plugin name). */
28
+ readonly owner: string;
29
+ /**
30
+ * Immutable version-family id declared by the provider. Two `store()` calls
31
+ * with the same id share ONE durable family (current pointer, version index,
32
+ * retention, pins); a different id is a completely separate family. It is part
33
+ * of the persistent identity, so the same family is readable again after a
34
+ * process restart.
35
+ */
36
+ readonly id?: string;
37
+ /** Runtime generation of the owner; part of the immutable descriptor. */
38
+ readonly epoch?: number;
39
+ readonly schemaVersion: number;
40
+ readonly chunkBytes?: number;
41
+ /** Retained versions, including the current one. */
42
+ readonly maxVersions?: number;
43
+ /** Bounded total retained body bytes. */
44
+ readonly maxBytes?: number;
45
+ }
46
+ /**
47
+ * One namespace-isolated, atomically published version family. The store never
48
+ * exposes its keys, connection, or any other namespace.
49
+ */
50
+ export declare class HostSnapshotStore {
51
+ #private;
52
+ constructor(store: CommunicationNamespaceStore, options: HostSnapshotStoreOptions);
53
+ /**
54
+ * Atomically publishes one immutable version. Returns the fixed descriptor, or
55
+ * throws (quota/corruption) — a partially written version is never visible.
56
+ */
57
+ publish(version: number, body: unknown | Uint8Array): ChannelSnapshotDescriptor;
58
+ /** Post-commit GC failure cannot turn a durable publication into a failed publish. */
59
+ maintain(): {
60
+ readonly removed: number;
61
+ readonly error: string | null;
62
+ };
63
+ maintenanceStatus(): {
64
+ readonly pending: boolean;
65
+ readonly error: string | null;
66
+ };
67
+ /** Source for the current version, or `null` when none was published. */
68
+ current(): PluginChannelSnapshotSource | null;
69
+ /** Source for one explicitly named, still-retained version. */
70
+ version(version: number): PluginChannelSnapshotSource | null;
71
+ /**
72
+ * Bounded GC in ONE transaction: drops the oldest unreferenced, non-current
73
+ * versions until both the version count and the total byte budget fit. Never
74
+ * touches a version a live read has retained, and never the current version.
75
+ */
76
+ collect(): number;
77
+ }
@@ -0,0 +1,158 @@
1
+ export type RpcCallKind = 'query' | 'command';
2
+ export type RpcCallPurpose = 'bootstrap' | 'background' | 'management' | 'request' | 'attempt';
3
+ export type RpcCommandDeduplication = 'local-transaction' | 'external-contract' | 'none';
4
+ /** Declared intent only; the host owns the actual transaction and retention. */
5
+ export interface RpcCommandPolicy {
6
+ readonly deduplication: RpcCommandDeduplication;
7
+ /**
8
+ * `null` means the result is retained permanently and durably: it survives a
9
+ * restart and is never recomputed. A positive number is a retention window in
10
+ * milliseconds. Retention is a host/storage concern; this is declaration only.
11
+ */
12
+ readonly resultRetentionMs: number | null;
13
+ readonly quotaBytes: number;
14
+ readonly maxResultBytes: number;
15
+ }
16
+ /** Pure JSON: null, boolean, finite number, string, arrays, and plain records. */
17
+ export type RpcJson = null | boolean | number | string | readonly RpcJson[] | {
18
+ readonly [key: string]: RpcJson;
19
+ };
20
+ /**
21
+ * Data schema DSL. `object` rejects unknown fields, `optional` lists real
22
+ * optional keys, and `json` carries an optional explicit byte bound (default:
23
+ * the RPC envelope).
24
+ */
25
+ export type RpcDataSchema = {
26
+ readonly type: 'string';
27
+ readonly minLength?: number;
28
+ readonly maxLength?: number;
29
+ } | {
30
+ readonly type: 'number';
31
+ readonly integer?: boolean;
32
+ readonly minimum?: number;
33
+ readonly maximum?: number;
34
+ } | {
35
+ readonly type: 'boolean';
36
+ } | {
37
+ readonly type: 'null';
38
+ } | {
39
+ readonly type: 'literal';
40
+ readonly value: RpcJson;
41
+ } | {
42
+ readonly type: 'array';
43
+ readonly items: RpcDataSchema;
44
+ readonly maxItems?: number;
45
+ } | {
46
+ readonly type: 'object';
47
+ readonly properties: {
48
+ readonly [key: string]: RpcDataSchema;
49
+ };
50
+ readonly optional?: readonly string[];
51
+ } | {
52
+ readonly type: 'record';
53
+ readonly values: RpcDataSchema;
54
+ readonly maxEntries?: number;
55
+ } | {
56
+ readonly type: 'union';
57
+ readonly variants: readonly RpcDataSchema[];
58
+ } | {
59
+ readonly type: 'json';
60
+ readonly maxBytes?: number;
61
+ };
62
+ /** Flattens intersections so optional modifiers survive as real optional keys. */
63
+ type Simplify<T> = {
64
+ [K in keyof T]: T[K];
65
+ };
66
+ type OptionalNames<S> = S extends {
67
+ readonly optional: readonly (infer K extends string)[];
68
+ } ? K : never;
69
+ type InferObject<P extends Record<string, RpcDataSchema>, O extends string> = Simplify<{
70
+ [K in keyof P as K extends O ? never : K]: InferRpcData<P[K]>;
71
+ } & {
72
+ [K in Extract<keyof P, O>]?: InferRpcData<P[K]>;
73
+ }>;
74
+ /** Derives the TypeScript type described by a `RpcDataSchema`. */
75
+ export type InferRpcData<S> = RpcDataSchema extends S ? RpcJson : S extends {
76
+ readonly type: 'string';
77
+ } ? string : S extends {
78
+ readonly type: 'number';
79
+ } ? number : S extends {
80
+ readonly type: 'boolean';
81
+ } ? boolean : S extends {
82
+ readonly type: 'null';
83
+ } ? null : S extends {
84
+ readonly type: 'literal';
85
+ readonly value: infer V extends RpcJson;
86
+ } ? V : S extends {
87
+ readonly type: 'json';
88
+ } ? RpcJson : S extends {
89
+ readonly type: 'array';
90
+ readonly items: infer I extends RpcDataSchema;
91
+ } ? InferRpcData<I>[] : S extends {
92
+ readonly type: 'record';
93
+ readonly values: infer V extends RpcDataSchema;
94
+ } ? {
95
+ [key: string]: InferRpcData<V>;
96
+ } : S extends {
97
+ readonly type: 'union';
98
+ readonly variants: infer VS;
99
+ } ? VS extends readonly (infer V extends RpcDataSchema)[] ? InferRpcData<V> : never : S extends {
100
+ readonly type: 'object';
101
+ readonly properties: infer P extends Record<string, RpcDataSchema>;
102
+ } ? InferObject<P, OptionalNames<S>> : never;
103
+ export interface RpcMethodDefinition {
104
+ readonly kind: RpcCallKind;
105
+ readonly input: RpcDataSchema;
106
+ readonly output: RpcDataSchema;
107
+ readonly purposes: readonly RpcCallPurpose[];
108
+ readonly timeoutMs?: number;
109
+ readonly maxInputBytes?: number;
110
+ readonly maxOutputBytes?: number;
111
+ readonly command?: RpcCommandPolicy;
112
+ }
113
+ export interface RpcServiceContract<M extends Record<string, RpcMethodDefinition> = Record<string, RpcMethodDefinition>> {
114
+ readonly id: string;
115
+ readonly version: number;
116
+ readonly methods: M;
117
+ }
118
+ export declare const RPC_JSON_MAX_BYTES: number;
119
+ /** Metadata contract/schema inputs are pure JSON and bounded well below the envelope. */
120
+ export declare const RPC_CONTRACT_MAX_BYTES: number;
121
+ export type RpcProtocolErrorCode = 'invalid_data' | 'size_limit' | 'invalid_contract';
122
+ /** Fixed-code error. It never carries payload, secrets, keys, or arbitrary objects. */
123
+ export declare class RpcProtocolError extends Error {
124
+ readonly code: RpcProtocolErrorCode;
125
+ readonly name = "RpcProtocolError";
126
+ constructor(code: RpcProtocolErrorCode, message: string);
127
+ }
128
+ /**
129
+ * Serializes a pure-JSON value under a UTF-8 byte bound. Oversized values are
130
+ * rejected by the running budget before a large clone is built. `maxBytes` may
131
+ * be raised for independent, larger data channels; the default stays the control
132
+ * envelope limit.
133
+ */
134
+ export declare function encodeRpcJson(value: unknown, maxBytes?: number): string;
135
+ /** Deterministic encoding for signed RPC metadata, retaining every legal JSON key. */
136
+ export declare function encodeCanonicalRpcJson(value: unknown, maxBytes?: number): string;
137
+ /** Parses strict, bounded pure JSON. Non-finite numbers and lone surrogates are rejected. */
138
+ export declare function decodeRpcJson(text: string, maxBytes?: number): RpcJson;
139
+ /**
140
+ * Asserts a runtime value matches the schema. The whole value is first cloned
141
+ * into bounded pure JSON without invoking accessors, then validated. Throws
142
+ * `RpcProtocolError` with `invalid_data` (value) or `invalid_contract` (malformed
143
+ * schema).
144
+ */
145
+ /** Validates a standalone data schema (lane contract registration) without a value. */
146
+ export declare function assertRpcDataSchema(schema: RpcDataSchema): void;
147
+ export declare function assertRpcData<S extends RpcDataSchema>(schema: S, value: unknown, maxBytes?: number): asserts value is InferRpcData<S>;
148
+ /**
149
+ * Validates a service contract and returns a deep-frozen pure clone. The caller's
150
+ * objects are never read through accessors, never frozen, and never modified;
151
+ * `methods` keeps its literal types so clients can derive call signatures.
152
+ */
153
+ export declare function defineRpcService<const M extends Record<string, RpcMethodDefinition>>(contract: {
154
+ readonly id: string;
155
+ readonly version: number;
156
+ readonly methods: M;
157
+ }): RpcServiceContract<M>;
158
+ export {};