yepanywhere 0.5.2 → 0.6.0
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 +21 -5
- package/bundled/@yep-anywhere/shared/dist/agent-context.d.ts +9 -0
- package/bundled/@yep-anywhere/shared/dist/agent-context.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/agent-context.js +18 -0
- package/bundled/@yep-anywhere/shared/dist/agent-context.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/app-types.d.ts +104 -1
- package/bundled/@yep-anywhere/shared/dist/app-types.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/app-types.js +4 -0
- package/bundled/@yep-anywhere/shared/dist/app-types.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/binary-framing.d.ts +4 -1
- package/bundled/@yep-anywhere/shared/dist/binary-framing.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/binary-framing.js +8 -3
- package/bundled/@yep-anywhere/shared/dist/binary-framing.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/AssistantEntrySchema.d.ts +4 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/AssistantEntrySchema.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/BaseEntrySchema.d.ts +4 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/BaseEntrySchema.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/BaseEntrySchema.js +7 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/BaseEntrySchema.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/ProgressEntrySchema.d.ts +4 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/ProgressEntrySchema.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SystemEntrySchema.d.ts +64 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SystemEntrySchema.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SystemEntrySchema.js +9 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SystemEntrySchema.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/UserEntrySchema.d.ts +4 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/UserEntrySchema.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/guards.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/guards.js +45 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/guards.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/index.d.ts +144 -2
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/index.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.d.ts +6 -4
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.js +8 -1
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/codex-schema/index.d.ts +3 -2
- package/bundled/@yep-anywhere/shared/dist/codex-schema/index.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/codex-schema/index.js +3 -2
- package/bundled/@yep-anywhere/shared/dist/codex-schema/index.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/codex-schema/session.d.ts +87 -3
- package/bundled/@yep-anywhere/shared/dist/codex-schema/session.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/codex-schema/session.js +39 -1
- package/bundled/@yep-anywhere/shared/dist/codex-schema/session.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/dag.d.ts +31 -11
- package/bundled/@yep-anywhere/shared/dist/dag.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/dag.js +77 -33
- package/bundled/@yep-anywhere/shared/dist/dag.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/git-status.d.ts +70 -1
- package/bundled/@yep-anywhere/shared/dist/git-status.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/git-status.js +6 -1
- package/bundled/@yep-anywhere/shared/dist/git-status.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/ideMetadata.js +1 -1
- package/bundled/@yep-anywhere/shared/dist/ideMetadata.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/index.d.ts +20 -11
- package/bundled/@yep-anywhere/shared/dist/index.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/index.js +8 -3
- package/bundled/@yep-anywhere/shared/dist/index.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/local-resource.d.ts +1 -0
- package/bundled/@yep-anywhere/shared/dist/local-resource.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/local-resource.js +4 -0
- package/bundled/@yep-anywhere/shared/dist/local-resource.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/events.d.ts +136 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/events.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/events.js +65 -3
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/events.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/types.d.ts +1 -1
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/types.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/project-queue.d.ts +153 -0
- package/bundled/@yep-anywhere/shared/dist/project-queue.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/project-queue.js +8 -0
- package/bundled/@yep-anywhere/shared/dist/project-queue.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/relay-protocol.d.ts +26 -2
- package/bundled/@yep-anywhere/shared/dist/relay-protocol.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/relay-protocol.js +33 -0
- package/bundled/@yep-anywhere/shared/dist/relay-protocol.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/relay.d.ts +45 -5
- package/bundled/@yep-anywhere/shared/dist/relay.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/relay.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/safe-restart.d.ts +25 -0
- package/bundled/@yep-anywhere/shared/dist/safe-restart.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/safe-restart.js +2 -0
- package/bundled/@yep-anywhere/shared/dist/safe-restart.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/session/SessionView.d.ts +2 -2
- package/bundled/@yep-anywhere/shared/dist/session/SessionView.js +3 -3
- package/bundled/@yep-anywhere/shared/dist/session/SessionView.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/session/UnifiedSession.d.ts +10 -0
- package/bundled/@yep-anywhere/shared/dist/session/UnifiedSession.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/session-liveness.d.ts +18 -0
- package/bundled/@yep-anywhere/shared/dist/session-liveness.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/types.d.ts +253 -8
- package/bundled/@yep-anywhere/shared/dist/types.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/types.js +48 -5
- package/bundled/@yep-anywhere/shared/dist/types.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/upload.d.ts +34 -2
- package/bundled/@yep-anywhere/shared/dist/upload.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/user-message-metadata.d.ts +47 -0
- package/bundled/@yep-anywhere/shared/dist/user-message-metadata.d.ts.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/user-message-metadata.js +59 -1
- package/bundled/@yep-anywhere/shared/dist/user-message-metadata.js.map +1 -1
- package/bundled/@yep-anywhere/shared/dist/workstreams.d.ts +54 -0
- package/bundled/@yep-anywhere/shared/dist/workstreams.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/workstreams.js +8 -0
- package/bundled/@yep-anywhere/shared/dist/workstreams.js.map +1 -0
- package/bundled/@yep-anywhere/shared/package.json +1 -1
- package/client-dist/assets/alegreya-sans-latin-400-italic-BQIUBrX-.woff2 +0 -0
- package/client-dist/assets/alegreya-sans-latin-400-normal-BxeZdXas.woff2 +0 -0
- package/client-dist/assets/alegreya-sans-latin-500-normal-uodOEoAl.woff2 +0 -0
- package/client-dist/assets/alegreya-sans-latin-700-normal-DFYOGfC8.woff2 +0 -0
- package/client-dist/assets/de-CHMDbVD5.js +6 -0
- package/client-dist/assets/es-CK8MPF_C.js +6 -0
- package/client-dist/assets/fira-mono-latin-400-normal-DVTTRLHv.woff2 +0 -0
- package/client-dist/assets/fira-mono-latin-ext-400-normal-B2gPvaNr.woff2 +0 -0
- package/client-dist/assets/fira-mono-symbols2-400-normal-C6JptOil.woff2 +0 -0
- package/client-dist/assets/fr-49PXQiUL.js +6 -0
- package/client-dist/assets/index-B-09fVut.js +557 -0
- package/client-dist/assets/index-uJnfvD1f.css +1 -0
- package/client-dist/assets/inter-latin-400-italic-D1l0FflY.woff2 +0 -0
- package/client-dist/assets/inter-latin-400-normal-C38fXH4l.woff2 +0 -0
- package/client-dist/assets/inter-latin-500-normal-Cerq10X2.woff2 +0 -0
- package/client-dist/assets/inter-latin-700-normal-Yt3aPRUw.woff2 +0 -0
- package/client-dist/assets/ja-CrCGPmoH.js +6 -0
- package/client-dist/assets/zh-CN-AFJxv5ke.js +6 -0
- package/client-dist/index.html +3 -3
- package/client-dist/sw.js +96 -9
- package/dist/app.d.ts +25 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +350 -35
- package/dist/app.js.map +1 -1
- package/dist/augments/augment-generator.d.ts +1 -1
- package/dist/augments/augment-generator.d.ts.map +1 -1
- package/dist/augments/augment-generator.js +2 -2
- package/dist/augments/augment-generator.js.map +1 -1
- package/dist/augments/markdown-augments.d.ts +1 -1
- package/dist/augments/markdown-augments.d.ts.map +1 -1
- package/dist/augments/markdown-augments.js +5 -5
- package/dist/augments/markdown-augments.js.map +1 -1
- package/dist/augments/safe-markdown.d.ts +10 -0
- package/dist/augments/safe-markdown.d.ts.map +1 -1
- package/dist/augments/safe-markdown.js +146 -3
- package/dist/augments/safe-markdown.js.map +1 -1
- package/dist/augments/stream-augmenter.d.ts +3 -0
- package/dist/augments/stream-augmenter.d.ts.map +1 -1
- package/dist/augments/stream-augmenter.js +6 -3
- package/dist/augments/stream-augmenter.js.map +1 -1
- package/dist/augments/stream-coordinator.d.ts +5 -1
- package/dist/augments/stream-coordinator.d.ts.map +1 -1
- package/dist/augments/stream-coordinator.js +6 -4
- package/dist/augments/stream-coordinator.js.map +1 -1
- package/dist/augments/task-list-augments.d.ts +27 -0
- package/dist/augments/task-list-augments.d.ts.map +1 -0
- package/dist/augments/task-list-augments.js +360 -0
- package/dist/augments/task-list-augments.js.map +1 -0
- package/dist/cli.d.ts +1 -17
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +22 -8
- package/dist/cli.js.map +1 -1
- package/dist/codex/correlationDebugLogger.d.ts.map +1 -1
- package/dist/codex/correlationDebugLogger.js +36 -8
- package/dist/codex/correlationDebugLogger.js.map +1 -1
- package/dist/codex/normalization.d.ts +1 -0
- package/dist/codex/normalization.d.ts.map +1 -1
- package/dist/codex/normalization.js +262 -7
- package/dist/codex/normalization.js.map +1 -1
- package/dist/config.d.ts +49 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +55 -14
- package/dist/config.js.map +1 -1
- package/dist/defaults.d.ts +3 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.js +3 -0
- package/dist/defaults.js.map +1 -0
- package/dist/device/DeviceBridgeService.js +1 -1
- package/dist/device/DeviceBridgeService.js.map +1 -1
- package/dist/envSettings.d.ts +64 -0
- package/dist/envSettings.d.ts.map +1 -0
- package/dist/envSettings.js +553 -0
- package/dist/envSettings.js.map +1 -0
- package/dist/frontend/static.d.ts.map +1 -1
- package/dist/frontend/static.js +3 -1
- package/dist/frontend/static.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +190 -14
- package/dist/index.js.map +1 -1
- package/dist/indexes/SessionDiscoveryIndex.d.ts +78 -0
- package/dist/indexes/SessionDiscoveryIndex.d.ts.map +1 -0
- package/dist/indexes/SessionDiscoveryIndex.js +223 -0
- package/dist/indexes/SessionDiscoveryIndex.js.map +1 -0
- package/dist/indexes/SessionIndexService.d.ts +114 -1
- package/dist/indexes/SessionIndexService.d.ts.map +1 -1
- package/dist/indexes/SessionIndexService.js +875 -105
- package/dist/indexes/SessionIndexService.js.map +1 -1
- package/dist/indexes/index.d.ts +2 -1
- package/dist/indexes/index.d.ts.map +1 -1
- package/dist/indexes/index.js +1 -0
- package/dist/indexes/index.js.map +1 -1
- package/dist/indexes/types.d.ts +26 -0
- package/dist/indexes/types.d.ts.map +1 -1
- package/dist/logging/logger.d.ts.map +1 -1
- package/dist/logging/logger.js +2 -3
- package/dist/logging/logger.js.map +1 -1
- package/dist/maintenance/server.d.ts.map +1 -1
- package/dist/maintenance/server.js +8 -11
- package/dist/maintenance/server.js.map +1 -1
- package/dist/metadata/ProjectMetadataService.d.ts +7 -0
- package/dist/metadata/ProjectMetadataService.d.ts.map +1 -1
- package/dist/metadata/ProjectMetadataService.js +63 -19
- package/dist/metadata/ProjectMetadataService.js.map +1 -1
- package/dist/metadata/SessionMetadataService.d.ts +82 -3
- package/dist/metadata/SessionMetadataService.d.ts.map +1 -1
- package/dist/metadata/SessionMetadataService.js +233 -17
- package/dist/metadata/SessionMetadataService.js.map +1 -1
- package/dist/middleware/file-access.d.ts +66 -0
- package/dist/middleware/file-access.d.ts.map +1 -0
- package/dist/middleware/file-access.js +112 -0
- package/dist/middleware/file-access.js.map +1 -0
- package/dist/projects/codex-scanner.d.ts +28 -1
- package/dist/projects/codex-scanner.d.ts.map +1 -1
- package/dist/projects/codex-scanner.js +149 -39
- package/dist/projects/codex-scanner.js.map +1 -1
- package/dist/projects/gemini-scanner.d.ts.map +1 -1
- package/dist/projects/gemini-scanner.js +59 -6
- package/dist/projects/gemini-scanner.js.map +1 -1
- package/dist/projects/paths.d.ts +15 -1
- package/dist/projects/paths.d.ts.map +1 -1
- package/dist/projects/paths.js +69 -23
- package/dist/projects/paths.js.map +1 -1
- package/dist/projects/scanner.d.ts +5 -0
- package/dist/projects/scanner.d.ts.map +1 -1
- package/dist/projects/scanner.js +136 -28
- package/dist/projects/scanner.js.map +1 -1
- package/dist/push/InactivityPushNotifier.d.ts +61 -0
- package/dist/push/InactivityPushNotifier.d.ts.map +1 -0
- package/dist/push/InactivityPushNotifier.js +305 -0
- package/dist/push/InactivityPushNotifier.js.map +1 -0
- package/dist/push/PushNotifier.d.ts.map +1 -1
- package/dist/push/PushNotifier.js.map +1 -1
- package/dist/push/PushService.d.ts +7 -4
- package/dist/push/PushService.d.ts.map +1 -1
- package/dist/push/PushService.js +27 -7
- package/dist/push/PushService.js.map +1 -1
- package/dist/push/index.d.ts +2 -1
- package/dist/push/index.d.ts.map +1 -1
- package/dist/push/index.js +1 -0
- package/dist/push/index.js.map +1 -1
- package/dist/push/routes.d.ts.map +1 -1
- package/dist/push/routes.js +28 -1
- package/dist/push/routes.js.map +1 -1
- package/dist/push/types.d.ts +21 -3
- package/dist/push/types.d.ts.map +1 -1
- package/dist/push/types.js +2 -0
- package/dist/push/types.js.map +1 -1
- package/dist/routes/dev.d.ts +2 -0
- package/dist/routes/dev.d.ts.map +1 -1
- package/dist/routes/dev.js +25 -0
- package/dist/routes/dev.js.map +1 -1
- package/dist/routes/env-settings.d.ts +20 -0
- package/dist/routes/env-settings.d.ts.map +1 -0
- package/dist/routes/env-settings.js +25 -0
- package/dist/routes/env-settings.js.map +1 -0
- package/dist/routes/files.d.ts +9 -0
- package/dist/routes/files.d.ts.map +1 -1
- package/dist/routes/files.js +98 -10
- package/dist/routes/files.js.map +1 -1
- package/dist/routes/git-status.d.ts.map +1 -1
- package/dist/routes/git-status.js +621 -23
- package/dist/routes/git-status.js.map +1 -1
- package/dist/routes/global-sessions.d.ts +11 -1
- package/dist/routes/global-sessions.d.ts.map +1 -1
- package/dist/routes/global-sessions.js +53 -33
- package/dist/routes/global-sessions.js.map +1 -1
- package/dist/routes/inbox.d.ts +10 -1
- package/dist/routes/inbox.d.ts.map +1 -1
- package/dist/routes/inbox.js +30 -3
- package/dist/routes/inbox.js.map +1 -1
- package/dist/routes/local-file.d.ts +6 -2
- package/dist/routes/local-file.d.ts.map +1 -1
- package/dist/routes/local-file.js +13 -4
- package/dist/routes/local-file.js.map +1 -1
- package/dist/routes/local-image.d.ts +2 -1
- package/dist/routes/local-image.d.ts.map +1 -1
- package/dist/routes/local-image.js.map +1 -1
- package/dist/routes/local-resource-policy.d.ts +7 -1
- package/dist/routes/local-resource-policy.d.ts.map +1 -1
- package/dist/routes/local-resource-policy.js +0 -0
- package/dist/routes/local-resource-policy.js.map +1 -1
- package/dist/routes/processes.d.ts.map +1 -1
- package/dist/routes/processes.js +49 -11
- package/dist/routes/processes.js.map +1 -1
- package/dist/routes/project-queue-response.d.ts +26 -0
- package/dist/routes/project-queue-response.d.ts.map +1 -0
- package/dist/routes/project-queue-response.js +188 -0
- package/dist/routes/project-queue-response.js.map +1 -0
- package/dist/routes/project-queue.d.ts +5 -0
- package/dist/routes/project-queue.d.ts.map +1 -0
- package/dist/routes/project-queue.js +219 -0
- package/dist/routes/project-queue.js.map +1 -0
- package/dist/routes/projects.d.ts +6 -0
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +116 -28
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/providers.d.ts +5 -0
- package/dist/routes/providers.d.ts.map +1 -1
- package/dist/routes/providers.js +52 -33
- package/dist/routes/providers.js.map +1 -1
- package/dist/routes/public-shares.d.ts.map +1 -1
- package/dist/routes/public-shares.js +46 -17
- package/dist/routes/public-shares.js.map +1 -1
- package/dist/routes/recents.d.ts +3 -0
- package/dist/routes/recents.d.ts.map +1 -1
- package/dist/routes/recents.js +3 -1
- package/dist/routes/recents.js.map +1 -1
- package/dist/routes/server-admin.d.ts +9 -0
- package/dist/routes/server-admin.d.ts.map +1 -1
- package/dist/routes/server-admin.js +45 -7
- package/dist/routes/server-admin.js.map +1 -1
- package/dist/routes/session-claude-resume-guard.d.ts +16 -0
- package/dist/routes/session-claude-resume-guard.d.ts.map +1 -0
- package/dist/routes/session-claude-resume-guard.js +50 -0
- package/dist/routes/session-claude-resume-guard.js.map +1 -0
- package/dist/routes/session-compact-thresholds.d.ts +22 -0
- package/dist/routes/session-compact-thresholds.d.ts.map +1 -0
- package/dist/routes/session-compact-thresholds.js +35 -0
- package/dist/routes/session-compact-thresholds.js.map +1 -0
- package/dist/routes/session-index.d.ts +7 -0
- package/dist/routes/session-index.d.ts.map +1 -0
- package/dist/routes/session-index.js +9 -0
- package/dist/routes/session-index.js.map +1 -0
- package/dist/routes/session-list-options.d.ts +1 -1
- package/dist/routes/session-list-options.d.ts.map +1 -1
- package/dist/routes/session-list-options.js +1 -1
- package/dist/routes/session-list-options.js.map +1 -1
- package/dist/routes/session-request-helpers.d.ts +31 -0
- package/dist/routes/session-request-helpers.d.ts.map +1 -0
- package/dist/routes/session-request-helpers.js +212 -0
- package/dist/routes/session-request-helpers.js.map +1 -0
- package/dist/routes/sessions.d.ts +14 -1
- package/dist/routes/sessions.d.ts.map +1 -1
- package/dist/routes/sessions.js +2141 -551
- package/dist/routes/sessions.js.map +1 -1
- package/dist/routes/settings.d.ts +7 -1
- package/dist/routes/settings.d.ts.map +1 -1
- package/dist/routes/settings.js +771 -25
- package/dist/routes/settings.js.map +1 -1
- package/dist/routes/speech.d.ts +24 -2
- package/dist/routes/speech.d.ts.map +1 -1
- package/dist/routes/speech.js +539 -10
- package/dist/routes/speech.js.map +1 -1
- package/dist/routes/supervisor-queue.d.ts +6 -0
- package/dist/routes/supervisor-queue.d.ts.map +1 -0
- package/dist/routes/supervisor-queue.js +35 -0
- package/dist/routes/supervisor-queue.js.map +1 -0
- package/dist/routes/upload.d.ts +2 -0
- package/dist/routes/upload.d.ts.map +1 -1
- package/dist/routes/upload.js +190 -38
- package/dist/routes/upload.js.map +1 -1
- package/dist/routes/version.d.ts +18 -1
- package/dist/routes/version.d.ts.map +1 -1
- package/dist/routes/version.js +22 -1
- package/dist/routes/version.js.map +1 -1
- package/dist/routes/workstreams.d.ts +11 -0
- package/dist/routes/workstreams.d.ts.map +1 -0
- package/dist/routes/workstreams.js +144 -0
- package/dist/routes/workstreams.js.map +1 -0
- package/dist/routes/ws-message-router.d.ts +10 -1
- package/dist/routes/ws-message-router.d.ts.map +1 -1
- package/dist/routes/ws-message-router.js +43 -4
- package/dist/routes/ws-message-router.js.map +1 -1
- package/dist/routes/ws-relay-handlers.d.ts +27 -5
- package/dist/routes/ws-relay-handlers.d.ts.map +1 -1
- package/dist/routes/ws-relay-handlers.js +177 -19
- package/dist/routes/ws-relay-handlers.js.map +1 -1
- package/dist/routes/ws-relay.d.ts +19 -0
- package/dist/routes/ws-relay.d.ts.map +1 -1
- package/dist/routes/ws-relay.js +21 -7
- package/dist/routes/ws-relay.js.map +1 -1
- package/dist/sdk/cli-detection.d.ts +1 -1
- package/dist/sdk/cli-detection.d.ts.map +1 -1
- package/dist/sdk/cli-detection.js +47 -7
- package/dist/sdk/cli-detection.js.map +1 -1
- package/dist/sdk/messageLogger.d.ts.map +1 -1
- package/dist/sdk/messageLogger.js +38 -10
- package/dist/sdk/messageLogger.js.map +1 -1
- package/dist/sdk/messageQueue.d.ts.map +1 -1
- package/dist/sdk/messageQueue.js +26 -0
- package/dist/sdk/messageQueue.js.map +1 -1
- package/dist/sdk/providers/__mocks__/grok.d.ts +1 -1
- package/dist/sdk/providers/__mocks__/grok.d.ts.map +1 -1
- package/dist/sdk/providers/__mocks__/grok.js +1 -1
- package/dist/sdk/providers/__mocks__/grok.js.map +1 -1
- package/dist/sdk/providers/agentctl-session-env.d.ts +8 -0
- package/dist/sdk/providers/agentctl-session-env.d.ts.map +1 -0
- package/dist/sdk/providers/agentctl-session-env.js +52 -0
- package/dist/sdk/providers/agentctl-session-env.js.map +1 -0
- package/dist/sdk/providers/claude-ollama.d.ts +2 -1
- package/dist/sdk/providers/claude-ollama.d.ts.map +1 -1
- package/dist/sdk/providers/claude-ollama.js +1 -0
- package/dist/sdk/providers/claude-ollama.js.map +1 -1
- package/dist/sdk/providers/claude-retention.d.ts +19 -0
- package/dist/sdk/providers/claude-retention.d.ts.map +1 -0
- package/dist/sdk/providers/claude-retention.js +169 -0
- package/dist/sdk/providers/claude-retention.js.map +1 -0
- package/dist/sdk/providers/claude.d.ts +52 -5
- package/dist/sdk/providers/claude.d.ts.map +1 -1
- package/dist/sdk/providers/claude.js +593 -71
- package/dist/sdk/providers/claude.js.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/AgentMessageInputContent.d.ts +8 -0
- package/dist/sdk/providers/codex-protocol/generated/AgentMessageInputContent.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/AgentMessageInputContent.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/AgentMessageInputContent.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/InternalChatMessageMetadataPassthrough.d.ts +10 -0
- package/dist/sdk/providers/codex-protocol/generated/InternalChatMessageMetadataPassthrough.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/InternalChatMessageMetadataPassthrough.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/InternalChatMessageMetadataPassthrough.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/LegacyAppPathString.d.ts +23 -0
- package/dist/sdk/providers/codex-protocol/generated/LegacyAppPathString.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/LegacyAppPathString.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/LegacyAppPathString.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/MultiAgentMode.d.ts +8 -0
- package/dist/sdk/providers/codex-protocol/generated/MultiAgentMode.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/MultiAgentMode.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/MultiAgentMode.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/ReasoningEffort.d.ts +1 -1
- package/dist/sdk/providers/codex-protocol/generated/ReasoningEffort.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/ResponseItem.d.ts +38 -1
- package/dist/sdk/providers/codex-protocol/generated/ResponseItem.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/AdditionalFileSystemPermissions.d.ts +3 -3
- package/dist/sdk/providers/codex-protocol/generated/v2/AdditionalFileSystemPermissions.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/CapabilityRootLocation.d.ts +9 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/CapabilityRootLocation.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/CapabilityRootLocation.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/CapabilityRootLocation.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/CommandExecutionRequestApprovalParams.d.ts +6 -2
- package/dist/sdk/providers/codex-protocol/generated/v2/CommandExecutionRequestApprovalParams.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolFunctionSpec.d.ts +8 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolFunctionSpec.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolFunctionSpec.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolFunctionSpec.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolNamespaceSpec.d.ts +7 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolNamespaceSpec.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolNamespaceSpec.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolNamespaceSpec.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolNamespaceTool.d.ts +5 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolNamespaceTool.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolNamespaceTool.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolNamespaceTool.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolSpec.d.ts +6 -7
- package/dist/sdk/providers/codex-protocol/generated/v2/DynamicToolSpec.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/FileSystemPath.d.ts +2 -2
- package/dist/sdk/providers/codex-protocol/generated/v2/FileSystemPath.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/McpToolCallAppContext.d.ts +6 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/McpToolCallAppContext.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/McpToolCallAppContext.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/McpToolCallAppContext.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/PermissionsRequestApprovalParams.d.ts +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/PermissionsRequestApprovalParams.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/SelectedCapabilityRoot.d.ts +15 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/SelectedCapabilityRoot.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/SelectedCapabilityRoot.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/SelectedCapabilityRoot.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/SortDirection.d.ts +2 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/SortDirection.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/SortDirection.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/SortDirection.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/SubAgentActivityKind.d.ts +2 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/SubAgentActivityKind.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/SubAgentActivityKind.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/SubAgentActivityKind.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/Thread.d.ts +8 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/Thread.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadCompactStartParams.d.ts +4 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadCompactStartParams.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadCompactStartParams.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadCompactStartParams.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadCompactStartResponse.d.ts +2 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadCompactStartResponse.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadCompactStartResponse.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadCompactStartResponse.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadForkParams.d.ts +64 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadForkParams.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadForkParams.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadForkParams.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadForkResponse.d.ts +46 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadForkResponse.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadForkResponse.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadForkResponse.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadItem.d.ts +19 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadItem.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadReadResponse.d.ts +5 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadReadResponse.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadReadResponse.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadReadResponse.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeInitialTurnsPageParams.d.ts +17 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeInitialTurnsPageParams.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeInitialTurnsPageParams.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeInitialTurnsPageParams.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeParams.d.ts +7 -7
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeParams.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeResponse.d.ts +13 -2
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeResponse.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackParams.d.ts +11 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackParams.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackParams.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackParams.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackResponse.d.ts +12 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackResponse.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackResponse.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackResponse.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadSource.d.ts +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadSource.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadStartParams.d.ts +13 -9
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadStartParams.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadStartResponse.d.ts +8 -2
- package/dist/sdk/providers/codex-protocol/generated/v2/ThreadStartResponse.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/ToolRequestUserInputParams.d.ts +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/ToolRequestUserInputParams.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/TurnEnvironmentParams.d.ts +2 -2
- package/dist/sdk/providers/codex-protocol/generated/v2/TurnEnvironmentParams.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/TurnStartParams.d.ts +17 -5
- package/dist/sdk/providers/codex-protocol/generated/v2/TurnStartParams.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/TurnSteerParams.d.ts +8 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/TurnSteerParams.d.ts.map +1 -1
- package/dist/sdk/providers/codex-protocol/generated/v2/TurnsPage.d.ts +7 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/TurnsPage.d.ts.map +1 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/TurnsPage.js +3 -0
- package/dist/sdk/providers/codex-protocol/generated/v2/TurnsPage.js.map +1 -0
- package/dist/sdk/providers/codex-protocol/index.d.ts +7 -0
- package/dist/sdk/providers/codex-protocol/index.d.ts.map +1 -1
- package/dist/sdk/providers/codex.d.ts +26 -4
- package/dist/sdk/providers/codex.d.ts.map +1 -1
- package/dist/sdk/providers/codex.js +457 -37
- package/dist/sdk/providers/codex.js.map +1 -1
- package/dist/sdk/providers/env-filter.d.ts.map +1 -1
- package/dist/sdk/providers/env-filter.js +19 -1
- package/dist/sdk/providers/env-filter.js.map +1 -1
- package/dist/sdk/providers/gemini-tools.d.ts +28 -0
- package/dist/sdk/providers/gemini-tools.d.ts.map +1 -0
- package/dist/sdk/providers/gemini-tools.js +57 -0
- package/dist/sdk/providers/gemini-tools.js.map +1 -0
- package/dist/sdk/providers/gemini.d.ts.map +1 -1
- package/dist/sdk/providers/gemini.js +4 -2
- package/dist/sdk/providers/gemini.js.map +1 -1
- package/dist/sdk/providers/grok-acp.d.ts +1 -1
- package/dist/sdk/providers/grok-acp.d.ts.map +1 -1
- package/dist/sdk/providers/grok-acp.js +1 -1
- package/dist/sdk/providers/grok-acp.js.map +1 -1
- package/dist/sdk/providers/index.d.ts +1 -0
- package/dist/sdk/providers/index.d.ts.map +1 -1
- package/dist/sdk/providers/index.js +6 -0
- package/dist/sdk/providers/index.js.map +1 -1
- package/dist/sdk/providers/opencode-tools.d.ts +36 -0
- package/dist/sdk/providers/opencode-tools.d.ts.map +1 -0
- package/dist/sdk/providers/opencode-tools.js +78 -0
- package/dist/sdk/providers/opencode-tools.js.map +1 -0
- package/dist/sdk/providers/opencode.d.ts +53 -5
- package/dist/sdk/providers/opencode.d.ts.map +1 -1
- package/dist/sdk/providers/opencode.js +379 -71
- package/dist/sdk/providers/opencode.js.map +1 -1
- package/dist/sdk/providers/pi-rpc-client.d.ts +90 -0
- package/dist/sdk/providers/pi-rpc-client.d.ts.map +1 -0
- package/dist/sdk/providers/pi-rpc-client.js +168 -0
- package/dist/sdk/providers/pi-rpc-client.js.map +1 -0
- package/dist/sdk/providers/pi-tools.d.ts +38 -0
- package/dist/sdk/providers/pi-tools.d.ts.map +1 -0
- package/dist/sdk/providers/pi-tools.js +214 -0
- package/dist/sdk/providers/pi-tools.js.map +1 -0
- package/dist/sdk/providers/pi.d.ts +84 -0
- package/dist/sdk/providers/pi.d.ts.map +1 -0
- package/dist/sdk/providers/pi.js +686 -0
- package/dist/sdk/providers/pi.js.map +1 -0
- package/dist/sdk/providers/staticSlashCommands.d.ts +4 -0
- package/dist/sdk/providers/staticSlashCommands.d.ts.map +1 -0
- package/dist/sdk/providers/staticSlashCommands.js +14 -0
- package/dist/sdk/providers/staticSlashCommands.js.map +1 -0
- package/dist/sdk/providers/types.d.ts +144 -17
- package/dist/sdk/providers/types.d.ts.map +1 -1
- package/dist/sdk/remote-spawn.d.ts.map +1 -1
- package/dist/sdk/remote-spawn.js.map +1 -1
- package/dist/sdk/slashCommandEmulation.d.ts +9 -0
- package/dist/sdk/slashCommandEmulation.d.ts.map +1 -1
- package/dist/sdk/slashCommandEmulation.js +15 -0
- package/dist/sdk/slashCommandEmulation.js.map +1 -1
- package/dist/sdk/types.d.ts +40 -0
- package/dist/sdk/types.d.ts.map +1 -1
- package/dist/security/approvalAuditLog.d.ts +3 -2
- package/dist/security/approvalAuditLog.d.ts.map +1 -1
- package/dist/security/approvalAuditLog.js +62 -2
- package/dist/security/approvalAuditLog.js.map +1 -1
- package/dist/services/BrowserProfileService.d.ts +21 -0
- package/dist/services/BrowserProfileService.d.ts.map +1 -1
- package/dist/services/BrowserProfileService.js +74 -1
- package/dist/services/BrowserProfileService.js.map +1 -1
- package/dist/services/CacheMissBillingMonitor.d.ts +25 -0
- package/dist/services/CacheMissBillingMonitor.d.ts.map +1 -0
- package/dist/services/CacheMissBillingMonitor.js +179 -0
- package/dist/services/CacheMissBillingMonitor.js.map +1 -0
- package/dist/services/CodexUpdateChecker.d.ts.map +1 -1
- package/dist/services/CodexUpdateChecker.js +3 -2
- package/dist/services/CodexUpdateChecker.js.map +1 -1
- package/dist/services/ModelInfoService.d.ts +58 -9
- package/dist/services/ModelInfoService.d.ts.map +1 -1
- package/dist/services/ModelInfoService.js +127 -14
- package/dist/services/ModelInfoService.js.map +1 -1
- package/dist/services/ProjectQueueScheduler.d.ts +91 -0
- package/dist/services/ProjectQueueScheduler.d.ts.map +1 -0
- package/dist/services/ProjectQueueScheduler.js +404 -0
- package/dist/services/ProjectQueueScheduler.js.map +1 -0
- package/dist/services/ProjectQueueService.d.ts +60 -0
- package/dist/services/ProjectQueueService.d.ts.map +1 -0
- package/dist/services/ProjectQueueService.js +804 -0
- package/dist/services/ProjectQueueService.js.map +1 -0
- package/dist/services/RelayClientService.d.ts +5 -0
- package/dist/services/RelayClientService.d.ts.map +1 -1
- package/dist/services/RelayClientService.js +26 -12
- package/dist/services/RelayClientService.js.map +1 -1
- package/dist/services/SafeRestartService.d.ts +48 -0
- package/dist/services/SafeRestartService.d.ts.map +1 -0
- package/dist/services/SafeRestartService.js +173 -0
- package/dist/services/SafeRestartService.js.map +1 -0
- package/dist/services/ServerSettingsService.d.ts +41 -1
- package/dist/services/ServerSettingsService.d.ts.map +1 -1
- package/dist/services/ServerSettingsService.js +110 -1
- package/dist/services/ServerSettingsService.js.map +1 -1
- package/dist/services/SessionQueuePersistenceService.d.ts +55 -0
- package/dist/services/SessionQueuePersistenceService.d.ts.map +1 -0
- package/dist/services/SessionQueuePersistenceService.js +264 -0
- package/dist/services/SessionQueuePersistenceService.js.map +1 -0
- package/dist/services/WorkstreamService.d.ts +92 -0
- package/dist/services/WorkstreamService.d.ts.map +1 -0
- package/dist/services/WorkstreamService.js +627 -0
- package/dist/services/WorkstreamService.js.map +1 -0
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +4 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/projectWorkIdle.d.ts +42 -0
- package/dist/services/projectWorkIdle.d.ts.map +1 -0
- package/dist/services/projectWorkIdle.js +50 -0
- package/dist/services/projectWorkIdle.js.map +1 -0
- package/dist/services/voice/SpeechBackend.d.ts +18 -1
- package/dist/services/voice/SpeechBackend.d.ts.map +1 -1
- package/dist/services/voice/SpeechBackend.js +3 -0
- package/dist/services/voice/SpeechBackend.js.map +1 -1
- package/dist/services/voice/audioRetention.d.ts +20 -0
- package/dist/services/voice/audioRetention.d.ts.map +1 -1
- package/dist/services/voice/audioRetention.js +2 -0
- package/dist/services/voice/audioRetention.js.map +1 -1
- package/dist/services/voice/deepgramBackend.d.ts.map +1 -1
- package/dist/services/voice/deepgramBackend.js +4 -1
- package/dist/services/voice/deepgramBackend.js.map +1 -1
- package/dist/services/voice/localNemoBackend.d.ts +31 -0
- package/dist/services/voice/localNemoBackend.d.ts.map +1 -0
- package/dist/services/voice/localNemoBackend.js +181 -0
- package/dist/services/voice/localNemoBackend.js.map +1 -0
- package/dist/services/voice/localParakeetBackend.d.ts +31 -0
- package/dist/services/voice/localParakeetBackend.d.ts.map +1 -0
- package/dist/services/voice/localParakeetBackend.js +180 -0
- package/dist/services/voice/localParakeetBackend.js.map +1 -0
- package/dist/services/voice/localSttRuntime.d.ts +21 -0
- package/dist/services/voice/localSttRuntime.d.ts.map +1 -0
- package/dist/services/voice/localSttRuntime.js +87 -0
- package/dist/services/voice/localSttRuntime.js.map +1 -0
- package/dist/services/voice/localWhisperBackend.d.ts +2 -1
- package/dist/services/voice/localWhisperBackend.d.ts.map +1 -1
- package/dist/services/voice/localWhisperBackend.js +47 -34
- package/dist/services/voice/localWhisperBackend.js.map +1 -1
- package/dist/services/voice/nemo_worker.py +232 -0
- package/dist/services/voice/parakeet_worker.py +151 -0
- package/dist/services/voice/registry.d.ts +19 -4
- package/dist/services/voice/registry.d.ts.map +1 -1
- package/dist/services/voice/registry.js +72 -22
- package/dist/services/voice/registry.js.map +1 -1
- package/dist/services/voice/serialQueue.d.ts +17 -0
- package/dist/services/voice/serialQueue.d.ts.map +1 -0
- package/dist/services/voice/serialQueue.js +24 -0
- package/dist/services/voice/serialQueue.js.map +1 -0
- package/dist/services/voice/whisper_worker.py +94 -0
- package/dist/services/voice/xaiSttBackend.d.ts +1 -1
- package/dist/services/voice/xaiSttBackend.d.ts.map +1 -1
- package/dist/services/voice/xaiSttBackend.js +15 -3
- package/dist/services/voice/xaiSttBackend.js.map +1 -1
- package/dist/sessions/agent-excerpt.d.ts +29 -0
- package/dist/sessions/agent-excerpt.d.ts.map +1 -0
- package/dist/sessions/agent-excerpt.js +128 -0
- package/dist/sessions/agent-excerpt.js.map +1 -0
- package/dist/sessions/claude-messages.d.ts.map +1 -1
- package/dist/sessions/claude-messages.js +75 -4
- package/dist/sessions/claude-messages.js.map +1 -1
- package/dist/sessions/claude-summary.d.ts +33 -0
- package/dist/sessions/claude-summary.d.ts.map +1 -0
- package/dist/sessions/claude-summary.js +461 -0
- package/dist/sessions/claude-summary.js.map +1 -0
- package/dist/sessions/codex-discovery.d.ts +46 -0
- package/dist/sessions/codex-discovery.d.ts.map +1 -0
- package/dist/sessions/codex-discovery.js +269 -0
- package/dist/sessions/codex-discovery.js.map +1 -0
- package/dist/sessions/codex-reader.d.ts +96 -13
- package/dist/sessions/codex-reader.d.ts.map +1 -1
- package/dist/sessions/codex-reader.js +1069 -141
- package/dist/sessions/codex-reader.js.map +1 -1
- package/dist/sessions/dag.d.ts +25 -4
- package/dist/sessions/dag.d.ts.map +1 -1
- package/dist/sessions/dag.js +37 -4
- package/dist/sessions/dag.js.map +1 -1
- package/dist/sessions/gemini-reader.d.ts +3 -1
- package/dist/sessions/gemini-reader.d.ts.map +1 -1
- package/dist/sessions/gemini-reader.js +17 -8
- package/dist/sessions/gemini-reader.js.map +1 -1
- package/dist/sessions/grok-reader.d.ts +1 -0
- package/dist/sessions/grok-reader.d.ts.map +1 -1
- package/dist/sessions/grok-reader.js +11 -5
- package/dist/sessions/grok-reader.js.map +1 -1
- package/dist/sessions/normalization.d.ts +3 -1
- package/dist/sessions/normalization.d.ts.map +1 -1
- package/dist/sessions/normalization.js +72 -16
- package/dist/sessions/normalization.js.map +1 -1
- package/dist/sessions/null-reader.d.ts +31 -0
- package/dist/sessions/null-reader.d.ts.map +1 -0
- package/dist/sessions/null-reader.js +30 -0
- package/dist/sessions/null-reader.js.map +1 -0
- package/dist/sessions/opencode-db-reader.d.ts +66 -0
- package/dist/sessions/opencode-db-reader.d.ts.map +1 -0
- package/dist/sessions/opencode-db-reader.js +333 -0
- package/dist/sessions/opencode-db-reader.js.map +1 -0
- package/dist/sessions/opencode-reader.d.ts +50 -0
- package/dist/sessions/opencode-reader.d.ts.map +1 -1
- package/dist/sessions/opencode-reader.js +375 -71
- package/dist/sessions/opencode-reader.js.map +1 -1
- package/dist/sessions/pagination.d.ts.map +1 -1
- package/dist/sessions/pagination.js +119 -3
- package/dist/sessions/pagination.js.map +1 -1
- package/dist/sessions/persisted-augments.d.ts +2 -1
- package/dist/sessions/persisted-augments.d.ts.map +1 -1
- package/dist/sessions/persisted-augments.js +2 -2
- package/dist/sessions/persisted-augments.js.map +1 -1
- package/dist/sessions/pi-fork.d.ts +12 -0
- package/dist/sessions/pi-fork.d.ts.map +1 -0
- package/dist/sessions/pi-fork.js +125 -0
- package/dist/sessions/pi-fork.js.map +1 -0
- package/dist/sessions/pi-reader.d.ts +81 -0
- package/dist/sessions/pi-reader.d.ts.map +1 -0
- package/dist/sessions/pi-reader.js +413 -0
- package/dist/sessions/pi-reader.js.map +1 -0
- package/dist/sessions/provider-resolution.d.ts +10 -3
- package/dist/sessions/provider-resolution.d.ts.map +1 -1
- package/dist/sessions/provider-resolution.js +62 -6
- package/dist/sessions/provider-resolution.js.map +1 -1
- package/dist/sessions/reader.d.ts +17 -24
- package/dist/sessions/reader.d.ts.map +1 -1
- package/dist/sessions/reader.js +86 -157
- package/dist/sessions/reader.js.map +1 -1
- package/dist/sessions/recap-overlays.d.ts +38 -0
- package/dist/sessions/recap-overlays.d.ts.map +1 -0
- package/dist/sessions/recap-overlays.js +176 -0
- package/dist/sessions/recap-overlays.js.map +1 -0
- package/dist/sessions/summary-parser-worker-client.d.ts +80 -0
- package/dist/sessions/summary-parser-worker-client.d.ts.map +1 -0
- package/dist/sessions/summary-parser-worker-client.js +539 -0
- package/dist/sessions/summary-parser-worker-client.js.map +1 -0
- package/dist/sessions/summary-parser-worker-entry.d.ts +2 -0
- package/dist/sessions/summary-parser-worker-entry.d.ts.map +1 -0
- package/dist/sessions/summary-parser-worker-entry.js +29 -0
- package/dist/sessions/summary-parser-worker-entry.js.map +1 -0
- package/dist/sessions/summary-parser-worker-protocol.d.ts +105 -0
- package/dist/sessions/summary-parser-worker-protocol.d.ts.map +1 -0
- package/dist/sessions/summary-parser-worker-protocol.js +35 -0
- package/dist/sessions/summary-parser-worker-protocol.js.map +1 -0
- package/dist/sessions/summary-parser-worker-runner.d.ts +3 -0
- package/dist/sessions/summary-parser-worker-runner.d.ts.map +1 -0
- package/dist/sessions/summary-parser-worker-runner.js +158 -0
- package/dist/sessions/summary-parser-worker-runner.js.map +1 -0
- package/dist/sessions/types.d.ts +30 -1
- package/dist/sessions/types.d.ts.map +1 -1
- package/dist/startupEnv.d.ts +2 -0
- package/dist/startupEnv.d.ts.map +1 -0
- package/dist/startupEnv.js +97 -0
- package/dist/startupEnv.js.map +1 -0
- package/dist/subscriptions.d.ts.map +1 -1
- package/dist/subscriptions.js +28 -18
- package/dist/subscriptions.js.map +1 -1
- package/dist/supervisor/ExternalSessionTracker.d.ts +5 -1
- package/dist/supervisor/ExternalSessionTracker.d.ts.map +1 -1
- package/dist/supervisor/ExternalSessionTracker.js +98 -6
- package/dist/supervisor/ExternalSessionTracker.js.map +1 -1
- package/dist/supervisor/Process.d.ts +252 -32
- package/dist/supervisor/Process.d.ts.map +1 -1
- package/dist/supervisor/Process.js +1233 -219
- package/dist/supervisor/Process.js.map +1 -1
- package/dist/supervisor/Supervisor.d.ts +201 -5
- package/dist/supervisor/Supervisor.d.ts.map +1 -1
- package/dist/supervisor/Supervisor.js +1074 -55
- package/dist/supervisor/Supervisor.js.map +1 -1
- package/dist/supervisor/WorkerQueue.d.ts +3 -1
- package/dist/supervisor/WorkerQueue.d.ts.map +1 -1
- package/dist/supervisor/WorkerQueue.js +1 -0
- package/dist/supervisor/WorkerQueue.js.map +1 -1
- package/dist/supervisor/composeTimeAnchor.d.ts +36 -0
- package/dist/supervisor/composeTimeAnchor.d.ts.map +1 -0
- package/dist/supervisor/composeTimeAnchor.js +51 -0
- package/dist/supervisor/composeTimeAnchor.js.map +1 -0
- package/dist/supervisor/deferredDeliverySettings.d.ts +23 -0
- package/dist/supervisor/deferredDeliverySettings.d.ts.map +1 -0
- package/dist/supervisor/deferredDeliverySettings.js +40 -0
- package/dist/supervisor/deferredDeliverySettings.js.map +1 -0
- package/dist/supervisor/liveness.d.ts +5 -2
- package/dist/supervisor/liveness.d.ts.map +1 -1
- package/dist/supervisor/liveness.js +40 -2
- package/dist/supervisor/liveness.js.map +1 -1
- package/dist/supervisor/types.d.ts +56 -5
- package/dist/supervisor/types.d.ts.map +1 -1
- package/dist/supervisor/types.js +0 -2
- package/dist/supervisor/types.js.map +1 -1
- package/dist/uploads/AttachmentStagingService.d.ts +94 -0
- package/dist/uploads/AttachmentStagingService.d.ts.map +1 -0
- package/dist/uploads/AttachmentStagingService.js +673 -0
- package/dist/uploads/AttachmentStagingService.js.map +1 -0
- package/dist/uploads/index.d.ts +2 -0
- package/dist/uploads/index.d.ts.map +1 -1
- package/dist/uploads/index.js +1 -0
- package/dist/uploads/index.js.map +1 -1
- package/dist/uploads/manager.d.ts +1 -0
- package/dist/uploads/manager.d.ts.map +1 -1
- package/dist/uploads/manager.js +72 -12
- package/dist/uploads/manager.js.map +1 -1
- package/dist/utils/codexRolloutFiles.d.ts +16 -0
- package/dist/utils/codexRolloutFiles.d.ts.map +1 -0
- package/dist/utils/codexRolloutFiles.js +45 -0
- package/dist/utils/codexRolloutFiles.js.map +1 -0
- package/dist/utils/jsonl.d.ts +8 -0
- package/dist/utils/jsonl.d.ts.map +1 -1
- package/dist/utils/jsonl.js +158 -5
- package/dist/utils/jsonl.js.map +1 -1
- package/dist/utils/publicShareViewerUrl.d.ts.map +1 -1
- package/dist/utils/publicShareViewerUrl.js +2 -15
- package/dist/utils/publicShareViewerUrl.js.map +1 -1
- package/dist/watcher/EventBus.d.ts +42 -4
- package/dist/watcher/EventBus.d.ts.map +1 -1
- package/dist/watcher/EventBus.js.map +1 -1
- package/dist/watcher/FileWatcher.d.ts +47 -0
- package/dist/watcher/FileWatcher.d.ts.map +1 -1
- package/dist/watcher/FileWatcher.js +185 -14
- package/dist/watcher/FileWatcher.js.map +1 -1
- package/dist/watcher/index.d.ts +2 -2
- package/dist/watcher/index.d.ts.map +1 -1
- package/dist/watcher/index.js.map +1 -1
- package/dist/yaModuleEnv.d.ts +6 -6
- package/dist/yaModuleEnv.d.ts.map +1 -1
- package/dist/yaModuleEnv.js +12 -12
- package/dist/yaModuleEnv.js.map +1 -1
- package/package.json +5 -6
- package/client-dist/assets/de-BuEb60Yc.js +0 -6
- package/client-dist/assets/es-CRlmPKnE.js +0 -6
- package/client-dist/assets/fr-Cglgjc2X.js +0 -6
- package/client-dist/assets/index-BNj7ibmq.js +0 -524
- package/client-dist/assets/index-CAmsUazi.css +0 -1
- package/client-dist/assets/ja-DMb9mFPv.js +0 -6
- package/client-dist/assets/zh-CN-D1tbfamz.js +0 -6
package/dist/routes/speech.js
CHANGED
|
@@ -3,15 +3,75 @@ import { Hono } from "hono";
|
|
|
3
3
|
import { getLogger } from "../logging/logger.js";
|
|
4
4
|
import { DEFAULT_SERVER_SETTINGS } from "../services/ServerSettingsService.js";
|
|
5
5
|
import { persistSpeechAudio, } from "../services/voice/audioRetention.js";
|
|
6
|
-
import { supportsStreaming, } from "../services/voice/SpeechBackend.js";
|
|
6
|
+
import { supportsStreaming, supportsPrewarm, } from "../services/voice/SpeechBackend.js";
|
|
7
7
|
const logger = getLogger();
|
|
8
8
|
const DEFAULT_MIME_TYPE = "audio/webm;codecs=opus";
|
|
9
|
+
const MAX_SMART_TURN_TIMEOUT_MS = 10000;
|
|
10
|
+
const XAI_REALTIME_CLIENT_SECRET_URL = "https://api.x.ai/v1/realtime/client_secrets";
|
|
9
11
|
function send(ws, msg) {
|
|
10
12
|
ws.send(JSON.stringify(msg));
|
|
11
13
|
}
|
|
14
|
+
function parseXaiClientSecret(data) {
|
|
15
|
+
const value = typeof data.value === "string"
|
|
16
|
+
? data.value
|
|
17
|
+
: typeof data.client_secret === "string"
|
|
18
|
+
? data.client_secret
|
|
19
|
+
: data.client_secret?.value;
|
|
20
|
+
const trimmed = value?.trim();
|
|
21
|
+
if (!trimmed)
|
|
22
|
+
return null;
|
|
23
|
+
return data.expires_at
|
|
24
|
+
? { value: trimmed, expiresAt: data.expires_at }
|
|
25
|
+
: { value: trimmed };
|
|
26
|
+
}
|
|
27
|
+
async function createXaiClientSecret(apiKey) {
|
|
28
|
+
const response = await fetch(XAI_REALTIME_CLIENT_SECRET_URL, {
|
|
29
|
+
method: "POST",
|
|
30
|
+
headers: {
|
|
31
|
+
Authorization: `Bearer ${apiKey}`,
|
|
32
|
+
"Content-Type": "application/json",
|
|
33
|
+
},
|
|
34
|
+
body: JSON.stringify({ expires_after: { seconds: 300 } }),
|
|
35
|
+
signal: AbortSignal.timeout(10_000),
|
|
36
|
+
});
|
|
37
|
+
const text = await response.text();
|
|
38
|
+
if (!response.ok) {
|
|
39
|
+
throw new Error(`xAI client secret request failed (HTTP ${response.status}): ${text.slice(0, 500)}`);
|
|
40
|
+
}
|
|
41
|
+
let data;
|
|
42
|
+
try {
|
|
43
|
+
data = JSON.parse(text);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
throw new Error("xAI client secret request returned non-JSON");
|
|
47
|
+
}
|
|
48
|
+
const secret = parseXaiClientSecret(data);
|
|
49
|
+
if (!secret) {
|
|
50
|
+
throw new Error("xAI client secret response did not include a secret");
|
|
51
|
+
}
|
|
52
|
+
return secret;
|
|
53
|
+
}
|
|
12
54
|
function formatStreamingTranscriptTraceLine(kind, text) {
|
|
13
55
|
return `${kind}\t${text.replaceAll("\r", "\\r").replaceAll("\n", "\\n")}`;
|
|
14
56
|
}
|
|
57
|
+
function toStreamingPartialTraceEvent(event) {
|
|
58
|
+
return {
|
|
59
|
+
kind: getPartialTraceKind(event),
|
|
60
|
+
text: event.text,
|
|
61
|
+
isFinal: event.isFinal,
|
|
62
|
+
speechFinal: event.speechFinal,
|
|
63
|
+
start: event.start,
|
|
64
|
+
duration: event.duration,
|
|
65
|
+
words: event.words,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function toStreamingDoneTraceEvent(done) {
|
|
69
|
+
return {
|
|
70
|
+
kind: "done",
|
|
71
|
+
text: done.text,
|
|
72
|
+
duration: done.duration,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
15
75
|
function getPartialTraceKind(event) {
|
|
16
76
|
if (event.speechFinal)
|
|
17
77
|
return "speech-final";
|
|
@@ -38,7 +98,7 @@ function parseSmartTurnStartOptions(value) {
|
|
|
38
98
|
? clampNumber(value.threshold, 0, 1)
|
|
39
99
|
: undefined;
|
|
40
100
|
const timeoutMs = typeof value.timeoutMs === "number" && Number.isFinite(value.timeoutMs)
|
|
41
|
-
? Math.round(clampNumber(value.timeoutMs, 0,
|
|
101
|
+
? Math.round(clampNumber(value.timeoutMs, 0, MAX_SMART_TURN_TIMEOUT_MS))
|
|
42
102
|
: undefined;
|
|
43
103
|
return { enabled: true, threshold, timeoutMs };
|
|
44
104
|
}
|
|
@@ -110,6 +170,12 @@ function cleanContextString(value, maxLength = 300) {
|
|
|
110
170
|
const trimmed = value.trim();
|
|
111
171
|
return trimmed ? trimmed.slice(0, maxLength) : undefined;
|
|
112
172
|
}
|
|
173
|
+
function cleanOptionalString(value, maxLength = 300) {
|
|
174
|
+
if (typeof value !== "string")
|
|
175
|
+
return undefined;
|
|
176
|
+
const trimmed = value.trim();
|
|
177
|
+
return trimmed ? trimmed.slice(0, maxLength) : undefined;
|
|
178
|
+
}
|
|
113
179
|
function parseTranscriptionContext(value) {
|
|
114
180
|
if (!isRecord(value))
|
|
115
181
|
return undefined;
|
|
@@ -118,6 +184,7 @@ function parseTranscriptionContext(value) {
|
|
|
118
184
|
sessionId: cleanContextString(value.sessionId),
|
|
119
185
|
clientTurnId: cleanContextString(value.clientTurnId, 120),
|
|
120
186
|
draftKey: cleanContextString(value.draftKey, 300),
|
|
187
|
+
speechTargetId: cleanContextString(value.speechTargetId, 120),
|
|
121
188
|
};
|
|
122
189
|
const clean = Object.fromEntries(Object.entries(context).filter(([, entry]) => entry !== undefined));
|
|
123
190
|
return Object.keys(clean).length > 0 ? clean : undefined;
|
|
@@ -136,6 +203,7 @@ async function transcribeWithAudit(deps, input) {
|
|
|
136
203
|
source: input.source,
|
|
137
204
|
backendId: input.backendId,
|
|
138
205
|
mimeType: input.options.mimeType ?? DEFAULT_MIME_TYPE,
|
|
206
|
+
model: input.options.model,
|
|
139
207
|
audioBytes: input.audio.length,
|
|
140
208
|
hasPrompt: !!input.options.prompt,
|
|
141
209
|
keytermCount: input.options.keyterms?.length ?? 0,
|
|
@@ -152,6 +220,7 @@ async function transcribeWithAudit(deps, input) {
|
|
|
152
220
|
requestId,
|
|
153
221
|
source: input.source,
|
|
154
222
|
backendId: input.backendId,
|
|
223
|
+
model: input.options.model,
|
|
155
224
|
mimeType: input.options.mimeType ?? DEFAULT_MIME_TYPE,
|
|
156
225
|
audio: input.audio,
|
|
157
226
|
transcript: text,
|
|
@@ -200,6 +269,7 @@ async function persistStreamingTranscription(deps, input) {
|
|
|
200
269
|
audio: input.audio,
|
|
201
270
|
transcript: input.transcript,
|
|
202
271
|
streamingTranscriptTrace: input.streamingTranscriptTrace,
|
|
272
|
+
streamingTranscriptEvents: input.streamingTranscriptEvents,
|
|
203
273
|
startedAt: input.startedAt,
|
|
204
274
|
completedAt,
|
|
205
275
|
durationMs: completedAtMs - input.startedAtMs,
|
|
@@ -217,6 +287,7 @@ async function persistStreamingTranscription(deps, input) {
|
|
|
217
287
|
durationMs: completedAtMs - input.startedAtMs,
|
|
218
288
|
transcriptChars: input.transcript.length,
|
|
219
289
|
streamingTranscriptTraceEvents: input.streamingTranscriptTrace?.length ?? 0,
|
|
290
|
+
streamingTranscriptRawEvents: input.streamingTranscriptEvents?.length ?? 0,
|
|
220
291
|
transcriptionId: retention.transcriptionId,
|
|
221
292
|
retention: {
|
|
222
293
|
stored: retention.stored,
|
|
@@ -252,13 +323,332 @@ function parseTranscribeBody(value) {
|
|
|
252
323
|
context: parseTranscriptionContext(body.context),
|
|
253
324
|
options: {
|
|
254
325
|
mimeType: typeof body.mimeType === "string" ? body.mimeType : DEFAULT_MIME_TYPE,
|
|
326
|
+
model: cleanOptionalString(body.model, 200),
|
|
255
327
|
prompt: typeof body.prompt === "string" ? body.prompt : undefined,
|
|
256
328
|
keyterms,
|
|
257
329
|
},
|
|
258
330
|
};
|
|
259
331
|
}
|
|
332
|
+
function parsePrewarmBody(value) {
|
|
333
|
+
if (!isRecord(value)) {
|
|
334
|
+
return { ok: false, message: "Expected JSON object" };
|
|
335
|
+
}
|
|
336
|
+
const body = value;
|
|
337
|
+
if (typeof body.backendId !== "string" || body.backendId.length === 0) {
|
|
338
|
+
return { ok: false, message: "backendId is required" };
|
|
339
|
+
}
|
|
340
|
+
return {
|
|
341
|
+
ok: true,
|
|
342
|
+
backendId: body.backendId,
|
|
343
|
+
options: {
|
|
344
|
+
model: cleanOptionalString(body.model, 200),
|
|
345
|
+
},
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
export function createSpeechWebSocketSession(deps, sendMessage) {
|
|
349
|
+
const chunks = [];
|
|
350
|
+
let mimeType = DEFAULT_MIME_TYPE;
|
|
351
|
+
let backendId = null;
|
|
352
|
+
let context;
|
|
353
|
+
let streamSession = null;
|
|
354
|
+
let streamSessionPromise = null;
|
|
355
|
+
let pendingAudio = [];
|
|
356
|
+
let streamRequestId = null;
|
|
357
|
+
let streamStartedAt = "";
|
|
358
|
+
let streamStartedAtMs = 0;
|
|
359
|
+
let streamingTranscriptTrace = [];
|
|
360
|
+
let streamingTranscriptEvents = [];
|
|
361
|
+
let streamingSpeechFinalTexts = [];
|
|
362
|
+
let streamingStopRequested = false;
|
|
363
|
+
let messageChain = Promise.resolve();
|
|
364
|
+
const processMessage = async (data) => {
|
|
365
|
+
const normalized = await normalizeWsData(data);
|
|
366
|
+
const msg = parseWsControlMessage(normalized.text);
|
|
367
|
+
if (!msg) {
|
|
368
|
+
if (normalized.buffer) {
|
|
369
|
+
chunks.push(normalized.buffer);
|
|
370
|
+
if (streamSession) {
|
|
371
|
+
streamSession.sendAudio(normalized.buffer);
|
|
372
|
+
}
|
|
373
|
+
else if (streamSessionPromise) {
|
|
374
|
+
pendingAudio.push(normalized.buffer);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
logger.warn("Unparseable speech WS frame");
|
|
379
|
+
}
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
if (msg.type === "start") {
|
|
383
|
+
chunks.length = 0;
|
|
384
|
+
backendId = msg.backendId ?? null;
|
|
385
|
+
mimeType = msg.mimeType ?? DEFAULT_MIME_TYPE;
|
|
386
|
+
context = parseTranscriptionContext(msg.context);
|
|
387
|
+
streamSession?.close();
|
|
388
|
+
streamSession = null;
|
|
389
|
+
streamSessionPromise = null;
|
|
390
|
+
pendingAudio = [];
|
|
391
|
+
streamRequestId = null;
|
|
392
|
+
streamingTranscriptTrace = [];
|
|
393
|
+
streamingTranscriptEvents = [];
|
|
394
|
+
streamingSpeechFinalTexts = [];
|
|
395
|
+
streamingStopRequested = false;
|
|
396
|
+
if (msg.streaming && backendId) {
|
|
397
|
+
const backend = deps.speechBackendRegistry.getBackend(backendId);
|
|
398
|
+
if (!backend) {
|
|
399
|
+
sendMessage({ type: "error", message: "No backend selected" });
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (!supportsStreaming(backend)) {
|
|
403
|
+
sendMessage({
|
|
404
|
+
type: "error",
|
|
405
|
+
message: `Backend does not support streaming: ${backendId}`,
|
|
406
|
+
});
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
const sampleRate = msg.sampleRate ?? 16_000;
|
|
410
|
+
const encoding = msg.encoding === "pcm" ? "pcm" : null;
|
|
411
|
+
if (!encoding) {
|
|
412
|
+
sendMessage({
|
|
413
|
+
type: "error",
|
|
414
|
+
message: "Streaming speech requires pcm encoding",
|
|
415
|
+
});
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
const smartTurn = backend.capabilities.smartTurn === true ? msg.smartTurn : undefined;
|
|
419
|
+
streamRequestId = randomUUID();
|
|
420
|
+
streamStartedAtMs = Date.now();
|
|
421
|
+
streamStartedAt = new Date(streamStartedAtMs).toISOString();
|
|
422
|
+
logger.info({
|
|
423
|
+
component: "speech",
|
|
424
|
+
requestId: streamRequestId,
|
|
425
|
+
source: "ws",
|
|
426
|
+
mode: "stream",
|
|
427
|
+
backendId,
|
|
428
|
+
mimeType,
|
|
429
|
+
sampleRate,
|
|
430
|
+
encoding,
|
|
431
|
+
smartTurn: smartTurn?.enabled === true
|
|
432
|
+
? {
|
|
433
|
+
threshold: smartTurn.threshold ?? null,
|
|
434
|
+
timeoutMs: smartTurn.timeoutMs ?? null,
|
|
435
|
+
}
|
|
436
|
+
: null,
|
|
437
|
+
context,
|
|
438
|
+
}, "Speech streaming transcription started");
|
|
439
|
+
const requestId = streamRequestId;
|
|
440
|
+
const isCurrent = () => streamRequestId === requestId;
|
|
441
|
+
streamSessionPromise = backend
|
|
442
|
+
.stream({
|
|
443
|
+
mimeType,
|
|
444
|
+
sampleRate,
|
|
445
|
+
encoding,
|
|
446
|
+
interimResults: true,
|
|
447
|
+
endpointingMs: 250,
|
|
448
|
+
language: "en",
|
|
449
|
+
smartTurnThreshold: smartTurn?.threshold,
|
|
450
|
+
smartTurnTimeoutMs: smartTurn?.timeoutMs,
|
|
451
|
+
}, {
|
|
452
|
+
onPartial: (event) => {
|
|
453
|
+
if (!isCurrent())
|
|
454
|
+
return;
|
|
455
|
+
streamingTranscriptTrace.push(formatStreamingTranscriptTraceLine(getPartialTraceKind(event), event.text));
|
|
456
|
+
streamingTranscriptEvents.push(toStreamingPartialTraceEvent(event));
|
|
457
|
+
if (event.speechFinal) {
|
|
458
|
+
streamingSpeechFinalTexts.push(event.text);
|
|
459
|
+
}
|
|
460
|
+
sendMessage({
|
|
461
|
+
type: "interim",
|
|
462
|
+
text: event.text,
|
|
463
|
+
isFinal: event.isFinal,
|
|
464
|
+
speechFinal: event.speechFinal,
|
|
465
|
+
start: event.start,
|
|
466
|
+
duration: event.duration,
|
|
467
|
+
words: event.words,
|
|
468
|
+
});
|
|
469
|
+
},
|
|
470
|
+
onError: (err) => {
|
|
471
|
+
if (!isCurrent() || streamingStopRequested)
|
|
472
|
+
return;
|
|
473
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
474
|
+
logger.warn({
|
|
475
|
+
component: "speech",
|
|
476
|
+
requestId,
|
|
477
|
+
source: "ws",
|
|
478
|
+
mode: "stream",
|
|
479
|
+
backendId,
|
|
480
|
+
}, `Speech streaming failed mid-session: ${message}`);
|
|
481
|
+
sendMessage({ type: "error", message });
|
|
482
|
+
},
|
|
483
|
+
})
|
|
484
|
+
.then((session) => {
|
|
485
|
+
if (!isCurrent()) {
|
|
486
|
+
session.close();
|
|
487
|
+
return session;
|
|
488
|
+
}
|
|
489
|
+
streamSession = session;
|
|
490
|
+
for (const buffered of pendingAudio) {
|
|
491
|
+
session.sendAudio(buffered);
|
|
492
|
+
}
|
|
493
|
+
pendingAudio = [];
|
|
494
|
+
return session;
|
|
495
|
+
});
|
|
496
|
+
streamSessionPromise.catch((err) => {
|
|
497
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
498
|
+
logger.error({
|
|
499
|
+
component: "speech",
|
|
500
|
+
requestId,
|
|
501
|
+
source: "ws",
|
|
502
|
+
mode: "stream",
|
|
503
|
+
backendId,
|
|
504
|
+
err,
|
|
505
|
+
}, "Speech streaming session failed to open");
|
|
506
|
+
if (!isCurrent())
|
|
507
|
+
return;
|
|
508
|
+
streamSessionPromise = null;
|
|
509
|
+
pendingAudio = [];
|
|
510
|
+
if (!streamingStopRequested) {
|
|
511
|
+
sendMessage({ type: "error", message });
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
const audio = Buffer.concat(chunks);
|
|
518
|
+
chunks.length = 0;
|
|
519
|
+
if (!backendId) {
|
|
520
|
+
sendMessage({ type: "error", message: "No backend selected" });
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
if (streamSessionPromise && streamRequestId) {
|
|
524
|
+
try {
|
|
525
|
+
streamingStopRequested = true;
|
|
526
|
+
const session = await streamSessionPromise;
|
|
527
|
+
const done = await session.finish();
|
|
528
|
+
streamingTranscriptTrace.push(formatStreamingTranscriptTraceLine("done", done.text));
|
|
529
|
+
streamingTranscriptEvents.push(toStreamingDoneTraceEvent(done));
|
|
530
|
+
const transcript = done.text.trim() ||
|
|
531
|
+
joinStreamingSpeechFinals(streamingSpeechFinalTexts);
|
|
532
|
+
const retention = await persistStreamingTranscription(deps, {
|
|
533
|
+
requestId: streamRequestId,
|
|
534
|
+
backendId,
|
|
535
|
+
audio,
|
|
536
|
+
mimeType,
|
|
537
|
+
transcript,
|
|
538
|
+
streamingTranscriptTrace,
|
|
539
|
+
streamingTranscriptEvents,
|
|
540
|
+
startedAt: streamStartedAt,
|
|
541
|
+
startedAtMs: streamStartedAtMs,
|
|
542
|
+
context,
|
|
543
|
+
});
|
|
544
|
+
sendMessage({
|
|
545
|
+
type: "final",
|
|
546
|
+
text: transcript,
|
|
547
|
+
transcriptionId: retention.transcriptionId,
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
catch (err) {
|
|
551
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
552
|
+
logger.error({
|
|
553
|
+
component: "speech",
|
|
554
|
+
requestId: streamRequestId,
|
|
555
|
+
source: "ws",
|
|
556
|
+
mode: "stream",
|
|
557
|
+
backendId,
|
|
558
|
+
audioBytes: audio.length,
|
|
559
|
+
context,
|
|
560
|
+
err,
|
|
561
|
+
}, "Speech streaming transcription failed");
|
|
562
|
+
sendMessage({ type: "error", message });
|
|
563
|
+
}
|
|
564
|
+
finally {
|
|
565
|
+
streamSession = null;
|
|
566
|
+
streamSessionPromise = null;
|
|
567
|
+
pendingAudio = [];
|
|
568
|
+
streamRequestId = null;
|
|
569
|
+
streamingTranscriptTrace = [];
|
|
570
|
+
streamingTranscriptEvents = [];
|
|
571
|
+
streamingSpeechFinalTexts = [];
|
|
572
|
+
streamingStopRequested = false;
|
|
573
|
+
}
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
try {
|
|
577
|
+
const { text, retention } = await transcribeWithAudit(deps, {
|
|
578
|
+
source: "ws",
|
|
579
|
+
backendId,
|
|
580
|
+
audio,
|
|
581
|
+
options: { mimeType },
|
|
582
|
+
context,
|
|
583
|
+
});
|
|
584
|
+
sendMessage({
|
|
585
|
+
type: "final",
|
|
586
|
+
text,
|
|
587
|
+
transcriptionId: retention.transcriptionId,
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
catch (err) {
|
|
591
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
592
|
+
sendMessage({ type: "error", message });
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
return {
|
|
596
|
+
handleMessage(data) {
|
|
597
|
+
messageChain = messageChain
|
|
598
|
+
.then(() => processMessage(data))
|
|
599
|
+
.catch((err) => {
|
|
600
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
601
|
+
logger.error({ component: "speech", err }, "Speech WS message handling failed");
|
|
602
|
+
sendMessage({ type: "error", message });
|
|
603
|
+
});
|
|
604
|
+
},
|
|
605
|
+
close() {
|
|
606
|
+
streamSession?.close();
|
|
607
|
+
streamSessionPromise?.then((session) => session.close()).catch(() => { });
|
|
608
|
+
streamSession = null;
|
|
609
|
+
streamSessionPromise = null;
|
|
610
|
+
pendingAudio = [];
|
|
611
|
+
streamingTranscriptTrace = [];
|
|
612
|
+
streamingTranscriptEvents = [];
|
|
613
|
+
streamingSpeechFinalTexts = [];
|
|
614
|
+
streamingStopRequested = false;
|
|
615
|
+
chunks.length = 0;
|
|
616
|
+
},
|
|
617
|
+
};
|
|
618
|
+
}
|
|
260
619
|
export function createSpeechRoutes(deps) {
|
|
261
620
|
const routes = new Hono();
|
|
621
|
+
const rejectCredentialGet = (c) => {
|
|
622
|
+
c.header("Allow", "POST");
|
|
623
|
+
return c.json({ error: "Use POST for speech credential broker routes" }, 405);
|
|
624
|
+
};
|
|
625
|
+
routes.get("/xai-client-key", rejectCredentialGet);
|
|
626
|
+
routes.post("/xai-client-key", (c) => {
|
|
627
|
+
if (deps.shareXaiSttApiKeyWithClients !== true) {
|
|
628
|
+
return c.json({ error: "Server xAI STT key borrowing is disabled" }, 403);
|
|
629
|
+
}
|
|
630
|
+
if (!deps.xaiSttApiKey) {
|
|
631
|
+
return c.json({ error: "Server xAI STT key is not configured" }, 404);
|
|
632
|
+
}
|
|
633
|
+
return c.json({ apiKey: deps.xaiSttApiKey });
|
|
634
|
+
});
|
|
635
|
+
routes.get("/xai-client-secret", rejectCredentialGet);
|
|
636
|
+
routes.post("/xai-client-secret", async (c) => {
|
|
637
|
+
if (!deps.xaiSttApiKey) {
|
|
638
|
+
return c.json({ error: "Server xAI STT key is not configured" }, 404);
|
|
639
|
+
}
|
|
640
|
+
try {
|
|
641
|
+
const secret = await createXaiClientSecret(deps.xaiSttApiKey);
|
|
642
|
+
return c.json({
|
|
643
|
+
clientSecret: secret.value,
|
|
644
|
+
...(secret.expiresAt ? { expiresAt: secret.expiresAt } : {}),
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
catch (err) {
|
|
648
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
649
|
+
return c.json({ error: message }, 502);
|
|
650
|
+
}
|
|
651
|
+
});
|
|
262
652
|
routes.post("/transcribe", async (c) => {
|
|
263
653
|
let rawBody;
|
|
264
654
|
try {
|
|
@@ -286,16 +676,69 @@ export function createSpeechRoutes(deps) {
|
|
|
286
676
|
return c.json({ error: message }, 500);
|
|
287
677
|
}
|
|
288
678
|
});
|
|
679
|
+
routes.post("/prewarm", async (c) => {
|
|
680
|
+
let rawBody;
|
|
681
|
+
try {
|
|
682
|
+
rawBody = await c.req.json();
|
|
683
|
+
}
|
|
684
|
+
catch {
|
|
685
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
686
|
+
}
|
|
687
|
+
const parsed = parsePrewarmBody(rawBody);
|
|
688
|
+
if (!parsed.ok) {
|
|
689
|
+
return c.json({ error: parsed.message }, 400);
|
|
690
|
+
}
|
|
691
|
+
const backend = deps.speechBackendRegistry.getBackend(parsed.backendId);
|
|
692
|
+
if (!backend) {
|
|
693
|
+
return c.json({ error: `Backend not available: ${parsed.backendId}` }, 404);
|
|
694
|
+
}
|
|
695
|
+
if (!supportsPrewarm(backend)) {
|
|
696
|
+
return c.json({ error: `Backend does not support prewarm: ${parsed.backendId}` }, 400);
|
|
697
|
+
}
|
|
698
|
+
logger.info({
|
|
699
|
+
component: "speech",
|
|
700
|
+
backendId: parsed.backendId,
|
|
701
|
+
model: parsed.options.model,
|
|
702
|
+
}, "Speech backend prewarm requested");
|
|
703
|
+
void backend
|
|
704
|
+
.prewarm(parsed.options)
|
|
705
|
+
.then(() => {
|
|
706
|
+
logger.info({
|
|
707
|
+
component: "speech",
|
|
708
|
+
backendId: parsed.backendId,
|
|
709
|
+
model: parsed.options.model,
|
|
710
|
+
}, "Speech backend prewarm completed");
|
|
711
|
+
})
|
|
712
|
+
.catch((err) => {
|
|
713
|
+
logger.warn({
|
|
714
|
+
component: "speech",
|
|
715
|
+
backendId: parsed.backendId,
|
|
716
|
+
model: parsed.options.model,
|
|
717
|
+
err,
|
|
718
|
+
}, "Speech backend prewarm failed");
|
|
719
|
+
});
|
|
720
|
+
return c.json({ ok: true });
|
|
721
|
+
});
|
|
289
722
|
routes.get("/ws", deps.upgradeWebSocket((_c) => {
|
|
290
723
|
const chunks = [];
|
|
291
724
|
let mimeType = DEFAULT_MIME_TYPE;
|
|
292
725
|
let backendId = null;
|
|
293
726
|
let context;
|
|
294
727
|
let streamSession = null;
|
|
728
|
+
// The upstream handshake (e.g. xAI returning transcript.created) can take
|
|
729
|
+
// a noticeable moment. We establish it concurrently rather than awaiting
|
|
730
|
+
// inside the serialized message chain, so incoming audio is never blocked
|
|
731
|
+
// behind it. Frames that arrive before the session is ready buffer here
|
|
732
|
+
// and flush in order the instant it resolves — otherwise a slow handshake
|
|
733
|
+
// produced a dead window where early speech was lost and no live partials
|
|
734
|
+
// were emitted.
|
|
735
|
+
let streamSessionPromise = null;
|
|
736
|
+
let pendingAudio = [];
|
|
295
737
|
let streamRequestId = null;
|
|
296
738
|
let streamStartedAt = "";
|
|
297
739
|
let streamStartedAtMs = 0;
|
|
298
740
|
let streamingTranscriptTrace = [];
|
|
741
|
+
let streamingTranscriptEvents = [];
|
|
299
742
|
let streamingSpeechFinalTexts = [];
|
|
300
743
|
let streamingStopRequested = false;
|
|
301
744
|
let messageChain = Promise.resolve();
|
|
@@ -304,12 +747,13 @@ export function createSpeechRoutes(deps) {
|
|
|
304
747
|
const msg = parseWsControlMessage(normalized.text);
|
|
305
748
|
if (!msg) {
|
|
306
749
|
if (normalized.buffer) {
|
|
750
|
+
chunks.push(normalized.buffer);
|
|
307
751
|
if (streamSession) {
|
|
308
|
-
chunks.push(normalized.buffer);
|
|
309
752
|
streamSession.sendAudio(normalized.buffer);
|
|
310
753
|
}
|
|
311
|
-
else {
|
|
312
|
-
|
|
754
|
+
else if (streamSessionPromise) {
|
|
755
|
+
// Session still handshaking: buffer in order, flushed on resolve.
|
|
756
|
+
pendingAudio.push(normalized.buffer);
|
|
313
757
|
}
|
|
314
758
|
}
|
|
315
759
|
else {
|
|
@@ -324,8 +768,11 @@ export function createSpeechRoutes(deps) {
|
|
|
324
768
|
context = parseTranscriptionContext(msg.context);
|
|
325
769
|
streamSession?.close();
|
|
326
770
|
streamSession = null;
|
|
771
|
+
streamSessionPromise = null;
|
|
772
|
+
pendingAudio = [];
|
|
327
773
|
streamRequestId = null;
|
|
328
774
|
streamingTranscriptTrace = [];
|
|
775
|
+
streamingTranscriptEvents = [];
|
|
329
776
|
streamingSpeechFinalTexts = [];
|
|
330
777
|
streamingStopRequested = false;
|
|
331
778
|
if (msg.streaming && backendId) {
|
|
@@ -350,7 +797,9 @@ export function createSpeechRoutes(deps) {
|
|
|
350
797
|
});
|
|
351
798
|
return;
|
|
352
799
|
}
|
|
353
|
-
const smartTurn = backend.capabilities.smartTurn === true
|
|
800
|
+
const smartTurn = backend.capabilities.smartTurn === true
|
|
801
|
+
? msg.smartTurn
|
|
802
|
+
: undefined;
|
|
354
803
|
streamRequestId = randomUUID();
|
|
355
804
|
streamStartedAtMs = Date.now();
|
|
356
805
|
streamStartedAt = new Date(streamStartedAtMs).toISOString();
|
|
@@ -371,7 +820,21 @@ export function createSpeechRoutes(deps) {
|
|
|
371
820
|
: null,
|
|
372
821
|
context,
|
|
373
822
|
}, "Speech streaming transcription started");
|
|
374
|
-
|
|
823
|
+
// Establish the backend session without blocking the WS message
|
|
824
|
+
// chain: the xAI handshake can take seconds, and awaiting it here
|
|
825
|
+
// would stall every audio frame behind it (head-of-line blocking),
|
|
826
|
+
// dropping the first seconds of speech. Instead, buffer incoming
|
|
827
|
+
// frames in `pendingAudio` and flush them in order once the session
|
|
828
|
+
// resolves.
|
|
829
|
+
// Tie every continuation to this request id. A new `start` can
|
|
830
|
+
// arrive before the handshake resolves; without this guard a late
|
|
831
|
+
// resolution would assign `streamSession`, flush the *new*
|
|
832
|
+
// request's buffered frames into the *old* session, and leak the
|
|
833
|
+
// superseded upstream socket.
|
|
834
|
+
const requestId = streamRequestId;
|
|
835
|
+
const isCurrent = () => streamRequestId === requestId;
|
|
836
|
+
streamSessionPromise = backend
|
|
837
|
+
.stream({
|
|
375
838
|
mimeType,
|
|
376
839
|
sampleRate,
|
|
377
840
|
encoding,
|
|
@@ -382,8 +845,11 @@ export function createSpeechRoutes(deps) {
|
|
|
382
845
|
smartTurnTimeoutMs: smartTurn?.timeoutMs,
|
|
383
846
|
}, {
|
|
384
847
|
onPartial: (event) => {
|
|
848
|
+
if (!isCurrent())
|
|
849
|
+
return;
|
|
385
850
|
streamingTranscriptTrace.push(formatStreamingTranscriptTraceLine(getPartialTraceKind(event), event.text));
|
|
386
|
-
|
|
851
|
+
streamingTranscriptEvents.push(toStreamingPartialTraceEvent(event));
|
|
852
|
+
if (event.speechFinal) {
|
|
387
853
|
streamingSpeechFinalTexts.push(event.text);
|
|
388
854
|
}
|
|
389
855
|
send(ws, {
|
|
@@ -391,9 +857,56 @@ export function createSpeechRoutes(deps) {
|
|
|
391
857
|
text: event.text,
|
|
392
858
|
isFinal: event.isFinal,
|
|
393
859
|
speechFinal: event.speechFinal,
|
|
860
|
+
start: event.start,
|
|
861
|
+
duration: event.duration,
|
|
394
862
|
words: event.words,
|
|
395
863
|
});
|
|
396
864
|
},
|
|
865
|
+
onError: (err) => {
|
|
866
|
+
if (!isCurrent() || streamingStopRequested)
|
|
867
|
+
return;
|
|
868
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
869
|
+
logger.warn({
|
|
870
|
+
component: "speech",
|
|
871
|
+
requestId,
|
|
872
|
+
source: "ws",
|
|
873
|
+
mode: "stream",
|
|
874
|
+
backendId,
|
|
875
|
+
}, `Speech streaming failed mid-session: ${message}`);
|
|
876
|
+
send(ws, { type: "error", message });
|
|
877
|
+
},
|
|
878
|
+
})
|
|
879
|
+
.then((session) => {
|
|
880
|
+
if (!isCurrent()) {
|
|
881
|
+
// Superseded by a newer start (or a stop/close): do not touch
|
|
882
|
+
// current buffers; just close this orphaned session.
|
|
883
|
+
session.close();
|
|
884
|
+
return session;
|
|
885
|
+
}
|
|
886
|
+
streamSession = session;
|
|
887
|
+
for (const buffered of pendingAudio) {
|
|
888
|
+
session.sendAudio(buffered);
|
|
889
|
+
}
|
|
890
|
+
pendingAudio = [];
|
|
891
|
+
return session;
|
|
892
|
+
});
|
|
893
|
+
streamSessionPromise.catch((err) => {
|
|
894
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
895
|
+
logger.error({
|
|
896
|
+
component: "speech",
|
|
897
|
+
requestId,
|
|
898
|
+
source: "ws",
|
|
899
|
+
mode: "stream",
|
|
900
|
+
backendId,
|
|
901
|
+
err,
|
|
902
|
+
}, "Speech streaming session failed to open");
|
|
903
|
+
if (!isCurrent())
|
|
904
|
+
return;
|
|
905
|
+
streamSessionPromise = null;
|
|
906
|
+
pendingAudio = [];
|
|
907
|
+
if (!streamingStopRequested) {
|
|
908
|
+
send(ws, { type: "error", message });
|
|
909
|
+
}
|
|
397
910
|
});
|
|
398
911
|
}
|
|
399
912
|
return;
|
|
@@ -404,11 +917,15 @@ export function createSpeechRoutes(deps) {
|
|
|
404
917
|
send(ws, { type: "error", message: "No backend selected" });
|
|
405
918
|
return;
|
|
406
919
|
}
|
|
407
|
-
if (
|
|
920
|
+
if (streamSessionPromise && streamRequestId) {
|
|
408
921
|
try {
|
|
409
922
|
streamingStopRequested = true;
|
|
410
|
-
|
|
923
|
+
// The session may still be handshaking; wait for it (and the
|
|
924
|
+
// in-order flush of any buffered frames) before finishing.
|
|
925
|
+
const session = await streamSessionPromise;
|
|
926
|
+
const done = await session.finish();
|
|
411
927
|
streamingTranscriptTrace.push(formatStreamingTranscriptTraceLine("done", done.text));
|
|
928
|
+
streamingTranscriptEvents.push(toStreamingDoneTraceEvent(done));
|
|
412
929
|
const transcript = done.text.trim() ||
|
|
413
930
|
joinStreamingSpeechFinals(streamingSpeechFinalTexts);
|
|
414
931
|
const retention = await persistStreamingTranscription(deps, {
|
|
@@ -418,6 +935,7 @@ export function createSpeechRoutes(deps) {
|
|
|
418
935
|
mimeType,
|
|
419
936
|
transcript,
|
|
420
937
|
streamingTranscriptTrace,
|
|
938
|
+
streamingTranscriptEvents,
|
|
421
939
|
startedAt: streamStartedAt,
|
|
422
940
|
startedAtMs: streamStartedAtMs,
|
|
423
941
|
context,
|
|
@@ -444,8 +962,11 @@ export function createSpeechRoutes(deps) {
|
|
|
444
962
|
}
|
|
445
963
|
finally {
|
|
446
964
|
streamSession = null;
|
|
965
|
+
streamSessionPromise = null;
|
|
966
|
+
pendingAudio = [];
|
|
447
967
|
streamRequestId = null;
|
|
448
968
|
streamingTranscriptTrace = [];
|
|
969
|
+
streamingTranscriptEvents = [];
|
|
449
970
|
streamingSpeechFinalTexts = [];
|
|
450
971
|
streamingStopRequested = false;
|
|
451
972
|
}
|
|
@@ -485,8 +1006,16 @@ export function createSpeechRoutes(deps) {
|
|
|
485
1006
|
},
|
|
486
1007
|
onClose() {
|
|
487
1008
|
streamSession?.close();
|
|
1009
|
+
// A still-handshaking session must be closed once it resolves, or it
|
|
1010
|
+
// leaks an open xAI socket after the client disconnects.
|
|
1011
|
+
streamSessionPromise
|
|
1012
|
+
?.then((session) => session.close())
|
|
1013
|
+
.catch(() => { });
|
|
488
1014
|
streamSession = null;
|
|
1015
|
+
streamSessionPromise = null;
|
|
1016
|
+
pendingAudio = [];
|
|
489
1017
|
streamingTranscriptTrace = [];
|
|
1018
|
+
streamingTranscriptEvents = [];
|
|
490
1019
|
streamingSpeechFinalTexts = [];
|
|
491
1020
|
streamingStopRequested = false;
|
|
492
1021
|
chunks.length = 0;
|