@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,66 @@
1
+ import type { AdmissionTarget, AdmissionDenial } from '../plugin-extensions';
2
+ import type { DurableJson } from '../plugin-durable-state';
3
+ import type { AttemptObservationEvent, AttemptObservationOutcome } from '../hooks/plugin-hooks';
4
+ export interface PreparedAdmissionAttempt {
5
+ readonly denial?: AdmissionDenial;
6
+ observeResponse?(event: AttemptObservationEvent): Promise<void>;
7
+ onResult?(result: {
8
+ sent: boolean;
9
+ outcome: AttemptObservationOutcome;
10
+ }): Promise<void>;
11
+ cancel?(): Promise<void>;
12
+ }
13
+ export interface WorkerAdmissionPlugin {
14
+ readonly pluginName: string;
15
+ resolveAdmissionModel?(input: {
16
+ url: string;
17
+ body: unknown;
18
+ }): string | null;
19
+ prepareAdmissionAttempt?(input: {
20
+ target: AdmissionTarget;
21
+ snapshot: DurableJson;
22
+ body: unknown;
23
+ callBudget(method: string, payload: unknown): Promise<unknown>;
24
+ }): Promise<PreparedAdmissionAttempt>;
25
+ }
26
+ type Rpc = (operation: string, payload: unknown, signal?: AbortSignal) => Promise<unknown>;
27
+ export type RequestLogAdmissionStage = 'signal-created' | 'signal-aborted' | 'rpc-sign-begin' | 'rpc-sign-end' | 'rpc-fetch-begin' | 'rpc-fetch-end' | 'rpc-body-begin' | 'rpc-body-end' | 'rpc-verify-begin' | 'rpc-verify-end' | 'rpc-end';
28
+ export type RequestLogAdmissionTrace = (stage: RequestLogAdmissionStage, signal?: AbortSignal) => void;
29
+ export declare function emitRequestLogAdmissionTrace(trace: RequestLogAdmissionTrace | undefined, stage: RequestLogAdmissionStage, signal?: AbortSignal): void;
30
+ export interface WorkerAdmissionSession {
31
+ admission: Rpc;
32
+ requestLogActive?: (trace?: RequestLogAdmissionTrace) => Promise<boolean>;
33
+ }
34
+ export declare function setWorkerAdmissionSession(value: WorkerAdmissionSession | null): void;
35
+ export declare function hasWorkerAdmissionSession(): boolean;
36
+ export type RequestLogAdmissionRejection = 'ingress-false' | 'rpc-timeout' | 'rpc-error';
37
+ export declare function canStartRequestLogOperation(onRejected?: (reason: RequestLogAdmissionRejection) => void, trace?: RequestLogAdmissionTrace): Promise<boolean>;
38
+ export declare class WorkerRequestAdmission {
39
+ private readonly plugins;
40
+ private readonly targetBase;
41
+ private readonly invokeBudget;
42
+ private grant;
43
+ private admittedBody;
44
+ constructor(plugins: readonly WorkerAdmissionPlugin[], targetBase: Omit<AdmissionTarget, 'attemptId' | 'upstreamId' | 'url' | 'model' | 'now'>, invokeBudget: (plugin: string, method: string, payload: unknown, target: AdmissionTarget) => Promise<unknown>);
45
+ /** Access and transport capability checks without planning, admission or budget reservation. */
46
+ inspect(input: {
47
+ attemptId: string;
48
+ upstreamId: string;
49
+ url: string;
50
+ model: string | null;
51
+ body: unknown;
52
+ transport?: 'websocket';
53
+ serviceId?: string | null;
54
+ }, signal: AbortSignal): Promise<void>;
55
+ prepare(input: {
56
+ attemptId: string;
57
+ upstreamId: string;
58
+ url: string;
59
+ model: string | null;
60
+ body: unknown;
61
+ transport?: 'websocket';
62
+ serviceId?: string | null;
63
+ }, signal: AbortSignal, loadBody?: () => Promise<unknown>): Promise<PreparedAdmissionAttempt[]>;
64
+ release(): Promise<void>;
65
+ }
66
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { Database } from 'bun:sqlite';
2
+ export declare function databaseSchemaDescriptor(db: Database): string;
@@ -0,0 +1,33 @@
1
+ export interface ExpressionContext {
2
+ headers: Record<string, string>;
3
+ body: any;
4
+ /** 最终出站请求;在响应求值期间保持请求方向。 */
5
+ request?: {
6
+ headers: Record<string, string>;
7
+ body?: any;
8
+ };
9
+ /** 仅在响应阶段提供。 */
10
+ response?: {
11
+ headers: Record<string, string>;
12
+ body?: any;
13
+ };
14
+ url: {
15
+ pathname: string;
16
+ search: string;
17
+ host: string;
18
+ protocol: string;
19
+ };
20
+ method: string;
21
+ env: Record<string, string>;
22
+ stream?: {
23
+ phase: string;
24
+ chunkIndex: number;
25
+ };
26
+ }
27
+ export declare function evaluateExpression(expression: string, context: ExpressionContext): any;
28
+ export declare function processDynamicValue(value: any, context: ExpressionContext): any;
29
+ export declare function clearExpressionCache(): void;
30
+ export declare function getCacheStats(): {
31
+ size: number;
32
+ keys: string[];
33
+ };
@@ -0,0 +1,7 @@
1
+ import type { Plugin, PluginHooks } from '@jeffusion/bungee-core/plugin';
2
+ export declare class AdmissionPlugin implements Plugin {
3
+ bodyRequirements(): {
4
+ request: "none";
5
+ };
6
+ register(hooks: PluginHooks): void;
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { AppConfig, RouteConfig } from '@jeffusion/bungee-types';
2
+ import type { GatewayAuxiliaryIdentity, GatewayAuxiliaryRequest, GatewayAuxiliaryResult } from './contracts';
3
+ import type { HandleRequestRuntimeContext } from './request-plugin';
4
+ /** Partition by actual outbound credentials and account selectors; request-body account claims never establish identity. */
5
+ export declare function auxiliaryCredentialIdentity(headers: Headers, model: string, upstreamId: string, managedCredentials?: readonly string[]): GatewayAuxiliaryIdentity;
6
+ /** Bound by the host to a single parent and frozen serving configuration. */
7
+ export declare function executeAuxiliaryRequest(parent: Request, config: AppConfig, _entry: RouteConfig, runtime: HandleRequestRuntimeContext | undefined, input: GatewayAuxiliaryRequest, signal: AbortSignal, targets: readonly import('./contracts').GatewayDispatchTarget[]): Promise<GatewayAuxiliaryResult>;
@@ -0,0 +1,39 @@
1
+ /** A representation changes whenever a hook or rule rewrites its bytes. */
2
+ export interface BodyViewIdentity {
3
+ readonly requestId: string;
4
+ readonly attemptId: string;
5
+ readonly direction: 'request' | 'response';
6
+ readonly stage: 'original-request' | 'outbound-request' | 'upstream-response' | 'client-response';
7
+ readonly version: number;
8
+ readonly contentType: string;
9
+ readonly contentEncoding: string;
10
+ }
11
+ export interface BodyConsumer {
12
+ readonly id: string;
13
+ readonly mandatory?: boolean;
14
+ readonly signal?: AbortSignal;
15
+ readonly backlogBytes?: number;
16
+ readonly backlogEvents?: number;
17
+ }
18
+ export interface BodyEvent {
19
+ /** Captured when the shared framer produces the event, before subscriber queues. */
20
+ readonly observedAtMonotonicMs?: number;
21
+ readonly data: string;
22
+ readonly hasData?: boolean;
23
+ readonly json?: unknown;
24
+ readonly event?: string;
25
+ readonly id?: string;
26
+ readonly retry?: string;
27
+ readonly comments?: string[];
28
+ readonly raw?: string;
29
+ readonly truncated?: boolean;
30
+ }
31
+ /** Byte arrays are borrowed read-only views. Writers must create a new representation. */
32
+ export interface BodyHandle {
33
+ readonly identity: Readonly<BodyViewIdentity>;
34
+ readonly maxBytes: number;
35
+ bytes(consumer?: BodyConsumer): Promise<Uint8Array>;
36
+ decoded(consumer?: BodyConsumer): Promise<Uint8Array>;
37
+ json(consumer?: BodyConsumer, emptyObject?: boolean): Promise<unknown>;
38
+ events(consumer?: BodyConsumer): AsyncIterable<BodyEvent>;
39
+ }
@@ -0,0 +1,58 @@
1
+ import type { BodyConsumer, BodyEvent } from './body-contracts';
2
+ export declare function bodyEventByteOffset(event: BodyEvent): number | undefined;
3
+ export declare class BodySSEFramer {
4
+ readonly configuredMax: number | (() => number);
5
+ readonly emit: (event: BodyEvent, bytes: number) => void;
6
+ readonly observeTime: boolean;
7
+ readonly trackByteOffsets?: (() => boolean) | undefined;
8
+ private offset;
9
+ private text;
10
+ private raw;
11
+ private data;
12
+ private event;
13
+ private id;
14
+ private retry;
15
+ private comments;
16
+ private count;
17
+ private tail;
18
+ private firstLine;
19
+ private decoder;
20
+ constructor(configuredMax: number | (() => number), emit: (event: BodyEvent, bytes: number) => void, observeTime?: boolean, trackByteOffsets?: (() => boolean) | undefined);
21
+ get maxBytes(): number;
22
+ private line;
23
+ get retainedBytes(): number;
24
+ feed(bytes: Uint8Array): void;
25
+ private consume;
26
+ finish(retainTail?: boolean): void;
27
+ }
28
+ /** A single decoder/framer fans out borrowed frame references to isolated bounded subscribers. */
29
+ export declare class BodyEventSession {
30
+ readonly coding: string;
31
+ maxBytes: number;
32
+ readonly decodedChunk?: ((chunk: Uint8Array) => void) | undefined;
33
+ readonly decodedEnd?: (() => void) | undefined;
34
+ readonly fromWireStart: boolean;
35
+ private chunks;
36
+ private wireLease;
37
+ private wake?;
38
+ private eof;
39
+ private ended;
40
+ private error?;
41
+ private subscribers;
42
+ private work;
43
+ private decodedStream?;
44
+ private pendingLease?;
45
+ private readonly decodeAbort;
46
+ private cancelled;
47
+ private missingWireBytes;
48
+ constructor(coding: string, maxBytes: number, decodedChunk?: ((chunk: Uint8Array) => void) | undefined, decodedEnd?: (() => void) | undefined, fromWireStart?: boolean);
49
+ get completion(): Promise<void>;
50
+ push(chunk: Uint8Array): void;
51
+ end(error?: unknown): void;
52
+ cancel(error: unknown): void;
53
+ private stopIfIdle;
54
+ private release;
55
+ private clear;
56
+ private publish;
57
+ events(consumer?: BodyConsumer, drainOnCancel?: boolean): AsyncIterable<BodyEvent>;
58
+ }
@@ -0,0 +1,4 @@
1
+ import type { GatewayBodyArguments } from './contracts';
2
+ import type { BodySource } from './body-service';
3
+ /** Uses the request's captured registry; no separate container or async initialization. */
4
+ export declare function createBodySource(...args: GatewayBodyArguments): BodySource;
@@ -0,0 +1,6 @@
1
+ import type { ByteObservation } from '../worker/response/attempt-observation';
2
+ import type { TransportOutcome } from '../logger/transport-outcome';
3
+ /** Install a tap without starting a pipe pump. Only the final reader advances wire bytes. */
4
+ export declare function observeBodyStream(source: ReadableStream<Uint8Array>, observer: ByteObservation): ReadableStream<Uint8Array>;
5
+ /** No decoding, prefetching or protocol inference; preserves consumer backpressure. */
6
+ export declare function observeTransportResponse(response: Response, signal: AbortSignal, record: (outcome: TransportOutcome, code?: string, committedBodyBytes?: number) => void, failureCode?: () => string | undefined): Response;
@@ -0,0 +1,8 @@
1
+ import type { Plugin, PluginHooks } from '@jeffusion/bungee-core/plugin';
2
+ /** The only production constructor. Ownership and decoding remain in BodySource. */
3
+ export declare class BodyServicePlugin implements Plugin {
4
+ bodyRequirements(): {
5
+ request: "none";
6
+ };
7
+ register(hooks: PluginHooks): void;
8
+ }
@@ -0,0 +1,37 @@
1
+ export declare const DEFAULT_BODY_PARSER_BYTES: number;
2
+ /** Worker budgets, never a per-request business size limit. */
3
+ export declare const bodyResources: Readonly<{
4
+ workerMemoryBytes: number;
5
+ optionalMemoryBytes: number;
6
+ observerBacklogBytes: number;
7
+ observerBacklogEvents: number;
8
+ mandatoryDecoders: number;
9
+ optionalDecoders: number;
10
+ loggerMemoryBytes: number;
11
+ loggerConsumers: number;
12
+ callbackMs: number;
13
+ optionalDecodeMs: number;
14
+ zstdWindowLog: number;
15
+ }>;
16
+ export declare const bodyMetrics: {
17
+ retainedBytes: number;
18
+ optionalBytes: number;
19
+ loggerBytes: number;
20
+ peakBytes: number;
21
+ activeDecoders: number;
22
+ activeOptionalDecoders: number;
23
+ decompressions: number;
24
+ jsonParses: number;
25
+ sseParses: number;
26
+ };
27
+ export declare function snapshotBodyResources(): {
28
+ retainedBytes: number;
29
+ optionalBytes: number;
30
+ loggerBytes: number;
31
+ peakBytes: number;
32
+ activeDecoders: number;
33
+ activeOptionalDecoders: number;
34
+ decompressions: number;
35
+ jsonParses: number;
36
+ sseParses: number;
37
+ };
@@ -0,0 +1,116 @@
1
+ export declare function getBodyProcessingDiagnosticCause(error: BodyProcessingError): unknown;
2
+ export declare class BodyProcessingError extends Error {
3
+ readonly status: number;
4
+ readonly code: string;
5
+ readonly limitBytes?: number | undefined;
6
+ readonly receivedBytes?: number | undefined;
7
+ constructor(status: number, code: string, limitBytes?: number | undefined, receivedBytes?: number | undefined);
8
+ static wrap(status: number, code: string, cause: unknown): BodyProcessingError;
9
+ }
10
+ import type { BodyConsumer, BodyHandle, BodyViewIdentity } from './body-contracts';
11
+ export declare function bodySourceForHandle(handle: BodyHandle): BodySource | undefined;
12
+ /** Cancellation belongs to the reader owner and remains observable until the source settles. */
13
+ export declare function cancelBodyReader(reader: ReadableStreamDefaultReader<Uint8Array>, reason?: unknown): Promise<void>;
14
+ export declare function bindBodySource(stream: ReadableStream<Uint8Array>, source: BodySource): void;
15
+ export declare function bodySourceFor(stream: ReadableStream<Uint8Array>): BodySource | undefined;
16
+ export declare function bindBodyObservationSource(stream: ReadableStream<Uint8Array>, source: BodySource): void;
17
+ export declare function bodyObservationSourceFor(stream: ReadableStream<Uint8Array>): BodySource | undefined;
18
+ /** One accounting lease per retained allocation, shared references do not reserve twice. */
19
+ export declare class BodyBufferLease {
20
+ private optional;
21
+ private logging;
22
+ private bytes;
23
+ constructor(optional?: boolean, logging?: boolean);
24
+ promote(): void;
25
+ add(bytes: number): void;
26
+ release(bytes: number): void;
27
+ dispose(): void;
28
+ }
29
+ export declare function freezeBodyValue<T>(root: T): T;
30
+ export declare const defaultBodyIdentity: BodyViewIdentity;
31
+ export declare function isJsonMediaType(value: string): boolean;
32
+ export declare function isObjectBody(value: unknown): value is Record<string, any>;
33
+ /** Single wire owner and computation cache for one immutable representation. */
34
+ export declare class BodySource {
35
+ maxBytes: number;
36
+ readonly coding: string;
37
+ signal?: AbortSignal | undefined;
38
+ readonly identity: BodyViewIdentity;
39
+ private source;
40
+ private bytes?;
41
+ private output?;
42
+ private bufferPromise?;
43
+ private jsonPromise?;
44
+ private mutableJSON?;
45
+ private decodedPromise?;
46
+ private eventsPromise?;
47
+ private eventSession?;
48
+ private eventDecoded;
49
+ private eventDecodedSize;
50
+ private eventDecodedLease;
51
+ private lease;
52
+ private consumed;
53
+ private disposed;
54
+ private mandatory;
55
+ private mandatoryConsumers;
56
+ private activeConsumers;
57
+ private lifecycle;
58
+ private wireReader?;
59
+ private wireCancellation?;
60
+ private wireError?;
61
+ private wireController?;
62
+ private optionalCache;
63
+ private decodedOptional;
64
+ private jsonOptional;
65
+ private loggerWire;
66
+ private captures;
67
+ private wireObservers;
68
+ private chunks;
69
+ private size;
70
+ private collectedSize;
71
+ private resolveEOF;
72
+ private rejectEOF;
73
+ readonly completion: Promise<void>;
74
+ readonly reasons: string[];
75
+ lastError?: BodyProcessingError;
76
+ /** Physical upstream EOF, independent of optional observer draining. */
77
+ endedAtMonotonicMs?: number;
78
+ mode: 'empty' | 'opaque-stream' | 'replayable-bytes';
79
+ constructor(source: ReadableStream<Uint8Array> | null, maxBytes: number, coding?: string, signal?: AbortSignal | undefined, identity?: BodyViewIdentity);
80
+ get replayable(): boolean;
81
+ get hasMandatoryConsumers(): boolean;
82
+ get hasActiveConsumers(): boolean;
83
+ private get readSignal();
84
+ /** Cancel the physical reader exactly once, including a source's asynchronous cancel gate. */
85
+ cancelReading(reason?: unknown): Promise<void>;
86
+ private registerConsumer;
87
+ consumerWork<T>(read: () => Promise<T>, consumer?: BodyConsumer): Promise<T>;
88
+ private hold;
89
+ private clear;
90
+ dispose(): void;
91
+ /** Optional retention follows actual pulls. Releasing a consumer never cancels the wire. */
92
+ retain(max: number, stop: (error: BodyProcessingError) => void, logging?: boolean): () => void;
93
+ private releaseLoggingWire;
94
+ private append;
95
+ /** An optional live copy with bounded backlog. It never pulls or cancels the transport. */
96
+ private logChunks;
97
+ logText(maxBytes: number, signal: AbortSignal): AsyncIterable<string>;
98
+ private finish;
99
+ buffer(reason: string, optional?: boolean): Promise<Uint8Array>;
100
+ private receiveEventDecoded;
101
+ private finishEventDecoded;
102
+ private cachedDecoded;
103
+ decoded(reason: string): Promise<Uint8Array>;
104
+ private canonicalJSON;
105
+ json(reason: string, emptyObject?: boolean): Promise<any>;
106
+ handle(identity?: BodyViewIdentity, drainEventsOnCancel?: boolean): BodyHandle;
107
+ take(): BodyInit | null;
108
+ }
109
+ export declare function readBodyChunk(reader: ReadableStreamDefaultReader<Uint8Array>, signal?: AbortSignal): Promise<Awaited<ReturnType<typeof reader.read>>>;
110
+ export interface OwnedDecodedStream extends ReadableStream<Uint8Array> {
111
+ dispose(): void;
112
+ promote?(): void;
113
+ }
114
+ export declare function limitStream(source: ReadableStream<Uint8Array>, max: number, signal?: AbortSignal, onError?: (error: unknown) => void): OwnedDecodedStream;
115
+ export declare function decodeStream(source: ReadableStream<Uint8Array>, coding: string, max: number, signal?: AbortSignal, optional?: boolean): OwnedDecodedStream;
116
+ export declare function reconcileEntityHeaders(headers: Headers, body: BodyInit | null, modified: boolean): void;
@@ -0,0 +1,196 @@
1
+ /** Typed extension stages shared by built-in and project plugins. */
2
+ import type { AppConfig, RouteConfig, CorsConfig, LLMProtocol } from '@jeffusion/bungee-types';
3
+ import type { ExpressionContext } from '../expression-engine';
4
+ import type { EffectiveRouteConfig, RuntimeUpstream, RuntimeServiceReference, RuntimeCandidate, RequestSnapshot } from '../worker/types';
5
+ import type { HandleRequestRuntimeContext } from './request-plugin';
6
+ import type { PhaseAwareHooks, InboundChain } from '../scoped-plugin-registry';
7
+ import type { MutableRequestContext } from '../worker/request/context';
8
+ import type { PluginHooks, RequestContext } from '../hooks';
9
+ import type { ModificationRules, ResponseModificationRules } from '@jeffusion/bungee-types';
10
+ import type { BodySource } from '../worker/request/body-source';
11
+ import type { ProxyAttemptOptions, ProxyRequestResult } from './forward-plugin';
12
+ import type { StreamCompletionState } from './response-plugin';
13
+ import type { RequestLogger } from '../logger/request-logger';
14
+ import type { WorkerRequestAdmission, WorkerAdmissionPlugin } from '../data-admission/worker';
15
+ import type { FailoverCoordinator } from '../worker/upstream/failover-coordinator';
16
+ export type GatewayBodyArguments = ConstructorParameters<typeof BodySource>;
17
+ export type GatewaySelector = (upstreams: RuntimeUpstream[], route?: EffectiveRouteConfig, context?: ExpressionContext) => RuntimeUpstream | undefined;
18
+ export type GatewayRequestArguments = [request: Request, config: AppConfig, runtimeContextOrSelector?: HandleRequestRuntimeContext | GatewaySelector, selector?: GatewaySelector];
19
+ export type GatewayForwardArguments = [snapshot: RequestSnapshot, route: EffectiveRouteConfig, upstream: RuntimeUpstream, requestLog: any, config: AppConfig, routeId: string, logger?: RequestLogger, phases?: PhaseAwareHooks | null, phaseContext?: MutableRequestContext, signal?: AbortSignal, options?: ProxyAttemptOptions];
20
+ export type GatewayResponseRuleArguments = [response: Response, rules: ResponseModificationRules, context: ExpressionContext, requestLog: any, logger?: RequestLogger, config?: AppConfig, hooks?: PluginHooks, streamContext?: RequestContext, state?: StreamCompletionState, inbound?: InboundChain, streamCallbacks?: boolean, strict?: boolean, signal?: AbortSignal, owners?: Array<{
21
+ dispose(): void;
22
+ }>, source?: BodySource, modified?: boolean];
23
+ export type GatewayBodyRuleArguments = [body: Record<string, any>, rules: ModificationRules['body'], context: ExpressionContext, requestLog: any];
24
+ export type GatewayHeaderRuleArguments = [headers: Headers, rules: ModificationRules['headers'], context: ExpressionContext];
25
+ export type GatewayCorsArguments = [response: Response, cors: CorsConfig | undefined, request: Request];
26
+ export type GatewayQueryRuleArguments = [params: URLSearchParams, rules: ModificationRules['query'], context: ExpressionContext, requestLog: any];
27
+ export interface GatewayDispatchTarget {
28
+ readonly type: 'route' | 'service';
29
+ readonly id: string;
30
+ }
31
+ export interface DispatchRequestInput {
32
+ /** Trusted host metadata, never client headers or message metadata. */
33
+ readonly webSocketConnection?: {
34
+ readonly id: string;
35
+ readonly signal: AbortSignal;
36
+ };
37
+ readonly context: import('../hooks').MutableRequestContext;
38
+ readonly targets: readonly GatewayDispatchTarget[];
39
+ readonly principal?: import('../plugin-extensions').DataPrincipal;
40
+ readonly signal: AbortSignal;
41
+ readonly servingRevision?: number;
42
+ }
43
+ export interface DispatchConversionDiagnostic {
44
+ readonly param: string;
45
+ readonly action: 'mapped' | 'omitted';
46
+ readonly reason: string;
47
+ }
48
+ export interface GatewayAuxiliaryIdentity {
49
+ readonly scope: string | null;
50
+ readonly model: string;
51
+ readonly upstreamId: string;
52
+ }
53
+ export interface GatewayAuxiliaryRequest {
54
+ readonly target: GatewayDispatchTarget;
55
+ readonly protocol: 'responses';
56
+ readonly model: string;
57
+ readonly body: unknown;
58
+ /** Explicit aggregate signal replaces parent cancellation; absent means parent-owned lifetime. */
59
+ readonly signal?: AbortSignal;
60
+ /** Null scope requires caller-owned local isolation and cannot identify a shared account cache. */
61
+ readonly reuse?: (identity: GatewayAuxiliaryIdentity) => Promise<unknown | undefined>;
62
+ }
63
+ export type GatewayAuxiliaryResult = {
64
+ readonly kind: 'response';
65
+ readonly status: number;
66
+ readonly bodyHandle: import('./body-contracts').BodyHandle;
67
+ readonly completion: Promise<import('../plugin-control/contracts').RawResponseCompletion>;
68
+ readonly identity: GatewayAuxiliaryIdentity;
69
+ readonly requestId: string;
70
+ dispose(): void;
71
+ } | {
72
+ readonly kind: 'reused';
73
+ readonly value: unknown;
74
+ readonly identity: GatewayAuxiliaryIdentity;
75
+ };
76
+ export type ExecuteGatewayAuxiliary = (input: GatewayAuxiliaryRequest) => Promise<GatewayAuxiliaryResult>;
77
+ export interface DispatchRequestPreparationInput {
78
+ /** Bounded history from the same authenticated WebSocket connection after a model switch. */
79
+ readonly crossModelHistory?: {
80
+ readonly responseId: string;
81
+ readonly items: readonly unknown[];
82
+ };
83
+ readonly webSocketConnection?: {
84
+ readonly id: string;
85
+ readonly signal: AbortSignal;
86
+ };
87
+ readonly context: import('../hooks').MutableRequestContext;
88
+ readonly principal?: import('../plugin-extensions').DataPrincipal;
89
+ readonly servingRevision?: number;
90
+ readonly signal: AbortSignal;
91
+ readonly executeAuxiliary: ExecuteGatewayAuxiliary;
92
+ }
93
+ export interface DispatchRequestPreparationResult {
94
+ readonly requiredUpstreamId?: string;
95
+ readonly adapter?: import('../plugin.types').Plugin;
96
+ readonly canonicalInput?: readonly unknown[];
97
+ readonly diagnostics?: readonly DispatchConversionDiagnostic[];
98
+ }
99
+ export interface DispatchRequestDecision extends DispatchRequestPreparationResult {
100
+ readonly target: GatewayDispatchTarget;
101
+ readonly protocol?: LLMProtocol;
102
+ readonly requiredUpstreamId?: string;
103
+ readonly prepareRequest?: (input: DispatchRequestPreparationInput) => Promise<DispatchRequestPreparationResult>;
104
+ }
105
+ export interface GatewayDispatchInput extends Omit<DispatchRequestInput, 'targets'> {
106
+ readonly config: AppConfig;
107
+ readonly entry: RouteConfig;
108
+ }
109
+ export interface GatewayDispatchDecision {
110
+ readonly route: RouteConfig;
111
+ readonly effective: EffectiveRouteConfig;
112
+ readonly context: import('../hooks').MutableRequestContext;
113
+ readonly entryRouteId?: string;
114
+ readonly target?: GatewayDispatchTarget;
115
+ readonly requiredUpstreamId?: string;
116
+ readonly protocol?: LLMProtocol;
117
+ readonly adapter?: import('../plugin.types').Plugin;
118
+ readonly canonicalInput?: readonly unknown[];
119
+ readonly diagnostics?: readonly DispatchConversionDiagnostic[];
120
+ readonly prepareRequest?: DispatchRequestDecision['prepareRequest'];
121
+ }
122
+ export interface GatewayRouteInput {
123
+ readonly request: Request;
124
+ readonly config: AppConfig;
125
+ }
126
+ export interface GatewayRouteDecision {
127
+ readonly route?: RouteConfig;
128
+ readonly effective?: EffectiveRouteConfig;
129
+ readonly response?: Response;
130
+ readonly responseKind?: 'rule' | 'local';
131
+ }
132
+ export interface GatewayAdmissionInput {
133
+ readonly route: RouteConfig;
134
+ readonly trustedPeer: string | null;
135
+ readonly context: ExpressionContext;
136
+ readonly servingRevision?: number;
137
+ readonly signal: AbortSignal;
138
+ }
139
+ export type GatewayAdmissionDecision = {
140
+ readonly allowed: true;
141
+ } | {
142
+ readonly allowed: false;
143
+ readonly retryAfterMs?: number;
144
+ };
145
+ export interface GatewayAdmissionSessionInput {
146
+ readonly handlers: readonly WorkerAdmissionPlugin[];
147
+ readonly identity: ConstructorParameters<typeof WorkerRequestAdmission>[1];
148
+ readonly invoke: ConstructorParameters<typeof WorkerRequestAdmission>[2];
149
+ }
150
+ export interface GatewayAdmissionPrepareInput {
151
+ readonly session: WorkerRequestAdmission;
152
+ readonly target: Parameters<WorkerRequestAdmission['prepare']>[0];
153
+ readonly signal: AbortSignal;
154
+ readonly readBody: Parameters<WorkerRequestAdmission['prepare']>[2];
155
+ }
156
+ export interface GatewaySelectInput {
157
+ readonly upstreams: RuntimeUpstream[];
158
+ readonly route: EffectiveRouteConfig;
159
+ readonly context: ExpressionContext;
160
+ readonly selector?: (upstreams: RuntimeUpstream[], route?: EffectiveRouteConfig, context?: ExpressionContext) => RuntimeUpstream | undefined;
161
+ readonly references?: RuntimeServiceReference[];
162
+ readonly coordinator?: FailoverCoordinator<RuntimeCandidate>;
163
+ }
164
+ export interface GatewaySelectDecision {
165
+ readonly reference?: RuntimeServiceReference;
166
+ readonly upstream?: RuntimeUpstream;
167
+ readonly shouldTransitionToHalfOpen?: boolean;
168
+ }
169
+ export interface GatewayFailoverInput {
170
+ readonly references?: RuntimeServiceReference[];
171
+ readonly upstreams: RuntimeUpstream[];
172
+ readonly route: EffectiveRouteConfig;
173
+ readonly recoveryIntervalMs: number;
174
+ readonly context: ExpressionContext;
175
+ }
176
+ export interface GatewayRetryInput {
177
+ readonly snapshot: RequestSnapshot;
178
+ readonly route: RouteConfig;
179
+ readonly signal: AbortSignal;
180
+ /** Caller cancellation stays terminal even when a buffered repair fallback survives the shared deadline. */
181
+ readonly clientSignal?: AbortSignal;
182
+ readonly runAttempt: (override?: GatewayRequestOverride) => Promise<ProxyRequestResult>;
183
+ readonly finish: (result: ProxyRequestResult, preserveRequestState?: boolean) => Promise<void>;
184
+ readonly end: (result: ProxyRequestResult, cancelled: boolean) => Promise<void>;
185
+ readonly cleanup: (result: ProxyRequestResult, signal: AbortSignal) => Promise<void>;
186
+ readonly claimRepair?: () => boolean;
187
+ readonly recordAttempt?: (result: ProxyRequestResult) => Promise<void>;
188
+ }
189
+ /** Final outbound representation: a repair attempt skips already completed request conversions. */
190
+ export interface GatewayRequestOverride {
191
+ readonly url: string;
192
+ readonly headers: Readonly<Record<string, string>>;
193
+ readonly body: unknown;
194
+ readonly annotations?: Readonly<Record<string, import('../plugin.types').PluginConfigValue>>;
195
+ }
196
+ export declare const GATEWAY_PROVIDER_STAGES: readonly ["onGatewayWebSocket", "onGatewayBody", "onGatewayRequest", "onGatewayRoute", "onGatewayDispatch", "onGatewayAdmission", "onGatewayAdmissionSession", "onGatewayAdmissionPrepare", "onGatewaySelect", "onGatewayFailover", "onGatewayRetry", "onGatewayForward", "onGatewayHeaderRules", "onGatewayCors", "onGatewayBodyRules", "onGatewayQueryRules", "onGatewayResponseRules"];
@@ -0,0 +1,5 @@
1
+ import type { BodyHandle } from '@jeffusion/bungee-core/plugin';
2
+ import { BodySource } from '../worker/request/body-source';
3
+ /** Drive a decorated transport only when the cache owner cannot drive that decoration itself. */
4
+ export declare function readControlledBody<T>(source: BodySource, input: ReadableStream<Uint8Array> | null, read: () => Promise<T>, signal?: AbortSignal, consumerManaged?: boolean): Promise<T>;
5
+ export declare function controlledBodyHandle(source: BodySource, input: ReadableStream<Uint8Array> | null, handle: BodyHandle, signal?: AbortSignal): BodyHandle;
@@ -0,0 +1,11 @@
1
+ import type { Plugin, PluginHooks, GatewayDispatchInput, GatewayDispatchTarget } from './plugin';
2
+ import type { RouteConfig } from '@jeffusion/bungee-types';
3
+ import { type LLMProtocol } from '@jeffusion/bungee-llms/plugin-api';
4
+ export declare class DispatchPlugin implements Plugin {
5
+ bodyRequirements(): {
6
+ request: "none";
7
+ };
8
+ register(hooks: PluginHooks): void;
9
+ }
10
+ /** Resolve a schema-bound target without invoking another dispatch hook. */
11
+ export declare function resolveDispatchTarget(config: import('@jeffusion/bungee-types').AppConfig, entry: RouteConfig, target: GatewayDispatchTarget, context: GatewayDispatchInput['context'], protocol?: LLMProtocol): RouteConfig;
@@ -0,0 +1,4 @@
1
+ import type { PluginConfigField } from '../plugin.types';
2
+ import type { GatewayDispatchTarget } from './contracts';
3
+ /** Extract references only from the trusted schema, never from arbitrary request JSON. */
4
+ export declare function declaredDispatchTargets(options: Record<string, unknown>, fields: readonly PluginConfigField[]): GatewayDispatchTarget[];