@voicelayer/sdk 0.4.0 → 0.4.2

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.
@@ -1,4 +1,4 @@
1
- export { ab as GraphTraceEvent, ac as LiveTextConversation, ad as LiveTurnResult, ae as RunLiveTextOptions, u as RunTextSessionOptions, v as RunTextTranscriptOptions, V as TextSession, W as TextTranscriptResult, af as runLiveTextConversation, a8 as runTextSession, a9 as runTextTranscript, ag as runWithOpenAIScope } from '../text-session-BB0dLLH2.js';
1
+ export { ab as GraphTraceEvent, ac as LiveTextConversation, ad as LiveTurnResult, ae as RunLiveTextOptions, u as RunTextSessionOptions, v as RunTextTranscriptOptions, V as TextSession, W as TextTranscriptResult, af as runLiveTextConversation, a8 as runTextSession, a9 as runTextTranscript, ag as runWithOpenAIScope } from '../text-session-CtXihRr6.js';
2
2
  import '@livekit/agents';
3
3
  import 'zod';
4
4
  import 'openai';
@@ -430,9 +430,11 @@ var init_agents = __esm({
430
430
  });
431
431
  ProcessSchemaDTO = z.object({
432
432
  id: z.string().min(1).max(64),
433
- // System-prompt fragments compiled from say/confirm nodes. The SDK bridge
434
- // composes these into the agent's prompt.
435
- prompts: z.array(z.object({ id: z.string().min(1).max(128), text: z.string().max(2e3) })).max(64).optional(),
433
+ // System-prompt fragments compiled from say/confirm/llm nodes. The SDK bridge
434
+ // composes these into the agent's prompt. An AI step's instructions are a
435
+ // system prompt in their own right, so the cap is generous (2,000 refused real
436
+ // flows — G-27); publish checks it (validateFlowGraph → compiledSchemaIssues).
437
+ prompts: z.array(z.object({ id: z.string().min(1).max(128), text: z.string().max(16e3) })).max(64).optional(),
436
438
  fields: z.array(ProcessFieldDTO).max(64),
437
439
  completionGate: z.object({
438
440
  requiredFields: z.array(z.string()).max(64),
@@ -1680,6 +1682,46 @@ var init_call_result = __esm({
1680
1682
  });
1681
1683
  }
1682
1684
  });
1685
+ var WEBHOOK_EVENT_TYPES, CallWebhookDirection, CallWebhookOutcome, CallWebhookAttributes, Party;
1686
+ var init_webhook_events = __esm({
1687
+ "../contracts/src/webhook-events.ts"() {
1688
+ WEBHOOK_EVENT_TYPES = ["call.started", "call.ended", "recording.ready"];
1689
+ z.enum(WEBHOOK_EVENT_TYPES);
1690
+ CallWebhookDirection = z.enum(["inbound", "outbound", "web"]);
1691
+ CallWebhookOutcome = z.enum(["completed", "dropped", "failed", "no_answer", "other"]);
1692
+ CallWebhookAttributes = z.record(z.union([z.string(), z.number(), z.boolean()]));
1693
+ Party = z.string().min(1).nullable();
1694
+ z.object({
1695
+ callId: z.string().uuid(),
1696
+ startedAt: z.string().datetime(),
1697
+ agentId: z.string().nullable(),
1698
+ phoneNumberId: z.string().nullable(),
1699
+ callerE164: Party,
1700
+ toE164: Party,
1701
+ // Null when it can't be told yet: an inbound phone call and a web session look alike until the caller joins. When
1702
+ // set, it is the same value `call.ended` carries; `call.ended` always has one.
1703
+ direction: CallWebhookDirection.nullable()
1704
+ });
1705
+ z.object({
1706
+ callId: z.string().uuid(),
1707
+ durationMs: z.number().int().min(0),
1708
+ endedAt: z.string().datetime(),
1709
+ endReason: z.string(),
1710
+ agentId: z.string().nullable(),
1711
+ phoneNumberId: z.string().nullable(),
1712
+ callerE164: Party,
1713
+ toE164: Party,
1714
+ direction: CallWebhookDirection,
1715
+ outcome: CallWebhookOutcome,
1716
+ attributes: CallWebhookAttributes
1717
+ });
1718
+ z.object({
1719
+ callId: z.string().uuid(),
1720
+ recordingUrl: z.string().url(),
1721
+ status: z.enum(["starting", "active", "completed", "failed", "aborted"])
1722
+ });
1723
+ }
1724
+ });
1683
1725
  var PhoneNumberStatus, PhoneNumberProvider, PhoneNumberCapabilities, PhoneNumberRecord;
1684
1726
  var init_numbers = __esm({
1685
1727
  "../contracts/src/numbers.ts"() {
@@ -1758,10 +1800,41 @@ var init_flow_ports = __esm({
1758
1800
  INCOMPLETE_PORT_ID = "incomplete";
1759
1801
  }
1760
1802
  });
1803
+
1804
+ // ../contracts/src/flow-edges.ts
1805
+ var init_flow_edges = __esm({
1806
+ "../contracts/src/flow-edges.ts"() {
1807
+ }
1808
+ });
1809
+
1810
+ // ../contracts/src/flow-enrichment.ts
1811
+ var init_flow_enrichment = __esm({
1812
+ "../contracts/src/flow-enrichment.ts"() {
1813
+ }
1814
+ });
1815
+
1816
+ // ../contracts/src/flow-compile.ts
1817
+ var init_flow_compile = __esm({
1818
+ "../contracts/src/flow-compile.ts"() {
1819
+ init_flow_enrichment();
1820
+ init_flow_edges();
1821
+ }
1822
+ });
1823
+
1824
+ // ../contracts/src/flow-compile-check.ts
1825
+ var init_flow_compile_check = __esm({
1826
+ "../contracts/src/flow-compile-check.ts"() {
1827
+ init_agents();
1828
+ init_flow_compile();
1829
+ }
1830
+ });
1761
1831
  var FlowIssueSeverity, FlowIssue;
1762
1832
  var init_flow_validate = __esm({
1763
1833
  "../contracts/src/flow-validate.ts"() {
1764
1834
  init_flow_ports();
1835
+ init_flow_edges();
1836
+ init_flow_compile_check();
1837
+ init_flow_edges();
1765
1838
  FlowIssueSeverity = z.enum(["error", "warning"]);
1766
1839
  FlowIssue = z.object({
1767
1840
  code: z.string().max(64),
@@ -1937,6 +2010,39 @@ var init_connection = __esm({
1937
2010
  keyPlaceholder: p.keyPlaceholder ?? "",
1938
2011
  supportsBaseUrl: p.supportsBaseUrl
1939
2012
  }));
2013
+ z.object({
2014
+ id: z.string().min(1),
2015
+ label: z.string().min(1),
2016
+ /** The vault `provider` the resulting connection is stored under. */
2017
+ vaultProvider: z.string().min(1),
2018
+ category: z.enum(["model", "tool"])
2019
+ });
2020
+ z.object({
2021
+ authorizeUrl: z.string().url()
2022
+ });
2023
+ z.object({
2024
+ state: z.string().min(1).max(512),
2025
+ code: z.string().min(1).max(4096)
2026
+ });
2027
+ z.object({
2028
+ providerId: z.string().min(1),
2029
+ /** The provider's display name ("ChatGPT"). */
2030
+ providerLabel: z.string().min(1),
2031
+ /** What the connection is for — which group the dashboard files it under. */
2032
+ category: z.enum(["model", "tool"]),
2033
+ /** The account's stable id at the provider (OIDC `sub`); reconnecting the same account updates the same row. */
2034
+ subject: z.string().min(1).nullable(),
2035
+ email: z.string().nullable(),
2036
+ displayName: z.string().nullable(),
2037
+ scopes: z.array(z.string()),
2038
+ /**
2039
+ * The workspace user who signed in. A person's model plan (category 'model') serves only them — never teammates or
2040
+ * API keys. Absent on rows connected before it was recorded.
2041
+ */
2042
+ connectedBy: z.string().nullable().optional(),
2043
+ /** Set when a refresh was refused (e.g. `invalid_grant`): the owner must connect again. */
2044
+ reauthRequired: z.boolean().optional()
2045
+ });
1940
2046
  }
1941
2047
  });
1942
2048
  var E164, RoomPrefix, RecordingPrefix, Cidr, TelephonySettings, ProfileSource, EffectiveCallProfile;
@@ -2259,18 +2365,13 @@ var init_connector_stream = __esm({
2259
2365
  ]);
2260
2366
  }
2261
2367
  });
2262
-
2263
- // ../contracts/src/flow-enrichment.ts
2264
- var init_flow_enrichment = __esm({
2265
- "../contracts/src/flow-enrichment.ts"() {
2266
- }
2267
- });
2268
-
2269
- // ../contracts/src/flow-compile.ts
2270
- var init_flow_compile = __esm({
2271
- "../contracts/src/flow-compile.ts"() {
2272
- init_flow_enrichment();
2273
- init_flow_validate();
2368
+ var FLOW_BOOT_FAILURES;
2369
+ var init_call_end_reason = __esm({
2370
+ "../contracts/src/call-end-reason.ts"() {
2371
+ FLOW_BOOT_FAILURES = ["schema_fetch_failed", "no_process_schema", "missing_agent_id", "no_api_key"];
2372
+ z.enum(
2373
+ FLOW_BOOT_FAILURES.map((cause) => `flow_boot:${cause}`)
2374
+ );
2274
2375
  }
2275
2376
  });
2276
2377
  var EnvironmentSpec;
@@ -3492,6 +3593,7 @@ var init_src = __esm({
3492
3593
  init_tests();
3493
3594
  init_call_review();
3494
3595
  init_call_result();
3596
+ init_webhook_events();
3495
3597
  init_numbers();
3496
3598
  init_project_limits();
3497
3599
  init_flow();
@@ -3509,6 +3611,8 @@ var init_src = __esm({
3509
3611
  init_connector();
3510
3612
  init_connector_stream();
3511
3613
  init_flow_compile();
3614
+ init_flow_compile_check();
3615
+ init_call_end_reason();
3512
3616
  init_flow_enrichment();
3513
3617
  init_environments();
3514
3618
  init_variables();