@openchamber/web 1.21.1 → 1.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{CodeMirrorCommentWidgets-BGj8TJxW.js → CodeMirrorCommentWidgets-BO_2OW4E.js} +1 -1
- package/dist/assets/DiffView-CNnDxRmO.js +4 -0
- package/dist/assets/DirtyBranchSwitchDialog-jADfXQnR.js +1 -0
- package/dist/assets/FilesView-8wdiG2mj.js +17 -0
- package/dist/assets/GitView-Cv2xH-S6.js +6 -0
- package/dist/assets/{JsonTreeView-CggOsLot.js → JsonTreeView-DUiIpERC.js} +1 -1
- package/dist/assets/LinearIssuesView-CoZ7pQN5.js +1 -0
- package/dist/assets/MarkdownImageGallery-DffjmciG.js +1 -0
- package/dist/assets/MarkdownRendererImpl-DxqdYDAx.js +12 -0
- package/dist/assets/OnboardingScreen-CTZe6HZn.js +1 -0
- package/dist/assets/{PatchDiff-DJYMUiXA.js → PatchDiff-BymkP9JA.js} +1 -1
- package/dist/assets/{PierreDiffViewer-CY2bx_SB.js → PierreDiffViewer-BvwtCxW4.js} +3 -3
- package/dist/assets/{PlanView-PkiOY_9H.js → PlanView-C1qvAm7m.js} +3 -3
- package/dist/assets/SettingsView-xGONHFGS.js +28 -0
- package/dist/assets/{SettingsWindow-oyOm2fHR.js → SettingsWindow-COzgfFxM.js} +1 -1
- package/dist/assets/{ToolOutputDialog-lKyeQTPL.js → ToolOutputDialog-Dlhh_-oe.js} +6 -6
- package/dist/assets/ToolPartDiffPreview-b9joNtXH.js +8 -0
- package/dist/assets/{VirtualizedFileDiff-BP7ebDFF.js → VirtualizedFileDiff-vqW3KKo5.js} +1 -1
- package/dist/assets/WalkthroughView-D-HFgdmM.js +4 -0
- package/dist/assets/{computeVirtualFileMetrics-CZ0xPeaT.js → computeVirtualFileMetrics-DUnyszhW.js} +1 -1
- package/dist/assets/{contextPanelEmbeddedChat-C9abMBTb.js → contextPanelEmbeddedChat-CV-DwAiX.js} +1 -1
- package/dist/assets/{de-CEoCz3j6.js → de-Cv_4FoXm.js} +6 -5
- package/dist/assets/es-BIWNEbnS.js +16 -0
- package/dist/assets/{fr-CS7Csln9.js → fr-SD3OfMHJ.js} +6 -5
- package/dist/assets/index-CHUT_bDS.css +1 -0
- package/dist/assets/index-DDInLQDd.js +40 -0
- package/dist/assets/{index-CaPAjwXQ.js → index-DLiD86ge.js} +1 -1
- package/dist/assets/{isDiffPlainText-ZBvDxhVB.js → isDiffPlainText-TNageFjy.js} +1 -1
- package/dist/assets/{isFilePlainText-DiLRrkJr.js → isFilePlainText-JPmZOYSp.js} +1 -1
- package/dist/assets/{ja-vnwqLcx6.js → ja-D7I9HofF.js} +7 -6
- package/dist/assets/{ko-CXuSfZv5.js → ko-BsVJM_PQ.js} +7 -6
- package/dist/assets/{main-D5RWr6sJ.js → main-DCB4JgVe.js} +2 -2
- package/dist/assets/main-De8Z5w49.js +928 -0
- package/dist/assets/markdownCore-BoQVG5-a.js +3 -0
- package/dist/assets/{miniChat-CqR3icsk.js → miniChat-BtV7N5OF.js} +2 -2
- package/dist/assets/{mobile-RN_UTTlB.js → mobile-DZV_sfX7.js} +2 -2
- package/dist/assets/{patchFileDiff-CjRR5ESs.js → patchFileDiff-Chmiz6hq.js} +4 -4
- package/dist/assets/{pl-BJxry0Mi.js → pl-XR9Bs8Be.js} +6 -5
- package/dist/assets/pt-BR-Due4be8g.js +16 -0
- package/dist/assets/{renderElectronMiniChatApp-1wC94fQK.js → renderElectronMiniChatApp-8tXADjfl.js} +2 -2
- package/dist/assets/renderMobileApp-Cji7Hma5.js +25 -0
- package/dist/assets/runtimeEndpointReset-gWt3Lb5D.js +16 -0
- package/dist/assets/scheduledTasksApi-9e-UX6im.js +1 -0
- package/dist/assets/{shikiHighlight-fGmFkxAM.js → shikiHighlight-CRpCl7UT.js} +1 -1
- package/dist/assets/tr-DBJcAv4y.js +7 -0
- package/dist/assets/uk-COYh2BaN.js +16 -0
- package/dist/assets/{useAppFontEffects-KP8_yiGW.js → useAppFontEffects-CCgvcQ6u.js} +178 -170
- package/dist/assets/useInlineCommentController-BkfXnjNZ.js +2 -0
- package/dist/assets/useRootScrollLock-KzOUytpn.js +1 -0
- package/dist/assets/{vendor-codemirror-language-data-DrTPkHl4.js → vendor-codemirror-language-data-BxpoC5Fp.js} +2 -2
- package/dist/assets/vendor-zod-DVWEh-IS.js +39 -0
- package/dist/assets/{web-components-DOXvU-tB.js → web-components-B6QgbmTo.js} +4 -4
- package/dist/assets/zh-CN-Cjk6lzhc.js +16 -0
- package/dist/assets/{zh-TW-Dv8yyhN1.js → zh-TW-Dk0dOg03.js} +6 -5
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +4 -4
- package/dist/mobile.html +4 -4
- package/package.json +2 -2
- package/server/index.js +35 -4
- package/server/lib/agent-tool/runtime.js +2 -19
- package/server/lib/dev-tunnel/DOCUMENTATION.md +13 -4
- package/server/lib/dev-tunnel/runtime.js +4 -4
- package/server/lib/dev-tunnel/tunnel.test.js +20 -0
- package/server/lib/dictation/DOCUMENTATION.md +19 -6
- package/server/lib/dictation/local/model-catalog.js +220 -0
- package/server/lib/dictation/local/model-catalog.test.js +42 -0
- package/server/lib/dictation/local/sherpa-tts.js +41 -20
- package/server/lib/dictation/local/worker-process.js +2 -0
- package/server/lib/dictation/runtime.js +4 -0
- package/server/lib/dictation/service.js +27 -4
- package/server/lib/fs/DOCUMENTATION.md +4 -0
- package/server/lib/fs/routes.js +129 -0
- package/server/lib/fs/routes.test.js +219 -0
- package/server/lib/git/DOCUMENTATION.md +3 -1
- package/server/lib/git/routes.js +16 -0
- package/server/lib/git/service.js +97 -17
- package/server/lib/git/service.test.js +153 -0
- package/server/lib/linear/DOCUMENTATION.md +97 -0
- package/server/lib/linear/OAUTH-BROKER-HANDOFF.md +91 -0
- package/server/lib/linear/auth.js +436 -0
- package/server/lib/linear/auth.test.js +242 -0
- package/server/lib/linear/client.js +191 -0
- package/server/lib/linear/index.js +61 -0
- package/server/lib/linear/issues.js +499 -0
- package/server/lib/linear/issues.test.js +512 -0
- package/server/lib/linear/mapping.js +188 -0
- package/server/lib/linear/mapping.test.js +147 -0
- package/server/lib/linear/oauth.js +345 -0
- package/server/lib/linear/oauth.test.js +166 -0
- package/server/lib/linear/parse.js +23 -0
- package/server/lib/linear/routes.js +432 -0
- package/server/lib/linear/routes.test.js +661 -0
- package/server/lib/linear/status-runtime.js +64 -0
- package/server/lib/linear/status-runtime.test.js +167 -0
- package/server/lib/linear/status.js +280 -0
- package/server/lib/linear/status.test.js +271 -0
- package/server/lib/linear/teams.js +72 -0
- package/server/lib/linear/teams.test.js +94 -0
- package/server/lib/mcp-reconnect/DOCUMENTATION.md +55 -0
- package/server/lib/mcp-reconnect/runtime.js +122 -0
- package/server/lib/mcp-reconnect/runtime.test.js +140 -0
- package/server/lib/message-queue/DOCUMENTATION.md +148 -0
- package/server/lib/message-queue/runtime.js +818 -0
- package/server/lib/message-queue/runtime.test.js +426 -0
- package/server/lib/openchamber-sessions/routes.js +102 -0
- package/server/lib/openchamber-sessions/routes.test.js +88 -0
- package/server/lib/opencode/DOCUMENTATION.md +5 -1
- package/server/lib/opencode/core-routes.js +1 -0
- package/server/lib/opencode/feature-routes-runtime.js +5 -0
- package/server/lib/opencode/managed-plugin-config.js +35 -0
- package/server/lib/opencode/settings-runtime.js +2 -2
- package/server/lib/opencode/settings-runtime.test.js +29 -0
- package/server/lib/opencode/shutdown-runtime.js +2 -0
- package/server/lib/opencode/static-routes-runtime.js +3 -3
- package/server/lib/projects/project-config.js +33 -5
- package/server/lib/projects/project-config.test.js +85 -0
- package/server/lib/quota/DOCUMENTATION.md +2 -1
- package/server/lib/quota/credentials/providers.js +4 -0
- package/server/lib/quota/credentials/store.js +1 -1
- package/server/lib/quota/credentials/store.test.js +4 -4
- package/server/lib/quota/providers/exe-dev.js +75 -0
- package/server/lib/quota/providers/exe-dev.test.js +47 -0
- package/server/lib/quota/providers/index.js +7 -0
- package/server/lib/quota/providers/opencode-go.js +1 -0
- package/server/lib/quota/providers/opencode-go.test.js +5 -1
- package/server/lib/quota/routes.js +2 -0
- package/server/lib/relay/DOCUMENTATION.md +1 -1
- package/server/lib/relay/tunnel-host.js +3 -1
- package/server/lib/relay/tunnel-host.test.js +9 -1
- package/server/lib/scheduled-tasks/DOCUMENTATION.md +7 -0
- package/server/lib/security/request-security.js +21 -6
- package/server/lib/security/request-security.test.js +42 -8
- package/server/lib/session-assist/runtime.js +1 -0
- package/server/lib/session-goal/create.js +3 -1
- package/server/lib/session-goal/runtime.js +1 -0
- package/server/lib/small-model/DOCUMENTATION.md +4 -0
- package/server/lib/small-model/call.js +8 -2
- package/server/lib/small-model/call.test.js +23 -0
- package/server/lib/small-model/index.js +2 -1
- package/server/lib/small-model/routes.js +2 -1
- package/server/lib/system-prompt/runtime.js +2 -21
- package/server/lib/terminal/runtime.js +30 -7
- package/server/lib/tts/DOCUMENTATION.md +1 -0
- package/server/lib/tts/language-detect.js +210 -0
- package/server/lib/tts/language-detect.test.js +76 -0
- package/server/lib/tts/routes.js +23 -1
- package/server/lib/tts/routes.test.js +26 -0
- package/server/lib/ui-auth/ui-auth.js +4 -1
- package/server/lib/ui-auth/ui-auth.test.js +16 -0
- package/server/lib/walkthrough/index.js +1 -0
- package/dist/assets/CommitSection-DwGiXyjf.js +0 -1
- package/dist/assets/DiffView-Db6bjVv1.js +0 -4
- package/dist/assets/FilesView-DQOa7Lgz.js +0 -17
- package/dist/assets/GitView-CHzJxTi0.js +0 -6
- package/dist/assets/MarkdownImageGallery-DoZpaHev.js +0 -1
- package/dist/assets/MarkdownRendererImpl-B5Y5xCOz.js +0 -12
- package/dist/assets/OnboardingScreen-C98d69Fp.js +0 -1
- package/dist/assets/SettingsView-D-K3ELCM.js +0 -28
- package/dist/assets/ToolPartDiffPreview-C7kBQNAA.js +0 -8
- package/dist/assets/WalkthroughView-MuJodAHD.js +0 -4
- package/dist/assets/es-DwyXCqaL.js +0 -15
- package/dist/assets/index-CUKcHnUA.css +0 -1
- package/dist/assets/index-DIvDEKE-.js +0 -7
- package/dist/assets/main-DLlfDjQ_.js +0 -926
- package/dist/assets/markdownCore-CcTcLsQF.js +0 -3
- package/dist/assets/pt-BR-DxLmkhdv.js +0 -15
- package/dist/assets/renderMobileApp-ltva2Plg.js +0 -25
- package/dist/assets/runtimeEndpointReset-D6SmNZaP.js +0 -15
- package/dist/assets/scheduledTasksApi-mjMDet_H.js +0 -1
- package/dist/assets/tr-5Mk_hQ2Q.js +0 -6
- package/dist/assets/uk-ClgQjmlw.js +0 -15
- package/dist/assets/useInlineCommentController-HIjtuhxD.js +0 -2
- package/dist/assets/useRootScrollLock-BSiQ5F75.js +0 -1
- package/dist/assets/vendor-zod-BLfBSgBh.js +0 -39
- package/dist/assets/zh-CN-Ba6y8H-i.js +0 -15
package/dist/index.html
CHANGED
|
@@ -509,16 +509,16 @@
|
|
|
509
509
|
pointer-events: none;
|
|
510
510
|
}
|
|
511
511
|
</style>
|
|
512
|
-
<script type="module" crossorigin src="/assets/main-
|
|
512
|
+
<script type="module" crossorigin src="/assets/main-DCB4JgVe.js"></script>
|
|
513
513
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
514
514
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
515
515
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
516
516
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
517
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-
|
|
517
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-DVWEh-IS.js">
|
|
518
518
|
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.js">
|
|
519
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
520
|
-
<link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-
|
|
521
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
519
|
+
<link rel="modulepreload" crossorigin href="/assets/index-DDInLQDd.js">
|
|
520
|
+
<link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-CV-DwAiX.js">
|
|
521
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CHUT_bDS.css">
|
|
522
522
|
</head>
|
|
523
523
|
<body class="h-full bg-background text-foreground">
|
|
524
524
|
<div id="root" class="h-full">
|
package/dist/mini-chat.html
CHANGED
|
@@ -74,15 +74,15 @@
|
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
76
|
|
|
77
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
77
|
+
<script type="module" crossorigin src="/assets/miniChat-BtV7N5OF.js"></script>
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
82
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-DVWEh-IS.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.js">
|
|
84
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
85
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
84
|
+
<link rel="modulepreload" crossorigin href="/assets/index-DDInLQDd.js">
|
|
85
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CHUT_bDS.css">
|
|
86
86
|
</head>
|
|
87
87
|
<body class="h-full bg-background text-foreground">
|
|
88
88
|
<div id="root" class="h-full">
|
package/dist/mobile.html
CHANGED
|
@@ -63,15 +63,15 @@
|
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
66
|
+
<script type="module" crossorigin src="/assets/mobile-DZV_sfX7.js"></script>
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
70
70
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-DVWEh-IS.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.js">
|
|
73
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
74
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/index-DDInLQDd.js">
|
|
74
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CHUT_bDS.css">
|
|
75
75
|
</head>
|
|
76
76
|
<body class="h-full bg-background text-foreground">
|
|
77
77
|
<div id="root" class="h-full"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openchamber/web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./server/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@clack/prompts": "^1.1.0",
|
|
27
27
|
"@octokit/rest": "^22.0.1",
|
|
28
|
-
"@opencode-ai/sdk": "1.18.
|
|
28
|
+
"@opencode-ai/sdk": "1.18.28",
|
|
29
29
|
"@simplewebauthn/server": "13.3.1",
|
|
30
30
|
"bun-pty": "^0.4.5",
|
|
31
31
|
"compression": "^1.8.1",
|
package/server/index.js
CHANGED
|
@@ -77,6 +77,7 @@ import { createOpenCodeWatcherRuntime } from './lib/opencode/watcher.js';
|
|
|
77
77
|
import { createSessionAssistRuntime } from './lib/session-assist/runtime.js';
|
|
78
78
|
import { createSessionGoalRuntime } from './lib/session-goal/runtime.js';
|
|
79
79
|
import { createContextObligatoryRuntime } from './lib/context-obligatory/runtime.js';
|
|
80
|
+
import { createLinearSessionStatusRuntime } from './lib/linear/status-runtime.js';
|
|
80
81
|
import { createSessionKnowledgeRuntime } from './lib/session-knowledge/runtime.js';
|
|
81
82
|
import { createScheduledTasksRuntime } from './lib/scheduled-tasks/runtime.js';
|
|
82
83
|
import { createServerStartupRuntime } from './lib/opencode/server-startup-runtime.js';
|
|
@@ -90,6 +91,7 @@ import { createPushRuntime } from './lib/notifications/push-runtime.js';
|
|
|
90
91
|
import { createApnsRuntime } from './lib/notifications/apns-runtime.js';
|
|
91
92
|
import { createNotificationTemplateRuntime } from './lib/notifications/template-runtime.js';
|
|
92
93
|
import { createPermissionAutoAcceptRuntime } from './lib/permission-auto-accept/runtime.js';
|
|
94
|
+
import { createMessageQueueRuntime } from './lib/message-queue/runtime.js';
|
|
93
95
|
import { createGracefulShutdownRuntime } from './lib/opencode/shutdown-runtime.js';
|
|
94
96
|
import { createProjectConfigRuntime } from './lib/projects/project-config.js';
|
|
95
97
|
import { createProjectContextRuntime } from './lib/project-context/runtime.js';
|
|
@@ -109,6 +111,7 @@ import { createDevServerScanner } from './lib/dev-servers/routes.js';
|
|
|
109
111
|
import { createDevTunnelRuntime } from './lib/dev-tunnel/runtime.js';
|
|
110
112
|
import { registerBrowserControlRoutes } from './lib/browser-control/routes.js';
|
|
111
113
|
import { createSystemPromptRuntime } from './lib/system-prompt/runtime.js';
|
|
114
|
+
import { createMcpReconnectRuntime } from './lib/mcp-reconnect/runtime.js';
|
|
112
115
|
import { createOpenChamberSessionService } from './lib/openchamber-sessions/routes.js';
|
|
113
116
|
import { createScheduledTaskService } from './lib/scheduled-tasks/service.js';
|
|
114
117
|
import { createOpenChamberControlService } from './lib/openchamber-control/service.js';
|
|
@@ -283,6 +286,7 @@ const readCustomThemesFromDisk = (...args) => themeRuntime.readCustomThemesFromD
|
|
|
283
286
|
let notificationTemplateRuntime = null;
|
|
284
287
|
let agentToolRuntime = null;
|
|
285
288
|
let systemPromptRuntime = null;
|
|
289
|
+
let mcpReconnectRuntime = null;
|
|
286
290
|
|
|
287
291
|
const createTimeoutSignal = (...args) => notificationTemplateRuntime.createTimeoutSignal(...args);
|
|
288
292
|
const formatProjectLabel = (...args) => notificationTemplateRuntime.formatProjectLabel(...args);
|
|
@@ -856,6 +860,8 @@ const contextObligatoryRuntime = createContextObligatoryRuntime({
|
|
|
856
860
|
sessionKnowledgeRuntime,
|
|
857
861
|
});
|
|
858
862
|
|
|
863
|
+
const linearSessionStatusRuntime = createLinearSessionStatusRuntime();
|
|
864
|
+
|
|
859
865
|
const globalMessageStreamHub = createGlobalMessageStreamHub({
|
|
860
866
|
buildOpenCodeUrl,
|
|
861
867
|
getOpenCodeAuthHeaders,
|
|
@@ -875,6 +881,19 @@ notificationTriggerRuntime.setGetIsSessionAutoAccepting(
|
|
|
875
881
|
(sessionId, directory) => permissionAutoAcceptRuntime.isSessionAutoAccepting(sessionId, directory),
|
|
876
882
|
);
|
|
877
883
|
|
|
884
|
+
// Queued follow-up messages are delivered by the server so a closed tab or a
|
|
885
|
+
// dropped connection no longer strands them (VS Code keeps its UI-side queue).
|
|
886
|
+
const messageQueueRuntime = createMessageQueueRuntime({
|
|
887
|
+
globalEventHub: globalMessageStreamHub,
|
|
888
|
+
buildOpenCodeUrl,
|
|
889
|
+
getOpenCodeAuthHeaders,
|
|
890
|
+
sessionKnowledgeRuntime,
|
|
891
|
+
broadcastGlobalUiEvent,
|
|
892
|
+
onPromptSent: (sessionId) => sessionRuntime.markUserMessageSent(sessionId),
|
|
893
|
+
dataDir: OPENCHAMBER_DATA_DIR,
|
|
894
|
+
});
|
|
895
|
+
messageQueueRuntime.start();
|
|
896
|
+
|
|
878
897
|
const openCodeWatcherRuntime = createOpenCodeWatcherRuntime({
|
|
879
898
|
waitForOpenCodePort: (...args) => waitForOpenCodePort(...args),
|
|
880
899
|
buildOpenCodeUrl,
|
|
@@ -901,6 +920,7 @@ globalMessageStreamHub.subscribeEvent((event) => {
|
|
|
901
920
|
sessionAssistRuntime.processPayload(payload, directory);
|
|
902
921
|
sessionGoalRuntime.processPayload(payload, directory);
|
|
903
922
|
contextObligatoryRuntime.processPayload(payload, directory);
|
|
923
|
+
linearSessionStatusRuntime.processPayload(payload);
|
|
904
924
|
});
|
|
905
925
|
|
|
906
926
|
const processForwardedEventPayload = (payload, emitSyntheticEvent) => {
|
|
@@ -1204,11 +1224,15 @@ const openCodeLifecycleRuntime = createOpenCodeLifecycleRuntime({
|
|
|
1204
1224
|
const managedEnv = includeControl || includeWeb || includeMemory
|
|
1205
1225
|
? await (agentToolRuntime?.prepareManagedOpenCodeEnv({ includeControl, includeWeb, includeMemory }) || {})
|
|
1206
1226
|
: {};
|
|
1207
|
-
if (settings?.optimizeSystemPrompt !== true) return managedEnv;
|
|
1208
1227
|
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1228
|
+
// Each managed plugin appends itself to the config the previous one produced.
|
|
1229
|
+
let configContent = managedEnv.OPENCODE_CONFIG_CONTENT ?? process.env.OPENCODE_CONFIG_CONTENT;
|
|
1230
|
+
if (settings?.optimizeSystemPrompt === true) {
|
|
1231
|
+
({ OPENCODE_CONFIG_CONTENT: configContent } = await systemPromptRuntime.prepareManagedOpenCodeEnv(configContent));
|
|
1232
|
+
}
|
|
1233
|
+
// Always on for managed OpenCode: it only retries servers OpenCode gave up on.
|
|
1234
|
+
const mcpReconnectEnv = await mcpReconnectRuntime.prepareManagedOpenCodeEnv(configContent);
|
|
1235
|
+
return { ...managedEnv, ...mcpReconnectEnv };
|
|
1212
1236
|
},
|
|
1213
1237
|
});
|
|
1214
1238
|
|
|
@@ -1423,6 +1447,7 @@ const gracefulShutdownRuntime = createGracefulShutdownRuntime({
|
|
|
1423
1447
|
sessionAssistRuntime,
|
|
1424
1448
|
sessionGoalRuntime,
|
|
1425
1449
|
contextObligatoryRuntime,
|
|
1450
|
+
messageQueueRuntime,
|
|
1426
1451
|
sessionRuntime,
|
|
1427
1452
|
getHealthCheckInterval: () => healthCheckInterval,
|
|
1428
1453
|
clearHealthCheckInterval: (value) => clearInterval(value),
|
|
@@ -1481,6 +1506,11 @@ async function main(options = {}) {
|
|
|
1481
1506
|
path,
|
|
1482
1507
|
dataDir: OPENCHAMBER_DATA_DIR,
|
|
1483
1508
|
});
|
|
1509
|
+
mcpReconnectRuntime = createMcpReconnectRuntime({
|
|
1510
|
+
fsPromises,
|
|
1511
|
+
path,
|
|
1512
|
+
dataDir: OPENCHAMBER_DATA_DIR,
|
|
1513
|
+
});
|
|
1484
1514
|
|
|
1485
1515
|
// Pairing transports advertised to the create-device dialog. LAN reachability is
|
|
1486
1516
|
// derived from the SERVER's actual bind (a wildcard bind → the machine's LAN IP;
|
|
@@ -1910,6 +1940,7 @@ async function main(options = {}) {
|
|
|
1910
1940
|
getOpenChamberEventClients: () => uiOpenChamberEventClients,
|
|
1911
1941
|
writeSseEvent,
|
|
1912
1942
|
permissionAutoAcceptRuntime,
|
|
1943
|
+
messageQueueRuntime,
|
|
1913
1944
|
});
|
|
1914
1945
|
|
|
1915
1946
|
const startupPipelineResult = await startupPipelineRuntime.run({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { parse as parseJsonc } from 'jsonc-parser';
|
|
2
1
|
import { pathToFileURL } from 'node:url';
|
|
2
|
+
import { appendManagedPlugin } from '../opencode/managed-plugin-config.js';
|
|
3
3
|
import {
|
|
4
4
|
OPENCHAMBER_AGENT_TOOL_ACTION_DEFINITIONS,
|
|
5
5
|
OPENCHAMBER_AGENT_TOOL_ACTIONS,
|
|
@@ -252,23 +252,6 @@ ${entries.join('')} },
|
|
|
252
252
|
`;
|
|
253
253
|
};
|
|
254
254
|
|
|
255
|
-
const mergePluginConfig = (rawConfig, pluginUrl) => {
|
|
256
|
-
const errors = [];
|
|
257
|
-
const parsed = asNonEmptyString(rawConfig) ? parseJsonc(rawConfig, errors, { allowTrailingComma: true }) : {};
|
|
258
|
-
if (errors.length > 0 || !parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
259
|
-
throw new Error('OPENCODE_CONFIG_CONTENT must contain a valid JSON object before OpenChamber can inject its managed tool');
|
|
260
|
-
}
|
|
261
|
-
if (parsed.plugin !== undefined && !Array.isArray(parsed.plugin)) {
|
|
262
|
-
throw new Error('OPENCODE_CONFIG_CONTENT plugin must be an array before OpenChamber can inject its managed tool');
|
|
263
|
-
}
|
|
264
|
-
const configured = Array.isArray(parsed.plugin) ? parsed.plugin : [];
|
|
265
|
-
parsed.plugin = [
|
|
266
|
-
...configured.filter((value) => value !== pluginUrl && (!Array.isArray(value) || value[0] !== pluginUrl)),
|
|
267
|
-
pluginUrl,
|
|
268
|
-
];
|
|
269
|
-
return JSON.stringify(parsed);
|
|
270
|
-
};
|
|
271
|
-
|
|
272
255
|
export const createAgentToolRuntime = (dependencies) => {
|
|
273
256
|
const {
|
|
274
257
|
crypto,
|
|
@@ -296,7 +279,7 @@ export const createAgentToolRuntime = (dependencies) => {
|
|
|
296
279
|
activeToken = crypto.randomBytes(32).toString('base64url');
|
|
297
280
|
const pluginUrl = pathToFileURL(pluginPath).href;
|
|
298
281
|
return {
|
|
299
|
-
OPENCODE_CONFIG_CONTENT:
|
|
282
|
+
OPENCODE_CONFIG_CONTENT: appendManagedPlugin(env.OPENCODE_CONFIG_CONTENT, pluginUrl, 'managed tool'),
|
|
300
283
|
OPENCHAMBER_AGENT_TOOL_URL: `http://127.0.0.1:${port}/api/openchamber/agent-tool`,
|
|
301
284
|
OPENCHAMBER_AGENT_TOOL_TOKEN: activeToken,
|
|
302
285
|
};
|
|
@@ -20,7 +20,13 @@ and what made it fragile per framework.
|
|
|
20
20
|
- `client.js` is the local end: it binds a loopback listener on the user's
|
|
21
21
|
machine and pipes each accepted connection through one WebSocket. It lives in
|
|
22
22
|
this package because it needs a WebSocket client the package already depends
|
|
23
|
-
on; the desktop shell drives it over IPC
|
|
23
|
+
on; the desktop shell drives it over IPC for directly reachable HTTP(S)
|
|
24
|
+
runtimes.
|
|
25
|
+
- Relay-only runtimes use `packages/electron/relay-dev-tunnel.mjs` for the local
|
|
26
|
+
listener. Each accepted connection gets an Electron `MessagePort`; the trusted
|
|
27
|
+
renderer carries its bytes through the active E2EE relay. This keeps relay
|
|
28
|
+
credentials and encryption in their existing renderer owner instead of
|
|
29
|
+
duplicating them in Electron main.
|
|
24
30
|
- Port discovery is not owned here. `runtime.js` is given the reachable set by
|
|
25
31
|
the same dev-server discovery the user's own list is built from.
|
|
26
32
|
- The browser panel decides when to tunnel; this module never chooses a target.
|
|
@@ -40,9 +46,12 @@ and what made it fragile per framework.
|
|
|
40
46
|
usual origin allowlist applies unchanged. That check is a CSRF defence: a
|
|
41
47
|
hostile page can make a browser open a WebSocket carrying ambient cookies,
|
|
42
48
|
and the origin is what exposes it.
|
|
43
|
-
- With no `Origin` the request must carry client-token auth
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
- With no `Origin` the request must carry client-token auth or a short-lived
|
|
50
|
+
URL token. The bearer case is the desktop main process. The URL-token case
|
|
51
|
+
is the trusted renderer carrying the socket through the E2EE relay.
|
|
52
|
+
- Through the E2EE relay, the trusted renderer mints a short-lived URL token
|
|
53
|
+
and includes it in the virtual WebSocket URL. The relay host and URL-token
|
|
54
|
+
allowlists accept exactly `/api/dev-tunnel`, not subpaths.
|
|
46
55
|
- Concurrency is capped per host, not per page, because one page load opens
|
|
47
56
|
many sockets.
|
|
48
57
|
- A connection that cannot be established fails the socket rather than holding
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
* - With an `Origin` header, the request came from a browser context and the
|
|
22
22
|
* usual origin check applies unchanged.
|
|
23
|
-
* - With no `Origin`, the request must carry client-token auth
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* - With no `Origin`, the request must carry client-token auth or a short-lived
|
|
24
|
+
* URL token. The URL-token case is used only by the trusted renderer through
|
|
25
|
+
* the E2EE relay; the UI-auth allowlist limits it to this exact path.
|
|
26
26
|
*/
|
|
27
27
|
import net from 'node:net';
|
|
28
28
|
import { WebSocketServer } from 'ws';
|
|
@@ -133,7 +133,7 @@ export function createDevTunnelRuntime({
|
|
|
133
133
|
void (async () => {
|
|
134
134
|
try {
|
|
135
135
|
if (uiAuthController?.enabled) {
|
|
136
|
-
const auth = await uiAuthController.resolveAuthContext(req, null, { allowUrlToken:
|
|
136
|
+
const auth = await uiAuthController.resolveAuthContext(req, null, { allowUrlToken: true });
|
|
137
137
|
if (!auth) {
|
|
138
138
|
rejectWebSocketUpgrade(socket, 401, 'UI authentication required');
|
|
139
139
|
return;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { afterEach, describe, expect, test } from 'bun:test';
|
|
2
2
|
import http from 'node:http';
|
|
3
3
|
import net from 'node:net';
|
|
4
|
+
import WebSocket from 'ws';
|
|
4
5
|
|
|
5
6
|
import { createDevTunnelClient } from './client.js';
|
|
6
7
|
import { createDevTunnelRuntime, isDevTunnelPath } from './runtime.js';
|
|
@@ -228,6 +229,12 @@ describe('dev tunnel authentication', () => {
|
|
|
228
229
|
enabled: true,
|
|
229
230
|
resolveAuthContext: async () => ({ type: 'session' }),
|
|
230
231
|
};
|
|
232
|
+
const urlTokenAuth = {
|
|
233
|
+
enabled: true,
|
|
234
|
+
resolveAuthContext: async (req, _res, options) => (
|
|
235
|
+
options?.allowUrlToken === true && req.url.includes('oc_url_token=good') ? { type: 'client', token: 'url:authenticated' } : null
|
|
236
|
+
),
|
|
237
|
+
};
|
|
231
238
|
|
|
232
239
|
test('accepts a bearer-authenticated client that sends no origin', async () => {
|
|
233
240
|
const devPort = await startDevServer((_req, res) => res.end('ok'));
|
|
@@ -243,6 +250,19 @@ describe('dev tunnel authentication', () => {
|
|
|
243
250
|
expect((await httpGet(localPort, '/')).body).toBe('ok');
|
|
244
251
|
});
|
|
245
252
|
|
|
253
|
+
test('accepts a URL-token client carried by the E2EE relay', async () => {
|
|
254
|
+
const devPort = await startDevServer((_req, res) => res.end('relay-ok'));
|
|
255
|
+
const host = await startHost({ allowedPorts: [devPort], auth: urlTokenAuth });
|
|
256
|
+
|
|
257
|
+
const body = await new Promise((resolve, reject) => {
|
|
258
|
+
const socket = new WebSocket(`ws://127.0.0.1:${host.port}/api/dev-tunnel?port=${devPort}&oc_url_token=good`);
|
|
259
|
+
socket.on('open', () => socket.send('GET / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n'));
|
|
260
|
+
socket.on('message', (data) => resolve(Buffer.from(data).toString()));
|
|
261
|
+
socket.on('error', reject);
|
|
262
|
+
});
|
|
263
|
+
expect(body).toContain('relay-ok');
|
|
264
|
+
});
|
|
265
|
+
|
|
246
266
|
test('rejects a client with no credentials', async () => {
|
|
247
267
|
const devPort = await startDevServer((_req, res) => res.end('ok'));
|
|
248
268
|
const host = await startHost({ allowedPorts: [devPort], auth: clientAuth });
|
|
@@ -11,12 +11,25 @@ live transcript costs O(n^2) work for a result the final decode replaces. The
|
|
|
11
11
|
composer shows no text while recording and inserts the full transcript on
|
|
12
12
|
stop.
|
|
13
13
|
|
|
14
|
-
Local TTS (Kokoro via sherpa-onnx OfflineTts) runs in the same
|
|
15
|
-
and is exposed as `POST /api/dictation/tts/speak` (JSON
|
|
16
|
-
speed?, model?}` → WAV bytes; 503 with
|
|
17
|
-
downloading). TTS models live in the same
|
|
18
|
-
(`local/model-catalog.js`
|
|
19
|
-
same status/download/delete
|
|
14
|
+
Local TTS (Kokoro and Piper/VITS via sherpa-onnx OfflineTts) runs in the same
|
|
15
|
+
worker process and is exposed as `POST /api/dictation/tts/speak` (JSON
|
|
16
|
+
`{text, speakerId?, speed?, model?, language?, languageSample?}` → WAV bytes; 503 with
|
|
17
|
+
`reasonCode` while the model is downloading). TTS models live in the same
|
|
18
|
+
catalog/downloader as STT models (`local/model-catalog.js`
|
|
19
|
+
`LOCAL_TTS_MODEL_CATALOG`) and are managed by the same status/download/delete
|
|
20
|
+
routes.
|
|
21
|
+
|
|
22
|
+
Each TTS catalog entry declares the `languages` it speaks. With
|
|
23
|
+
`language: 'auto'` the service detects the language of `languageSample` — the
|
|
24
|
+
whole message the chunk belongs to, sent by the client with every chunk — or
|
|
25
|
+
of `text` when no sample is given
|
|
26
|
+
(`../tts/language-detect.js`, script plus function-word scoring, no
|
|
27
|
+
dependencies) and keeps the caller's model when it speaks that language;
|
|
28
|
+
otherwise it switches to the catalog model for the language, downloading it on
|
|
29
|
+
first use like any other model, and starts from that model's default speaker
|
|
30
|
+
(`defaultSpeakerByLanguage`) instead of the caller's speaker id. A language no
|
|
31
|
+
catalog model covers keeps the caller's model, so text is always spoken. The
|
|
32
|
+
response carries `X-Speech-Model` and `X-Speech-Language`.
|
|
20
33
|
|
|
21
34
|
## Ownership
|
|
22
35
|
|
|
@@ -68,9 +68,19 @@ export const LOCAL_STT_MODEL_CATALOG = {
|
|
|
68
68
|
* Local text-to-speech models (sherpa-onnx OfflineTts). Downloaded and
|
|
69
69
|
* managed through the same pipeline as the STT models.
|
|
70
70
|
*/
|
|
71
|
+
/**
|
|
72
|
+
* Local text-to-speech models (sherpa-onnx OfflineTts). Downloaded and
|
|
73
|
+
* managed through the same pipeline as the STT models.
|
|
74
|
+
*
|
|
75
|
+
* `languages` lists the languages a model speaks well; the speech service
|
|
76
|
+
* uses it to pick a model for the language a text is written in. Kokoro
|
|
77
|
+
* models carry speaker ids (`voices`); a Piper model is one voice for one
|
|
78
|
+
* language. `lexicon` entries are joined with commas for sherpa-onnx.
|
|
79
|
+
*/
|
|
71
80
|
export const LOCAL_TTS_MODEL_CATALOG = {
|
|
72
81
|
'kokoro-en-v0_19': {
|
|
73
82
|
type: 'kokoro',
|
|
83
|
+
languages: ['en'],
|
|
74
84
|
archiveUrl:
|
|
75
85
|
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-en-v0_19.tar.bz2',
|
|
76
86
|
extractedDir: 'kokoro-en-v0_19',
|
|
@@ -82,6 +92,188 @@ export const LOCAL_TTS_MODEL_CATALOG = {
|
|
|
82
92
|
},
|
|
83
93
|
description: 'Kokoro TTS (English, natural voices)',
|
|
84
94
|
},
|
|
95
|
+
'kokoro-multi-lang-v1_1': {
|
|
96
|
+
type: 'kokoro',
|
|
97
|
+
languages: ['zh', 'en'],
|
|
98
|
+
// sherpa-onnx wires this Kokoro build for Chinese and English only;
|
|
99
|
+
// speakers 0-2 are English, 3-102 Chinese.
|
|
100
|
+
defaultSpeakerByLanguage: { en: 0, zh: 3 },
|
|
101
|
+
archiveUrl:
|
|
102
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-multi-lang-v1_1.tar.bz2',
|
|
103
|
+
extractedDir: 'kokoro-multi-lang-v1_1',
|
|
104
|
+
files: {
|
|
105
|
+
model: 'model.onnx',
|
|
106
|
+
voices: 'voices.bin',
|
|
107
|
+
tokens: 'tokens.txt',
|
|
108
|
+
espeakData: 'espeak-ng-data',
|
|
109
|
+
lexiconEnglish: 'lexicon-us-en.txt',
|
|
110
|
+
lexiconChinese: 'lexicon-zh.txt',
|
|
111
|
+
},
|
|
112
|
+
lexicon: ['lexiconEnglish', 'lexiconChinese'],
|
|
113
|
+
description: 'Kokoro TTS (Chinese and English, 103 voices)',
|
|
114
|
+
},
|
|
115
|
+
// The larger `ukrainian_tts-medium` build is a character-level model
|
|
116
|
+
// (`phoneme_type: text`); sherpa-onnx phonemizes every Piper model through
|
|
117
|
+
// espeak-ng, which turns that one into noise. `vits-coqui-uk-mai` sounds
|
|
118
|
+
// better but reads Cyrillic only and drops every Latin word (file names,
|
|
119
|
+
// product names), which is unusable in a coding chat. Lada is an espeak
|
|
120
|
+
// model: small, but it reads mixed text.
|
|
121
|
+
'piper-uk_UA-lada-x_low': {
|
|
122
|
+
type: 'vits',
|
|
123
|
+
languages: ['uk'],
|
|
124
|
+
archiveUrl:
|
|
125
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-uk_UA-lada-x_low.tar.bz2',
|
|
126
|
+
extractedDir: 'vits-piper-uk_UA-lada-x_low',
|
|
127
|
+
files: {
|
|
128
|
+
model: 'uk_UA-lada-x_low.onnx',
|
|
129
|
+
tokens: 'tokens.txt',
|
|
130
|
+
espeakData: 'espeak-ng-data',
|
|
131
|
+
},
|
|
132
|
+
description: 'Piper TTS (Ukrainian)',
|
|
133
|
+
},
|
|
134
|
+
'piper-de_DE-thorsten-medium': {
|
|
135
|
+
type: 'vits',
|
|
136
|
+
languages: ['de'],
|
|
137
|
+
archiveUrl:
|
|
138
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-de_DE-thorsten-medium.tar.bz2',
|
|
139
|
+
extractedDir: 'vits-piper-de_DE-thorsten-medium',
|
|
140
|
+
files: {
|
|
141
|
+
model: 'de_DE-thorsten-medium.onnx',
|
|
142
|
+
tokens: 'tokens.txt',
|
|
143
|
+
espeakData: 'espeak-ng-data',
|
|
144
|
+
},
|
|
145
|
+
description: 'Piper TTS (German)',
|
|
146
|
+
},
|
|
147
|
+
'piper-fr_FR-siwis-medium': {
|
|
148
|
+
type: 'vits',
|
|
149
|
+
languages: ['fr'],
|
|
150
|
+
archiveUrl:
|
|
151
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-fr_FR-siwis-medium.tar.bz2',
|
|
152
|
+
extractedDir: 'vits-piper-fr_FR-siwis-medium',
|
|
153
|
+
files: {
|
|
154
|
+
model: 'fr_FR-siwis-medium.onnx',
|
|
155
|
+
tokens: 'tokens.txt',
|
|
156
|
+
espeakData: 'espeak-ng-data',
|
|
157
|
+
},
|
|
158
|
+
description: 'Piper TTS (French)',
|
|
159
|
+
},
|
|
160
|
+
'piper-es_ES-davefx-medium': {
|
|
161
|
+
type: 'vits',
|
|
162
|
+
languages: ['es'],
|
|
163
|
+
archiveUrl:
|
|
164
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-es_ES-davefx-medium.tar.bz2',
|
|
165
|
+
extractedDir: 'vits-piper-es_ES-davefx-medium',
|
|
166
|
+
files: {
|
|
167
|
+
model: 'es_ES-davefx-medium.onnx',
|
|
168
|
+
tokens: 'tokens.txt',
|
|
169
|
+
espeakData: 'espeak-ng-data',
|
|
170
|
+
},
|
|
171
|
+
description: 'Piper TTS (Spanish)',
|
|
172
|
+
},
|
|
173
|
+
'piper-it_IT-paola-medium': {
|
|
174
|
+
type: 'vits',
|
|
175
|
+
languages: ['it'],
|
|
176
|
+
archiveUrl:
|
|
177
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-it_IT-paola-medium.tar.bz2',
|
|
178
|
+
extractedDir: 'vits-piper-it_IT-paola-medium',
|
|
179
|
+
files: {
|
|
180
|
+
model: 'it_IT-paola-medium.onnx',
|
|
181
|
+
tokens: 'tokens.txt',
|
|
182
|
+
espeakData: 'espeak-ng-data',
|
|
183
|
+
},
|
|
184
|
+
description: 'Piper TTS (Italian)',
|
|
185
|
+
},
|
|
186
|
+
'piper-pt_BR-faber-medium': {
|
|
187
|
+
type: 'vits',
|
|
188
|
+
languages: ['pt'],
|
|
189
|
+
archiveUrl:
|
|
190
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-pt_BR-faber-medium.tar.bz2',
|
|
191
|
+
extractedDir: 'vits-piper-pt_BR-faber-medium',
|
|
192
|
+
files: {
|
|
193
|
+
model: 'pt_BR-faber-medium.onnx',
|
|
194
|
+
tokens: 'tokens.txt',
|
|
195
|
+
espeakData: 'espeak-ng-data',
|
|
196
|
+
},
|
|
197
|
+
description: 'Piper TTS (Portuguese (Brazil))',
|
|
198
|
+
},
|
|
199
|
+
'piper-pl_PL-gosia-medium': {
|
|
200
|
+
type: 'vits',
|
|
201
|
+
languages: ['pl'],
|
|
202
|
+
archiveUrl:
|
|
203
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-pl_PL-gosia-medium.tar.bz2',
|
|
204
|
+
extractedDir: 'vits-piper-pl_PL-gosia-medium',
|
|
205
|
+
files: {
|
|
206
|
+
model: 'pl_PL-gosia-medium.onnx',
|
|
207
|
+
tokens: 'tokens.txt',
|
|
208
|
+
espeakData: 'espeak-ng-data',
|
|
209
|
+
},
|
|
210
|
+
description: 'Piper TTS (Polish)',
|
|
211
|
+
},
|
|
212
|
+
'piper-ru_RU-irina-medium': {
|
|
213
|
+
type: 'vits',
|
|
214
|
+
languages: ['ru'],
|
|
215
|
+
archiveUrl:
|
|
216
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-ru_RU-irina-medium.tar.bz2',
|
|
217
|
+
extractedDir: 'vits-piper-ru_RU-irina-medium',
|
|
218
|
+
files: {
|
|
219
|
+
model: 'ru_RU-irina-medium.onnx',
|
|
220
|
+
tokens: 'tokens.txt',
|
|
221
|
+
espeakData: 'espeak-ng-data',
|
|
222
|
+
},
|
|
223
|
+
description: 'Piper TTS (Russian)',
|
|
224
|
+
},
|
|
225
|
+
'piper-nl_NL-pim-medium': {
|
|
226
|
+
type: 'vits',
|
|
227
|
+
languages: ['nl'],
|
|
228
|
+
archiveUrl:
|
|
229
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-nl_NL-pim-medium.tar.bz2',
|
|
230
|
+
extractedDir: 'vits-piper-nl_NL-pim-medium',
|
|
231
|
+
files: {
|
|
232
|
+
model: 'nl_NL-pim-medium.onnx',
|
|
233
|
+
tokens: 'tokens.txt',
|
|
234
|
+
espeakData: 'espeak-ng-data',
|
|
235
|
+
},
|
|
236
|
+
description: 'Piper TTS (Dutch)',
|
|
237
|
+
},
|
|
238
|
+
'piper-cs_CZ-jirka-medium': {
|
|
239
|
+
type: 'vits',
|
|
240
|
+
languages: ['cs'],
|
|
241
|
+
archiveUrl:
|
|
242
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-cs_CZ-jirka-medium.tar.bz2',
|
|
243
|
+
extractedDir: 'vits-piper-cs_CZ-jirka-medium',
|
|
244
|
+
files: {
|
|
245
|
+
model: 'cs_CZ-jirka-medium.onnx',
|
|
246
|
+
tokens: 'tokens.txt',
|
|
247
|
+
espeakData: 'espeak-ng-data',
|
|
248
|
+
},
|
|
249
|
+
description: 'Piper TTS (Czech)',
|
|
250
|
+
},
|
|
251
|
+
'piper-tr_TR-dfki-medium': {
|
|
252
|
+
type: 'vits',
|
|
253
|
+
languages: ['tr'],
|
|
254
|
+
archiveUrl:
|
|
255
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-tr_TR-dfki-medium.tar.bz2',
|
|
256
|
+
extractedDir: 'vits-piper-tr_TR-dfki-medium',
|
|
257
|
+
files: {
|
|
258
|
+
model: 'tr_TR-dfki-medium.onnx',
|
|
259
|
+
tokens: 'tokens.txt',
|
|
260
|
+
espeakData: 'espeak-ng-data',
|
|
261
|
+
},
|
|
262
|
+
description: 'Piper TTS (Turkish)',
|
|
263
|
+
},
|
|
264
|
+
'piper-sv_SE-nst-medium': {
|
|
265
|
+
type: 'vits',
|
|
266
|
+
languages: ['sv'],
|
|
267
|
+
archiveUrl:
|
|
268
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-sv_SE-nst-medium.tar.bz2',
|
|
269
|
+
extractedDir: 'vits-piper-sv_SE-nst-medium',
|
|
270
|
+
files: {
|
|
271
|
+
model: 'sv_SE-nst-medium.onnx',
|
|
272
|
+
tokens: 'tokens.txt',
|
|
273
|
+
espeakData: 'espeak-ng-data',
|
|
274
|
+
},
|
|
275
|
+
description: 'Piper TTS (Swedish)',
|
|
276
|
+
},
|
|
85
277
|
};
|
|
86
278
|
|
|
87
279
|
export const DEFAULT_LOCAL_STT_MODEL = 'parakeet-tdt-0.6b-v2-int8';
|
|
@@ -131,6 +323,34 @@ export function getLocalSttModelSpec(modelId) {
|
|
|
131
323
|
};
|
|
132
324
|
}
|
|
133
325
|
|
|
326
|
+
/**
|
|
327
|
+
* The local TTS model to use for a language, preferring the model the user
|
|
328
|
+
* selected when it speaks that language. Returns null when no catalog model
|
|
329
|
+
* covers the language, in which case callers keep the selected model.
|
|
330
|
+
* @param {string} language BCP-47 primary subtag (`uk`, `zh`...)
|
|
331
|
+
* @param {string} [preferredModelId]
|
|
332
|
+
* @returns {string | null}
|
|
333
|
+
*/
|
|
334
|
+
export function resolveLocalTtsModelForLanguage(language, preferredModelId) {
|
|
335
|
+
const speaks = (modelId) => LOCAL_TTS_MODEL_CATALOG[modelId]?.languages?.includes(language) === true;
|
|
336
|
+
if (preferredModelId && speaks(preferredModelId)) return preferredModelId;
|
|
337
|
+
const candidate = LOCAL_TTS_MODEL_IDS.find(speaks);
|
|
338
|
+
return candidate ?? null;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* The speaker id a model should use for a language when the caller's
|
|
343
|
+
* speaker was chosen for another language. `undefined` keeps the caller's
|
|
344
|
+
* speaker.
|
|
345
|
+
* @param {string} modelId
|
|
346
|
+
* @param {string} language
|
|
347
|
+
* @returns {number | undefined}
|
|
348
|
+
*/
|
|
349
|
+
export function getLocalTtsDefaultSpeaker(modelId, language) {
|
|
350
|
+
const speaker = LOCAL_TTS_MODEL_CATALOG[modelId]?.defaultSpeakerByLanguage?.[language];
|
|
351
|
+
return Number.isInteger(speaker) ? speaker : undefined;
|
|
352
|
+
}
|
|
353
|
+
|
|
134
354
|
/**
|
|
135
355
|
* @param {string} modelsDir
|
|
136
356
|
* @param {string} modelId
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_LOCAL_TTS_MODEL,
|
|
4
|
+
LOCAL_TTS_MODEL_CATALOG,
|
|
5
|
+
getLocalSttModelSpec,
|
|
6
|
+
getLocalTtsDefaultSpeaker,
|
|
7
|
+
resolveLocalTtsModelForLanguage,
|
|
8
|
+
} from './model-catalog.js';
|
|
9
|
+
|
|
10
|
+
describe('local TTS catalog', () => {
|
|
11
|
+
it('keeps the selected model when it speaks the language', () => {
|
|
12
|
+
expect(resolveLocalTtsModelForLanguage('en', DEFAULT_LOCAL_TTS_MODEL)).toBe(DEFAULT_LOCAL_TTS_MODEL);
|
|
13
|
+
expect(resolveLocalTtsModelForLanguage('zh', 'kokoro-multi-lang-v1_1')).toBe('kokoro-multi-lang-v1_1');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('picks a catalog model for a language the selected model lacks', () => {
|
|
17
|
+
expect(resolveLocalTtsModelForLanguage('uk', DEFAULT_LOCAL_TTS_MODEL)).toBe('piper-uk_UA-lada-x_low');
|
|
18
|
+
expect(resolveLocalTtsModelForLanguage('zh', DEFAULT_LOCAL_TTS_MODEL)).toBe('kokoro-multi-lang-v1_1');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('returns null for a language no model covers', () => {
|
|
22
|
+
expect(resolveLocalTtsModelForLanguage('xx', DEFAULT_LOCAL_TTS_MODEL)).toBeNull();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('gives Chinese a Chinese speaker on the multi-language Kokoro', () => {
|
|
26
|
+
expect(getLocalTtsDefaultSpeaker('kokoro-multi-lang-v1_1', 'zh')).toBe(3);
|
|
27
|
+
expect(getLocalTtsDefaultSpeaker('kokoro-multi-lang-v1_1', 'en')).toBe(0);
|
|
28
|
+
expect(getLocalTtsDefaultSpeaker('piper-uk_UA-lada-x_low', 'uk')).toBeUndefined();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('every TTS entry declares its languages and installable files', () => {
|
|
32
|
+
for (const [id, spec] of Object.entries(LOCAL_TTS_MODEL_CATALOG)) {
|
|
33
|
+
expect(spec.languages.length, id).toBeGreaterThan(0);
|
|
34
|
+
expect(spec.archiveUrl, id).toMatch(/^https:\/\/github\.com\/k2-fsa\/sherpa-onnx\/releases\/download\/tts-models\//);
|
|
35
|
+
const resolved = getLocalSttModelSpec(id);
|
|
36
|
+
expect(resolved.requiredFiles, id).toContain(spec.files.model);
|
|
37
|
+
for (const key of spec.lexicon ?? []) {
|
|
38
|
+
expect(spec.files[key], `${id} lexicon ${key}`).toBeTruthy();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|