@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,105 @@
1
+ import type { PluginHooks } from '../hooks';
2
+ import type { RequestLogger, RequestLoggerDependencies } from '../logger/request-logger';
3
+ import type { WebSocketObservationIncompleteReason, WebSocketObservationFailureDetail } from '../websocket/observation';
4
+ import type { RequestLogAdmissionRejection, RequestLogAdmissionTrace } from '../data-admission/worker';
5
+ import type { RequestLogContext, RequestLogEvent, RequestLogObserver, RequestLogRecords, RequestLogWebSocketEvent, LogObservationBinding, LogExecutionCause } from './request-log-contracts';
6
+ export type RequestLogApplicationFactory = (context: RequestLogContext) => RequestLogObserver | undefined;
7
+ export declare function selectRequestLogApplicationFactory(hooks: PluginHooks | undefined, globalHooks: PluginHooks, context: RequestLogContext): RequestLogApplicationFactory | undefined;
8
+ type RequestLogDelivery = (records: RequestLogRecords) => void | Promise<void>;
9
+ type OperationStartRejection = RequestLogAdmissionRejection | 'bridge-closing' | 'session-stopped' | 'session-closing' | 'lease-inactive' | 'admission-false';
10
+ type AcceptsOperations = (onRejected?: (reason: OperationStartRejection) => void, trace?: RequestLogAdmissionTrace) => boolean | Promise<boolean>;
11
+ export interface RequestLogExecutionMetadata {
12
+ readonly settled: boolean;
13
+ readonly syntheticTerminal?: true;
14
+ readonly responseOrigin: 'upstream' | 'gateway';
15
+ readonly executionCause?: LogExecutionCause;
16
+ readonly finalUpstreamResponse?: {
17
+ readonly attemptId: string;
18
+ readonly httpStatus: number;
19
+ };
20
+ }
21
+ export interface RequestLogCloseOptions {
22
+ readonly observationCause?: WebSocketObservationIncompleteReason | 'prepare-error' | 'delivery-error' | 'finish-timeout' | 'invalid-record' | 'selection-error' | 'observation-lost';
23
+ readonly observationDetail?: WebSocketObservationFailureDetail;
24
+ readonly observationMessage?: RequestLogWebSocketEvent['message'];
25
+ readonly closeCode?: number;
26
+ readonly executionCause?: LogExecutionCause;
27
+ readonly finalUpstreamResponse?: {
28
+ readonly attemptId: string;
29
+ readonly httpStatus: number;
30
+ };
31
+ }
32
+ export interface RequestLogHttpObservationOptions {
33
+ readonly stage?: 'upstream-response' | 'client-response';
34
+ readonly finishLease?: (finish: () => void) => void;
35
+ readonly responseOrigin: 'upstream' | 'gateway';
36
+ readonly executionCause?: () => LogExecutionCause | undefined;
37
+ readonly finalUpstreamResponse?: {
38
+ readonly attemptId: string;
39
+ readonly httpStatus: number;
40
+ };
41
+ }
42
+ export declare class RequestLogSession {
43
+ private readonly observer;
44
+ private readonly context;
45
+ private readonly accessId;
46
+ private readonly routePath;
47
+ private readonly logging;
48
+ private readonly acceptsOperations?;
49
+ private readonly binding?;
50
+ readonly applicationFactory?: RequestLogApplicationFactory | undefined;
51
+ private readonly deliveryTimings;
52
+ private readonly deliveryOperations;
53
+ private preparingOperation?;
54
+ private readonly preparedBodyOperations;
55
+ private readonly open;
56
+ private readonly root;
57
+ private readonly captures;
58
+ private readonly activeBodies;
59
+ private readonly deliveries;
60
+ private readonly bodies?;
61
+ private stopped;
62
+ private closing?;
63
+ private lostDiagnosed;
64
+ private readonly pending;
65
+ private httpStarted;
66
+ private boundaryAt;
67
+ private readonly startedAt;
68
+ private messageTokens;
69
+ private dispatches;
70
+ private readonly executions;
71
+ private operationMessages;
72
+ dispatchWebSocket(message: RequestLogWebSocketEvent['message'], outcome: 'dispatching' | 'queued' | 'dropped' | 'failed', upstream: string): void;
73
+ private writeExecution;
74
+ private writeExecutionFile;
75
+ private bindExecution;
76
+ constructor(observer: RequestLogObserver, context: RequestLogContext, accessId: string, routePath: string, logging: RequestLoggerDependencies, acceptsOperations?: AcceptsOperations | undefined, maxBodyBytes?: number, binding?: LogObservationBinding | undefined, applicationFactory?: RequestLogApplicationFactory | undefined);
77
+ static observeAttempt(response: Response, observer: RequestLogObserver, logger: RequestLogger, maxBytes: number): {
78
+ completion: Promise<void>;
79
+ finish: () => void;
80
+ };
81
+ createExecutionMetadataReceiver(requestId: string, receivedAt?: number): (metadata: RequestLogExecutionMetadata) => void;
82
+ private initializeOperation;
83
+ private writeClosed;
84
+ private diagnoseMissingEvidence;
85
+ prepareWebSocket(input: Omit<RequestLogWebSocketEvent, 'timestamp'>): RequestLogWebSocketEvent['message'] | undefined;
86
+ observeWebSocket(message: RequestLogWebSocketEvent['message'], isActive: () => boolean): void | Promise<void>;
87
+ recoverWebSocketOperation(message: RequestLogWebSocketEvent['message'], detail: WebSocketObservationFailureDetail): boolean;
88
+ observe(event: RequestLogEvent, isActive: () => boolean, deliver?: RequestLogDelivery, failureCause?: 'prepare-error' | 'delivery-error'): void | Promise<void>;
89
+ markBoundary(observedAt?: number): void;
90
+ webSocketOperationActive(operationId: string): () => boolean;
91
+ close(observation?: 'complete' | 'lost', options?: RequestLogCloseOptions): void;
92
+ private diagnoseLost;
93
+ private finishClose;
94
+ private closeOperation;
95
+ private fact;
96
+ }
97
+ export declare function hasRequestLogCollector(hooks: PluginHooks): boolean;
98
+ export declare function createRequestLog(hooks: PluginHooks | undefined, globalHooks: PluginHooks, request: Request, routePath: string, transportType: RequestLogContext['transportType'], accessId: string, logging: RequestLoggerDependencies | undefined, options?: {
99
+ acceptsOperations: AcceptsOperations;
100
+ webSocketMode?: RequestLogContext['webSocketMode'];
101
+ maxBodyBytes?: number;
102
+ }): RequestLogSession | undefined;
103
+ /** The response consumer drives the wire. Every view uses an optional lease. */
104
+ export declare function observeRequestLogHttp(response: Response, session: Pick<RequestLogSession, 'observe' | 'markBoundary' | 'close'>, accessId: string, signal: AbortSignal, maxBytes: number, options: RequestLogHttpObservationOptions): Response;
105
+ export {};
@@ -0,0 +1,98 @@
1
+ import { type RequestLoggerDependencies } from '../logger/request-logger';
2
+ import type { AppConfig } from '@jeffusion/bungee-types';
3
+ import type { ExpressionContext } from '../expression-engine';
4
+ import type { EffectiveRouteConfig, RuntimeUpstream } from '../worker/types';
5
+ import type { RawResponseCompletion } from '../plugin-control/contracts';
6
+ import { type RequestLogExecutionMetadata } from './request-log';
7
+ export interface HandleRequestRuntimeContext {
8
+ accessId?: string;
9
+ servingRevision?: number;
10
+ parentRequestId?: string;
11
+ webSocketConnection?: {
12
+ readonly id: string;
13
+ readonly signal: AbortSignal;
14
+ };
15
+ /** Core-only locked handoff: no dispatch hook or recursive preparation. */
16
+ auxiliary?: {
17
+ target: import('./contracts').GatewayDispatchTarget;
18
+ parentRequestId?: string;
19
+ onIdentity: (identity: import('./contracts').GatewayAuxiliaryIdentity) => Promise<boolean>;
20
+ };
21
+ onCompletion?: (completion: Promise<RawResponseCompletion>) => void;
22
+ /** Host-only session context, never accepted from client fields. */
23
+ transport?: 'websocket';
24
+ webSocketRequestId?: string;
25
+ websocketBridge?: import('../websocket').WebSocketBridge;
26
+ nativeResponses?: import('../websocket/transport').NativeResponsesTurn;
27
+ onNativeExecutionMetadata?: (metadata: RequestLogExecutionMetadata) => void;
28
+ crossModelHistory?: import('./contracts').DispatchRequestPreparationInput['crossModelHistory'];
29
+ skipEntryRate?: boolean;
30
+ /** Host session receives the codec's logical history without re-reading the request body. */
31
+ onCanonicalInput?: (input: readonly unknown[]) => void;
32
+ logging?: RequestLoggerDependencies;
33
+ operationLog?: {
34
+ operationId: string;
35
+ connectionId: string;
36
+ message?: import('./websocket-contracts').WebSocketMessageView;
37
+ logging: RequestLoggerDependencies;
38
+ onExecutionMetadata(metadata: {
39
+ settled: boolean;
40
+ responseOrigin: 'upstream' | 'gateway';
41
+ executionCause?: import('./request-log-contracts').LogExecutionCause;
42
+ finalUpstreamResponse?: {
43
+ attemptId: string;
44
+ httpStatus: number;
45
+ };
46
+ }): void;
47
+ };
48
+ }
49
+ type UpstreamSelector = (upstreams: RuntimeUpstream[], route?: EffectiveRouteConfig, context?: ExpressionContext) => RuntimeUpstream | undefined;
50
+ /**
51
+ * Handles incoming HTTP requests
52
+ *
53
+ * This is the main entry point for request processing. It orchestrates:
54
+ * 1. **Request logging**: Starts the normal request log
55
+ * 2. **Route matching**: Finds matching route configuration
56
+ * 3. **Request snapshot**: Creates immutable copy for failover isolation
57
+ * 4. **Plugin loading**: Loads route-level plugins
58
+ * 5. **Authentication**: Validates request credentials (if enabled)
59
+ * 6. **Upstream selection**: Chooses target upstream server
60
+ * 7. **Failover/Retry**: Attempts multiple upstreams on failure
61
+ * 8. **Recovery mechanism**: Allows UNHEALTHY upstreams to recover
62
+ * 9. **Stats collection**: Records request metrics
63
+ * 10. **Request logging**: Persists request details to database
64
+ *
65
+ * **Failover behavior**:
66
+ * - Healthy upstreams are tried first (by priority/weight)
67
+ * - Recovery candidates (UNHEALTHY but past recovery interval) are tried next
68
+ * - Each attempt uses a clean snapshot to prevent plugin state pollution
69
+ * - Upstreams are marked UNHEALTHY on failure, HEALTHY on success
70
+ *
71
+ * **Access control**:
72
+ * - Optional admission plugins enforce policies using the trusted ingress identity
73
+ * - Protected routes reject missing credentials or denied scopes
74
+ * - Authorization follows configured header rules and plugin transformations
75
+ *
76
+ * @param req - Incoming HTTP request
77
+ * @param config - Application configuration
78
+ * @param upstreamSelector - Upstream selection strategy (defaults to selectUpstream)
79
+ * @returns Response from upstream or error response
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * // Standard usage
84
+ * const response = await handleRequest(req, config);
85
+ *
86
+ * // Custom upstream selector
87
+ * const response = await handleRequest(req, config, customSelector);
88
+ * ```
89
+ */
90
+ export declare function executeHttpRequest(req: Request, config: AppConfig, runtimeContextOrSelector?: HandleRequestRuntimeContext | UpstreamSelector, selectorOverride?: UpstreamSelector): Promise<Response>;
91
+ import type { Plugin, PluginHooks } from '@jeffusion/bungee-core/plugin';
92
+ export declare class HttpRequestPlugin implements Plugin {
93
+ bodyRequirements(): {
94
+ request: "none";
95
+ };
96
+ register(hooks: PluginHooks): void;
97
+ }
98
+ export {};
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Request/Response modification rules module
3
+ * Handles body and header modification based on configuration rules
4
+ */
5
+ import { type ExpressionContext } from '../expression-engine';
6
+ import type { ModificationRules } from '@jeffusion/bungee-types';
7
+ export { deepMergeRules } from '../worker/rules/deep-merge';
8
+ /**
9
+ * Applies body modification rules to a request/response body
10
+ *
11
+ * Supports four types of modifications:
12
+ * - **add**: Adds new fields (unconditional)
13
+ * - **replace**: Replaces existing fields
14
+ * - **default**: Sets field only if undefined
15
+ * - **remove**: Removes top-level fields (unless added/replaced in same rule).
16
+ * For requests, unmatched dotted keys are also tried as paths through JSON objects.
17
+ *
18
+ * **Processing order**: add → replace → default → remove
19
+ *
20
+ * **Special features:**
21
+ * - Dynamic value processing (expressions like `${env.API_KEY}`)
22
+ * - Multi-event support (returns array if `__multi_events` present)
23
+ * - Deep clone to prevent mutation of original body
24
+ *
25
+ * @param body - Original body object
26
+ * @param rules - Modification rules to apply
27
+ * @param context - Expression context for dynamic values
28
+ * @param requestLog - Request log for debugging
29
+ * @returns Modified body (or array of bodies if multi-event)
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * const body = { user: 'john', age: 30 };
34
+ * const rules = {
35
+ * add: { timestamp: '${Date.now()}' },
36
+ * replace: { age: 31 },
37
+ * remove: ['user']
38
+ * };
39
+ * const context = { env: process.env };
40
+ * const result = await applyBodyRules(body, rules, context, requestLog);
41
+ * // Result: { age: 31, timestamp: 1234567890 }
42
+ * ```
43
+ */
44
+ export declare function executeBodyRules(body: Record<string, any>, rules: ModificationRules['body'], context: ExpressionContext, requestLog: any): Promise<Record<string, any>>;
45
+ /**
46
+ * Applies query parameter modification rules
47
+ *
48
+ * @param searchParams - Original URLSearchParams
49
+ * @param rules - Modification rules to apply
50
+ * @param context - Expression context for dynamic values
51
+ * @param requestLog - Request log for debugging
52
+ * @returns Modified URLSearchParams
53
+ */
54
+ export declare function executeQueryRules(searchParams: URLSearchParams, rules: ModificationRules['query'], context: ExpressionContext, requestLog: any): URLSearchParams;
55
+ import type { Plugin, PluginHooks } from '@jeffusion/bungee-core/plugin';
56
+ export declare class RequestRulesPlugin implements Plugin {
57
+ bodyRequirements(): {
58
+ request: "none";
59
+ };
60
+ register(hooks: PluginHooks): void;
61
+ }
@@ -0,0 +1,34 @@
1
+ import type { RequestLogger } from '../logger/request-logger';
2
+ import type { AppConfig, ModificationRules, ResponseModificationRules } from '@jeffusion/bungee-types';
3
+ import { type ExpressionContext } from '../expression-engine';
4
+ import type { RequestContext } from '../hooks';
5
+ import type { InboundChain } from '../scoped-plugin-registry';
6
+ import { type BodySource } from '../worker/request/body-source';
7
+ import type { RawResponseCompletion } from '../plugin-control/contracts';
8
+ export interface StreamCompletionState {
9
+ interrupted: boolean;
10
+ cancelled: boolean;
11
+ clientCancelled?: boolean;
12
+ completion?: Promise<RawResponseCompletion>;
13
+ complete?: (completion: RawResponseCompletion) => void;
14
+ teardown?: Promise<void>;
15
+ teardownNow?: (reason?: unknown) => Promise<void>;
16
+ finalCompletion?: Promise<RawResponseCompletion>;
17
+ }
18
+ export interface PrepareResponseResult {
19
+ headers: Headers;
20
+ body: BodyInit | null;
21
+ }
22
+ export declare function applyHeaderRules(headers: Headers, rules: ModificationRules['headers'], context: ExpressionContext): void;
23
+ /** Completion follows the consumer, including ordinary binary responses. */
24
+ export declare function completionStream(source: ReadableStream<Uint8Array>, state?: StreamCompletionState, signal?: AbortSignal): ReadableStream<Uint8Array>;
25
+ export declare function executeResponseRules(res: Response, rules: ResponseModificationRules, requestContext: ExpressionContext, requestLog: any, reqLogger?: RequestLogger, config?: AppConfig, _pluginHooks?: PluginHooks, streamRequestContext?: RequestContext, state?: StreamCompletionState, inboundChain?: InboundChain, hasInboundStreamCallbacks?: boolean, _strictRawResponse?: boolean, signal?: AbortSignal, bodyOwners?: Array<{
26
+ dispose(): void;
27
+ }>, cachedSource?: BodySource, representationModified?: boolean): Promise<PrepareResponseResult>;
28
+ import type { Plugin, PluginHooks } from '@jeffusion/bungee-core/plugin';
29
+ export declare class ResponseRulesPlugin implements Plugin {
30
+ bodyRequirements(): {
31
+ request: "none";
32
+ };
33
+ register(hooks: PluginHooks): void;
34
+ }
@@ -0,0 +1,33 @@
1
+ import { type BodySource } from '../worker/request/body-source';
2
+ import type { BodyViewIdentity } from './body-contracts';
3
+ /** One current response representation, refreshed after each tap and retained across scopes. */
4
+ export declare class ResponseViews {
5
+ private readonly identity;
6
+ private readonly maxBytes;
7
+ private readonly signal;
8
+ private readonly owners;
9
+ private readonly raw;
10
+ private wire;
11
+ private value;
12
+ private owner?;
13
+ private version;
14
+ private currentContext?;
15
+ private entityHeaders;
16
+ changed: boolean;
17
+ constructor(response: Response, identity: BodyViewIdentity, maxBytes: number, signal: AbortSignal | undefined, owners: Array<{
18
+ dispose(): void;
19
+ }>, raw?: boolean, owner?: BodySource);
20
+ private metadata;
21
+ private handle;
22
+ private viewIdentity;
23
+ context<T extends {
24
+ responseOrigin: 'upstream' | 'gateway';
25
+ }>(context: T): T;
26
+ private updateContext;
27
+ private restoreEntityHeaders;
28
+ accept(response: Response): Response;
29
+ input(): Response;
30
+ source(): BodySource | undefined;
31
+ versionNumber(): number;
32
+ materialize(response: Response): Response;
33
+ }
@@ -0,0 +1,24 @@
1
+ import type { GatewayWebSocketInput, WebSocketMessageView } from './websocket-contracts';
2
+ import type { ManagedWebSocketSession } from '../websocket';
3
+ import type { PluginHooks } from '../hooks';
4
+ import type { RequestLogExecutionMetadata } from './request-log';
5
+ type HostedErrorOutcome = 'failed' | 'cancelled';
6
+ type ObserveResponse = (message: string, failure: HostedErrorOutcome | undefined, messageSequence: number) => void;
7
+ /** One connection owns one active logical generation; the transport owns all queues. */
8
+ export declare class ResponsesWebSocketSession {
9
+ private readonly input;
10
+ private readonly hooks;
11
+ private active;
12
+ private readonly connectionId;
13
+ private readonly history;
14
+ private readonly historyLease;
15
+ private historyBytes;
16
+ private native;
17
+ constructor(input: GatewayWebSocketInput, hooks: PluginHooks);
18
+ dispose(): Promise<void>;
19
+ private remember;
20
+ private error;
21
+ onMessage(session: ManagedWebSocketSession, message: WebSocketMessageView, requestId: string, observe?: ObserveResponse, operationId?: string, connectionId?: string, onExecutionMetadata?: (metadata: RequestLogExecutionMetadata) => void): void | Promise<void>;
22
+ private generate;
23
+ }
24
+ export {};
@@ -0,0 +1,7 @@
1
+ export declare class RequestRetryAction extends Error {
2
+ readonly reason: string;
3
+ readonly body: unknown;
4
+ constructor(body: unknown, reason: string);
5
+ /** Plugins and host may bundle the SDK independently in the same process. */
6
+ static [Symbol.hasInstance](value: unknown): boolean;
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { Plugin, PluginHooks } from '@jeffusion/bungee-core/plugin';
2
+ export declare class RetryPlugin implements Plugin {
3
+ bodyRequirements(): {
4
+ request: "none";
5
+ };
6
+ register(hooks: PluginHooks): void;
7
+ }
@@ -0,0 +1,11 @@
1
+ import type { AppConfig, RouteConfig, CorsConfig } from '@jeffusion/bungee-types';
2
+ import type { EffectiveRouteConfig } from '../worker/types';
3
+ import type { Plugin, PluginHooks } from '@jeffusion/bungee-core/plugin';
4
+ export declare function resolveEffectiveRoute(config: AppConfig, route: RouteConfig): EffectiveRouteConfig;
5
+ export declare function applyCorsHeaders(response: Response, cors: CorsConfig | undefined, request: Request): Response;
6
+ export declare class RoutingPlugin implements Plugin {
7
+ bodyRequirements(): {
8
+ request: "none";
9
+ };
10
+ register(hooks: PluginHooks): void;
11
+ }
@@ -0,0 +1,15 @@
1
+ import { type PluginHooks } from '../hooks';
2
+ import type { Plugin } from '../plugin.types';
3
+ import { type executeHttpRequest } from './request-plugin';
4
+ import type { GatewayWebSocketInput, GatewayWebSocketResult } from './websocket-contracts';
5
+ export declare function gatewayBuiltins(): Plugin[];
6
+ /** The host only owns registration; providers use the existing Plugin contract and Hook executor. */
7
+ export declare function registerGatewayBuiltins(hooks: PluginHooks, plugins?: readonly Plugin[]): void;
8
+ export declare function validateGatewayProviders(hooks: PluginHooks): void;
9
+ export declare function createGatewayHooks(plugins?: readonly Plugin[]): PluginHooks;
10
+ export declare function gatewayHooks(): PluginHooks;
11
+ export declare function runWithGatewayHooks<T>(hooks: PluginHooks, run: () => T): T;
12
+ export declare function initializeGateway(): void;
13
+ export declare function requireGatewayResult<T>(value: T | undefined, stage: string): T;
14
+ export declare const runGatewayRequest: typeof executeHttpRequest;
15
+ export declare function runGatewayWebSocket(input: GatewayWebSocketInput): Promise<GatewayWebSocketResult>;
@@ -0,0 +1,7 @@
1
+ import type { Plugin, PluginHooks } from '@jeffusion/bungee-core/plugin';
2
+ export declare class SelectionPlugin implements Plugin {
3
+ bodyRequirements(): {
4
+ request: "none";
5
+ };
6
+ register(hooks: PluginHooks): void;
7
+ }
@@ -0,0 +1,6 @@
1
+ import type { BodyHandle, RequestContext } from '@jeffusion/bungee-core/plugin';
2
+ import type { ModificationRules } from '@jeffusion/bungee-types';
3
+ import type { ExpressionContext } from '../expression-engine';
4
+ import type { InboundChain } from '../scoped-plugin-registry';
5
+ /** A required consumer drives the one wire owner up to the next shared event. */
6
+ export declare function sharedSSEResponse(input: ReadableStream<Uint8Array>, handle: BodyHandle, rules: ModificationRules['body'], context: ExpressionContext, chain?: InboundChain, request?: RequestContext, signal?: AbortSignal): ReadableStream<Uint8Array>;
@@ -0,0 +1,71 @@
1
+ /** Read-only WebSocket SDK. HTTP bodies and WebSocket messages have separate owners. */
2
+ export interface WebSocketMessageView {
3
+ readonly kind: 'text' | 'binary';
4
+ readonly byteLength: number;
5
+ /** Fast, conservative precheck for JSON string prefixes. Escaped text may match. */
6
+ mayContainJsonString?(...prefixes: readonly string[]): boolean;
7
+ /** Demand-driven, shared, deeply frozen JSON; binary is skipped unless explicitly requested. */
8
+ json(options?: {
9
+ readonly binary?: boolean;
10
+ }): unknown;
11
+ }
12
+ export interface WebSocketSessionContext {
13
+ readonly connectionId: string;
14
+ readonly keyId?: string | null;
15
+ readonly routeId: string;
16
+ readonly upstreamId: string;
17
+ readonly upstreamUrl: string;
18
+ readonly servingRevision?: number;
19
+ }
20
+ export interface WebSocketSessionMetrics {
21
+ readonly clientDisconnected?: true;
22
+ readonly durationMs: number;
23
+ readonly clientMessages: number;
24
+ readonly upstreamMessages: number;
25
+ readonly clientBytes: number;
26
+ readonly upstreamBytes: number;
27
+ }
28
+ export type WebSocketObservationEvent = Readonly<WebSocketSessionContext & {
29
+ /** Captured once before the independent observer queues. */
30
+ readonly observedAtMonotonicMs?: number;
31
+ /** Delivery lease expires when the observer returns or exceeds its deadline. */
32
+ readonly isActive: () => boolean;
33
+ } & ({
34
+ readonly phase: 'open';
35
+ } | {
36
+ readonly phase: 'message';
37
+ readonly direction: 'client' | 'upstream';
38
+ readonly message: WebSocketMessageView;
39
+ readonly messageSequence?: number;
40
+ } | {
41
+ readonly phase: 'incomplete';
42
+ readonly reason: 'observer-timeout' | 'observer-error' | 'buffer-limit' | 'message-limit';
43
+ } | {
44
+ readonly phase: 'close';
45
+ readonly code: number;
46
+ readonly reason: string;
47
+ readonly metrics: WebSocketSessionMetrics;
48
+ })>;
49
+ /** Handshake-only transforms; message data is never mutable through this hook. */
50
+ export interface WebSocketHandshakeContext {
51
+ readonly connectionId: string;
52
+ readonly routeId: string;
53
+ readonly upstreamId: string;
54
+ readonly signal: AbortSignal;
55
+ url: URL;
56
+ headers: Headers;
57
+ }
58
+ export interface GatewayWebSocketInput {
59
+ readonly request: Request;
60
+ readonly nativeRequest: Request;
61
+ readonly server: Bun.Server<import('../websocket').WebSocketBridgeData>;
62
+ readonly bridge: import('../websocket').WebSocketBridge;
63
+ readonly config: import('@jeffusion/bungee-types').AppConfig;
64
+ readonly servingRevision: number;
65
+ readonly logging?: import('../logger/request-logger').RequestLoggerDependencies;
66
+ /** Host shutdown barrier; retains observer/credential owners until close cleanup. */
67
+ readonly retain: (completion: Promise<void>) => void;
68
+ }
69
+ export interface GatewayWebSocketResult {
70
+ readonly response?: Response;
71
+ }
@@ -0,0 +1,3 @@
1
+ import type { RuntimeUpstream } from '../worker/types';
2
+ /** Uses the same exact endpoint/binding/origin credential policy as HTTP attempts. */
3
+ export declare function websocketCredential(upstream: RuntimeUpstream, url: URL, sourceHeaders: Headers, revision: number, attemptId: string, signal: AbortSignal): Promise<Headers>;
@@ -0,0 +1,9 @@
1
+ import type { Plugin, PluginHooks } from '@jeffusion/bungee-core/plugin';
2
+ /** WebSocket is a registered gateway provider, with handshake and read-only message hooks. */
3
+ export declare class WebSocketGatewayPlugin implements Plugin {
4
+ bodyRequirements(): {
5
+ request: "none";
6
+ };
7
+ register(hooks: PluginHooks): void;
8
+ private upgrade;
9
+ }
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Hook 实现类
3
+ *
4
+ * 提供 4 种 Hook 类型的实现:
5
+ * - AsyncParallelHook: 异步并行执行
6
+ * - AsyncSeriesHook: 异步串行执行
7
+ * - AsyncSeriesBailHook: 异步串行可中断
8
+ * - AsyncSeriesWaterfallHook: 异步串行瀑布
9
+ */
10
+ /** Host-supplied view refresh, run between every waterfall tap. */
11
+ export declare const WATERFALL_VIEW_TRANSFORM: unique symbol;
12
+ import type { TapInfo, Tap, IAsyncParallelHook, IAsyncSeriesHook, IAsyncSeriesBailHook, IAsyncSeriesWaterfallHook, IAsyncSeriesMapHook, HookStats } from './types';
13
+ /**
14
+ * 基础 Hook 类
15
+ */
16
+ declare abstract class BaseHook<T extends any[]> {
17
+ protected taps: Tap<T, any>[];
18
+ protected name: string;
19
+ protected callCount: number;
20
+ protected totalTimeMs: number;
21
+ constructor(name?: string);
22
+ /**
23
+ * 同步注册
24
+ */
25
+ tap(info: TapInfo | string, fn: (...args: T) => any): void;
26
+ /**
27
+ * 异步回调风格注册
28
+ */
29
+ tapAsync(info: TapInfo | string, fn: (...args: any[]) => void): void;
30
+ /**
31
+ * Promise 风格注册
32
+ */
33
+ tapPromise(info: TapInfo | string, fn: (...args: T) => Promise<any>): void;
34
+ /**
35
+ * 检查是否有注册的回调
36
+ */
37
+ hasCallbacks(): boolean;
38
+ /**
39
+ * 获取统计信息
40
+ */
41
+ getStats(): HookStats;
42
+ /**
43
+ * 重置统计信息
44
+ */
45
+ resetStats(): void;
46
+ /**
47
+ * 清空所有注册的回调
48
+ */
49
+ clear(): void;
50
+ /**
51
+ * 按 stage 排序(稳定排序)
52
+ */
53
+ private sortTaps;
54
+ /**
55
+ * 执行单个 tap
56
+ */
57
+ protected executeTap<R>(tap: Tap<T, R>, args: T): Promise<R | undefined>;
58
+ }
59
+ /** Synchronous providers use the same registration, ordering and statistics as async hooks. */
60
+ export declare class SyncBailHook<T extends any[] = [], R = unknown> extends BaseHook<T> {
61
+ tapAsync(): never;
62
+ tapPromise(): never;
63
+ call(...args: T): R | undefined;
64
+ }
65
+ /**
66
+ * 异步并行 Hook
67
+ * 所有回调并行执行,全部完成后返回
68
+ */
69
+ export declare class AsyncParallelHook<T extends any[] = []> extends BaseHook<T> implements IAsyncParallelHook<T> {
70
+ promise(...args: T): Promise<void>;
71
+ }
72
+ /**
73
+ * 异步串行 Hook
74
+ * 所有回调按顺序串行执行
75
+ */
76
+ export declare class AsyncSeriesHook<T extends any[] = []> extends BaseHook<T> implements IAsyncSeriesHook<T> {
77
+ promise(...args: T): Promise<void>;
78
+ }
79
+ /**
80
+ * 异步串行可中断 Hook
81
+ * 任意回调返回非 undefined 值则停止执行并返回该值
82
+ */
83
+ export declare class AsyncSeriesBailHook<T extends any[] = [], R = any> extends BaseHook<T> implements IAsyncSeriesBailHook<T, R> {
84
+ promise(...args: T): Promise<R | undefined>;
85
+ }
86
+ /**
87
+ * 异步串行瀑布 Hook
88
+ * 每个回调的返回值作为下一个回调的第一个参数
89
+ */
90
+ export declare class AsyncSeriesWaterfallHook<T, A extends any[] = []> extends BaseHook<[T, ...A]> implements IAsyncSeriesWaterfallHook<T, A> {
91
+ promise(value: T, ...args: A): Promise<T>;
92
+ }
93
+ /**
94
+ * 异步串行映射 Hook
95
+ * 支持 N:M 转换:每个回调处理输入,可以返回 0 到多个输出
96
+ *
97
+ * 执行流程:
98
+ * 1. 初始输入:单个 chunk
99
+ * 2. 每个插件处理当前的所有 chunks,返回新的 chunks 数组
100
+ * 3. 下一个插件处理上一步的所有输出
101
+ *
102
+ * 返回值约定:
103
+ * - null/undefined: 不处理,原样输出当前 chunk
104
+ * - []: 缓冲当前 chunk,不输出(N:0)
105
+ * - [chunk]: 1:1 转换
106
+ * - [chunk1, chunk2, ...]: 1:M 拆分
107
+ *
108
+ * 性能优化:
109
+ * - 同步优先执行:sync tap 直接同步调用,跳过 Promise 开销
110
+ * - 适用于流式响应处理等高频调用场景
111
+ */
112
+ export declare class AsyncSeriesMapHook<T, A extends any[] = []> extends BaseHook<[T, ...A]> implements IAsyncSeriesMapHook<T, A> {
113
+ /**
114
+ * 同步执行单个 tap(跳过 Promise 开销)
115
+ */
116
+ private executeTapSync;
117
+ promise(value: T, ...args: A): Promise<T[]>;
118
+ }
119
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Hooks 模块导出
3
+ */
4
+ export type { TapInfo, Tap, IAsyncParallelHook, IAsyncSeriesHook, IAsyncSeriesBailHook, IAsyncSeriesWaterfallHook, IAsyncSeriesMapHook, HookStats, } from './types';
5
+ export { SyncBailHook, AsyncParallelHook, AsyncSeriesHook, AsyncSeriesBailHook, AsyncSeriesWaterfallHook, AsyncSeriesMapHook, } from './impl';
6
+ export { createPluginHooks, getHooksStats, resetHooksStats, clearHooks, } from './plugin-hooks';
7
+ export type { PluginHooks, RequestContext, MutableRequestContext, ResponseContext, RawResponseContext, ErrorContext, StreamChunkContext, FinallyContext, AttemptObservationEvent, AttemptObservationOutcome, PluginInitContext, PluginLogger, PluginScopeInfo, } from './plugin-hooks';