@vellumai/assistant 0.12.0-dev.202609111617.f60422f → 0.12.0-dev.202609111819.3dcbf21

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.
Files changed (28) hide show
  1. package/ARCHITECTURE.md +1 -1
  2. package/package.json +1 -1
  3. package/src/__tests__/config-schema.test.ts +12 -6
  4. package/src/calls/__tests__/call-controller.test.ts +106 -0
  5. package/src/calls/__tests__/media-stream-output.test.ts +32 -0
  6. package/src/{live-voice → calls}/__tests__/progress-narration.test.ts +4 -4
  7. package/src/{live-voice → calls}/__tests__/progress-phrases.test.ts +1 -1
  8. package/src/calls/__tests__/voice-leg-coordinator.test.ts +229 -0
  9. package/src/calls/__tests__/voice-progress-cadence.test.ts +274 -0
  10. package/src/calls/call-controller.ts +190 -113
  11. package/src/calls/call-transport.ts +16 -0
  12. package/src/calls/media-stream-output.ts +32 -0
  13. package/src/{live-voice → calls}/progress-narration.ts +2 -2
  14. package/src/calls/voice-leg-coordinator.ts +189 -0
  15. package/src/calls/voice-progress-cadence.ts +423 -0
  16. package/src/config/default-profile-catalog.ts +1 -1
  17. package/src/config/schema.ts +2 -0
  18. package/src/config/schemas/__tests__/live-voice.test.ts +0 -134
  19. package/src/config/schemas/__tests__/voice.test.ts +148 -0
  20. package/src/config/schemas/live-voice.ts +1 -153
  21. package/src/config/schemas/voice.ts +150 -0
  22. package/src/live-voice/__tests__/live-voice-progress.test.ts +15 -15
  23. package/src/live-voice/__tests__/live-voice-vad.test.ts +2 -2
  24. package/src/live-voice/live-voice-session.ts +178 -521
  25. package/src/workspace/migrations/155-move-front-model-config-to-voice.ts +78 -0
  26. package/src/workspace/migrations/__tests__/155-move-front-model-config-to-voice.test.ts +102 -0
  27. package/src/workspace/migrations/registry.ts +2 -0
  28. /package/src/{live-voice → calls}/progress-phrases.ts +0 -0
