@hyperwindmill/caretaker-cli 0.17.0 → 0.19.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.
@@ -11,6 +11,16 @@ export declare function resolveVoice(): Promise<{
11
11
  error: string;
12
12
  }>;
13
13
  export declare function voiceAuthHeaders(voice: VoiceConfig): Record<string, string>;
14
+ /** Build auth headers from an explicit key (which may be stored encrypted).
15
+ * Used so the synthesis leg can send its own key — or none at all. */
16
+ export declare function authHeaders(apiKey: string | undefined | null): Record<string, string>;
17
+ /** Where synthesis goes. A configured `ttsEndpoint` takes its own key — or
18
+ * none at all: the transcription key belongs to a different host and must
19
+ * not leak to a third-party TTS service. */
20
+ export declare function ttsTarget(voice: VoiceConfig): {
21
+ endpoint: string;
22
+ apiKey?: string;
23
+ };
14
24
  export declare function registerVoiceProxy(app: Hono): void;
15
25
  /**
16
26
  * Read a speech endpoint's installed models so the settings form can offer real
@@ -20,6 +30,12 @@ export declare function registerVoiceProxy(app: Hono): void;
20
30
  * those are correctly scoped, unlike the global /v1/audio/voices catalogue, which
21
31
  * ignores its model_id parameter. A plain OpenAI-compatible endpoint reports
22
32
  * neither, so every id is offered for both tasks and the voice stays free text.
33
+ *
34
+ * openai-edge-tts reports models under `{"models": [...]}` (not `{"data": [...]}`),
35
+ * with no task metadata, and publishes its voice list at `/voices/all` rather than
36
+ * per model — voice ids are under the `"name"` key, not `"id"`. When no TTS entry
37
+ * carries its own voices, a best-effort `/voices/all` fetch fills them in; failure
38
+ * degrades to the free-text voice field, which already works.
23
39
  */
24
40
  export declare function fetchVoiceCatalog(endpoint: string, apiKey?: string | null): Promise<VoiceCatalog>;
25
41
  //# sourceMappingURL=voice_proxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"voice_proxy.d.ts","sourceRoot":"","sources":["../../../src/cli/web/voice_proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC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AAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE3E;AAED;uEACuE;AACvE,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGrF;AAED;;6CAE6C;AAC7C,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAInF;AAOD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CA2ElD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAAC,YAAY,CAAC,CA6DvB"}
@@ -35,9 +35,23 @@ function plainKey(apiKey) {
35
35
  return isEncrypted(apiKey) ? decrypt(apiKey) : apiKey;
36
36
  }
37
37
  export function voiceAuthHeaders(voice) {
38
- const key = plainKey(voice.apiKey);
38
+ return authHeaders(voice.apiKey);
39
+ }
40
+ /** Build auth headers from an explicit key (which may be stored encrypted).
41
+ * Used so the synthesis leg can send its own key — or none at all. */
42
+ export function authHeaders(apiKey) {
43
+ const key = plainKey(apiKey);
39
44
  return key ? { authorization: `Bearer ${key}` } : {};
40
45
  }
46
+ /** Where synthesis goes. A configured `ttsEndpoint` takes its own key — or
47
+ * none at all: the transcription key belongs to a different host and must
48
+ * not leak to a third-party TTS service. */
49
+ export function ttsTarget(voice) {
50
+ const tts = voice.ttsEndpoint?.trim();
51
+ if (!tts)
52
+ return { endpoint: voice.endpoint, apiKey: voice.apiKey };
53
+ return { endpoint: tts, ...(voice.ttsApiKey ? { apiKey: voice.ttsApiKey } : {}) };
54
+ }
41
55
  /** Join a base URL and a path without doubling or dropping the slash. */
