@openllmsh/sdk 2.10.12-alpha.1 → 2.10.12
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/README.md +27 -7
- package/dist/client/chat.d.ts +38 -0
- package/dist/client/chat.js +77 -0
- package/dist/client/devices.d.ts +70 -0
- package/dist/client/devices.js +172 -0
- package/dist/client/http.d.ts +24 -0
- package/dist/client/http.js +34 -0
- package/dist/client/index.d.ts +43 -0
- package/dist/client/index.js +57 -0
- package/dist/client/relay-mux.d.ts +71 -0
- package/dist/client/relay-mux.js +394 -0
- package/dist/client/types.d.ts +47 -0
- package/dist/client/types.js +5 -0
- package/dist/client/vault.d.ts +68 -0
- package/dist/client/vault.js +113 -0
- package/dist/connect/chat.d.ts +24 -0
- package/dist/connect/chat.js +25 -0
- package/dist/connect/client.d.ts +50 -0
- package/dist/connect/client.js +141 -0
- package/dist/connect/config.d.ts +22 -0
- package/dist/connect/config.js +22 -0
- package/dist/connect/errors.d.ts +32 -0
- package/dist/connect/errors.js +85 -0
- package/{connect/index.ts → dist/connect/index.d.ts} +7 -7
- package/dist/connect/index.js +23 -0
- package/dist/connect/oauth.d.ts +51 -0
- package/dist/connect/oauth.js +150 -0
- package/dist/connect/routes.d.ts +38 -0
- package/dist/connect/routes.js +175 -0
- package/dist/connect/store.d.ts +26 -0
- package/dist/connect/store.js +65 -0
- package/dist/mcp/handle.d.ts +6 -0
- package/dist/mcp/handle.js +6 -0
- package/dist/mcp/index.d.ts +15 -0
- package/dist/mcp/index.js +10 -0
- package/dist/mcp/server.d.ts +84 -0
- package/dist/mcp/server.js +168 -0
- package/dist/mcp/tools/marketplace.d.ts +94 -0
- package/dist/mcp/tools/marketplace.js +303 -0
- package/dist/mcp/tools/memory-client.d.ts +109 -0
- package/dist/mcp/tools/memory-client.js +200 -0
- package/dist/mcp/tools/memory-config.d.ts +29 -0
- package/dist/mcp/tools/memory-config.js +12 -0
- package/dist/mcp/tools/memory.d.ts +92 -0
- package/dist/mcp/tools/memory.js +312 -0
- package/dist/mcp/tools/model-priority.d.ts +16 -0
- package/dist/mcp/tools/model-priority.js +87 -0
- package/dist/mcp/tools/openllm.d.ts +75 -0
- package/dist/mcp/tools/openllm.js +715 -0
- package/dist/mcp/types.d.ts +25 -0
- package/dist/mcp/types.js +7 -0
- package/dist/openapi/call.d.ts +26 -0
- package/dist/openapi/call.js +56 -0
- package/dist/openapi/index.d.ts +2 -0
- package/dist/openapi/index.js +2 -0
- package/dist/openapi/openapi.json +80213 -0
- package/dist/openapi/operations.d.ts +14 -0
- package/dist/openapi/operations.js +2060 -0
- package/dist/protocol/access.d.ts +81 -0
- package/dist/protocol/access.js +125 -0
- package/dist/protocol/agent-prompt-text.d.ts +15 -0
- package/{protocol/agent-prompt-text.ts → dist/protocol/agent-prompt-text.js} +9 -14
- package/dist/protocol/agent.d.ts +1487 -0
- package/dist/protocol/agent.js +787 -0
- package/dist/protocol/api-key-syntax.d.ts +58 -0
- package/dist/protocol/api-key-syntax.js +73 -0
- package/dist/protocol/audio.d.ts +18 -0
- package/dist/protocol/audio.js +21 -0
- package/dist/protocol/auth.d.ts +126 -0
- package/dist/protocol/auth.js +119 -0
- package/dist/protocol/changelog.d.ts +69 -0
- package/dist/protocol/changelog.js +107 -0
- package/dist/protocol/chat.d.ts +789 -0
- package/dist/protocol/chat.js +394 -0
- package/dist/protocol/client-registry.d.ts +151 -0
- package/dist/protocol/client-registry.js +238 -0
- package/dist/protocol/config.d.ts +508 -0
- package/dist/protocol/config.js +289 -0
- package/dist/protocol/control-channel.d.ts +102 -0
- package/{protocol/control-channel.ts → dist/protocol/control-channel.js} +33 -61
- package/dist/protocol/cooldown-reason.d.ts +30 -0
- package/dist/protocol/cooldown-reason.js +44 -0
- package/dist/protocol/cost.d.ts +9 -0
- package/dist/protocol/cost.js +8 -0
- package/dist/protocol/daemon-port.d.ts +2 -0
- package/dist/protocol/daemon-port.js +28 -0
- package/dist/protocol/daemon.d.ts +2034 -0
- package/dist/protocol/daemon.js +1286 -0
- package/dist/protocol/default-chains.d.ts +15 -0
- package/dist/protocol/default-chains.js +21 -0
- package/dist/protocol/device-state.d.ts +223 -0
- package/dist/protocol/device-state.js +52 -0
- package/dist/protocol/doctor-report-local.d.ts +105 -0
- package/{protocol/doctor-report-local.ts → dist/protocol/doctor-report-local.js} +92 -196
- package/dist/protocol/doctor-report-policy.d.ts +62 -0
- package/{protocol/doctor-report-policy.ts → dist/protocol/doctor-report-policy.js} +23 -76
- package/dist/protocol/doctor-report.d.ts +406 -0
- package/dist/protocol/doctor-report.js +645 -0
- package/dist/protocol/errors.d.ts +17 -0
- package/dist/protocol/errors.js +10 -0
- package/dist/protocol/execution-selection.d.ts +92 -0
- package/{protocol/execution-selection.ts → dist/protocol/execution-selection.js} +38 -63
- package/dist/protocol/hop-grant.d.ts +28 -0
- package/{protocol/hop-grant.ts → dist/protocol/hop-grant.js} +7 -13
- package/dist/protocol/image-edit-parse.d.ts +25 -0
- package/dist/protocol/image-edit-parse.js +196 -0
- package/dist/protocol/images.d.ts +288 -0
- package/dist/protocol/images.js +229 -0
- package/dist/protocol/index.d.ts +69 -0
- package/dist/protocol/index.js +74 -0
- package/dist/protocol/inference-headers.d.ts +3 -0
- package/dist/protocol/keepalive.d.ts +36 -0
- package/dist/protocol/keepalive.js +51 -0
- package/dist/protocol/local-auth.d.ts +125 -0
- package/dist/protocol/local-auth.js +227 -0
- package/dist/protocol/local-device-control.d.ts +108 -0
- package/{protocol/local-device-control.ts → dist/protocol/local-device-control.js} +40 -70
- package/dist/protocol/local-provider.d.ts +105 -0
- package/dist/protocol/local-provider.js +213 -0
- package/dist/protocol/local-session.d.ts +70 -0
- package/dist/protocol/local-session.js +87 -0
- package/dist/protocol/marketplace.d.ts +190 -0
- package/dist/protocol/marketplace.js +140 -0
- package/{protocol/media-attempt.ts → dist/protocol/media-attempt.d.ts} +11 -50
- package/dist/protocol/media-attempt.js +50 -0
- package/dist/protocol/media-bytes.d.ts +8 -0
- package/dist/protocol/media-bytes.js +21 -0
- package/dist/protocol/media-default.d.ts +56 -0
- package/dist/protocol/media-default.js +302 -0
- package/{protocol/media-dimensions.ts → dist/protocol/media-dimensions.d.ts} +11 -78
- package/dist/protocol/media-dimensions.js +90 -0
- package/dist/protocol/media-input.d.ts +20 -0
- package/dist/protocol/media-input.js +29 -0
- package/dist/protocol/media-model.d.ts +77 -0
- package/dist/protocol/media-model.js +89 -0
- package/{protocol/media-option-issue.ts → dist/protocol/media-option-issue.d.ts} +25 -53
- package/dist/protocol/media-option-issue.js +50 -0
- package/dist/protocol/media-types.d.ts +14 -0
- package/dist/protocol/media-types.js +61 -0
- package/dist/protocol/model-match.d.ts +254 -0
- package/dist/protocol/model-match.js +760 -0
- package/dist/protocol/model-settings.d.ts +153 -0
- package/dist/protocol/model-settings.js +246 -0
- package/dist/protocol/models.d.ts +1065 -0
- package/dist/protocol/models.js +638 -0
- package/dist/protocol/mux.d.ts +350 -0
- package/dist/protocol/mux.js +595 -0
- package/{protocol/plan-surface.ts → dist/protocol/plan-surface.d.ts} +12 -26
- package/dist/protocol/plan-surface.js +39 -0
- package/dist/protocol/provider-models.d.ts +8 -0
- package/{protocol/provider-models.ts → dist/protocol/provider-models.js} +7 -9
- package/dist/protocol/provider-status.d.ts +59 -0
- package/dist/protocol/provider-status.js +142 -0
- package/dist/protocol/provider-tier.d.ts +34 -0
- package/{protocol/provider-tier.ts → dist/protocol/provider-tier.js} +9 -34
- package/dist/protocol/provider-usage.d.ts +230 -0
- package/dist/protocol/provider-usage.js +214 -0
- package/dist/protocol/providers.d.ts +2496 -0
- package/dist/protocol/providers.js +723 -0
- package/dist/protocol/public-usage-index.d.ts +449 -0
- package/dist/protocol/public-usage-index.js +279 -0
- package/dist/protocol/realtime-generated.d.ts +29 -0
- package/{protocol/realtime-generated.ts → dist/protocol/realtime-generated.js} +3 -5
- package/dist/protocol/realtime.d.ts +241 -0
- package/{protocol/realtime.ts → dist/protocol/realtime.js} +88 -155
- package/dist/protocol/registry-pointer.d.ts +24 -0
- package/dist/protocol/registry-pointer.js +78 -0
- package/dist/protocol/relay.d.ts +1152 -0
- package/{protocol/relay.ts → dist/protocol/relay.js} +237 -370
- package/dist/protocol/replay-session.d.ts +4 -0
- package/{protocol/replay-session.ts → dist/protocol/replay-session.js} +1 -8
- package/dist/protocol/responses.d.ts +303 -0
- package/dist/protocol/responses.js +240 -0
- package/dist/protocol/semver.d.ts +59 -0
- package/dist/protocol/semver.js +171 -0
- package/{protocol/setup-mode.ts → dist/protocol/setup-mode.d.ts} +4 -12
- package/dist/protocol/setup-mode.js +18 -0
- package/dist/protocol/sha256-hex.d.ts +2 -0
- package/dist/protocol/sha256-hex.js +93 -0
- package/dist/protocol/stats.d.ts +711 -0
- package/dist/protocol/stats.js +353 -0
- package/dist/protocol/streaming.d.ts +16 -0
- package/dist/protocol/streaming.js +15 -0
- package/{protocol/subscription-daemon-floors.ts → dist/protocol/subscription-daemon-floors.d.ts} +8 -14
- package/dist/protocol/subscription-daemon-floors.js +4 -0
- package/dist/protocol/subscription-provider-compat.d.ts +44 -0
- package/dist/protocol/subscription-provider-compat.js +67 -0
- package/dist/protocol/subscription-provider.d.ts +15 -0
- package/dist/protocol/subscription-provider.js +17 -0
- package/dist/protocol/team-grant.d.ts +14 -0
- package/{protocol/team-grant.ts → dist/protocol/team-grant.js} +0 -3
- package/dist/protocol/team-shareable.d.ts +6 -0
- package/{protocol/team-shareable.ts → dist/protocol/team-shareable.js} +29 -33
- package/dist/protocol/transcription-encoding.d.ts +25 -0
- package/dist/protocol/transcription-encoding.js +47 -0
- package/{protocol/url-locality-dns.ts → dist/protocol/url-locality-dns.d.ts} +1 -23
- package/dist/protocol/url-locality-dns.js +33 -0
- package/dist/protocol/url-locality.d.ts +45 -0
- package/dist/protocol/url-locality.js +288 -0
- package/dist/protocol/usage-snapshots.d.ts +8 -0
- package/{protocol/usage-snapshots.ts → dist/protocol/usage-snapshots.js} +1 -2
- package/dist/protocol/vendor-cli-install.d.ts +20 -0
- package/{protocol/vendor-cli-install.ts → dist/protocol/vendor-cli-install.js} +10 -15
- package/dist/protocol/video-job-plan.d.ts +18 -0
- package/dist/protocol/video-job-plan.js +44 -0
- package/dist/protocol/videos.d.ts +107 -0
- package/dist/protocol/videos.js +154 -0
- package/dist/tunnel/channel-envelope.d.ts +53 -0
- package/dist/tunnel/channel-envelope.js +100 -0
- package/dist/tunnel/codec.d.ts +71 -0
- package/dist/tunnel/codec.js +151 -0
- package/dist/tunnel/device-anchor.d.ts +62 -0
- package/dist/tunnel/device-anchor.js +168 -0
- package/dist/tunnel/device-control.d.ts +50 -0
- package/dist/tunnel/device-control.js +88 -0
- package/dist/tunnel/device-grant.d.ts +91 -0
- package/dist/tunnel/device-grant.js +105 -0
- package/dist/tunnel/fleet.d.ts +28 -0
- package/dist/tunnel/fleet.js +41 -0
- package/dist/tunnel/index.d.ts +22 -0
- package/dist/tunnel/index.js +22 -0
- package/dist/tunnel/mux.d.ts +64 -0
- package/dist/tunnel/mux.js +449 -0
- package/dist/tunnel/peer-link.d.ts +88 -0
- package/dist/tunnel/peer-link.js +271 -0
- package/dist/tunnel/rtc-auth.d.ts +159 -0
- package/dist/tunnel/rtc-auth.js +340 -0
- package/dist/tunnel/rtc-duplex.d.ts +52 -0
- package/dist/tunnel/rtc-duplex.js +148 -0
- package/dist/tunnel/rtc-ice.d.ts +55 -0
- package/dist/tunnel/rtc-ice.js +100 -0
- package/dist/tunnel/secure.d.ts +179 -0
- package/dist/tunnel/secure.js +936 -0
- package/dist/tunnel/stream-reset-error.d.ts +6 -0
- package/dist/tunnel/stream-reset-error.js +9 -0
- package/dist/tunnel/streams.d.ts +244 -0
- package/dist/tunnel/streams.js +1071 -0
- package/dist/tunnel/team-grant.d.ts +90 -0
- package/dist/tunnel/team-grant.js +226 -0
- package/dist/tunnel/wire-bytes.d.ts +32 -0
- package/dist/tunnel/wire-bytes.js +90 -0
- package/dist/vault/api-key.d.ts +71 -0
- package/dist/vault/api-key.js +130 -0
- package/{vault/argon2.ts → dist/vault/argon2.d.ts} +18 -53
- package/dist/vault/argon2.js +82 -0
- package/dist/vault/cli-auth-seal.d.ts +35 -0
- package/dist/vault/cli-auth-seal.js +78 -0
- package/dist/vault/cred-seal.d.ts +18 -0
- package/dist/vault/cred-seal.js +86 -0
- package/dist/vault/credential.d.ts +21 -0
- package/dist/vault/credential.js +26 -0
- package/dist/vault/crypto.d.ts +51 -0
- package/dist/vault/crypto.js +156 -0
- package/dist/vault/daemon-attest.d.ts +68 -0
- package/dist/vault/daemon-attest.js +147 -0
- package/dist/vault/derive.d.ts +34 -0
- package/dist/vault/derive.js +84 -0
- package/dist/vault/device-access.d.ts +17 -0
- package/dist/vault/device-access.js +77 -0
- package/dist/vault/device-anchor.d.ts +42 -0
- package/dist/vault/device-anchor.js +90 -0
- package/dist/vault/device-control.d.ts +80 -0
- package/{vault/device-control.ts → dist/vault/device-control.js} +46 -104
- package/dist/vault/handoff.d.ts +102 -0
- package/dist/vault/handoff.js +236 -0
- package/dist/vault/index.d.ts +21 -0
- package/dist/vault/index.js +21 -0
- package/dist/vault/passkey.d.ts +82 -0
- package/{vault/passkey.ts → dist/vault/passkey.js} +63 -153
- package/dist/vault/phrase.d.ts +40 -0
- package/{vault/phrase.ts → dist/vault/phrase.js} +17 -23
- package/dist/vault/pin.d.ts +46 -0
- package/dist/vault/pin.js +92 -0
- package/dist/vault/public-key-seal.d.ts +17 -0
- package/dist/vault/public-key-seal.js +59 -0
- package/dist/vault/seed.d.ts +96 -0
- package/dist/vault/seed.js +179 -0
- package/dist/vault/team.d.ts +134 -0
- package/dist/vault/team.js +217 -0
- package/dist/vault/vault-item.d.ts +45 -0
- package/dist/vault/vault-item.js +62 -0
- package/dist/vault/vault-migrate-digest.d.ts +10 -0
- package/dist/vault/vault-migrate-digest.js +22 -0
- package/dist/vault/wrapped.d.ts +19 -0
- package/dist/vault/wrapped.js +52 -0
- package/dist/wire/adapters/messages/anthropic-map.d.ts +8 -0
- package/dist/wire/adapters/messages/anthropic-map.js +32 -0
- package/dist/wire/adapters/messages/index.d.ts +7 -0
- package/dist/wire/adapters/messages/index.js +7 -0
- package/dist/wire/adapters/messages/reasoning-from-items.d.ts +14 -0
- package/dist/wire/adapters/messages/reasoning-from-items.js +39 -0
- package/dist/wire/adapters/messages/reasoning-signature.d.ts +81 -0
- package/dist/wire/adapters/messages/reasoning-signature.js +180 -0
- package/dist/wire/adapters/messages/request.d.ts +28 -0
- package/dist/wire/adapters/messages/request.js +490 -0
- package/dist/wire/adapters/messages/response.d.ts +10 -0
- package/dist/wire/adapters/messages/response.js +177 -0
- package/dist/wire/adapters/messages/streaming.d.ts +134 -0
- package/dist/wire/adapters/messages/streaming.js +791 -0
- package/dist/wire/adapters/messages/usage.d.ts +20 -0
- package/dist/wire/adapters/messages/usage.js +10 -0
- package/dist/wire/adapters/responses/index.d.ts +3 -0
- package/dist/wire/adapters/responses/index.js +3 -0
- package/dist/wire/adapters/responses/request.d.ts +2 -0
- package/dist/wire/adapters/responses/request.js +287 -0
- package/dist/wire/adapters/responses/response.d.ts +11 -0
- package/dist/wire/adapters/responses/response.js +69 -0
- package/dist/wire/adapters/responses/streaming.d.ts +2 -0
- package/dist/wire/adapters/responses/streaming.js +267 -0
- package/dist/wire/features/account-rank.d.ts +61 -0
- package/dist/wire/features/account-rank.js +109 -0
- package/dist/wire/features/compaction/compact-request.d.ts +69 -0
- package/dist/wire/features/compaction/compact-request.js +667 -0
- package/dist/wire/features/compaction/compaction-text.d.ts +17 -0
- package/dist/wire/features/compaction/compaction-text.js +29 -0
- package/dist/wire/features/context-demote.d.ts +15 -0
- package/dist/wire/features/context-demote.js +45 -0
- package/dist/wire/features/context-overflow-strategy.d.ts +12 -0
- package/dist/wire/features/context-overflow-strategy.js +8 -0
- package/dist/wire/features/context-skip.d.ts +120 -0
- package/{wire/features/context-skip.ts → dist/wire/features/context-skip.js} +23 -57
- package/dist/wire/features/conversation-affinity.d.ts +49 -0
- package/dist/wire/features/conversation-affinity.js +121 -0
- package/dist/wire/features/max-tokens-backfill.d.ts +50 -0
- package/dist/wire/features/max-tokens-backfill.js +118 -0
- package/dist/wire/features/model-caps.d.ts +7 -0
- package/dist/wire/features/model-caps.js +40 -0
- package/dist/wire/features/model-settings.d.ts +3 -0
- package/dist/wire/features/model-settings.js +13 -0
- package/dist/wire/features/output-limit-clamp.d.ts +14 -0
- package/dist/wire/features/output-limit-clamp.js +36 -0
- package/dist/wire/features/quota-gate.d.ts +16 -0
- package/dist/wire/features/quota-gate.js +48 -0
- package/dist/wire/index.d.ts +44 -0
- package/dist/wire/index.js +44 -0
- package/dist/wire/lib/attempt-outcome.d.ts +19 -0
- package/dist/wire/lib/attempt-outcome.js +18 -0
- package/{wire/lib/canonical/content-part.ts → dist/wire/lib/canonical/content-part.d.ts} +12 -18
- package/dist/wire/lib/canonical/content-part.js +11 -0
- package/dist/wire/lib/canonical/count-tokens-capability.d.ts +52 -0
- package/dist/wire/lib/canonical/count-tokens-capability.js +109 -0
- package/{wire/lib/canonical/encoding-select.ts → dist/wire/lib/canonical/encoding-select.d.ts} +7 -24
- package/dist/wire/lib/canonical/encoding-select.js +26 -0
- package/dist/wire/lib/canonical/image-signature.d.ts +20 -0
- package/dist/wire/lib/canonical/image-signature.js +184 -0
- package/dist/wire/lib/canonical/image-sse.d.ts +88 -0
- package/dist/wire/lib/canonical/image-sse.js +173 -0
- package/{wire/lib/canonical/message.ts → dist/wire/lib/canonical/message.d.ts} +2 -20
- package/dist/wire/lib/canonical/message.js +31 -0
- package/dist/wire/lib/canonical/token-estimate.d.ts +98 -0
- package/dist/wire/lib/canonical/token-estimate.js +230 -0
- package/dist/wire/lib/encrypted-content.d.ts +22 -0
- package/dist/wire/lib/encrypted-content.js +55 -0
- package/dist/wire/lib/error-class.d.ts +57 -0
- package/dist/wire/lib/error-class.js +97 -0
- package/dist/wire/lib/error-envelope.d.ts +20 -0
- package/dist/wire/lib/error-envelope.js +53 -0
- package/dist/wire/lib/forwarded-headers.d.ts +16 -0
- package/{wire/lib/forwarded-headers.ts → dist/wire/lib/forwarded-headers.js} +62 -72
- package/dist/wire/lib/provider-error-rules.d.ts +21 -0
- package/dist/wire/lib/provider-error-rules.js +20 -0
- package/{wire/lib/refusal.ts → dist/wire/lib/refusal.d.ts} +3 -13
- package/dist/wire/lib/refusal.js +27 -0
- package/dist/wire/lib/responses-apply-patch.d.ts +57 -0
- package/dist/wire/lib/responses-apply-patch.js +81 -0
- package/dist/wire/lib/responses-namespace.d.ts +27 -0
- package/{wire/lib/responses-namespace.ts → dist/wire/lib/responses-namespace.js} +16 -32
- package/dist/wire/lib/secret-scrub.d.ts +23 -0
- package/dist/wire/lib/secret-scrub.js +72 -0
- package/dist/wire/lib/streaming/accumulate.d.ts +12 -0
- package/dist/wire/lib/streaming/accumulate.js +187 -0
- package/dist/wire/lib/streaming/finish-reason.d.ts +20 -0
- package/dist/wire/lib/streaming/finish-reason.js +15 -0
- package/{wire/lib/streaming/peek.ts → dist/wire/lib/streaming/peek.d.ts} +13 -82
- package/dist/wire/lib/streaming/peek.js +100 -0
- package/dist/wire/lib/streaming/provider-decode.d.ts +57 -0
- package/dist/wire/lib/streaming/provider-decode.js +210 -0
- package/dist/wire/lib/streaming/response-stream.d.ts +16 -0
- package/dist/wire/lib/streaming/response-stream.js +64 -0
- package/dist/wire/lib/streaming/sse.d.ts +130 -0
- package/dist/wire/lib/streaming/sse.js +600 -0
- package/dist/wire/lib/streaming/strip-tool-calls.d.ts +14 -0
- package/dist/wire/lib/streaming/strip-tool-calls.js +75 -0
- package/dist/wire/lib/streaming/upstream-error.d.ts +32 -0
- package/dist/wire/lib/streaming/upstream-error.js +45 -0
- package/dist/wire/lib/strip-subagent-isolation.d.ts +16 -0
- package/dist/wire/lib/strip-subagent-isolation.js +240 -0
- package/dist/wire/lib/thinking-signature.d.ts +56 -0
- package/{wire/lib/thinking-signature.ts → dist/wire/lib/thinking-signature.js} +77 -84
- package/dist/wire/lib/token-ruler/bpe-core.d.ts +105 -0
- package/dist/wire/lib/token-ruler/bpe-core.js +398 -0
- package/dist/wire/lib/token-ruler/index.d.ts +2 -0
- package/dist/wire/lib/token-ruler/index.js +2 -0
- package/dist/wire/lib/token-ruler/ruler.d.ts +36 -0
- package/dist/wire/lib/token-ruler/ruler.js +50 -0
- package/dist/wire/lib/token-ruler/vocab/claude-ranks.d.ts +14 -0
- package/dist/wire/lib/token-ruler/vocab/claude-ranks.js +16 -0
- package/{wire/lib/token-ruler/vocab/claude.ts → dist/wire/lib/token-ruler/vocab/claude.d.ts} +2 -12
- package/dist/wire/lib/token-ruler/vocab/claude.js +8 -0
- package/dist/wire/lib/token-ruler/vocab/o200k-ranks.d.ts +3 -0
- package/dist/wire/lib/token-ruler/vocab/o200k-ranks.js +18 -0
- package/dist/wire/lib/token-ruler/vocab/o200k.d.ts +11 -0
- package/dist/wire/lib/token-ruler/vocab/o200k.js +6 -0
- package/dist/wire/lib/tool-name-map.d.ts +44 -0
- package/dist/wire/lib/tool-name-map.js +186 -0
- package/dist/wire/lib/tool-schema.d.ts +15 -0
- package/dist/wire/lib/tool-schema.js +307 -0
- package/dist/wire/lib/usage-observer.d.ts +9 -0
- package/dist/wire/lib/usage-observer.js +108 -0
- package/dist/wire/providers/anthropic/adaptive-thinking.d.ts +125 -0
- package/dist/wire/providers/anthropic/adaptive-thinking.js +221 -0
- package/dist/wire/providers/anthropic/beta-headers.d.ts +44 -0
- package/{wire/providers/anthropic/beta-headers.ts → dist/wire/providers/anthropic/beta-headers.js} +57 -79
- package/dist/wire/providers/anthropic/index.d.ts +6 -0
- package/{wire/providers/anthropic/index.ts → dist/wire/providers/anthropic/index.js} +6 -6
- package/dist/wire/providers/anthropic/request.d.ts +12 -0
- package/dist/wire/providers/anthropic/request.js +456 -0
- package/dist/wire/providers/anthropic/response.d.ts +3 -0
- package/dist/wire/providers/anthropic/response.js +126 -0
- package/dist/wire/providers/anthropic/streaming.d.ts +28 -0
- package/dist/wire/providers/anthropic/streaming.js +268 -0
- package/dist/wire/providers/anthropic/web-search-domains.d.ts +7 -0
- package/dist/wire/providers/anthropic/web-search-domains.js +36 -0
- package/dist/wire/providers/chatgpt/common.d.ts +27 -0
- package/{wire/providers/chatgpt/common.ts → dist/wire/providers/chatgpt/common.js} +69 -89
- package/dist/wire/providers/chatgpt/index.d.ts +4 -0
- package/{wire/providers/chatgpt/index.ts → dist/wire/providers/chatgpt/index.js} +4 -4
- package/dist/wire/providers/chatgpt/request.d.ts +132 -0
- package/dist/wire/providers/chatgpt/request.js +696 -0
- package/dist/wire/providers/chatgpt/streaming.d.ts +69 -0
- package/dist/wire/providers/chatgpt/streaming.js +761 -0
- package/dist/wire/providers/chatgpt/web-search.d.ts +19 -0
- package/dist/wire/providers/chatgpt/web-search.js +55 -0
- package/dist/wire/providers/grok/web-search.d.ts +23 -0
- package/dist/wire/providers/grok/web-search.js +74 -0
- package/dist/wire/providers/kimi/web-search.d.ts +48 -0
- package/dist/wire/providers/kimi/web-search.js +106 -0
- package/dist/wire/providers/upstream-deny.d.ts +61 -0
- package/dist/wire/providers/upstream-deny.js +293 -0
- package/dist/wire/providers/upstream-request.d.ts +104 -0
- package/dist/wire/providers/upstream-request.js +411 -0
- package/package.json +105 -23
- package/ARCHITECTURE.md +0 -43
- package/client/chat.ts +0 -140
- package/client/devices.ts +0 -269
- package/client/http.ts +0 -72
- package/client/index.ts +0 -129
- package/client/relay-mux.ts +0 -547
- package/client/types.ts +0 -51
- package/client/vault.ts +0 -239
- package/connect/chat.ts +0 -58
- package/connect/client.ts +0 -240
- package/connect/config.ts +0 -47
- package/connect/errors.ts +0 -121
- package/connect/oauth.ts +0 -265
- package/connect/routes.ts +0 -234
- package/connect/store.ts +0 -107
- package/mcp/handle.ts +0 -24
- package/mcp/index.ts +0 -76
- package/mcp/server.ts +0 -319
- package/mcp/tools/marketplace.ts +0 -439
- package/mcp/tools/memory-client.ts +0 -297
- package/mcp/tools/memory-config.ts +0 -32
- package/mcp/tools/memory.ts +0 -369
- package/mcp/tools/model-priority.ts +0 -88
- package/mcp/tools/openllm.ts +0 -883
- package/mcp/types.ts +0 -28
- package/openapi/call.ts +0 -90
- package/openapi/index.ts +0 -8
- package/openapi/openapi.json +0 -80213
- package/openapi/operations.ts +0 -2075
- package/protocol/CONTRIBUTING.md +0 -21
- package/protocol/README.md +0 -134
- package/protocol/access.ts +0 -186
- package/protocol/agent.ts +0 -991
- package/protocol/api-key-syntax.ts +0 -105
- package/protocol/assets/openllm-light.svg +0 -18
- package/protocol/assets/openllm.svg +0 -18
- package/protocol/audio.ts +0 -29
- package/protocol/auth.ts +0 -142
- package/protocol/changelog.ts +0 -155
- package/protocol/chat.ts +0 -458
- package/protocol/client-registry.ts +0 -356
- package/protocol/config.ts +0 -345
- package/protocol/cooldown-reason.ts +0 -78
- package/protocol/cost.ts +0 -10
- package/protocol/daemon-port.ts +0 -31
- package/protocol/daemon.ts +0 -1524
- package/protocol/default-chains.ts +0 -66
- package/protocol/device-state.ts +0 -85
- package/protocol/doctor-report.ts +0 -947
- package/protocol/errors.ts +0 -14
- package/protocol/image-edit-parse.ts +0 -263
- package/protocol/images.ts +0 -298
- package/protocol/index.ts +0 -74
- package/protocol/keepalive.ts +0 -69
- package/protocol/local-auth.ts +0 -300
- package/protocol/local-provider.ts +0 -288
- package/protocol/local-session.ts +0 -118
- package/protocol/marketplace.ts +0 -187
- package/protocol/media-bytes.ts +0 -28
- package/protocol/media-default.ts +0 -357
- package/protocol/media-input.ts +0 -61
- package/protocol/media-model.ts +0 -142
- package/protocol/media-types.ts +0 -70
- package/protocol/model-match.ts +0 -1051
- package/protocol/model-settings.ts +0 -327
- package/protocol/models.ts +0 -767
- package/protocol/mux.ts +0 -722
- package/protocol/provider-status.ts +0 -206
- package/protocol/provider-usage.ts +0 -263
- package/protocol/providers.ts +0 -901
- package/protocol/public-usage-index.ts +0 -354
- package/protocol/registry-pointer.ts +0 -118
- package/protocol/responses.ts +0 -280
- package/protocol/semver.ts +0 -182
- package/protocol/sha256-hex.ts +0 -98
- package/protocol/stats.ts +0 -406
- package/protocol/streaming.ts +0 -19
- package/protocol/subscription-provider-compat.ts +0 -104
- package/protocol/subscription-provider.ts +0 -32
- package/protocol/transcription-encoding.ts +0 -76
- package/protocol/url-locality.ts +0 -288
- package/protocol/video-job-plan.ts +0 -50
- package/protocol/videos.ts +0 -227
- package/tsconfig.json +0 -14
- package/tunnel/ARCHITECTURE.md +0 -111
- package/tunnel/assets/openllm-light.svg +0 -18
- package/tunnel/assets/openllm.svg +0 -18
- package/tunnel/channel-envelope.ts +0 -139
- package/tunnel/codec.ts +0 -191
- package/tunnel/device-anchor.ts +0 -229
- package/tunnel/device-control.ts +0 -118
- package/tunnel/device-grant.ts +0 -173
- package/tunnel/fleet.ts +0 -77
- package/tunnel/index.ts +0 -22
- package/tunnel/mux.ts +0 -580
- package/tunnel/peer-link.ts +0 -390
- package/tunnel/rtc-auth.ts +0 -415
- package/tunnel/rtc-duplex.ts +0 -187
- package/tunnel/rtc-ice.ts +0 -136
- package/tunnel/secure.ts +0 -1298
- package/tunnel/stream-reset-error.ts +0 -14
- package/tunnel/streams.ts +0 -1430
- package/tunnel/team-grant.ts +0 -302
- package/tunnel/wire-bytes.ts +0 -102
- package/vault/ARCHITECTURE.md +0 -470
- package/vault/api-key.ts +0 -190
- package/vault/cli-auth-seal.ts +0 -157
- package/vault/cred-seal.ts +0 -146
- package/vault/credential.ts +0 -55
- package/vault/crypto.ts +0 -210
- package/vault/daemon-attest.ts +0 -229
- package/vault/derive.ts +0 -113
- package/vault/device-access.ts +0 -87
- package/vault/device-anchor.ts +0 -185
- package/vault/handoff.ts +0 -396
- package/vault/index.ts +0 -21
- package/vault/pin.ts +0 -153
- package/vault/public-key-seal.ts +0 -131
- package/vault/seed.ts +0 -272
- package/vault/team.ts +0 -355
- package/vault/vault-item.ts +0 -131
- package/vault/vault-migrate-digest.ts +0 -29
- package/vault/wrapped.ts +0 -77
- package/wire/ARCHITECTURE.md +0 -90
- package/wire/CONTRIBUTING.md +0 -19
- package/wire/adapters/messages/anthropic-map.ts +0 -37
- package/wire/adapters/messages/index.ts +0 -7
- package/wire/adapters/messages/reasoning-from-items.ts +0 -38
- package/wire/adapters/messages/reasoning-signature.ts +0 -243
- package/wire/adapters/messages/request.ts +0 -574
- package/wire/adapters/messages/response.ts +0 -215
- package/wire/adapters/messages/streaming.ts +0 -1027
- package/wire/adapters/messages/usage.ts +0 -43
- package/wire/adapters/responses/index.ts +0 -3
- package/wire/adapters/responses/request.ts +0 -395
- package/wire/adapters/responses/response.ts +0 -88
- package/wire/adapters/responses/streaming.ts +0 -344
- package/wire/assets/openllm-light.svg +0 -18
- package/wire/assets/openllm.svg +0 -18
- package/wire/features/account-rank.ts +0 -166
- package/wire/features/compaction/compact-request.ts +0 -862
- package/wire/features/compaction/compaction-text.ts +0 -43
- package/wire/features/context-demote.ts +0 -47
- package/wire/features/context-overflow-strategy.ts +0 -26
- package/wire/features/conversation-affinity.ts +0 -144
- package/wire/features/max-tokens-backfill.ts +0 -141
- package/wire/features/model-caps.ts +0 -53
- package/wire/features/model-settings.ts +0 -24
- package/wire/features/output-limit-clamp.ts +0 -64
- package/wire/features/quota-gate.ts +0 -85
- package/wire/index.ts +0 -44
- package/wire/lib/attempt-outcome.ts +0 -43
- package/wire/lib/canonical/count-tokens-capability.ts +0 -138
- package/wire/lib/canonical/image-signature.ts +0 -202
- package/wire/lib/canonical/image-sse.ts +0 -216
- package/wire/lib/canonical/token-estimate.ts +0 -266
- package/wire/lib/encrypted-content.ts +0 -66
- package/wire/lib/error-class.ts +0 -154
- package/wire/lib/error-envelope.ts +0 -56
- package/wire/lib/provider-error-rules.ts +0 -48
- package/wire/lib/responses-apply-patch.ts +0 -104
- package/wire/lib/secret-scrub.ts +0 -101
- package/wire/lib/streaming/accumulate.ts +0 -221
- package/wire/lib/streaming/finish-reason.ts +0 -33
- package/wire/lib/streaming/provider-decode.ts +0 -259
- package/wire/lib/streaming/response-stream.ts +0 -71
- package/wire/lib/streaming/sse.ts +0 -699
- package/wire/lib/streaming/strip-tool-calls.ts +0 -95
- package/wire/lib/streaming/upstream-error.ts +0 -58
- package/wire/lib/strip-subagent-isolation.ts +0 -284
- package/wire/lib/token-ruler/bpe-core.ts +0 -426
- package/wire/lib/token-ruler/index.ts +0 -2
- package/wire/lib/token-ruler/ruler.ts +0 -79
- package/wire/lib/token-ruler/vocab/claude-ranks.ts +0 -16
- package/wire/lib/token-ruler/vocab/o200k-ranks.ts +0 -18
- package/wire/lib/token-ruler/vocab/o200k.ts +0 -19
- package/wire/lib/tool-name-map.ts +0 -271
- package/wire/lib/tool-schema.ts +0 -353
- package/wire/lib/usage-observer.ts +0 -125
- package/wire/providers/anthropic/adaptive-thinking.ts +0 -291
- package/wire/providers/anthropic/request.ts +0 -607
- package/wire/providers/anthropic/response.ts +0 -155
- package/wire/providers/anthropic/streaming.ts +0 -315
- package/wire/providers/anthropic/web-search-domains.ts +0 -49
- package/wire/providers/chatgpt/request.ts +0 -959
- package/wire/providers/chatgpt/streaming.ts +0 -1007
- package/wire/providers/chatgpt/web-search.ts +0 -63
- package/wire/providers/grok/web-search.ts +0 -87
- package/wire/providers/kimi/web-search.ts +0 -145
- package/wire/providers/upstream-deny.ts +0 -355
- package/wire/providers/upstream-request.ts +0 -619
- /package/{protocol/inference-headers.ts → dist/protocol/inference-headers.js} +0 -0
|
@@ -0,0 +1,1152 @@
|
|
|
1
|
+
import { Schema as S } from "effect";
|
|
2
|
+
/** Which end a connect ticket authorizes. A `daemon` socket receives
|
|
3
|
+
* commands for its `key_id` and sends acks/status; a `watcher` socket
|
|
4
|
+
* (a dashboard tab) enqueues commands for keys its `user_id` owns and
|
|
5
|
+
* receives status/presence pushes. */
|
|
6
|
+
/** `origin` is the cloud `/v1/*` proxy dialing in as a FLEET consumer
|
|
7
|
+
* (origin-side tunneling): it may only open mux channels, and the relay
|
|
8
|
+
* stamps its channels `consumer:"daemon"` exactly like a peer daemon's. */
|
|
9
|
+
export declare const RelayRole: S.Literals<readonly ["daemon", "watcher", "origin"]>;
|
|
10
|
+
export type TRelayRole = S.Schema.Type<typeof RelayRole>;
|
|
11
|
+
/** Bounded, open-vocabulary capability advertisement limits. */
|
|
12
|
+
export declare const RELAY_CAP_MAX_ITEMS = 32;
|
|
13
|
+
export declare const RELAY_CAP_MAX_LENGTH = 64;
|
|
14
|
+
export declare const ChannelId: S.String;
|
|
15
|
+
export type TChannelId = S.Schema.Type<typeof ChannelId>;
|
|
16
|
+
/** The port the in-sandbox WS server listens on — declared in `ports` at
|
|
17
|
+
* `Sandbox.getOrCreate` (cloud) and bound by the relay. A fixed internal
|
|
18
|
+
* constant (the public surface is the sandbox's own domain), shared so the
|
|
19
|
+
* provisioner's `sandbox.domain(port)` and the relay's listener agree. */
|
|
20
|
+
export declare const RELAY_PORT = 8080;
|
|
21
|
+
export type TRelayDatabaseTarget = "pre-production" | "production";
|
|
22
|
+
/**
|
|
23
|
+
* The relay identity (sandbox name + TTL class) for the current deployment,
|
|
24
|
+
* derived from `VERCEL_ENV` — the only remaining discriminator now that a
|
|
25
|
+
* single `DATABASE_URL_UNPOOLED` selects the Neon database per environment
|
|
26
|
+
* (Vercel injects the matching value in each env; local dev points it at the
|
|
27
|
+
* dev branch). `production` only on the Vercel production deployment;
|
|
28
|
+
* everything else (preview, `vercel dev`, plain `next dev`, tests) is
|
|
29
|
+
* `pre-production`. Pure (a function of its input) so the DB client, the cloud
|
|
30
|
+
* provisioner, and the in-sandbox relay all agree from the same signal.
|
|
31
|
+
*/
|
|
32
|
+
export declare const resolveDatabaseTarget: (vercelEnv: string | undefined) => TRelayDatabaseTarget;
|
|
33
|
+
/** The name of the retired daemon-relay logical-replication slot. The relay no
|
|
34
|
+
* longer subscribes it (commands route in memory) — this is kept ONLY so
|
|
35
|
+
* `packages/db/migrate.ts` can DROP a leftover slot on deploy (Phase 5
|
|
36
|
+
* demolition). The matching `daemon_relay_pub` publication is dropped by
|
|
37
|
+
* `migrations/0007_chunky_expediter.sql` using its literal name. */
|
|
38
|
+
export declare const RELAY_SLOT = "daemon_relay_slot";
|
|
39
|
+
/** The per-environment relay identity — just the sandbox name now (the
|
|
40
|
+
* publication/slot the CDC era carried are gone). Pure derivation (no env, no
|
|
41
|
+
* I/O) so the cloud provisioner and the relay agree. */
|
|
42
|
+
export type TRelayNames = {
|
|
43
|
+
readonly relayName: string;
|
|
44
|
+
};
|
|
45
|
+
export declare const relayNamesFor: (target: TRelayDatabaseTarget) => TRelayNames;
|
|
46
|
+
/** Tag key: the sanitized stable origin that provisioned/uses this box. */
|
|
47
|
+
export declare const RELAY_TAG_ORIGIN = "origin";
|
|
48
|
+
/** Tag key: unix-ms (decimal string) of the origin's last claim/refresh. */
|
|
49
|
+
export declare const RELAY_TAG_ORIGIN_AT = "origin-at";
|
|
50
|
+
/** The env signals the origin is derived from. `localHostname` is caller-
|
|
51
|
+
* provided (`os.hostname()`) so this stays pure and testable. */
|
|
52
|
+
export type TRelayOriginInputs = {
|
|
53
|
+
readonly vercelEnv: string | undefined;
|
|
54
|
+
readonly projectProductionUrl: string | undefined;
|
|
55
|
+
readonly branchUrl: string | undefined;
|
|
56
|
+
readonly deploymentUrl: string | undefined;
|
|
57
|
+
readonly localHostname: string | undefined;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* The STABLE origin identity for sandbox tagging — stable across deploys of
|
|
61
|
+
* the same "place", so the cleanup cron's per-origin change detection fires:
|
|
62
|
+
* production → the project production URL (not the per-deploy VERCEL_URL);
|
|
63
|
+
* preview → the branch URL (stable per git branch), falling back to the
|
|
64
|
+
* per-deploy URL only when the branch URL is absent;
|
|
65
|
+
* local/test → `local-<hostname>` so two developers never supersede each
|
|
66
|
+
* other's boxes.
|
|
67
|
+
* Pure (a function of its inputs) per the convention above.
|
|
68
|
+
*/
|
|
69
|
+
export declare const resolveRelayOrigin: (inputs: TRelayOriginInputs) => string;
|
|
70
|
+
/**
|
|
71
|
+
* The decoded claims of a connect ticket. The cloud (`/api/daemon/channel`)
|
|
72
|
+
* mints these after validating the caller (`sk-llm` key → `daemon`, Neon
|
|
73
|
+
* Auth session → `watcher`) and Ed25519-signs them; the relay verifies with
|
|
74
|
+
* the corresponding public key only (it does NO DB-side auth in the
|
|
75
|
+
* Sandbox and cannot mint tickets). `key_id` is present iff
|
|
76
|
+
* `role === "daemon"`. `exp` is a unix-ms deadline kept short (~60s) so a
|
|
77
|
+
* leaked ticket is near-useless. `aud` binds the ticket to a specific relay
|
|
78
|
+
* sandbox name; `jti` is a one-shot nonce consumed by the relay.
|
|
79
|
+
*/
|
|
80
|
+
export declare const RelayTicketClaims: S.Struct<{
|
|
81
|
+
readonly role: S.Literals<readonly ["daemon", "watcher", "origin"]>;
|
|
82
|
+
readonly user_id: S.String;
|
|
83
|
+
readonly key_id: S.optional<S.String>;
|
|
84
|
+
readonly exp: S.Number;
|
|
85
|
+
/** Relay sandbox audience, e.g. `daemon-relay-production`. */
|
|
86
|
+
readonly aud: S.String;
|
|
87
|
+
/** Unique ticket id (base64url) — single-use within the TTL window. */
|
|
88
|
+
readonly jti: S.String;
|
|
89
|
+
}>;
|
|
90
|
+
export type TRelayTicketClaims = S.Schema.Type<typeof RelayTicketClaims>;
|
|
91
|
+
/**
|
|
92
|
+
* Domain-separation label for the Ed25519 seed derivation. Shared by the
|
|
93
|
+
* cloud signer and the verifier so both derive the same keypair from
|
|
94
|
+
* `NEON_AUTH_COOKIE_SECRET`. The sandbox receives only the public half.
|
|
95
|
+
*/
|
|
96
|
+
export declare const RELAY_TICKET_SEED_LABEL = "openllm-relay-ticket-ed25519-seed-v1";
|
|
97
|
+
/** One ICE server entry (STUN or TURN) on the channel handshake — mirrors
|
|
98
|
+
* `RTCIceServer` so browser and daemon feed it to their peer connections
|
|
99
|
+
* verbatim. */
|
|
100
|
+
export declare const IceServer: S.Struct<{
|
|
101
|
+
readonly urls: S.Union<readonly [S.String, S.$Array<S.String>]>;
|
|
102
|
+
readonly username: S.optional<S.String>;
|
|
103
|
+
readonly credential: S.optional<S.String>;
|
|
104
|
+
}>;
|
|
105
|
+
export type TIceServer = S.Schema.Type<typeof IceServer>;
|
|
106
|
+
/** GET /api/daemon/channel → the live relay WSS URL + a connect ticket. Both
|
|
107
|
+
* daemon and browser dial `wss_url`, presenting `ticket` in their first
|
|
108
|
+
* `hello` frame. The URL is the sandbox's own domain (`wss://<sandbox-host>`);
|
|
109
|
+
* it can rotate when the relay cycles, so clients re-fetch this on every
|
|
110
|
+
* (re)connect rather than caching the host. `ice_servers` is the optional
|
|
111
|
+
* cloud-served ICE config (from `OPENLLM_RTC_ICE_SERVERS`) — absent, both
|
|
112
|
+
* ends fall back to their default STUN. */
|
|
113
|
+
export declare const RelayChannelResponse: S.Struct<{
|
|
114
|
+
readonly wss_url: S.String;
|
|
115
|
+
/** Short-lived Ed25519-signed connect ticket
|
|
116
|
+
* (opaque `<b64url(claims)>.<b64url(sig)>`). */
|
|
117
|
+
readonly ticket: S.String;
|
|
118
|
+
/** Optional cloud-served ICE servers (STUN/TURN) for RTC peers. */
|
|
119
|
+
readonly ice_servers: S.optional<S.$Array<S.Struct<{
|
|
120
|
+
readonly urls: S.Union<readonly [S.String, S.$Array<S.String>]>;
|
|
121
|
+
readonly username: S.optional<S.String>;
|
|
122
|
+
readonly credential: S.optional<S.String>;
|
|
123
|
+
}>>>;
|
|
124
|
+
}>;
|
|
125
|
+
export type TRelayChannelResponse = S.Schema.Type<typeof RelayChannelResponse>;
|
|
126
|
+
/** client → relay (first frame). A daemon may piggyback its initial
|
|
127
|
+
* status snapshot; a watcher sends ticket only. */
|
|
128
|
+
export declare const RelayHelloFrame: S.Struct<{
|
|
129
|
+
readonly type: S.Literal<"hello">;
|
|
130
|
+
readonly ticket: S.String;
|
|
131
|
+
/** Daemon protocol capability; absent daemons retain legacy compatibility. */
|
|
132
|
+
readonly protocol_version: S.optional<S.Number>;
|
|
133
|
+
/** Open-vocabulary peer capability list.
|
|
134
|
+
* Unknown capabilities preserve forward compatibility. */
|
|
135
|
+
readonly caps: S.optional<S.$Array<S.String>>;
|
|
136
|
+
/** Daemon only: initial per-provider `TDaemonStatus` snapshot, folded
|
|
137
|
+
* into `api_key_activity.daemon_status_json` on connect. */
|
|
138
|
+
readonly status: S.optional<S.Unknown>;
|
|
139
|
+
}>;
|
|
140
|
+
export type TRelayHelloFrame = S.Schema.Type<typeof RelayHelloFrame>;
|
|
141
|
+
/** relay → client. Handshake accepted; carries the current presence snapshot so
|
|
142
|
+
* a freshly-attached dashboard paints immediately. */
|
|
143
|
+
export declare const RelayWelcomeFrame: S.Struct<{
|
|
144
|
+
readonly type: S.Literal<"welcome">;
|
|
145
|
+
/** Watcher only: the AUTHORITATIVE set of the user's key ids that have a live
|
|
146
|
+
* daemon socket on the relay right now, from its in-memory registry. The
|
|
147
|
+
* dashboard treats membership as presence — keys absent here are offline by
|
|
148
|
+
* authority of the relay that owns every socket — so a stale-`true`
|
|
149
|
+
* `api_key_activity` row (ungraceful relay death) is corrected the instant a
|
|
150
|
+
* watcher (re)connects. Live status keeps flowing via `status_push`. */
|
|
151
|
+
readonly snapshot: S.optional<S.$Array<S.String>>;
|
|
152
|
+
/** Daemon only: relay-assigned connection epoch for ordered snapshots. */
|
|
153
|
+
readonly daemon_session_id: S.optional<S.String>;
|
|
154
|
+
readonly daemon_session_started_at_ms: S.optional<S.Number>;
|
|
155
|
+
readonly protocol_version: S.optional<S.Number>;
|
|
156
|
+
/** Relay capabilities. */
|
|
157
|
+
readonly caps: S.optional<S.$Array<S.String>>;
|
|
158
|
+
/** Per-serving-daemon capability snapshots, parallel to `snapshot`. */
|
|
159
|
+
readonly snapshot_caps: S.optional<S.$Record<S.String, S.$Array<S.String>>>;
|
|
160
|
+
}>;
|
|
161
|
+
export type TRelayWelcomeFrame = S.Schema.Type<typeof RelayWelcomeFrame>;
|
|
162
|
+
/** relay → daemon. One command to run, routed in memory the instant the watcher
|
|
163
|
+
* enqueues it (no durable mailbox). `id` is a relay-generated uuid. */
|
|
164
|
+
export declare const RelayCommandFrame: S.Struct<{
|
|
165
|
+
readonly type: S.Literal<"command">;
|
|
166
|
+
readonly command: S.Union<readonly [S.Struct<{
|
|
167
|
+
id: S.String;
|
|
168
|
+
replay_session_id: S.optional<S.String>;
|
|
169
|
+
} & {
|
|
170
|
+
readonly kind: S.Literals<readonly ["auth"]>;
|
|
171
|
+
readonly payload: S.Struct<{
|
|
172
|
+
readonly operation: S.Literals<["add-account" | "cancel" | "login" | "logout" | "pin-account" | "providers" | "refresh" | "remove-account" | "status" | "submit-code" | "unpin-account" | "usage", ...("add-account" | "cancel" | "login" | "logout" | "pin-account" | "providers" | "refresh" | "remove-account" | "status" | "submit-code" | "unpin-account" | "usage")[]]>;
|
|
173
|
+
readonly provider: S.optional<S.String>;
|
|
174
|
+
readonly method: S.optional<S.Literals<readonly ["browser", "device"]>>;
|
|
175
|
+
readonly flow_id: S.optional<S.String>;
|
|
176
|
+
readonly account: S.optional<S.Number>;
|
|
177
|
+
readonly label: S.optional<S.String>;
|
|
178
|
+
readonly since: S.optional<S.String>;
|
|
179
|
+
readonly wait_ms: S.optional<S.Int>;
|
|
180
|
+
readonly sealed_code: S.optional<S.String>;
|
|
181
|
+
}>;
|
|
182
|
+
}>, S.Struct<{
|
|
183
|
+
id: S.String;
|
|
184
|
+
replay_session_id: S.optional<S.String>;
|
|
185
|
+
} & {
|
|
186
|
+
readonly kind: S.Literals<readonly ["connect"]>;
|
|
187
|
+
readonly payload: S.Struct<{
|
|
188
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
189
|
+
readonly account_index: S.optional<S.Number>;
|
|
190
|
+
}>;
|
|
191
|
+
}>, S.Struct<{
|
|
192
|
+
id: S.String;
|
|
193
|
+
replay_session_id: S.optional<S.String>;
|
|
194
|
+
} & {
|
|
195
|
+
readonly kind: S.Literals<readonly ["connect_device_code"]>;
|
|
196
|
+
readonly payload: S.Struct<{
|
|
197
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
198
|
+
readonly account_index: S.optional<S.Number>;
|
|
199
|
+
}>;
|
|
200
|
+
}>, S.Struct<{
|
|
201
|
+
id: S.String;
|
|
202
|
+
replay_session_id: S.optional<S.String>;
|
|
203
|
+
} & {
|
|
204
|
+
readonly kind: S.Literals<readonly ["cancel_connect"]>;
|
|
205
|
+
readonly payload: S.Struct<{
|
|
206
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
207
|
+
readonly account_index: S.optional<S.Number>;
|
|
208
|
+
readonly flow_id: S.optional<S.String>;
|
|
209
|
+
}>;
|
|
210
|
+
}>, S.Struct<{
|
|
211
|
+
id: S.String;
|
|
212
|
+
replay_session_id: S.optional<S.String>;
|
|
213
|
+
} & {
|
|
214
|
+
readonly kind: S.Literals<readonly ["logout"]>;
|
|
215
|
+
readonly payload: S.Struct<{
|
|
216
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
217
|
+
readonly account_index: S.optional<S.Number>;
|
|
218
|
+
}>;
|
|
219
|
+
}>, S.Struct<{
|
|
220
|
+
id: S.String;
|
|
221
|
+
replay_session_id: S.optional<S.String>;
|
|
222
|
+
} & {
|
|
223
|
+
readonly kind: S.Literals<readonly ["submit_login_code"]>;
|
|
224
|
+
readonly payload: S.Struct<{
|
|
225
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
226
|
+
readonly account_index: S.optional<S.Number>;
|
|
227
|
+
readonly sealed: S.String;
|
|
228
|
+
}>;
|
|
229
|
+
}>, S.Struct<{
|
|
230
|
+
id: S.String;
|
|
231
|
+
replay_session_id: S.optional<S.String>;
|
|
232
|
+
} & {
|
|
233
|
+
readonly kind: S.Literals<readonly ["add_account"]>;
|
|
234
|
+
readonly payload: S.Struct<{
|
|
235
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
236
|
+
readonly label: S.optional<S.String>;
|
|
237
|
+
}>;
|
|
238
|
+
}>, S.Struct<{
|
|
239
|
+
id: S.String;
|
|
240
|
+
replay_session_id: S.optional<S.String>;
|
|
241
|
+
} & {
|
|
242
|
+
readonly kind: S.Literals<readonly ["remove_account"]>;
|
|
243
|
+
readonly payload: S.Struct<{
|
|
244
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
245
|
+
readonly account_index: S.Number;
|
|
246
|
+
}>;
|
|
247
|
+
}>, S.Struct<{
|
|
248
|
+
id: S.String;
|
|
249
|
+
replay_session_id: S.optional<S.String>;
|
|
250
|
+
} & {
|
|
251
|
+
readonly kind: S.Literals<readonly ["pin_account"]>;
|
|
252
|
+
readonly payload: S.Struct<{
|
|
253
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
254
|
+
readonly account_index: S.NullOr<S.Number>;
|
|
255
|
+
}>;
|
|
256
|
+
}>, S.Struct<{
|
|
257
|
+
id: S.String;
|
|
258
|
+
replay_session_id: S.optional<S.String>;
|
|
259
|
+
} & {
|
|
260
|
+
readonly kind: S.Literals<readonly ["set_auto_update"]>;
|
|
261
|
+
readonly payload: S.Struct<{
|
|
262
|
+
readonly enabled: S.Boolean;
|
|
263
|
+
}>;
|
|
264
|
+
}>, S.Struct<{
|
|
265
|
+
id: S.String;
|
|
266
|
+
replay_session_id: S.optional<S.String>;
|
|
267
|
+
} & {
|
|
268
|
+
readonly kind: S.Literals<readonly ["refresh"]>;
|
|
269
|
+
readonly payload: S.optional<S.Struct<{
|
|
270
|
+
readonly slug: S.optional<S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>>;
|
|
271
|
+
readonly account_index: S.optional<S.Number>;
|
|
272
|
+
readonly manual: S.optional<S.Boolean>;
|
|
273
|
+
}>>;
|
|
274
|
+
}>, S.Struct<{
|
|
275
|
+
id: S.String;
|
|
276
|
+
replay_session_id: S.optional<S.String>;
|
|
277
|
+
} & {
|
|
278
|
+
readonly kind: S.Literals<readonly ["status"]>;
|
|
279
|
+
readonly payload: S.optional<S.Struct<{}>>;
|
|
280
|
+
}>, S.Struct<{
|
|
281
|
+
id: S.String;
|
|
282
|
+
replay_session_id: S.optional<S.String>;
|
|
283
|
+
} & {
|
|
284
|
+
readonly kind: S.Literals<readonly ["update"]>;
|
|
285
|
+
readonly payload: S.optional<S.Struct<{}>>;
|
|
286
|
+
}>, S.Struct<{
|
|
287
|
+
id: S.String;
|
|
288
|
+
replay_session_id: S.optional<S.String>;
|
|
289
|
+
} & {
|
|
290
|
+
readonly kind: S.Literals<readonly ["bust_plan_cache"]>;
|
|
291
|
+
readonly payload: S.optional<S.Struct<{}>>;
|
|
292
|
+
}>, S.Struct<{
|
|
293
|
+
id: S.String;
|
|
294
|
+
replay_session_id: S.optional<S.String>;
|
|
295
|
+
} & {
|
|
296
|
+
readonly kind: S.Literals<readonly ["refresh_models"]>;
|
|
297
|
+
readonly payload: S.optional<S.Struct<{}>>;
|
|
298
|
+
}>, S.Struct<{
|
|
299
|
+
id: S.String;
|
|
300
|
+
replay_session_id: S.optional<S.String>;
|
|
301
|
+
} & {
|
|
302
|
+
readonly kind: S.Literals<readonly ["refresh_models_due"]>;
|
|
303
|
+
readonly payload: S.optional<S.Struct<{}>>;
|
|
304
|
+
}>, S.Struct<{
|
|
305
|
+
id: S.String;
|
|
306
|
+
replay_session_id: S.optional<S.String>;
|
|
307
|
+
} & {
|
|
308
|
+
readonly kind: S.Literals<readonly ["list_local_sessions"]>;
|
|
309
|
+
readonly payload: S.Struct<{
|
|
310
|
+
readonly cli: S.Literals<readonly ["claude_code", "chatgpt", "grok", "opencode", "hermes", "shell"]>;
|
|
311
|
+
readonly limit: S.optional<S.Number>;
|
|
312
|
+
}>;
|
|
313
|
+
}>, S.Struct<{
|
|
314
|
+
id: S.String;
|
|
315
|
+
replay_session_id: S.optional<S.String>;
|
|
316
|
+
} & {
|
|
317
|
+
readonly kind: S.Literals<readonly ["local_rescan"]>;
|
|
318
|
+
readonly payload: S.optional<S.Struct<{}>>;
|
|
319
|
+
}>, S.Struct<{
|
|
320
|
+
id: S.String;
|
|
321
|
+
replay_session_id: S.optional<S.String>;
|
|
322
|
+
} & {
|
|
323
|
+
readonly kind: S.Literals<readonly ["set_local_key"]>;
|
|
324
|
+
readonly payload: S.Struct<{
|
|
325
|
+
readonly port: S.Number;
|
|
326
|
+
readonly sealed: S.Union<readonly [S.String, S.Literal<"">]>;
|
|
327
|
+
}>;
|
|
328
|
+
}>, S.Struct<{
|
|
329
|
+
id: S.String;
|
|
330
|
+
replay_session_id: S.optional<S.String>;
|
|
331
|
+
} & {
|
|
332
|
+
readonly kind: S.Literals<readonly ["set_provider_key"]>;
|
|
333
|
+
readonly payload: S.Struct<{
|
|
334
|
+
readonly slug: S.Literals<readonly ["opencode_go", "zai_coding", "minimax_coding"]>;
|
|
335
|
+
readonly account_index: S.optional<S.Number>;
|
|
336
|
+
readonly sealed: S.Union<readonly [S.String, S.Literal<"">]>;
|
|
337
|
+
readonly label: S.optional<S.String>;
|
|
338
|
+
}>;
|
|
339
|
+
}>, S.Struct<{
|
|
340
|
+
id: S.String;
|
|
341
|
+
replay_session_id: S.optional<S.String>;
|
|
342
|
+
} & {
|
|
343
|
+
readonly kind: S.Literals<readonly ["set_team_key"]>;
|
|
344
|
+
readonly payload: S.Struct<{
|
|
345
|
+
readonly team_id: S.String;
|
|
346
|
+
readonly epoch: S.Int;
|
|
347
|
+
readonly sealed: S.String;
|
|
348
|
+
}>;
|
|
349
|
+
}>, S.Struct<{
|
|
350
|
+
id: S.String;
|
|
351
|
+
replay_session_id: S.optional<S.String>;
|
|
352
|
+
} & {
|
|
353
|
+
readonly kind: S.Literals<readonly ["delete_team_key"]>;
|
|
354
|
+
readonly payload: S.Struct<{
|
|
355
|
+
readonly team_id: S.String;
|
|
356
|
+
}>;
|
|
357
|
+
}>, S.Struct<{
|
|
358
|
+
id: S.String;
|
|
359
|
+
replay_session_id: S.optional<S.String>;
|
|
360
|
+
} & {
|
|
361
|
+
readonly kind: S.Literals<readonly ["set_device_sessions"]>;
|
|
362
|
+
readonly payload: S.Struct<{
|
|
363
|
+
readonly statement: S.String;
|
|
364
|
+
}>;
|
|
365
|
+
}>]>;
|
|
366
|
+
}>;
|
|
367
|
+
export type TRelayCommandFrame = S.Schema.Type<typeof RelayCommandFrame>;
|
|
368
|
+
/** daemon → relay. A terminal command result; the relay forwards it to the
|
|
369
|
+
* originating watcher as a `command_lifecycle` frame (no `daemon_commands`
|
|
370
|
+
* row to update). */
|
|
371
|
+
export declare const RelayAckFrame: S.Struct<{
|
|
372
|
+
readonly type: S.Literal<"ack">;
|
|
373
|
+
readonly ack: S.Struct<{
|
|
374
|
+
readonly id: S.String;
|
|
375
|
+
readonly status: S.Literals<readonly ["ack", "done", "not_done", "error"]>;
|
|
376
|
+
readonly result: S.optional<S.Unknown>;
|
|
377
|
+
}>;
|
|
378
|
+
}>;
|
|
379
|
+
export type TRelayAckFrame = S.Schema.Type<typeof RelayAckFrame>;
|
|
380
|
+
/** Planned-downtime reason on a graceful `active:false` status beacon.
|
|
381
|
+
* Absent ⇒ real offline / legacy beacon (CERTAIN death). */
|
|
382
|
+
export declare const RelayStatusRestartReason: S.Literal<"restarting">;
|
|
383
|
+
export type TRelayStatusRestartReason = S.Schema.Type<typeof RelayStatusRestartReason>;
|
|
384
|
+
/** daemon → relay. Heartbeat + per-provider snapshot. `active:false` is the
|
|
385
|
+
* graceful-exit beacon. The relay folds the snapshot into
|
|
386
|
+
* `api_key_activity.daemon_status_json` (durable, read by the proxy + a cold
|
|
387
|
+
* HTTP load) and fans it out to the user's watchers (`status_push`).
|
|
388
|
+
*
|
|
389
|
+
* Planned restarts send `active:false` WITH `reason:"restarting"` (and an
|
|
390
|
+
* optional `expect_back_ms` hint) so the relay keeps the row routable —
|
|
391
|
+
* `daemon_active` stays true and `last_seen` stays fresh — while origin's
|
|
392
|
+
* presence grace absorbs the brief gap. A bare `active:false` remains a
|
|
393
|
+
* CERTAIN death (`daemon_active=false`). See
|
|
394
|
+
* `docs/audit/2026-10-20-deploy-zero-downtime.md` fix #2. */
|
|
395
|
+
export declare const RelayStatusFrame: S.Struct<{
|
|
396
|
+
readonly type: S.Literal<"status">;
|
|
397
|
+
readonly active: S.optional<S.Boolean>;
|
|
398
|
+
readonly status: S.optional<S.Unknown>;
|
|
399
|
+
/** Present for protocol-v2 daemon status snapshots. */
|
|
400
|
+
readonly daemon_session_id: S.optional<S.String>;
|
|
401
|
+
readonly status_seq: S.optional<S.Number>;
|
|
402
|
+
readonly acks: S.optional<S.$Array<S.Struct<{
|
|
403
|
+
readonly id: S.String;
|
|
404
|
+
readonly status: S.Literals<readonly ["ack", "done", "not_done", "error"]>;
|
|
405
|
+
readonly result: S.optional<S.Unknown>;
|
|
406
|
+
}>>>;
|
|
407
|
+
/** Planned downtime; absent ⇒ real offline / legacy beacon. */
|
|
408
|
+
readonly reason: S.optional<S.Literal<"restarting">>;
|
|
409
|
+
/** Hint for origin grace / UI: ms until this key should be back. */
|
|
410
|
+
readonly expect_back_ms: S.optional<S.Number>;
|
|
411
|
+
}>;
|
|
412
|
+
export type TRelayStatusFrame = S.Schema.Type<typeof RelayStatusFrame>;
|
|
413
|
+
/** watcher → relay. The dashboard enqueues a control command for one of the
|
|
414
|
+
* user's keys. The relay authorizes it by REGISTRY MEMBERSHIP — a watcher may
|
|
415
|
+
* address `key_id` K iff a daemon socket for K is connected with the same
|
|
416
|
+
* `user_id` (off that daemon's ticket) — then routes it to that socket in
|
|
417
|
+
* memory. `req_id` correlates the relay's `enqueue_ack`; omit it for
|
|
418
|
+
* fire-and-forget. */
|
|
419
|
+
export declare const RelayEnqueueFrame: S.Struct<{
|
|
420
|
+
readonly type: S.Literal<"enqueue">;
|
|
421
|
+
readonly req_id: S.optional<S.String>;
|
|
422
|
+
readonly key_id: S.String;
|
|
423
|
+
readonly kind: S.String;
|
|
424
|
+
readonly payload: S.optional<S.Unknown>;
|
|
425
|
+
readonly replay_session_id: S.optional<S.String>;
|
|
426
|
+
}>;
|
|
427
|
+
export type TRelayEnqueueFrame = S.Schema.Type<typeof RelayEnqueueFrame>;
|
|
428
|
+
/** relay → watcher. The result of an `enqueue` carrying a `req_id`: the
|
|
429
|
+
* relay-generated command id on success, or an error (`daemon_offline` /
|
|
430
|
+
* `invalid_command`). */
|
|
431
|
+
export declare const RelayEnqueueAckFrame: S.Struct<{
|
|
432
|
+
readonly type: S.Literal<"enqueue_ack">;
|
|
433
|
+
readonly req_id: S.String;
|
|
434
|
+
readonly ok: S.Boolean;
|
|
435
|
+
readonly id: S.optional<S.String>;
|
|
436
|
+
readonly error: S.optional<S.String>;
|
|
437
|
+
}>;
|
|
438
|
+
export type TRelayEnqueueAckFrame = S.Schema.Type<typeof RelayEnqueueAckFrame>;
|
|
439
|
+
/** relay → watcher. A daemon's status snapshot for one key landed; push it
|
|
440
|
+
* to the dashboard. */
|
|
441
|
+
export declare const RelayStatusPushFrame: S.Struct<{
|
|
442
|
+
readonly type: S.Literal<"status_push">;
|
|
443
|
+
readonly key_id: S.String;
|
|
444
|
+
readonly status: S.Unknown;
|
|
445
|
+
readonly daemon_session_id: S.optional<S.String>;
|
|
446
|
+
readonly daemon_session_started_at_ms: S.optional<S.Number>;
|
|
447
|
+
readonly status_seq: S.optional<S.Number>;
|
|
448
|
+
}>;
|
|
449
|
+
export type TRelayStatusPushFrame = S.Schema.Type<typeof RelayStatusPushFrame>;
|
|
450
|
+
/** relay → watcher. A key's daemon presence flipped (socket open/close). */
|
|
451
|
+
export declare const RelayPresenceFrame: S.Struct<{
|
|
452
|
+
readonly type: S.Literal<"presence">;
|
|
453
|
+
readonly key_id: S.String;
|
|
454
|
+
readonly active: S.Boolean;
|
|
455
|
+
/** Present when an active daemon advertises capabilities. */
|
|
456
|
+
readonly caps: S.optional<S.$Array<S.String>>;
|
|
457
|
+
}>;
|
|
458
|
+
export type TRelayPresenceFrame = S.Schema.Type<typeof RelayPresenceFrame>;
|
|
459
|
+
/**
|
|
460
|
+
* Max base64 length of a seed-gated device-grant envelope on open frames.
|
|
461
|
+
* Real envelopes are a few hundred bytes (JSON of nonce/ts/key_id/cid/aud +
|
|
462
|
+
* Ed25519 sig, then base64); 4 KiB is generous headroom so a peer cannot
|
|
463
|
+
* push an unbounded string through Schema re-encode into the daemon.
|
|
464
|
+
*
|
|
465
|
+
* Canonical owner for the wire cap. `@openllmsh/sdk/tunnel/device-grant` re-exports
|
|
466
|
+
* the same value so decode stays aligned with Schema maxLength.
|
|
467
|
+
*/
|
|
468
|
+
export declare const DEVICE_GRANT_B64_MAX: number;
|
|
469
|
+
/**
|
|
470
|
+
* Internal hop marker: the serving daemon stamps this on every request it
|
|
471
|
+
* dispatches from a tunnel open so a fleet-peer walker can refuse to
|
|
472
|
+
* re-tunnel (loop guard). Not a client-facing API.
|
|
473
|
+
*/
|
|
474
|
+
export declare const TUNNELED_REQUEST_HEADER = "x-openllm-tunneled";
|
|
475
|
+
/** Response header naming the device key that served a tunneled request. */
|
|
476
|
+
export declare const SERVED_BY_DEVICE_HEADER = "x-openllm-served-by-device";
|
|
477
|
+
/**
|
|
478
|
+
* Request header pinning a follow-up to the device that served an earlier
|
|
479
|
+
* call (a video job lives on ONE device's vendor account; its id does not
|
|
480
|
+
* name the device). Any client may echo back {@link SERVED_BY_DEVICE_HEADER}
|
|
481
|
+
* here. Honoured only if that key is one of the caller's own serving
|
|
482
|
+
* devices — it reorders the candidates, never widens them.
|
|
483
|
+
*/
|
|
484
|
+
export declare const TARGET_DEVICE_HEADER = "x-openllm-target-device";
|
|
485
|
+
export declare const TUNNELED_REQUEST_VALUE = "1";
|
|
486
|
+
/** consumer → relay → serving daemon. Auth runs once when opening this
|
|
487
|
+
* channel; after acceptance, all subsequent binary frames on both sockets
|
|
488
|
+
* belong to this channel. */
|
|
489
|
+
export declare const RelayChannelOpenFrame: S.Struct<{
|
|
490
|
+
readonly type: S.Literal<"channel_open">;
|
|
491
|
+
readonly channel_id: S.String;
|
|
492
|
+
readonly key_id: S.String;
|
|
493
|
+
/**
|
|
494
|
+
* Who is opening the channel. The relay stamps this from the authenticated
|
|
495
|
+
* socket role before forward (`watcher` → `browser`, `daemon` → `daemon`) —
|
|
496
|
+
* clients may set it but the relay overwrites. `daemon` marks a fleet peer
|
|
497
|
+
* hop so the serving daemon skips seedgate (no vault DEK on the consumer).
|
|
498
|
+
* Omitted / `browser` is the default seed-gated path.
|
|
499
|
+
*/
|
|
500
|
+
readonly consumer: S.optional<S.Literals<readonly ["browser", "daemon"]>>;
|
|
501
|
+
/**
|
|
502
|
+
* Seed-gated device grant (base64 envelope). Present when the serving
|
|
503
|
+
* daemon advertises `seedgate1`. Relay re-encodes via Schema — must be
|
|
504
|
+
* on the schema so it survives forward; never verified by the relay.
|
|
505
|
+
* Bounded so a peer cannot ship an arbitrarily large grant past re-encode.
|
|
506
|
+
*/
|
|
507
|
+
readonly grant: S.optional<S.String>;
|
|
508
|
+
/**
|
|
509
|
+
* Origin-signed team grant (base64 envelope). Required for cross-user
|
|
510
|
+
* admission: the relay admits when non-empty (it does NOT verify — the
|
|
511
|
+
* contributor daemon re-checks with its bootstrap `team_grant_key`).
|
|
512
|
+
* Same-user opens omit it. Opaque to the payload path; bounded like
|
|
513
|
+
* {@link DEVICE_GRANT_B64_MAX}.
|
|
514
|
+
*/
|
|
515
|
+
readonly team_grant: S.optional<S.String>;
|
|
516
|
+
/** Authenticated consumer user id. The relay replaces client input. */
|
|
517
|
+
readonly peer_user_id: S.optional<S.String>;
|
|
518
|
+
}>;
|
|
519
|
+
export type TRelayChannelOpenFrame = S.Schema.Type<typeof RelayChannelOpenFrame>;
|
|
520
|
+
/** Relay-to-daemon form of {@link RelayChannelOpenFrame}. The relay stamps
|
|
521
|
+
* `peer_user_id`; daemons never accept an unstamped open as same-user. */
|
|
522
|
+
export declare const RelayStampedChannelOpenFrame: S.Struct<{
|
|
523
|
+
readonly type: S.Literal<"channel_open">;
|
|
524
|
+
readonly channel_id: S.String;
|
|
525
|
+
readonly key_id: S.String;
|
|
526
|
+
readonly consumer: S.optional<S.Literals<readonly ["browser", "daemon"]>>;
|
|
527
|
+
readonly grant: S.optional<S.String>;
|
|
528
|
+
readonly team_grant: S.optional<S.String>;
|
|
529
|
+
readonly peer_user_id: S.String;
|
|
530
|
+
}>;
|
|
531
|
+
export type TRelayStampedChannelOpenFrame = S.Schema.Type<typeof RelayStampedChannelOpenFrame>;
|
|
532
|
+
/** serving daemon → relay → consumer. The relay mints failure acknowledgements;
|
|
533
|
+
* an accepting daemon's acknowledgement is echoed verbatim. */
|
|
534
|
+
export declare const RelayChannelOpenAckFrame: S.Struct<{
|
|
535
|
+
readonly type: S.Literal<"channel_open_ack">;
|
|
536
|
+
readonly channel_id: S.String;
|
|
537
|
+
readonly ok: S.Boolean;
|
|
538
|
+
/**
|
|
539
|
+
* Free-string on the wire so newer daemon failures remain decodable by
|
|
540
|
+
* older relay peers. Known values live in {@link ChannelOpenError}.
|
|
541
|
+
*/
|
|
542
|
+
readonly error: S.optional<S.String>;
|
|
543
|
+
}>;
|
|
544
|
+
export type TRelayChannelOpenAckFrame = S.Schema.Type<typeof RelayChannelOpenAckFrame>;
|
|
545
|
+
/** Either side / relay-minted. `relay_restart` is a drain signal: consumers
|
|
546
|
+
* reset in-flight streams and re-open the channel on the successor relay. */
|
|
547
|
+
export declare const RelayChannelCloseFrame: S.Struct<{
|
|
548
|
+
readonly type: S.Literal<"channel_close">;
|
|
549
|
+
readonly channel_id: S.String;
|
|
550
|
+
/** Free-string on the wire; known values live in ChannelCloseReason. */
|
|
551
|
+
readonly reason: S.optional<S.String>;
|
|
552
|
+
}>;
|
|
553
|
+
export type TRelayChannelCloseFrame = S.Schema.Type<typeof RelayChannelCloseFrame>;
|
|
554
|
+
/**
|
|
555
|
+
* Soft upper bound for an SDP blob on the signaling plane. Real offers/
|
|
556
|
+
* answers are a few KB; 64 KiB leaves headroom while staying well under a
|
|
557
|
+
* typical WebSocket frame budget (~1 MiB on Cloudflare / PartySocket).
|
|
558
|
+
*/
|
|
559
|
+
export declare const RTC_SDP_MAX: number;
|
|
560
|
+
/**
|
|
561
|
+
* Soft upper bound for a base64 sealed fingerprint proof. Sealed-box
|
|
562
|
+
* ciphertext for the offer/answer inner is well under 2 KiB even with a
|
|
563
|
+
* nested device grant; 8 KiB is a conservative ceiling.
|
|
564
|
+
*/
|
|
565
|
+
export declare const RTC_FINGERPRINT_PROOF_B64_MAX: number;
|
|
566
|
+
/**
|
|
567
|
+
* Soft upper bound for a JSON-serialized `RTCIceCandidateInit`. A single
|
|
568
|
+
* candidate line + mid/mline fields is typically < 512 B; 4 KiB is generous.
|
|
569
|
+
*/
|
|
570
|
+
export declare const RTC_ICE_CANDIDATE_MAX: number;
|
|
571
|
+
/** consumer → relay → serving daemon. Open an RTC signaling session aimed at
|
|
572
|
+
* the daemon serving `key_id`. The consumer mints `channel_id` (uuid); the
|
|
573
|
+
* relay authorizes by registry membership and registers the pair so later
|
|
574
|
+
* `rtc_answer` / `rtc_ice` frames route by `channel_id`. */
|
|
575
|
+
export declare const RelayRtcOfferFrame: S.Struct<{
|
|
576
|
+
readonly type: S.Literal<"rtc_offer">;
|
|
577
|
+
readonly channel_id: S.String;
|
|
578
|
+
readonly key_id: S.String;
|
|
579
|
+
readonly sdp: S.String;
|
|
580
|
+
readonly fingerprint_proof: S.String;
|
|
581
|
+
/** Opaque origin-signed grant required for cross-user RTC admission. */
|
|
582
|
+
readonly team_grant: S.optional<S.String>;
|
|
583
|
+
/** Authenticated consumer id. The relay replaces client input. */
|
|
584
|
+
readonly peer_user_id: S.optional<S.String>;
|
|
585
|
+
/** Authenticated consumer kind. The relay replaces client input. */
|
|
586
|
+
readonly consumer: S.optional<S.Literals<readonly ["browser", "daemon"]>>;
|
|
587
|
+
}>;
|
|
588
|
+
export type TRelayRtcOfferFrame = S.Schema.Type<typeof RelayRtcOfferFrame>;
|
|
589
|
+
/** Relay-to-daemon form of {@link RelayRtcOfferFrame}. The relay stamps both
|
|
590
|
+
* identity fields; an unstamped offer is rejected as an outdated relay. */
|
|
591
|
+
export declare const RelayStampedRtcOfferFrame: S.Struct<{
|
|
592
|
+
readonly type: S.Literal<"rtc_offer">;
|
|
593
|
+
readonly channel_id: S.String;
|
|
594
|
+
readonly key_id: S.String;
|
|
595
|
+
readonly sdp: S.String;
|
|
596
|
+
readonly fingerprint_proof: S.String;
|
|
597
|
+
readonly team_grant: S.optional<S.String>;
|
|
598
|
+
readonly peer_user_id: S.String;
|
|
599
|
+
readonly consumer: S.Literals<readonly ["browser", "daemon"]>;
|
|
600
|
+
}>;
|
|
601
|
+
export type TRelayStampedRtcOfferFrame = S.Schema.Type<typeof RelayStampedRtcOfferFrame>;
|
|
602
|
+
/** serving daemon → relay → consumer. Answer the offer for `channel_id`. */
|
|
603
|
+
export declare const RelayRtcAnswerFrame: S.Struct<{
|
|
604
|
+
readonly type: S.Literal<"rtc_answer">;
|
|
605
|
+
readonly channel_id: S.String;
|
|
606
|
+
readonly sdp: S.String;
|
|
607
|
+
readonly fingerprint_proof: S.String;
|
|
608
|
+
}>;
|
|
609
|
+
export type TRelayRtcAnswerFrame = S.Schema.Type<typeof RelayRtcAnswerFrame>;
|
|
610
|
+
/** Both directions. One trickle ICE candidate for `channel_id`. `candidate` is
|
|
611
|
+
* a JSON-serialized `RTCIceCandidateInit` object (stringified by the sender,
|
|
612
|
+
* `JSON.parse`'d by the receiver) — preferred over a raw SDP candidate line
|
|
613
|
+
* for browser/werift field parity (`candidate`/`sdpMid`/`sdpMLineIndex`/…). */
|
|
614
|
+
export declare const RelayRtcIceFrame: S.Struct<{
|
|
615
|
+
readonly type: S.Literal<"rtc_ice">;
|
|
616
|
+
readonly channel_id: S.String;
|
|
617
|
+
readonly candidate: S.String;
|
|
618
|
+
}>;
|
|
619
|
+
export type TRelayRtcIceFrame = S.Schema.Type<typeof RelayRtcIceFrame>;
|
|
620
|
+
/** Why a serving daemon refused an `rtc_offer`. `seedgate` = the vault DEK is
|
|
621
|
+
* locked (retry after unlock); `overloaded` = transient session cap (retry
|
|
622
|
+
* soon); `disabled` / `not_capable` / `handshake_failed` = daemon posture or
|
|
623
|
+
* a failed pre-mux handshake (cache the failure — it will not recover on this
|
|
624
|
+
* immediate retry). `proof_open_failed` means the offer was sealed to a stale
|
|
625
|
+
* daemon X25519 key; consumers should refresh the cloud identity projection.
|
|
626
|
+
* `daemon_outdated` means a relay or daemon omitted a required current stamp. */
|
|
627
|
+
export declare const RtcNackReason: S.Literals<readonly ["seedgate", "overloaded", "disabled", "not_capable", "handshake_failed", "proof_open_failed", "daemon_outdated"]>;
|
|
628
|
+
export type TRtcNackReason = S.Schema.Type<typeof RtcNackReason>;
|
|
629
|
+
/** Normalize a forward-compatible peer refusal to a generic retryable refusal. */
|
|
630
|
+
export declare const normalizeRtcNackReason: (reason: string) => TRtcNackReason;
|
|
631
|
+
/** serving daemon or relay → consumer. Refuse the offer for `channel_id` —
|
|
632
|
+
* the explicit non-silent reject so the offerer fails fast instead of
|
|
633
|
+
* waiting out the signaling/ICE timeout. */
|
|
634
|
+
export declare const RelayRtcNackFrame: S.Struct<{
|
|
635
|
+
readonly type: S.Literal<"rtc_nack">;
|
|
636
|
+
readonly channel_id: S.String;
|
|
637
|
+
/**
|
|
638
|
+
* Free-string on the wire so a newer daemon refusal stays decodable. Known
|
|
639
|
+
* values live in {@link RtcNackReason}; unrecognized values are generic,
|
|
640
|
+
* non-cacheable refusals to consumers.
|
|
641
|
+
*/
|
|
642
|
+
readonly reason: S.String;
|
|
643
|
+
}>;
|
|
644
|
+
export type TRelayRtcNackFrame = S.Schema.Type<typeof RelayRtcNackFrame>;
|
|
645
|
+
/** relay → every client. This box is superseded (a newer relay deploy is
|
|
646
|
+
* accepting): move to the box `/api/daemon/channel` now returns. The box
|
|
647
|
+
* admits no new work, finishes in-flight channels, then closes each socket
|
|
648
|
+
* with {@link RELAY_MOVED_CLOSE_CODE}. Old clients drop the unknown frame and
|
|
649
|
+
* move on that close. See `docs/plans/relay-handover.md`. */
|
|
650
|
+
export declare const RelayMovedFrame: S.Struct<{
|
|
651
|
+
readonly type: S.Literal<"relay_moved">;
|
|
652
|
+
}>;
|
|
653
|
+
export type TRelayMovedFrame = S.Schema.Type<typeof RelayMovedFrame>;
|
|
654
|
+
/** Close code of a retired box's socket: reconnect immediately (no backoff).
|
|
655
|
+
* Distinct from 4000 `superseded`, so it never triggers daemon stand-down. */
|
|
656
|
+
export declare const RELAY_MOVED_CLOSE_CODE = 4010;
|
|
657
|
+
/** Keepalive (both directions). The relay pings below Cloudflare's
|
|
658
|
+
* proxied-WS idle bound; a missed pong is the relay's dead-peer signal. */
|
|
659
|
+
export declare const RelayPingFrame: S.Struct<{
|
|
660
|
+
readonly type: S.Literal<"ping">;
|
|
661
|
+
}>;
|
|
662
|
+
export type TRelayPingFrame = S.Schema.Type<typeof RelayPingFrame>;
|
|
663
|
+
export declare const RelayPongFrame: S.Struct<{
|
|
664
|
+
readonly type: S.Literal<"pong">;
|
|
665
|
+
}>;
|
|
666
|
+
export type TRelayPongFrame = S.Schema.Type<typeof RelayPongFrame>;
|
|
667
|
+
/**
|
|
668
|
+
* daemon → relay → watcher. Explicit subscription-auth FSM (`auth.ts`).
|
|
669
|
+
*
|
|
670
|
+
* Same `type: "auth"` from both roles so `parseFrame` accepts it the way
|
|
671
|
+
* `status` is accepted from the daemon (there is no separate DaemonToRelay
|
|
672
|
+
* union). Frame-level `key_id` is the routing key; the inner event also
|
|
673
|
+
* carries `key_id` (and `flow_id` except on `auth.session.lost`).
|
|
674
|
+
*
|
|
675
|
+
* Old relays that predate this member fail-decode the frame and drop it
|
|
676
|
+
* (`parseFrame` → null) — the designed unknown-type tolerance. New relays
|
|
677
|
+
* parse it even before they route it.
|
|
678
|
+
*/
|
|
679
|
+
export declare const RelayAuthFrame: S.Struct<{
|
|
680
|
+
readonly type: S.Literal<"auth">;
|
|
681
|
+
readonly key_id: S.String;
|
|
682
|
+
readonly auth: S.Union<readonly [S.Struct<{
|
|
683
|
+
readonly event: S.Literal<"auth.login.started">;
|
|
684
|
+
readonly flow_id: S.String;
|
|
685
|
+
readonly key_id: S.String;
|
|
686
|
+
readonly slug: S.String;
|
|
687
|
+
readonly mode: S.Literals<readonly ["browser", "device_code", "paste_code"]>;
|
|
688
|
+
}>, S.Struct<{
|
|
689
|
+
readonly event: S.Literal<"auth.login.prompt">;
|
|
690
|
+
readonly flow_id: S.String;
|
|
691
|
+
readonly key_id: S.String;
|
|
692
|
+
readonly slug: S.String;
|
|
693
|
+
readonly url: S.String;
|
|
694
|
+
readonly code: S.optional<S.String>;
|
|
695
|
+
readonly mode: S.Literals<readonly ["browser", "device_code", "paste_code"]>;
|
|
696
|
+
}>, S.Struct<{
|
|
697
|
+
readonly event: S.Literal<"auth.login.succeeded">;
|
|
698
|
+
readonly flow_id: S.String;
|
|
699
|
+
readonly key_id: S.String;
|
|
700
|
+
readonly slug: S.String;
|
|
701
|
+
readonly account_hash: S.optional<S.String>;
|
|
702
|
+
}>, S.Struct<{
|
|
703
|
+
readonly event: S.Literal<"auth.login.failed">;
|
|
704
|
+
readonly flow_id: S.String;
|
|
705
|
+
readonly key_id: S.String;
|
|
706
|
+
readonly slug: S.String;
|
|
707
|
+
readonly code: S.Literals<readonly ["not_installed", "spawn_denied", "store_unavailable", "prompt_timeout", "cli_crash", "poll_expired", "relay_disconnected", "user_cancelled"]>;
|
|
708
|
+
readonly message: S.String;
|
|
709
|
+
readonly retryable: S.Boolean;
|
|
710
|
+
readonly reason_code: S.optional<S.Literals<readonly ["probe_timeout", "probe_failed", "keychain_unavailable", "store_unreadable", "cli_unavailable", "cli_runtime_missing", "credential_absent"]>>;
|
|
711
|
+
}>, S.Struct<{
|
|
712
|
+
readonly event: S.Literal<"auth.session.lost">;
|
|
713
|
+
readonly key_id: S.String;
|
|
714
|
+
readonly slug: S.String;
|
|
715
|
+
readonly account_hash: S.optional<S.String>;
|
|
716
|
+
readonly diagnostic_code: S.optional<S.Literals<readonly ["credential_absent", "cli_unavailable", "store_unreadable", "keychain_unavailable", "probe_timeout", "vendor_revoked_unknown", "unclassified"]>>;
|
|
717
|
+
}>, S.Struct<{
|
|
718
|
+
readonly event: S.Literal<"auth.liveness.degraded">;
|
|
719
|
+
readonly key_id: S.String;
|
|
720
|
+
readonly slug: S.String;
|
|
721
|
+
readonly consecutive_unknown: S.Number;
|
|
722
|
+
readonly reason_code: S.optional<S.Literals<readonly ["probe_timeout", "probe_failed", "keychain_unavailable", "store_unreadable", "cli_unavailable", "cli_runtime_missing", "credential_absent"]>>;
|
|
723
|
+
}>]>;
|
|
724
|
+
}>;
|
|
725
|
+
export type TRelayAuthFrame = S.Schema.Type<typeof RelayAuthFrame>;
|
|
726
|
+
/** The full frame union, discriminated on `type`. `command_lifecycle` (relay →
|
|
727
|
+
* watcher) is the stateless-relay command receipt: the relay forwards the
|
|
728
|
+
* daemon's terminal `ack` to the originating watcher as a live lifecycle
|
|
729
|
+
* update, so the dashboard releases an optimistic button off the socket — no
|
|
730
|
+
* DB `command_seq` cursor. See `control-channel.ts` +
|
|
731
|
+
* `docs/proposals/daemon-owned-state-stateless-relay.md`. `auth` (daemon →
|
|
732
|
+
* relay → watcher) is the subscription-login FSM; it is not a CommandState. */
|
|
733
|
+
export declare const RelayFrame: S.Union<readonly [S.Struct<{
|
|
734
|
+
readonly type: S.Literal<"hello">;
|
|
735
|
+
readonly ticket: S.String;
|
|
736
|
+
/** Daemon protocol capability; absent daemons retain legacy compatibility. */
|
|
737
|
+
readonly protocol_version: S.optional<S.Number>;
|
|
738
|
+
/** Open-vocabulary peer capability list.
|
|
739
|
+
* Unknown capabilities preserve forward compatibility. */
|
|
740
|
+
readonly caps: S.optional<S.$Array<S.String>>;
|
|
741
|
+
/** Daemon only: initial per-provider `TDaemonStatus` snapshot, folded
|
|
742
|
+
* into `api_key_activity.daemon_status_json` on connect. */
|
|
743
|
+
readonly status: S.optional<S.Unknown>;
|
|
744
|
+
}>, S.Struct<{
|
|
745
|
+
readonly type: S.Literal<"welcome">;
|
|
746
|
+
/** Watcher only: the AUTHORITATIVE set of the user's key ids that have a live
|
|
747
|
+
* daemon socket on the relay right now, from its in-memory registry. The
|
|
748
|
+
* dashboard treats membership as presence — keys absent here are offline by
|
|
749
|
+
* authority of the relay that owns every socket — so a stale-`true`
|
|
750
|
+
* `api_key_activity` row (ungraceful relay death) is corrected the instant a
|
|
751
|
+
* watcher (re)connects. Live status keeps flowing via `status_push`. */
|
|
752
|
+
readonly snapshot: S.optional<S.$Array<S.String>>;
|
|
753
|
+
/** Daemon only: relay-assigned connection epoch for ordered snapshots. */
|
|
754
|
+
readonly daemon_session_id: S.optional<S.String>;
|
|
755
|
+
readonly daemon_session_started_at_ms: S.optional<S.Number>;
|
|
756
|
+
readonly protocol_version: S.optional<S.Number>;
|
|
757
|
+
/** Relay capabilities. */
|
|
758
|
+
readonly caps: S.optional<S.$Array<S.String>>;
|
|
759
|
+
/** Per-serving-daemon capability snapshots, parallel to `snapshot`. */
|
|
760
|
+
readonly snapshot_caps: S.optional<S.$Record<S.String, S.$Array<S.String>>>;
|
|
761
|
+
}>, S.Struct<{
|
|
762
|
+
readonly type: S.Literal<"command">;
|
|
763
|
+
readonly command: S.Union<readonly [S.Struct<{
|
|
764
|
+
id: S.String;
|
|
765
|
+
replay_session_id: S.optional<S.String>;
|
|
766
|
+
} & {
|
|
767
|
+
readonly kind: S.Literals<readonly ["auth"]>;
|
|
768
|
+
readonly payload: S.Struct<{
|
|
769
|
+
readonly operation: S.Literals<["add-account" | "cancel" | "login" | "logout" | "pin-account" | "providers" | "refresh" | "remove-account" | "status" | "submit-code" | "unpin-account" | "usage", ...("add-account" | "cancel" | "login" | "logout" | "pin-account" | "providers" | "refresh" | "remove-account" | "status" | "submit-code" | "unpin-account" | "usage")[]]>;
|
|
770
|
+
readonly provider: S.optional<S.String>;
|
|
771
|
+
readonly method: S.optional<S.Literals<readonly ["browser", "device"]>>;
|
|
772
|
+
readonly flow_id: S.optional<S.String>;
|
|
773
|
+
readonly account: S.optional<S.Number>;
|
|
774
|
+
readonly label: S.optional<S.String>;
|
|
775
|
+
readonly since: S.optional<S.String>;
|
|
776
|
+
readonly wait_ms: S.optional<S.Int>;
|
|
777
|
+
readonly sealed_code: S.optional<S.String>;
|
|
778
|
+
}>;
|
|
779
|
+
}>, S.Struct<{
|
|
780
|
+
id: S.String;
|
|
781
|
+
replay_session_id: S.optional<S.String>;
|
|
782
|
+
} & {
|
|
783
|
+
readonly kind: S.Literals<readonly ["connect"]>;
|
|
784
|
+
readonly payload: S.Struct<{
|
|
785
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
786
|
+
readonly account_index: S.optional<S.Number>;
|
|
787
|
+
}>;
|
|
788
|
+
}>, S.Struct<{
|
|
789
|
+
id: S.String;
|
|
790
|
+
replay_session_id: S.optional<S.String>;
|
|
791
|
+
} & {
|
|
792
|
+
readonly kind: S.Literals<readonly ["connect_device_code"]>;
|
|
793
|
+
readonly payload: S.Struct<{
|
|
794
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
795
|
+
readonly account_index: S.optional<S.Number>;
|
|
796
|
+
}>;
|
|
797
|
+
}>, S.Struct<{
|
|
798
|
+
id: S.String;
|
|
799
|
+
replay_session_id: S.optional<S.String>;
|
|
800
|
+
} & {
|
|
801
|
+
readonly kind: S.Literals<readonly ["cancel_connect"]>;
|
|
802
|
+
readonly payload: S.Struct<{
|
|
803
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
804
|
+
readonly account_index: S.optional<S.Number>;
|
|
805
|
+
readonly flow_id: S.optional<S.String>;
|
|
806
|
+
}>;
|
|
807
|
+
}>, S.Struct<{
|
|
808
|
+
id: S.String;
|
|
809
|
+
replay_session_id: S.optional<S.String>;
|
|
810
|
+
} & {
|
|
811
|
+
readonly kind: S.Literals<readonly ["logout"]>;
|
|
812
|
+
readonly payload: S.Struct<{
|
|
813
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
814
|
+
readonly account_index: S.optional<S.Number>;
|
|
815
|
+
}>;
|
|
816
|
+
}>, S.Struct<{
|
|
817
|
+
id: S.String;
|
|
818
|
+
replay_session_id: S.optional<S.String>;
|
|
819
|
+
} & {
|
|
820
|
+
readonly kind: S.Literals<readonly ["submit_login_code"]>;
|
|
821
|
+
readonly payload: S.Struct<{
|
|
822
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
823
|
+
readonly account_index: S.optional<S.Number>;
|
|
824
|
+
readonly sealed: S.String;
|
|
825
|
+
}>;
|
|
826
|
+
}>, S.Struct<{
|
|
827
|
+
id: S.String;
|
|
828
|
+
replay_session_id: S.optional<S.String>;
|
|
829
|
+
} & {
|
|
830
|
+
readonly kind: S.Literals<readonly ["add_account"]>;
|
|
831
|
+
readonly payload: S.Struct<{
|
|
832
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
833
|
+
readonly label: S.optional<S.String>;
|
|
834
|
+
}>;
|
|
835
|
+
}>, S.Struct<{
|
|
836
|
+
id: S.String;
|
|
837
|
+
replay_session_id: S.optional<S.String>;
|
|
838
|
+
} & {
|
|
839
|
+
readonly kind: S.Literals<readonly ["remove_account"]>;
|
|
840
|
+
readonly payload: S.Struct<{
|
|
841
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
842
|
+
readonly account_index: S.Number;
|
|
843
|
+
}>;
|
|
844
|
+
}>, S.Struct<{
|
|
845
|
+
id: S.String;
|
|
846
|
+
replay_session_id: S.optional<S.String>;
|
|
847
|
+
} & {
|
|
848
|
+
readonly kind: S.Literals<readonly ["pin_account"]>;
|
|
849
|
+
readonly payload: S.Struct<{
|
|
850
|
+
readonly slug: S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>;
|
|
851
|
+
readonly account_index: S.NullOr<S.Number>;
|
|
852
|
+
}>;
|
|
853
|
+
}>, S.Struct<{
|
|
854
|
+
id: S.String;
|
|
855
|
+
replay_session_id: S.optional<S.String>;
|
|
856
|
+
} & {
|
|
857
|
+
readonly kind: S.Literals<readonly ["set_auto_update"]>;
|
|
858
|
+
readonly payload: S.Struct<{
|
|
859
|
+
readonly enabled: S.Boolean;
|
|
860
|
+
}>;
|
|
861
|
+
}>, S.Struct<{
|
|
862
|
+
id: S.String;
|
|
863
|
+
replay_session_id: S.optional<S.String>;
|
|
864
|
+
} & {
|
|
865
|
+
readonly kind: S.Literals<readonly ["refresh"]>;
|
|
866
|
+
readonly payload: S.optional<S.Struct<{
|
|
867
|
+
readonly slug: S.optional<S.Literals<readonly ["claude_code", "chatgpt", "kimi_code", "grok", "cursor", "muse", "antigravity"]>>;
|
|
868
|
+
readonly account_index: S.optional<S.Number>;
|
|
869
|
+
readonly manual: S.optional<S.Boolean>;
|
|
870
|
+
}>>;
|
|
871
|
+
}>, S.Struct<{
|
|
872
|
+
id: S.String;
|
|
873
|
+
replay_session_id: S.optional<S.String>;
|
|
874
|
+
} & {
|
|
875
|
+
readonly kind: S.Literals<readonly ["status"]>;
|
|
876
|
+
readonly payload: S.optional<S.Struct<{}>>;
|
|
877
|
+
}>, S.Struct<{
|
|
878
|
+
id: S.String;
|
|
879
|
+
replay_session_id: S.optional<S.String>;
|
|
880
|
+
} & {
|
|
881
|
+
readonly kind: S.Literals<readonly ["update"]>;
|
|
882
|
+
readonly payload: S.optional<S.Struct<{}>>;
|
|
883
|
+
}>, S.Struct<{
|
|
884
|
+
id: S.String;
|
|
885
|
+
replay_session_id: S.optional<S.String>;
|
|
886
|
+
} & {
|
|
887
|
+
readonly kind: S.Literals<readonly ["bust_plan_cache"]>;
|
|
888
|
+
readonly payload: S.optional<S.Struct<{}>>;
|
|
889
|
+
}>, S.Struct<{
|
|
890
|
+
id: S.String;
|
|
891
|
+
replay_session_id: S.optional<S.String>;
|
|
892
|
+
} & {
|
|
893
|
+
readonly kind: S.Literals<readonly ["refresh_models"]>;
|
|
894
|
+
readonly payload: S.optional<S.Struct<{}>>;
|
|
895
|
+
}>, S.Struct<{
|
|
896
|
+
id: S.String;
|
|
897
|
+
replay_session_id: S.optional<S.String>;
|
|
898
|
+
} & {
|
|
899
|
+
readonly kind: S.Literals<readonly ["refresh_models_due"]>;
|
|
900
|
+
readonly payload: S.optional<S.Struct<{}>>;
|
|
901
|
+
}>, S.Struct<{
|
|
902
|
+
id: S.String;
|
|
903
|
+
replay_session_id: S.optional<S.String>;
|
|
904
|
+
} & {
|
|
905
|
+
readonly kind: S.Literals<readonly ["list_local_sessions"]>;
|
|
906
|
+
readonly payload: S.Struct<{
|
|
907
|
+
readonly cli: S.Literals<readonly ["claude_code", "chatgpt", "grok", "opencode", "hermes", "shell"]>;
|
|
908
|
+
readonly limit: S.optional<S.Number>;
|
|
909
|
+
}>;
|
|
910
|
+
}>, S.Struct<{
|
|
911
|
+
id: S.String;
|
|
912
|
+
replay_session_id: S.optional<S.String>;
|
|
913
|
+
} & {
|
|
914
|
+
readonly kind: S.Literals<readonly ["local_rescan"]>;
|
|
915
|
+
readonly payload: S.optional<S.Struct<{}>>;
|
|
916
|
+
}>, S.Struct<{
|
|
917
|
+
id: S.String;
|
|
918
|
+
replay_session_id: S.optional<S.String>;
|
|
919
|
+
} & {
|
|
920
|
+
readonly kind: S.Literals<readonly ["set_local_key"]>;
|
|
921
|
+
readonly payload: S.Struct<{
|
|
922
|
+
readonly port: S.Number;
|
|
923
|
+
readonly sealed: S.Union<readonly [S.String, S.Literal<"">]>;
|
|
924
|
+
}>;
|
|
925
|
+
}>, S.Struct<{
|
|
926
|
+
id: S.String;
|
|
927
|
+
replay_session_id: S.optional<S.String>;
|
|
928
|
+
} & {
|
|
929
|
+
readonly kind: S.Literals<readonly ["set_provider_key"]>;
|
|
930
|
+
readonly payload: S.Struct<{
|
|
931
|
+
readonly slug: S.Literals<readonly ["opencode_go", "zai_coding", "minimax_coding"]>;
|
|
932
|
+
readonly account_index: S.optional<S.Number>;
|
|
933
|
+
readonly sealed: S.Union<readonly [S.String, S.Literal<"">]>;
|
|
934
|
+
readonly label: S.optional<S.String>;
|
|
935
|
+
}>;
|
|
936
|
+
}>, S.Struct<{
|
|
937
|
+
id: S.String;
|
|
938
|
+
replay_session_id: S.optional<S.String>;
|
|
939
|
+
} & {
|
|
940
|
+
readonly kind: S.Literals<readonly ["set_team_key"]>;
|
|
941
|
+
readonly payload: S.Struct<{
|
|
942
|
+
readonly team_id: S.String;
|
|
943
|
+
readonly epoch: S.Int;
|
|
944
|
+
readonly sealed: S.String;
|
|
945
|
+
}>;
|
|
946
|
+
}>, S.Struct<{
|
|
947
|
+
id: S.String;
|
|
948
|
+
replay_session_id: S.optional<S.String>;
|
|
949
|
+
} & {
|
|
950
|
+
readonly kind: S.Literals<readonly ["delete_team_key"]>;
|
|
951
|
+
readonly payload: S.Struct<{
|
|
952
|
+
readonly team_id: S.String;
|
|
953
|
+
}>;
|
|
954
|
+
}>, S.Struct<{
|
|
955
|
+
id: S.String;
|
|
956
|
+
replay_session_id: S.optional<S.String>;
|
|
957
|
+
} & {
|
|
958
|
+
readonly kind: S.Literals<readonly ["set_device_sessions"]>;
|
|
959
|
+
readonly payload: S.Struct<{
|
|
960
|
+
readonly statement: S.String;
|
|
961
|
+
}>;
|
|
962
|
+
}>]>;
|
|
963
|
+
}>, S.Struct<{
|
|
964
|
+
readonly type: S.Literal<"ack">;
|
|
965
|
+
readonly ack: S.Struct<{
|
|
966
|
+
readonly id: S.String;
|
|
967
|
+
readonly status: S.Literals<readonly ["ack", "done", "not_done", "error"]>;
|
|
968
|
+
readonly result: S.optional<S.Unknown>;
|
|
969
|
+
}>;
|
|
970
|
+
}>, S.Struct<{
|
|
971
|
+
readonly type: S.Literal<"status">;
|
|
972
|
+
readonly active: S.optional<S.Boolean>;
|
|
973
|
+
readonly status: S.optional<S.Unknown>;
|
|
974
|
+
/** Present for protocol-v2 daemon status snapshots. */
|
|
975
|
+
readonly daemon_session_id: S.optional<S.String>;
|
|
976
|
+
readonly status_seq: S.optional<S.Number>;
|
|
977
|
+
readonly acks: S.optional<S.$Array<S.Struct<{
|
|
978
|
+
readonly id: S.String;
|
|
979
|
+
readonly status: S.Literals<readonly ["ack", "done", "not_done", "error"]>;
|
|
980
|
+
readonly result: S.optional<S.Unknown>;
|
|
981
|
+
}>>>;
|
|
982
|
+
/** Planned downtime; absent ⇒ real offline / legacy beacon. */
|
|
983
|
+
readonly reason: S.optional<S.Literal<"restarting">>;
|
|
984
|
+
/** Hint for origin grace / UI: ms until this key should be back. */
|
|
985
|
+
readonly expect_back_ms: S.optional<S.Number>;
|
|
986
|
+
}>, S.Struct<{
|
|
987
|
+
readonly type: S.Literal<"enqueue">;
|
|
988
|
+
readonly req_id: S.optional<S.String>;
|
|
989
|
+
readonly key_id: S.String;
|
|
990
|
+
readonly kind: S.String;
|
|
991
|
+
readonly payload: S.optional<S.Unknown>;
|
|
992
|
+
readonly replay_session_id: S.optional<S.String>;
|
|
993
|
+
}>, S.Struct<{
|
|
994
|
+
readonly type: S.Literal<"enqueue_ack">;
|
|
995
|
+
readonly req_id: S.String;
|
|
996
|
+
readonly ok: S.Boolean;
|
|
997
|
+
readonly id: S.optional<S.String>;
|
|
998
|
+
readonly error: S.optional<S.String>;
|
|
999
|
+
}>, S.Struct<{
|
|
1000
|
+
readonly type: S.Literal<"status_push">;
|
|
1001
|
+
readonly key_id: S.String;
|
|
1002
|
+
readonly status: S.Unknown;
|
|
1003
|
+
readonly daemon_session_id: S.optional<S.String>;
|
|
1004
|
+
readonly daemon_session_started_at_ms: S.optional<S.Number>;
|
|
1005
|
+
readonly status_seq: S.optional<S.Number>;
|
|
1006
|
+
}>, S.Struct<{
|
|
1007
|
+
readonly type: S.Literal<"presence">;
|
|
1008
|
+
readonly key_id: S.String;
|
|
1009
|
+
readonly active: S.Boolean;
|
|
1010
|
+
/** Present when an active daemon advertises capabilities. */
|
|
1011
|
+
readonly caps: S.optional<S.$Array<S.String>>;
|
|
1012
|
+
}>, S.Struct<{
|
|
1013
|
+
readonly type: S.Literal<"command_lifecycle">;
|
|
1014
|
+
readonly lifecycle: S.Struct<{
|
|
1015
|
+
readonly req_id: S.String;
|
|
1016
|
+
readonly command_id: S.optional<S.String>;
|
|
1017
|
+
readonly key_id: S.String;
|
|
1018
|
+
readonly daemon_session_id: S.optional<S.String>;
|
|
1019
|
+
readonly slug: S.optional<S.String>;
|
|
1020
|
+
readonly target: S.optional<S.String>;
|
|
1021
|
+
readonly account_index: S.optional<S.Number>;
|
|
1022
|
+
readonly kind: S.Literals<readonly ["auth", "connect", "connect_device_code", "cancel_connect", "logout", "submit_login_code", "add_account", "remove_account", "pin_account", "set_auto_update", "refresh", "status", "update", "bust_plan_cache", "refresh_models", "refresh_models_due", "list_local_sessions", "local_rescan", "set_local_key", "set_provider_key", "set_team_key", "delete_team_key", "set_device_sessions"]>;
|
|
1023
|
+
readonly state: S.Literals<readonly ["pending", "ack", "done", "not_done", "error"]>;
|
|
1024
|
+
readonly message: S.optional<S.String>;
|
|
1025
|
+
readonly result: S.optional<S.Unknown>;
|
|
1026
|
+
}>;
|
|
1027
|
+
}>, S.Struct<{
|
|
1028
|
+
readonly type: S.Literal<"auth">;
|
|
1029
|
+
readonly key_id: S.String;
|
|
1030
|
+
readonly auth: S.Union<readonly [S.Struct<{
|
|
1031
|
+
readonly event: S.Literal<"auth.login.started">;
|
|
1032
|
+
readonly flow_id: S.String;
|
|
1033
|
+
readonly key_id: S.String;
|
|
1034
|
+
readonly slug: S.String;
|
|
1035
|
+
readonly mode: S.Literals<readonly ["browser", "device_code", "paste_code"]>;
|
|
1036
|
+
}>, S.Struct<{
|
|
1037
|
+
readonly event: S.Literal<"auth.login.prompt">;
|
|
1038
|
+
readonly flow_id: S.String;
|
|
1039
|
+
readonly key_id: S.String;
|
|
1040
|
+
readonly slug: S.String;
|
|
1041
|
+
readonly url: S.String;
|
|
1042
|
+
readonly code: S.optional<S.String>;
|
|
1043
|
+
readonly mode: S.Literals<readonly ["browser", "device_code", "paste_code"]>;
|
|
1044
|
+
}>, S.Struct<{
|
|
1045
|
+
readonly event: S.Literal<"auth.login.succeeded">;
|
|
1046
|
+
readonly flow_id: S.String;
|
|
1047
|
+
readonly key_id: S.String;
|
|
1048
|
+
readonly slug: S.String;
|
|
1049
|
+
readonly account_hash: S.optional<S.String>;
|
|
1050
|
+
}>, S.Struct<{
|
|
1051
|
+
readonly event: S.Literal<"auth.login.failed">;
|
|
1052
|
+
readonly flow_id: S.String;
|
|
1053
|
+
readonly key_id: S.String;
|
|
1054
|
+
readonly slug: S.String;
|
|
1055
|
+
readonly code: S.Literals<readonly ["not_installed", "spawn_denied", "store_unavailable", "prompt_timeout", "cli_crash", "poll_expired", "relay_disconnected", "user_cancelled"]>;
|
|
1056
|
+
readonly message: S.String;
|
|
1057
|
+
readonly retryable: S.Boolean;
|
|
1058
|
+
readonly reason_code: S.optional<S.Literals<readonly ["probe_timeout", "probe_failed", "keychain_unavailable", "store_unreadable", "cli_unavailable", "cli_runtime_missing", "credential_absent"]>>;
|
|
1059
|
+
}>, S.Struct<{
|
|
1060
|
+
readonly event: S.Literal<"auth.session.lost">;
|
|
1061
|
+
readonly key_id: S.String;
|
|
1062
|
+
readonly slug: S.String;
|
|
1063
|
+
readonly account_hash: S.optional<S.String>;
|
|
1064
|
+
readonly diagnostic_code: S.optional<S.Literals<readonly ["credential_absent", "cli_unavailable", "store_unreadable", "keychain_unavailable", "probe_timeout", "vendor_revoked_unknown", "unclassified"]>>;
|
|
1065
|
+
}>, S.Struct<{
|
|
1066
|
+
readonly event: S.Literal<"auth.liveness.degraded">;
|
|
1067
|
+
readonly key_id: S.String;
|
|
1068
|
+
readonly slug: S.String;
|
|
1069
|
+
readonly consecutive_unknown: S.Number;
|
|
1070
|
+
readonly reason_code: S.optional<S.Literals<readonly ["probe_timeout", "probe_failed", "keychain_unavailable", "store_unreadable", "cli_unavailable", "cli_runtime_missing", "credential_absent"]>>;
|
|
1071
|
+
}>]>;
|
|
1072
|
+
}>, S.Struct<{
|
|
1073
|
+
readonly type: S.Literal<"channel_open">;
|
|
1074
|
+
readonly channel_id: S.String;
|
|
1075
|
+
readonly key_id: S.String;
|
|
1076
|
+
/**
|
|
1077
|
+
* Who is opening the channel. The relay stamps this from the authenticated
|
|
1078
|
+
* socket role before forward (`watcher` → `browser`, `daemon` → `daemon`) —
|
|
1079
|
+
* clients may set it but the relay overwrites. `daemon` marks a fleet peer
|
|
1080
|
+
* hop so the serving daemon skips seedgate (no vault DEK on the consumer).
|
|
1081
|
+
* Omitted / `browser` is the default seed-gated path.
|
|
1082
|
+
*/
|
|
1083
|
+
readonly consumer: S.optional<S.Literals<readonly ["browser", "daemon"]>>;
|
|
1084
|
+
/**
|
|
1085
|
+
* Seed-gated device grant (base64 envelope). Present when the serving
|
|
1086
|
+
* daemon advertises `seedgate1`. Relay re-encodes via Schema — must be
|
|
1087
|
+
* on the schema so it survives forward; never verified by the relay.
|
|
1088
|
+
* Bounded so a peer cannot ship an arbitrarily large grant past re-encode.
|
|
1089
|
+
*/
|
|
1090
|
+
readonly grant: S.optional<S.String>;
|
|
1091
|
+
/**
|
|
1092
|
+
* Origin-signed team grant (base64 envelope). Required for cross-user
|
|
1093
|
+
* admission: the relay admits when non-empty (it does NOT verify — the
|
|
1094
|
+
* contributor daemon re-checks with its bootstrap `team_grant_key`).
|
|
1095
|
+
* Same-user opens omit it. Opaque to the payload path; bounded like
|
|
1096
|
+
* {@link DEVICE_GRANT_B64_MAX}.
|
|
1097
|
+
*/
|
|
1098
|
+
readonly team_grant: S.optional<S.String>;
|
|
1099
|
+
/** Authenticated consumer user id. The relay replaces client input. */
|
|
1100
|
+
readonly peer_user_id: S.optional<S.String>;
|
|
1101
|
+
}>, S.Struct<{
|
|
1102
|
+
readonly type: S.Literal<"channel_open_ack">;
|
|
1103
|
+
readonly channel_id: S.String;
|
|
1104
|
+
readonly ok: S.Boolean;
|
|
1105
|
+
/**
|
|
1106
|
+
* Free-string on the wire so newer daemon failures remain decodable by
|
|
1107
|
+
* older relay peers. Known values live in {@link ChannelOpenError}.
|
|
1108
|
+
*/
|
|
1109
|
+
readonly error: S.optional<S.String>;
|
|
1110
|
+
}>, S.Struct<{
|
|
1111
|
+
readonly type: S.Literal<"channel_close">;
|
|
1112
|
+
readonly channel_id: S.String;
|
|
1113
|
+
/** Free-string on the wire; known values live in ChannelCloseReason. */
|
|
1114
|
+
readonly reason: S.optional<S.String>;
|
|
1115
|
+
}>, S.Struct<{
|
|
1116
|
+
readonly type: S.Literal<"rtc_offer">;
|
|
1117
|
+
readonly channel_id: S.String;
|
|
1118
|
+
readonly key_id: S.String;
|
|
1119
|
+
readonly sdp: S.String;
|
|
1120
|
+
readonly fingerprint_proof: S.String;
|
|
1121
|
+
/** Opaque origin-signed grant required for cross-user RTC admission. */
|
|
1122
|
+
readonly team_grant: S.optional<S.String>;
|
|
1123
|
+
/** Authenticated consumer id. The relay replaces client input. */
|
|
1124
|
+
readonly peer_user_id: S.optional<S.String>;
|
|
1125
|
+
/** Authenticated consumer kind. The relay replaces client input. */
|
|
1126
|
+
readonly consumer: S.optional<S.Literals<readonly ["browser", "daemon"]>>;
|
|
1127
|
+
}>, S.Struct<{
|
|
1128
|
+
readonly type: S.Literal<"rtc_answer">;
|
|
1129
|
+
readonly channel_id: S.String;
|
|
1130
|
+
readonly sdp: S.String;
|
|
1131
|
+
readonly fingerprint_proof: S.String;
|
|
1132
|
+
}>, S.Struct<{
|
|
1133
|
+
readonly type: S.Literal<"rtc_ice">;
|
|
1134
|
+
readonly channel_id: S.String;
|
|
1135
|
+
readonly candidate: S.String;
|
|
1136
|
+
}>, S.Struct<{
|
|
1137
|
+
readonly type: S.Literal<"rtc_nack">;
|
|
1138
|
+
readonly channel_id: S.String;
|
|
1139
|
+
/**
|
|
1140
|
+
* Free-string on the wire so a newer daemon refusal stays decodable. Known
|
|
1141
|
+
* values live in {@link RtcNackReason}; unrecognized values are generic,
|
|
1142
|
+
* non-cacheable refusals to consumers.
|
|
1143
|
+
*/
|
|
1144
|
+
readonly reason: S.String;
|
|
1145
|
+
}>, S.Struct<{
|
|
1146
|
+
readonly type: S.Literal<"relay_moved">;
|
|
1147
|
+
}>, S.Struct<{
|
|
1148
|
+
readonly type: S.Literal<"ping">;
|
|
1149
|
+
}>, S.Struct<{
|
|
1150
|
+
readonly type: S.Literal<"pong">;
|
|
1151
|
+
}>]>;
|
|
1152
|
+
export type TRelayFrame = S.Schema.Type<typeof RelayFrame>;
|