@hyperwindmill/caretaker-cli 0.29.0 → 0.31.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/dist/agents/dispatch.d.ts.map +1 -1
- package/dist/agents/dispatch.js +4 -1
- package/dist/cli/web/server.d.ts.map +1 -1
- package/dist/cli/web/server.js +29 -7
- package/dist/cli/web/session_scope.d.ts +11 -0
- package/dist/cli/web/session_scope.d.ts.map +1 -0
- package/dist/cli/web/session_scope.js +13 -0
- package/dist/cli/web/turn_guard.d.ts +9 -0
- package/dist/cli/web/turn_guard.d.ts.map +1 -0
- package/dist/cli/web/turn_guard.js +18 -0
- package/dist/cli/web/voice_backend.d.ts +4 -0
- package/dist/cli/web/voice_backend.d.ts.map +1 -1
- package/dist/cli/web/voice_backend.js +14 -3
- package/dist/cli/web/voice_builtin.d.ts +3 -0
- package/dist/cli/web/voice_builtin.d.ts.map +1 -0
- package/dist/cli/web/voice_builtin.js +74 -0
- package/dist/cli/web/voice_proxy.d.ts +36 -1
- package/dist/cli/web/voice_proxy.d.ts.map +1 -1
- package/dist/cli/web/voice_proxy.js +201 -30
- package/dist/commands/loader.js +2 -2
- package/dist/harness/tools/builtin/index.d.ts.map +1 -1
- package/dist/harness/tools/builtin/index.js +4 -0
- package/dist/harness/tools/builtin/set_workspace.d.ts +3 -0
- package/dist/harness/tools/builtin/set_workspace.d.ts.map +1 -0
- package/dist/harness/tools/builtin/set_workspace.js +71 -0
- package/dist/plugins/manifest.d.ts +1 -1
- package/dist/plugins/manifest.js +1 -1
- package/dist/session/store.d.ts +6 -0
- package/dist/session/store.d.ts.map +1 -1
- package/dist/session/store.js +11 -0
- package/dist/session/types.d.ts +5 -0
- package/dist/session/types.d.ts.map +1 -1
- package/dist/store/db.d.ts.map +1 -1
- package/dist/store/db.js +3 -1
- package/dist/voice/pocket/catalog.d.ts +24 -0
- package/dist/voice/pocket/catalog.d.ts.map +1 -0
- package/dist/voice/pocket/catalog.js +152 -0
- package/dist/voice/pocket/engine.d.ts +17 -0
- package/dist/voice/pocket/engine.d.ts.map +1 -0
- package/dist/voice/pocket/engine.js +145 -0
- package/dist/voice/pocket/inference.d.ts +36 -0
- package/dist/voice/pocket/inference.d.ts.map +1 -0
- package/dist/voice/pocket/inference.js +228 -0
- package/dist/voice/pocket/install.d.ts +68 -0
- package/dist/voice/pocket/install.d.ts.map +1 -0
- package/dist/voice/pocket/install.js +329 -0
- package/dist/voice/pocket/tokenizer.d.ts +42 -0
- package/dist/voice/pocket/tokenizer.d.ts.map +1 -0
- package/dist/voice/pocket/tokenizer.js +279 -0
- package/dist/voice/pocket/voices.d.ts +9 -0
- package/dist/voice/pocket/voices.d.ts.map +1 -0
- package/dist/voice/pocket/voices.js +88 -0
- package/dist/voice/pronunciation.d.ts +16 -0
- package/dist/voice/pronunciation.d.ts.map +1 -0
- package/dist/voice/pronunciation.js +54 -0
- package/dist/voice/whisper/catalog.d.ts +15 -0
- package/dist/voice/whisper/catalog.d.ts.map +1 -0
- package/dist/voice/whisper/catalog.js +53 -0
- package/dist/voice/whisper/decoder.d.ts +3 -0
- package/dist/voice/whisper/decoder.d.ts.map +1 -0
- package/dist/voice/whisper/decoder.js +48 -0
- package/dist/voice/whisper/engine.d.ts +8 -0
- package/dist/voice/whisper/engine.d.ts.map +1 -0
- package/dist/voice/whisper/engine.js +77 -0
- package/dist/voice/whisper/features.d.ts +10 -0
- package/dist/voice/whisper/features.d.ts.map +1 -0
- package/dist/voice/whisper/features.js +149 -0
- package/dist/voice/whisper/inference.d.ts +17 -0
- package/dist/voice/whisper/inference.d.ts.map +1 -0
- package/dist/voice/whisper/inference.js +257 -0
- package/dist/voice/whisper/wav.d.ts +5 -0
- package/dist/voice/whisper/wav.d.ts.map +1 -0
- package/dist/voice/whisper/wav.js +48 -0
- package/dist/webview/standalone.js +1777 -743
- package/dist/webview/standalone.js.map +4 -4
- package/package.json +3 -3
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { loadConfig } from '../../store/json.js';
|
|
2
2
|
import { decrypt, isEncrypted } from '../../lib/encryption.js';
|
|
3
|
+
import { parseWav16kMono } from '../../voice/whisper/wav.js';
|
|
4
|
+
import { applyPronunciation, dictionaryFor, synthesisLanguage } from '../../voice/pronunciation.js';
|
|
3
5
|
export function voiceClientConfig(config) {
|
|
4
6
|
const voice = config.voice;
|
|
5
7
|
if (!voice)
|
|
6
8
|
return null;
|
|
7
9
|
const out = {
|
|
8
10
|
enabled: voice.enabled === true,
|
|
9
|
-
configured:
|
|
10
|
-
|
|
11
|
+
configured: voice.sttEngine === 'builtin' ||
|
|
12
|
+
(typeof voice.endpoint === 'string' && voice.endpoint.trim().length > 0),
|
|
13
|
+
canSpeak: voice.ttsEngine === 'builtin'
|
|
14
|
+
? typeof voice.ttsLanguage === 'string' && voice.ttsLanguage.length > 0
|
|
15
|
+
: typeof voice.ttsModel === 'string' && voice.ttsModel.trim().length > 0,
|
|
11
16
|
};
|
|
17
|
+
if (voice.sttEngine)
|
|
18
|
+
out.sttEngine = voice.sttEngine;
|
|
12
19
|
if (voice.lang)
|
|
13
20
|
out.lang = voice.lang;
|
|
21
|
+
if (Number.isFinite(voice.playbackBufferMs))
|
|
22
|
+
out.playbackBufferMs = voice.playbackBufferMs;
|
|
14
23
|
return out;
|
|
15
24
|
}
|
|
16
25
|
/** Resolve the usable voice config, or a reason it cannot be used. Shared with
|
|
@@ -22,7 +31,7 @@ export async function resolveVoice() {
|
|
|
22
31
|
if (!voice || voice.enabled !== true) {
|
|
23
32
|
return { error: 'Voice mode is disabled. Enable it in Settings → Voice.' };
|
|
24
33
|
}
|
|
25
|
-
if (!voice.endpoint || voice.endpoint.trim().length === 0) {
|
|
34
|
+
if (voice.sttEngine !== 'builtin' && (!voice.endpoint || voice.endpoint.trim().length === 0)) {
|
|
26
35
|
return { error: 'No voice endpoint configured. Set one in Settings → Voice.' };
|
|
27
36
|
}
|
|
28
37
|
return { voice };
|
|
@@ -62,12 +71,28 @@ export function registerVoiceProxy(app) {
|
|
|
62
71
|
if ('error' in resolved)
|
|
63
72
|
return c.text(resolved.error, 503);
|
|
64
73
|
const { voice } = resolved;
|
|
65
|
-
if (!voice.sttModel)
|
|
74
|
+
if (voice.sttEngine !== 'builtin' && !voice.sttModel) {
|
|
66
75
|
return c.text('No transcription model configured.', 400);
|
|
76
|
+
}
|
|
67
77
|
const incoming = await c.req.formData();
|
|
68
78
|
const file = incoming.get('file');
|
|
69
79
|
if (!file)
|
|
70
80
|
return c.text('No audio uploaded (expected a "file" part).', 400);
|
|
81
|
+
if (voice.sttEngine === 'builtin') {
|
|
82
|
+
if (!builtinTranscriber) {
|
|
83
|
+
return c.text('The built-in transcription engine is not available.', 503);
|
|
84
|
+
}
|
|
85
|
+
if (typeof file === 'string')
|
|
86
|
+
return c.text('Expected an audio file in the "file" part.', 400);
|
|
87
|
+
let samples;
|
|
88
|
+
try {
|
|
89
|
+
samples = parseWav16kMono(new Uint8Array(await file.arrayBuffer()));
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
return c.text(err instanceof Error ? err.message : String(err), 400);
|
|
93
|
+
}
|
|
94
|
+
return builtinTranscriber(voice, samples, c.req.raw.signal);
|
|
95
|
+
}
|
|
71
96
|
const form = new FormData();
|
|
72
97
|
form.set('file', file);
|
|
73
98
|
form.set('model', voice.sttModel);
|
|
@@ -96,41 +121,187 @@ export function registerVoiceProxy(app) {
|
|
|
96
121
|
});
|
|
97
122
|
});
|
|
98
123
|
app.post('/api/voice/speak', async (c) => {
|
|
99
|
-
const resolved = await
|
|
124
|
+
const resolved = await resolveSynthesis();
|
|
100
125
|
if ('error' in resolved)
|
|
101
126
|
return c.text(resolved.error, 503);
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const { text } = await c.req.json();
|
|
106
|
-
if (!text || text.trim().length === 0)
|
|
127
|
+
const body = await c.req.json().catch(() => ({}));
|
|
128
|
+
const text = body.text;
|
|
129
|
+
if (typeof text !== 'string' || text.trim().length === 0)
|
|
107
130
|
return c.text('No text to speak.', 400);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
131
|
+
if (text.length > MAX_SPEAK_CHARS)
|
|
132
|
+
return c.text('Text is too long to speak.', 400);
|
|
133
|
+
return synthesize(resolved.voice, text, c.req.raw.signal);
|
|
134
|
+
});
|
|
135
|
+
// Listen: synthesize with the form's unsaved settings. Credentials never
|
|
136
|
+
// come from the view; mergePreview keeps the saved ones (see its comment).
|
|
137
|
+
app.post('/api/voice/preview', async (c) => {
|
|
138
|
+
const resolved = await resolveSynthesis();
|
|
139
|
+
if ('error' in resolved)
|
|
140
|
+
return c.text(resolved.error, 503);
|
|
141
|
+
const body = await c.req.json().catch(() => null);
|
|
142
|
+
const parsed = parsePreviewBody(body);
|
|
143
|
+
if (typeof parsed === 'string')
|
|
144
|
+
return c.text(parsed, 400);
|
|
145
|
+
const voice = mergePreview(resolved.voice, parsed.settings);
|
|
146
|
+
return synthesize(voice, parsed.text, c.req.raw.signal);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
const MAX_SPEAK_CHARS = 20_000;
|
|
150
|
+
const MAX_PREVIEW_CHARS = 2_000;
|
|
151
|
+
const MAX_DICTIONARY_ROWS = 500;
|
|
152
|
+
/** Validate the preview body; returns the parsed request or an error message. */
|
|
153
|
+
function parsePreviewBody(body) {
|
|
154
|
+
if (!body || typeof body !== 'object')
|
|
155
|
+
return 'Expected a JSON body.';
|
|
156
|
+
const { text, settings } = body;
|
|
157
|
+
if (typeof text !== 'string' || text.trim().length === 0)
|
|
158
|
+
return 'No text to speak.';
|
|
159
|
+
if (text.length > MAX_PREVIEW_CHARS)
|
|
160
|
+
return 'Text is too long for a preview.';
|
|
161
|
+
if (!settings || typeof settings !== 'object' || Array.isArray(settings)) {
|
|
162
|
+
return 'Expected a "settings" object.';
|
|
163
|
+
}
|
|
164
|
+
const s = settings;
|
|
165
|
+
const optString = (k) => s[k] === undefined || typeof s[k] === 'string';
|
|
166
|
+
for (const k of ['ttsLanguage', 'ttsVoice', 'ttsModel', 'ttsEndpoint']) {
|
|
167
|
+
if (!optString(k))
|
|
168
|
+
return `"${k}" must be a string.`;
|
|
169
|
+
}
|
|
170
|
+
if (s.ttsEngine !== undefined && s.ttsEngine !== 'endpoint' && s.ttsEngine !== 'builtin') {
|
|
171
|
+
return '"ttsEngine" must be "endpoint" or "builtin".';
|
|
172
|
+
}
|
|
173
|
+
if (s.ttsSpeed !== undefined && (typeof s.ttsSpeed !== 'number' || !Number.isFinite(s.ttsSpeed))) {
|
|
174
|
+
return '"ttsSpeed" must be a number.';
|
|
175
|
+
}
|
|
176
|
+
if (s.pronunciationEnabled !== undefined && typeof s.pronunciationEnabled !== 'boolean') {
|
|
177
|
+
return '"pronunciationEnabled" must be a boolean.';
|
|
178
|
+
}
|
|
179
|
+
if (s.pronunciation !== undefined) {
|
|
180
|
+
if (!Array.isArray(s.pronunciation) || s.pronunciation.length > MAX_DICTIONARY_ROWS) {
|
|
181
|
+
return '"pronunciation" must be a list of at most 500 entries.';
|
|
113
182
|
}
|
|
114
|
-
|
|
183
|
+
const ok = s.pronunciation.every((e) => e && typeof e.term === 'string' && typeof e.say === 'string');
|
|
184
|
+
if (!ok)
|
|
185
|
+
return 'Each pronunciation entry needs a string "term" and "say".';
|
|
186
|
+
}
|
|
187
|
+
return { text, settings: s };
|
|
188
|
+
}
|
|
189
|
+
/** The saved voice config if synthesis can run: voice enabled, and (for the
|
|
190
|
+
* endpoint engine) some endpoint to talk to. The built-in engine needs none. */
|
|
191
|
+
export async function resolveSynthesis() {
|
|
192
|
+
const voice = (await loadConfig()).voice;
|
|
193
|
+
if (!voice || voice.enabled !== true) {
|
|
194
|
+
return { error: 'Voice mode is disabled. Enable it in Settings → Voice.' };
|
|
195
|
+
}
|
|
196
|
+
if (voice.ttsEngine !== 'builtin' && !voice.endpoint?.trim() && !voice.ttsEndpoint?.trim()) {
|
|
197
|
+
return { error: 'No voice endpoint configured. Set one in Settings → Voice.' };
|
|
198
|
+
}
|
|
199
|
+
return { voice };
|
|
200
|
+
}
|
|
201
|
+
/** Same server: scheme, host and port. A different path or a trailing slash is
|
|
202
|
+
* not a different host, so it keeps the saved key. */
|
|
203
|
+
export function sameHost(a, b) {
|
|
204
|
+
const origin = (u) => {
|
|
205
|
+
const t = (u ?? '').trim();
|
|
115
206
|
try {
|
|
116
|
-
|
|
117
|
-
upstream = await fetch(url(target.endpoint, '/audio/speech'), {
|
|
118
|
-
method: 'POST',
|
|
119
|
-
headers: { ...authHeaders(target.apiKey), 'content-type': 'application/json' },
|
|
120
|
-
body: JSON.stringify(payload),
|
|
121
|
-
});
|
|
207
|
+
return new URL(t).origin;
|
|
122
208
|
}
|
|
123
|
-
catch
|
|
124
|
-
return
|
|
209
|
+
catch {
|
|
210
|
+
return t.replace(/\/+$/, '');
|
|
125
211
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
212
|
+
};
|
|
213
|
+
return origin(a) === origin(b);
|
|
214
|
+
}
|
|
215
|
+
export const KEY_WITHHELD_HINT = 'The endpoint changed: enter the API key again, or save first, to use it with the new endpoint.';
|
|
216
|
+
/** The key to send to `endpoint` for a request built from the settings form. A key
|
|
217
|
+
* typed in the form is the user's own, for that endpoint. The stored key (the form
|
|
218
|
+
* round-trips its encrypted blob) goes only to the host it was saved for;
|
|
219
|
+
* otherwise it is withheld and the request goes without a key. */
|
|
220
|
+
export function formKeyFor(endpoint, formKey, saved) {
|
|
221
|
+
if (!formKey)
|
|
222
|
+
return { key: null, withheld: false };
|
|
223
|
+
if (!isEncrypted(formKey))
|
|
224
|
+
return { key: formKey, withheld: false };
|
|
225
|
+
const pairs = [
|
|
226
|
+
[saved?.apiKey, saved?.endpoint],
|
|
227
|
+
[saved?.ttsApiKey, saved?.ttsEndpoint],
|
|
228
|
+
];
|
|
229
|
+
return pairs.some(([k, ep]) => k === formKey && sameHost(ep, endpoint))
|
|
230
|
+
? { key: formKey, withheld: false }
|
|
231
|
+
: { key: null, withheld: true };
|
|
232
|
+
}
|
|
233
|
+
/** Overlay the form's unsaved synthesis settings on the saved config. The saved
|
|
234
|
+
* `ttsApiKey` is dropped when the previewed `ttsEndpoint` is on another host than
|
|
235
|
+
* the saved one, so editing the URL can never send the stored key to a new host. */
|
|
236
|
+
export function mergePreview(saved, s) {
|
|
237
|
+
const merged = {
|
|
238
|
+
...saved,
|
|
239
|
+
ttsEngine: s.ttsEngine,
|
|
240
|
+
ttsLanguage: s.ttsLanguage,
|
|
241
|
+
ttsVoice: s.ttsVoice,
|
|
242
|
+
ttsModel: s.ttsModel,
|
|
243
|
+
ttsSpeed: s.ttsSpeed,
|
|
244
|
+
ttsEndpoint: s.ttsEndpoint,
|
|
245
|
+
pronunciationEnabled: s.pronunciationEnabled,
|
|
246
|
+
};
|
|
247
|
+
if (!sameHost(s.ttsEndpoint, saved.ttsEndpoint))
|
|
248
|
+
delete merged.ttsApiKey;
|
|
249
|
+
if (s.pronunciation) {
|
|
250
|
+
const code = synthesisLanguage(merged);
|
|
251
|
+
if (code)
|
|
252
|
+
merged.pronunciation = { ...saved.pronunciation, [code]: s.pronunciation };
|
|
253
|
+
}
|
|
254
|
+
return merged;
|
|
255
|
+
}
|
|
256
|
+
let builtinTranscriber = null;
|
|
257
|
+
/** The built-in transcription engine registers itself here; null unregisters. */
|
|
258
|
+
export function setBuiltinTranscriber(fn) {
|
|
259
|
+
builtinTranscriber = fn;
|
|
260
|
+
}
|
|
261
|
+
let builtinSpeaker = null;
|
|
262
|
+
/** The built-in engine registers itself here; null unregisters. */
|
|
263
|
+
export function setBuiltinSpeaker(fn) {
|
|
264
|
+
builtinSpeaker = fn;
|
|
265
|
+
}
|
|
266
|
+
/** Synthesize `text` with the configured engine, dictionary applied, streaming
|
|
267
|
+
* the audio back. Failures are Responses (status + readable body), not throws. */
|
|
268
|
+
export async function synthesize(voice, text, signal) {
|
|
269
|
+
const code = voice.pronunciationEnabled ? synthesisLanguage(voice) : null;
|
|
270
|
+
const input = code ? applyPronunciation(text, dictionaryFor(voice, code)) : text;
|
|
271
|
+
if (voice.ttsEngine === 'builtin') {
|
|
272
|
+
if (!builtinSpeaker) {
|
|
273
|
+
return new Response('The built-in voice engine is not available.', { status: 503 });
|
|
130
274
|
}
|
|
131
|
-
return
|
|
132
|
-
|
|
275
|
+
return builtinSpeaker(voice, input, signal);
|
|
276
|
+
}
|
|
277
|
+
if (!voice.ttsModel)
|
|
278
|
+
return new Response('No synthesis model configured.', { status: 400 });
|
|
279
|
+
const payload = { model: voice.ttsModel, input };
|
|
280
|
+
if (voice.ttsVoice)
|
|
281
|
+
payload.voice = voice.ttsVoice;
|
|
282
|
+
if (Number.isFinite(voice.ttsSpeed) && voice.ttsSpeed > 0) {
|
|
283
|
+
payload.speed = voice.ttsSpeed;
|
|
284
|
+
}
|
|
285
|
+
let upstream;
|
|
286
|
+
try {
|
|
287
|
+
const target = ttsTarget(voice);
|
|
288
|
+
upstream = await fetch(url(target.endpoint, '/audio/speech'), {
|
|
289
|
+
method: 'POST',
|
|
290
|
+
headers: { ...authHeaders(target.apiKey), 'content-type': 'application/json' },
|
|
291
|
+
body: JSON.stringify(payload),
|
|
292
|
+
signal,
|
|
133
293
|
});
|
|
294
|
+
}
|
|
295
|
+
catch (err) {
|
|
296
|
+
return new Response(`Could not reach the voice endpoint: ${err}`, { status: 502 });
|
|
297
|
+
}
|
|
298
|
+
// Stream through; failures are propagated verbatim (a wrong model id must
|
|
299
|
+
// surface as the provider's own message).
|
|
300
|
+
return new Response(upstream.body, {
|
|
301
|
+
status: upstream.status,
|
|
302
|
+
headers: {
|
|
303
|
+
'content-type': upstream.headers.get('content-type') ?? (upstream.ok ? 'audio/mpeg' : 'text/plain'),
|
|
304
|
+
},
|
|
134
305
|
});
|
|
135
306
|
}
|
|
136
307
|
/**
|
package/dist/commands/loader.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// — same model as skills. No separate store; the plugin record is the
|
|
4
4
|
// source of truth.
|
|
5
5
|
//
|
|
6
|
-
// Names are scoped: a plugin named "
|
|
7
|
-
// `commands/
|
|
6
|
+
// Names are scoped: a plugin named "release-tools" with
|
|
7
|
+
// `commands/changelog.md` registers as `/changelog`. On a
|
|
8
8
|
// collision (two active plugins both define `/foo`), the first plugin
|
|
9
9
|
// listed in `agent.plugins` wins; the duplicate is dropped silently and
|
|
10
10
|
// the user can disambiguate by removing the conflicting plugin from the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1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AAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAkE7D;AAED,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,cAAc,EACd,aAAa,EACb,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,cAAc,GACf,CAAC"}
|
|
@@ -18,6 +18,7 @@ import { listSkillsTool } from './list_skills.js';
|
|
|
18
18
|
import { readSkillTool } from './read_skill.js';
|
|
19
19
|
import { listAgentsTool } from './list_agents.js';
|
|
20
20
|
import { invokeAgentTool } from './invoke_agent.js';
|
|
21
|
+
import { setWorkspaceTool } from './set_workspace.js';
|
|
21
22
|
import { listCommandsTool } from './list_commands.js';
|
|
22
23
|
import { invokeCommandTool } from './invoke_command.js';
|
|
23
24
|
import { getAgentContextTool } from './get_agent_context.js';
|
|
@@ -49,6 +50,9 @@ export function registerBuiltins(registry) {
|
|
|
49
50
|
// more than one agent configured — they're useless otherwise).
|
|
50
51
|
registry.register(listAgentsTool);
|
|
51
52
|
registry.register(invokeAgentTool);
|
|
53
|
+
// Session workspace switch (opt-in via allowedTools like any capability
|
|
54
|
+
// tool; session-bound, so not part of a served mcp__* namespace).
|
|
55
|
+
registry.register(setWorkspaceTool);
|
|
52
56
|
// Slash commands as tools — same gating as skills (auto-included when
|
|
53
57
|
// the agent has at least one plugin active).
|
|
54
58
|
registry.register(listCommandsTool);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set_workspace.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/set_workspace.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,aAAa,CAAC;AAEpD,eAAO,MAAM,gBAAgB,EAAE,IA2D9B,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Move the current chat session into one of the configured projects.
|
|
2
|
+
//
|
|
3
|
+
// Session-bound on purpose: it needs ctx.sessionId to persist the override,
|
|
4
|
+
// which is why it is a plain builtin and not part of a served mcp__* namespace
|
|
5
|
+
// (those are context-free). The switch mutates ctx.workingDir in place, so
|
|
6
|
+
// file/shell tools later in the same turn already resolve against the new
|
|
7
|
+
// directory; the prelude (AGENTS.md, project memories) is built once per run
|
|
8
|
+
// and picks the project up from the next turn, when the web server's chat
|
|
9
|
+
// controller reads the override back from the session meta.
|
|
10
|
+
// See docs/superpowers/specs/2026-11-07-desktop-assistant-design.md
|
|
11
|
+
import { stat } from 'node:fs/promises';
|
|
12
|
+
import { loadConfig } from '../../../store/json.js';
|
|
13
|
+
import { updateSessionWorkspace } from '../../../session/store.js';
|
|
14
|
+
import { projectWorkingDir } from '../../../lib/task_git.js';
|
|
15
|
+
export const setWorkspaceTool = {
|
|
16
|
+
name: 'set_workspace',
|
|
17
|
+
description: "Switch this chat session's working directory to one of the configured projects for the rest of the session, " +
|
|
18
|
+
"or pass agent_default: true to go back to the agent's own working directory (use it when leaving a project). " +
|
|
19
|
+
'Pass exactly one of project_id / agent_default. Call mcp__task__project_list first to get a project_id.',
|
|
20
|
+
parameters: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
project_id: { type: 'string', description: 'Id of the project to switch to (from project_list).' },
|
|
24
|
+
agent_default: {
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
description: "true = return to this agent's own working directory (alternative to project_id).",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
required: [],
|
|
30
|
+
},
|
|
31
|
+
dangerous: true,
|
|
32
|
+
execute: async (args, ctx) => {
|
|
33
|
+
const agentId = ctx.callerAgent?.id;
|
|
34
|
+
if (!ctx.sessionId || !agentId) {
|
|
35
|
+
return { content: 'Error: no chat session to switch — set_workspace only works inside a saved chat session.' };
|
|
36
|
+
}
|
|
37
|
+
const a = args;
|
|
38
|
+
const wantDefault = a.agent_default === true;
|
|
39
|
+
const projectId = String(a.project_id ?? '');
|
|
40
|
+
if (wantDefault === !!projectId) {
|
|
41
|
+
return { content: 'Error: pass exactly one of project_id or agent_default: true.' };
|
|
42
|
+
}
|
|
43
|
+
if (wantDefault) {
|
|
44
|
+
const own = ctx.callerAgent?.workingDir;
|
|
45
|
+
if (!own) {
|
|
46
|
+
return { content: "Error: this agent has no working directory of its own to return to." };
|
|
47
|
+
}
|
|
48
|
+
ctx.workingDir = own;
|
|
49
|
+
await updateSessionWorkspace({ agentId, id: ctx.sessionId }, null);
|
|
50
|
+
return {
|
|
51
|
+
content: `Back to the agent's own working directory (${own}). File and shell tools already use it; ` +
|
|
52
|
+
'project context files (AGENTS.md) and memories follow from the next turn.',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const project = ((await loadConfig()).projects ?? []).find((p) => p.id === projectId);
|
|
56
|
+
if (!project) {
|
|
57
|
+
return { content: `Error: unknown project "${projectId}". Call mcp__task__project_list for the valid ids.` };
|
|
58
|
+
}
|
|
59
|
+
const dir = projectWorkingDir(project);
|
|
60
|
+
const isDir = dir ? await stat(dir).then((s) => s.isDirectory(), () => false) : false;
|
|
61
|
+
if (!isDir) {
|
|
62
|
+
return { content: `Error: project "${project.name}" has no directory on disk (${dir || 'no working dir configured'}).` };
|
|
63
|
+
}
|
|
64
|
+
ctx.workingDir = dir;
|
|
65
|
+
await updateSessionWorkspace({ agentId, id: ctx.sessionId }, { workingDir: dir, projectId: project.id });
|
|
66
|
+
return {
|
|
67
|
+
content: `Switched to project "${project.name}" (${dir}). File and shell tools already use it; ` +
|
|
68
|
+
'project context files (AGENTS.md) and project memories apply from the next turn.',
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
};
|
|
@@ -3,7 +3,7 @@ import type { AgentSpec, CommandSpec, McpServerSpec, PluginManifestKind, SkillSp
|
|
|
3
3
|
/**
|
|
4
4
|
* Read `<pluginRoot>/.mcp.json` and return the declared MCP server specs.
|
|
5
5
|
* Two shapes are observed in the wild and both are accepted:
|
|
6
|
-
* - `{ "mcpServers": { name: { … } } }` (
|
|
6
|
+
* - `{ "mcpServers": { name: { … } } }` (official spec)
|
|
7
7
|
* - `{ name: { … } }` (claude-plugins-official examples)
|
|
8
8
|
*
|
|
9
9
|
* Returns `undefined` when the file is absent, malformed, or contains zero
|
package/dist/plugins/manifest.js
CHANGED
|
@@ -73,7 +73,7 @@ function parseMcpServersMap(raw) {
|
|
|
73
73
|
/**
|
|
74
74
|
* Read `<pluginRoot>/.mcp.json` and return the declared MCP server specs.
|
|
75
75
|
* Two shapes are observed in the wild and both are accepted:
|
|
76
|
-
* - `{ "mcpServers": { name: { … } } }` (
|
|
76
|
+
* - `{ "mcpServers": { name: { … } } }` (official spec)
|
|
77
77
|
* - `{ name: { … } }` (claude-plugins-official examples)
|
|
78
78
|
*
|
|
79
79
|
* Returns `undefined` when the file is absent, malformed, or contains zero
|
package/dist/session/store.d.ts
CHANGED
|
@@ -46,6 +46,12 @@ export declare function updateTitle(meta: Pick<SessionMetaRecord, 'agentId' | 'i
|
|
|
46
46
|
/** Persist the Claude Code session id by appending a fresh meta line
|
|
47
47
|
* (readSession picks the latest meta; listForAgent keeps using the first). */
|
|
48
48
|
export declare function updateClaudeSessionId(meta: Pick<SessionMetaRecord, 'agentId' | 'id'>, claudeSessionId: string): Promise<void>;
|
|
49
|
+
/** Persist a session-level workspace override (`set_workspace`; `null` clears it). Appends a
|
|
50
|
+
* new session_meta record, latest wins — same pattern as claudeSessionId. */
|
|
51
|
+
export declare function updateSessionWorkspace(meta: Pick<SessionMetaRecord, 'agentId' | 'id'>, ws: {
|
|
52
|
+
workingDir: string;
|
|
53
|
+
projectId: string;
|
|
54
|
+
} | null): Promise<void>;
|
|
49
55
|
export declare function updateAcpSessionId(meta: Pick<SessionMetaRecord, 'agentId' | 'id'>, acpSessionId: string): Promise<void>;
|
|
50
56
|
export declare function deleteSession(agentId: string, sessionId: string): Promise<void>;
|
|
51
57
|
export declare function userMessage(content: string, opts?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/session/store.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AAED,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,iBAAS,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzC;AAED,iBAAS,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE/D;AAmDD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,MAAM,CAAC,EAAE,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,EACtB,KAAK,CAAC,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACzC,aAAa,CAYf;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGnF;AAED,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,oBAAoB,EAAE,EACpC,IAAI,CAAC,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACzC,aAAa,CAWf;AAID,eAAO,MAAM,YAAY;;;;CAA2C,CAAC"}
|
package/dist/session/store.js
CHANGED
|
@@ -211,6 +211,17 @@ export async function updateClaudeSessionId(meta, claudeSessionId) {
|
|
|
211
211
|
const path = sessionPath(meta.agentId, meta.id);
|
|
212
212
|
await appendFile(path, serialize(record), { mode: 0o600 });
|
|
213
213
|
}
|
|
214
|
+
/** Persist a session-level workspace override (`set_workspace`; `null` clears it). Appends a
|
|
215
|
+
* new session_meta record, latest wins — same pattern as claudeSessionId. */
|
|
216
|
+
export async function updateSessionWorkspace(meta, ws) {
|
|
217
|
+
const current = await readSession(meta.agentId, meta.id);
|
|
218
|
+
// null clears the override: the appended record simply omits both keys
|
|
219
|
+
// (the latest record replaces the whole meta, so old files need no migration).
|
|
220
|
+
const { workingDir: _w, projectId: _p, ...rest } = current.meta;
|
|
221
|
+
const record = ws ? { ...rest, workingDir: ws.workingDir, projectId: ws.projectId } : rest;
|
|
222
|
+
const path = sessionPath(meta.agentId, meta.id);
|
|
223
|
+
await appendFile(path, serialize(record), { mode: 0o600 });
|
|
224
|
+
}
|
|
214
225
|
export async function updateAcpSessionId(meta, acpSessionId) {
|
|
215
226
|
const current = await readSession(meta.agentId, meta.id);
|
|
216
227
|
const record = { ...current.meta, acpSessionId };
|
package/dist/session/types.d.ts
CHANGED
|
@@ -35,6 +35,11 @@ export interface SessionMetaRecord {
|
|
|
35
35
|
taskId?: string;
|
|
36
36
|
projectId?: string;
|
|
37
37
|
taskRole?: 'developer' | 'planner' | 'reviewer';
|
|
38
|
+
/** Session-level working-dir override written by the `set_workspace` tool
|
|
39
|
+
* (together with `projectId`). Honoured per turn by the web server's chat
|
|
40
|
+
* controller; absent ⇒ the agent's own workingDir (clearing it appends a
|
|
41
|
+
* record without the key). */
|
|
42
|
+
workingDir?: string;
|
|
38
43
|
}
|
|
39
44
|
export type Role = 'user' | 'assistant' | 'tool';
|
|
40
45
|
export interface ToolAttachmentRecord {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/session/types.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MA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dist/store/db.js
CHANGED
|
@@ -61,7 +61,9 @@ export function tryNormalizeChecklistStatus(status) {
|
|
|
61
61
|
/** Ids are validated slugs/composites; anything else never matches a record.
|
|
62
62
|
* Also keeps quotes/backslashes out of interpolated queries. */
|
|
63
63
|
function safeId(id) {
|
|
64
|
-
|
|
64
|
+
// `_` is needed for Telegram session ids (`telegram_<chatId>`); it is inert in
|
|
65
|
+
// both the interpolated `= '…'` SQL and a filename.
|
|
66
|
+
return /^[a-z0-9][a-z0-9_-]*$/.test(id);
|
|
65
67
|
}
|
|
66
68
|
export async function runQuery(sql) {
|
|
67
69
|
if (!migrationPromise)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type PocketLanguage = 'english' | 'french' | 'german' | 'spanish' | 'portuguese' | 'italian' | 'dutch';
|
|
2
|
+
export declare const POCKET_BASE_URL = "https://huggingface.co/Alias-Alias/pocket-3-3-0-tts-onnx/resolve";
|
|
3
|
+
export declare const POCKET_REVISION = "71a4d6d11a76e26b98709fa163477c77d16bdbdb";
|
|
4
|
+
export type BundleFile = {
|
|
5
|
+
name: string;
|
|
6
|
+
sha256: string;
|
|
7
|
+
bytes: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const POCKET_LANGUAGES: Readonly<Record<PocketLanguage, {
|
|
10
|
+
code: string;
|
|
11
|
+
dir: string;
|
|
12
|
+
nativeVoice: string;
|
|
13
|
+
files: readonly BundleFile[];
|
|
14
|
+
}>>;
|
|
15
|
+
export declare const POCKET_VOICES: readonly string[];
|
|
16
|
+
export declare const ORT_VERSION = "1.31.1";
|
|
17
|
+
export declare const ORT_TARBALLS: Readonly<Record<'node' | 'common', {
|
|
18
|
+
url: string;
|
|
19
|
+
integrity: string;
|
|
20
|
+
}>>;
|
|
21
|
+
export declare const POCKET_SAMPLE_RATE = 24000;
|
|
22
|
+
export type InferenceSource = 'npm-pocket-tts' | 'own-loop';
|
|
23
|
+
export declare const INFERENCE_SOURCE: InferenceSource;
|
|
24
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/voice/pocket/catalog.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,YAAY,GACZ,SAAS,GACT,OAAO,CAAC;AAEZ,eAAO,MAAM,eAAe,qEACwC,CAAC;AACrE,eAAO,MAAM,eAAe,6CAA6C,CAAC;AAE1E,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAMzE,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CACrC,MAAM,CACJ,cAAc,EACd;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAA;CAAE,CACjF,CA2GF,CAAC;AAGF,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAS1C,CAAC;AAEF,eAAO,MAAM,WAAW,WAAW,CAAC;AAIpC,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,QAAQ,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAWhG,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAExC,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,UAAU,CAAC;AAC5D,eAAO,MAAM,gBAAgB,EAAE,eAA4B,CAAC"}
|