@openllmsh/sdk 2.10.12-alpha.0 → 2.10.12-alpha.2
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,1487 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent session protocol — the structured replacement for remote PTY
|
|
3
|
+
* mirroring (docs/plan/2026-10-23-agent-sessions-replace-remote-pty.md).
|
|
4
|
+
*
|
|
5
|
+
* A consumer opens a mux stream with {@link AgentStreamOpenPayload}
|
|
6
|
+
* (`kind:"agent"`, seed-gated on the daemon) or reaches the daemon's loopback
|
|
7
|
+
* agent endpoint, then exchanges NDJSON lines over the flow-controlled DATA
|
|
8
|
+
* channel:
|
|
9
|
+
*
|
|
10
|
+
* consumer → daemon : {@link AgentCommand} (start / attach / send /
|
|
11
|
+
* interrupt / respond / close / attachment_get /
|
|
12
|
+
* set_model / delete_session / history_get)
|
|
13
|
+
* daemon → consumer : {@link AgentEvent} (session / turn / item / content /
|
|
14
|
+
* request / user-input / token-usage / runtime /
|
|
15
|
+
* attachment.data / history.page)
|
|
16
|
+
*
|
|
17
|
+
* History is paged (after t3code's windowed thread detail): an attach replays
|
|
18
|
+
* only the LATEST window of the session, ending on a turn boundary, then a
|
|
19
|
+
* {@link AgentHistoryPageEvent} names the opaque cursor before that window.
|
|
20
|
+
* `history_get{before}` returns the adjacent, strictly older page.
|
|
21
|
+
*
|
|
22
|
+
* The event families are a trimmed subset of t3code's `ProviderRuntimeEvent`:
|
|
23
|
+
* no multi-CLI orchestration, no event-sourcing / checkpoint / git tooling, no
|
|
24
|
+
* terminal drawer, no realtime-audio, account or MCP-OAuth events. Every
|
|
25
|
+
* engine adapter on the daemon emits this one stream, so the UI renders one
|
|
26
|
+
* vocabulary whichever engine runs the session.
|
|
27
|
+
*
|
|
28
|
+
* Forward compatibility: an event whose `type` this build does not know
|
|
29
|
+
* decodes to `null` and is dropped by consumers. Commands are validated
|
|
30
|
+
* strictly by the serving daemon.
|
|
31
|
+
*/
|
|
32
|
+
import { Schema as S } from "effect";
|
|
33
|
+
/**
|
|
34
|
+
* Capability advertising `kind:"agent"` stream support. Consumers MUST check
|
|
35
|
+
* {@link hasAgentCap} before OPEN; a peer without it gets "update your device".
|
|
36
|
+
*/
|
|
37
|
+
export declare const AGENT_CAP = "agent1";
|
|
38
|
+
/** Returns whether an open-vocabulary capability list advertises agent sessions. */
|
|
39
|
+
export declare const hasAgentCap: (caps: readonly string[] | undefined) => boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Bound on ONE NDJSON agent line (JSON-encoded UTF-8 bytes, including the
|
|
42
|
+
* trailing `\n`). Larger than the realtime bound because a `send` command may
|
|
43
|
+
* carry inline attachments; a line (or unterminated remainder) over the bound
|
|
44
|
+
* is an overflow, never a growing buffer.
|
|
45
|
+
*/
|
|
46
|
+
export declare const AGENT_MAX_LINE_BYTES: number;
|
|
47
|
+
/** Max characters of one prompt. */
|
|
48
|
+
export declare const AGENT_MAX_PROMPT_LENGTH: number;
|
|
49
|
+
/**
|
|
50
|
+
* Daemon loopback route Claude's hooks post to (`openllm exec agent hook`):
|
|
51
|
+
* busy/idle and PermissionRequest for agent sessions. Admitted like the other
|
|
52
|
+
* `/local/*` routes (loopback peer + Host, local control capability).
|
|
53
|
+
* Body: `{session_id, event, payload}`; reply: `{output}` (the hook's stdout
|
|
54
|
+
* JSON) or `{}` for no output.
|
|
55
|
+
*/
|
|
56
|
+
export declare const AGENT_HOOK_LOCAL_PATH = "/local/agent-hook";
|
|
57
|
+
/**
|
|
58
|
+
* Claude hook events `openllm exec agent hook` forwards. `SessionStart` is the
|
|
59
|
+
* engine's readiness signal: Claude runs it once the TUI is up (after any
|
|
60
|
+
* folder-trust dialog), so a queued web prompt is pasted only then.
|
|
61
|
+
*/
|
|
62
|
+
export declare const AGENT_HOOK_EVENTS: readonly ["PermissionRequest", "PreToolUse", "Stop", "SessionStart"];
|
|
63
|
+
/** Max inline attachments on one `send`. */
|
|
64
|
+
export declare const AGENT_MAX_ATTACHMENTS = 8;
|
|
65
|
+
/** Max base64 characters of one inline attachment. */
|
|
66
|
+
export declare const AGENT_MAX_ATTACHMENT_BASE64_LENGTH: number;
|
|
67
|
+
/**
|
|
68
|
+
* Engines an agent session can run. Each id is the `openllm <client>` the
|
|
69
|
+
* daemon launches the engine through (same overlay, gateway URL, key, model
|
|
70
|
+
* mapping), so a session's inference is routed through openllm whatever
|
|
71
|
+
* model the user picked.
|
|
72
|
+
*/
|
|
73
|
+
export declare const AgentEngine: S.Literals<readonly ["claude", "codex"]>;
|
|
74
|
+
export type TAgentEngine = S.Schema.Type<typeof AgentEngine>;
|
|
75
|
+
/**
|
|
76
|
+
* Agent session id: daemon-minted (a UUID), the consumer's own record id, or
|
|
77
|
+
* a vendor session id for attach/resume (Claude / Codex ids are UUIDs). The
|
|
78
|
+
* id names the session host's registry dir and its attachments dir, so it is
|
|
79
|
+
* the local session id itself: url-safe, no `.`, so never `.` / `..`.
|
|
80
|
+
*/
|
|
81
|
+
export declare const AGENT_SESSION_ID_PATTERN: RegExp;
|
|
82
|
+
export declare const AgentSessionId: S.String;
|
|
83
|
+
export type TAgentSessionId = S.Schema.Type<typeof AgentSessionId>;
|
|
84
|
+
/**
|
|
85
|
+
* Length caps (UTF-16 code units, as `String.length`) of an event's short
|
|
86
|
+
* label fields (titles, messages, option labels), its detail text, and a tool
|
|
87
|
+
* call's `tool_name`. An event over one fails to decode and consumers drop it,
|
|
88
|
+
* so builders clip to these.
|
|
89
|
+
*/
|
|
90
|
+
export declare const AGENT_SHORT_TEXT_MAX_LENGTH = 256;
|
|
91
|
+
export declare const AGENT_DETAIL_TEXT_MAX_LENGTH: number;
|
|
92
|
+
export declare const AGENT_TOOL_NAME_MAX_LENGTH = 128;
|
|
93
|
+
/**
|
|
94
|
+
* Mux `kind:"agent"` OPEN payload — folded into `StreamOpenPayload` in
|
|
95
|
+
* `./mux`. Carries nothing but the kind: the session itself is driven by
|
|
96
|
+
* {@link AgentCommand} lines on the stream, so one OPEN shape serves start,
|
|
97
|
+
* attach and resume.
|
|
98
|
+
*/
|
|
99
|
+
export declare const AgentStreamOpenPayload: S.Struct<{
|
|
100
|
+
readonly kind: S.Literal<"agent">;
|
|
101
|
+
}>;
|
|
102
|
+
export type TAgentStreamOpenPayload = S.Schema.Type<typeof AgentStreamOpenPayload>;
|
|
103
|
+
export declare const AgentAttachment: S.Struct<{
|
|
104
|
+
readonly kind: S.Literals<readonly ["image", "file"]>;
|
|
105
|
+
readonly name: S.optional<S.String>;
|
|
106
|
+
readonly media_type: S.String;
|
|
107
|
+
/** Base64 bytes. */
|
|
108
|
+
readonly data: S.String;
|
|
109
|
+
}>;
|
|
110
|
+
export type TAgentAttachment = S.Schema.Type<typeof AgentAttachment>;
|
|
111
|
+
/**
|
|
112
|
+
* Metadata for an attachment that was saved on the device for a turn. The
|
|
113
|
+
* `name` is the on-disk basename under the session's attachments dir (what
|
|
114
|
+
* {@link AgentAttachmentGetCommand} looks up) — not the original upload name
|
|
115
|
+
* when they differ. Optional on `turn.started` so terminal prompts and older
|
|
116
|
+
* daemons stay compatible.
|
|
117
|
+
*/
|
|
118
|
+
export declare const AgentAttachmentMeta: S.Struct<{
|
|
119
|
+
readonly name: S.String;
|
|
120
|
+
readonly mime: S.String;
|
|
121
|
+
readonly size: S.Number;
|
|
122
|
+
}>;
|
|
123
|
+
export type TAgentAttachmentMeta = S.Schema.Type<typeof AgentAttachmentMeta>;
|
|
124
|
+
/** Decoded-byte cap mirroring {@link AGENT_MAX_ATTACHMENT_BASE64_LENGTH}. */
|
|
125
|
+
export declare const AGENT_MAX_ATTACHMENT_BYTES: number;
|
|
126
|
+
/** Decision on an approval request (`request.opened`). */
|
|
127
|
+
export declare const AgentRequestDecision: S.Literals<readonly ["accept", "accept_for_session", "decline", "cancel"]>;
|
|
128
|
+
export type TAgentRequestDecision = S.Schema.Type<typeof AgentRequestDecision>;
|
|
129
|
+
/** Answers to a `user-input.requested`, keyed by question id. */
|
|
130
|
+
export declare const AgentUserInputAnswers: S.$Record<S.String, S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
131
|
+
export type TAgentUserInputAnswers = S.Schema.Type<typeof AgentUserInputAnswers>;
|
|
132
|
+
export declare const AgentStartCommand: S.Struct<{
|
|
133
|
+
readonly type: S.Literal<"start">;
|
|
134
|
+
readonly id: S.optional<S.String>;
|
|
135
|
+
readonly engine: S.Literals<readonly ["claude", "codex"]>;
|
|
136
|
+
/** Gateway model id; omitted → the engine's openllm default. */
|
|
137
|
+
readonly model: S.optional<S.String>;
|
|
138
|
+
/** Omitted → the daemon user's home directory. */
|
|
139
|
+
readonly cwd: S.optional<S.String>;
|
|
140
|
+
/**
|
|
141
|
+
* Per-session opt-in to the engine's skip-permissions mode
|
|
142
|
+
* (`--dangerously-skip-permissions` or the vendor equivalent). Default off:
|
|
143
|
+
* approvals surface as `request.opened` events.
|
|
144
|
+
*/
|
|
145
|
+
readonly skip_permissions: S.optional<S.Boolean>;
|
|
146
|
+
readonly title: S.optional<S.String>;
|
|
147
|
+
/**
|
|
148
|
+
* The id the new session takes (the consumer's own record id, e.g. the web's
|
|
149
|
+
* cloud session row). Omitted → the daemon mints one. One id end to end (the
|
|
150
|
+
* cloud row, the session host, Claude's transcript) is what lets a reload
|
|
151
|
+
* re-attach and a running row match the daemon's status.
|
|
152
|
+
*/
|
|
153
|
+
readonly session_id: S.optional<S.String>;
|
|
154
|
+
}>;
|
|
155
|
+
export type TAgentStartCommand = S.Schema.Type<typeof AgentStartCommand>;
|
|
156
|
+
export declare const AgentAttachCommand: S.Struct<{
|
|
157
|
+
readonly type: S.Literal<"attach">;
|
|
158
|
+
readonly id: S.optional<S.String>;
|
|
159
|
+
readonly session_id: S.String;
|
|
160
|
+
/** Engine of the target session when the consumer knows it (local index). */
|
|
161
|
+
readonly engine: S.optional<S.Literals<readonly ["claude", "codex"]>>;
|
|
162
|
+
/**
|
|
163
|
+
* The session was started with skip-permissions: a resume (the session is
|
|
164
|
+
* not running) relaunches the engine the same way. Ignored when joining a
|
|
165
|
+
* live session, which keeps the mode it runs in.
|
|
166
|
+
*/
|
|
167
|
+
readonly skip_permissions: S.optional<S.Boolean>;
|
|
168
|
+
}>;
|
|
169
|
+
export type TAgentAttachCommand = S.Schema.Type<typeof AgentAttachCommand>;
|
|
170
|
+
export declare const AgentSendCommand: S.Struct<{
|
|
171
|
+
readonly type: S.Literal<"send">;
|
|
172
|
+
readonly id: S.optional<S.String>;
|
|
173
|
+
readonly prompt: S.String;
|
|
174
|
+
readonly attachments: S.optional<S.$Array<S.Struct<{
|
|
175
|
+
readonly kind: S.Literals<readonly ["image", "file"]>;
|
|
176
|
+
readonly name: S.optional<S.String>;
|
|
177
|
+
readonly media_type: S.String;
|
|
178
|
+
/** Base64 bytes. */
|
|
179
|
+
readonly data: S.String;
|
|
180
|
+
}>>>;
|
|
181
|
+
}>;
|
|
182
|
+
export type TAgentSendCommand = S.Schema.Type<typeof AgentSendCommand>;
|
|
183
|
+
/**
|
|
184
|
+
* Deliver the queued prompts NOW instead of after the running turn. Plain,
|
|
185
|
+
* they join the running turn at its next tool boundary and running tools
|
|
186
|
+
* finish. With `interrupt`, the engine's own send-now (Claude Code's
|
|
187
|
+
* ctrl+enter) runs: running shells move to the background and tools that
|
|
188
|
+
* can't (an MCP call) are stopped — consumers ask the user before setting it.
|
|
189
|
+
* A daemon that predates it rejects the line; consumers offer it only after
|
|
190
|
+
* a `queue.updated` showed the daemon queues.
|
|
191
|
+
*/
|
|
192
|
+
export declare const AgentSendNowCommand: S.Struct<{
|
|
193
|
+
readonly type: S.Literal<"send_now">;
|
|
194
|
+
readonly id: S.optional<S.String>;
|
|
195
|
+
readonly interrupt: S.optional<S.Boolean>;
|
|
196
|
+
}>;
|
|
197
|
+
export type TAgentSendNowCommand = S.Schema.Type<typeof AgentSendNowCommand>;
|
|
198
|
+
/** Resume a queue that an interrupt deliberately paused. */
|
|
199
|
+
export declare const AgentResumeQueueCommand: S.Struct<{
|
|
200
|
+
readonly type: S.Literal<"resume_queue">;
|
|
201
|
+
readonly id: S.optional<S.String>;
|
|
202
|
+
}>;
|
|
203
|
+
export type TAgentResumeQueueCommand = S.Schema.Type<typeof AgentResumeQueueCommand>;
|
|
204
|
+
/** Remove one queued prompt without affecting the active turn. */
|
|
205
|
+
export declare const AgentCancelQueuedCommand: S.Struct<{
|
|
206
|
+
readonly type: S.Literal<"cancel_queued">;
|
|
207
|
+
readonly id: S.optional<S.String>;
|
|
208
|
+
readonly queue_id: S.String;
|
|
209
|
+
}>;
|
|
210
|
+
export type TAgentCancelQueuedCommand = S.Schema.Type<typeof AgentCancelQueuedCommand>;
|
|
211
|
+
export declare const AgentInterruptCommand: S.Struct<{
|
|
212
|
+
readonly type: S.Literal<"interrupt">;
|
|
213
|
+
readonly id: S.optional<S.String>;
|
|
214
|
+
/** Omitted → the active turn. */
|
|
215
|
+
readonly turn_id: S.optional<S.String>;
|
|
216
|
+
}>;
|
|
217
|
+
export type TAgentInterruptCommand = S.Schema.Type<typeof AgentInterruptCommand>;
|
|
218
|
+
/**
|
|
219
|
+
* Answer a pending approval (`decision`) or user-input request (`answers`).
|
|
220
|
+
* Exactly one of the two is present.
|
|
221
|
+
*/
|
|
222
|
+
export declare const AgentRespondCommand: S.Struct<{
|
|
223
|
+
readonly type: S.Literal<"respond">;
|
|
224
|
+
readonly id: S.optional<S.String>;
|
|
225
|
+
readonly request_id: S.String;
|
|
226
|
+
readonly decision: S.optional<S.Literals<readonly ["accept", "accept_for_session", "decline", "cancel"]>>;
|
|
227
|
+
readonly answers: S.optional<S.$Record<S.String, S.Union<readonly [S.String, S.$Array<S.String>]>>>;
|
|
228
|
+
}>;
|
|
229
|
+
export type TAgentRespondCommand = S.Schema.Type<typeof AgentRespondCommand>;
|
|
230
|
+
export declare const AgentCloseCommand: S.Struct<{
|
|
231
|
+
readonly type: S.Literal<"close">;
|
|
232
|
+
readonly id: S.optional<S.String>;
|
|
233
|
+
}>;
|
|
234
|
+
export type TAgentCloseCommand = S.Schema.Type<typeof AgentCloseCommand>;
|
|
235
|
+
/**
|
|
236
|
+
* Fetch one attachment from the current session's on-device attachments dir.
|
|
237
|
+
* `name` is the basename recorded on `turn.started.attachments` (no path
|
|
238
|
+
* separators). The daemon refuses traversal / absolute / symlink-escape names
|
|
239
|
+
* and streams the bytes back as one or more {@link AgentAttachmentDataEvent}
|
|
240
|
+
* lines under the same `command_id`.
|
|
241
|
+
*/
|
|
242
|
+
export declare const AgentAttachmentGetCommand: S.Struct<{
|
|
243
|
+
readonly type: S.Literal<"attachment_get">;
|
|
244
|
+
readonly id: S.optional<S.String>;
|
|
245
|
+
readonly name: S.String;
|
|
246
|
+
}>;
|
|
247
|
+
export type TAgentAttachmentGetCommand = S.Schema.Type<typeof AgentAttachmentGetCommand>;
|
|
248
|
+
/**
|
|
249
|
+
* A model id a running session can switch to: gateway ids and Claude aliases
|
|
250
|
+
* (`ultra`, `sonnet`, `openai/gpt-5`, `claude-opus-4-5[1m]`). No whitespace or
|
|
251
|
+
* control characters: it is typed into the engine's own `/model` command.
|
|
252
|
+
*/
|
|
253
|
+
export declare const AGENT_SWITCH_MODEL_PATTERN: RegExp;
|
|
254
|
+
/**
|
|
255
|
+
* Switch the running session's model (Claude: its own `/model <id>`, applied
|
|
256
|
+
* when the session is idle, queued while a turn runs). Confirmed by a
|
|
257
|
+
* `session.configured` event once the engine reports the change.
|
|
258
|
+
*/
|
|
259
|
+
export declare const AgentSetModelCommand: S.Struct<{
|
|
260
|
+
readonly type: S.Literal<"set_model">;
|
|
261
|
+
readonly id: S.optional<S.String>;
|
|
262
|
+
readonly model: S.String;
|
|
263
|
+
}>;
|
|
264
|
+
export type TAgentSetModelCommand = S.Schema.Type<typeof AgentSetModelCommand>;
|
|
265
|
+
/**
|
|
266
|
+
* Delete one session from this device: stop its process if it runs (here or
|
|
267
|
+
* in a terminal), then remove its attachments, Claude's transcript
|
|
268
|
+
* (`~/.claude/projects/<slug of its cwd>/<id>.jsonl`) and its lines in
|
|
269
|
+
* `~/.claude/history.jsonl`. Stream-level (needs no bound session). Answered
|
|
270
|
+
* by `session.deleted`, or a `runtime.error`. `close` is the non-destructive
|
|
271
|
+
* Stop: it kills the process and keeps the history.
|
|
272
|
+
*/
|
|
273
|
+
export declare const AgentDeleteSessionCommand: S.Struct<{
|
|
274
|
+
readonly type: S.Literal<"delete_session">;
|
|
275
|
+
readonly id: S.optional<S.String>;
|
|
276
|
+
readonly session_id: S.String;
|
|
277
|
+
}>;
|
|
278
|
+
export type TAgentDeleteSessionCommand = S.Schema.Type<typeof AgentDeleteSessionCommand>;
|
|
279
|
+
/** Turns one `history_get` page holds at most. */
|
|
280
|
+
export declare const AGENT_HISTORY_MAX_PAGE_TURNS = 100;
|
|
281
|
+
/** Events one `history.page` carries at most. */
|
|
282
|
+
export declare const AGENT_HISTORY_MAX_PAGE_EVENTS = 4000;
|
|
283
|
+
/**
|
|
284
|
+
* Older history of the bound session: the turns strictly before `before`
|
|
285
|
+
* (a cursor from an earlier `history.page`), newest `limit` of them. Answered
|
|
286
|
+
* by one `history.page` carrying the events, under the same `command_id`.
|
|
287
|
+
*/
|
|
288
|
+
export declare const AgentHistoryGetCommand: S.Struct<{
|
|
289
|
+
readonly type: S.Literal<"history_get">;
|
|
290
|
+
readonly id: S.optional<S.String>;
|
|
291
|
+
readonly before: S.String;
|
|
292
|
+
readonly limit: S.optional<S.Number>;
|
|
293
|
+
}>;
|
|
294
|
+
export type TAgentHistoryGetCommand = S.Schema.Type<typeof AgentHistoryGetCommand>;
|
|
295
|
+
/** One consumer → daemon command line. */
|
|
296
|
+
export declare const AgentCommand: S.Union<readonly [S.Struct<{
|
|
297
|
+
readonly type: S.Literal<"start">;
|
|
298
|
+
readonly id: S.optional<S.String>;
|
|
299
|
+
readonly engine: S.Literals<readonly ["claude", "codex"]>;
|
|
300
|
+
/** Gateway model id; omitted → the engine's openllm default. */
|
|
301
|
+
readonly model: S.optional<S.String>;
|
|
302
|
+
/** Omitted → the daemon user's home directory. */
|
|
303
|
+
readonly cwd: S.optional<S.String>;
|
|
304
|
+
/**
|
|
305
|
+
* Per-session opt-in to the engine's skip-permissions mode
|
|
306
|
+
* (`--dangerously-skip-permissions` or the vendor equivalent). Default off:
|
|
307
|
+
* approvals surface as `request.opened` events.
|
|
308
|
+
*/
|
|
309
|
+
readonly skip_permissions: S.optional<S.Boolean>;
|
|
310
|
+
readonly title: S.optional<S.String>;
|
|
311
|
+
/**
|
|
312
|
+
* The id the new session takes (the consumer's own record id, e.g. the web's
|
|
313
|
+
* cloud session row). Omitted → the daemon mints one. One id end to end (the
|
|
314
|
+
* cloud row, the session host, Claude's transcript) is what lets a reload
|
|
315
|
+
* re-attach and a running row match the daemon's status.
|
|
316
|
+
*/
|
|
317
|
+
readonly session_id: S.optional<S.String>;
|
|
318
|
+
}>, S.Struct<{
|
|
319
|
+
readonly type: S.Literal<"attach">;
|
|
320
|
+
readonly id: S.optional<S.String>;
|
|
321
|
+
readonly session_id: S.String;
|
|
322
|
+
/** Engine of the target session when the consumer knows it (local index). */
|
|
323
|
+
readonly engine: S.optional<S.Literals<readonly ["claude", "codex"]>>;
|
|
324
|
+
/**
|
|
325
|
+
* The session was started with skip-permissions: a resume (the session is
|
|
326
|
+
* not running) relaunches the engine the same way. Ignored when joining a
|
|
327
|
+
* live session, which keeps the mode it runs in.
|
|
328
|
+
*/
|
|
329
|
+
readonly skip_permissions: S.optional<S.Boolean>;
|
|
330
|
+
}>, S.Struct<{
|
|
331
|
+
readonly type: S.Literal<"send">;
|
|
332
|
+
readonly id: S.optional<S.String>;
|
|
333
|
+
readonly prompt: S.String;
|
|
334
|
+
readonly attachments: S.optional<S.$Array<S.Struct<{
|
|
335
|
+
readonly kind: S.Literals<readonly ["image", "file"]>;
|
|
336
|
+
readonly name: S.optional<S.String>;
|
|
337
|
+
readonly media_type: S.String;
|
|
338
|
+
/** Base64 bytes. */
|
|
339
|
+
readonly data: S.String;
|
|
340
|
+
}>>>;
|
|
341
|
+
}>, S.Struct<{
|
|
342
|
+
readonly type: S.Literal<"send_now">;
|
|
343
|
+
readonly id: S.optional<S.String>;
|
|
344
|
+
readonly interrupt: S.optional<S.Boolean>;
|
|
345
|
+
}>, S.Struct<{
|
|
346
|
+
readonly type: S.Literal<"resume_queue">;
|
|
347
|
+
readonly id: S.optional<S.String>;
|
|
348
|
+
}>, S.Struct<{
|
|
349
|
+
readonly type: S.Literal<"cancel_queued">;
|
|
350
|
+
readonly id: S.optional<S.String>;
|
|
351
|
+
readonly queue_id: S.String;
|
|
352
|
+
}>, S.Struct<{
|
|
353
|
+
readonly type: S.Literal<"interrupt">;
|
|
354
|
+
readonly id: S.optional<S.String>;
|
|
355
|
+
/** Omitted → the active turn. */
|
|
356
|
+
readonly turn_id: S.optional<S.String>;
|
|
357
|
+
}>, S.Struct<{
|
|
358
|
+
readonly type: S.Literal<"respond">;
|
|
359
|
+
readonly id: S.optional<S.String>;
|
|
360
|
+
readonly request_id: S.String;
|
|
361
|
+
readonly decision: S.optional<S.Literals<readonly ["accept", "accept_for_session", "decline", "cancel"]>>;
|
|
362
|
+
readonly answers: S.optional<S.$Record<S.String, S.Union<readonly [S.String, S.$Array<S.String>]>>>;
|
|
363
|
+
}>, S.Struct<{
|
|
364
|
+
readonly type: S.Literal<"close">;
|
|
365
|
+
readonly id: S.optional<S.String>;
|
|
366
|
+
}>, S.Struct<{
|
|
367
|
+
readonly type: S.Literal<"attachment_get">;
|
|
368
|
+
readonly id: S.optional<S.String>;
|
|
369
|
+
readonly name: S.String;
|
|
370
|
+
}>, S.Struct<{
|
|
371
|
+
readonly type: S.Literal<"set_model">;
|
|
372
|
+
readonly id: S.optional<S.String>;
|
|
373
|
+
readonly model: S.String;
|
|
374
|
+
}>, S.Struct<{
|
|
375
|
+
readonly type: S.Literal<"delete_session">;
|
|
376
|
+
readonly id: S.optional<S.String>;
|
|
377
|
+
readonly session_id: S.String;
|
|
378
|
+
}>, S.Struct<{
|
|
379
|
+
readonly type: S.Literal<"history_get">;
|
|
380
|
+
readonly id: S.optional<S.String>;
|
|
381
|
+
readonly before: S.String;
|
|
382
|
+
readonly limit: S.optional<S.Number>;
|
|
383
|
+
}>]>;
|
|
384
|
+
export type TAgentCommand = S.Schema.Type<typeof AgentCommand>;
|
|
385
|
+
export type TAgentCommandType = TAgentCommand["type"];
|
|
386
|
+
export declare const AgentTokenUsage: S.Struct<{
|
|
387
|
+
readonly input_tokens: S.Number;
|
|
388
|
+
readonly output_tokens: S.Number;
|
|
389
|
+
readonly cached_input_tokens: S.optional<S.Number>;
|
|
390
|
+
readonly reasoning_tokens: S.optional<S.Number>;
|
|
391
|
+
readonly total_tokens: S.optional<S.Number>;
|
|
392
|
+
/** The model's context window, when known, for a fill gauge. */
|
|
393
|
+
readonly context_window: S.optional<S.Number>;
|
|
394
|
+
}>;
|
|
395
|
+
export type TAgentTokenUsage = S.Schema.Type<typeof AgentTokenUsage>;
|
|
396
|
+
export declare const AgentSessionExitReason: S.Literals<readonly ["closed", "completed", "killed", "error"]>;
|
|
397
|
+
export type TAgentSessionExitReason = S.Schema.Type<typeof AgentSessionExitReason>;
|
|
398
|
+
export declare const AgentSessionStartedEvent: S.Struct<{
|
|
399
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
400
|
+
readonly seq: S.optional<S.Number>;
|
|
401
|
+
/** Epoch milliseconds on the daemon. */
|
|
402
|
+
readonly at: S.optional<S.Number>;
|
|
403
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
404
|
+
readonly command_id: S.optional<S.String>;
|
|
405
|
+
readonly type: S.Literal<"session.started">;
|
|
406
|
+
readonly session_id: S.String;
|
|
407
|
+
readonly engine: S.Literals<readonly ["claude", "codex"]>;
|
|
408
|
+
readonly model: S.optional<S.String>;
|
|
409
|
+
readonly cwd: S.optional<S.String>;
|
|
410
|
+
/** True when this is an attach/resume of an existing engine session. */
|
|
411
|
+
readonly resumed: S.optional<S.Boolean>;
|
|
412
|
+
readonly skip_permissions: S.optional<S.Boolean>;
|
|
413
|
+
}>;
|
|
414
|
+
/**
|
|
415
|
+
* The engine began a new conversation in the same live TUI (for example,
|
|
416
|
+
* Claude Code's `/new`). The consumer must discard the prior transcript; the
|
|
417
|
+
* daemon also starts its replay buffer over so a later attach stays clean.
|
|
418
|
+
*/
|
|
419
|
+
export declare const AgentSessionResetEvent: S.Struct<{
|
|
420
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
421
|
+
readonly session_id: S.optional<S.String>;
|
|
422
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
423
|
+
readonly seq: S.optional<S.Number>;
|
|
424
|
+
/** Epoch milliseconds on the daemon. */
|
|
425
|
+
readonly at: S.optional<S.Number>;
|
|
426
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
427
|
+
readonly command_id: S.optional<S.String>;
|
|
428
|
+
readonly type: S.Literal<"session.reset">;
|
|
429
|
+
}>;
|
|
430
|
+
/**
|
|
431
|
+
* The session's configuration changed (today: its model), from whichever side
|
|
432
|
+
* changed it (a web `set_model`, or `/model` typed in the terminal). Read from
|
|
433
|
+
* the engine's own record, so every viewer converges on the same value.
|
|
434
|
+
*/
|
|
435
|
+
export declare const AgentSessionConfiguredEvent: S.Struct<{
|
|
436
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
437
|
+
readonly session_id: S.optional<S.String>;
|
|
438
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
439
|
+
readonly seq: S.optional<S.Number>;
|
|
440
|
+
/** Epoch milliseconds on the daemon. */
|
|
441
|
+
readonly at: S.optional<S.Number>;
|
|
442
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
443
|
+
readonly command_id: S.optional<S.String>;
|
|
444
|
+
readonly type: S.Literal<"session.configured">;
|
|
445
|
+
readonly model: S.optional<S.String>;
|
|
446
|
+
/**
|
|
447
|
+
* The conversation's title, from the engine's own record (Claude's
|
|
448
|
+
* `ai-title`). Optional: older daemons omit it, older consumers ignore it.
|
|
449
|
+
*/
|
|
450
|
+
readonly title: S.optional<S.String>;
|
|
451
|
+
}>;
|
|
452
|
+
export declare const AgentSessionExitedEvent: S.Struct<{
|
|
453
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
454
|
+
readonly seq: S.optional<S.Number>;
|
|
455
|
+
/** Epoch milliseconds on the daemon. */
|
|
456
|
+
readonly at: S.optional<S.Number>;
|
|
457
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
458
|
+
readonly command_id: S.optional<S.String>;
|
|
459
|
+
readonly type: S.Literal<"session.exited">;
|
|
460
|
+
readonly session_id: S.String;
|
|
461
|
+
readonly reason: S.Literals<readonly ["closed", "completed", "killed", "error"]>;
|
|
462
|
+
readonly message: S.optional<S.String>;
|
|
463
|
+
}>;
|
|
464
|
+
export declare const AgentTurnStartedEvent: S.Struct<{
|
|
465
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
466
|
+
readonly session_id: S.optional<S.String>;
|
|
467
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
468
|
+
readonly seq: S.optional<S.Number>;
|
|
469
|
+
/** Epoch milliseconds on the daemon. */
|
|
470
|
+
readonly at: S.optional<S.Number>;
|
|
471
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
472
|
+
readonly command_id: S.optional<S.String>;
|
|
473
|
+
readonly type: S.Literal<"turn.started">;
|
|
474
|
+
readonly turn_id: S.String;
|
|
475
|
+
readonly model: S.optional<S.String>;
|
|
476
|
+
/**
|
|
477
|
+
* The prompt text that opened the turn. Lets a consumer that attaches later
|
|
478
|
+
* (replay) render the user's side of the transcript. Optional: older daemons
|
|
479
|
+
* omit it and older consumers ignore it.
|
|
480
|
+
*/
|
|
481
|
+
readonly prompt: S.optional<S.String>;
|
|
482
|
+
/**
|
|
483
|
+
* Attachments saved for this turn (on-disk basename + mime + size). Optional:
|
|
484
|
+
* terminal prompts and older daemons omit it; older consumers ignore it.
|
|
485
|
+
*/
|
|
486
|
+
readonly attachments: S.optional<S.$Array<S.Struct<{
|
|
487
|
+
readonly name: S.String;
|
|
488
|
+
readonly mime: S.String;
|
|
489
|
+
readonly size: S.Number;
|
|
490
|
+
}>>>;
|
|
491
|
+
}>;
|
|
492
|
+
/** Most prompts a session holds behind its running turn. */
|
|
493
|
+
export declare const AGENT_MAX_QUEUED_PROMPTS = 16;
|
|
494
|
+
/**
|
|
495
|
+
* The prompts waiting behind the running turn, oldest first — the whole
|
|
496
|
+
* queue, so the latest event is the state. A `send` that lands mid-turn is
|
|
497
|
+
* queued on the daemon and goes out as the turn ends (or on `send_now`).
|
|
498
|
+
* Older consumers ignore it.
|
|
499
|
+
*/
|
|
500
|
+
export declare const AgentQueuedPrompt: S.Struct<{
|
|
501
|
+
/** Stable while the prompt is queued; used for a targeted cancel. */
|
|
502
|
+
readonly id: S.String;
|
|
503
|
+
/** Clipped preview, never the complete prompt. */
|
|
504
|
+
readonly prompt: S.String;
|
|
505
|
+
readonly attachment_count: S.Number;
|
|
506
|
+
}>;
|
|
507
|
+
export type TAgentQueuedPrompt = S.Schema.Type<typeof AgentQueuedPrompt>;
|
|
508
|
+
export declare const AgentQueueUpdatedEvent: S.Struct<{
|
|
509
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
510
|
+
readonly session_id: S.optional<S.String>;
|
|
511
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
512
|
+
readonly seq: S.optional<S.Number>;
|
|
513
|
+
/** Epoch milliseconds on the daemon. */
|
|
514
|
+
readonly at: S.optional<S.Number>;
|
|
515
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
516
|
+
readonly command_id: S.optional<S.String>;
|
|
517
|
+
readonly type: S.Literal<"queue.updated">;
|
|
518
|
+
/**
|
|
519
|
+
* Identified entries, oldest first. `string[]` remains valid on the browser
|
|
520
|
+
* boundary for daemons predating this protocol shape.
|
|
521
|
+
*/
|
|
522
|
+
readonly prompts: S.$Array<S.Union<readonly [S.Struct<{
|
|
523
|
+
/** Stable while the prompt is queued; used for a targeted cancel. */
|
|
524
|
+
readonly id: S.String;
|
|
525
|
+
/** Clipped preview, never the complete prompt. */
|
|
526
|
+
readonly prompt: S.String;
|
|
527
|
+
readonly attachment_count: S.Number;
|
|
528
|
+
}>, S.String]>>;
|
|
529
|
+
/** An interrupt pauses automatic draining until `resume_queue`. */
|
|
530
|
+
readonly held: S.optional<S.Boolean>;
|
|
531
|
+
}>;
|
|
532
|
+
export declare const AgentTurnCompletedEvent: S.Struct<{
|
|
533
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
534
|
+
readonly session_id: S.optional<S.String>;
|
|
535
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
536
|
+
readonly seq: S.optional<S.Number>;
|
|
537
|
+
/** Epoch milliseconds on the daemon. */
|
|
538
|
+
readonly at: S.optional<S.Number>;
|
|
539
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
540
|
+
readonly command_id: S.optional<S.String>;
|
|
541
|
+
readonly type: S.Literal<"turn.completed">;
|
|
542
|
+
readonly turn_id: S.String;
|
|
543
|
+
readonly stop_reason: S.optional<S.String>;
|
|
544
|
+
/**
|
|
545
|
+
* What the turn cost, from the engine's own record: `input_tokens` is the
|
|
546
|
+
* context the turn's last request carried, `output_tokens` the sum the turn
|
|
547
|
+
* generated. Optional: older daemons omit it, older consumers ignore it.
|
|
548
|
+
*/
|
|
549
|
+
readonly usage: S.optional<S.Struct<{
|
|
550
|
+
readonly input_tokens: S.Number;
|
|
551
|
+
readonly output_tokens: S.Number;
|
|
552
|
+
readonly cached_input_tokens: S.optional<S.Number>;
|
|
553
|
+
readonly reasoning_tokens: S.optional<S.Number>;
|
|
554
|
+
readonly total_tokens: S.optional<S.Number>;
|
|
555
|
+
/** The model's context window, when known, for a fill gauge. */
|
|
556
|
+
readonly context_window: S.optional<S.Number>;
|
|
557
|
+
}>>;
|
|
558
|
+
}>;
|
|
559
|
+
export declare const AgentTurnAbortedEvent: S.Struct<{
|
|
560
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
561
|
+
readonly session_id: S.optional<S.String>;
|
|
562
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
563
|
+
readonly seq: S.optional<S.Number>;
|
|
564
|
+
/** Epoch milliseconds on the daemon. */
|
|
565
|
+
readonly at: S.optional<S.Number>;
|
|
566
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
567
|
+
readonly command_id: S.optional<S.String>;
|
|
568
|
+
readonly type: S.Literal<"turn.aborted">;
|
|
569
|
+
readonly turn_id: S.String;
|
|
570
|
+
readonly reason: S.Literals<readonly ["interrupted", "failed", "cancelled"]>;
|
|
571
|
+
readonly message: S.optional<S.String>;
|
|
572
|
+
}>;
|
|
573
|
+
export declare const AgentToolStatus: S.Literals<readonly ["in_progress", "completed", "failed"]>;
|
|
574
|
+
export type TAgentToolStatus = S.Schema.Type<typeof AgentToolStatus>;
|
|
575
|
+
export declare const AgentNoticeKind: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
|
|
576
|
+
export type TAgentNoticeKind = S.Schema.Type<typeof AgentNoticeKind>;
|
|
577
|
+
/** The renderable unit of a turn. */
|
|
578
|
+
export declare const AgentItem: S.Union<readonly [S.Struct<{
|
|
579
|
+
readonly kind: S.Literal<"assistant_message">;
|
|
580
|
+
readonly text: S.String;
|
|
581
|
+
}>, S.Struct<{
|
|
582
|
+
readonly kind: S.Literal<"reasoning">;
|
|
583
|
+
readonly text: S.String;
|
|
584
|
+
}>, S.Struct<{
|
|
585
|
+
readonly kind: S.Literal<"tool_call">;
|
|
586
|
+
readonly tool_name: S.String;
|
|
587
|
+
readonly title: S.optional<S.String>;
|
|
588
|
+
/** The tool's input as the engine reported it (JSON). */
|
|
589
|
+
readonly input: S.optional<S.Unknown>;
|
|
590
|
+
readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
|
|
591
|
+
/** Result text, truncated by the daemon to fit one line. */
|
|
592
|
+
readonly output: S.optional<S.String>;
|
|
593
|
+
readonly is_error: S.optional<S.Boolean>;
|
|
594
|
+
/** The user (or a policy) refused the call; optional, additive. */
|
|
595
|
+
readonly denied: S.optional<S.Boolean>;
|
|
596
|
+
/** Wall time from call to result, when the engine recorded both. */
|
|
597
|
+
readonly duration_ms: S.optional<S.Number>;
|
|
598
|
+
/** A shell command's exit status, when the engine reported it. */
|
|
599
|
+
readonly exit_code: S.optional<S.Number>;
|
|
600
|
+
/**
|
|
601
|
+
* A subagent launched in the background: the call's own result is only
|
|
602
|
+
* the launch ack, so it stays in progress past its turn until the
|
|
603
|
+
* subagent finishes. Optional, additive.
|
|
604
|
+
*/
|
|
605
|
+
readonly background: S.optional<S.Boolean>;
|
|
606
|
+
}>, S.Struct<{
|
|
607
|
+
readonly kind: S.Literal<"notice">;
|
|
608
|
+
readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
|
|
609
|
+
readonly text: S.optional<S.String>;
|
|
610
|
+
/** The item the notice is about (a subagent's call). Optional, additive. */
|
|
611
|
+
readonly ref_item_id: S.optional<S.String>;
|
|
612
|
+
}>]>;
|
|
613
|
+
export type TAgentItem = S.Schema.Type<typeof AgentItem>;
|
|
614
|
+
export declare const AgentItemStartedEvent: S.Struct<{
|
|
615
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
616
|
+
readonly session_id: S.optional<S.String>;
|
|
617
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
618
|
+
readonly seq: S.optional<S.Number>;
|
|
619
|
+
/** Epoch milliseconds on the daemon. */
|
|
620
|
+
readonly at: S.optional<S.Number>;
|
|
621
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
622
|
+
readonly command_id: S.optional<S.String>;
|
|
623
|
+
readonly turn_id: S.optional<S.String>;
|
|
624
|
+
readonly item_id: S.String;
|
|
625
|
+
readonly item: S.Union<readonly [S.Struct<{
|
|
626
|
+
readonly kind: S.Literal<"assistant_message">;
|
|
627
|
+
readonly text: S.String;
|
|
628
|
+
}>, S.Struct<{
|
|
629
|
+
readonly kind: S.Literal<"reasoning">;
|
|
630
|
+
readonly text: S.String;
|
|
631
|
+
}>, S.Struct<{
|
|
632
|
+
readonly kind: S.Literal<"tool_call">;
|
|
633
|
+
readonly tool_name: S.String;
|
|
634
|
+
readonly title: S.optional<S.String>;
|
|
635
|
+
/** The tool's input as the engine reported it (JSON). */
|
|
636
|
+
readonly input: S.optional<S.Unknown>;
|
|
637
|
+
readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
|
|
638
|
+
/** Result text, truncated by the daemon to fit one line. */
|
|
639
|
+
readonly output: S.optional<S.String>;
|
|
640
|
+
readonly is_error: S.optional<S.Boolean>;
|
|
641
|
+
/** The user (or a policy) refused the call; optional, additive. */
|
|
642
|
+
readonly denied: S.optional<S.Boolean>;
|
|
643
|
+
/** Wall time from call to result, when the engine recorded both. */
|
|
644
|
+
readonly duration_ms: S.optional<S.Number>;
|
|
645
|
+
/** A shell command's exit status, when the engine reported it. */
|
|
646
|
+
readonly exit_code: S.optional<S.Number>;
|
|
647
|
+
/**
|
|
648
|
+
* A subagent launched in the background: the call's own result is only
|
|
649
|
+
* the launch ack, so it stays in progress past its turn until the
|
|
650
|
+
* subagent finishes. Optional, additive.
|
|
651
|
+
*/
|
|
652
|
+
readonly background: S.optional<S.Boolean>;
|
|
653
|
+
}>, S.Struct<{
|
|
654
|
+
readonly kind: S.Literal<"notice">;
|
|
655
|
+
readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
|
|
656
|
+
readonly text: S.optional<S.String>;
|
|
657
|
+
/** The item the notice is about (a subagent's call). Optional, additive. */
|
|
658
|
+
readonly ref_item_id: S.optional<S.String>;
|
|
659
|
+
}>]>;
|
|
660
|
+
/**
|
|
661
|
+
* The tool call (a Task / Agent subagent) this item belongs to: a
|
|
662
|
+
* subagent's own text and tool calls nest under the call that spawned it.
|
|
663
|
+
* Absent → a top-level item of the turn. Older consumers ignore it.
|
|
664
|
+
*/
|
|
665
|
+
readonly parent_item_id: S.optional<S.String>;
|
|
666
|
+
readonly type: S.Literal<"item.started">;
|
|
667
|
+
}>;
|
|
668
|
+
export declare const AgentItemUpdatedEvent: S.Struct<{
|
|
669
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
670
|
+
readonly session_id: S.optional<S.String>;
|
|
671
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
672
|
+
readonly seq: S.optional<S.Number>;
|
|
673
|
+
/** Epoch milliseconds on the daemon. */
|
|
674
|
+
readonly at: S.optional<S.Number>;
|
|
675
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
676
|
+
readonly command_id: S.optional<S.String>;
|
|
677
|
+
readonly turn_id: S.optional<S.String>;
|
|
678
|
+
readonly item_id: S.String;
|
|
679
|
+
readonly item: S.Union<readonly [S.Struct<{
|
|
680
|
+
readonly kind: S.Literal<"assistant_message">;
|
|
681
|
+
readonly text: S.String;
|
|
682
|
+
}>, S.Struct<{
|
|
683
|
+
readonly kind: S.Literal<"reasoning">;
|
|
684
|
+
readonly text: S.String;
|
|
685
|
+
}>, S.Struct<{
|
|
686
|
+
readonly kind: S.Literal<"tool_call">;
|
|
687
|
+
readonly tool_name: S.String;
|
|
688
|
+
readonly title: S.optional<S.String>;
|
|
689
|
+
/** The tool's input as the engine reported it (JSON). */
|
|
690
|
+
readonly input: S.optional<S.Unknown>;
|
|
691
|
+
readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
|
|
692
|
+
/** Result text, truncated by the daemon to fit one line. */
|
|
693
|
+
readonly output: S.optional<S.String>;
|
|
694
|
+
readonly is_error: S.optional<S.Boolean>;
|
|
695
|
+
/** The user (or a policy) refused the call; optional, additive. */
|
|
696
|
+
readonly denied: S.optional<S.Boolean>;
|
|
697
|
+
/** Wall time from call to result, when the engine recorded both. */
|
|
698
|
+
readonly duration_ms: S.optional<S.Number>;
|
|
699
|
+
/** A shell command's exit status, when the engine reported it. */
|
|
700
|
+
readonly exit_code: S.optional<S.Number>;
|
|
701
|
+
/**
|
|
702
|
+
* A subagent launched in the background: the call's own result is only
|
|
703
|
+
* the launch ack, so it stays in progress past its turn until the
|
|
704
|
+
* subagent finishes. Optional, additive.
|
|
705
|
+
*/
|
|
706
|
+
readonly background: S.optional<S.Boolean>;
|
|
707
|
+
}>, S.Struct<{
|
|
708
|
+
readonly kind: S.Literal<"notice">;
|
|
709
|
+
readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
|
|
710
|
+
readonly text: S.optional<S.String>;
|
|
711
|
+
/** The item the notice is about (a subagent's call). Optional, additive. */
|
|
712
|
+
readonly ref_item_id: S.optional<S.String>;
|
|
713
|
+
}>]>;
|
|
714
|
+
/**
|
|
715
|
+
* The tool call (a Task / Agent subagent) this item belongs to: a
|
|
716
|
+
* subagent's own text and tool calls nest under the call that spawned it.
|
|
717
|
+
* Absent → a top-level item of the turn. Older consumers ignore it.
|
|
718
|
+
*/
|
|
719
|
+
readonly parent_item_id: S.optional<S.String>;
|
|
720
|
+
readonly type: S.Literal<"item.updated">;
|
|
721
|
+
}>;
|
|
722
|
+
export declare const AgentItemCompletedEvent: S.Struct<{
|
|
723
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
724
|
+
readonly session_id: S.optional<S.String>;
|
|
725
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
726
|
+
readonly seq: S.optional<S.Number>;
|
|
727
|
+
/** Epoch milliseconds on the daemon. */
|
|
728
|
+
readonly at: S.optional<S.Number>;
|
|
729
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
730
|
+
readonly command_id: S.optional<S.String>;
|
|
731
|
+
readonly turn_id: S.optional<S.String>;
|
|
732
|
+
readonly item_id: S.String;
|
|
733
|
+
readonly item: S.Union<readonly [S.Struct<{
|
|
734
|
+
readonly kind: S.Literal<"assistant_message">;
|
|
735
|
+
readonly text: S.String;
|
|
736
|
+
}>, S.Struct<{
|
|
737
|
+
readonly kind: S.Literal<"reasoning">;
|
|
738
|
+
readonly text: S.String;
|
|
739
|
+
}>, S.Struct<{
|
|
740
|
+
readonly kind: S.Literal<"tool_call">;
|
|
741
|
+
readonly tool_name: S.String;
|
|
742
|
+
readonly title: S.optional<S.String>;
|
|
743
|
+
/** The tool's input as the engine reported it (JSON). */
|
|
744
|
+
readonly input: S.optional<S.Unknown>;
|
|
745
|
+
readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
|
|
746
|
+
/** Result text, truncated by the daemon to fit one line. */
|
|
747
|
+
readonly output: S.optional<S.String>;
|
|
748
|
+
readonly is_error: S.optional<S.Boolean>;
|
|
749
|
+
/** The user (or a policy) refused the call; optional, additive. */
|
|
750
|
+
readonly denied: S.optional<S.Boolean>;
|
|
751
|
+
/** Wall time from call to result, when the engine recorded both. */
|
|
752
|
+
readonly duration_ms: S.optional<S.Number>;
|
|
753
|
+
/** A shell command's exit status, when the engine reported it. */
|
|
754
|
+
readonly exit_code: S.optional<S.Number>;
|
|
755
|
+
/**
|
|
756
|
+
* A subagent launched in the background: the call's own result is only
|
|
757
|
+
* the launch ack, so it stays in progress past its turn until the
|
|
758
|
+
* subagent finishes. Optional, additive.
|
|
759
|
+
*/
|
|
760
|
+
readonly background: S.optional<S.Boolean>;
|
|
761
|
+
}>, S.Struct<{
|
|
762
|
+
readonly kind: S.Literal<"notice">;
|
|
763
|
+
readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
|
|
764
|
+
readonly text: S.optional<S.String>;
|
|
765
|
+
/** The item the notice is about (a subagent's call). Optional, additive. */
|
|
766
|
+
readonly ref_item_id: S.optional<S.String>;
|
|
767
|
+
}>]>;
|
|
768
|
+
/**
|
|
769
|
+
* The tool call (a Task / Agent subagent) this item belongs to: a
|
|
770
|
+
* subagent's own text and tool calls nest under the call that spawned it.
|
|
771
|
+
* Absent → a top-level item of the turn. Older consumers ignore it.
|
|
772
|
+
*/
|
|
773
|
+
readonly parent_item_id: S.optional<S.String>;
|
|
774
|
+
readonly type: S.Literal<"item.completed">;
|
|
775
|
+
}>;
|
|
776
|
+
export declare const AgentContentStream: S.Literals<readonly ["assistant_text", "reasoning_text", "tool_output"]>;
|
|
777
|
+
export type TAgentContentStream = S.Schema.Type<typeof AgentContentStream>;
|
|
778
|
+
export declare const AgentContentDeltaEvent: S.Struct<{
|
|
779
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
780
|
+
readonly session_id: S.optional<S.String>;
|
|
781
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
782
|
+
readonly seq: S.optional<S.Number>;
|
|
783
|
+
/** Epoch milliseconds on the daemon. */
|
|
784
|
+
readonly at: S.optional<S.Number>;
|
|
785
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
786
|
+
readonly command_id: S.optional<S.String>;
|
|
787
|
+
readonly type: S.Literal<"content.delta">;
|
|
788
|
+
readonly turn_id: S.optional<S.String>;
|
|
789
|
+
readonly item_id: S.String;
|
|
790
|
+
readonly stream: S.Literals<readonly ["assistant_text", "reasoning_text", "tool_output"]>;
|
|
791
|
+
readonly delta: S.String;
|
|
792
|
+
}>;
|
|
793
|
+
/** What an approval request asks permission for. */
|
|
794
|
+
export declare const AgentRequestKind: S.Literals<readonly ["command", "file_change", "tool", "other"]>;
|
|
795
|
+
export type TAgentRequestKind = S.Schema.Type<typeof AgentRequestKind>;
|
|
796
|
+
export declare const AgentRequestOpenedEvent: S.Struct<{
|
|
797
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
798
|
+
readonly session_id: S.optional<S.String>;
|
|
799
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
800
|
+
readonly seq: S.optional<S.Number>;
|
|
801
|
+
/** Epoch milliseconds on the daemon. */
|
|
802
|
+
readonly at: S.optional<S.Number>;
|
|
803
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
804
|
+
readonly command_id: S.optional<S.String>;
|
|
805
|
+
readonly type: S.Literal<"request.opened">;
|
|
806
|
+
readonly request_id: S.String;
|
|
807
|
+
readonly turn_id: S.optional<S.String>;
|
|
808
|
+
readonly item_id: S.optional<S.String>;
|
|
809
|
+
readonly request_kind: S.Literals<readonly ["command", "file_change", "tool", "other"]>;
|
|
810
|
+
readonly title: S.optional<S.String>;
|
|
811
|
+
readonly detail: S.optional<S.String>;
|
|
812
|
+
readonly input: S.optional<S.Unknown>;
|
|
813
|
+
}>;
|
|
814
|
+
export declare const AgentRequestResolvedEvent: S.Struct<{
|
|
815
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
816
|
+
readonly session_id: S.optional<S.String>;
|
|
817
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
818
|
+
readonly seq: S.optional<S.Number>;
|
|
819
|
+
/** Epoch milliseconds on the daemon. */
|
|
820
|
+
readonly at: S.optional<S.Number>;
|
|
821
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
822
|
+
readonly command_id: S.optional<S.String>;
|
|
823
|
+
readonly type: S.Literal<"request.resolved">;
|
|
824
|
+
readonly request_id: S.String;
|
|
825
|
+
readonly decision: S.Literals<readonly ["accept", "accept_for_session", "decline", "cancel"]>;
|
|
826
|
+
}>;
|
|
827
|
+
export declare const AgentUserInputQuestion: S.Struct<{
|
|
828
|
+
readonly id: S.String;
|
|
829
|
+
readonly header: S.optional<S.String>;
|
|
830
|
+
readonly question: S.String;
|
|
831
|
+
readonly options: S.optional<S.$Array<S.Struct<{
|
|
832
|
+
readonly label: S.String;
|
|
833
|
+
readonly description: S.optional<S.String>;
|
|
834
|
+
}>>>;
|
|
835
|
+
readonly multi_select: S.optional<S.Boolean>;
|
|
836
|
+
}>;
|
|
837
|
+
export type TAgentUserInputQuestion = S.Schema.Type<typeof AgentUserInputQuestion>;
|
|
838
|
+
export declare const AgentUserInputRequestedEvent: S.Struct<{
|
|
839
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
840
|
+
readonly session_id: S.optional<S.String>;
|
|
841
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
842
|
+
readonly seq: S.optional<S.Number>;
|
|
843
|
+
/** Epoch milliseconds on the daemon. */
|
|
844
|
+
readonly at: S.optional<S.Number>;
|
|
845
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
846
|
+
readonly command_id: S.optional<S.String>;
|
|
847
|
+
readonly type: S.Literal<"user-input.requested">;
|
|
848
|
+
readonly request_id: S.String;
|
|
849
|
+
readonly turn_id: S.optional<S.String>;
|
|
850
|
+
readonly questions: S.$Array<S.Struct<{
|
|
851
|
+
readonly id: S.String;
|
|
852
|
+
readonly header: S.optional<S.String>;
|
|
853
|
+
readonly question: S.String;
|
|
854
|
+
readonly options: S.optional<S.$Array<S.Struct<{
|
|
855
|
+
readonly label: S.String;
|
|
856
|
+
readonly description: S.optional<S.String>;
|
|
857
|
+
}>>>;
|
|
858
|
+
readonly multi_select: S.optional<S.Boolean>;
|
|
859
|
+
}>>;
|
|
860
|
+
}>;
|
|
861
|
+
export declare const AgentUserInputResolvedEvent: S.Struct<{
|
|
862
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
863
|
+
readonly session_id: S.optional<S.String>;
|
|
864
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
865
|
+
readonly seq: S.optional<S.Number>;
|
|
866
|
+
/** Epoch milliseconds on the daemon. */
|
|
867
|
+
readonly at: S.optional<S.Number>;
|
|
868
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
869
|
+
readonly command_id: S.optional<S.String>;
|
|
870
|
+
readonly type: S.Literal<"user-input.resolved">;
|
|
871
|
+
readonly request_id: S.String;
|
|
872
|
+
readonly answers: S.$Record<S.String, S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
873
|
+
}>;
|
|
874
|
+
export declare const AgentTokenUsageUpdatedEvent: S.Struct<{
|
|
875
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
876
|
+
readonly session_id: S.optional<S.String>;
|
|
877
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
878
|
+
readonly seq: S.optional<S.Number>;
|
|
879
|
+
/** Epoch milliseconds on the daemon. */
|
|
880
|
+
readonly at: S.optional<S.Number>;
|
|
881
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
882
|
+
readonly command_id: S.optional<S.String>;
|
|
883
|
+
readonly type: S.Literal<"thread.token-usage.updated">;
|
|
884
|
+
readonly usage: S.Struct<{
|
|
885
|
+
readonly input_tokens: S.Number;
|
|
886
|
+
readonly output_tokens: S.Number;
|
|
887
|
+
readonly cached_input_tokens: S.optional<S.Number>;
|
|
888
|
+
readonly reasoning_tokens: S.optional<S.Number>;
|
|
889
|
+
readonly total_tokens: S.optional<S.Number>;
|
|
890
|
+
/** The model's context window, when known, for a fill gauge. */
|
|
891
|
+
readonly context_window: S.optional<S.Number>;
|
|
892
|
+
}>;
|
|
893
|
+
}>;
|
|
894
|
+
export declare const AgentRuntimeWarningEvent: S.Struct<{
|
|
895
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
896
|
+
readonly session_id: S.optional<S.String>;
|
|
897
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
898
|
+
readonly seq: S.optional<S.Number>;
|
|
899
|
+
/** Epoch milliseconds on the daemon. */
|
|
900
|
+
readonly at: S.optional<S.Number>;
|
|
901
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
902
|
+
readonly command_id: S.optional<S.String>;
|
|
903
|
+
readonly type: S.Literal<"runtime.warning">;
|
|
904
|
+
readonly code: S.optional<S.String>;
|
|
905
|
+
readonly message: S.String;
|
|
906
|
+
}>;
|
|
907
|
+
/**
|
|
908
|
+
* `runtime.error` code of a `set_model` the engine accepted but could not
|
|
909
|
+
* apply (the CLI refused the model, or never confirmed the switch).
|
|
910
|
+
*/
|
|
911
|
+
export declare const AGENT_MODEL_SWITCH_FAILED_CODE = "model_switch_failed";
|
|
912
|
+
/** `runtime.warning` code of a model switch the user declined. */
|
|
913
|
+
export declare const AGENT_MODEL_SWITCH_DECLINED_CODE = "model_switch_declined";
|
|
914
|
+
export declare const AgentRuntimeErrorEvent: S.Struct<{
|
|
915
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
916
|
+
readonly session_id: S.optional<S.String>;
|
|
917
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
918
|
+
readonly seq: S.optional<S.Number>;
|
|
919
|
+
/** Epoch milliseconds on the daemon. */
|
|
920
|
+
readonly at: S.optional<S.Number>;
|
|
921
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
922
|
+
readonly command_id: S.optional<S.String>;
|
|
923
|
+
readonly type: S.Literal<"runtime.error">;
|
|
924
|
+
readonly code: S.optional<S.String>;
|
|
925
|
+
readonly message: S.String;
|
|
926
|
+
/** True when the session cannot continue (a `session.exited` follows). */
|
|
927
|
+
readonly fatal: S.optional<S.Boolean>;
|
|
928
|
+
}>;
|
|
929
|
+
/**
|
|
930
|
+
* One chunk of an `attachment_get` response. Chunked so a single NDJSON line
|
|
931
|
+
* stays under {@link AGENT_MAX_LINE_BYTES}: `data` is base64 of
|
|
932
|
+
* `file[offset .. offset+decodedLen)`, and `done` is true on the last chunk.
|
|
933
|
+
*/
|
|
934
|
+
export declare const AgentAttachmentDataEvent: S.Struct<{
|
|
935
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
936
|
+
readonly session_id: S.optional<S.String>;
|
|
937
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
938
|
+
readonly seq: S.optional<S.Number>;
|
|
939
|
+
/** Epoch milliseconds on the daemon. */
|
|
940
|
+
readonly at: S.optional<S.Number>;
|
|
941
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
942
|
+
readonly command_id: S.optional<S.String>;
|
|
943
|
+
readonly type: S.Literal<"attachment.data">;
|
|
944
|
+
readonly name: S.String;
|
|
945
|
+
readonly mime: S.String;
|
|
946
|
+
/** Total decoded byte length of the file. */
|
|
947
|
+
readonly size: S.Number;
|
|
948
|
+
/** Decoded-byte offset of this chunk within the file. */
|
|
949
|
+
readonly offset: S.Number;
|
|
950
|
+
/** Base64 of this chunk. */
|
|
951
|
+
readonly data: S.String;
|
|
952
|
+
/** True when this is the last chunk. */
|
|
953
|
+
readonly done: S.Boolean;
|
|
954
|
+
}>;
|
|
955
|
+
export type TAgentAttachmentDataEvent = S.Schema.Type<typeof AgentAttachmentDataEvent>;
|
|
956
|
+
/** Answer to `delete_session`: the session is gone from the device. */
|
|
957
|
+
export declare const AgentSessionDeletedEvent: S.Struct<{
|
|
958
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
959
|
+
readonly seq: S.optional<S.Number>;
|
|
960
|
+
/** Epoch milliseconds on the daemon. */
|
|
961
|
+
readonly at: S.optional<S.Number>;
|
|
962
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
963
|
+
readonly command_id: S.optional<S.String>;
|
|
964
|
+
readonly type: S.Literal<"session.deleted">;
|
|
965
|
+
readonly session_id: S.String;
|
|
966
|
+
}>;
|
|
967
|
+
/**
|
|
968
|
+
* A page of session history. On attach (no `events`): the cursor before the
|
|
969
|
+
* replayed window. Answering `history_get` (same `command_id`): the older
|
|
970
|
+
* events themselves, oldest first, each one {@link AgentEvent} line's value
|
|
971
|
+
* (decode with {@link parseAgentEvent}; unknown types are dropped). Paging is
|
|
972
|
+
* by whole turns, so a page never splits one. `has_more` false → the page
|
|
973
|
+
* reaches the start of the session.
|
|
974
|
+
*/
|
|
975
|
+
export declare const AgentHistoryPageEvent: S.Struct<{
|
|
976
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
977
|
+
readonly session_id: S.optional<S.String>;
|
|
978
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
979
|
+
readonly seq: S.optional<S.Number>;
|
|
980
|
+
/** Epoch milliseconds on the daemon. */
|
|
981
|
+
readonly at: S.optional<S.Number>;
|
|
982
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
983
|
+
readonly command_id: S.optional<S.String>;
|
|
984
|
+
readonly type: S.Literal<"history.page">;
|
|
985
|
+
readonly before_cursor: S.optional<S.String>;
|
|
986
|
+
readonly has_more: S.Boolean;
|
|
987
|
+
readonly events: S.optional<S.$Array<S.Unknown>>;
|
|
988
|
+
}>;
|
|
989
|
+
export type TAgentHistoryPageEvent = S.Schema.Type<typeof AgentHistoryPageEvent>;
|
|
990
|
+
/** One daemon → consumer event line. */
|
|
991
|
+
export declare const AgentEvent: S.Union<readonly [S.Struct<{
|
|
992
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
993
|
+
readonly seq: S.optional<S.Number>;
|
|
994
|
+
/** Epoch milliseconds on the daemon. */
|
|
995
|
+
readonly at: S.optional<S.Number>;
|
|
996
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
997
|
+
readonly command_id: S.optional<S.String>;
|
|
998
|
+
readonly type: S.Literal<"session.started">;
|
|
999
|
+
readonly session_id: S.String;
|
|
1000
|
+
readonly engine: S.Literals<readonly ["claude", "codex"]>;
|
|
1001
|
+
readonly model: S.optional<S.String>;
|
|
1002
|
+
readonly cwd: S.optional<S.String>;
|
|
1003
|
+
/** True when this is an attach/resume of an existing engine session. */
|
|
1004
|
+
readonly resumed: S.optional<S.Boolean>;
|
|
1005
|
+
readonly skip_permissions: S.optional<S.Boolean>;
|
|
1006
|
+
}>, S.Struct<{
|
|
1007
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1008
|
+
readonly session_id: S.optional<S.String>;
|
|
1009
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1010
|
+
readonly seq: S.optional<S.Number>;
|
|
1011
|
+
/** Epoch milliseconds on the daemon. */
|
|
1012
|
+
readonly at: S.optional<S.Number>;
|
|
1013
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1014
|
+
readonly command_id: S.optional<S.String>;
|
|
1015
|
+
readonly type: S.Literal<"session.reset">;
|
|
1016
|
+
}>, S.Struct<{
|
|
1017
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1018
|
+
readonly session_id: S.optional<S.String>;
|
|
1019
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1020
|
+
readonly seq: S.optional<S.Number>;
|
|
1021
|
+
/** Epoch milliseconds on the daemon. */
|
|
1022
|
+
readonly at: S.optional<S.Number>;
|
|
1023
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1024
|
+
readonly command_id: S.optional<S.String>;
|
|
1025
|
+
readonly type: S.Literal<"session.configured">;
|
|
1026
|
+
readonly model: S.optional<S.String>;
|
|
1027
|
+
/**
|
|
1028
|
+
* The conversation's title, from the engine's own record (Claude's
|
|
1029
|
+
* `ai-title`). Optional: older daemons omit it, older consumers ignore it.
|
|
1030
|
+
*/
|
|
1031
|
+
readonly title: S.optional<S.String>;
|
|
1032
|
+
}>, S.Struct<{
|
|
1033
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1034
|
+
readonly seq: S.optional<S.Number>;
|
|
1035
|
+
/** Epoch milliseconds on the daemon. */
|
|
1036
|
+
readonly at: S.optional<S.Number>;
|
|
1037
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1038
|
+
readonly command_id: S.optional<S.String>;
|
|
1039
|
+
readonly type: S.Literal<"session.exited">;
|
|
1040
|
+
readonly session_id: S.String;
|
|
1041
|
+
readonly reason: S.Literals<readonly ["closed", "completed", "killed", "error"]>;
|
|
1042
|
+
readonly message: S.optional<S.String>;
|
|
1043
|
+
}>, S.Struct<{
|
|
1044
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1045
|
+
readonly session_id: S.optional<S.String>;
|
|
1046
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1047
|
+
readonly seq: S.optional<S.Number>;
|
|
1048
|
+
/** Epoch milliseconds on the daemon. */
|
|
1049
|
+
readonly at: S.optional<S.Number>;
|
|
1050
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1051
|
+
readonly command_id: S.optional<S.String>;
|
|
1052
|
+
readonly type: S.Literal<"turn.started">;
|
|
1053
|
+
readonly turn_id: S.String;
|
|
1054
|
+
readonly model: S.optional<S.String>;
|
|
1055
|
+
/**
|
|
1056
|
+
* The prompt text that opened the turn. Lets a consumer that attaches later
|
|
1057
|
+
* (replay) render the user's side of the transcript. Optional: older daemons
|
|
1058
|
+
* omit it and older consumers ignore it.
|
|
1059
|
+
*/
|
|
1060
|
+
readonly prompt: S.optional<S.String>;
|
|
1061
|
+
/**
|
|
1062
|
+
* Attachments saved for this turn (on-disk basename + mime + size). Optional:
|
|
1063
|
+
* terminal prompts and older daemons omit it; older consumers ignore it.
|
|
1064
|
+
*/
|
|
1065
|
+
readonly attachments: S.optional<S.$Array<S.Struct<{
|
|
1066
|
+
readonly name: S.String;
|
|
1067
|
+
readonly mime: S.String;
|
|
1068
|
+
readonly size: S.Number;
|
|
1069
|
+
}>>>;
|
|
1070
|
+
}>, S.Struct<{
|
|
1071
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1072
|
+
readonly session_id: S.optional<S.String>;
|
|
1073
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1074
|
+
readonly seq: S.optional<S.Number>;
|
|
1075
|
+
/** Epoch milliseconds on the daemon. */
|
|
1076
|
+
readonly at: S.optional<S.Number>;
|
|
1077
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1078
|
+
readonly command_id: S.optional<S.String>;
|
|
1079
|
+
readonly type: S.Literal<"queue.updated">;
|
|
1080
|
+
/**
|
|
1081
|
+
* Identified entries, oldest first. `string[]` remains valid on the browser
|
|
1082
|
+
* boundary for daemons predating this protocol shape.
|
|
1083
|
+
*/
|
|
1084
|
+
readonly prompts: S.$Array<S.Union<readonly [S.Struct<{
|
|
1085
|
+
/** Stable while the prompt is queued; used for a targeted cancel. */
|
|
1086
|
+
readonly id: S.String;
|
|
1087
|
+
/** Clipped preview, never the complete prompt. */
|
|
1088
|
+
readonly prompt: S.String;
|
|
1089
|
+
readonly attachment_count: S.Number;
|
|
1090
|
+
}>, S.String]>>;
|
|
1091
|
+
/** An interrupt pauses automatic draining until `resume_queue`. */
|
|
1092
|
+
readonly held: S.optional<S.Boolean>;
|
|
1093
|
+
}>, S.Struct<{
|
|
1094
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1095
|
+
readonly session_id: S.optional<S.String>;
|
|
1096
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1097
|
+
readonly seq: S.optional<S.Number>;
|
|
1098
|
+
/** Epoch milliseconds on the daemon. */
|
|
1099
|
+
readonly at: S.optional<S.Number>;
|
|
1100
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1101
|
+
readonly command_id: S.optional<S.String>;
|
|
1102
|
+
readonly type: S.Literal<"turn.completed">;
|
|
1103
|
+
readonly turn_id: S.String;
|
|
1104
|
+
readonly stop_reason: S.optional<S.String>;
|
|
1105
|
+
/**
|
|
1106
|
+
* What the turn cost, from the engine's own record: `input_tokens` is the
|
|
1107
|
+
* context the turn's last request carried, `output_tokens` the sum the turn
|
|
1108
|
+
* generated. Optional: older daemons omit it, older consumers ignore it.
|
|
1109
|
+
*/
|
|
1110
|
+
readonly usage: S.optional<S.Struct<{
|
|
1111
|
+
readonly input_tokens: S.Number;
|
|
1112
|
+
readonly output_tokens: S.Number;
|
|
1113
|
+
readonly cached_input_tokens: S.optional<S.Number>;
|
|
1114
|
+
readonly reasoning_tokens: S.optional<S.Number>;
|
|
1115
|
+
readonly total_tokens: S.optional<S.Number>;
|
|
1116
|
+
/** The model's context window, when known, for a fill gauge. */
|
|
1117
|
+
readonly context_window: S.optional<S.Number>;
|
|
1118
|
+
}>>;
|
|
1119
|
+
}>, S.Struct<{
|
|
1120
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1121
|
+
readonly session_id: S.optional<S.String>;
|
|
1122
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1123
|
+
readonly seq: S.optional<S.Number>;
|
|
1124
|
+
/** Epoch milliseconds on the daemon. */
|
|
1125
|
+
readonly at: S.optional<S.Number>;
|
|
1126
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1127
|
+
readonly command_id: S.optional<S.String>;
|
|
1128
|
+
readonly type: S.Literal<"turn.aborted">;
|
|
1129
|
+
readonly turn_id: S.String;
|
|
1130
|
+
readonly reason: S.Literals<readonly ["interrupted", "failed", "cancelled"]>;
|
|
1131
|
+
readonly message: S.optional<S.String>;
|
|
1132
|
+
}>, S.Struct<{
|
|
1133
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1134
|
+
readonly session_id: S.optional<S.String>;
|
|
1135
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1136
|
+
readonly seq: S.optional<S.Number>;
|
|
1137
|
+
/** Epoch milliseconds on the daemon. */
|
|
1138
|
+
readonly at: S.optional<S.Number>;
|
|
1139
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1140
|
+
readonly command_id: S.optional<S.String>;
|
|
1141
|
+
readonly turn_id: S.optional<S.String>;
|
|
1142
|
+
readonly item_id: S.String;
|
|
1143
|
+
readonly item: S.Union<readonly [S.Struct<{
|
|
1144
|
+
readonly kind: S.Literal<"assistant_message">;
|
|
1145
|
+
readonly text: S.String;
|
|
1146
|
+
}>, S.Struct<{
|
|
1147
|
+
readonly kind: S.Literal<"reasoning">;
|
|
1148
|
+
readonly text: S.String;
|
|
1149
|
+
}>, S.Struct<{
|
|
1150
|
+
readonly kind: S.Literal<"tool_call">;
|
|
1151
|
+
readonly tool_name: S.String;
|
|
1152
|
+
readonly title: S.optional<S.String>;
|
|
1153
|
+
/** The tool's input as the engine reported it (JSON). */
|
|
1154
|
+
readonly input: S.optional<S.Unknown>;
|
|
1155
|
+
readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
|
|
1156
|
+
/** Result text, truncated by the daemon to fit one line. */
|
|
1157
|
+
readonly output: S.optional<S.String>;
|
|
1158
|
+
readonly is_error: S.optional<S.Boolean>;
|
|
1159
|
+
/** The user (or a policy) refused the call; optional, additive. */
|
|
1160
|
+
readonly denied: S.optional<S.Boolean>;
|
|
1161
|
+
/** Wall time from call to result, when the engine recorded both. */
|
|
1162
|
+
readonly duration_ms: S.optional<S.Number>;
|
|
1163
|
+
/** A shell command's exit status, when the engine reported it. */
|
|
1164
|
+
readonly exit_code: S.optional<S.Number>;
|
|
1165
|
+
/**
|
|
1166
|
+
* A subagent launched in the background: the call's own result is only
|
|
1167
|
+
* the launch ack, so it stays in progress past its turn until the
|
|
1168
|
+
* subagent finishes. Optional, additive.
|
|
1169
|
+
*/
|
|
1170
|
+
readonly background: S.optional<S.Boolean>;
|
|
1171
|
+
}>, S.Struct<{
|
|
1172
|
+
readonly kind: S.Literal<"notice">;
|
|
1173
|
+
readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
|
|
1174
|
+
readonly text: S.optional<S.String>;
|
|
1175
|
+
/** The item the notice is about (a subagent's call). Optional, additive. */
|
|
1176
|
+
readonly ref_item_id: S.optional<S.String>;
|
|
1177
|
+
}>]>;
|
|
1178
|
+
/**
|
|
1179
|
+
* The tool call (a Task / Agent subagent) this item belongs to: a
|
|
1180
|
+
* subagent's own text and tool calls nest under the call that spawned it.
|
|
1181
|
+
* Absent → a top-level item of the turn. Older consumers ignore it.
|
|
1182
|
+
*/
|
|
1183
|
+
readonly parent_item_id: S.optional<S.String>;
|
|
1184
|
+
readonly type: S.Literal<"item.started">;
|
|
1185
|
+
}>, S.Struct<{
|
|
1186
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1187
|
+
readonly session_id: S.optional<S.String>;
|
|
1188
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1189
|
+
readonly seq: S.optional<S.Number>;
|
|
1190
|
+
/** Epoch milliseconds on the daemon. */
|
|
1191
|
+
readonly at: S.optional<S.Number>;
|
|
1192
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1193
|
+
readonly command_id: S.optional<S.String>;
|
|
1194
|
+
readonly turn_id: S.optional<S.String>;
|
|
1195
|
+
readonly item_id: S.String;
|
|
1196
|
+
readonly item: S.Union<readonly [S.Struct<{
|
|
1197
|
+
readonly kind: S.Literal<"assistant_message">;
|
|
1198
|
+
readonly text: S.String;
|
|
1199
|
+
}>, S.Struct<{
|
|
1200
|
+
readonly kind: S.Literal<"reasoning">;
|
|
1201
|
+
readonly text: S.String;
|
|
1202
|
+
}>, S.Struct<{
|
|
1203
|
+
readonly kind: S.Literal<"tool_call">;
|
|
1204
|
+
readonly tool_name: S.String;
|
|
1205
|
+
readonly title: S.optional<S.String>;
|
|
1206
|
+
/** The tool's input as the engine reported it (JSON). */
|
|
1207
|
+
readonly input: S.optional<S.Unknown>;
|
|
1208
|
+
readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
|
|
1209
|
+
/** Result text, truncated by the daemon to fit one line. */
|
|
1210
|
+
readonly output: S.optional<S.String>;
|
|
1211
|
+
readonly is_error: S.optional<S.Boolean>;
|
|
1212
|
+
/** The user (or a policy) refused the call; optional, additive. */
|
|
1213
|
+
readonly denied: S.optional<S.Boolean>;
|
|
1214
|
+
/** Wall time from call to result, when the engine recorded both. */
|
|
1215
|
+
readonly duration_ms: S.optional<S.Number>;
|
|
1216
|
+
/** A shell command's exit status, when the engine reported it. */
|
|
1217
|
+
readonly exit_code: S.optional<S.Number>;
|
|
1218
|
+
/**
|
|
1219
|
+
* A subagent launched in the background: the call's own result is only
|
|
1220
|
+
* the launch ack, so it stays in progress past its turn until the
|
|
1221
|
+
* subagent finishes. Optional, additive.
|
|
1222
|
+
*/
|
|
1223
|
+
readonly background: S.optional<S.Boolean>;
|
|
1224
|
+
}>, S.Struct<{
|
|
1225
|
+
readonly kind: S.Literal<"notice">;
|
|
1226
|
+
readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
|
|
1227
|
+
readonly text: S.optional<S.String>;
|
|
1228
|
+
/** The item the notice is about (a subagent's call). Optional, additive. */
|
|
1229
|
+
readonly ref_item_id: S.optional<S.String>;
|
|
1230
|
+
}>]>;
|
|
1231
|
+
/**
|
|
1232
|
+
* The tool call (a Task / Agent subagent) this item belongs to: a
|
|
1233
|
+
* subagent's own text and tool calls nest under the call that spawned it.
|
|
1234
|
+
* Absent → a top-level item of the turn. Older consumers ignore it.
|
|
1235
|
+
*/
|
|
1236
|
+
readonly parent_item_id: S.optional<S.String>;
|
|
1237
|
+
readonly type: S.Literal<"item.updated">;
|
|
1238
|
+
}>, S.Struct<{
|
|
1239
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1240
|
+
readonly session_id: S.optional<S.String>;
|
|
1241
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1242
|
+
readonly seq: S.optional<S.Number>;
|
|
1243
|
+
/** Epoch milliseconds on the daemon. */
|
|
1244
|
+
readonly at: S.optional<S.Number>;
|
|
1245
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1246
|
+
readonly command_id: S.optional<S.String>;
|
|
1247
|
+
readonly turn_id: S.optional<S.String>;
|
|
1248
|
+
readonly item_id: S.String;
|
|
1249
|
+
readonly item: S.Union<readonly [S.Struct<{
|
|
1250
|
+
readonly kind: S.Literal<"assistant_message">;
|
|
1251
|
+
readonly text: S.String;
|
|
1252
|
+
}>, S.Struct<{
|
|
1253
|
+
readonly kind: S.Literal<"reasoning">;
|
|
1254
|
+
readonly text: S.String;
|
|
1255
|
+
}>, S.Struct<{
|
|
1256
|
+
readonly kind: S.Literal<"tool_call">;
|
|
1257
|
+
readonly tool_name: S.String;
|
|
1258
|
+
readonly title: S.optional<S.String>;
|
|
1259
|
+
/** The tool's input as the engine reported it (JSON). */
|
|
1260
|
+
readonly input: S.optional<S.Unknown>;
|
|
1261
|
+
readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
|
|
1262
|
+
/** Result text, truncated by the daemon to fit one line. */
|
|
1263
|
+
readonly output: S.optional<S.String>;
|
|
1264
|
+
readonly is_error: S.optional<S.Boolean>;
|
|
1265
|
+
/** The user (or a policy) refused the call; optional, additive. */
|
|
1266
|
+
readonly denied: S.optional<S.Boolean>;
|
|
1267
|
+
/** Wall time from call to result, when the engine recorded both. */
|
|
1268
|
+
readonly duration_ms: S.optional<S.Number>;
|
|
1269
|
+
/** A shell command's exit status, when the engine reported it. */
|
|
1270
|
+
readonly exit_code: S.optional<S.Number>;
|
|
1271
|
+
/**
|
|
1272
|
+
* A subagent launched in the background: the call's own result is only
|
|
1273
|
+
* the launch ack, so it stays in progress past its turn until the
|
|
1274
|
+
* subagent finishes. Optional, additive.
|
|
1275
|
+
*/
|
|
1276
|
+
readonly background: S.optional<S.Boolean>;
|
|
1277
|
+
}>, S.Struct<{
|
|
1278
|
+
readonly kind: S.Literal<"notice">;
|
|
1279
|
+
readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
|
|
1280
|
+
readonly text: S.optional<S.String>;
|
|
1281
|
+
/** The item the notice is about (a subagent's call). Optional, additive. */
|
|
1282
|
+
readonly ref_item_id: S.optional<S.String>;
|
|
1283
|
+
}>]>;
|
|
1284
|
+
/**
|
|
1285
|
+
* The tool call (a Task / Agent subagent) this item belongs to: a
|
|
1286
|
+
* subagent's own text and tool calls nest under the call that spawned it.
|
|
1287
|
+
* Absent → a top-level item of the turn. Older consumers ignore it.
|
|
1288
|
+
*/
|
|
1289
|
+
readonly parent_item_id: S.optional<S.String>;
|
|
1290
|
+
readonly type: S.Literal<"item.completed">;
|
|
1291
|
+
}>, S.Struct<{
|
|
1292
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1293
|
+
readonly session_id: S.optional<S.String>;
|
|
1294
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1295
|
+
readonly seq: S.optional<S.Number>;
|
|
1296
|
+
/** Epoch milliseconds on the daemon. */
|
|
1297
|
+
readonly at: S.optional<S.Number>;
|
|
1298
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1299
|
+
readonly command_id: S.optional<S.String>;
|
|
1300
|
+
readonly type: S.Literal<"content.delta">;
|
|
1301
|
+
readonly turn_id: S.optional<S.String>;
|
|
1302
|
+
readonly item_id: S.String;
|
|
1303
|
+
readonly stream: S.Literals<readonly ["assistant_text", "reasoning_text", "tool_output"]>;
|
|
1304
|
+
readonly delta: S.String;
|
|
1305
|
+
}>, S.Struct<{
|
|
1306
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1307
|
+
readonly session_id: S.optional<S.String>;
|
|
1308
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1309
|
+
readonly seq: S.optional<S.Number>;
|
|
1310
|
+
/** Epoch milliseconds on the daemon. */
|
|
1311
|
+
readonly at: S.optional<S.Number>;
|
|
1312
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1313
|
+
readonly command_id: S.optional<S.String>;
|
|
1314
|
+
readonly type: S.Literal<"request.opened">;
|
|
1315
|
+
readonly request_id: S.String;
|
|
1316
|
+
readonly turn_id: S.optional<S.String>;
|
|
1317
|
+
readonly item_id: S.optional<S.String>;
|
|
1318
|
+
readonly request_kind: S.Literals<readonly ["command", "file_change", "tool", "other"]>;
|
|
1319
|
+
readonly title: S.optional<S.String>;
|
|
1320
|
+
readonly detail: S.optional<S.String>;
|
|
1321
|
+
readonly input: S.optional<S.Unknown>;
|
|
1322
|
+
}>, S.Struct<{
|
|
1323
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1324
|
+
readonly session_id: S.optional<S.String>;
|
|
1325
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1326
|
+
readonly seq: S.optional<S.Number>;
|
|
1327
|
+
/** Epoch milliseconds on the daemon. */
|
|
1328
|
+
readonly at: S.optional<S.Number>;
|
|
1329
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1330
|
+
readonly command_id: S.optional<S.String>;
|
|
1331
|
+
readonly type: S.Literal<"request.resolved">;
|
|
1332
|
+
readonly request_id: S.String;
|
|
1333
|
+
readonly decision: S.Literals<readonly ["accept", "accept_for_session", "decline", "cancel"]>;
|
|
1334
|
+
}>, S.Struct<{
|
|
1335
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1336
|
+
readonly session_id: S.optional<S.String>;
|
|
1337
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1338
|
+
readonly seq: S.optional<S.Number>;
|
|
1339
|
+
/** Epoch milliseconds on the daemon. */
|
|
1340
|
+
readonly at: S.optional<S.Number>;
|
|
1341
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1342
|
+
readonly command_id: S.optional<S.String>;
|
|
1343
|
+
readonly type: S.Literal<"user-input.requested">;
|
|
1344
|
+
readonly request_id: S.String;
|
|
1345
|
+
readonly turn_id: S.optional<S.String>;
|
|
1346
|
+
readonly questions: S.$Array<S.Struct<{
|
|
1347
|
+
readonly id: S.String;
|
|
1348
|
+
readonly header: S.optional<S.String>;
|
|
1349
|
+
readonly question: S.String;
|
|
1350
|
+
readonly options: S.optional<S.$Array<S.Struct<{
|
|
1351
|
+
readonly label: S.String;
|
|
1352
|
+
readonly description: S.optional<S.String>;
|
|
1353
|
+
}>>>;
|
|
1354
|
+
readonly multi_select: S.optional<S.Boolean>;
|
|
1355
|
+
}>>;
|
|
1356
|
+
}>, S.Struct<{
|
|
1357
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1358
|
+
readonly session_id: S.optional<S.String>;
|
|
1359
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1360
|
+
readonly seq: S.optional<S.Number>;
|
|
1361
|
+
/** Epoch milliseconds on the daemon. */
|
|
1362
|
+
readonly at: S.optional<S.Number>;
|
|
1363
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1364
|
+
readonly command_id: S.optional<S.String>;
|
|
1365
|
+
readonly type: S.Literal<"user-input.resolved">;
|
|
1366
|
+
readonly request_id: S.String;
|
|
1367
|
+
readonly answers: S.$Record<S.String, S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
1368
|
+
}>, S.Struct<{
|
|
1369
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1370
|
+
readonly session_id: S.optional<S.String>;
|
|
1371
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1372
|
+
readonly seq: S.optional<S.Number>;
|
|
1373
|
+
/** Epoch milliseconds on the daemon. */
|
|
1374
|
+
readonly at: S.optional<S.Number>;
|
|
1375
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1376
|
+
readonly command_id: S.optional<S.String>;
|
|
1377
|
+
readonly type: S.Literal<"thread.token-usage.updated">;
|
|
1378
|
+
readonly usage: S.Struct<{
|
|
1379
|
+
readonly input_tokens: S.Number;
|
|
1380
|
+
readonly output_tokens: S.Number;
|
|
1381
|
+
readonly cached_input_tokens: S.optional<S.Number>;
|
|
1382
|
+
readonly reasoning_tokens: S.optional<S.Number>;
|
|
1383
|
+
readonly total_tokens: S.optional<S.Number>;
|
|
1384
|
+
/** The model's context window, when known, for a fill gauge. */
|
|
1385
|
+
readonly context_window: S.optional<S.Number>;
|
|
1386
|
+
}>;
|
|
1387
|
+
}>, S.Struct<{
|
|
1388
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1389
|
+
readonly session_id: S.optional<S.String>;
|
|
1390
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1391
|
+
readonly seq: S.optional<S.Number>;
|
|
1392
|
+
/** Epoch milliseconds on the daemon. */
|
|
1393
|
+
readonly at: S.optional<S.Number>;
|
|
1394
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1395
|
+
readonly command_id: S.optional<S.String>;
|
|
1396
|
+
readonly type: S.Literal<"runtime.warning">;
|
|
1397
|
+
readonly code: S.optional<S.String>;
|
|
1398
|
+
readonly message: S.String;
|
|
1399
|
+
}>, S.Struct<{
|
|
1400
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1401
|
+
readonly session_id: S.optional<S.String>;
|
|
1402
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1403
|
+
readonly seq: S.optional<S.Number>;
|
|
1404
|
+
/** Epoch milliseconds on the daemon. */
|
|
1405
|
+
readonly at: S.optional<S.Number>;
|
|
1406
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1407
|
+
readonly command_id: S.optional<S.String>;
|
|
1408
|
+
readonly type: S.Literal<"runtime.error">;
|
|
1409
|
+
readonly code: S.optional<S.String>;
|
|
1410
|
+
readonly message: S.String;
|
|
1411
|
+
/** True when the session cannot continue (a `session.exited` follows). */
|
|
1412
|
+
readonly fatal: S.optional<S.Boolean>;
|
|
1413
|
+
}>, S.Struct<{
|
|
1414
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1415
|
+
readonly session_id: S.optional<S.String>;
|
|
1416
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1417
|
+
readonly seq: S.optional<S.Number>;
|
|
1418
|
+
/** Epoch milliseconds on the daemon. */
|
|
1419
|
+
readonly at: S.optional<S.Number>;
|
|
1420
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1421
|
+
readonly command_id: S.optional<S.String>;
|
|
1422
|
+
readonly type: S.Literal<"attachment.data">;
|
|
1423
|
+
readonly name: S.String;
|
|
1424
|
+
readonly mime: S.String;
|
|
1425
|
+
/** Total decoded byte length of the file. */
|
|
1426
|
+
readonly size: S.Number;
|
|
1427
|
+
/** Decoded-byte offset of this chunk within the file. */
|
|
1428
|
+
readonly offset: S.Number;
|
|
1429
|
+
/** Base64 of this chunk. */
|
|
1430
|
+
readonly data: S.String;
|
|
1431
|
+
/** True when this is the last chunk. */
|
|
1432
|
+
readonly done: S.Boolean;
|
|
1433
|
+
}>, S.Struct<{
|
|
1434
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1435
|
+
readonly seq: S.optional<S.Number>;
|
|
1436
|
+
/** Epoch milliseconds on the daemon. */
|
|
1437
|
+
readonly at: S.optional<S.Number>;
|
|
1438
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1439
|
+
readonly command_id: S.optional<S.String>;
|
|
1440
|
+
readonly type: S.Literal<"session.deleted">;
|
|
1441
|
+
readonly session_id: S.String;
|
|
1442
|
+
}>, S.Struct<{
|
|
1443
|
+
/** The session this event belongs to (absent only before one exists). */
|
|
1444
|
+
readonly session_id: S.optional<S.String>;
|
|
1445
|
+
/** Daemon-assigned ordinal, monotonically increasing per session. */
|
|
1446
|
+
readonly seq: S.optional<S.Number>;
|
|
1447
|
+
/** Epoch milliseconds on the daemon. */
|
|
1448
|
+
readonly at: S.optional<S.Number>;
|
|
1449
|
+
/** Echo of the {@link AgentCommand} `id` this event answers, if any. */
|
|
1450
|
+
readonly command_id: S.optional<S.String>;
|
|
1451
|
+
readonly type: S.Literal<"history.page">;
|
|
1452
|
+
readonly before_cursor: S.optional<S.String>;
|
|
1453
|
+
readonly has_more: S.Boolean;
|
|
1454
|
+
readonly events: S.optional<S.$Array<S.Unknown>>;
|
|
1455
|
+
}>]>;
|
|
1456
|
+
export type TAgentEvent = S.Schema.Type<typeof AgentEvent>;
|
|
1457
|
+
export type TAgentEventType = TAgentEvent["type"];
|
|
1458
|
+
/** Narrow {@link TAgentEvent} to one `type`. */
|
|
1459
|
+
export type TAgentEventOf<K extends TAgentEventType> = Extract<TAgentEvent, {
|
|
1460
|
+
readonly type: K;
|
|
1461
|
+
}>;
|
|
1462
|
+
/** Decode an already-parsed JSON value as a command, or null. */
|
|
1463
|
+
export declare const parseAgentCommand: (value: unknown) => TAgentCommand | null;
|
|
1464
|
+
/** Decode an already-parsed JSON value as an event, or null (unknown types too). */
|
|
1465
|
+
export declare const parseAgentEvent: (value: unknown) => TAgentEvent | null;
|
|
1466
|
+
/**
|
|
1467
|
+
* JSON-encode one value as a newline-terminated line. Null when it does not
|
|
1468
|
+
* serialize or exceeds {@link AGENT_MAX_LINE_BYTES} — the caller decides
|
|
1469
|
+
* (truncate, or emit a `runtime.warning`); a truncated line would desync the
|
|
1470
|
+
* framing.
|
|
1471
|
+
*/
|
|
1472
|
+
export declare const encodeAgentLine: (value: unknown) => Uint8Array | null;
|
|
1473
|
+
/** Decode one line's bytes (without `\n`) into JSON, or `undefined`. */
|
|
1474
|
+
export declare const decodeAgentLine: (line: Uint8Array) => unknown;
|
|
1475
|
+
export type TAgentLineSplitter = {
|
|
1476
|
+
/**
|
|
1477
|
+
* Feed one chunk; returns the complete lines it finished (without `\n`), or
|
|
1478
|
+
* null once a line exceeds `maxLineBytes` (the splitter stays failed).
|
|
1479
|
+
*/
|
|
1480
|
+
readonly push: (chunk: Uint8Array) => readonly Uint8Array[] | null;
|
|
1481
|
+
};
|
|
1482
|
+
/**
|
|
1483
|
+
* Stateful NDJSON splitter. Partial lines are kept as a chunk list and joined
|
|
1484
|
+
* once, when their newline arrives, so a multi-megabyte line costs one copy
|
|
1485
|
+
* rather than one per DATA frame.
|
|
1486
|
+
*/
|
|
1487
|
+
export declare const createAgentLineSplitter: (maxLineBytes?: number) => TAgentLineSplitter;
|