@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,136 @@
1
+ import { RequestRetryAction } from './retry-action';
2
+ import { type RequestLogApplicationFactory } from './request-log';
3
+ import type { GatewayRequestOverride } from './contracts';
4
+ import type { AppConfig } from '@jeffusion/bungee-types';
5
+ import { type RequestLogger } from '../logger/request-logger';
6
+ import type { EffectiveRouteConfig, RuntimeUpstream, RequestSnapshot } from '../worker/types';
7
+ import type { PhaseAwareHooks } from '../scoped-plugin-registry';
8
+ import type { AttemptObservationEvent } from '../hooks/plugin-hooks';
9
+ import { type MutableRequestContext } from '../worker/request/context';
10
+ import { type StreamCompletionState } from '../worker/response/processor';
11
+ import type { RawResponseCompletion } from '../plugin-control/contracts';
12
+ export interface ProxyRequestResult {
13
+ responseOrigin: 'upstream' | 'gateway';
14
+ repairRetry?: {
15
+ readonly action: RequestRetryAction;
16
+ readonly request: GatewayRequestOverride;
17
+ };
18
+ repairFallback?: boolean;
19
+ attemptLogger?: RequestLogger;
20
+ response: Response;
21
+ upstreamConnected?: boolean;
22
+ completion: Promise<RawResponseCompletion>;
23
+ protocolCompletion?: Promise<RawResponseCompletion>;
24
+ observationCompletion?: Promise<void>;
25
+ observationEndedAtMonotonicMs?: () => number | undefined;
26
+ drainRetryObservation?: () => Promise<void>;
27
+ cleanup?: () => Promise<void>;
28
+ streamCompletionState?: StreamCompletionState;
29
+ upstreamId: string;
30
+ credentialLeaseVersion?: number;
31
+ rejectAccess?: (signal: AbortSignal) => Promise<void>;
32
+ shortCircuitedByPlugin?: boolean;
33
+ /** Deadline evidence only; never derived from an application completion result. */
34
+ transportFailureCode?: () => string | undefined;
35
+ }
36
+ export interface ProxyAttemptOptions {
37
+ readonly requestLogApplicationFactory?: RequestLogApplicationFactory;
38
+ readonly nativeWebSocket?: boolean;
39
+ readonly websocketBridge?: import('../websocket').WebSocketBridge;
40
+ readonly nativeResponses?: import('../websocket/transport').NativeResponsesTurn;
41
+ readonly nativeResponsesScope?: string;
42
+ readonly requestOverride?: GatewayRequestOverride;
43
+ readonly servingRevision?: number;
44
+ readonly attemptId: string;
45
+ readonly beforeReuse?: (identity: import('./contracts').GatewayAuxiliaryIdentity, target: {
46
+ url: string;
47
+ model: string | null;
48
+ body: unknown;
49
+ }) => Promise<boolean>;
50
+ readonly beforeSend?: (target: {
51
+ url: string;
52
+ model: string | null;
53
+ body: unknown;
54
+ }) => Promise<void>;
55
+ readonly onRequestDispatch?: () => void;
56
+ readonly takePhysicalBudget?: () => void;
57
+ /** The request orchestrator owns Service/root failure and finally hooks. */
58
+ readonly managesRequestLifecycle?: boolean;
59
+ readonly onErrorNotified?: () => void;
60
+ readonly observeRequest?: (event: AttemptObservationEvent) => Promise<void>;
61
+ readonly shouldObserveResponse?: (protocol: 'json' | 'sse') => boolean;
62
+ readonly observeResponse?: (event: AttemptObservationEvent) => Promise<void>;
63
+ readonly observeIncomplete?: (reason: 'raw-response-incomplete', detail?: Pick<AttemptObservationEvent, 'direction' | 'representation' | 'view'>) => Promise<void>;
64
+ }
65
+ export declare class AttemptCleanupError extends Error {
66
+ constructor(message?: string, options?: ErrorOptions);
67
+ }
68
+ export declare class UpstreamResponseValidationError extends Error {
69
+ }
70
+ export declare class UpstreamPhaseFailoverSignal extends Error {
71
+ readonly reason?: string;
72
+ constructor(reason?: string);
73
+ }
74
+ export declare class ManagedUpstreamAccessError extends Error {
75
+ readonly code = "managed_upstream_access_unavailable";
76
+ constructor(message: string, options?: ErrorOptions);
77
+ }
78
+ export declare class UpstreamTimeoutError extends Error {
79
+ readonly code = "upstream_timeout";
80
+ constructor(timeoutType: 'first_response_timeout' | 'request_timeout');
81
+ }
82
+ export declare class UpstreamNetworkError extends Error {
83
+ readonly code = "upstream_network_error";
84
+ constructor(message: string);
85
+ }
86
+ export declare function isUpstreamTimeoutError(error: unknown): error is UpstreamTimeoutError;
87
+ export declare function isUpstreamNetworkError(error: unknown): error is UpstreamNetworkError;
88
+ export declare function isManagedUpstreamAccessError(error: unknown): error is ManagedUpstreamAccessError;
89
+ export declare function isUpstreamPhaseFailoverSignal(error: unknown): error is UpstreamPhaseFailoverSignal;
90
+ /**
91
+ * Proxies a request to an upstream server
92
+ *
93
+ * This is the core request handling function that:
94
+ * 1. Loads and deduplicates plugins
95
+ * 2. Applies path rewriting
96
+ * 3. Executes plugin hooks (onion model)
97
+ * 4. Applies body/header modification rules
98
+ * 5. Sends request to upstream
99
+ * 6. Processes response
100
+ * 7. Handles errors
101
+ *
102
+ * **Plugin execution order** (onion model):
103
+ * - Request: onRequestInit → onBeforeRequest → onInterceptRequest
104
+ * - Response: onResponse (reverse order)
105
+ * - Error: onError (reverse order)
106
+ *
107
+ * @param requestSnapshot - Request snapshot (for failover isolation)
108
+ * @param route - Route configuration
109
+ * @param upstream - Target upstream server
110
+ * @param requestLog - Request log for debugging
111
+ * @param config - Application configuration
112
+ * @param routeId - Route ID for precompiled hooks lookup
113
+ * @param reqLogger - Request logger for recording
114
+ * @returns Response from upstream (or plugin)
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * const response = await proxyRequest(
119
+ * snapshot,
120
+ * route,
121
+ * selectedUpstream,
122
+ * requestLog,
123
+ * config,
124
+ * route.path,
125
+ * reqLogger
126
+ * );
127
+ * ```
128
+ */
129
+ export declare function executeForward(requestSnapshot: RequestSnapshot, route: EffectiveRouteConfig, upstream: RuntimeUpstream, requestLog: any, config: AppConfig, routeId: string, reqLogger?: RequestLogger, phaseAwareHooks?: PhaseAwareHooks | null, phase1and2Context?: MutableRequestContext, requestSignal?: AbortSignal, attemptOptions?: ProxyAttemptOptions): Promise<ProxyRequestResult>;
130
+ import type { Plugin, PluginHooks } from '@jeffusion/bungee-core/plugin';
131
+ export declare class ForwardPlugin implements Plugin {
132
+ bodyRequirements(): {
133
+ request: "none";
134
+ };
135
+ register(hooks: PluginHooks): void;
136
+ }
@@ -0,0 +1,23 @@
1
+ /** Public SDK entry. This entry never boots the host process. */
2
+ export * from '../plugin.types';
3
+ export * from '../hooks';
4
+ export type { RawResponseResult, RawResponseCompletion, RawResponseError, BoundControlClient, ControlPlugin, PluginControl, CredentialPolicy, CredentialLease, SecretStore, SecretValue, ControlRpcContext, ControlApiHandlerContext, ControlHostContext, UpstreamAccount, UpstreamDraft, BoundAttemptContext, ControlBindingIdentity, ControlApiDeclaration, ControlRpcDeclaration, OfflineRecoveryCapability, OfflineRecoveryContext, OfflineRecoveryPrompt, PluginRecoveryAction } from '../plugin-control/contracts';
5
+ export type * from '../plugin-extensions';
6
+ export type * from '../plugin-services';
7
+ export type * from './contracts';
8
+ export type * from './body-contracts';
9
+ export type * from './websocket-contracts';
10
+ export type * from './request-log-contracts';
11
+ export type { AccessLogEntry } from '../logger/access-log-writer';
12
+ export { protocolSSEOutput } from '../plugins/sse-envelope';
13
+ export { logger } from '../plugin-logger';
14
+ export { ANONYMOUS_PRINCIPAL } from '../plugin-extensions';
15
+ export { DataAdmissionError } from '../data-admission/errors';
16
+ export { isDurableStateConflictError } from '../plugin-durable-state';
17
+ export type { PluginDurableState, DurableJson } from '../plugin-durable-state';
18
+ export type { PluginChannelSnapshotRead } from '../plugin-services/peer-channel-hub';
19
+ export { defineRpcService } from '../plugin-services';
20
+ export { RequestRetryAction } from './retry-action';
21
+ export { TOKEN_METERING_SERVICE_ID, TOKEN_METERING_CONTRACT_VERSION, TOKEN_PRICING_SERVICE_ID, TOKEN_PRICING_CONTRACT_VERSION } from '../plugin-services';
22
+ export { TOKEN_STATS_RANGES, TOKEN_STATS_RETENTION_MS, tokenStatsWindow } from '../token-stats-window';
23
+ export type { DurableMutation, DurableRecord, DurableTransactionOptions } from '../plugin-durable-state';
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- // packages/core/src/plugin-logger.ts
2
+ // src/plugin-logger.ts
3
3
  var sinkKey = Symbol.for("@jeffusion/bungee/plugin-log-sink");
