@vellumai/assistant 0.10.10-dev.202607211446.b7f81ca → 0.10.10-dev.202607211519.4a4e758
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/openapi.yaml +3 -1
- package/package.json +1 -1
- package/scripts/generate-openapi.ts +21 -117
- package/src/__tests__/agent-loop-mutable-latest-user-message.test.ts +7 -0
- package/src/__tests__/injector-pkb-v2-silenced.test.ts +37 -7
- package/src/__tests__/injector-v3-suppression.test.ts +7 -0
- package/src/__tests__/lifecycle-memory-v2-seed.test.ts +8 -4
- package/src/__tests__/plugin-import-boundary-guard.test.ts +1 -0
- package/src/__tests__/voice-config-update.test.ts +92 -1
- package/src/cli/commands/__tests__/tts.test.ts +121 -1
- package/src/cli/commands/memory/index.help.ts +5 -5
- package/src/cli/commands/tts.help.ts +33 -0
- package/src/cli/commands/tts.ts +80 -0
- package/src/cli/lib/__tests__/upgrade-plugin.test.ts +44 -6
- package/src/cli/lib/upgrade-plugin.ts +45 -13
- package/src/config/bundled-skills/settings/TOOLS.json +3 -3
- package/src/config/bundled-skills/settings/tools/voice-config-update.ts +42 -14
- package/src/config/memory-v3-gate.test.ts +40 -0
- package/src/config/memory-v3-gate.ts +39 -0
- package/src/daemon/conversation-lifecycle.ts +7 -6
- package/src/daemon/tool-side-effects.ts +13 -0
- package/src/permissions/checker.test.ts +7 -0
- package/src/plugins/defaults/memory/__tests__/memory-retrospective-job.test.ts +7 -0
- package/src/plugins/defaults/memory/context-search/sources/memory.ts +2 -1
- package/src/plugins/defaults/memory/graph/__tests__/handle-remember-v2.test.ts +23 -39
- package/src/plugins/defaults/memory/graph/graph-search.ts +6 -5
- package/src/plugins/defaults/memory/graph/retriever.ts +6 -5
- package/src/plugins/defaults/memory/graph/tool-handlers.test.ts +28 -5
- package/src/plugins/defaults/memory/graph/tool-handlers.ts +24 -56
- package/src/plugins/defaults/memory/graph/tools.ts +13 -14
- package/src/plugins/defaults/memory/indexer.ts +22 -21
- package/src/plugins/defaults/memory/injectors.ts +14 -9
- package/src/plugins/defaults/memory/job-handler-registration.ts +5 -5
- package/src/plugins/defaults/memory/job-handlers.ts +4 -3
- package/src/plugins/defaults/memory/jobs/embed-pkb-file.ts +7 -6
- package/src/plugins/defaults/memory/jobs-worker.ts +42 -36
- package/src/plugins/defaults/memory/pkb/pkb-search.ts +5 -4
- package/src/plugins/defaults/memory/search/semantic.ts +6 -4
- package/src/plugins/defaults/memory/src/memory-item-routes.ts +6 -5
- package/src/plugins/defaults/memory/src/memory-v2-routes.ts +10 -8
- package/src/plugins/defaults/memory/startup.ts +14 -12
- package/src/plugins/defaults/memory/tools.test.ts +29 -55
- package/src/plugins/defaults/memory/tools.ts +8 -7
- package/src/plugins/defaults/memory/v2/__tests__/consolidation-job.test.ts +7 -0
- package/src/plugins/defaults/memory/v2/consolidation-job.ts +7 -4
- package/src/plugins/defaults/memory/v2/frontmatter-sweep.ts +4 -3
- package/src/plugins/defaults/memory/v2/memory-v2-startup.test.ts +7 -0
- package/src/plugins/defaults/memory/v2/memory-v2-startup.ts +6 -5
- package/src/plugins/defaults/memory/v2/static-context.ts +5 -4
- package/src/plugins/defaults/memory/v2/sweep-job.ts +6 -5
- package/src/plugins/defaults/memory/v3/__tests__/maintain-job.test.ts +7 -0
- package/src/runtime/routes/__tests__/default-plugin-routes.test.ts +33 -0
- package/src/runtime/routes/__tests__/route-tags-guard.test.ts +26 -0
- package/src/runtime/routes/consolidation-routes.ts +11 -12
- package/src/runtime/routes/content-source-routes.ts +1 -0
- package/src/runtime/routes/filing-routes.ts +5 -2
- package/src/runtime/routes/sanity-routes.ts +2 -0
- package/src/runtime/routes/user-route-resolution.ts +35 -20
- package/src/tts/__tests__/tts-voice-field.test.ts +45 -0
- package/src/tts/tts-voice-field.ts +67 -0
package/openapi.yaml
CHANGED
|
@@ -17703,7 +17703,9 @@ paths:
|
|
|
17703
17703
|
post:
|
|
17704
17704
|
operationId: memory_v2_reembedskills_post
|
|
17705
17705
|
summary: Re-seed v2 skill entries from the current skill catalog
|
|
17706
|
-
description:
|
|
17706
|
+
description:
|
|
17707
|
+
Synchronously re-runs seedV2SkillEntries against the current skill catalog. Gated on concept-page memory
|
|
17708
|
+
being active.
|
|
17707
17709
|
tags:
|
|
17708
17710
|
- memory
|
|
17709
17711
|
requestBody:
|
package/package.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* HTTP route definitions.
|
|
5
5
|
*
|
|
6
6
|
* Pipeline:
|
|
7
|
-
* 1.
|
|
8
|
-
*
|
|
7
|
+
* 1. Import the assembled `ROUTES` table from src/runtime/routes/index.ts —
|
|
8
|
+
* the same single source of truth the HTTP and IPC servers serve.
|
|
9
9
|
* 2. Combine with pre-auth / non-v1 routes.
|
|
10
10
|
* 3. Convert to OpenAPI path items.
|
|
11
11
|
* 4. Write to openapi.yaml.
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
* cd assistant && bun run generate:openapi -- --check # CI: fail if stale
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
19
|
+
import { readFileSync } from "node:fs";
|
|
20
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
21
21
|
import { join, resolve } from "node:path";
|
|
22
22
|
|
|
23
23
|
import { stringify } from "yaml";
|
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
} from "zod-openapi";
|
|
31
31
|
import { createDocument } from "zod-openapi";
|
|
32
32
|
|
|
33
|
+
import { ROUTES } from "../src/runtime/routes/index.js";
|
|
33
34
|
import { jsonValueSchema } from "../src/telemetry/telemetry-wire.generated.js";
|
|
34
35
|
|
|
35
36
|
// The recursive wire JSON-value schema (`claims`/`suggestions` item type) must
|
|
@@ -39,8 +40,6 @@ import { jsonValueSchema } from "../src/telemetry/telemetry-wire.generated.js";
|
|
|
39
40
|
z.globalRegistry.add(jsonValueSchema, { id: "TelemetryJsonValue" });
|
|
40
41
|
|
|
41
42
|
const ROOT = resolve(import.meta.dir, "..");
|
|
42
|
-
const ROUTES_DIR = join(ROOT, "src/runtime/routes");
|
|
43
|
-
const PLUGIN_DEFAULTS_DIR = join(ROOT, "src/plugins/defaults");
|
|
44
43
|
const OUTPUT_PATH = join(ROOT, "openapi.yaml");
|
|
45
44
|
const PKG_PATH = join(ROOT, "package.json");
|
|
46
45
|
|
|
@@ -120,8 +119,6 @@ const RouteEntrySchema = z.object({
|
|
|
120
119
|
additionalResponses: z
|
|
121
120
|
.record(z.string(), RouteAdditionalResponseSchema)
|
|
122
121
|
.optional(),
|
|
123
|
-
/** Source module filename, used for auto-deriving tags. */
|
|
124
|
-
sourceModule: z.string().optional(),
|
|
125
122
|
});
|
|
126
123
|
|
|
127
124
|
type RouteEntry = z.infer<typeof RouteEntrySchema>;
|
|
@@ -156,100 +153,23 @@ function resolveSchemaForDocument(schemaSource: unknown): ContentSchema {
|
|
|
156
153
|
// ---------------------------------------------------------------------------
|
|
157
154
|
|
|
158
155
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
* (
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* (non-`ROUTES` modules under either dir are simply ignored). Sorted for
|
|
168
|
-
* reproducible output (see {@link collectRoutesFromModules}).
|
|
156
|
+
* Collect the OpenAPI-relevant fields of every route from the assembled
|
|
157
|
+
* `runtime/routes/index.ts` `ROUTES` table — the same single source of truth
|
|
158
|
+
* the HTTP and IPC servers serve. Each `RouteDefinition` is parsed through
|
|
159
|
+
* {@link RouteEntrySchema}, which keeps only the documentable fields (method,
|
|
160
|
+
* endpoint, summary, tags, request/response bodies, …) and drops the runtime
|
|
161
|
+
* ones (handler, policy). Routes that omit `tags` are surfaced without a tag —
|
|
162
|
+
* a lint-style guard test asserts every route sets one, so the spec never
|
|
163
|
+
* loses grouping.
|
|
169
164
|
*/
|
|
170
|
-
|
|
171
|
-
const dirs = [ROUTES_DIR];
|
|
172
|
-
for (const entry of await readdir(PLUGIN_DEFAULTS_DIR, {
|
|
173
|
-
withFileTypes: true,
|
|
174
|
-
})) {
|
|
175
|
-
if (!entry.isDirectory()) continue;
|
|
176
|
-
for (const sub of ["src", "routes"]) {
|
|
177
|
-
const dir = join(PLUGIN_DEFAULTS_DIR, entry.name, sub);
|
|
178
|
-
if (existsSync(dir)) {
|
|
179
|
-
dirs.push(dir);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return dirs.sort();
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Dynamically import every route module under each {@link routeModuleDirs}
|
|
188
|
-
* entry and collect all exported `ROUTES` / `*_ROUTES` arrays. Each route
|
|
189
|
-
* module exports a `RouteDefinition[]`; new modules are picked up without
|
|
190
|
-
* manual updates.
|
|
191
|
-
*/
|
|
192
|
-
async function collectRoutesFromModules(): Promise<RouteEntry[]> {
|
|
165
|
+
function collectRoutes(): RouteEntry[] {
|
|
193
166
|
const routes: RouteEntry[] = [];
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
// every entry. The duplicate `method:endpoint` keys are deduped later by
|
|
199
|
-
// first-seen, but the surviving entry's `sourceModule` (used to derive
|
|
200
|
-
// OpenAPI `tags`) depends on `readdir` order — which is filesystem
|
|
201
|
-
// dependent and diverges between local sandbox and the CI runner, making
|
|
202
|
-
// the generator non-reproducible. Sort the file list as well so directory
|
|
203
|
-
// entry order can never affect the output.
|
|
204
|
-
const files = (await readdir(dir, { recursive: true }))
|
|
205
|
-
.filter(
|
|
206
|
-
(f) =>
|
|
207
|
-
typeof f === "string" &&
|
|
208
|
-
f.endsWith(".ts") &&
|
|
209
|
-
!f.endsWith(".test.ts") &&
|
|
210
|
-
!f.endsWith(".benchmark.test.ts") &&
|
|
211
|
-
!f.includes("node_modules") &&
|
|
212
|
-
f !== "index.ts" &&
|
|
213
|
-
!f.endsWith("/index.ts"),
|
|
214
|
-
)
|
|
215
|
-
.sort();
|
|
216
|
-
|
|
217
|
-
for (const file of files) {
|
|
218
|
-
const filePath = join(dir, file);
|
|
219
|
-
let mod: Record<string, unknown>;
|
|
220
|
-
try {
|
|
221
|
-
mod = (await import(filePath)) as Record<string, unknown>;
|
|
222
|
-
} catch (err) {
|
|
223
|
-
console.warn(
|
|
224
|
-
`Warning: could not import ${file}: ${err instanceof Error ? err.message : err}`,
|
|
225
|
-
);
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Collect every export whose name is `ROUTES` or ends in `_ROUTES`.
|
|
230
|
-
// A handful of route files (e.g. `channel-route-definitions.ts`,
|
|
231
|
-
// `contact-prompt-routes.ts`) export under domain-prefixed names like
|
|
232
|
-
// `CHANNEL_ROUTES` and `CONTACT_PROMPT_ROUTES` rather than the
|
|
233
|
-
// canonical `ROUTES`. Without this fan-out the only way those routes
|
|
234
|
-
// reached the spec was via the `index.ts` barrel — which is excluded
|
|
235
|
-
// above for reproducibility.
|
|
236
|
-
const exportNames = Object.keys(mod)
|
|
237
|
-
.filter((k) => k === "ROUTES" || k.endsWith("_ROUTES"))
|
|
238
|
-
.sort();
|
|
239
|
-
for (const name of exportNames) {
|
|
240
|
-
const arr = mod[name];
|
|
241
|
-
if (!Array.isArray(arr)) continue;
|
|
242
|
-
for (const raw of arr) {
|
|
243
|
-
const result = RouteEntrySchema.safeParse({
|
|
244
|
-
...(typeof raw === "object" && raw !== null ? raw : {}),
|
|
245
|
-
sourceModule: file,
|
|
246
|
-
});
|
|
247
|
-
if (result.success) routes.push(result.data);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
167
|
+
for (const raw of ROUTES) {
|
|
168
|
+
const result = RouteEntrySchema.safeParse(raw);
|
|
169
|
+
if (result.success) {
|
|
170
|
+
routes.push(result.data);
|
|
250
171
|
}
|
|
251
172
|
}
|
|
252
|
-
|
|
253
173
|
return routes;
|
|
254
174
|
}
|
|
255
175
|
|
|
@@ -395,14 +315,6 @@ function resolveBodyContent(body: unknown): {
|
|
|
395
315
|
return { contentType: "application/json", schemaSource: body };
|
|
396
316
|
}
|
|
397
317
|
|
|
398
|
-
/** Derive a tag name from a route module filename (e.g. "secret-routes.ts" → "secrets"). */
|
|
399
|
-
function deriveTagFromModule(filename: string): string {
|
|
400
|
-
// Strip directory prefix and extension
|
|
401
|
-
const base = filename.replace(/^.*[\/]/, "").replace(/\.ts$/, "");
|
|
402
|
-
// Remove trailing "-routes" suffix
|
|
403
|
-
return base.replace(/-routes$/, "");
|
|
404
|
-
}
|
|
405
|
-
|
|
406
318
|
function buildSpec(
|
|
407
319
|
routes: RouteEntry[],
|
|
408
320
|
version: string,
|
|
@@ -505,13 +417,8 @@ function buildSpec(
|
|
|
505
417
|
}
|
|
506
418
|
}
|
|
507
419
|
|
|
508
|
-
// Determine tags: explicit tags > auto-derived from source module
|
|
509
420
|
const tags: string[] | undefined =
|
|
510
|
-
entry.tags && entry.tags.length > 0
|
|
511
|
-
? entry.tags
|
|
512
|
-
: entry.sourceModule
|
|
513
|
-
? [deriveTagFromModule(entry.sourceModule)]
|
|
514
|
-
: undefined;
|
|
421
|
+
entry.tags && entry.tags.length > 0 ? entry.tags : undefined;
|
|
515
422
|
|
|
516
423
|
// Build the operation. Default success status is 200; async endpoints
|
|
517
424
|
// that enqueue a job and return immediately set responseStatus: "202"
|
|
@@ -613,11 +520,8 @@ async function main() {
|
|
|
613
520
|
};
|
|
614
521
|
const version = pkg.version;
|
|
615
522
|
|
|
616
|
-
// Collect routes
|
|
617
|
-
const
|
|
618
|
-
|
|
619
|
-
// Combine all route sources
|
|
620
|
-
const allRoutes: RouteEntry[] = moduleRoutes;
|
|
523
|
+
// Collect routes from the assembled shared route table
|
|
524
|
+
const allRoutes: RouteEntry[] = collectRoutes();
|
|
621
525
|
|
|
622
526
|
// Build the spec
|
|
623
527
|
const spec = buildSpec(allRoutes, version);
|
|
@@ -18,6 +18,13 @@ import { afterEach, describe, expect, mock, test } from "bun:test";
|
|
|
18
18
|
let memoryV3LiveSlot = false;
|
|
19
19
|
mock.module("../config/memory-v3-gate.js", () => ({
|
|
20
20
|
isMemoryV3Live: () => memoryV3LiveSlot,
|
|
21
|
+
usesConceptPageMemory: (memory?: {
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
v2?: { enabled?: boolean };
|
|
24
|
+
v3?: { live?: boolean };
|
|
25
|
+
}) =>
|
|
26
|
+
memory?.enabled !== false &&
|
|
27
|
+
(memory?.v3?.live === true || memory?.v2?.enabled === true),
|
|
21
28
|
}));
|
|
22
29
|
|
|
23
30
|
import { AgentLoop } from "../agent/loop.js";
|
|
@@ -18,24 +18,32 @@ import { afterEach, beforeEach, describe, expect, mock, test } from "bun:test";
|
|
|
18
18
|
|
|
19
19
|
import { setConfig } from "./helpers/set-config.js";
|
|
20
20
|
|
|
21
|
-
let
|
|
21
|
+
let memoryState: {
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
v2: { enabled: boolean };
|
|
24
|
+
v3?: { live?: boolean };
|
|
25
|
+
} = { v2: { enabled: false } };
|
|
22
26
|
|
|
23
27
|
/**
|
|
24
|
-
*
|
|
25
|
-
* loader-based readers) and drives the mocked plugin accessor below.
|
|
28
|
+
* Set the memory gate state: seeds the workspace config for real (covering
|
|
29
|
+
* any loader-based readers) and drives the mocked plugin accessor below.
|
|
26
30
|
*/
|
|
27
|
-
function
|
|
28
|
-
|
|
31
|
+
function setMemoryState(state: typeof memoryState): void {
|
|
32
|
+
memoryState = state;
|
|
29
33
|
setConfig("memory", {
|
|
30
|
-
|
|
34
|
+
...state,
|
|
31
35
|
retrieval: { scratchpadInjection: { enabled: true } },
|
|
32
36
|
});
|
|
33
37
|
}
|
|
34
38
|
|
|
39
|
+
function setV2Active(enabled: boolean): void {
|
|
40
|
+
setMemoryState({ v2: { enabled } });
|
|
41
|
+
}
|
|
42
|
+
|
|
35
43
|
// The PKB silencing gate reads the plugin's own config accessor.
|
|
36
44
|
mock.module("../plugins/defaults/memory/config.js", () => ({
|
|
37
45
|
getMemoryConfig: () => ({
|
|
38
|
-
|
|
46
|
+
...memoryState,
|
|
39
47
|
retrieval: { scratchpadInjection: { enabled: true } },
|
|
40
48
|
}),
|
|
41
49
|
}));
|
|
@@ -124,4 +132,26 @@ describe("PKB injector v2 cutover behavior", () => {
|
|
|
124
132
|
expect(texts.some((t) => t.includes("<NOW.md"))).toBe(true);
|
|
125
133
|
expect(texts).toContain("What next?");
|
|
126
134
|
});
|
|
135
|
+
|
|
136
|
+
test("v3 live with the v2 flag off → pkb-context and pkb-reminder silenced", async () => {
|
|
137
|
+
setMemoryState({ v2: { enabled: false }, v3: { live: true } });
|
|
138
|
+
const result = await applyRuntimeInjections(RUN_MESSAGES, {
|
|
139
|
+
...makeTurnContext(),
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const texts = tailTexts(result.messages);
|
|
143
|
+
expect(texts.some((t) => t.includes("<knowledge_base>"))).toBe(false);
|
|
144
|
+
expect(texts.some((t) => t.includes("<system_reminder>"))).toBe(false);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test("memory disabled → pkb-context and pkb-reminder stay silenced even with no engine active", async () => {
|
|
148
|
+
setMemoryState({ enabled: false, v2: { enabled: false } });
|
|
149
|
+
const result = await applyRuntimeInjections(RUN_MESSAGES, {
|
|
150
|
+
...makeTurnContext(),
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
const texts = tailTexts(result.messages);
|
|
154
|
+
expect(texts.some((t) => t.includes("<knowledge_base>"))).toBe(false);
|
|
155
|
+
expect(texts.some((t) => t.includes("<system_reminder>"))).toBe(false);
|
|
156
|
+
});
|
|
127
157
|
});
|
|
@@ -63,6 +63,13 @@ let memoryV3LiveSlot = false;
|
|
|
63
63
|
mock.module("../config/memory-v3-gate.js", () => ({
|
|
64
64
|
isMemoryV3Live: () => memoryV3LiveSlot,
|
|
65
65
|
isProcToSkillsActive: () => false,
|
|
66
|
+
usesConceptPageMemory: (memory?: {
|
|
67
|
+
enabled?: boolean;
|
|
68
|
+
v2?: { enabled?: boolean };
|
|
69
|
+
v3?: { live?: boolean };
|
|
70
|
+
}) =>
|
|
71
|
+
memory?.enabled !== false &&
|
|
72
|
+
(memory?.v3?.live === true || memory?.v2?.enabled === true),
|
|
66
73
|
}));
|
|
67
74
|
|
|
68
75
|
const { applyRuntimeInjections } =
|
|
@@ -158,17 +158,21 @@ function makeConfig(v2Enabled: boolean): AssistantConfig {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
|
-
* Drain all
|
|
161
|
+
* Drain all pending async work so any `void`-prefixed promise inside
|
|
162
162
|
* `maybeSeedMemoryV2Skills` settles before the test asserts. The fire-and-
|
|
163
163
|
* forget chain involves: dynamic-import settle → `.then` callback →
|
|
164
|
-
* inner `seedV2SkillEntries` resolution → `.catch` settle.
|
|
165
|
-
*
|
|
166
|
-
*
|
|
164
|
+
* inner `seedV2SkillEntries` resolution → `.catch` settle. Dynamic-import
|
|
165
|
+
* settlement can take a macrotask (not just microtasks), so yield through
|
|
166
|
+
* a timer with microtask drains on both sides.
|
|
167
167
|
*/
|
|
168
168
|
async function flushMicrotasks(): Promise<void> {
|
|
169
169
|
for (let i = 0; i < 10; i++) {
|
|
170
170
|
await Promise.resolve();
|
|
171
171
|
}
|
|
172
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
173
|
+
for (let i = 0; i < 10; i++) {
|
|
174
|
+
await Promise.resolve();
|
|
175
|
+
}
|
|
172
176
|
}
|
|
173
177
|
|
|
174
178
|
// ---------------------------------------------------------------------------
|
|
@@ -79,6 +79,7 @@ const BASELINE: Record<string, readonly string[]> = {
|
|
|
79
79
|
"../../../util/logger.js",
|
|
80
80
|
],
|
|
81
81
|
memory: [
|
|
82
|
+
"../../../../../config/memory-v3-gate.js",
|
|
82
83
|
"../../../../../config/types.js",
|
|
83
84
|
"../../../../../messaging/providers/slack/message-metadata.js",
|
|
84
85
|
"../../../../../persistence/auto-analysis-constants.js",
|
|
@@ -203,7 +203,7 @@ describe("voice_config_update — tts_voice_id", () => {
|
|
|
203
203
|
expect((config.elevenlabs as any)?.voiceId).toBeUndefined();
|
|
204
204
|
});
|
|
205
205
|
|
|
206
|
-
test("rejects non-alphanumeric voice ID", async () => {
|
|
206
|
+
test("rejects non-alphanumeric voice ID when provider is elevenlabs", async () => {
|
|
207
207
|
const result = await run(
|
|
208
208
|
{ setting: "tts_voice_id", value: "abc-123!" },
|
|
209
209
|
makeContext(),
|
|
@@ -214,6 +214,97 @@ describe("voice_config_update — tts_voice_id", () => {
|
|
|
214
214
|
});
|
|
215
215
|
});
|
|
216
216
|
|
|
217
|
+
// ---------------------------------------------------------------------------
|
|
218
|
+
// Tests: tts_voice_id targets the active provider's voice field
|
|
219
|
+
// ---------------------------------------------------------------------------
|
|
220
|
+
|
|
221
|
+
describe("voice_config_update — tts_voice_id (managed/vellum active)", () => {
|
|
222
|
+
function makeVellumActive(): void {
|
|
223
|
+
writeConfig({ services: { tts: { provider: "vellum" } } });
|
|
224
|
+
invalidateConfigCache();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
test("writes a Deepgram Aura model id to services.tts.providers.vellum.model", async () => {
|
|
228
|
+
makeVellumActive();
|
|
229
|
+
|
|
230
|
+
const result = await run(
|
|
231
|
+
{ setting: "tts_voice_id", value: "aura-2-zeus-en" },
|
|
232
|
+
makeContext(),
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
expect(result.isError).toBe(false);
|
|
236
|
+
const config = readConfig();
|
|
237
|
+
expect((config.services as any)?.tts?.providers?.vellum?.model).toBe(
|
|
238
|
+
"aura-2-zeus-en",
|
|
239
|
+
);
|
|
240
|
+
// The ElevenLabs field is never touched when vellum is active.
|
|
241
|
+
expect(
|
|
242
|
+
(config.services as any)?.tts?.providers?.elevenlabs?.voiceId,
|
|
243
|
+
).toBeUndefined();
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
test("accepts an ElevenLabs voice id as a managed model (managed serves ElevenLabs voices)", async () => {
|
|
247
|
+
makeVellumActive();
|
|
248
|
+
|
|
249
|
+
const result = await run(
|
|
250
|
+
{ setting: "tts_voice_id", value: "EXAVITQu4vr4xnSDxMaL" },
|
|
251
|
+
makeContext(),
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
expect(result.isError).toBe(false);
|
|
255
|
+
expect((readConfig().services as any)?.tts?.providers?.vellum?.model).toBe(
|
|
256
|
+
"EXAVITQu4vr4xnSDxMaL",
|
|
257
|
+
);
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
test("does not broadcast the ElevenLabs ttsVoiceId key for a managed voice", async () => {
|
|
261
|
+
makeVellumActive();
|
|
262
|
+
const messages: any[] = [];
|
|
263
|
+
const ctx = makeContext({
|
|
264
|
+
sendToClient: (msg: any) => messages.push(msg),
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
const result = await run(
|
|
268
|
+
{ setting: "tts_voice_id", value: "aura-2-zeus-en" },
|
|
269
|
+
ctx,
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
expect(result.isError).toBe(false);
|
|
273
|
+
expect(messages).toHaveLength(0);
|
|
274
|
+
expect(result.content).not.toContain("broadcast");
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
test("rejects a value with characters invalid for any voice id", async () => {
|
|
278
|
+
makeVellumActive();
|
|
279
|
+
|
|
280
|
+
const result = await run(
|
|
281
|
+
{ setting: "tts_voice_id", value: "a british man" },
|
|
282
|
+
makeContext(),
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
expect(result.isError).toBe(true);
|
|
286
|
+
expect((readConfig().services as any)?.tts?.providers?.vellum?.model).toBe(
|
|
287
|
+
undefined,
|
|
288
|
+
);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
test("broadcasts the ElevenLabs ttsVoiceId key when elevenlabs is active", async () => {
|
|
292
|
+
writeConfig({ services: { tts: { provider: "elevenlabs" } } });
|
|
293
|
+
invalidateConfigCache();
|
|
294
|
+
const messages: any[] = [];
|
|
295
|
+
const ctx = makeContext({
|
|
296
|
+
sendToClient: (msg: any) => messages.push(msg),
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
const result = await run({ setting: "tts_voice_id", value: "abc123" }, ctx);
|
|
300
|
+
|
|
301
|
+
expect(result.isError).toBe(false);
|
|
302
|
+
expect(messages).toHaveLength(1);
|
|
303
|
+
expect(messages[0].key).toBe("ttsVoiceId");
|
|
304
|
+
expect(messages[0].value).toBe("abc123");
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
|
|
217
308
|
// ---------------------------------------------------------------------------
|
|
218
309
|
// Tests: fish_audio_reference_id persists to canonical path only
|
|
219
310
|
// ---------------------------------------------------------------------------
|
|
@@ -21,12 +21,21 @@ import { Command } from "commander";
|
|
|
21
21
|
/** The last `cliIpcCall` invocation captured for assertions. */
|
|
22
22
|
let lastIpcCall: { method: string; params?: any } | null = null;
|
|
23
23
|
|
|
24
|
+
/** Every `cliIpcCall` invocation in order (the `voice` command makes two). */
|
|
25
|
+
let ipcCalls: Array<{ method: string; params?: any }> = [];
|
|
26
|
+
|
|
24
27
|
/** The result that cliIpcCall will return. */
|
|
25
28
|
let mockIpcResult: { ok: boolean; result?: unknown; error?: string } = {
|
|
26
29
|
ok: true,
|
|
27
30
|
result: { audioBase64: "dGVzdA==", contentType: "audio/mpeg" },
|
|
28
31
|
};
|
|
29
32
|
|
|
33
|
+
/** Optional per-method result overrides (falls back to `mockIpcResult`). */
|
|
34
|
+
let ipcResponders: Record<
|
|
35
|
+
string,
|
|
36
|
+
{ ok: boolean; result?: unknown; error?: string }
|
|
37
|
+
> = {};
|
|
38
|
+
|
|
30
39
|
/** Captured writeFileSync calls. */
|
|
31
40
|
let writeFileCalls: Array<{ path: string; data: Buffer }> = [];
|
|
32
41
|
|
|
@@ -40,7 +49,8 @@ let stdinReturnsText = false;
|
|
|
40
49
|
mock.module("../../../ipc/cli-client.js", () => ({
|
|
41
50
|
cliIpcCall: async (method: string, params?: any) => {
|
|
42
51
|
lastIpcCall = { method, params };
|
|
43
|
-
|
|
52
|
+
ipcCalls.push({ method, params });
|
|
53
|
+
return ipcResponders[method] ?? mockIpcResult;
|
|
44
54
|
},
|
|
45
55
|
exitFromIpcResult: (r: any) => {
|
|
46
56
|
process.exitCode = 1;
|
|
@@ -156,6 +166,8 @@ async function runCommand(
|
|
|
156
166
|
|
|
157
167
|
beforeEach(() => {
|
|
158
168
|
lastIpcCall = null;
|
|
169
|
+
ipcCalls = [];
|
|
170
|
+
ipcResponders = {};
|
|
159
171
|
mockIpcResult = {
|
|
160
172
|
ok: true,
|
|
161
173
|
result: { audioBase64: "dGVzdA==", contentType: "audio/mpeg" },
|
|
@@ -326,3 +338,111 @@ describe("tts synthesize — base64 round-trip", () => {
|
|
|
326
338
|
);
|
|
327
339
|
});
|
|
328
340
|
});
|
|
341
|
+
|
|
342
|
+
// ---------------------------------------------------------------------------
|
|
343
|
+
// voice — routes to the active provider's config key
|
|
344
|
+
// ---------------------------------------------------------------------------
|
|
345
|
+
|
|
346
|
+
describe("tts voice — active-provider routing", () => {
|
|
347
|
+
function respondProvider(provider: string): void {
|
|
348
|
+
ipcResponders.config_get = {
|
|
349
|
+
ok: true,
|
|
350
|
+
result: { services: { tts: { provider } } },
|
|
351
|
+
};
|
|
352
|
+
ipcResponders.config_set = { ok: true, result: {} };
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
test("managed (vellum) writes to services.tts.providers.vellum.model", async () => {
|
|
356
|
+
respondProvider("vellum");
|
|
357
|
+
|
|
358
|
+
const { exitCode } = await runCommand(["tts", "voice", "aura-2-zeus-en"]);
|
|
359
|
+
|
|
360
|
+
expect(exitCode).toBe(0);
|
|
361
|
+
const setCall = ipcCalls.find((c) => c.method === "config_set");
|
|
362
|
+
expect(setCall).toBeDefined();
|
|
363
|
+
expect(setCall!.params.body.path).toBe(
|
|
364
|
+
"services.tts.providers.vellum.model",
|
|
365
|
+
);
|
|
366
|
+
expect(setCall!.params.body.value).toBe("aura-2-zeus-en");
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
test("an ElevenLabs voice id on a managed assistant still writes vellum.model", async () => {
|
|
370
|
+
respondProvider("vellum");
|
|
371
|
+
|
|
372
|
+
const { exitCode } = await runCommand([
|
|
373
|
+
"tts",
|
|
374
|
+
"voice",
|
|
375
|
+
"pqHfZKP75CvOlQylNhV4",
|
|
376
|
+
]);
|
|
377
|
+
|
|
378
|
+
expect(exitCode).toBe(0);
|
|
379
|
+
const setCall = ipcCalls.find((c) => c.method === "config_set");
|
|
380
|
+
expect(setCall!.params.body.path).toBe(
|
|
381
|
+
"services.tts.providers.vellum.model",
|
|
382
|
+
);
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
test("elevenlabs writes to services.tts.providers.elevenlabs.voiceId", async () => {
|
|
386
|
+
respondProvider("elevenlabs");
|
|
387
|
+
|
|
388
|
+
const { exitCode } = await runCommand(["tts", "voice", "abc123"]);
|
|
389
|
+
|
|
390
|
+
expect(exitCode).toBe(0);
|
|
391
|
+
const setCall = ipcCalls.find((c) => c.method === "config_set");
|
|
392
|
+
expect(setCall!.params.body.path).toBe(
|
|
393
|
+
"services.tts.providers.elevenlabs.voiceId",
|
|
394
|
+
);
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
test("defaults to elevenlabs when no provider is configured", async () => {
|
|
398
|
+
ipcResponders.config_get = { ok: true, result: {} };
|
|
399
|
+
ipcResponders.config_set = { ok: true, result: {} };
|
|
400
|
+
|
|
401
|
+
const { exitCode } = await runCommand(["tts", "voice", "abc123"]);
|
|
402
|
+
|
|
403
|
+
expect(exitCode).toBe(0);
|
|
404
|
+
const setCall = ipcCalls.find((c) => c.method === "config_set");
|
|
405
|
+
expect(setCall!.params.body.path).toBe(
|
|
406
|
+
"services.tts.providers.elevenlabs.voiceId",
|
|
407
|
+
);
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
test("no voice id exits code 1 without touching config", async () => {
|
|
411
|
+
respondProvider("vellum");
|
|
412
|
+
|
|
413
|
+
const { exitCode } = await runCommand(["tts", "voice"]);
|
|
414
|
+
|
|
415
|
+
expect(exitCode).toBe(1);
|
|
416
|
+
expect(ipcCalls.find((c) => c.method === "config_set")).toBeUndefined();
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
test("--json emits the provider and path it wrote", async () => {
|
|
420
|
+
respondProvider("vellum");
|
|
421
|
+
|
|
422
|
+
const { exitCode, stdout } = await runCommand([
|
|
423
|
+
"tts",
|
|
424
|
+
"voice",
|
|
425
|
+
"aura-2-luna-en",
|
|
426
|
+
"--json",
|
|
427
|
+
]);
|
|
428
|
+
|
|
429
|
+
expect(exitCode).toBe(0);
|
|
430
|
+
const parsed = JSON.parse(stdout.trim());
|
|
431
|
+
expect(parsed.ok).toBe(true);
|
|
432
|
+
expect(parsed.provider).toBe("vellum");
|
|
433
|
+
expect(parsed.path).toBe("services.tts.providers.vellum.model");
|
|
434
|
+
expect(parsed.voiceId).toBe("aura-2-luna-en");
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
test("a config_set failure sets a non-zero exit code", async () => {
|
|
438
|
+
ipcResponders.config_get = {
|
|
439
|
+
ok: true,
|
|
440
|
+
result: { services: { tts: { provider: "vellum" } } },
|
|
441
|
+
};
|
|
442
|
+
ipcResponders.config_set = { ok: false, error: "daemon error" };
|
|
443
|
+
|
|
444
|
+
const { exitCode } = await runCommand(["tts", "voice", "aura-2-zeus-en"]);
|
|
445
|
+
|
|
446
|
+
expect(exitCode).not.toBe(0);
|
|
447
|
+
});
|
|
448
|
+
});
|
|
@@ -364,10 +364,10 @@ Examples:
|
|
|
364
364
|
name: "v2",
|
|
365
365
|
description: "Memory v2 subsystem operations (concept-page model)",
|
|
366
366
|
helpText: `
|
|
367
|
-
The
|
|
368
|
-
each page's frontmatter
|
|
369
|
-
|
|
370
|
-
memory.v2.enabled
|
|
367
|
+
The concept-page memory subsystem stores prose concept pages with directed
|
|
368
|
+
edges in each page's frontmatter. Pages live under
|
|
369
|
+
/workspace/memory/concepts/ and are active when memory.v3.live or
|
|
370
|
+
memory.v2.enabled is set.
|
|
371
371
|
|
|
372
372
|
Mutating subcommands return a jobId enqueued on the memory job queue,
|
|
373
373
|
except reembed-skills which runs synchronously inside the assistant.
|
|
@@ -408,7 +408,7 @@ changes the enabled-skill set, or to recover corrupted skill embeddings.
|
|
|
408
408
|
|
|
409
409
|
Unlike 'reembed' (concept pages), this runs synchronously inside the
|
|
410
410
|
assistant — the command returns only once the seed completes. Requires
|
|
411
|
-
memory
|
|
411
|
+
concept-page memory to be active (memory.v3.live or memory.v2.enabled).
|
|
412
412
|
|
|
413
413
|
Examples:
|
|
414
414
|
$ assistant memory v2 reembed-skills`,
|