@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,128 @@
|
|
|
1
|
+
import type { SupervisionProcessCredential } from '../supervision/protocol';
|
|
2
|
+
import { type RpcJson } from './wire-contract';
|
|
3
|
+
export declare const PEER_PROTOCOL: "bungee-plugin-communication/v1";
|
|
4
|
+
/** Metadata header limit; the body budget is independent. */
|
|
5
|
+
export declare const PEER_HEADER_MAX_BYTES = 8192;
|
|
6
|
+
/** Raw body frame limit. Larger payloads belong to a separate future stream. */
|
|
7
|
+
export declare const PEER_BODY_MAX_BYTES: number;
|
|
8
|
+
/** Canonical unpadded base64url length of {@link PEER_HEADER_MAX_BYTES}; a pre-decode allocation guard. */
|
|
9
|
+
export declare const PEER_HEADER_MAX_BASE64URL_CHARS: number;
|
|
10
|
+
export declare const PEER_REPLAY_WINDOW_DEFAULT_CAPACITY = 1024;
|
|
11
|
+
export declare const PEER_REPLAY_WINDOW_MIN_CAPACITY = 1;
|
|
12
|
+
export declare const PEER_REPLAY_WINDOW_MAX_CAPACITY = 4096;
|
|
13
|
+
export type PluginPeerRole = 'worker' | 'ingress';
|
|
14
|
+
export type PluginPeerDirection = 'peer-to-control' | 'control-to-peer';
|
|
15
|
+
export type PluginPeerLane = 'registry' | 'rpc' | 'event' | 'snapshot' | 'stream';
|
|
16
|
+
export type PluginPeerKind = 'request' | 'response' | 'cancel' | 'terminal' | 'notification' | 'chunk';
|
|
17
|
+
export type PluginPeerIdentity = {
|
|
18
|
+
readonly role: PluginPeerRole;
|
|
19
|
+
readonly process_instance_id: string;
|
|
20
|
+
readonly boot_nonce: string;
|
|
21
|
+
};
|
|
22
|
+
export type PluginPeerAuthority = {
|
|
23
|
+
readonly controller_epoch: number;
|
|
24
|
+
readonly controller_id: string;
|
|
25
|
+
};
|
|
26
|
+
export type PluginPeerHeader = {
|
|
27
|
+
readonly protocol: typeof PEER_PROTOCOL;
|
|
28
|
+
readonly direction: PluginPeerDirection;
|
|
29
|
+
readonly peer: PluginPeerIdentity;
|
|
30
|
+
readonly authority: PluginPeerAuthority;
|
|
31
|
+
readonly sequence: number;
|
|
32
|
+
readonly request_id: string;
|
|
33
|
+
readonly lane: PluginPeerLane;
|
|
34
|
+
readonly kind: PluginPeerKind;
|
|
35
|
+
readonly deadline_at: number;
|
|
36
|
+
/** Host-authored metadata; typed service-specific validation happens later. */
|
|
37
|
+
readonly context: RpcJson;
|
|
38
|
+
readonly body_hash: `sha256:${string}`;
|
|
39
|
+
readonly mac: `hmac-sha256:${string}`;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Caller-supplied sign input. `protocol`, `peer`, `body_hash`, and `mac` are
|
|
43
|
+
* always generated by the factory from the credential and the raw body.
|
|
44
|
+
*/
|
|
45
|
+
export type PluginPeerUnsignedFields = {
|
|
46
|
+
readonly direction: PluginPeerDirection;
|
|
47
|
+
readonly authority: PluginPeerAuthority;
|
|
48
|
+
readonly sequence: number;
|
|
49
|
+
readonly request_id: string;
|
|
50
|
+
readonly lane: PluginPeerLane;
|
|
51
|
+
readonly kind: PluginPeerKind;
|
|
52
|
+
readonly deadline_at: number;
|
|
53
|
+
readonly context: RpcJson;
|
|
54
|
+
};
|
|
55
|
+
export type PluginPeerPacket = {
|
|
56
|
+
readonly header: PluginPeerHeader;
|
|
57
|
+
readonly body: Uint8Array;
|
|
58
|
+
};
|
|
59
|
+
export type PluginPeerExpectation = {
|
|
60
|
+
readonly direction: PluginPeerDirection;
|
|
61
|
+
readonly authority: PluginPeerAuthority;
|
|
62
|
+
};
|
|
63
|
+
/** Public half of a peer credential: only the frozen public identity, never a key. */
|
|
64
|
+
export type PluginPeerCredential = {
|
|
65
|
+
readonly identity: PluginPeerIdentity;
|
|
66
|
+
};
|
|
67
|
+
export type PluginPeerProtocolErrorCode = 'malformed_message' | 'unsupported_protocol' | 'size_limit' | 'invalid_credential' | 'identity_mismatch' | 'authority_mismatch' | 'direction_mismatch' | 'authentication_failed' | 'replayed';
|
|
68
|
+
/** Fixed-code error. It never carries a cause, payload, secret, or signing body. */
|
|
69
|
+
export declare class PluginPeerProtocolError extends Error {
|
|
70
|
+
readonly code: PluginPeerProtocolErrorCode;
|
|
71
|
+
readonly name = "PluginPeerProtocolError";
|
|
72
|
+
constructor(code: PluginPeerProtocolErrorCode, message: string);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The sole minter. Validates the supervision credential, copies its key before
|
|
76
|
+
* derivation so a later caller mutation cannot change the credential, and keeps
|
|
77
|
+
* the derived key in a private WeakMap. The public object only exposes a frozen
|
|
78
|
+
* public identity.
|
|
79
|
+
*/
|
|
80
|
+
export declare function createPluginPeerCredential(supervision: SupervisionProcessCredential): PluginPeerCredential;
|
|
81
|
+
/** SHA-256 over the exact raw body bytes; never a re-canonicalized JSON form. */
|
|
82
|
+
export declare function hashPluginPeerBody(body: Uint8Array): `sha256:${string}`;
|
|
83
|
+
/**
|
|
84
|
+
* Signs one peer packet. Only {@link PluginPeerUnsignedFields} plus the raw body
|
|
85
|
+
* are accepted; protocol, peer, body_hash and mac are derived. The returned body
|
|
86
|
+
* is a copy so mutating the caller's buffer afterwards cannot change the signed
|
|
87
|
+
* payload.
|
|
88
|
+
*/
|
|
89
|
+
export declare function signPluginPeerPacket(fields: PluginPeerUnsignedFields, body: Uint8Array, credential: PluginPeerCredential): PluginPeerPacket;
|
|
90
|
+
/** Parses and deep-freezes header metadata. No MAC verification. */
|
|
91
|
+
export declare function parsePluginPeerHeader(value: unknown): PluginPeerHeader;
|
|
92
|
+
/** Encodes header metadata as canonical unpadded base64url of its canonical JSON. */
|
|
93
|
+
export declare function encodePluginPeerHeader(header: PluginPeerHeader): string;
|
|
94
|
+
/** Decodes a canonical base64url header with a fatal UTF-8 and byte-bound check. */
|
|
95
|
+
export declare function decodePluginPeerHeader(encoded: string): PluginPeerHeader;
|
|
96
|
+
/**
|
|
97
|
+
* Verifies one peer packet against the credential and the exact expected
|
|
98
|
+
* direction/authority. MAC and body-hash mismatches share one generic error so
|
|
99
|
+
* neither the expected MAC nor the signing body is distinguishable. Deadline
|
|
100
|
+
* expiry is deliberately not judged here: a terminal ACK may legitimately arrive
|
|
101
|
+
* after the business deadline, so admission stays with the caller.
|
|
102
|
+
*/
|
|
103
|
+
export declare function verifyPluginPeerPacket(header: unknown, body: unknown, credential: PluginPeerCredential, expected: PluginPeerExpectation): true;
|
|
104
|
+
export type PluginPeerReplayWindowOptions = {
|
|
105
|
+
readonly capacity?: number;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Per-authority/direction/peer anti-replay window. The host allocates one window
|
|
109
|
+
* per authenticated peer stream; this module never shares a global window and
|
|
110
|
+
* never accepts a sequence on its own — the caller must verify the packet first.
|
|
111
|
+
* `accept` does not verify MACs and does not trust unknown peers.
|
|
112
|
+
*/
|
|
113
|
+
export declare class PluginPeerReplayWindow {
|
|
114
|
+
readonly capacity: number;
|
|
115
|
+
private highest;
|
|
116
|
+
private readonly seen;
|
|
117
|
+
constructor(options?: PluginPeerReplayWindowOptions);
|
|
118
|
+
/**
|
|
119
|
+
* Records an already-authenticated sequence. In-window reordering is accepted;
|
|
120
|
+
* duplicates and sequences older than the window are rejected as `replayed`.
|
|
121
|
+
* A large forward jump prunes the window without ever growing past capacity.
|
|
122
|
+
*/
|
|
123
|
+
accept(sequence: number): void;
|
|
124
|
+
/** Highest accepted sequence; a status counter that never exposes key material. */
|
|
125
|
+
get highestAccepted(): number;
|
|
126
|
+
/** Number of retained in-window sequences; bounded by {@link capacity}. */
|
|
127
|
+
get windowSize(): number;
|
|
128
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* P4 authenticated paired plugin-peer RPC link (protocol/flow).
|
|
3
|
+
*
|
|
4
|
+
* Owns only network-call correlation, in-flight slots, and completion receipts
|
|
5
|
+
* over the signed peer channel. It never decides logical caller authority, holds
|
|
6
|
+
* no endpoint lease, opens no command journal, and never re-executes or retries a
|
|
7
|
+
* command: the host maps an authenticated inbound call to the real
|
|
8
|
+
* `RpcServiceRuntime.invokeTracked` pair through `onRequest`.
|
|
9
|
+
*
|
|
10
|
+
* Contract:
|
|
11
|
+
* - Every frame is decoded, authenticated (inverse direction, exact authority,
|
|
12
|
+
* credential identity) and replay-windowed before dispatch. Kind, lane, the
|
|
13
|
+
* exact `context.op` key set and the body shape are validated before any record
|
|
14
|
+
* lookup, so a malformed wrapper is rejected even with an unknown request id.
|
|
15
|
+
* - `request()` prepares (sequence + sign + encode) first: a prepare failure or an
|
|
16
|
+
* explicit `send === false` is known-not-started. A send that throws after the
|
|
17
|
+
* frame may have entered the transport is unknown: the result gets a fixed code
|
|
18
|
+
* but the terminal stays pending until a real terminal/inspect/host proof.
|
|
19
|
+
* - A result is delivered as soon as it exists; a terminal is emitted only when
|
|
20
|
+
* the provider terminal promise resolves. Rejected/absent/broken terminals keep
|
|
21
|
+
* the record fail-closed. Detached or non-copyable result buffers become a fixed
|
|
22
|
+
* failure, never an empty success.
|
|
23
|
+
* - `dispose()` stops new admission but keeps draining existing legal work over an
|
|
24
|
+
* attached transport. `confirmRemoteStopped()` (host-only) is the trusted proof
|
|
25
|
+
* that the whole remote endpoint is gone: it releases outbound barriers, drops
|
|
26
|
+
* ACKs and completed receipts, and keeps local inbound tasks until their real
|
|
27
|
+
* terminal.
|
|
28
|
+
* - Outbound pending calls, inbound active + completed receipts, and the ACK
|
|
29
|
+
* outbox are bounded; every byte buffer is a captured copy; every error is a
|
|
30
|
+
* fixed code with no cause or secret.
|
|
31
|
+
*/
|
|
32
|
+
import { type RpcJson } from './wire-contract';
|
|
33
|
+
import { type PluginPeerAuthority, type PluginPeerCredential, type PluginPeerDirection, type PluginPeerLane } from './peer-protocol';
|
|
34
|
+
/**
|
|
35
|
+
* Metadata operation carried by the strict `header.context` wrapper.
|
|
36
|
+
*
|
|
37
|
+
* `emit` is the only lane-neutral fire-and-forget operation: the `rpc` lane
|
|
38
|
+
* never uses it (its strict `KIND_BY_OP` mapping still rejects it), while the
|
|
39
|
+
* event/stream/snapshot lanes use it for bulk chunks and notifications that must
|
|
40
|
+
* not pay for a per-frame acknowledgement barrier.
|
|
41
|
+
*/
|
|
42
|
+
export type PluginPeerRpcOp = 'call' | 'result' | 'terminal' | 'cancel' | 'inspect' | 'ack' | 'ack-confirmed' | 'emit';
|
|
43
|
+
/** Fixed result-failure codes that may cross the wire; no provider cause rides along. */
|
|
44
|
+
export type PluginPeerRpcWireErrorCode = 'failed' | 'overloaded' | 'expired' | 'unknown' | 'closed';
|
|
45
|
+
export type PluginPeerRpcLinkErrorCode = PluginPeerRpcWireErrorCode | 'invalid_context' | 'invalid_call' | 'duplicate_conflict' | 'cancelled' | 'timeout' | 'disconnected';
|
|
46
|
+
/** Fixed-code error. It never carries a cause, payload, key, or secret. */
|
|
47
|
+
export declare class PluginPeerRpcLinkError extends Error {
|
|
48
|
+
readonly code: PluginPeerRpcLinkErrorCode;
|
|
49
|
+
readonly name = "PluginPeerRpcLinkError";
|
|
50
|
+
constructor(code: PluginPeerRpcLinkErrorCode, message: string);
|
|
51
|
+
}
|
|
52
|
+
export interface PluginPeerRpcLinkLimits {
|
|
53
|
+
readonly maxOutboundPending?: number;
|
|
54
|
+
readonly maxInboundRecords?: number;
|
|
55
|
+
readonly maxAckOutbox?: number;
|
|
56
|
+
}
|
|
57
|
+
/** Authenticated inbound call handed to the host mapper. */
|
|
58
|
+
export interface PluginPeerRpcInboundCall {
|
|
59
|
+
readonly requestId: string;
|
|
60
|
+
/** Exact lane the call arrived on; lanes never share correlation records. */
|
|
61
|
+
readonly lane: PluginPeerLane;
|
|
62
|
+
/**
|
|
63
|
+
* Opaque caller metadata. For the `rpc` lane this is the strict `caller`
|
|
64
|
+
* field; for the other lanes it is the complete (already op-validated)
|
|
65
|
+
* lane-specific request context, which only that lane handler may parse.
|
|
66
|
+
* Structure only: it grants no authorization.
|
|
67
|
+
*/
|
|
68
|
+
readonly metadata: RpcJson;
|
|
69
|
+
/** Complete op-validated request context; `metadata === context` off the rpc lane. */
|
|
70
|
+
readonly context: RpcJson;
|
|
71
|
+
/** Captured body copy; the caller may write to its own copy freely. */
|
|
72
|
+
readonly body: Uint8Array;
|
|
73
|
+
readonly deadlineAt: number;
|
|
74
|
+
readonly sequence: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* One lane's inbound surface. The link still owns decode/authentication,
|
|
78
|
+
* anti-replay, correlation, deadlines, cancellation and the result/terminal
|
|
79
|
+
* barrier; the handler owns only the lane-specific semantics.
|
|
80
|
+
*/
|
|
81
|
+
export interface PluginPeerLaneHandler {
|
|
82
|
+
/**
|
|
83
|
+
* Admits one lane request. Returning `null` is an explicit refusal (the link
|
|
84
|
+
* answers with a fixed `closed` result + terminal), never a silent drop.
|
|
85
|
+
*/
|
|
86
|
+
onRequest(call: PluginPeerRpcInboundCall, signal: AbortSignal): PluginPeerRpcRequestExecution | null;
|
|
87
|
+
/**
|
|
88
|
+
* Fire-and-forget lane frame (`kind: 'chunk' | 'notification'`). The link
|
|
89
|
+
* validates the op/kind/body shape first; the handler owns its meaning.
|
|
90
|
+
*/
|
|
91
|
+
onEmit?(frame: PluginPeerLaneEmit): void;
|
|
92
|
+
/**
|
|
93
|
+
* The transport was re-attached after a disconnect (a real reconnect, never
|
|
94
|
+
* the first attach). A lane that lost frames while detached can now re-signal
|
|
95
|
+
* a real gap/failure using its own durable state; it must not resend or retry
|
|
96
|
+
* business CALLs/commands.
|
|
97
|
+
*/
|
|
98
|
+
onTransportReady?(): void;
|
|
99
|
+
/** Retire/close/remote-stop notification so pending lane work settles honestly. */
|
|
100
|
+
onTransportEnd?(reason: 'retired' | 'closed' | 'remote-stopped'): void;
|
|
101
|
+
}
|
|
102
|
+
/** One authenticated fire-and-forget lane frame. */
|
|
103
|
+
export interface PluginPeerLaneEmit {
|
|
104
|
+
readonly lane: PluginPeerLane;
|
|
105
|
+
readonly kind: 'chunk' | 'notification';
|
|
106
|
+
readonly requestId: string;
|
|
107
|
+
readonly deadlineAt: number;
|
|
108
|
+
readonly context: RpcJson;
|
|
109
|
+
readonly body: Uint8Array;
|
|
110
|
+
readonly sequence: number;
|
|
111
|
+
}
|
|
112
|
+
export interface PluginPeerRpcRequestExecution {
|
|
113
|
+
readonly result: Promise<Uint8Array>;
|
|
114
|
+
readonly terminal: Promise<void>;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Host mapper. It must return synchronously; the two promises are independent
|
|
118
|
+
* and the terminal must reflect the REAL provider completion, not the reply.
|
|
119
|
+
*/
|
|
120
|
+
export type PluginPeerRpcRequestHandler = (call: PluginPeerRpcInboundCall, signal: AbortSignal) => PluginPeerRpcRequestExecution;
|
|
121
|
+
/** Transport adapter. `false` means the frame never entered the transport. */
|
|
122
|
+
export type PluginPeerRpcSendAdapter = (frame: Uint8Array, priority: 'data' | 'control') => boolean;
|
|
123
|
+
export interface PluginPeerRpcLinkOptions {
|
|
124
|
+
readonly credential: PluginPeerCredential;
|
|
125
|
+
/** Exact host authority the link is bound to; a changed authority needs a new link. */
|
|
126
|
+
readonly authority: PluginPeerAuthority;
|
|
127
|
+
/** Direction used for every frame this link sends; the inbound direction is its inverse. */
|
|
128
|
+
readonly outgoingDirection: PluginPeerDirection;
|
|
129
|
+
readonly onRequest: PluginPeerRpcRequestHandler;
|
|
130
|
+
readonly limits?: PluginPeerRpcLinkLimits;
|
|
131
|
+
}
|
|
132
|
+
export interface PluginPeerRpcRequestOptions {
|
|
133
|
+
readonly signal?: AbortSignal;
|
|
134
|
+
/** Absolute deadline shared with the wire `deadline_at`; required. */
|
|
135
|
+
readonly deadlineAt: number;
|
|
136
|
+
}
|
|
137
|
+
export interface PluginPeerRpcLinkStatus {
|
|
138
|
+
readonly attached: boolean;
|
|
139
|
+
readonly retired: boolean;
|
|
140
|
+
readonly closed: boolean;
|
|
141
|
+
readonly outboundPending: number;
|
|
142
|
+
readonly ackOutbox: number;
|
|
143
|
+
readonly inboundActive: number;
|
|
144
|
+
readonly inboundReceipts: number;
|
|
145
|
+
}
|
|
146
|
+
export declare const PEER_RPC_LINK_MAX_PENDING = 64;
|
|
147
|
+
export declare const PEER_RPC_LINK_MAX_ACK_OUTBOX = 64;
|
|
148
|
+
export declare const PEER_RPC_LINK_MAX_INBOUND_RECORDS = 64;
|
|
149
|
+
/** Global hard cap for any per-link limit; small overrides stay available for tests. */
|
|
150
|
+
export declare const PEER_RPC_LINK_HARD_LIMIT = 1024;
|
|
151
|
+
export declare class PluginPeerRpcLink {
|
|
152
|
+
#private;
|
|
153
|
+
constructor(options: PluginPeerRpcLinkOptions);
|
|
154
|
+
/**
|
|
155
|
+
* Installs the transport. A repeat call is a reconnect: sequences and the replay
|
|
156
|
+
* window are never reset, pending calls are re-inspected, retained ACKs are
|
|
157
|
+
* resent, and waiting ACK transfers are flushed. Calls are never resent and
|
|
158
|
+
* commands are never retried. Attaching while draining is allowed so existing
|
|
159
|
+
* work can finish.
|
|
160
|
+
*/
|
|
161
|
+
attach(send: PluginPeerRpcSendAdapter): void;
|
|
162
|
+
/** Detaches the transport without claiming any remote task ended. */
|
|
163
|
+
disconnect(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Installs the handler for one non-rpc lane. A lane is served by exactly one
|
|
166
|
+
* handler; re-registration (for example after a hub rebuild) replaces it, and
|
|
167
|
+
* the previous handler is told the transport ended so it cannot leak work.
|
|
168
|
+
* The `rpc` lane is never registrable here — it keeps its constructor handler.
|
|
169
|
+
*/
|
|
170
|
+
registerLaneHandler(lane: PluginPeerLane, handler: PluginPeerLaneHandler): void;
|
|
171
|
+
/** Removes one lane handler, telling it the lane is gone. */
|
|
172
|
+
releaseLaneHandler(lane: PluginPeerLane): void;
|
|
173
|
+
/**
|
|
174
|
+
* Correlates one outbound call. Only a prepare failure or an explicit
|
|
175
|
+
* `send === false` is known-not-started (fixed result + resolved terminal); a
|
|
176
|
+
* send that throws keeps a pending terminal until a real proof arrives.
|
|
177
|
+
*/
|
|
178
|
+
request(context: RpcJson, body: Uint8Array, options: PluginPeerRpcRequestOptions): PluginPeerRpcRequestExecution;
|
|
179
|
+
/**
|
|
180
|
+
* Correlates one outbound non-rpc lane call. The lane request context is
|
|
181
|
+
* wrapped as `{ op: 'call', request: context }` and the receiving lane handler
|
|
182
|
+
* owns its validation; correlation, deadlines, cancellation and the
|
|
183
|
+
* result/terminal barrier are exactly the rpc lane's.
|
|
184
|
+
*/
|
|
185
|
+
requestOnLane(lane: PluginPeerLane, context: RpcJson, body: Uint8Array, options: PluginPeerRpcRequestOptions): PluginPeerRpcRequestExecution;
|
|
186
|
+
/**
|
|
187
|
+
* Sends one fire-and-forget lane frame (bulk chunk / notification). Returns
|
|
188
|
+
* `false` when the frame never entered the transport (detached, refusing
|
|
189
|
+
* socket, or a prepare failure), so a caller can apply backpressure instead of
|
|
190
|
+
* assuming delivery. It never creates a correlation record and never blocks.
|
|
191
|
+
*/
|
|
192
|
+
emitLane(lane: PluginPeerLane, kind: 'chunk' | 'notification', requestId: string, deadlineAt: number, context: RpcJson, body: Uint8Array, priority?: 'data' | 'control'): boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Admits one received frame: decode, authenticate, replay-check, then dispatch.
|
|
195
|
+
* Legal frames for existing work are still accepted while draining.
|
|
196
|
+
*/
|
|
197
|
+
receive(frame: Uint8Array | ArrayBuffer): void;
|
|
198
|
+
/**
|
|
199
|
+
* Host-only proof that the whole remote endpoint is gone. Releases every
|
|
200
|
+
* outbound barrier, drops retained ACKs and completed receipts, and aborts (but
|
|
201
|
+
* never releases early) local inbound tasks. Never use for a single task ACK or
|
|
202
|
+
* a socket close.
|
|
203
|
+
*/
|
|
204
|
+
confirmRemoteStopped(): void;
|
|
205
|
+
/** Stops admitting new calls; existing work keeps draining. */
|
|
206
|
+
retire(): void;
|
|
207
|
+
/** Exact link admission state: `true` once retired (new work is refused). */
|
|
208
|
+
get retired(): boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Stops admission, rejects unsettled outbound results, and aborts local inbound
|
|
211
|
+
* signals. Existing result/terminal/inspect/ACK traffic still flows over an
|
|
212
|
+
* attached transport, so receipts can drain; only a real terminal settles an
|
|
213
|
+
* outbound barrier.
|
|
214
|
+
*/
|
|
215
|
+
dispose(): void;
|
|
216
|
+
/** Counts only; it never exposes payload, metadata, or key material. */
|
|
217
|
+
status(): PluginPeerRpcLinkStatus;
|
|
218
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* P4 native/plugin-peer RPC DTO mapping.
|
|
3
|
+
*
|
|
4
|
+
* Bridges the canonical in-process kernel (`RpcServiceRuntime` /
|
|
5
|
+
* `HostRpcAdapter`) and the reviewed authenticated peer link
|
|
6
|
+
* (`PluginPeerRpcLink`) without inventing a second runtime, a second lease, or a
|
|
7
|
+
* second command journal:
|
|
8
|
+
*
|
|
9
|
+
* - The caller side wraps an already-registered proxy endpoint with
|
|
10
|
+
* {@link createPluginPeerRpcProxy}: the native handler context is compiled into
|
|
11
|
+
* one exact bounded frozen call DTO plus a raw strict-JSON body, and the link's
|
|
12
|
+
* independent `result`/`terminal` pair is returned untouched.
|
|
13
|
+
* - The callee side wraps the required host dispatch callback with
|
|
14
|
+
* {@link createPluginPeerRpcRequestHandler}: metadata and body are strictly
|
|
15
|
+
* decoded before any dispatch, the callback must use the real host-bound
|
|
16
|
+
* `invokeTracked`, and a native result rejection is re-encoded as a fixed-code
|
|
17
|
+
* body so the transport never has to interpret a provider error.
|
|
18
|
+
*
|
|
19
|
+
* Authorization is never derived here. The DTO carries only the caller's claimed
|
|
20
|
+
* identity, the exact claimed target binding, and a host-compiled minimal DTO;
|
|
21
|
+
* the trusted host still decides per call against the kernel-selected endpoint
|
|
22
|
+
* and its own broker proof. No opaque callee frame, request, cookie, token, or
|
|
23
|
+
* signal is ever default-serialized into the metadata.
|
|
24
|
+
*/
|
|
25
|
+
import type { PluginServiceScope } from './contracts';
|
|
26
|
+
import { type PluginPeerRpcInboundCall, type PluginPeerRpcLink, type PluginPeerRpcRequestHandler } from './peer-rpc-link';
|
|
27
|
+
import { type RpcCommandAction, type RpcEndpointBinding, type RpcInvocationErrorCode, type RpcInvokeRequest, type RpcProxyExecution, type RpcProxyExecutor } from './rpc-runtime';
|
|
28
|
+
import { type RpcCallKind, type RpcCallPurpose, type RpcJson } from './wire-contract';
|
|
29
|
+
export declare const PEER_RPC_METADATA_VERSION: 1;
|
|
30
|
+
/** Complete call metadata budget: half the peer header, leaving room for the signed wrapper. */
|
|
31
|
+
export declare const PEER_RPC_METADATA_MAX_BYTES: number;
|
|
32
|
+
/** The trusted host DTO must stay minimal; it may never dominate the metadata header. */
|
|
33
|
+
export declare const PEER_RPC_HOST_METADATA_MAX_BYTES: number;
|
|
34
|
+
/** Fixed ASCII prefix that can never begin a legal JSON value. */
|
|
35
|
+
export declare const PEER_RPC_ERROR_PREFIX = "!RPC1:";
|
|
36
|
+
export declare const PEER_RPC_ERROR_CODES: readonly RpcInvocationErrorCode[];
|
|
37
|
+
export type PluginPeerRpcMappingErrorCode = 'invalid_metadata' | 'invalid_input' | 'invalid_result';
|
|
38
|
+
/** Fixed-code mapping error. It never carries a peer payload, cause, or secret. */
|
|
39
|
+
export declare class PluginPeerRpcMappingError extends Error {
|
|
40
|
+
readonly name = "PluginPeerRpcMappingError";
|
|
41
|
+
readonly code: PluginPeerRpcMappingErrorCode;
|
|
42
|
+
constructor(code: PluginPeerRpcMappingErrorCode, message: string);
|
|
43
|
+
}
|
|
44
|
+
/** Frozen caller identity; scope is mandatory on the wire. */
|
|
45
|
+
export type PeerRpcCaller = Readonly<{
|
|
46
|
+
readonly subject: string;
|
|
47
|
+
readonly scope: PluginServiceScope;
|
|
48
|
+
}>;
|
|
49
|
+
export type PeerRpcCallTarget = Readonly<{
|
|
50
|
+
readonly provider: string;
|
|
51
|
+
readonly service: string;
|
|
52
|
+
readonly major: number;
|
|
53
|
+
readonly method: string;
|
|
54
|
+
}>;
|
|
55
|
+
export type PeerRpcCallMetadata = Readonly<{
|
|
56
|
+
readonly version: typeof PEER_RPC_METADATA_VERSION;
|
|
57
|
+
readonly target: PeerRpcCallTarget;
|
|
58
|
+
readonly binding: Readonly<RpcEndpointBinding>;
|
|
59
|
+
readonly caller: PeerRpcCaller;
|
|
60
|
+
readonly purpose: RpcCallPurpose;
|
|
61
|
+
readonly operationId: string | null;
|
|
62
|
+
readonly commandAction: RpcCommandAction | null;
|
|
63
|
+
readonly host: RpcJson;
|
|
64
|
+
}>;
|
|
65
|
+
/** Strict, bounded, frozen decode of one inbound call metadata DTO. */
|
|
66
|
+
export declare function decodePeerRpcCallMetadata(value: unknown): PeerRpcCallMetadata;
|
|
67
|
+
/** Validates one candidate and returns the bounded pure-JSON wire form. */
|
|
68
|
+
export declare function encodePeerRpcCallMetadata(metadata: unknown): RpcJson;
|
|
69
|
+
export type PeerRpcDecodedResult = {
|
|
70
|
+
readonly ok: true;
|
|
71
|
+
readonly value: RpcJson;
|
|
72
|
+
} | {
|
|
73
|
+
readonly ok: false;
|
|
74
|
+
readonly code: RpcInvocationErrorCode;
|
|
75
|
+
};
|
|
76
|
+
/** Encodes a native output (or a business input) as raw strict JSON within the RPC envelope. */
|
|
77
|
+
export declare function encodePeerRpcJsonBody(value: unknown): Uint8Array;
|
|
78
|
+
/** Strictly decodes one raw business input body (never an error body). */
|
|
79
|
+
export declare function decodePeerRpcInputBody(bytes: Uint8Array): RpcJson;
|
|
80
|
+
/** Encodes one fixed native error code as the reserved non-JSON error body. */
|
|
81
|
+
export declare function encodePeerRpcErrorBody(code: RpcInvocationErrorCode): Uint8Array;
|
|
82
|
+
/**
|
|
83
|
+
* Splits one result body into a success value or a fixed error code. The reserved
|
|
84
|
+
* prefix cannot start a legal JSON value, so a success payload that merely
|
|
85
|
+
* *contains* the prefix stays an unambiguous success.
|
|
86
|
+
*/
|
|
87
|
+
export declare function decodePeerRpcResultBody(bytes: Uint8Array): PeerRpcDecodedResult;
|
|
88
|
+
/**
|
|
89
|
+
* Reads a fixed runtime error code from an untrusted rejection without ever
|
|
90
|
+
* invoking an accessor, a proxy trap, or the error's cause/message.
|
|
91
|
+
*/
|
|
92
|
+
export declare function resolvePeerRpcErrorCode(error: unknown): RpcInvocationErrorCode;
|
|
93
|
+
/** Minimal, non-opaque view handed to the trusted host metadata compiler. */
|
|
94
|
+
export type PluginPeerRpcHostCallContext = Readonly<{
|
|
95
|
+
readonly method: string;
|
|
96
|
+
readonly kind: RpcCallKind;
|
|
97
|
+
readonly purpose: RpcCallPurpose;
|
|
98
|
+
readonly operationId: string | null;
|
|
99
|
+
readonly commandAction: RpcCommandAction | null;
|
|
100
|
+
readonly caller: PeerRpcCaller;
|
|
101
|
+
readonly endpoint: Readonly<RpcEndpointBinding & {
|
|
102
|
+
readonly service: string;
|
|
103
|
+
readonly version: number;
|
|
104
|
+
}>;
|
|
105
|
+
readonly deadlineAt: number;
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* Trusted host compiler. It receives the minimal per-call context and THIS
|
|
109
|
+
* call's opaque admission callee frame (never a plugin option and never global
|
|
110
|
+
* state), so it can read the real host-owned frame and emit only an explicitly
|
|
111
|
+
* selected DTO. The opaque frame itself is never serialized by default.
|
|
112
|
+
*/
|
|
113
|
+
export type PluginPeerRpcHostMetadataCompiler<TCallee = unknown> = (context: PluginPeerRpcHostCallContext, callee: TCallee) => RpcJson;
|
|
114
|
+
/**
|
|
115
|
+
* Builds the native `RpcProxyExecutor` that carries one registered proxy
|
|
116
|
+
* endpoint over the authenticated peer link. All preparation is pure and runs
|
|
117
|
+
* before any transport write; the result and terminal stay independent, and
|
|
118
|
+
* only a pure prepare failure may report a resolved terminal.
|
|
119
|
+
*/
|
|
120
|
+
export declare function createPluginPeerRpcProxy<TCallee = unknown>(provider: string, link: PluginPeerRpcLink, compileHostMetadata: PluginPeerRpcHostMetadataCompiler<TCallee>): RpcProxyExecutor<TCallee>;
|
|
121
|
+
/** Exactly what a host-bound `invokeTracked` accepts: caller identity stays host-owned. */
|
|
122
|
+
export type PluginPeerRpcNativeRequest = Omit<RpcInvokeRequest, 'caller' | 'callerToken'>;
|
|
123
|
+
export type PluginPeerRpcNativeDispatch = (metadata: PeerRpcCallMetadata, request: PluginPeerRpcNativeRequest, call: PluginPeerRpcInboundCall) => RpcProxyExecution | null;
|
|
124
|
+
/**
|
|
125
|
+
* Builds the link `onRequest` handler. Metadata and body are strictly decoded
|
|
126
|
+
* before any dispatch, so a malformed wrapper never starts work: such a parse
|
|
127
|
+
* failure is a definite `invalid_input` rejection with a resolved terminal, so
|
|
128
|
+
* the peer record is never left unproven. The required host callback must use
|
|
129
|
+
* the real native `invokeTracked`; only an explicit `null` is a no-dispatch
|
|
130
|
+
* rejection, a thrown callback propagates (fail-closed), and every other return
|
|
131
|
+
* shape keeps an unproven terminal.
|
|
132
|
+
*/
|
|
133
|
+
export declare function createPluginPeerRpcRequestHandler(dispatchNative: PluginPeerRpcNativeDispatch): PluginPeerRpcRequestHandler;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* P4 plugin peer WebSocket transport (host side): bounded BPC1 frames over the
|
|
3
|
+
* existing master-control management listener.
|
|
4
|
+
*
|
|
5
|
+
* This module is a *transport only*. It owns at most one WebSocket per
|
|
6
|
+
* authenticated peer link, strictly validates the upgrade request, asks the
|
|
7
|
+
* host-owned {@link PluginPeerWebSocketAuthorize} callback for the existing
|
|
8
|
+
* {@link PluginPeerRpcLink}, and then hands every inbound binary message
|
|
9
|
+
* straight to `PluginPeerRpcLink.receive`. It never authenticates a peer by
|
|
10
|
+
* itself, never mints a credential, never inspects a Cookie, and never decides
|
|
11
|
+
* caller authority or broker policy — `authorize` is the only admission
|
|
12
|
+
* decision and it is required.
|
|
13
|
+
*
|
|
14
|
+
* Guarantees:
|
|
15
|
+
* - Fixed private path {@link PLUGIN_PEER_WS_PATH}; the management listener
|
|
16
|
+
* installs this adapter on the loopback `master-control` profile only. A
|
|
17
|
+
* transport is never consulted (nor stopped) on a profile that does not own it.
|
|
18
|
+
* - Path, empty query, `GET`, the optional Origin allowlist, and
|
|
19
|
+
* `Upgrade: websocket` are validated before any authorization work. A request
|
|
20
|
+
* that carries an `Origin` header is rejected unless the host explicitly
|
|
21
|
+
* allows it, so a cross-origin browser page can never reach the peer channel.
|
|
22
|
+
* - The handshake bound applies to the *real* authorizations, not to the HTTP
|
|
23
|
+
* wait: a timed-out or aborted authorization keeps its slot until the
|
|
24
|
+
* callback promise actually settles, so a hung callback can never be used to
|
|
25
|
+
* pile up unbounded concurrent admissions. The HTTP wait itself always ends
|
|
26
|
+
* promptly, and a late result can never upgrade after `stopAccepting()`.
|
|
27
|
+
* - Socket bookkeeping stays exact. A connection is tracked from its
|
|
28
|
+
* reservation until Bun reports the *real* close of its socket; the token
|
|
29
|
+
* mapping lives just as long. A logical admission release only detaches the
|
|
30
|
+
* link transport and frees the per-link slot, so a still-closing socket keeps
|
|
31
|
+
* counting against `maxSockets` and a late close can only ever clean up its
|
|
32
|
+
* own object.
|
|
33
|
+
* - Socket close only detaches the transport (`PluginPeerRpcLink.disconnect`).
|
|
34
|
+
* It never calls `confirmRemoteStopped`, never forges a terminal, and never
|
|
35
|
+
* revokes the link's other work. Bun's server WebSocket handler has no
|
|
36
|
+
* `error` callback: a socket fault surfaces as `close`, which is handled
|
|
37
|
+
* exactly the same way. The client binding ignores `error` for the same reason.
|
|
38
|
+
* - Shutdown never claims an unconfirmed close: unresponsive peers are
|
|
39
|
+
* hard-terminated and only a real Bun close callback releases the tracking.
|
|
40
|
+
* If that still cannot be confirmed, `stop()` rejects and the caller's own
|
|
41
|
+
* bounded forced-shutdown path (which owns the instance lock gate) decides.
|
|
42
|
+
* - `send` returns `false` whenever the frame provably did not enter the
|
|
43
|
+
* transport: a closed socket, a buffered-byte budget, a Bun `send` status of
|
|
44
|
+
* `0` (dropped) or a negative status (the socket's own backpressure limit was
|
|
45
|
+
* reached and the message was NOT queued). Only a positive byte count means
|
|
46
|
+
* the frame entered the transport. Treating `-1` as delivered would silently
|
|
47
|
+
* drop frames, which is exactly what breaks a credit/backpressure window. A
|
|
48
|
+
* thrown `send` is never converted to `false`: an unknown transport outcome
|
|
49
|
+
* stays unknown so the link keeps its caller lease.
|
|
50
|
+
*/
|
|
51
|
+
import { PluginPeerRpcLink } from './peer-rpc-link';
|
|
52
|
+
/** Fixed private upgrade path served on the `master-control` listener only. */
|
|
53
|
+
export declare const PLUGIN_PEER_WS_PATH: "/__bungee/internal/plugin-peer/v1";
|
|
54
|
+
export declare const PEER_WS_DEFAULT_MAX_HANDSHAKES = 8;
|
|
55
|
+
export declare const PEER_WS_DEFAULT_HANDSHAKE_TIMEOUT_MS = 5000;
|
|
56
|
+
export declare const PEER_WS_DEFAULT_MAX_SOCKETS = 32;
|
|
57
|
+
export declare const PEER_WS_DEFAULT_MAX_BUFFERED_BYTES: number;
|
|
58
|
+
export declare const PEER_WS_DEFAULT_CONTROL_RESERVE_BYTES: number;
|
|
59
|
+
export declare const PEER_WS_DEFAULT_SOCKET_CLOSE_TIMEOUT_MS = 1000;
|
|
60
|
+
/**
|
|
61
|
+
* Opaque Bun WebSocket data attached by this module. It deliberately exposes no
|
|
62
|
+
* peer identity, caller, authority, credential, URL, or key material: all state
|
|
63
|
+
* lives in a module-private WeakMap keyed by {@link PluginPeerConnectionData.connection}.
|
|
64
|
+
*/
|
|
65
|
+
export interface PluginPeerConnectionData {
|
|
66
|
+
readonly connection: object;
|
|
67
|
+
}
|
|
68
|
+
/** Trusted host admission: returns the existing link, or an explicit `null`. */
|
|
69
|
+
export type PluginPeerWebSocketAuthorize = (request: Request, signal: AbortSignal) => PluginPeerRpcLink | null | Promise<PluginPeerRpcLink | null>;
|
|
70
|
+
export interface PluginPeerWebSocketLimits {
|
|
71
|
+
/** Concurrent *real* authorizations; a timed-out callback still holds its slot. */
|
|
72
|
+
readonly maxHandshakes?: number;
|
|
73
|
+
/** Absolute bound on one HTTP handshake wait (and, once, on the admission signal). */
|
|
74
|
+
readonly handshakeTimeoutMs?: number;
|
|
75
|
+
/**
|
|
76
|
+
* Admitted connections, counting a still-closing socket until Bun reports its
|
|
77
|
+
* real close. This bounds reservations + live + closing sockets together.
|
|
78
|
+
*/
|
|
79
|
+
readonly maxSockets?: number;
|
|
80
|
+
/** Largest accepted inbound binary message; defaults to a full BPC1 frame. */
|
|
81
|
+
readonly maxMessageBytes?: number;
|
|
82
|
+
/** Buffered outbound bytes before a send is refused as backpressure. */
|
|
83
|
+
readonly maxBufferedBytes?: number;
|
|
84
|
+
/** Buffered bytes reserved so control frames can still be written under data pressure. */
|
|
85
|
+
readonly controlReserveBytes?: number;
|
|
86
|
+
/** Bound on one graceful close attempt and on one handshake drain during `stop()`. */
|
|
87
|
+
readonly socketCloseTimeoutMs?: number;
|
|
88
|
+
}
|
|
89
|
+
export interface PluginPeerWebSocketOptions {
|
|
90
|
+
/** REQUIRED trusted admission. Never defaults to allow. */
|
|
91
|
+
readonly authorize: PluginPeerWebSocketAuthorize;
|
|
92
|
+
/** Allowed `Origin` values. Empty means any request carrying `Origin` is rejected. */
|
|
93
|
+
readonly allowedOrigins?: readonly string[];
|
|
94
|
+
readonly limits?: PluginPeerWebSocketLimits;
|
|
95
|
+
}
|
|
96
|
+
export interface PluginPeerWebSocketStatus {
|
|
97
|
+
readonly accepting: boolean;
|
|
98
|
+
/** In-flight real authorizations (the thing `maxHandshakes` bounds). */
|
|
99
|
+
readonly handshakes: number;
|
|
100
|
+
/** Admitted connections from reservation until a confirmed physical close. */
|
|
101
|
+
readonly sockets: number;
|
|
102
|
+
}
|
|
103
|
+
export type PluginPeerWebSocketErrorCode = 'invalid_options' | 'binding_conflict' | 'stop_unconfirmed';
|
|
104
|
+
/** Fixed-code configuration/lifecycle error. It never carries a cause, URL, or secret. */
|
|
105
|
+
export declare class PluginPeerWebSocketError extends Error {
|
|
106
|
+
readonly code: PluginPeerWebSocketErrorCode;
|
|
107
|
+
readonly name = "PluginPeerWebSocketError";
|
|
108
|
+
constructor(code: PluginPeerWebSocketErrorCode, message: string);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Host adapter handed to the management listener. `handle` returns `undefined`
|
|
112
|
+
* only for a successful upgrade — the caller MUST then return `undefined` to
|
|
113
|
+
* Bun rather than constructing a 101 Response — `null` when the request is not
|
|
114
|
+
* the peer path, and a fixed `Response` for every rejection.
|
|
115
|
+
*/
|
|
116
|
+
export interface PluginPeerWebSocketServer {
|
|
117
|
+
handle(request: Request, server: Bun.Server<PluginPeerConnectionData>, signal?: AbortSignal): Promise<Response | undefined | null>;
|
|
118
|
+
/**
|
|
119
|
+
* Synchronously closes handshake admission. Established transports and their
|
|
120
|
+
* in-flight RPC keep running; only new upgrades (and any still-waiting
|
|
121
|
+
* authorization) are cut.
|
|
122
|
+
*/
|
|
123
|
+
stopAccepting(): void;
|
|
124
|
+
/**
|
|
125
|
+
* Stops new upgrades, ends handshake waits, closes transports, and resolves
|
|
126
|
+
* only once every socket close is really confirmed. It rejects with
|
|
127
|
+
* `stop_unconfirmed` rather than claiming an unconfirmed close.
|
|
128
|
+
*/
|
|
129
|
+
stop(): Promise<void>;
|
|
130
|
+
readonly websocket: Bun.WebSocketHandler<PluginPeerConnectionData>;
|
|
131
|
+
/** Counts only; it never exposes a peer identity, caller, or credential. */
|
|
132
|
+
status(): PluginPeerWebSocketStatus;
|
|
133
|
+
}
|
|
134
|
+
export declare function createPluginPeerWebSocketServer(options: PluginPeerWebSocketOptions): PluginPeerWebSocketServer;
|
|
135
|
+
export interface PluginPeerClientSocketOptions {
|
|
136
|
+
readonly maxBufferedBytes?: number;
|
|
137
|
+
readonly controlReserveBytes?: number;
|
|
138
|
+
}
|
|
139
|
+
export interface PluginPeerClientSocketBinding {
|
|
140
|
+
/** True while this exact binding owns the link and its socket is open. */
|
|
141
|
+
readonly attached: boolean;
|
|
142
|
+
/** True once this binding has closed (explicitly, or because its socket closed). */
|
|
143
|
+
readonly closed: boolean;
|
|
144
|
+
close(code?: number, reason?: string): void;
|
|
145
|
+
}
|
|
146
|
+
export declare function bindPluginPeerClientSocket(link: PluginPeerRpcLink, socket: WebSocket, options?: PluginPeerClientSocketOptions): PluginPeerClientSocketBinding;
|