@@ -0,0 +1,78 @@
1
+ import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+
4
+ import { getLogger } from "../../util/logger.js";
5
+ import type { WorkspaceMigration } from "./types.js";
6
+
7
+ const log = getLogger("workspace-migration-155");
8
+
9
+ /**
10
+ * Move `liveVoice.frontModel` to `voice.frontModel` in `config.json`.
11
+ *
12
+ * The front-door tuning (endpointing budgets and progress narration cadence)
13
+ * is read by phone calls as well as live voice, so it lives under a
14
+ * transport-agnostic key. A `voice.frontModel` already present wins field by
15
+ * field; the `liveVoice` block is removed either way so raw-config saves do
16
+ * not write it back.
17
+ */
18
+ export const moveFrontModelConfigToVoiceMigration: WorkspaceMigration = {
19
+ id: "155-move-front-model-config-to-voice",
20
+ description: "Move liveVoice.frontModel to voice.frontModel in config.json",
21
+ run(workspaceDir: string): void {
22
+ const configPath = join(workspaceDir, "config.json");
23
+ if (!existsSync(configPath)) {
24
+ return;
25
+ }
26
+
27
+ let config: Record<string, unknown>;
28
+ try {
29
+ const raw = JSON.parse(readFileSync(configPath, "utf-8"));
30
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
31
+ return;
32
+ }
33
+ config = raw as Record<string, unknown>;
34
+ } catch {
35
+ return;
36
+ }
37
+
38
+ const liveVoice = readObject(config.liveVoice);
39
+ if (liveVoice === null || !Object.hasOwn(liveVoice, "frontModel")) {
40
+ return;
41
+ }
42
+ const legacy = readObject(liveVoice.frontModel);
43
+ delete liveVoice.frontModel;
44
+
45
+ if (legacy !== null) {
46
+ const voice = readObject(config.voice) ?? {};
47
+ const current = readObject(voice.frontModel) ?? {};
48
+ const legacyProgress = readObject(legacy.progress) ?? {};
49
+ const currentProgress = readObject(current.progress) ?? {};
50
+ const merged: Record<string, unknown> = { ...legacy, ...current };
51
+ if (
52
+ Object.keys(legacyProgress).length > 0 ||
53
+ Object.keys(currentProgress).length > 0
54
+ ) {
55
+ merged.progress = { ...legacyProgress, ...currentProgress };
56
+ }
57
+ voice.frontModel = merged;
58
+ config.voice = voice;
59
+ }
60
+
61
+ const tmpPath = `${configPath}.migration-155.tmp`;
62
+ writeFileSync(tmpPath, JSON.stringify(config, null, 2) + "\n");
63
+ renameSync(tmpPath, configPath);
64
+ log.info("Moved liveVoice.frontModel to voice.frontModel in config.json");
65
+ },
66
+ retryFailedCheckpoint: true,
67
+ down(_workspaceDir: string): void {
68
+ // Forward-only: the schema reads voice.frontModel and strips unknown
69
+ // liveVoice keys, so a block moved back is dropped on the next load.
70
+ },
71
+ };
72
+
73
+ function readObject(value: unknown): Record<string, unknown> | null {
74
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
75
+ return null;
76
+ }
77
+ return value as Record<string, unknown>;
78
+ }
@@ -0,0 +1,102 @@
1
+ import { mkdtempSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { tmpdir } from "node:os";
3
+ import { join } from "node:path";
4
+ import { describe, expect, test } from "bun:test";
5
+
6
+ import { moveFrontModelConfigToVoiceMigration } from "../155-move-front-model-config-to-voice.js";
7
+
8
+ function workspaceWith(config: unknown): string {
9
+ const dir = mkdtempSync(join(tmpdir(), "move-front-model-"));
10
+ writeFileSync(join(dir, "config.json"), JSON.stringify(config, null, 2));
11
+ return dir;
12
+ }
13
+
14
+ function readConfig(dir: string): Record<string, unknown> {
15
+ return JSON.parse(readFileSync(join(dir, "config.json"), "utf8")) as Record<
16
+ string,
17
+ unknown
18
+ >;
19
+ }
20
+
21
+ describe("155-move-front-model-config-to-voice", () => {
22
+ test("moves liveVoice.frontModel under voice and leaves the rest of liveVoice", () => {
23
+ const dir = workspaceWith({
24
+ liveVoice: {
25
+ vad: { silenceThresholdMs: 900 },
26
+ frontModel: {
27
+ endpointDecisionTimeoutMs: 300,
28
+ progress: { idleIntervalMs: 4_000 },
29
+ },
30
+ },
31
+ });
32
+
33
+ moveFrontModelConfigToVoiceMigration.run(dir);
34
+
35
+ expect(readConfig(dir)).toEqual({
36
+ liveVoice: { vad: { silenceThresholdMs: 900 } },
37
+ voice: {
38
+ frontModel: {
39
+ endpointDecisionTimeoutMs: 300,
40
+ progress: { idleIntervalMs: 4_000 },
41
+ },
42
+ },
43
+ });
44
+ });
45
+
46
+ test("an existing voice.frontModel wins field by field", () => {
47
+ const dir = workspaceWith({
48
+ liveVoice: {
49
+ frontModel: {
50
+ endpointDecisionTimeoutMs: 300,
51
+ endpointMaxExtensions: 1,
52
+ progress: { idleIntervalMs: 4_000, minGapMs: 2_000 },
53
+ },
54
+ },
55
+ voice: {
56
+ frontModel: {
57
+ endpointDecisionTimeoutMs: 800,
58
+ progress: { idleIntervalMs: 7_000 },
59
+ },
60
+ },
61
+ });
62
+
63
+ moveFrontModelConfigToVoiceMigration.run(dir);
64
+
65
+ expect(readConfig(dir)).toEqual({
66
+ liveVoice: {},
67
+ voice: {
68
+ frontModel: {
69
+ endpointDecisionTimeoutMs: 800,
70
+ endpointMaxExtensions: 1,
71
+ progress: { idleIntervalMs: 7_000, minGapMs: 2_000 },
72
+ },
73
+ },
74
+ });
75
+ });
76
+
77
+ test("a config without the old key is left untouched", () => {
78
+ const dir = workspaceWith({ liveVoice: { archiveAudio: true } });
79
+ const before = readFileSync(join(dir, "config.json"), "utf8");
80
+
81
+ moveFrontModelConfigToVoiceMigration.run(dir);
82
+
83
+ expect(readFileSync(join(dir, "config.json"), "utf8")).toBe(before);
84
+ });
85
+
86
+ test("is idempotent", () => {
87
+ const dir = workspaceWith({
88
+ liveVoice: { frontModel: { endpointExtensionMs: 2_000 } },
89
+ });
90
+
91
+ moveFrontModelConfigToVoiceMigration.run(dir);
92
+ const once = readConfig(dir);
93
+ moveFrontModelConfigToVoiceMigration.run(dir);
94
+
95
+ expect(readConfig(dir)).toEqual(once);
96
+ });
97
+
98
+ test("a missing config file is a no-op", () => {
99
+ const dir = mkdtempSync(join(tmpdir(), "move-front-model-empty-"));
100
+ expect(() => moveFrontModelConfigToVoiceMigration.run(dir)).not.toThrow();
101
+ });
102
+ });
@@ -152,6 +152,7 @@ import { repairRenamedFireworksDeepseekProModelIdMigration } from "./151-repair-
152
152
  import { repairRetiredFireworksMinimaxM2p7ModelIdMigration } from "./152-repair-retired-fireworks-minimax-m2p7-model-id.js";
153
153
  import { stripMcpPolicyFieldsMigration } from "./153-strip-mcp-policy-fields.js";
154
154
  import { repairRetiredCodexGpt54ModelIdsMigration } from "./154-repair-retired-codex-gpt-5-4-model-ids.js";
155
+ import { moveFrontModelConfigToVoiceMigration } from "./155-move-front-model-config-to-voice.js";
155
156
  import { migrateToWorkspaceVolumeMigration } from "./migrate-to-workspace-volume.js";
156
157
  import type { WorkspaceMigration } from "./types.js";
157
158
 
@@ -319,4 +320,5 @@ export const WORKSPACE_MIGRATIONS: WorkspaceMigration[] = [
319
320
  repairRetiredFireworksMinimaxM2p7ModelIdMigration,
320
321
  stripMcpPolicyFieldsMigration,
321
322
  repairRetiredCodexGpt54ModelIdsMigration,
323
+ moveFrontModelConfigToVoiceMigration,
322
324
  ];
File without changes