4
4
  function createLogger(bindings = {}) {
5
5
  const method = (level) => (value, message) => {
@@ -25,7 +25,7 @@ function createLogger(bindings = {}) {
25
25
  }
26
26
  var logger = createLogger();
27
27
 
28
- // packages/core/src/hooks/impl.ts
28
+ // src/hooks/impl.ts
29
29
  var WATERFALL_VIEW_TRANSFORM = Symbol("waterfall-view-transform");
30
30
  function normalizeTapInfo(info) {
31
31
  if (typeof info === "string") {
@@ -252,7 +252,7 @@ class AsyncSeriesMapHook extends BaseHook {
252
252
  }
253
253
  }
254
254
  }
255
- // packages/core/src/hooks/plugin-hooks.ts
255
+ // src/hooks/plugin-hooks.ts
256
256
  class AttemptObservationHook extends AsyncParallelHook {
257
257
  async promise(...args) {
258
258
  if (this.taps.length === 0)
@@ -328,7 +328,7 @@ function clearHooks(hooks) {
328
328
  for (const hook of Object.values(hooks))
329
329
  hook.clear();
330
330
  }
331
- // packages/core/src/plugin.types.ts
331
+ // src/plugin.types.ts
332
332
  function hasConfigSchema(PluginClass) {
333
333
  return "configSchema" in PluginClass && Array.isArray(PluginClass.configSchema);
334
334
  }
@@ -347,7 +347,7 @@ function getPluginDescription(plugin) {
347
347
  function getPluginMetadata(plugin) {
348
348
  return plugin.constructor.metadata;
349
349
  }
350
- // packages/core/src/plugins/sse-envelope.ts
350
+ // src/plugins/sse-envelope.ts
351
351
  function protocolSSEOutput(payloads, protocol, source) {
352
352
  return payloads.map((json, index) => {
353
353
  const envelope = { data: JSON.stringify(json), json };
@@ -365,9 +365,9 @@ function protocolSSEOutput(payloads, protocol, source) {
365
365
  return envelope;
366
366
  });
367
367
  }
368
- // packages/core/src/plugin-extensions.ts
368
+ // src/plugin-extensions.ts
369
369
  var ANONYMOUS_PRINCIPAL = Object.freeze({ domain: "anonymous", keyId: "", credentialVersion: 0 });
370
- // packages/core/src/data-admission/errors.ts
370
+ // src/data-admission/errors.ts
371
371
  function safeDetails(details) {
372
372
  if (!details)
373
373
  return;
@@ -390,15 +390,15 @@ class DataAdmissionError extends Error {
390
390
  this.details = safeDetails(details);
391
391
  }
392
392
  }
393
- // packages/core/src/plugin-durable-state.ts
393
+ // src/plugin-durable-state.ts
394
394
  function isDurableStateConflictError(error) {
395
395
  return error instanceof Error && "code" in error && error.code === "durable_state_conflict";
396
396
  }
397
397
  var MAX_BYTES = 1024 * 1024;
398
- // packages/core/src/plugin-services/host-rpc.ts
398
+ // src/plugin-services/host-rpc.ts
399
399
  import { AsyncLocalStorage } from "async_hooks";
400
400
 
401
- // packages/core/src/plugin-services/wire-contract.ts
401
+ // src/plugin-services/wire-contract.ts
402
402
  import { isProxy } from "util/types";
403
403
  var RPC_JSON_MAX_BYTES = 64 * 1024;
404
404
  var RPC_CONTRACT_MAX_BYTES = 256 * 1024;
@@ -811,14 +811,14 @@ function defineRpcService(contract) {
811
811
  return deepFreeze(pure);
812
812
  }
813
813
 
814
- // packages/core/src/plugin-services/rpc-runtime.ts
814
+ // src/plugin-services/rpc-runtime.ts
815
815
  var PROCESSES = new Set(["control", "worker", "ingress"]);
816
816
  var SCOPES = new Set(["global", "binding"]);
817
817
  var PURPOSES = new Set(["bootstrap", "background", "management", "request", "attempt"]);
818
818
  var ENDPOINTS = new WeakMap;
819
819
  var REVOKED = new WeakMap;
820
820
 
821
- // packages/core/src/plugin-services/host-rpc.ts
821
+ // src/plugin-services/host-rpc.ts
822
822
  var SERVICE_ERROR_MESSAGES = {
823
823
  unauthorized: "RPC call is not authorized",
824
824
  not_ready: "RPC endpoint is not ready",
@@ -853,7 +853,7 @@ var SERVICE_ERROR_CODES = new Set(Object.keys(SERVICE_ERROR_MESSAGES));
853
853
  var EMPTY_OPTIONS = Object.freeze({});
854
854
  var FRAME_STORE = new AsyncLocalStorage;
855
855
  var CALLEE_INFO = new WeakMap;
856
- // packages/core/src/plugin-services/peer-channel-protocol.ts
856
+ // src/plugin-services/peer-channel-protocol.ts
857
857
  var CHANNEL_REQUEST_MAX_BYTES = 4 * 1024;
858
858
  var CHANNEL_RESULT_MAX_BYTES = 60 * 1024;
859
859
  var CHANNEL_MAX_CHUNK_BYTES = 60 * 1024;
@@ -876,7 +876,7 @@ var ERROR_CODES = new Set([
876
876
  ]);
877
877
  var RPC_CALL_PURPOSES2 = new Set(["bootstrap", "background", "management", "request", "attempt"]);
878
878
 
879
- // packages/core/src/plugin-services/peer-channel-hub.ts
879
+ // src/plugin-services/peer-channel-hub.ts
880
880
  var CHANNEL_MAX_TRANSFER_BUFFER_BYTES = 4 * CHANNEL_MAX_CHUNK_BYTES;
881
881
  var CHANNEL_MAX_TOTAL_BUFFER_BYTES = 16 * CHANNEL_MAX_CHUNK_BYTES;
882
882
  var CHANNEL_STREAM_MAX_TOTAL_BYTES = 64 * 1024 * 1024;
@@ -887,17 +887,17 @@ var CHANNEL_EVENT_MAX_PAYLOAD_BYTES = 60 * 1024;
887
887
  var EMPTY = new Uint8Array(0);
888
888
  var HANDLE_REGISTRATIONS = new WeakMap;
889
889
 
890
- // packages/core/src/plugin-services/snapshot-store.ts
890
+ // src/plugin-services/snapshot-store.ts
891
891
  var DEFAULT_CHUNK_BYTES = 60 * 1024;
892
892
  var SNAPSHOT_FAMILY_REFS = new Map;
893
893
 
894
- // packages/core/src/plugin-services.ts
894
+ // src/plugin-services.ts
895
895
  var CHANNEL_KINDS = new Set(["events", "snapshot", "stream"]);
896
896
  var TOKEN_METERING_SERVICE_ID = "token-metering.v1";
897
897
  var TOKEN_METERING_CONTRACT_VERSION = 1;
898
898
  var TOKEN_PRICING_SERVICE_ID = "token-stats.pricing.v1";
899
899
  var TOKEN_PRICING_CONTRACT_VERSION = 1;
900
- // packages/core/src/gateway/retry-action.ts
900
+ // src/gateway/retry-action.ts
901
901
  var retryActionBrand = Symbol.for("@jeffusion/bungee/request-retry-action");
902
902
 
903
903
  class RequestRetryAction extends Error {
@@ -914,7 +914,7 @@ class RequestRetryAction extends Error {
914
914
  return value instanceof Error && value[retryActionBrand] === true;
915
915
  }
916
916
  }
917
- // packages/core/src/token-stats-window.ts
917
+ // src/token-stats-window.ts
918
918
  var HOUR = 3600000;
919
919
  var TOKEN_STATS_RETENTION_MS = 31 * 24 * HOUR;
920
920
  var TOKEN_STATS_RANGES = ["1h", "12h", "24h", "1d", "7d", "30d", "day", "week", "month"];
@@ -0,0 +1,346 @@
1
+ import type { BodyConsumer, BodyEvent, BodyHandle, BodyViewIdentity } from './body-contracts';
2
+ import type { WebSocketMessageView } from './websocket-contracts';
3
+ import type { TransportType } from '../logger/transport-outcome';
4
+ export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
5
+ readonly [key: string]: JsonValue;
6
+ };
7
+ export type RequestLogScope = 'request' | 'connection';
8
+ export type LogExecutionCause = {
9
+ readonly kind: 'cancelled';
10
+ readonly source: 'caller' | 'gateway' | 'unknown';
11
+ readonly code?: string;
12
+ } | {
13
+ readonly kind: 'timeout' | 'rejected' | 'transport_error';
14
+ readonly code: string;
15
+ } | {
16
+ readonly kind: 'interrupted';
17
+ readonly code?: string;
18
+ };
19
+ export type RequestResult = {
20
+ readonly state: 'running';
21
+ } | {
22
+ readonly state: 'unconfirmed';
23
+ readonly reason: string;
24
+ } | {
25
+ readonly state: 'succeeded' | 'failed' | 'cancelled' | 'incomplete';
26
+ readonly basis: 'http' | 'protocol' | 'gateway' | 'transport';
27
+ readonly code?: string;
28
+ };
29
+ export type ContentPart = {
30
+ readonly type: 'text';
31
+ readonly group?: string;
32
+ readonly text: string;
33
+ } | {
34
+ readonly type: 'json';
35
+ readonly group?: string;
36
+ readonly value: JsonValue;
37
+ readonly nativeType?: string;
38
+ } | {
39
+ readonly type: 'blob';
40
+ readonly group?: string;
41
+ readonly ref: string;
42
+ readonly mediaType: string;
43
+ };
44
+ export type ContentAvailability = {
45
+ readonly state: 'pending' | 'empty';
46
+ } | {
47
+ readonly state: 'available';
48
+ readonly ref: string;
49
+ } | {
50
+ readonly state: 'unavailable';
51
+ readonly reason: string;
52
+ };
53
+ export interface ContentView {
54
+ readonly capture: {
55
+ readonly state: 'pending' | 'available' | 'empty';
56
+ } | {
57
+ readonly state: 'unavailable';
58
+ readonly reason: string;
59
+ };
60
+ readonly projection: 'complete' | 'partial';
61
+ /** Canonical ContentPart storage and native evidence are independently available. */
62
+ readonly contentRef: ContentAvailability;
63
+ readonly nativeRef: ContentAvailability;
64
+ }
65
+ /** Ordered contributions; replace targets only the same group (including the unnamed group).
66
+ * A final text snapshot replaces its group's deltas rather than appending them again. */
67
+ export interface RequestLogContentContribution {
68
+ readonly mode: 'append' | 'replace';
69
+ readonly part: ContentPart;
70
+ }
71
+ export type RequestLogContentDirection = 'input' | 'output';
72
+ export type RequestLogProjection = ContentView['projection'];
73
+ export interface RequestLogContentSink {
74
+ /** Synchronously copy into the host's bounded spool; capture disabled/closed drops content only.
75
+ * Contributions use the same redaction, byte limits and retention as native evidence. */
76
+ project(direction: RequestLogContentDirection, contributions: readonly RequestLogContentContribution[], projection: RequestLogProjection): void;
77
+ }
78
+ /** Actual ingress facts only. WS accepted send is neither completed delivery nor client read. */
79
+ export type RequestLogTransportFacts = {
80
+ readonly transportType: 'http';
81
+ readonly httpStatus: number | null;
82
+ readonly outcome: 'pending' | 'completed' | 'failed' | 'cancelled' | 'unknown';
83
+ readonly observedAt: number;
84
+ readonly code?: string;
85
+ } | {
86
+ readonly transportType: 'websocket';
87
+ readonly httpStatus: null;
88
+ readonly delivery?: 'pending' | 'accepted' | 'failed' | 'cancelled';
89
+ readonly deliveredThrough?: number;
90
+ readonly observedAt: number;
91
+ readonly code?: string;
92
+ readonly closeCode?: number;
93
+ };
94
+ /** HTTP requestId equals accessId. WS protocol identity arrives through semantic facts.
95
+ * ownerId is the public ingress process UUID + boot_nonce for either transport;
96
+ * never a PID, master generation or configuration revision. No producer supplies result. */
97
+ export interface LogRequestInit {
98
+ readonly scope: RequestLogScope;
99
+ readonly requestId: string;
100
+ readonly accessId: string;
101
+ readonly ownerId: string;
102
+ readonly transportType: TransportType;
103
+ readonly startedAt: number;
104
+ readonly method: string;
105
+ readonly path: string;
106
+ readonly query?: string;
107
+ readonly routePath?: string;
108
+ readonly connectionId?: string;
109
+ readonly input: ContentView;
110
+ readonly output: ContentView;
111
+ }
112
+ export interface LogRequestMetadata {
113
+ readonly routePath?: string;
114
+ readonly upstream?: string;
115
+ readonly transformer?: string;
116
+ readonly transformedPath?: string;
117
+ readonly authSuccess?: boolean;
118
+ readonly authLevel?: string;
119
+ readonly errorMessage?: string;
120
+ readonly reqHeaderId?: string;
121
+ readonly respHeaderId?: string;
122
+ readonly originalReqHeaderId?: string;
123
+ readonly processingSteps?: readonly {
124
+ readonly step: string;
125
+ readonly detail?: JsonValue;
126
+ readonly timestamp: number;
127
+ readonly duration?: number;
128
+ }[];
129
+ }
130
+ export interface RequestLogRecord extends LogRequestInit, LogRequestMetadata {
131
+ /** Actual semantic observation worker UUID + boot_nonce, independently bound from ingress. */
132
+ readonly observationOwnerId?: string;
133
+ readonly protocol?: string;
134
+ readonly operation?: string;
135
+ readonly settledAt?: number;
136
+ readonly observationEndedAt?: number;
137
+ readonly observation: 'active' | 'complete' | 'lost';
138
+ readonly requireTerminal: boolean;
139
+ readonly result: RequestResult;
140
+ readonly transport: RequestLogTransportFacts;
141
+ }
142
+ /** Attempts are diagnostics linked to a main request, never additional main records. */
143
+ export interface RequestLogAttemptIdentity {
144
+ readonly requestId: string;
145
+ readonly attemptId: string;
146
+ readonly attemptNumber: number;
147
+ }
148
+ /** Ingress binds the actually selected worker once; business retries do not change this binding. */
149
+ export interface LogObservationBinding {
150
+ readonly requestId: string;
151
+ readonly ownerId: string;
152
+ readonly observationOwnerId: string;
153
+ }
154
+ /** Only the actual observation owner submits existing diagnostic fields, merged fieldwise
155
+ * and idempotently; this cannot modify init identity, result or content. */
156
+ export interface LogMetadataPatch extends LogObservationBinding {
157
+ readonly metadata: LogRequestMetadata;
158
+ }
159
+ export interface LogSemanticClaim {
160
+ readonly protocol: string;
161
+ readonly operation: string;
162
+ readonly requireTerminal: boolean;
163
+ }
164
+ export interface LogTerminalCandidate {
165
+ readonly state: 'succeeded' | 'failed' | 'cancelled' | 'incomplete';
166
+ readonly basis: 'protocol' | 'gateway';
167
+ readonly code?: string;
168
+ /** Host-captured original message boundary time, not enqueue or persistence time. */
169
+ readonly observedAt: number;
170
+ }
171
+ /** closed is self-contained, so it can precede claim/init in cross-process delivery.
172
+ * Complete without claim explicitly means not-applicable; missing claim alone proves nothing. */
173
+ export type LogSemanticFact = LogObservationBinding & {
174
+ readonly revision: number;
175
+ } & ({
176
+ readonly kind: 'claim';
177
+ readonly claim: LogSemanticClaim;
178
+ } | {
179
+ readonly kind: 'closed';
180
+ readonly claim?: LogSemanticClaim;
181
+ readonly observation: 'complete' | 'lost';
182
+ readonly observationEndedAt: number;
183
+ readonly candidate?: LogTerminalCandidate;
184
+ readonly requiredOutputSequence?: number;
185
+ /** Complete terminal frame end offset in the final identity HTTP body. */
186
+ readonly requiredHttpBodyBytes?: number;
187
+ readonly executionCause?: LogExecutionCause;
188
+ readonly finalUpstreamResponse?: {
189
+ readonly attemptId: string;
190
+ readonly httpStatus: number;
191
+ };
192
+ });
193
+ export type LogSemanticClosed = Extract<LogSemanticFact, {
194
+ readonly kind: 'closed';
195
+ }>;
196
+ /** Content writers update only supplied fields in this direction, never replay a record/result.
197
+ * Native and canonical completion can arrive independently. Duplicate completion is a no-op;
198
+ * late pending updates cannot replace a closed availability. Invalid input is rejected, not coerced.
199
+ * Storage/admission failure is best-effort logging failure and must not block proxy traffic. */
200
+ export interface LogContentPatch {
201
+ readonly requestId: string;
202
+ readonly direction: RequestLogContentDirection;
203
+ readonly content: Partial<ContentView>;
204
+ }
205
+ /** Only the actual ingress owner supplies transport facts, never a logical result. */
206
+ export interface LogTransportPatch {
207
+ readonly revision: number;
208
+ readonly requestId: string;
209
+ readonly ownerId: string;
210
+ readonly transport: RequestLogTransportFacts;
211
+ /** Final HTTP body bytes committed by ingress; never part of public transport. */
212
+ readonly committedBodyBytes?: number;
213
+ }
214
+ /** Host proof of process exit/replacement or a drained, closed observation stream only.
215
+ * Master takeover, temporary disconnect or failure to contact an owner is not such proof. */
216
+ export interface ConfirmedLogOwnerEnd {
217
+ readonly ownerId: string;
218
+ readonly endedAt: number;
219
+ readonly reason: 'process_exit' | 'process_replaced' | 'observation_ended';
220
+ }
221
+ /** Mutators only bounded-enqueue; proxy traffic never awaits SQLite. The writer merges facts
222
+ * and projects the sole result in one SQLite immediate transaction, checking persisted owner-end
223
+ * fences even for late facts. Persist facts arriving before init; count only complete init records.
224
+ * Closed/terminal facts cannot be replaced by pending facts or stale snapshots. Project only after
225
+ * the transport/semantic barrier; persist a bounded deadline when the other side is missing, then
226
+ * reproject on newer owner revisions. Flush control facts promptly, not on the five-second batch timer.
227
+ * Reopening restores pending deadlines; never infer death by scanning all running records. */
228
+ export interface RequestLogFactWriter {
229
+ beginRequest(init: LogRequestInit): void;
230
+ bindObservation(binding: LogObservationBinding): void;
231
+ writeSemantic(fact: LogSemanticFact): void;
232
+ patchTransport(patch: LogTransportPatch): void;
233
+ patchContent(patch: LogContentPatch): void;
234
+ patchMetadata(patch: LogMetadataPatch): void;
235
+ endOwner(fact: ConfirmedLogOwnerEnd): void;
236
+ flush(): Promise<void>;
237
+ close(): Promise<void>;
238
+ }
239
+ export interface RequestLogContext {
240
+ readonly transportType: TransportType;
241
+ readonly method: string;
242
+ readonly path: string;
243
+ readonly webSocketMode?: 'responses';
244
+ }
245
+ export interface RequestLogBodyContext extends RequestLogContext {
246
+ readonly stage: Exclude<BodyViewIdentity['stage'], 'upstream-response'>;
247
+ readonly contentType: string;
248
+ }
249
+ /** Native evidence is explicit JSON, not an untyped canonical projection. */
250
+ export interface RequestLogBodyValue {
251
+ readonly native: JsonValue;
252
+ }
253
+ /** Project through the bounded capture sink; return native evidence, or skip this representation. */
254
+ export type RequestLogBodyParser = (body: BodyHandle, consumer: BodyConsumer, content: RequestLogContentSink) => RequestLogBodyValue | undefined | Promise<RequestLogBodyValue | undefined>;
255
+ export interface RequestLogStreamBody extends RequestLogContentSink {
256
+ /** Reject native storage only; continue consuming and projecting canonical content. */
257
+ discardNative(): void;
258
+ /** UTF-8 bytes granted/reserved from the existing logger budget, not a new setting.
259
+ * Projection exhaustion must not discard native JSON saved through the streaming tokenizer.
260
+ * The content API may expose that native reference as typed JSON without a second projection. */
261
+ readonly projectionByteLimit: number;
262
+ /** Incrementally decoded UTF-8 text from the shared body source. */
263
+ textChunks(): AsyncIterable<string>;
264
+ events(): AsyncIterable<BodyEvent>;
265
+ }
266
+ /** Native evidence: yield one serialized JSON value, or text fragments with format='text'.
267
+ * Canonical parts go through body.project, never mixed into the native byte stream. */
268
+ export interface RequestLogBodyStreamParser {
269
+ readonly format?: 'text';
270
+ readonly stream: (body: RequestLogStreamBody) => AsyncIterable<string>;
271
+ }
272
+ export type RequestLogBodyHandler = RequestLogBodyParser | RequestLogBodyStreamParser;
273
+ export type RequestLogEvent = {
274
+ readonly kind: 'http';
275
+ readonly responseOrigin: 'upstream' | 'gateway';
276
+ readonly status: number;
277
+ readonly contentType: string;
278
+ readonly body: BodyHandle;
279
+ readonly signal: AbortSignal;
280
+ } | RequestLogWebSocketEvent;
281
+ export interface RequestLogWebSocketEvent {
282
+ readonly messageSequence?: number;
283
+ readonly kind: 'websocket';
284
+ readonly direction: 'client' | 'upstream';
285
+ readonly message: WebSocketMessageView;
286
+ /** Payload-free host token for the client frame's local dispatch. */
287
+ readonly requestToken?: object;
288
+ /** Wall-clock time at the client-side message boundary. */
289
+ readonly timestamp: number;
290
+ readonly relatedOperationId?: string;
291
+ /** A final rejection sent by the hosted handler. Forwarded error events may be intermediate. */
292
+ readonly hostedErrorOutcome?: 'failed' | 'cancelled';
293
+ /** The hosted handler finished sending messages for this client request. */
294
+ readonly settled?: true;
295
+ /** JSON inspection is unavailable for this frame because it exceeded the observation budget. */
296
+ readonly oversized?: true;
297
+ }
298
+ export interface RequestLogWebSocketBody extends RequestLogContentSink {
299
+ /** Reject native storage without reading the optional frame; preserve its size/capacity failure reason. */
300
+ discardNative(direction: RequestLogContentDirection, message?: WebSocketMessageView): void;
301
+ /** start already includes the first input message; append subsequent input/output native messages in delivery order. */
302
+ append(direction: RequestLogContentDirection, message: WebSocketMessageView): void;
303
+ /** Discard the request when several candidates could have started the operation. */
304
+ discardRequest(): void;
305
+ /** Discard the response when its full membership cannot be established. */
306
+ discardResponse(reason?: 'size_limit'): void;
307
+ /** Release a candidate that cannot be attributed to an operation. */
308
+ discard(): void;
309
+ }
310
+ export interface RequestLogWebSocketBodies {
311
+ start(request: WebSocketMessageView): RequestLogWebSocketBody | undefined;
312
+ }
313
+ export interface RequestLogRecords {
314
+ /** HTTP claims the existing access main record; WS creates an identified operation.
315
+ * Resolves with its stable requestId after admission, or undefined when skipped. */
316
+ start(fields: {
317
+ readonly protocol: string;
318
+ readonly operation: string;
319
+ /** Protocol claim requires an explicit terminal; EOF without one is unconfirmed. */
320
+ readonly requireTerminal: boolean;
321
+ readonly body?: RequestLogWebSocketBody;
322
+ /** For a WebSocket request confirmed by a later frame, the timestamp of its first client frame. */
323
+ readonly startedAt?: number;
324
+ /** Host token from the first client frame; never retain its payload for delayed identification. */
325
+ readonly requestToken?: object;
326
+ }): Promise<string | undefined>;
327
+ /** Report a protocol terminal candidate, not a durable result. The host owns settlement:
328
+ * drain bounded admitted deliveries and honor hosted rejection/transport failure first.
329
+ * Missing terminal or observation loss is unconfirmed, never protocol incomplete.
330
+ * Omit the candidate when observation ended without a confirmed terminal. */
331
+ finish(id: string, result?: {
332
+ readonly state: 'succeeded' | 'failed' | 'incomplete' | 'cancelled';
333
+ readonly code?: string;
334
+ }, frame?: BodyEvent): void;
335
+ }
336
+ export interface RequestLogObserver {
337
+ /** Hosted WS only: synchronously and idempotently abandon this operation's undelivered
338
+ * prepared work and body capture, without changing other operations or protocol selection.
339
+ * Missing capability or a thrown error requires the host to stop conservatively. */
340
+ abandonWebSocketOperation?(operationId: string): undefined;
341
+ /** Fast, synchronous admission for the log queue. Return false only for messages the observer can ignore. */
342
+ shouldObserveWebSocket?(direction: 'client' | 'upstream', message: WebSocketMessageView): boolean;
343
+ /** Correlate ordered messages synchronously. Return lifecycle work that retains only bounded metadata. */
344
+ prepareWebSocket?(event: RequestLogWebSocketEvent, bodies?: RequestLogWebSocketBodies): ((records: RequestLogRecords) => void | Promise<void>) | undefined;
345
+ observe(event: RequestLogEvent, records: RequestLogRecords): void | Promise<void>;
346
+ }