@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.
- package/dist/access-database.d.ts +22 -0
- package/dist/api/handlers/logs.d.ts +66 -0
- package/dist/api/handlers/stats.d.ts +50 -0
- package/dist/api/logs.d.ts +145 -0
- package/dist/api/types.d.ts +21 -0
- package/dist/{chunk-assets-swq50rh3.js → chunk-assets-vsan7gav.js} +11 -11
- package/dist/{chunk-body-capture-gtta9q26.js → chunk-body-capture-sbk6cdf9.js} +2 -2
- package/dist/{chunk-handler-ehkkxpnq.js → chunk-handler-9k6b95w4.js} +2 -2
- package/dist/{chunk-main-rcw37zhd.js → chunk-main-1p15rgq5.js} +1 -1
- package/dist/{chunk-main-10pgdbgn.js → chunk-main-2efrk1nt.js} +1 -1
- package/dist/{chunk-main-a4eygw79.js → chunk-main-d74e7qxc.js} +1 -1
- package/dist/{chunk-main-p5rpfk7t.js → chunk-main-gwaw6pxp.js} +1 -1
- package/dist/{chunk-main-25kbhd4n.js → chunk-main-mqgkewnx.js} +1 -1
- package/dist/{chunk-main-0w3jk2x4.js → chunk-main-qm1tgaka.js} +2 -2
- package/dist/{chunk-master-276v10xm.js → chunk-master-wtcfwd6g.js} +6 -6
- package/dist/{chunk-plugin-context-manager-nexyp0jb.js → chunk-plugin-context-manager-kabrbg0s.js} +1 -1
- package/dist/{chunk-plugin-manager-dvxc5w6p.js → chunk-plugin-manager-q1bt6xnw.js} +2 -2
- package/dist/{chunk-runtime-upgrade-sjxsa2r6.js → chunk-runtime-upgrade-rvm3d096.js} +3 -3
- package/dist/{chunk-runtime-qbfd9z3p.js → chunk-runtime-xmp308t7.js} +2 -2
- package/dist/{chunk-worker-5mdsmhte.js → chunk-worker-99q8qnj9.js} +9 -9
- package/dist/config-publication/admission-handoff.d.ts +13 -0
- package/dist/config-publication/coordinator-types.d.ts +176 -0
- package/dist/config-publication/current-startup.d.ts +26 -0
- package/dist/config-publication/drain-workers.d.ts +15 -0
- package/dist/config-publication/index.d.ts +6 -0
- package/dist/config-publication/master-coordinator.d.ts +45 -0
- package/dist/config-publication/master-messages.d.ts +2 -0
- package/dist/config-publication/message-fields.d.ts +20 -0
- package/dist/config-publication/messages.d.ts +3 -0
- package/dist/config-publication/process-cleanup.d.ts +30 -0
- package/dist/config-publication/process-identity.d.ts +14 -0
- package/dist/config-publication/process-termination.d.ts +7 -0
- package/dist/config-publication/publication-runner.d.ts +50 -0
- package/dist/config-publication/recovery-disposition.d.ts +17 -0
- package/dist/config-publication/types.d.ts +137 -0
- package/dist/config-publication/waiter-safety.d.ts +2 -0
- package/dist/config-publication/worker-messages.d.ts +2 -0
- package/dist/config-publication/worker-runtime-contract.d.ts +76 -0
- package/dist/config-publication/worker-runtime-plugins.d.ts +8 -0
- package/dist/config-publication/worker-runtime.d.ts +22 -0
- package/dist/config-publication/worker-wait.d.ts +44 -0
- package/dist/config-storage/active-publication.d.ts +37 -0
- package/dist/config-storage/aggregate.d.ts +4 -0
- package/dist/config-storage/async-config-repository.d.ts +125 -0
- package/dist/config-storage/commit-transaction.d.ts +13 -0
- package/dist/config-storage/compiler.d.ts +4 -0
- package/dist/config-storage/config-repository.d.ts +118 -0
- package/dist/config-storage/consistent-read.d.ts +2 -0
- package/dist/config-storage/content-hash.d.ts +17 -0
- package/dist/config-storage/cross-table-audit.d.ts +20 -0
- package/dist/config-storage/current-revision.d.ts +2 -0
- package/dist/config-storage/domain-validation.d.ts +5 -0
- package/dist/config-storage/expression-ast.d.ts +2 -0
- package/dist/config-storage/expression-call-policy.d.ts +2 -0
- package/dist/config-storage/expression-syntax.d.ts +2 -0
- package/dist/config-storage/gateway-target-validation.d.ts +5 -0
- package/dist/config-storage/global-scalars.d.ts +6 -0
- package/dist/config-storage/global-validation.d.ts +2 -0
- package/dist/config-storage/immutable-snapshot.d.ts +4 -0
- package/dist/config-storage/index.d.ts +21 -0
- package/dist/config-storage/json-preflight.d.ts +15 -0
- package/dist/config-storage/management-protection.d.ts +10 -0
- package/dist/config-storage/materialize.d.ts +3 -0
- package/dist/config-storage/menu-store.d.ts +12 -0
- package/dist/config-storage/migrations/baseline.d.ts +8 -0
- package/dist/config-storage/migrations/index.d.ts +8 -0
- package/dist/config-storage/migrations/management-protection.d.ts +2 -0
- package/dist/config-storage/migrations/plan.d.ts +9 -0
- package/dist/config-storage/migrations/prepared-worker-allocation.d.ts +2 -0
- package/dist/config-storage/migrations/publication-retirement.d.ts +3 -0
- package/dist/config-storage/migrations/publication-targets.d.ts +3 -0
- package/dist/config-storage/migrations/request-logs-default.d.ts +2 -0
- package/dist/config-storage/migrations/runtime-cutover.d.ts +2 -0
- package/dist/config-storage/migrations/service-references.d.ts +3 -0
- package/dist/config-storage/migrations/ui-menus.d.ts +2 -0
- package/dist/config-storage/migrations/websocket-connections.d.ts +2 -0
- package/dist/config-storage/migrations/websocket-message-size.d.ts +2 -0
- package/dist/config-storage/migrations/worker-launch-capacity.d.ts +2 -0
- package/dist/config-storage/modification-validation.d.ts +4 -0
- package/dist/config-storage/operation-records.d.ts +42 -0
- package/dist/config-storage/operation-relations.d.ts +6 -0
- package/dist/config-storage/operation-store.d.ts +12 -0
- package/dist/config-storage/persisted-json.d.ts +2 -0
- package/dist/config-storage/persisted-validation.d.ts +7 -0
- package/dist/config-storage/plugin-name.d.ts +2 -0
- package/dist/config-storage/plugin-schema.d.ts +16 -0
- package/dist/config-storage/policy-fields.d.ts +15 -0
- package/dist/config-storage/prepared-command.d.ts +14 -0
- package/dist/config-storage/read-materialization.d.ts +4 -0
- package/dist/config-storage/recovery-store.d.ts +21 -0
- package/dist/config-storage/relation-materialization.d.ts +30 -0
- package/dist/config-storage/repository-snapshot.d.ts +5 -0
- package/dist/config-storage/repository-types.d.ts +216 -0
- package/dist/config-storage/repository-validation.d.ts +6 -0
- package/dist/config-storage/request-logs-default.d.ts +5 -0
- package/dist/config-storage/retirement-store.d.ts +78 -0
- package/dist/config-storage/route-policy-validation.d.ts +2 -0
- package/dist/config-storage/runtime-config.d.ts +14 -0
- package/dist/config-storage/runtime-cutover.d.ts +13 -0
- package/dist/config-storage/runtime-recovery-budget.d.ts +35 -0
- package/dist/config-storage/schema-fingerprint.d.ts +5 -0
- package/dist/config-storage/schema.d.ts +2 -0
- package/dist/config-storage/service-policy-validation.d.ts +4 -0
- package/dist/config-storage/service-reference-upgrade.d.ts +4 -0
- package/dist/config-storage/serving-snapshot.d.ts +9 -0
- package/dist/config-storage/snapshot-validation.d.ts +3 -0
- package/dist/config-storage/sqlite-errors.d.ts +3 -0
- package/dist/config-storage/sqlite-query.d.ts +3 -0
- package/dist/config-storage/sqlite-version.d.ts +10 -0
- package/dist/config-storage/storage-protocol.d.ts +52 -0
- package/dist/config-storage/utf16.d.ts +2 -0
- package/dist/config-storage/validation.d.ts +31 -0
- package/dist/config-storage/worker-launch-store.d.ts +93 -0
- package/dist/config-worker/http-provider.d.ts +6 -0
- package/dist/config-worker/lifecycle.d.ts +84 -0
- package/dist/config-worker/private-transport.d.ts +31 -0
- package/dist/config-worker/process-environment.d.ts +38 -0
- package/dist/config-worker/rate-limit-provider.d.ts +31 -0
- package/dist/config-worker/runtime-dependencies.d.ts +12 -0
- package/dist/config-worker/snapshot-compiler.d.ts +5 -0
- package/dist/config-worker/supervised-process-entry.d.ts +8 -0
- package/dist/core-version.d.ts +1 -0
- package/dist/daemon-control/bootstrap.d.ts +41 -0
- package/dist/daemon-control/index.d.ts +1 -0
- package/dist/daemon-control/launch-identity.d.ts +26 -0
- package/dist/daemon-control/shutdown.d.ts +22 -0
- package/dist/data-admission/errors.d.ts +16 -0
- package/dist/data-admission/host.d.ts +92 -0
- package/dist/data-admission/keyed-state.d.ts +21 -0
- package/dist/data-admission/rpc.d.ts +40 -0
- package/dist/data-admission/worker.d.ts +66 -0
- package/dist/database-schema.d.ts +2 -0
- package/dist/expression-engine.d.ts +33 -0
- package/dist/gateway/admission-plugin.d.ts +7 -0
- package/dist/gateway/auxiliary-request.d.ts +7 -0
- package/dist/gateway/body-contracts.d.ts +39 -0
- package/dist/gateway/body-events.d.ts +58 -0
- package/dist/gateway/body-factory.d.ts +4 -0
- package/dist/gateway/body-observation-stream.d.ts +6 -0
- package/dist/gateway/body-plugin.d.ts +8 -0
- package/dist/gateway/body-resources.d.ts +37 -0
- package/dist/gateway/body-service.d.ts +116 -0
- package/dist/gateway/contracts.d.ts +196 -0
- package/dist/gateway/controlled-views.d.ts +5 -0
- package/dist/gateway/dispatch-plugin.d.ts +11 -0
- package/dist/gateway/dispatch-targets.d.ts +4 -0
- package/dist/gateway/forward-plugin.d.ts +136 -0
- package/dist/gateway/plugin.d.ts +23 -0
- package/dist/gateway/plugin.js +18 -18
- package/dist/gateway/request-log-contracts.d.ts +346 -0
- package/dist/gateway/request-log.d.ts +105 -0
- package/dist/gateway/request-plugin.d.ts +98 -0
- package/dist/gateway/request-rules-plugin.d.ts +61 -0
- package/dist/gateway/response-plugin.d.ts +34 -0
- package/dist/gateway/response-views.d.ts +33 -0
- package/dist/gateway/responses-websocket-session.d.ts +24 -0
- package/dist/gateway/retry-action.d.ts +7 -0
- package/dist/gateway/retry-plugin.d.ts +7 -0
- package/dist/gateway/routing-plugin.d.ts +11 -0
- package/dist/gateway/runtime.d.ts +15 -0
- package/dist/gateway/selection-plugin.d.ts +7 -0
- package/dist/gateway/sse-response.d.ts +6 -0
- package/dist/gateway/websocket-contracts.d.ts +71 -0
- package/dist/gateway/websocket-credential.d.ts +3 -0
- package/dist/gateway/websocket-plugin.d.ts +9 -0
- package/dist/hooks/impl.d.ts +119 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/plugin-hooks.d.ts +308 -0
- package/dist/hooks/types.d.ts +130 -0
- package/dist/ingress/admission-registry.d.ts +56 -0
- package/dist/ingress/admission-set.d.ts +29 -0
- package/dist/ingress/index.d.ts +4 -0
- package/dist/ingress/master-controller.d.ts +278 -0
- package/dist/ingress/runtime.d.ts +29 -0
- package/dist/ingress/supervision-http.d.ts +118 -0
- package/dist/ingress.d.ts +5 -0
- package/dist/instance-lock.d.ts +2 -0
- package/dist/logger/access-log-writer.d.ts +120 -0
- package/dist/logger/body-capture.d.ts +21 -0
- package/dist/logger/body-log-redaction.d.ts +6 -0
- package/dist/logger/body-storage.d.ts +71 -0
- package/dist/logger/content-capture.d.ts +47 -0
- package/dist/logger/dated-log-files.d.ts +5 -0
- package/dist/logger/header-storage.d.ts +54 -0
- package/dist/logger/log-cleanup.d.ts +69 -0
- package/dist/logger/log-url.d.ts +2 -0
- package/dist/logger/request-logger.d.ts +308 -0
- package/dist/logger/transport-outcome.d.ts +25 -0
- package/dist/logger/websocket-body-capture.d.ts +26 -0
- package/dist/logger.d.ts +16 -0
- package/dist/main.d.ts +19 -0
- package/dist/main.js +8 -8
- package/dist/management-listener/index.d.ts +2 -0
- package/dist/management-listener/listener.d.ts +48 -0
- package/dist/management-listener/request-source.d.ts +4 -0
- package/dist/master-runtime/component-recovery.d.ts +40 -0
- package/dist/master-runtime/composition.d.ts +129 -0
- package/dist/master-runtime/configuration-recovery.d.ts +80 -0
- package/dist/master-runtime/control-api-body.d.ts +9 -0
- package/dist/master-runtime/control-api.d.ts +122 -0
- package/dist/master-runtime/error-chain.d.ts +9 -0
- package/dist/master-runtime/initialize-configuration.d.ts +4 -0
- package/dist/master-runtime/instance-lock.d.ts +25 -0
- package/dist/master-runtime/kernel-exit-timer.d.ts +7 -0
- package/dist/master-runtime/kernel-monotonic-clock.d.ts +15 -0
- package/dist/master-runtime/management-auth.d.ts +43 -0
- package/dist/master-runtime/master-plugin-catalog-api.d.ts +18 -0
- package/dist/master-runtime/master-stats.d.ts +52 -0
- package/dist/master-runtime/menu-api.d.ts +19 -0
- package/dist/master-runtime/observability-client.d.ts +49 -0
- package/dist/master-runtime/offline-recovery.d.ts +9 -0
- package/dist/master-runtime/offline-storage-session.d.ts +8 -0
- package/dist/master-runtime/plugin-journal-recovery.d.ts +28 -0
- package/dist/master-runtime/process-identity.d.ts +48 -0
- package/dist/master-runtime/process-options.d.ts +59 -0
- package/dist/master-runtime/publication-task-manager.d.ts +47 -0
- package/dist/master-runtime/reconcile-plugin-dependencies.d.ts +7 -0
- package/dist/master-runtime/recovery-prompt.d.ts +9 -0
- package/dist/master-runtime/route-body-plan.d.ts +31 -0
- package/dist/master-runtime/runtime-cleanup.d.ts +3 -0
- package/dist/master-runtime/runtime-contracts.d.ts +101 -0
- package/dist/master-runtime/runtime-evidence.d.ts +8 -0
- package/dist/master-runtime/runtime-status.d.ts +36 -0
- package/dist/master-runtime/runtime-supervisor.d.ts +30 -0
- package/dist/master-runtime/runtime-upgrade.d.ts +11 -0
- package/dist/master-runtime/runtime-upstreams.d.ts +14 -0
- package/dist/master-runtime/runtime.d.ts +23 -0
- package/dist/master-runtime/shutdown-diagnostics.d.ts +28 -0
- package/dist/master-runtime/signal-handlers.d.ts +18 -0
- package/dist/master-runtime/stopped-instance-lock.d.ts +6 -0
- package/dist/master-runtime/stopped-process.d.ts +2 -0
- package/dist/master-runtime/supervised-worker-client.d.ts +108 -0
- package/dist/master-runtime/supervised-worker-discovery.d.ts +41 -0
- package/dist/master-runtime/supervised-worker-factory.d.ts +298 -0
- package/dist/master-runtime/supervised-worker-process-adapter.d.ts +146 -0
- package/dist/master-runtime/worker-initialization-diagnostics.d.ts +18 -0
- package/dist/master.d.ts +2 -0
- package/dist/oauth-callback.d.ts +8 -0
- package/dist/plugin-artifact-contract.d.ts +4 -0
- package/dist/plugin-artifact-negotiation.d.ts +12 -0
- package/dist/plugin-artifact-types.d.ts +61 -0
- package/dist/plugin-context-manager.d.ts +91 -0
- package/dist/plugin-control/artifact-loader.d.ts +3 -0
- package/dist/plugin-control/contracts.d.ts +180 -0
- package/dist/plugin-control/host.d.ts +90 -0
- package/dist/plugin-control/index.d.ts +3 -0
- package/dist/plugin-control/master-invocation-projector.d.ts +52 -0
- package/dist/plugin-control/request-service-authority.d.ts +33 -0
- package/dist/plugin-control/secret-crypto.d.ts +13 -0
- package/dist/plugin-control/secret-store.d.ts +15 -0
- package/dist/plugin-dependencies.d.ts +30 -0
- package/dist/plugin-durable-state.d.ts +62 -0
- package/dist/plugin-extensions.d.ts +99 -0
- package/dist/plugin-logger.d.ts +17 -0
- package/dist/plugin-manifest-catalog/catalog.d.ts +28 -0
- package/dist/plugin-manifest-catalog/config-constraint-parser.d.ts +3 -0
- package/dist/plugin-manifest-catalog/config-default-validator.d.ts +3 -0
- package/dist/plugin-manifest-catalog/config-field-parser.d.ts +3 -0
- package/dist/plugin-manifest-catalog/config-field-references.d.ts +2 -0
- package/dist/plugin-manifest-catalog/index.d.ts +6 -0
- package/dist/plugin-manifest-catalog/manifest-filesystem.d.ts +9 -0
- package/dist/plugin-manifest-catalog/manifest-json.d.ts +1 -0
- package/dist/plugin-manifest-catalog/manifest-nested-parser.d.ts +11 -0
- package/dist/plugin-manifest-catalog/manifest-parser.d.ts +2 -0
- package/dist/plugin-manifest-catalog/manifest-semver.d.ts +4 -0
- package/dist/plugin-manifest-catalog/manifest-values.d.ts +6 -0
- package/dist/plugin-manifest-catalog/parse-utils.d.ts +19 -0
- package/dist/plugin-manifest-catalog/plugin-field-value.d.ts +3 -0
- package/dist/plugin-manifest-catalog/runtime-identity.d.ts +12 -0
- package/dist/plugin-manifest-catalog/types.d.ts +187 -0
- package/dist/plugin-path-resolver.d.ts +17 -0
- package/dist/plugin-registry.d.ts +165 -0
- package/dist/plugin-runtime-config.d.ts +10 -0
- package/dist/plugin-runtime-diff.d.ts +15 -0
- package/dist/plugin-runtime-orchestrator.d.ts +69 -0
- package/dist/plugin-runtime-state-machine.d.ts +78 -0
- package/dist/plugin-runtime-status.d.ts +29 -0
- package/dist/plugin-services/channels.d.ts +391 -0
- package/dist/plugin-services/command-journal.d.ts +234 -0
- package/dist/plugin-services/contracts.d.ts +23 -0
- package/dist/plugin-services/host-rpc.d.ts +268 -0
- package/dist/plugin-services/peer-broker.d.ts +351 -0
- package/dist/plugin-services/peer-channel-hub.d.ts +457 -0
- package/dist/plugin-services/peer-channel-protocol.d.ts +339 -0
- package/dist/plugin-services/peer-directory.d.ts +163 -0
- package/dist/plugin-services/peer-executor-proof.d.ts +13 -0
- package/dist/plugin-services/peer-frame.d.ts +65 -0
- package/dist/plugin-services/peer-journal.d.ts +25 -0
- package/dist/plugin-services/peer-protocol.d.ts +128 -0
- package/dist/plugin-services/peer-rpc-link.d.ts +218 -0
- package/dist/plugin-services/peer-rpc-mapping.d.ts +133 -0
- package/dist/plugin-services/peer-websocket.d.ts +146 -0
- package/dist/plugin-services/persistence.d.ts +166 -0
- package/dist/plugin-services/rpc-runtime.d.ts +227 -0
- package/dist/plugin-services/snapshot-store.d.ts +77 -0
- package/dist/plugin-services/wire-contract.d.ts +158 -0
- package/dist/plugin-services.d.ts +237 -0
- package/dist/plugin-state/client.d.ts +160 -0
- package/dist/plugin-state/message-size.d.ts +2 -0
- package/dist/plugin-state/operations.d.ts +4 -0
- package/dist/plugin-state/protocol.d.ts +40 -0
- package/dist/plugin-state/storage-rpc.d.ts +7 -0
- package/dist/plugin.types.d.ts +999 -0
- package/dist/plugins/anthropic-request-sanitizer/index.js +17 -17
- package/dist/plugins/anthropic-request-sanitizer/index.js.map +1 -1
- package/dist/plugins/anthropic-tool-name-transformer/index.js +17 -17
- package/dist/plugins/anthropic-tool-name-transformer/index.js.map +1 -1
- package/dist/plugins/chatgpt-oauth/control.js +24 -24
- package/dist/plugins/chatgpt-oauth/control.js.map +1 -1
- package/dist/plugins/chatgpt-oauth/index.js +23 -23
- package/dist/plugins/chatgpt-oauth/index.js.map +1 -1
- package/dist/plugins/codex-router/control.js +19 -19
- package/dist/plugins/codex-router/control.js.map +1 -1
- package/dist/plugins/codex-router/index.js +31 -31
- package/dist/plugins/codex-router/index.js.map +1 -1
- package/dist/plugins/deepseek-reasoning-fix/index.js +17 -17
- package/dist/plugins/deepseek-reasoning-fix/index.js.map +1 -1
- package/dist/plugins/key-access/control.js +18 -18
- package/dist/plugins/key-access/control.js.map +1 -1
- package/dist/plugins/key-access/index.js +19 -19
- package/dist/plugins/key-access/index.js.map +1 -1
- package/dist/plugins/key-access/ingress.js +18 -18
- package/dist/plugins/key-access/ingress.js.map +1 -1
- package/dist/plugins/key-rate-limit/control.js +3 -3
- package/dist/plugins/key-rate-limit/control.js.map +1 -1
- package/dist/plugins/key-rate-limit/index.js +18 -18
- package/dist/plugins/key-rate-limit/index.js.map +1 -1
- package/dist/plugins/key-rate-limit/ingress.js +2 -2
- package/dist/plugins/key-rate-limit/ingress.js.map +1 -1
- package/dist/plugins/llm-protocol-adapter/control.js +48 -48
- package/dist/plugins/llm-protocol-adapter/control.js.map +1 -1
- package/dist/plugins/llm-protocol-adapter/index.js +53 -53
- package/dist/plugins/llm-protocol-adapter/index.js.map +1 -1
- package/dist/plugins/llm-tps/control.js +5 -5
- package/dist/plugins/llm-tps/control.js.map +1 -1
- package/dist/plugins/llm-tps/index.js +20 -20
- package/dist/plugins/llm-tps/index.js.map +1 -1
- package/dist/plugins/model-mapping/control.js +4 -4
- package/dist/plugins/model-mapping/control.js.map +1 -1
- package/dist/plugins/model-mapping/index.js +19 -19
- package/dist/plugins/model-mapping/index.js.map +1 -1
- package/dist/plugins/models-dev/control.js +10 -10
- package/dist/plugins/models-dev/control.js.map +1 -1
- package/dist/plugins/models-dev/index.js +23 -23
- package/dist/plugins/models-dev/index.js.map +1 -1
- package/dist/plugins/request-body-redaction/control.js +2 -2
- package/dist/plugins/request-body-redaction/control.js.map +1 -1
- package/dist/plugins/request-body-redaction/index.js +21 -21
- package/dist/plugins/request-body-redaction/index.js.map +1 -1
- package/dist/plugins/request-logs/index.js +27 -27
- package/dist/plugins/request-logs/index.js.map +1 -1
- package/dist/plugins/request-logs/ingress.js +2 -2
- package/dist/plugins/request-logs/ingress.js.map +1 -1
- package/dist/plugins/signature-repair/index.js +17 -17
- package/dist/plugins/signature-repair/index.js.map +1 -1
- package/dist/plugins/sse-envelope.d.ts +3 -0
- package/dist/plugins/token-budget/control.js +19 -19
- package/dist/plugins/token-budget/control.js.map +1 -1
- package/dist/plugins/token-budget/index.js +19 -19
- package/dist/plugins/token-budget/index.js.map +1 -1
- package/dist/plugins/token-budget/ingress.js +2 -2
- package/dist/plugins/token-budget/ingress.js.map +1 -1
- package/dist/plugins/token-metering/index.js +30 -30
- package/dist/plugins/token-metering/index.js.map +1 -1
- package/dist/plugins/token-stats/control.js +22 -22
- package/dist/plugins/token-stats/control.js.map +1 -1
- package/dist/plugins/token-stats/index.js +22 -22
- package/dist/plugins/token-stats/index.js.map +1 -1
- package/dist/plugins/user-auth/control.js +21 -21
- package/dist/plugins/user-auth/control.js.map +1 -1
- package/dist/plugins/user-auth/index.js +17 -17
- package/dist/plugins/user-auth/index.js.map +1 -1
- package/dist/public-listener/admission-registry.d.ts +15 -0
- package/dist/public-listener/forwarding.d.ts +24 -0
- package/dist/public-listener/headers.d.ts +5 -0
- package/dist/public-listener/index.d.ts +4 -0
- package/dist/public-listener/listener.d.ts +21 -0
- package/dist/public-listener/websocket.d.ts +4 -0
- package/dist/rate-limit/http.d.ts +80 -0
- package/dist/rate-limit/index.d.ts +7 -0
- package/dist/rate-limit/json.d.ts +8 -0
- package/dist/rate-limit/profile.d.ts +46 -0
- package/dist/rate-limit/protocol.d.ts +104 -0
- package/dist/rate-limit/store.d.ts +61 -0
- package/dist/scoped-plugin-registry.d.ts +645 -0
- package/dist/supervision/index.d.ts +12 -0
- package/dist/supervision/process-lifetime-guard.d.ts +54 -0
- package/dist/supervision/protocol.d.ts +173 -0
- package/dist/supervision/state-repository.d.ts +15 -0
- package/dist/supervision/strict-json.d.ts +2 -0
- package/dist/supervision/worker-descriptor.d.ts +77 -0
- package/dist/supervision/worker-http.d.ts +135 -0
- package/dist/supervision/worker-runtime-snapshot.d.ts +64 -0
- package/dist/token-stats-window.d.ts +23 -0
- package/dist/ui/assets.d.ts +8 -0
- package/dist/ui/icon-resources.d.ts +28 -0
- package/dist/ui/menu-icons.d.ts +15 -0
- package/dist/ui/menu-layout.d.ts +10 -0
- package/dist/ui/plugin-sandbox-policy.d.ts +11 -0
- package/dist/ui/server.d.ts +10 -0
- package/dist/updates/archive-installer.d.ts +8 -0
- package/dist/updates/controller.d.ts +50 -0
- package/dist/updates/download.d.ts +8 -0
- package/dist/updates/installation.d.ts +26 -0
- package/dist/updates/names.d.ts +3 -0
- package/dist/updates/release.d.ts +23 -0
- package/dist/updates/restart.d.ts +13 -0
- package/dist/utils/config-validator.d.ts +40 -0
- package/dist/utils/endpoint-resolver.d.ts +20 -0
- package/dist/utils/expression-dependencies.d.ts +10 -0
- package/dist/utils/plugin-helpers.d.ts +46 -0
- package/dist/websocket/headers.d.ts +9 -0
- package/dist/websocket/index.d.ts +3 -0
- package/dist/websocket/message.d.ts +3 -0
- package/dist/websocket/observation.d.ts +36 -0
- package/dist/websocket/transport.d.ts +197 -0
- package/dist/worker/health/checker.d.ts +54 -0
- package/dist/worker/health/scheduler.d.ts +27 -0
- package/dist/worker/request/body-source.d.ts +1 -0
- package/dist/worker/request/context-builder.d.ts +78 -0
- package/dist/worker/request/context.d.ts +55 -0
- package/dist/worker/request/credential.d.ts +10 -0
- package/dist/worker/request/handler.d.ts +3 -0
- package/dist/worker/request/proxy.d.ts +4 -0
- package/dist/worker/request/response-detector.d.ts +9 -0
- package/dist/worker/request/snapshot.d.ts +18 -0
- package/dist/worker/response/attempt-observation.d.ts +24 -0
- package/dist/worker/response/processor.d.ts +4 -0
- package/dist/worker/response/streaming-response.d.ts +1 -0
- package/dist/worker/rules/deep-merge.d.ts +2 -0
- package/dist/worker/rules/modifier.d.ts +3 -0
- package/dist/worker/state/plugin-manager.d.ts +95 -0
- package/dist/worker/state/runtime-state.d.ts +90 -0
- package/dist/worker/types.d.ts +44 -0
- package/dist/worker/upstream/condition-filter.d.ts +31 -0
- package/dist/worker/upstream/failover-coordinator.d.ts +93 -0
- package/dist/worker/upstream/filter.d.ts +37 -0
- package/dist/worker/upstream/priority-group.d.ts +66 -0
- package/dist/worker/upstream/selector.d.ts +10 -0
- package/dist/worker/upstream/service-execution.d.ts +17 -0
- package/dist/worker/utils/jitter.d.ts +81 -0
- package/dist/worker/utils/slow-start.d.ts +67 -0
- package/dist/worker/utils/status-code-matcher.d.ts +10 -0
- package/dist/worker.d.ts +1 -0
- 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';
|
package/dist/gateway/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
368
|
+
// src/plugin-extensions.ts
|
|
369
369
|
var ANONYMOUS_PRINCIPAL = Object.freeze({ domain: "anonymous", keyId: "", credentialVersion: 0 });
|
|
370
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
398
|
+
// src/plugin-services/host-rpc.ts
|
|
399
399
|
import { AsyncLocalStorage } from "async_hooks";
|
|
400
400
|
|
|
401
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
+
}
|