@alexkroman1/aai-cli 0.15.5 → 0.17.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/{_dev-server-B4ZiXbZj.mjs → _dev-server-D6VSQbYW.mjs} +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/{console-Bp1kSqz_.mjs → console-tVBjfKyR.mjs} +1 -1
- package/dist/{dev-CxZsZsOL.mjs → dev-CT_QHHZL.mjs} +1 -1
- package/dist/scaffold/CLAUDE.md +2 -2
- package/dist/scaffold/agent-guide/AGENT-API.md +6 -3
- package/dist/scaffold/agent-guide/PIPELINE-TUNING.md +1 -1
- package/dist/scaffold/agent-guide/PROVIDERS.md +14 -15
- package/dist/scaffold/agent-guide/WORKFLOWS.md +1 -1
- package/dist/scaffold/package.json +4 -4
- package/dist/templates/call-audit-workflow/agent.eval.test.ts +1 -1
- package/dist/templates/call-audit-workflow/agent.test.ts +3 -2
- package/dist/templates/call-audit-workflow/agent.ts +6 -11
- package/dist/templates/call-audit-workflow/workflows/summarize.ts +1 -1
- package/dist/templates/custom-pipeline-agent/modes.test.ts +4 -4
- package/dist/templates/custom-pipeline-agent/stages.test.ts +12 -37
- package/dist/templates/document-redline-workflow/form.ts +4 -5
- package/dist/templates/front-desk-agent/agent.test.ts +6 -8
- package/dist/templates/home-assistant-agent/agent.ts +1 -1
- package/dist/templates/home-assistant-agent/client.tsx +2 -9
- package/dist/templates/meeting-recap-agent/agent.test.ts +9 -12
- package/dist/templates/outbound-call-agent/workflows/call.ts +5 -1
- package/dist/templates/quickstart-agent/agent.ts +1 -1
- package/dist/templates/research-handoff-agent/agent.test.ts +9 -21
- package/dist/templates/spoken-summary-workflow/agent.eval.test.ts +3 -3
- package/dist/templates/spoken-summary-workflow/agent.test.ts +11 -13
- package/dist/templates/spoken-summary-workflow/agent.ts +8 -24
- package/dist/templates/spoken-summary-workflow/workflows/summarize.ts +1 -1
- package/dist/templates/text-adventure-agent/agent.ts +1 -1
- package/dist/templates/web-research-agent/agent.test.ts +3 -3
- package/package.json +4 -4
|
@@ -14,8 +14,8 @@ import { existsSync, statSync } from "node:fs";
|
|
|
14
14
|
import path from "node:path";
|
|
15
15
|
import { omitUndefined, plural } from "@alexkroman1/aai/utils";
|
|
16
16
|
import { agentRequiredEnv, createCoalescingRunner, frontDoorOf, parseWsUpgradeParams, requestPath, sleep } from "@alexkroman1/aai/internal";
|
|
17
|
-
import { DEFAULT_LISTEN_HOST, createRuntime, createServerForRuntime, ensureSessionStateSchema, ensureWorkflowJournalSchema } from "@alexkroman1/aai-runtime";
|
|
18
|
-
import { SERVER_ROUTES, WORKFLOW_DATA_DIR_ENV,
|
|
17
|
+
import { DEFAULT_LISTEN_HOST, createMemoryJournal, createRuntime, createServerForRuntime, ensureSessionStateSchema, ensureWorkflowJournalSchema } from "@alexkroman1/aai-runtime";
|
|
18
|
+
import { SERVER_ROUTES, WORKFLOW_DATA_DIR_ENV, handleWorkflowRequest, isPathInside, publishClientInboxDefaults, publishStepEnv, requiredProviderEnvVars, withHostCredentialFallback } from "@alexkroman1/aai-runtime/internal";
|
|
19
19
|
import { defaultClientDir } from "@alexkroman1/aai-ui/client-dir";
|
|
20
20
|
import { watch } from "chokidar";
|
|
21
21
|
import getPort, { portNumbers } from "get-port";
|
package/dist/cli.mjs
CHANGED
|
@@ -892,7 +892,7 @@ const dev = defineExec({
|
|
|
892
892
|
},
|
|
893
893
|
cwd: "agent",
|
|
894
894
|
async run({ args, cwd, ui }) {
|
|
895
|
-
const { executeDev } = await import("./dev-
|
|
895
|
+
const { executeDev } = await import("./dev-CT_QHHZL.mjs");
|
|
896
896
|
return executeDev({
|
|
897
897
|
cwd,
|
|
898
898
|
port: args.port,
|
|
@@ -913,7 +913,7 @@ const consoleCommand = defineExec({
|
|
|
913
913
|
} },
|
|
914
914
|
cwd: "agent",
|
|
915
915
|
async run({ args, cwd, mode, ui }) {
|
|
916
|
-
const { executeConsole } = await import("./console-
|
|
916
|
+
const { executeConsole } = await import("./console-tVBjfKyR.mjs");
|
|
917
917
|
return executeConsole({
|
|
918
918
|
cwd,
|
|
919
919
|
verbose: args.verbose,
|
|
@@ -3,7 +3,7 @@ import { a as ok, n as fail } from "./_output-DBP9Op_d.mjs";
|
|
|
3
3
|
import { t as defaultUi } from "./_ui-Coe0zwmm.mjs";
|
|
4
4
|
import { o as errorDetail, s as errorMessage } from "./_utils-BVLdBvdT.mjs";
|
|
5
5
|
import { n as createWorkerEvaluator } from "./_bundler-DCuNHjDF.mjs";
|
|
6
|
-
import { loadWorker, t as resolveAgentEnv } from "./_dev-server-
|
|
6
|
+
import { loadWorker, t as resolveAgentEnv } from "./_dev-server-D6VSQbYW.mjs";
|
|
7
7
|
import { styleText } from "node:util";
|
|
8
8
|
import { spawn } from "node:child_process";
|
|
9
9
|
import { connectSession, createRuntime, ensureSessionStateSchema, ensureWorkflowJournalSchema } from "@alexkroman1/aai-runtime";
|
|
@@ -164,7 +164,7 @@ async function resolveDevDeps(deps) {
|
|
|
164
164
|
ui: deps.ui ?? defaultUi,
|
|
165
165
|
startQuickTunnel: deps.startQuickTunnel ?? startQuickTunnel,
|
|
166
166
|
runPublicUrlHook: deps.runPublicUrlHook ?? runPublicUrlHook,
|
|
167
|
-
startDevServer: deps.startDevServer ?? (await import("./_dev-server-
|
|
167
|
+
startDevServer: deps.startDevServer ?? (await import("./_dev-server-D6VSQbYW.mjs")).startDevServer
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
170
|
/**
|
package/dist/scaffold/CLAUDE.md
CHANGED
|
@@ -168,7 +168,7 @@ import { assemblyAITts } from "@alexkroman1/aai/tts";
|
|
|
168
168
|
|
|
169
169
|
export default agent({
|
|
170
170
|
name: "My Agent",
|
|
171
|
-
tts: assemblyAITts({ voice: "paul" }),
|
|
171
|
+
tts: assemblyAITts({ voice: "aai-paul" }),
|
|
172
172
|
llm: "claude-sonnet-4-6",
|
|
173
173
|
greeting: "Hi, how can I help?",
|
|
174
174
|
builtinTools: ["think", "web_search"],
|
|
@@ -178,7 +178,7 @@ export default agent({
|
|
|
178
178
|
```
|
|
179
179
|
|
|
180
180
|
The fields almost every agent sets: `name` (required), `greeting` (default: "Hey
|
|
181
|
-
there..."; `""` starts silent), `tts` (voice `jane` unless set), `llm`,
|
|
181
|
+
there..."; `""` starts silent), `tts` (voice `aai-jane` unless set), `llm`,
|
|
182
182
|
`builtinTools` (omitted = `["think"]` only; setting it REPLACES the default),
|
|
183
183
|
`maxSteps` (default 10 tool-calling steps per reply) and `requiredEnv` (every
|
|
184
184
|
env var a tool or step reads; **publishing checks it**, so a missing key fails
|
|
@@ -106,7 +106,9 @@ export default agent({
|
|
|
106
106
|
// name: { cart: cartSlot.projected } (read it
|
|
107
107
|
// with useAgentState; see UI.md)
|
|
108
108
|
events?: SessionEventHandlers; // observe the session; "metrics.collected" is each
|
|
109
|
-
// reply's latency/tokens: createMetricsCollector()
|
|
109
|
+
// reply's latency/tokens: createMetricsCollector();
|
|
110
|
+
// "error.reported" carries a SessionErrorCode (open:
|
|
111
|
+
// switch with a default); "*" gets AnySessionEvent
|
|
110
112
|
sessionContext?: (args) => SessionContext; // fetched once per connect, before the first model
|
|
111
113
|
// call: extra instructions, history cut-off, refusal
|
|
112
114
|
onSessionEnd?: (ctx) => unknown; // after every hang-up / disconnect / idle close
|
|
@@ -176,8 +178,9 @@ export default agent({
|
|
|
176
178
|
`sessionContext` is bounded (1.5 s) and a throw, a timeout or `undefined` starts
|
|
177
179
|
the session without it; `onSessionEnd` is fire-and-forget and at-least-once, so
|
|
178
180
|
key any run it starts. A `routes` handler's return value is the JSON body;
|
|
179
|
-
`routeResponse(status, body)` picks another status and
|
|
180
|
-
`routeError(status, message)`
|
|
181
|
+
`routeResponse(status, body, { headers })` picks another status (and any headers
|
|
182
|
+
— a `Location`, a `Retry-After`) and a thrown `routeError(status, message)`
|
|
183
|
+
answers `{ error: message }`.
|
|
181
184
|
|
|
182
185
|
## Composing a system prompt
|
|
183
186
|
|
|
@@ -100,7 +100,7 @@ export default agent({
|
|
|
100
100
|
|
|
101
101
|
| Factory | Default voice | Env var |
|
|
102
102
|
| --------------- | ---------------------------------------- | -------------------- |
|
|
103
|
-
| `assemblyAITts` | `"jane"`
|
|
103
|
+
| `assemblyAITts` | `"aai-jane"` | `ASSEMBLYAI_API_KEY` |
|
|
104
104
|
| `cartesiaTts` | `"f786b574-daa5-4673-aa0c-cbe3e8534c02"` | `CARTESIA_API_KEY` |
|
|
105
105
|
| `rimeTts` | `"cove"` (model `mistv2`) | `RIME_API_KEY` |
|
|
106
106
|
|
|
@@ -109,20 +109,19 @@ Override with `{ voice, model, language }`.
|
|
|
109
109
|
|
|
110
110
|
**AssemblyAI TTS** shares `ASSEMBLYAI_API_KEY` with AssemblyAI STT and the LLM
|
|
111
111
|
Gateway, so an all-AssemblyAI pipeline needs exactly one secret. On the default
|
|
112
|
-
pipeline, `tts: assemblyAITts({ voice: "michael" })` changes the voice and
|
|
113
|
-
leaves the other two stages on the default.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
and accent, and put the delivery in the system prompt instead.
|
|
112
|
+
pipeline, `tts: assemblyAITts({ voice: "aai-michael" })` changes the voice and
|
|
113
|
+
leaves the other two stages on the default. A voice is a `voice_id` SLUG — the
|
|
114
|
+
`aai-` prefix is part of it, and the bare name is refused — and **an unknown one
|
|
115
|
+
is refused when the session opens**, so pick from the library
|
|
116
|
+
(`ASSEMBLYAI_TTS_VOICES`) rather than guessing a plausible name:
|
|
117
|
+
|
|
118
|
+
`aai-alba`, `aai-anna`, `aai-charles`, `aai-eve`, `aai-george`, `aai-jane` (the
|
|
119
|
+
default), `aai-jean`, `aai-mary`, `aai-michael`, `aai-paul`, `aai-vera`
|
|
120
|
+
|
|
121
|
+
Every library voice speaks all six languages; `language` (`"en"`, `"fr"`,
|
|
122
|
+
`"de"`, `"it"`, `"pt"`, `"es"`) picks which. There is no separate
|
|
123
|
+
age/gender/style axis — match the persona by picking a voice, and put the
|
|
124
|
+
delivery in the system prompt instead.
|
|
126
125
|
|
|
127
126
|
Set `language` only alongside a voice that speaks it, as an ISO 639-1 code —
|
|
128
127
|
`"en"`, `"fr"`, `"de"`, `"it"`, `"pt"`, `"es"` are the six the catalog covers,
|
|
@@ -670,7 +670,7 @@ trip.
|
|
|
670
670
|
import { stepSpeak, stepWriteUpload } from "@alexkroman1/aai/step";
|
|
671
671
|
|
|
672
672
|
export async function narrate(script: string) {
|
|
673
|
-
const spoken = await stepSpeak(script, { voice: "jane" });
|
|
673
|
+
const spoken = await stepSpeak(script, { voice: "aai-jane" });
|
|
674
674
|
const stored = await stepWriteUpload(spoken.audio, { name: "summary.wav", type: "audio/wav" });
|
|
675
675
|
return { audio: stored.id, durationMs: spoken.durationMs };
|
|
676
676
|
}
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"publish:agent": "aai publish"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@alexkroman1/aai": "^0.
|
|
19
|
-
"@alexkroman1/aai-cli": "^0.
|
|
20
|
-
"@alexkroman1/aai-runtime": "^0.
|
|
21
|
-
"@alexkroman1/aai-ui": "^0.
|
|
18
|
+
"@alexkroman1/aai": "^0.17.0",
|
|
19
|
+
"@alexkroman1/aai-cli": "^0.17.0",
|
|
20
|
+
"@alexkroman1/aai-runtime": "^0.17.0",
|
|
21
|
+
"@alexkroman1/aai-ui": "^0.17.0",
|
|
22
22
|
"react": "^19.3.0",
|
|
23
23
|
"react-dom": "^19.3.0",
|
|
24
24
|
"tailwindcss": "^4.0.0",
|
|
@@ -409,7 +409,7 @@ describeWorkflowEvalWithFfmpeg(
|
|
|
409
409
|
expect(output.audioBytes).toBeLessThan(wavBytes / 4);
|
|
410
410
|
// The run says both numbers, which is what makes the trade visible.
|
|
411
411
|
expect(run.reported.at(-1)).toMatch(
|
|
412
|
-
/^Recorded a \d+s audit
|
|
412
|
+
/^Recorded a \d+s audit with voice [\w-]+ — .* of MP3, from .* of WAV\.$/,
|
|
413
413
|
);
|
|
414
414
|
|
|
415
415
|
// The model really read the transcript, and the audit really reached the
|
|
@@ -220,7 +220,8 @@ describe("the declaration", () => {
|
|
|
220
220
|
?.issues,
|
|
221
221
|
).toBeTruthy();
|
|
222
222
|
expect(
|
|
223
|
-
(await audit.input?.["~standard"].validate({ recording: UPLOAD_ID, voice: "jane" }))
|
|
223
|
+
(await audit.input?.["~standard"].validate({ recording: UPLOAD_ID, voice: "aai-jane" }))
|
|
224
|
+
?.issues,
|
|
224
225
|
).toBeUndefined();
|
|
225
226
|
});
|
|
226
227
|
|
|
@@ -829,7 +830,7 @@ describe("the ffmpeg steps, up to the spawn", () => {
|
|
|
829
830
|
installStubReporter();
|
|
830
831
|
installStubUploads({}, { writable: true });
|
|
831
832
|
|
|
832
|
-
await expect(narrate("Read this back.", "jane")).rejects.toBeInstanceOf(FatalError);
|
|
833
|
+
await expect(narrate("Read this back.", "aai-jane")).rejects.toBeInstanceOf(FatalError);
|
|
833
834
|
expect(speech.calls.length).toBe(1);
|
|
834
835
|
expect(speech.calls[0]?.text).toBe("Read this back.");
|
|
835
836
|
});
|
|
@@ -86,23 +86,18 @@
|
|
|
86
86
|
*/
|
|
87
87
|
|
|
88
88
|
import { workflow, workflowApp } from "@alexkroman1/aai";
|
|
89
|
-
import {
|
|
89
|
+
import { ASSEMBLYAI_TTS_VOICES } from "@alexkroman1/aai/tts";
|
|
90
90
|
import type { WorkflowDef } from "@alexkroman1/aai/workflow-api";
|
|
91
91
|
import { z } from "zod";
|
|
92
92
|
import { auditFlow, type CallAudit } from "./workflows/audit.ts";
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
* The voices the form offers, as the tuple `z.enum`
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* the socket is open, so the synthesis simply produces nothing. Narrowed to the
|
|
100
|
-
* English ones because the audit is written in the transcript's language and
|
|
101
|
-
* the prompt does not translate; every voice in the catalog speaks exactly one.
|
|
102
|
-
* `ttsVoiceIds` owns the derivation, including the fallback to the SDK's own
|
|
103
|
-
* default voice should the filter ever match nothing.
|
|
95
|
+
* The voices the form offers: the SDK's library voices, as the tuple `z.enum`
|
|
96
|
+
* takes. READ from the catalog rather than listed, because a wrong voice id is
|
|
97
|
+
* refused when the synthesis socket opens. Every library voice speaks every
|
|
98
|
+
* supported language, so none needs filtering out.
|
|
104
99
|
*/
|
|
105
|
-
const VOICES =
|
|
100
|
+
const VOICES = ASSEMBLYAI_TTS_VOICES;
|
|
106
101
|
|
|
107
102
|
/**
|
|
108
103
|
* The run input, as its own const.
|
|
@@ -186,7 +186,7 @@ export async function narrate(
|
|
|
186
186
|
});
|
|
187
187
|
|
|
188
188
|
await stepReport(
|
|
189
|
-
`Recorded a ${Math.round(spoken.durationMs / 1000)}s audit
|
|
189
|
+
`Recorded a ${Math.round(spoken.durationMs / 1000)}s audit with voice ${spoken.voice} — ` +
|
|
190
190
|
`${formatBytes(bytes)} of MP3, from ${formatBytes(spoken.audio.byteLength)} of WAV.`,
|
|
191
191
|
);
|
|
192
192
|
return {
|
|
@@ -86,11 +86,11 @@ describe("three modes, three members", () => {
|
|
|
86
86
|
// reads the second. A voice has no shorthand: it is the TTS descriptor's.
|
|
87
87
|
const def: AgentDef = agent({
|
|
88
88
|
...SHARED,
|
|
89
|
-
tts: assemblyAITts({ voice: "michael" }),
|
|
89
|
+
tts: assemblyAITts({ voice: "aai-michael" }),
|
|
90
90
|
llm: "claude-sonnet-4-6",
|
|
91
91
|
});
|
|
92
92
|
expect(def.tts?.kind).toBe("assemblyai");
|
|
93
|
-
expect(def.tts?.options.voice).toBe("michael");
|
|
93
|
+
expect(def.tts?.options.voice).toBe("aai-michael");
|
|
94
94
|
expect(def.llm?.options.model).toBe("claude-sonnet-4-6");
|
|
95
95
|
});
|
|
96
96
|
});
|
|
@@ -104,11 +104,11 @@ test("the preset takes OPTIONS — one setting across the three stages at once",
|
|
|
104
104
|
// on two descriptors that can drift apart, and `voice` to TTS. (An EU agent
|
|
105
105
|
// also has to name a model the EU gateway carries — Claude and most Gemini
|
|
106
106
|
// ids — which is the half no shorthand can do for you.)
|
|
107
|
-
const options: AssemblyAIPipelineOptions = { region: "eu", voice: "michael" };
|
|
107
|
+
const options: AssemblyAIPipelineOptions = { region: "eu", voice: "aai-michael" };
|
|
108
108
|
const pipeline = assemblyAIPipeline(options);
|
|
109
109
|
expect(pipeline.stt.options.region).toBe("eu");
|
|
110
110
|
expect(pipeline.llm.options.providerOptions).toMatchObject({ region: "eu" });
|
|
111
|
-
expect(pipeline.tts.options.voice).toBe("michael");
|
|
111
|
+
expect(pipeline.tts.options.voice).toBe("aai-michael");
|
|
112
112
|
|
|
113
113
|
// And a stage declared AFTER the spread still wins — that is the whole point
|
|
114
114
|
// of it being a plain object, and it is how this template's own `agent.ts`
|
|
@@ -42,7 +42,6 @@ import {
|
|
|
42
42
|
ASSEMBLYAI_STT_EU_URL,
|
|
43
43
|
type AssemblyAISttOptions,
|
|
44
44
|
assemblyAIStt,
|
|
45
|
-
DEEPGRAM_DEFAULT_ENDPOINTING_MS,
|
|
46
45
|
type DeepgramSttOptions,
|
|
47
46
|
deepgramStt,
|
|
48
47
|
type ElevenLabsSttOptions,
|
|
@@ -58,7 +57,6 @@ import {
|
|
|
58
57
|
type AssemblyAITtsLanguage,
|
|
59
58
|
type AssemblyAITtsOptions,
|
|
60
59
|
type AssemblyAITtsVoice,
|
|
61
|
-
type AssemblyAITtsVoiceInfo,
|
|
62
60
|
assemblyAITts,
|
|
63
61
|
CARTESIA_DEFAULT_VOICE,
|
|
64
62
|
type CartesiaTtsOptions,
|
|
@@ -67,8 +65,6 @@ import {
|
|
|
67
65
|
type RimeTtsOptions,
|
|
68
66
|
rimeTts,
|
|
69
67
|
type TtsProvider,
|
|
70
|
-
ttsVoiceIds,
|
|
71
|
-
ttsVoiceInfo,
|
|
72
68
|
} from "@alexkroman1/aai/tts";
|
|
73
69
|
import { describe, expect, test } from "vitest";
|
|
74
70
|
|
|
@@ -226,16 +222,13 @@ describe("the STT stage", () => {
|
|
|
226
222
|
}
|
|
227
223
|
});
|
|
228
224
|
|
|
229
|
-
test("Deepgram's endpointing window is
|
|
230
|
-
// The descriptor carries only what you set — the host fills the rest
|
|
231
|
-
//
|
|
232
|
-
// knowing before you move it: 1500ms is matched to the AssemblyAI opener's
|
|
225
|
+
test("Deepgram's endpointing window is the host's default unless you set one", () => {
|
|
226
|
+
// The descriptor carries only what you set — the host fills the rest. It is
|
|
227
|
+
// worth knowing before you move it: the host default, 1500ms, is matched to the AssemblyAI opener's
|
|
233
228
|
// 1600ms `min_turn_silence`, and Deepgram exposes no pause-tolerance
|
|
234
229
|
// counterpart, so this one window is the whole end-of-turn policy there.
|
|
235
230
|
expect(deepgramStt().options.endpointing).toBeUndefined();
|
|
236
|
-
expect(deepgramStt({ endpointing:
|
|
237
|
-
DEEPGRAM_DEFAULT_ENDPOINTING_MS,
|
|
238
|
-
);
|
|
231
|
+
expect(deepgramStt({ endpointing: 1500 }).options.endpointing).toBe(1500);
|
|
239
232
|
// Deepgram is also the one STT here that does NOT auto-detect: it defaults
|
|
240
233
|
// to English, so an agent moved to it silently loses non-English
|
|
241
234
|
// transcription unless it names a code.
|
|
@@ -261,34 +254,16 @@ describe("the TTS stage", () => {
|
|
|
261
254
|
}
|
|
262
255
|
});
|
|
263
256
|
|
|
264
|
-
test("
|
|
265
|
-
// The catalog is `
|
|
266
|
-
//
|
|
267
|
-
|
|
268
|
-
// speaks English, so asking for French and nothing else used to produce an
|
|
269
|
-
// agent that connected, reported ready, and never spoke.
|
|
270
|
-
// `ttsVoiceInfo` is the lookup by an OPEN voice id — `undefined` for one
|
|
271
|
-
// this release's catalog does not list — so it needs no cast.
|
|
272
|
-
const info: AssemblyAITtsVoiceInfo | undefined = ttsVoiceInfo(ASSEMBLYAI_TTS_DEFAULT_VOICE);
|
|
273
|
-
expect(info?.language).toBe("en");
|
|
274
|
-
expect(ttsVoiceInfo("a-voice-shipped-next-week")).toBeUndefined();
|
|
275
|
-
// With no language, `ttsVoiceIds()` is the whole catalog, in its order.
|
|
276
|
-
expect(ttsVoiceIds()).toEqual(Object.keys(ASSEMBLYAI_TTS_VOICES));
|
|
277
|
-
|
|
257
|
+
test("every library voice speaks every supported language", () => {
|
|
258
|
+
// The catalog is a tuple of `voice_id` slugs (what `z.enum` takes), and
|
|
259
|
+
// language is a separate axis: any voice, any of the six languages.
|
|
260
|
+
expect(ASSEMBLYAI_TTS_VOICES).toContain(ASSEMBLYAI_TTS_DEFAULT_VOICE);
|
|
278
261
|
for (const language of Object.keys(ASSEMBLYAI_TTS_LANGUAGES) as AssemblyAITtsLanguage[]) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
const speaking = agent({ name: NAME, tts: assemblyAITts({ language, voice }) });
|
|
284
|
-
expect(() => toAgentConfig(speaking), language).not.toThrow();
|
|
262
|
+
for (const voice of ASSEMBLYAI_TTS_VOICES) {
|
|
263
|
+
const speaking = agent({ name: NAME, tts: assemblyAITts({ language, voice }) });
|
|
264
|
+
expect(() => toAgentConfig(speaking), `${voice}/${language}`).not.toThrow();
|
|
265
|
+
}
|
|
285
266
|
}
|
|
286
|
-
|
|
287
|
-
// `toAgentConfig` is the last layer that sees the mismatch while somebody
|
|
288
|
-
// is still authoring — after it, the refusal is in-band, after the socket
|
|
289
|
-
// opens, with the agent ready and mute.
|
|
290
|
-
const mismatched = agent({ name: NAME, tts: assemblyAITts({ language: "fr" }) });
|
|
291
|
-
expect(() => toAgentConfig(mismatched)).toThrow(/speaks en/);
|
|
292
267
|
});
|
|
293
268
|
|
|
294
269
|
test("the catalog is not an allow-list: a voice shipped later still compiles", () => {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import { omitUndefined } from "@alexkroman1/aai/utils";
|
|
17
17
|
import type { WorkflowInputOf } from "@alexkroman1/aai/workflow-api";
|
|
18
|
-
import
|
|
18
|
+
import { type FormValues, isFileValue } from "@alexkroman1/aai-ui";
|
|
19
19
|
import type { redline } from "./agent.ts";
|
|
20
20
|
|
|
21
21
|
/** What the desk is asked for, derived from the declaration rather than restated. */
|
|
@@ -54,7 +54,7 @@ export function toInput(values: FormValues): RedlineFormInput {
|
|
|
54
54
|
/**
|
|
55
55
|
* The chosen file as the schema's `source`, or nothing at all.
|
|
56
56
|
*
|
|
57
|
-
* `<FileField read="text">` contributes a
|
|
57
|
+
* `<FileField read="text">` contributes a `FileValue` — the file's
|
|
58
58
|
* metadata plus its text, read in the BROWSER — and contributes no key at all
|
|
59
59
|
* when nothing was chosen, which is why this takes `unknown` and why the absent
|
|
60
60
|
* case is the ordinary one rather than an error. Nothing is uploaded: a draft is
|
|
@@ -63,12 +63,11 @@ export function toInput(values: FormValues): RedlineFormInput {
|
|
|
63
63
|
* and `transcription-workflow` is where it is answered.
|
|
64
64
|
*/
|
|
65
65
|
export function attachedDraft(value: unknown): { name: string; text: string } | undefined {
|
|
66
|
-
|
|
67
|
-
if (file === undefined || typeof file.content !== "string") return undefined;
|
|
66
|
+
if (!isFileValue(value) || value.content === undefined) return undefined;
|
|
68
67
|
// Passed through UNTRIMMED, deliberately: a file somebody chose is a file they
|
|
69
68
|
// meant to redline, so an empty one has to come back as the schema refusing it
|
|
70
69
|
// by name rather than as a draft written from scratch that they did not ask
|
|
71
70
|
// for. It is the same layering as `brief` — the schema counts CHARACTERS, and
|
|
72
71
|
// `acceptDraft` catches the whitespace that gets past it.
|
|
73
|
-
return { name:
|
|
72
|
+
return { name: value.name, text: value.content };
|
|
74
73
|
}
|
|
@@ -18,19 +18,17 @@ function refusal(result: unknown): string {
|
|
|
18
18
|
describe("the roster", () => {
|
|
19
19
|
test("triage answers the phone, and every persona's tools plus `handoff` are on the agent", () => {
|
|
20
20
|
expect(desk.list.map((one) => one.name)).toEqual(["triage", "billing", "support"]);
|
|
21
|
-
// The `tools/` files
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
...(agentDef.toolsets ?? []).flatMap((set) => Object.keys(set.list())),
|
|
25
|
-
];
|
|
26
|
-
expect(served.sort()).toEqual([
|
|
21
|
+
// The `tools/` files are the shared ones; the roster minted the rest.
|
|
22
|
+
expect(Object.keys(agentDef.tools).sort()).toEqual(["verify_account"]);
|
|
23
|
+
for (const name of [
|
|
27
24
|
HANDOFF_TOOL_NAME,
|
|
28
25
|
"issue_refund",
|
|
29
26
|
"lookup_invoice",
|
|
30
27
|
"run_diagnostic",
|
|
31
28
|
"schedule_technician",
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
]) {
|
|
30
|
+
expect(toolOf(agentDef, name).description).not.toBe("");
|
|
31
|
+
}
|
|
34
32
|
expect(desk.active(createToolContext())).toBe(triage);
|
|
35
33
|
});
|
|
36
34
|
|
|
@@ -23,7 +23,7 @@ export default agent({
|
|
|
23
23
|
// The first thing a caller hears. Without one the agent waits for them to speak.
|
|
24
24
|
greeting: "Hi, what can I do for you?",
|
|
25
25
|
// Only the speaking stage is declared; speech-to-text and the LLM are the defaults.
|
|
26
|
-
tts: assemblyAITts({ voice: "jane" }),
|
|
26
|
+
tts: assemblyAITts({ voice: "aai-jane" }),
|
|
27
27
|
// Setting this REPLACES the default (`["think"]`), so `think` is listed to keep it. All
|
|
28
28
|
// keyless but text_me, which reads TEXTBELT_KEY and SMS_TO_PHONE and texts only the
|
|
29
29
|
// owner: without them it says it can't, and nothing else here depends on it.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
2
|
import "@alexkroman1/aai-ui/styles.css";
|
|
3
3
|
import {
|
|
4
|
+
type ChatMessage,
|
|
4
5
|
ConversationView,
|
|
5
6
|
mountClient,
|
|
6
7
|
SessionErrorBanner,
|
|
@@ -102,15 +103,7 @@ function App() {
|
|
|
102
103
|
);
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
function Bubble({
|
|
106
|
-
from,
|
|
107
|
-
text,
|
|
108
|
-
live,
|
|
109
|
-
}: {
|
|
110
|
-
from: "user" | "assistant";
|
|
111
|
-
text: string;
|
|
112
|
-
live?: boolean;
|
|
113
|
-
}) {
|
|
106
|
+
function Bubble({ from, text, live }: { from: ChatMessage["role"]; text: string; live?: boolean }) {
|
|
114
107
|
const mine = from === "user";
|
|
115
108
|
return (
|
|
116
109
|
<p
|
|
@@ -50,13 +50,11 @@ import {
|
|
|
50
50
|
createStubWorkflows,
|
|
51
51
|
createToolContext,
|
|
52
52
|
createWorkflowContext,
|
|
53
|
-
type JournalStore,
|
|
54
53
|
parseSchemaInput,
|
|
55
54
|
type RecordedStep,
|
|
56
55
|
type RunWorkflowOptions,
|
|
57
56
|
runTool,
|
|
58
57
|
runWorkflow,
|
|
59
|
-
type SleepRecord,
|
|
60
58
|
schemaInputIssues,
|
|
61
59
|
stubGatewayRoute,
|
|
62
60
|
toolRunner,
|
|
@@ -64,6 +62,7 @@ import {
|
|
|
64
62
|
type WorkflowTestHandle,
|
|
65
63
|
type WorkflowTestRun,
|
|
66
64
|
type WorkflowTestStep,
|
|
65
|
+
type WorkflowTestWait,
|
|
67
66
|
} from "@alexkroman1/aai-runtime/testing";
|
|
68
67
|
import {
|
|
69
68
|
installStubGateway,
|
|
@@ -1208,8 +1207,8 @@ describe("the run is DURABLE", () => {
|
|
|
1208
1207
|
}
|
|
1209
1208
|
|
|
1210
1209
|
/** What each of a run's parks IS — an ordinary sleep, or a window's deadline. */
|
|
1211
|
-
function parkKinds(
|
|
1212
|
-
return
|
|
1210
|
+
function parkKinds(waits: readonly WorkflowTestWait[]): WorkflowTestWait["kind"][] {
|
|
1211
|
+
return waits.map((wait) => wait.kind);
|
|
1213
1212
|
}
|
|
1214
1213
|
|
|
1215
1214
|
beforeEach(() => {
|
|
@@ -1286,7 +1285,7 @@ describe("the run is DURABLE", () => {
|
|
|
1286
1285
|
test("journals the gate as a hook DEADLINE and the poll as a sleep", async () => {
|
|
1287
1286
|
// The distinction the whole retention pattern rests on, read off the
|
|
1288
1287
|
// journal rather than inferred from behaviour. A run parks twice for two
|
|
1289
|
-
// different reasons, and `
|
|
1288
|
+
// different reasons, and `WorkflowTestWait.kind` is what keeps them apart:
|
|
1290
1289
|
// `wakeUp` (with no correlation ids) reaches only `sleep`, which is why
|
|
1291
1290
|
// `expireWaits` exists at all and why "send it now" cannot be made to
|
|
1292
1291
|
// answer an approval window it was never told the answer to.
|
|
@@ -1294,13 +1293,11 @@ describe("the run is DURABLE", () => {
|
|
|
1294
1293
|
const run = await startRecap();
|
|
1295
1294
|
await run.advanceSleep();
|
|
1296
1295
|
|
|
1297
|
-
// `
|
|
1298
|
-
// the
|
|
1299
|
-
//
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
// rather than by when the run reached each park.
|
|
1303
|
-
const kinds = parkKinds(await journal.readSleeps(run.runId));
|
|
1296
|
+
// `waits` is read off the journal the run really lives in, so this is the
|
|
1297
|
+
// durable record and not the driver's view of it. One of each, without a
|
|
1298
|
+
// claim about the order: the list is by KEY rather than by when the run
|
|
1299
|
+
// reached each park.
|
|
1300
|
+
const kinds = parkKinds(run.waits);
|
|
1304
1301
|
expect(kinds).toHaveLength(2);
|
|
1305
1302
|
expect(kinds).toContain("sleep");
|
|
1306
1303
|
expect(kinds).toContain("hookTimeout");
|
|
@@ -142,10 +142,14 @@ function connected(status: PlacedCallStatus): boolean {
|
|
|
142
142
|
/** The carrier's word for a call that never reached a session. */
|
|
143
143
|
function unansweredOutcome(status: PlacedCallStatus): CallOutcome {
|
|
144
144
|
switch (status) {
|
|
145
|
+
// Spelled per case: `PlacedCallStatus` is OPEN (a carrier may report a status
|
|
146
|
+
// this SDK has not named yet), so a matched case does not narrow `status`.
|
|
145
147
|
case "busy":
|
|
148
|
+
return "busy";
|
|
146
149
|
case "failed":
|
|
150
|
+
return "failed";
|
|
147
151
|
case "canceled":
|
|
148
|
-
return
|
|
152
|
+
return "canceled";
|
|
149
153
|
default:
|
|
150
154
|
// Still `queued`/`ringing` after every poll reads as nobody picking up.
|
|
151
155
|
return "no-answer";
|
|
@@ -21,5 +21,5 @@ export default agent({
|
|
|
21
21
|
// Any name from `ASSEMBLYAI_TTS_VOICES`. The voice is the speaking stage's
|
|
22
22
|
// own option, so this replaces only that stage; the other two stay on the
|
|
23
23
|
// default pipeline.
|
|
24
|
-
tts: assemblyAITts({ voice: "jane" }),
|
|
24
|
+
tts: assemblyAITts({ voice: "aai-jane" }),
|
|
25
25
|
});
|
|
@@ -30,13 +30,10 @@ import {
|
|
|
30
30
|
import { FatalError, RetryableError } from "@alexkroman1/aai/step-errors";
|
|
31
31
|
import type { WorkflowRunSnapshot } from "@alexkroman1/aai/workflow-api";
|
|
32
32
|
import type {
|
|
33
|
-
JournalStore,
|
|
34
|
-
ResumableRun,
|
|
35
33
|
RunWorkflowOptions,
|
|
36
|
-
SleepRecord,
|
|
37
|
-
StepEntry,
|
|
38
|
-
WorkflowTestHandle,
|
|
39
34
|
WorkflowTestRun,
|
|
35
|
+
WorkflowTestStep,
|
|
36
|
+
WorkflowTestWait,
|
|
40
37
|
} from "@alexkroman1/aai-runtime/testing";
|
|
41
38
|
import {
|
|
42
39
|
createRunSnapshot,
|
|
@@ -697,22 +694,13 @@ describe("the run is DURABLE", () => {
|
|
|
697
694
|
* The run's snapshot carries `wakeAt` and nothing about WHICH wait it is, so
|
|
698
695
|
* the correlation id `file_it_now` names is only visible here.
|
|
699
696
|
*/
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
return sleeps.find((sleep) => sleep.correlationId === REVIEW_SLEEP_ID);
|
|
697
|
+
function reviewSleep(run: WorkflowTestRun<unknown>): WorkflowTestWait | undefined {
|
|
698
|
+
return run.waits.find((wait) => wait.correlationId === REVIEW_SLEEP_ID);
|
|
703
699
|
}
|
|
704
700
|
|
|
705
701
|
/** What an `investigate` left in the journal for a resume to reuse. */
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
runId: string,
|
|
709
|
-
): Promise<StepEntry | undefined> {
|
|
710
|
-
return (await journal.readSteps(runId)).find((step) => step.name === "investigate");
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
/** What a boot sweep would still owe — the query a stranded run is found by. */
|
|
714
|
-
async function resumable(journal: JournalStore): Promise<ResumableRun[]> {
|
|
715
|
-
return (await journal.resumableRuns?.(10)) ?? [];
|
|
702
|
+
function journaledResearch(run: WorkflowTestRun<unknown>): WorkflowTestStep | undefined {
|
|
703
|
+
return run.steps.find((step) => step.name === "investigate");
|
|
716
704
|
}
|
|
717
705
|
|
|
718
706
|
test("suspends on the review wait with the whole report already journaled", async () => {
|
|
@@ -742,7 +730,7 @@ describe("the run is DURABLE", () => {
|
|
|
742
730
|
installStubGateway(SCRIPT);
|
|
743
731
|
const run = await runWorkflow(research, INPUT, RUN);
|
|
744
732
|
|
|
745
|
-
const sleep =
|
|
733
|
+
const sleep = reviewSleep(run);
|
|
746
734
|
expect(sleep, "the run holds no sleep under the review correlation id").toBeDefined();
|
|
747
735
|
expect(sleep?.woken).toBe(false);
|
|
748
736
|
expect(sleep?.kind).toBe("sleep");
|
|
@@ -799,13 +787,13 @@ describe("the run is DURABLE", () => {
|
|
|
799
787
|
// WHY the resume is free, read off the store rather than inferred from a
|
|
800
788
|
// call count: the finished angle's own result is sitting in the journal,
|
|
801
789
|
// which is what the second walk answers `investigate#0` from.
|
|
802
|
-
const done =
|
|
790
|
+
const done = journaledResearch(run);
|
|
803
791
|
expect(done?.status).toBe("ok");
|
|
804
792
|
expect(done?.output).toMatchObject({ angle: "Tool use" });
|
|
805
793
|
// And the run is still FINDABLE: a dead worker leaves it for a boot sweep,
|
|
806
794
|
// which is what makes "resume" a platform behaviour rather than a promise
|
|
807
795
|
// this handle keeps.
|
|
808
|
-
expect(
|
|
796
|
+
expect(run.resumable).toBe(true);
|
|
809
797
|
|
|
810
798
|
await run.restart();
|
|
811
799
|
await run.advanceSleep([REVIEW_SLEEP_ID]);
|
|
@@ -200,7 +200,7 @@ describeWorkflowEval(
|
|
|
200
200
|
// the run renders.
|
|
201
201
|
expect(run.reported[0]).toMatch(/^Uploading standup\.wav /);
|
|
202
202
|
expect(run.reported).toContain("Summarizing the transcript.");
|
|
203
|
-
expect(run.reported.at(-1)).toMatch(/^Recorded a 2s summary
|
|
203
|
+
expect(run.reported.at(-1)).toMatch(/^Recorded a 2s summary with voice [\w-]+\.$/);
|
|
204
204
|
// The job finished on its first poll, so no durable wait was asked for.
|
|
205
205
|
expect(run.slept).toEqual([]);
|
|
206
206
|
// One upload of the recording, and one submit — the split that exists so a
|
|
@@ -218,7 +218,7 @@ describeWorkflowEval(
|
|
|
218
218
|
const { model } = scriptProvider();
|
|
219
219
|
const speech = installStubSpeech();
|
|
220
220
|
|
|
221
|
-
const run = await app.run(spokenSummary, { recording: UPLOAD_ID, voice: "michael" });
|
|
221
|
+
const run = await app.run(spokenSummary, { recording: UPLOAD_ID, voice: "aai-michael" });
|
|
222
222
|
|
|
223
223
|
expect(run.error).toBeUndefined();
|
|
224
224
|
const spokenText = speech.calls[0]?.text;
|
|
@@ -227,7 +227,7 @@ describeWorkflowEval(
|
|
|
227
227
|
// whatever was spoken, it was not the list.
|
|
228
228
|
for (const point of REPLY.points) expect(spokenText).not.toContain(point);
|
|
229
229
|
// The form's choice really reaches the synthesizer.
|
|
230
|
-
expect(speech.calls[0]?.voice).toBe("michael");
|
|
230
|
+
expect(speech.calls[0]?.voice).toBe("aai-michael");
|
|
231
231
|
// Both shapes survive to the output — one to read, one that was heard.
|
|
232
232
|
expect(run.output?.points).toEqual(REPLY.points);
|
|
233
233
|
expect(run.output?.spoken).toBe(REPLY.spoken);
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
WAV_HEADER_BYTES,
|
|
27
27
|
} from "@alexkroman1/aai/step";
|
|
28
28
|
import { FatalError, RetryableError } from "@alexkroman1/aai/step-errors";
|
|
29
|
-
import { ASSEMBLYAI_TTS_DEFAULT_VOICE
|
|
29
|
+
import { ASSEMBLYAI_TTS_DEFAULT_VOICE } from "@alexkroman1/aai/tts";
|
|
30
30
|
import {
|
|
31
31
|
createWorkflowContext,
|
|
32
32
|
runWorkflow,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
installStubUploads,
|
|
42
42
|
} from "@alexkroman1/aai-runtime/testing/vitest";
|
|
43
43
|
import { beforeEach, describe, expect, test, vi } from "vitest";
|
|
44
|
-
import agentDef, {
|
|
44
|
+
import agentDef, { spokenSummary, VOICES } from "./agent.ts";
|
|
45
45
|
import { speak, spokenSummaryFlow, summarize } from "./workflows/summarize.ts";
|
|
46
46
|
import { createJob, pollTranscript, uploadToProvider } from "./workflows/transcribe.ts";
|
|
47
47
|
|
|
@@ -118,14 +118,9 @@ describe("the declaration", () => {
|
|
|
118
118
|
|
|
119
119
|
test("the voice that fills in when nobody chooses is one the form would have offered", () => {
|
|
120
120
|
// `voice` is OPTIONAL, so an unchosen summary is read by the SDK's own
|
|
121
|
-
// default rather than by anything this template names
|
|
122
|
-
//
|
|
123
|
-
// speaking `SUMMARY_LANGUAGE`, the form would still offer nothing but
|
|
124
|
-
// English while the common path spoke something else, which is the failure
|
|
125
|
-
// no voice-id validation can see: the id is real, it is simply the wrong
|
|
126
|
-
// one. Asked of the catalog rather than restated, so the answer stays true.
|
|
121
|
+
// default rather than by anything this template names. Asked of the
|
|
122
|
+
// catalog rather than restated, so the answer stays true.
|
|
127
123
|
expect(VOICES).toContain(ASSEMBLYAI_TTS_DEFAULT_VOICE);
|
|
128
|
-
expect(ttsVoiceInfo(ASSEMBLYAI_TTS_DEFAULT_VOICE)?.language).toBe(SUMMARY_LANGUAGE);
|
|
129
124
|
});
|
|
130
125
|
});
|
|
131
126
|
|
|
@@ -285,10 +280,10 @@ describe("speaking", () => {
|
|
|
285
280
|
const speech = installStubSpeech();
|
|
286
281
|
installStubReporter();
|
|
287
282
|
|
|
288
|
-
await speak("Hello.", { voice: "michael" });
|
|
283
|
+
await speak("Hello.", { voice: "aai-michael" });
|
|
289
284
|
await speak("Hello.");
|
|
290
285
|
|
|
291
|
-
expect(speech.calls[0]?.voice).toBe("michael");
|
|
286
|
+
expect(speech.calls[0]?.voice).toBe("aai-michael");
|
|
292
287
|
// The SDK's own default, named rather than restated — a literal here would
|
|
293
288
|
// have been this template quietly keeping a second copy of it.
|
|
294
289
|
expect(speech.calls[1]?.voice).toBe(ASSEMBLYAI_TTS_DEFAULT_VOICE);
|
|
@@ -369,9 +364,12 @@ describe("the whole run", () => {
|
|
|
369
364
|
installStubReporter();
|
|
370
365
|
const speech = installStubSpeech();
|
|
371
366
|
|
|
372
|
-
await spokenSummaryFlow(
|
|
367
|
+
await spokenSummaryFlow(
|
|
368
|
+
{ recording: UPLOAD_ID, voice: "aai-michael" },
|
|
369
|
+
createWorkflowContext(),
|
|
370
|
+
);
|
|
373
371
|
|
|
374
|
-
expect(speech.calls[0]).toMatchObject({ text: "Spoken.", voice: "michael" });
|
|
372
|
+
expect(speech.calls[0]).toMatchObject({ text: "Spoken.", voice: "aai-michael" });
|
|
375
373
|
});
|
|
376
374
|
|
|
377
375
|
test("a recording the provider gave up on fails the run rather than half-summarizing", async () => {
|
|
@@ -76,40 +76,24 @@
|
|
|
76
76
|
*/
|
|
77
77
|
|
|
78
78
|
import { workflow, workflowApp } from "@alexkroman1/aai";
|
|
79
|
-
import {
|
|
79
|
+
import { ASSEMBLYAI_TTS_VOICES } from "@alexkroman1/aai/tts";
|
|
80
80
|
import type { WorkflowDef } from "@alexkroman1/aai/workflow-api";
|
|
81
81
|
import { z } from "zod";
|
|
82
82
|
import { type SpokenSummary, spokenSummaryFlow } from "./workflows/summarize.ts";
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* The
|
|
86
|
-
*
|
|
87
|
-
* The voice list below is filtered by it, and the prompt in
|
|
88
|
-
* `workflows/summarize.ts` writes the summary in the transcript's own language
|
|
89
|
-
* rather than translating — so this is a claim about the VOICES, which is why
|
|
90
|
-
* it lives next to them. Typed as the catalog's own union rather than the
|
|
91
|
-
* literal `"en"`, so a fork changing it can only name a language the voices
|
|
92
|
-
* actually cover — `ttsVoiceIds` answers the SDK's default voice ALONE when a
|
|
93
|
-
* filter matches nothing, and a select with one entry in it is not a failure
|
|
94
|
-
* anybody would look at twice.
|
|
95
|
-
*/
|
|
96
|
-
export const SUMMARY_LANGUAGE: AssemblyAITtsLanguage = "en";
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* The voices the form offers, as the tuple `z.enum` takes.
|
|
85
|
+
* The voices the form offers: the SDK's library voices, as the tuple `z.enum`
|
|
86
|
+
* takes.
|
|
100
87
|
*
|
|
101
|
-
* READ from the SDK's catalog rather than listed, because a wrong voice id is
|
|
102
|
-
*
|
|
103
|
-
* the
|
|
104
|
-
*
|
|
105
|
-
* language and the prompt does not translate; every voice in the catalog speaks
|
|
106
|
-
* exactly one. `ttsVoiceIds` owns the derivation, including the fallback to the
|
|
107
|
-
* SDK's own default voice should the filter ever match nothing.
|
|
88
|
+
* READ from the SDK's catalog rather than listed, because a wrong voice id is
|
|
89
|
+
* refused when the synthesis socket opens — the run fails at the step rather
|
|
90
|
+
* than at the form. Every library voice speaks every supported language, so the
|
|
91
|
+
* summary (written in the transcript's own language) can be read by any of them.
|
|
108
92
|
*
|
|
109
93
|
* Exported so `agent.test.ts` can hold the list to the catalog it came from —
|
|
110
94
|
* in particular that the voice the SDK fills in for an unchosen one is on it.
|
|
111
95
|
*/
|
|
112
|
-
export const VOICES =
|
|
96
|
+
export const VOICES = ASSEMBLYAI_TTS_VOICES;
|
|
113
97
|
|
|
114
98
|
/**
|
|
115
99
|
* The run input, as its own const.
|
|
@@ -254,7 +254,7 @@ export async function speak(
|
|
|
254
254
|
});
|
|
255
255
|
|
|
256
256
|
await stepReport(
|
|
257
|
-
`Recorded a ${Math.round(spoken.durationMs / 1000)}s summary
|
|
257
|
+
`Recorded a ${Math.round(spoken.durationMs / 1000)}s summary with voice ${spoken.voice}.`,
|
|
258
258
|
);
|
|
259
259
|
return { audio: stored.id, durationMs: spoken.durationMs };
|
|
260
260
|
}
|
|
@@ -16,7 +16,7 @@ export default agent({
|
|
|
16
16
|
// something to project rather than an empty state object.
|
|
17
17
|
// A narrator wants a narrative voice; everything else stays on the
|
|
18
18
|
// default all-AssemblyAI pipeline.
|
|
19
|
-
tts: assemblyAITts({ voice: "paul" }),
|
|
19
|
+
tts: assemblyAITts({ voice: "aai-paul" }),
|
|
20
20
|
/**
|
|
21
21
|
* The status line, pushed to the CRT's top bar — where you are, your score,
|
|
22
22
|
* your rank and the turn count, the four facts the printed games put across
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** The def a DEPLOYED agent runs: authored, plus what `system-prompt.md` says. */
|
|
2
2
|
import agentDef from "virtual:aai/agent";
|
|
3
|
-
import {
|
|
3
|
+
import { MCP_TOOL_PREFIX, mcpToolName } from "@alexkroman1/aai";
|
|
4
4
|
import { expectDeployable, expectPromptBuiltinsDeclared } from "@alexkroman1/aai-runtime/testing";
|
|
5
5
|
import { afterEach, describe, expect, test, vi } from "vitest";
|
|
6
6
|
import { ARCHIVE_KEY, ARCHIVE_TOKEN_ENV, ARCHIVE_URL_ENV } from "./agent.ts";
|
|
@@ -172,11 +172,11 @@ describe("the archive MCP server", () => {
|
|
|
172
172
|
// the archive publishing its own `web_search` cannot land where Scout's
|
|
173
173
|
// builtin of that name stood. The key is the first segment of that name and
|
|
174
174
|
// is the template's own choice, so this is where its length is spent —
|
|
175
|
-
//
|
|
175
|
+
// the 64-character tool-name cap providers enforce is hard and a name that exceeds it is TRUNCATED,
|
|
176
176
|
// which is how two of a server's tools collapse onto one name and one of
|
|
177
177
|
// them is silently dropped.
|
|
178
178
|
const name = mcpToolName(ARCHIVE_KEY, "web_search");
|
|
179
179
|
expect(name).toBe(`${MCP_TOOL_PREFIX}${ARCHIVE_KEY}_web_search`);
|
|
180
|
-
expect(name.length).toBeLessThanOrEqual(
|
|
180
|
+
expect(name.length).toBeLessThanOrEqual(64);
|
|
181
181
|
});
|
|
182
182
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexkroman1/aai-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"vite": "^8.3.1",
|
|
59
59
|
"xstate": "^5.33.2",
|
|
60
60
|
"zod": "^4.6.5",
|
|
61
|
-
"@alexkroman1/aai": "0.
|
|
62
|
-
"@alexkroman1/aai-runtime": "0.
|
|
63
|
-
"@alexkroman1/aai-ui": "0.
|
|
61
|
+
"@alexkroman1/aai": "0.17.0",
|
|
62
|
+
"@alexkroman1/aai-runtime": "0.17.0",
|
|
63
|
+
"@alexkroman1/aai-ui": "0.17.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"playwright": "^1.63.0",
|