@voicelayer/sdk 0.5.1 → 0.6.1
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/brain/index.d.ts +2 -2
- package/dist/brain/index.js +70 -16
- package/dist/index.d.ts +280 -277
- package/dist/index.js +7807 -6419
- package/dist/runtime/text-session.d.ts +1 -1
- package/dist/runtime/text-session.js +578 -103
- package/dist/{text-session-BbG3VG50.d.ts → text-session-C4Z59gG4.d.ts} +194 -111
- package/package.json +8 -4
package/dist/brain/index.d.ts
CHANGED
|
@@ -81,14 +81,14 @@ declare const ConnectorUpFrame: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
81
81
|
code: z.ZodEnum<["upstream_timeout", "upstream_error", "bad_response", "normalize_failed", "unreachable"]>;
|
|
82
82
|
message: z.ZodString;
|
|
83
83
|
}, "strip", z.ZodTypeAny, {
|
|
84
|
-
kind: "brain.error";
|
|
85
84
|
code: "upstream_timeout" | "upstream_error" | "bad_response" | "normalize_failed" | "unreachable";
|
|
86
85
|
message: string;
|
|
86
|
+
kind: "brain.error";
|
|
87
87
|
streamId: string;
|
|
88
88
|
}, {
|
|
89
|
-
kind: "brain.error";
|
|
90
89
|
code: "upstream_timeout" | "upstream_error" | "bad_response" | "normalize_failed" | "unreachable";
|
|
91
90
|
message: string;
|
|
91
|
+
kind: "brain.error";
|
|
92
92
|
streamId: string;
|
|
93
93
|
}>]>;
|
|
94
94
|
type ConnectorUpFrame = z.infer<typeof ConnectorUpFrame>;
|
package/dist/brain/index.js
CHANGED
|
@@ -628,7 +628,15 @@ var ProcessToolDTO = z.object({
|
|
|
628
628
|
* Self-hosted workers only: allow a private / loopback address (a localhost service of your own). A platform
|
|
629
629
|
* worker (it holds the internal service token) never honours it.
|
|
630
630
|
*/
|
|
631
|
-
allowPrivateNetwork: z.boolean().optional()
|
|
631
|
+
allowPrivateNetwork: z.boolean().optional(),
|
|
632
|
+
/**
|
|
633
|
+
* Burn-down G-33: the model reads the caller's PII as tokens (`<PII_PHONE_1>`). `true` — this tool's arguments carry
|
|
634
|
+
* the caller's real values instead, when its URL fixes the host (publish refuses it on a host the call fills in).
|
|
635
|
+
* Absent — real values only when it signs in with a connection; otherwise the endpoint gets the tokens. `false` —
|
|
636
|
+
* always the tokens.
|
|
637
|
+
* (packages/sdk/test/tool-detokenise.test.ts)
|
|
638
|
+
*/
|
|
639
|
+
sendRealValues: z.boolean().optional()
|
|
632
640
|
});
|
|
633
641
|
var ProcessSchemaDTO = z.object({
|
|
634
642
|
id: z.string().min(1).max(64),
|
|
@@ -1188,8 +1196,14 @@ var AgentConfig = z.object({
|
|
|
1188
1196
|
// collects nothing structured. DERIVED from the agents row; read-only.
|
|
1189
1197
|
requiredInfo: z.array(RequiredInfoField).max(64).default([]),
|
|
1190
1198
|
createdAt: z.string().datetime(),
|
|
1191
|
-
//
|
|
1192
|
-
|
|
1199
|
+
// On the draft view: when the draft row last changed. On the published view (GET /config's default): when what runs
|
|
1200
|
+
// last changed — the published version's createdAt. Only the draft's is the PATCH lock token: send draftUpdatedAt.
|
|
1201
|
+
updatedAt: z.string().datetime(),
|
|
1202
|
+
// The optimistic-lock token PATCH /v1/agents/:id/config checks (If-Match; also sent, quoted, as the ETag): the DRAFT
|
|
1203
|
+
// row's updatedAt. Always on the draft view; on the published view only while the draft equals what's published —
|
|
1204
|
+
// otherwise absent, and an editor reads ?view=draft, so it never writes over unpublished changes it didn't see
|
|
1205
|
+
// (burn-down G-37). A projection of the existing column, not a stored field (agents DECISIONS A-7 stands).
|
|
1206
|
+
draftUpdatedAt: z.string().datetime().optional()
|
|
1193
1207
|
});
|
|
1194
1208
|
|
|
1195
1209
|
// ../contracts/src/call-plan.ts
|
|
@@ -1522,21 +1536,27 @@ z.object({
|
|
|
1522
1536
|
|
|
1523
1537
|
// ../contracts/src/providers.ts
|
|
1524
1538
|
var PROVIDERS = {
|
|
1525
|
-
openai: { id: "openai", label: "OpenAI", capabilities: ["llm", "tts", "realtime"], byok: true, supportsBaseUrl: true, keyPlaceholder: "sk-..." },
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1539
|
+
openai: { id: "openai", label: "OpenAI", capabilities: ["llm", "tts", "realtime"], byok: true, supportsBaseUrl: true, keyPlaceholder: "sk-...", runsOn: { llm: ["voice", "text"], tts: ["voice"], realtime: ["voice"] }, platformKeyEnv: "OPENAI_API_KEY" },
|
|
1540
|
+
// No platform runtime: LiveKit's anthropic plugin needs @livekit/agents >= 1.5 (the workers pin 1.4.0 — the 1.7 audio
|
|
1541
|
+
// regression), and the API's text replies run OpenAI only (burn-down G-9).
|
|
1542
|
+
anthropic: { id: "anthropic", label: "Anthropic", capabilities: ["llm"], byok: true, supportsBaseUrl: true, keyPlaceholder: "sk-ant-...", runsOn: { llm: [] }, platformKeyEnv: "ANTHROPIC_API_KEY" },
|
|
1543
|
+
deepgram: { id: "deepgram", label: "Deepgram", capabilities: ["stt", "tts"], byok: true, supportsBaseUrl: false, keyPlaceholder: "Deepgram API key", runsOn: { stt: ["voice"], tts: ["voice"] }, platformKeyEnv: "DEEPGRAM_API_KEY" },
|
|
1544
|
+
elevenlabs: { id: "elevenlabs", label: "ElevenLabs", capabilities: ["tts"], byok: true, supportsBaseUrl: false, keyPlaceholder: "ElevenLabs API key", runsOn: { tts: ["voice"] }, platformKeyEnv: "ELEVEN_API_KEY" },
|
|
1545
|
+
// Cartesia's LiveKit plugin (1.4.0) ships TTS only: its speech-to-text has no runtime.
|
|
1546
|
+
cartesia: { id: "cartesia", label: "Cartesia", capabilities: ["stt", "tts"], byok: true, supportsBaseUrl: false, keyPlaceholder: "Cartesia API key", runsOn: { stt: [], tts: ["voice"] }, platformKeyEnv: "CARTESIA_API_KEY" },
|
|
1547
|
+
assemblyai: { id: "assemblyai", label: "AssemblyAI", capabilities: ["stt"], byok: true, supportsBaseUrl: false, keyPlaceholder: "AssemblyAI API key", runsOn: { stt: ["voice"] }, platformKeyEnv: "ASSEMBLYAI_API_KEY" },
|
|
1548
|
+
// Gemini on text waits on burn-down G-9 (the API's text replies run OpenAI only).
|
|
1549
|
+
google: { id: "google", label: "Google (Gemini)", capabilities: ["llm", "realtime"], byok: true, supportsBaseUrl: false, keyPlaceholder: "AIza...", runsOn: { llm: ["voice"], realtime: ["voice"] }, platformKeyEnv: "GOOGLE_API_KEY" },
|
|
1550
|
+
groq: { id: "groq", label: "Groq", capabilities: ["llm"], byok: true, supportsBaseUrl: true, keyPlaceholder: "gsk_...", runsOn: { llm: [] }, platformKeyEnv: "GROQ_API_KEY" },
|
|
1533
1551
|
// Runtime-only providers (no external key): local VAD.
|
|
1534
|
-
silero: { id: "silero", label: "Silero", capabilities: ["vad"], byok: false, supportsBaseUrl: false }
|
|
1552
|
+
silero: { id: "silero", label: "Silero", capabilities: ["vad"], byok: false, supportsBaseUrl: false, runsOn: { vad: ["voice"] } }
|
|
1535
1553
|
};
|
|
1536
1554
|
function byokProviders() {
|
|
1537
1555
|
return Object.values(PROVIDERS).filter((p) => p.byok);
|
|
1538
1556
|
}
|
|
1539
1557
|
var ProviderKind = z.enum(["llm", "stt", "tts", "realtime"]);
|
|
1558
|
+
var ModelSurface = z.enum(["voice", "text"]);
|
|
1559
|
+
var ProviderKeySource = z.enum(["workspace", "platform", "none"]);
|
|
1540
1560
|
var CatalogVoice = z.object({
|
|
1541
1561
|
id: z.string().min(1).max(128),
|
|
1542
1562
|
label: z.string().min(1).max(128),
|
|
@@ -1570,7 +1590,12 @@ var CatalogProvider = z.object({
|
|
|
1570
1590
|
// Populated for tts / realtime providers.
|
|
1571
1591
|
voices: z.array(CatalogVoice).optional(),
|
|
1572
1592
|
// Pre-selected when the provider is chosen.
|
|
1573
|
-
defaultModel: z.string().max(128).optional()
|
|
1593
|
+
defaultModel: z.string().max(128).optional(),
|
|
1594
|
+
// The surfaces the platform runs this provider's models on (contracts PROVIDERS `runsOn`). A picker offers the
|
|
1595
|
+
// provider only for a surface listed here; absent means none, so an unrunnable provider is never offered by default.
|
|
1596
|
+
surfaces: z.array(ModelSurface).default([]),
|
|
1597
|
+
// Whose key this provider would run on for the requesting workspace; unknown means none.
|
|
1598
|
+
key: ProviderKeySource.default("none")
|
|
1574
1599
|
});
|
|
1575
1600
|
z.object({
|
|
1576
1601
|
llm: z.array(CatalogProvider).default([]),
|
|
@@ -1625,8 +1650,26 @@ z.object({
|
|
|
1625
1650
|
// The assumptions actually used (after defaults) — drives the UI footnote.
|
|
1626
1651
|
assumptions: CostEstimateAssumptions.required()
|
|
1627
1652
|
});
|
|
1653
|
+
|
|
1654
|
+
// ../contracts/src/openai-models.ts
|
|
1655
|
+
function categorizeOpenAiModel(id) {
|
|
1656
|
+
const s = id.toLowerCase();
|
|
1657
|
+
if (s.includes("realtime")) return "realtime";
|
|
1658
|
+
if (s.includes("transcribe") || s.includes("whisper")) return "stt";
|
|
1659
|
+
if (s.includes("tts") || s.includes("audio-speech")) return "tts";
|
|
1660
|
+
if (/embedding|moderation|dall-e|image|^omni-|^text-|search|rerank|babbage|davinci|codex/.test(s)) {
|
|
1661
|
+
return null;
|
|
1662
|
+
}
|
|
1663
|
+
if (/-pro\b|deep-research|computer-use/.test(s)) return null;
|
|
1664
|
+
if (/^(gpt|o[0-9]|chatgpt)/.test(s)) return "llm";
|
|
1665
|
+
return null;
|
|
1666
|
+
}
|
|
1667
|
+
function isOpenAiChatModel(id) {
|
|
1668
|
+
return categorizeOpenAiModel(id) === "llm";
|
|
1669
|
+
}
|
|
1628
1670
|
var EvaluationMetric = z.enum(["rating", "binary", "options", "text"]);
|
|
1629
1671
|
var EvaluationStatus = z.enum(["pending", "scored", "failed"]);
|
|
1672
|
+
var EvaluationJudgeModel = z.string().min(1).max(128).refine(isOpenAiChatModel, { message: "The judge runs OpenAI chat models only (e.g. gpt-4o-mini)." });
|
|
1630
1673
|
var EvaluationOption = z.object({
|
|
1631
1674
|
value: z.string().min(1).max(64),
|
|
1632
1675
|
label: z.string().min(1).max(120),
|
|
@@ -1638,6 +1681,7 @@ z.object({
|
|
|
1638
1681
|
name: z.string().min(1).max(120),
|
|
1639
1682
|
criteria: z.string().max(4e3),
|
|
1640
1683
|
metric: EvaluationMetric,
|
|
1684
|
+
// a stored row may predate the judge-model rule; it is judged on the default (EVALUATION_JUDGE_SUGGESTIONS)
|
|
1641
1685
|
model: z.string().min(1).max(128),
|
|
1642
1686
|
minValue: z.number().int().nullable(),
|
|
1643
1687
|
minLabel: z.string().nullable(),
|
|
@@ -1653,7 +1697,7 @@ var EvaluationInput = z.object({
|
|
|
1653
1697
|
name: z.string().min(1).max(120),
|
|
1654
1698
|
criteria: z.string().max(4e3).default(""),
|
|
1655
1699
|
metric: EvaluationMetric.default("rating"),
|
|
1656
|
-
model:
|
|
1700
|
+
model: EvaluationJudgeModel.default("gpt-4o-mini"),
|
|
1657
1701
|
minValue: z.number().int().nullable().optional(),
|
|
1658
1702
|
minLabel: z.string().max(200).nullable().optional(),
|
|
1659
1703
|
maxValue: z.number().int().nullable().optional(),
|
|
@@ -1815,7 +1859,10 @@ var ToolCallAudit = z.object({
|
|
|
1815
1859
|
ok: z.boolean(),
|
|
1816
1860
|
// refused by the Action Guard before it ran
|
|
1817
1861
|
blocked: z.boolean(),
|
|
1818
|
-
errorMessage: z.string().optional()
|
|
1862
|
+
errorMessage: z.string().optional(),
|
|
1863
|
+
// Burn-down G-33: the call's PII tokens swapped back for the caller's real values in this tool's arguments (it went to
|
|
1864
|
+
// a trusted destination) — how many, and the host they went to (null: the agent's own code). Never a value.
|
|
1865
|
+
detokenized: z.object({ count: z.number().int().min(1), destinationHost: z.string().nullable() }).optional()
|
|
1819
1866
|
});
|
|
1820
1867
|
var McpInteractionAudit = z.object({
|
|
1821
1868
|
// One of the four runtime tools — closed set, no growth allowed.
|
|
@@ -2481,7 +2528,14 @@ z.discriminatedUnion("kind", [
|
|
|
2481
2528
|
BrainRequestFrame,
|
|
2482
2529
|
BrainCancelFrame
|
|
2483
2530
|
]);
|
|
2484
|
-
var FLOW_BOOT_FAILURES = [
|
|
2531
|
+
var FLOW_BOOT_FAILURES = [
|
|
2532
|
+
"schema_fetch_failed",
|
|
2533
|
+
"no_process_schema",
|
|
2534
|
+
"missing_agent_id",
|
|
2535
|
+
"no_api_key",
|
|
2536
|
+
"worker_identity_refused",
|
|
2537
|
+
"provider_unavailable"
|
|
2538
|
+
];
|
|
2485
2539
|
z.enum(
|
|
2486
2540
|
FLOW_BOOT_FAILURES.map((cause) => `flow_boot:${cause}`)
|
|
2487
2541
|
);
|