42
56
  function url(endpoint, suffix) {
43
57
  return `${endpoint.replace(/\/+$/, '')}${suffix}`;
@@ -99,9 +113,10 @@ export function registerVoiceProxy(app) {
99
113
  }
100
114
  let upstream;
101
115
  try {
102
- upstream = await fetch(url(voice.endpoint, '/audio/speech'), {
116
+ const target = ttsTarget(voice);
117
+ upstream = await fetch(url(target.endpoint, '/audio/speech'), {
103
118
  method: 'POST',
104
- headers: { ...voiceAuthHeaders(voice), 'content-type': 'application/json' },
119
+ headers: { ...authHeaders(target.apiKey), 'content-type': 'application/json' },
105
120
  body: JSON.stringify(payload),
106
121
  });
107
122
  }
@@ -126,17 +141,28 @@ export function registerVoiceProxy(app) {
126
141
  * those are correctly scoped, unlike the global /v1/audio/voices catalogue, which
127
142
  * ignores its model_id parameter. A plain OpenAI-compatible endpoint reports
128
143
  * neither, so every id is offered for both tasks and the voice stays free text.
144
+ *
145
+ * openai-edge-tts reports models under `{"models": [...]}` (not `{"data": [...]}`),
146
+ * with no task metadata, and publishes its voice list at `/voices/all` rather than
147
+ * per model — voice ids are under the `"name"` key, not `"id"`. When no TTS entry
148
+ * carries its own voices, a best-effort `/voices/all` fetch fills them in; failure
149
+ * degrades to the free-text voice field, which already works.
129
150
  */
130
151
  export async function fetchVoiceCatalog(endpoint, apiKey) {
131
152
  const key = plainKey(apiKey);
132
- const res = await fetch(url(endpoint, '/models'), {
133
- headers: key ? { authorization: `Bearer ${key}` } : {},
134
- });
153
+ const headers = authHeaders(key);
154
+ const res = await fetch(url(endpoint, '/models'), { headers });
135
155
  if (!res.ok) {
136
156
  throw new Error(`${res.status} ${res.statusText}: ${(await res.text()).slice(0, 300)}`);
137
157
  }
138
158
  const body = (await res.json());
139
- const rows = Array.isArray(body?.data) ? body.data : [];
159
+ // Accept both { "data": [...] } (OpenAI/Speaches) and { "models": [...] }
160
+ // (openai-edge-tts) — the latter uses a non-standard envelope key.
161
+ const rows = Array.isArray(body?.data)
162
+ ? body.data
163
+ : Array.isArray(body?.models)
164
+ ? body.models
165
+ : [];
140
166
  const stt = [];
141
167
  const tts = [];
142
168
  const untasked = [];
@@ -173,8 +199,77 @@ export async function fetchVoiceCatalog(endpoint, apiKey) {
173
199
  }
174
200
  // No task metadata anywhere: offer everything for both, voices unknown.
175
201
  if (stt.length === 0 && tts.length === 0) {
176
- return { stt: untasked, tts: untasked.map((id) => ({ id, voices: [] })) };
202
+ const ttsModels = untasked.map((id) => ({ id, voices: [] }));
203
+ await fillVoicesFromCatalog(endpoint, headers, ttsModels);
204
+ return { stt: untasked, tts: ttsModels };
177
205
  }
178
206
  // Mixed: keep the untasked ids selectable for transcription, the likelier use.
207
+ if (tts.length > 0 && tts.every((m) => m.voices.length === 0)) {
208
+ await fillVoicesFromCatalog(endpoint, headers, tts);
209
+ }
179
210
  return { stt: [...stt, ...untasked], tts };
180
211
  }
212
+ /** Best-effort GET <endpoint>/voices/all — openai-edge-tts publishes its voice
213
+ * list here rather than per model. Voice ids are under the `"name"` key (not
214
+ * `"id"`), the route defaults to en-US only on `/voices` (not `/voices/all`),
215
+ * and it may require auth. Failure is silent: an endpoint without the route
216
+ * degrades to the free-text voice field, which already works. */
217
+ async function fillVoicesFromCatalog(endpoint, headers, ttsModels) {
218
+ if (ttsModels.length === 0)
219
+ return;
220
+ let res;
221
+ try {
222
+ res = await fetch(url(endpoint, '/voices/all'), { headers });
223
+ }
224
+ catch {
225
+ return;
226
+ }
227
+ if (!res.ok)
228
+ return;
229
+ let body;
230
+ try {
231
+ body = await res.json();
232
+ }
233
+ catch {
234
+ return;
235
+ }
236
+ // Accept both a bare array and a { "voices": [...] } envelope. The edge-tts
237
+ // shape is { "voices": [{ "name": "it-IT-ElsaNeural", "gender": "Female",
238
+ // "language": "it-IT" }, ...] }.
239
+ const voiceRows = Array.isArray(body)
240
+ ? body
241
+ : Array.isArray(body?.voices)
242
+ ? body.voices
243
+ : [];
244
+ if (voiceRows.length === 0)
245
+ return;
246
+ const voices = voiceRows.flatMap((v) => {
247
+ if (!v || typeof v !== 'object')
248
+ return [];
249
+ const voice = v;
250
+ // edge-tts uses "name" for the voice id; Speaches uses "id"; some APIs use
251
+ // "ShortName". Accept any, preferring "name" first for edge-tts.
252
+ const id = typeof voice.name === 'string'
253
+ ? voice.name
254
+ : typeof voice.id === 'string'
255
+ ? voice.id
256
+ : typeof voice.ShortName === 'string'
257
+ ? voice.ShortName
258
+ : null;
259
+ if (!id)
260
+ return [];
261
+ const language = voice.language ?? voice.Locale;
262
+ const gender = voice.gender ?? voice.Gender;
263
+ return [
264
+ {
265
+ id,
266
+ ...(typeof language === 'string' ? { language } : {}),
267
+ ...(typeof gender === 'string' ? { gender } : {}),
268
+ },
269
+ ];
270
+ });
271
+ if (voices.length > 0) {
272
+ for (const model of ttsModels)
273
+ model.voices = voices;
274
+ }
275
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/store/json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK7F,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AACD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AACD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AACD,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AACD,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,eAAO,MAAM,aAAa,EAAE,eAG3B,CAAC;AAqDF,wBAAsB,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC,CAE3D;AAED,wBAAsB,UAAU,CAAC,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAclE;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAEzD;AAED,wBAAsB,UAAU,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhE;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CASxD;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,WA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,GAAG,OAAO,CAAC,IAAI,CAAC,CAExE;AAID;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAO5E"}
@@ -91,6 +91,9 @@ export async function saveConfig(c) {
91
91
  if (c.voice?.apiKey && !isEncrypted(c.voice.apiKey)) {
92
92
  c.voice.apiKey = encrypt(c.voice.apiKey);
93
93
  }
94
+ if (c.voice?.ttsApiKey && !isEncrypted(c.voice.ttsApiKey)) {
95
+ c.voice.ttsApiKey = encrypt(c.voice.ttsApiKey);
96
+ }
94
97
  await writeJson(configPath(), c);
95
98
  }
96
99
  export async function loadAgents() {
@@ -612,6 +612,100 @@ body.vscode-light .tool {
612
612
  padding: 8px;
613
613
  max-height: 180px;
614
614
  }
615
+ .tool-bubble-wrap {
616
+ align-self: flex-start;
617
+ max-width: 100%;
618
+ }
619
+ .tool-bubble-row {
620
+ display: flex;
621
+ flex-wrap: wrap;
622
+ align-items: center;
623
+ gap: 6px;
624
+ max-width: 100%;
625
+ }
626
+ .tool-bubble {
627
+ display: inline-flex;
628
+ align-items: center;
629
+ gap: 6px;
630
+ max-width: 100%;
631
+ padding: 3px 10px;
632
+ border-radius: 999px;
633
+ font-size: 11px;
634
+ color: var(--vscode-descriptionForeground, #8c8c8c);
635
+ background: oklch(0.2 0.02 240 / 0.6);
636
+ border: 1px solid var(--glass-border);
637
+ border-left: 2px solid var(--accent-cyan);
638
+ cursor: default;
639
+ transition: background var(--transition-fast), border-color var(--transition-fast);
640
+ animation: fadeInUp 0.24s ease forwards;
641
+ }
642
+ .tool-bubble:hover,
643
+ .tool-bubble--open {
644
+ background: oklch(0.24 0.03 240 / 0.75);
645
+ }
646
+ .tool-bubble:focus-visible {
647
+ outline: 1px solid var(--accent-cyan);
648
+ outline-offset: 1px;
649
+ }
650
+ .tool-bubble__icon {
651
+ color: var(--accent-cyan);
652
+ display: inline-flex;
653
+ flex: none;
654
+ }
655
+ .tool-bubble__name {
656
+ font-family: var(--font-mono);
657
+ font-weight: 700;
658
+ color: var(--vscode-foreground);
659
+ flex: none;
660
+ }
661
+ .tool-bubble__summary {
662
+ font-family: var(--font-mono);
663
+ opacity: 0.8;
664
+ min-width: 0;
665
+ max-width: 340px;
666
+ overflow: hidden;
667
+ text-overflow: ellipsis;
668
+ white-space: nowrap;
669
+ }
670
+ .tool-bubble__status {
671
+ font-family: var(--font-mono);
672
+ opacity: 0.7;
673
+ flex: none;
674
+ }
675
+ .tool-bubble__popover {
676
+ z-index: 60;
677
+ padding: 8px;
678
+ max-height: 320px;
679
+ overflow: hidden;
680
+ border-radius: var(--radius-md);
681
+ border: 1px solid var(--glass-border);
682
+ background: var(--vscode-editorHoverWidget-background, oklch(0.16 0.02 240));
683
+ box-shadow: 0 8px 24px oklch(0 0 0 / 0.35);
684
+ }
685
+ .tool-bubble__popover--pinned {
686
+ overflow: auto;
687
+ }
688
+ .tool-bubble__args {
689
+ margin: 0;
690
+ font-family: var(--font-mono);
691
+ font-size: 10px;
692
+ color: var(--vscode-foreground);
693
+ white-space: pre-wrap;
694
+ word-break: break-all;
695
+ }
696
+ .tool-bubble__result {
697
+ margin-top: 6px;
698
+ padding-top: 6px;
699
+ border-top: 1px dashed oklch(1 0 0 / 0.08);
700
+ font-size: 11.5px;
701
+ }
702
+ body.vscode-light .tool-bubble {
703
+ background: oklch(0.96 0.01 240);
704
+ border-color: oklch(0 0 0 / 0.08);
705
+ }
706
+ body.vscode-light .tool-bubble__popover {
707
+ background: #fff;
708
+ }
615
709
  .confirm {
616
710
  display: flex;
617
711
  flex-direction: column;