@voicelayer/sdk 0.3.1 → 0.4.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.
@@ -79,14 +79,14 @@ declare const ConnectorUpFrame: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
79
79
  code: z.ZodEnum<["upstream_timeout", "upstream_error", "bad_response", "normalize_failed", "unreachable"]>;
80
80
  message: z.ZodString;
81
81
  }, "strip", z.ZodTypeAny, {
82
- kind: "brain.error";
83
82
  code: "upstream_timeout" | "upstream_error" | "bad_response" | "normalize_failed" | "unreachable";
84
83
  message: string;
84
+ kind: "brain.error";
85
85
  streamId: string;
86
86
  }, {
87
- kind: "brain.error";
88
87
  code: "upstream_timeout" | "upstream_error" | "bad_response" | "normalize_failed" | "unreachable";
89
88
  message: string;
89
+ kind: "brain.error";
90
90
  streamId: string;
91
91
  }>]>;
92
92
  type ConnectorUpFrame = z.infer<typeof ConnectorUpFrame>;
@@ -855,7 +855,10 @@ var CallEventKind = z.enum([
855
855
  // presses a key on their leg; `dtmf.sent` fires when our agent (or a
856
856
  // programmatic caller via /v1/calls/:id/dtmf) emits one outbound.
857
857
  "dtmf.received",
858
- "dtmf.sent"
858
+ "dtmf.sent",
859
+ // A host's runtime intervention (burn-down G-6): call_say / call_send_guidance / call_inject_context / call_instruct,
860
+ // with masked args and the API key — written by the API only, never through the worker's /events endpoint.
861
+ "mcp.interaction"
859
862
  ]);
860
863
  var OP_CALL_EVENT_KIND = /^(tool|handoff|lookup|record|notify|engine)\.[a-z0-9_]{1,48}(\.[a-z0-9_]{1,48})?$/;
861
864
  var OpCallEventKind = z.string().regex(OP_CALL_EVENT_KIND);
@@ -901,7 +904,7 @@ z.object({
901
904
  payload: z.unknown(),
902
905
  ts: z.string().datetime()
903
906
  });
904
- z.enum(["say", "hangup", "dtmf", "instruct", "guidance"]);
907
+ z.enum(["say", "hangup", "dtmf", "instruct", "inject_context", "guidance"]);
905
908
  var commandId = z.string().uuid().optional();
906
909
  var SayCommand = z.object({
907
910
  kind: z.literal("say"),
@@ -924,20 +927,26 @@ var DtmfCommand = z.object({
924
927
  var InstructCommand = z.object({
925
928
  kind: z.literal("instruct"),
926
929
  commandId,
927
- text: z.string().min(1)
930
+ text: z.string().min(1).max(4e3)
931
+ });
932
+ var InjectContextCommand = z.object({
933
+ kind: z.literal("inject_context"),
934
+ commandId,
935
+ text: z.string().min(1).max(4e3)
928
936
  });
929
937
  z.discriminatedUnion("kind", [
930
938
  SayCommand,
931
939
  HangupCommand,
932
940
  DtmfCommand,
933
941
  InstructCommand,
942
+ InjectContextCommand,
934
943
  GuidanceCommand
935
944
  ]);
936
945
  z.object({
937
946
  commandId: z.string().uuid(),
938
947
  outcome: z.enum(["applied", "refused", "failed"]),
939
948
  // machine code: output_blocked · not_supported · unknown_consultation · no_consultation · invalid_command ·
940
- // say_unavailable · dtmf_unavailable
949
+ // say_unavailable · dtmf_unavailable · context_full · instructions_unavailable
941
950
  code: z.string().max(64).optional(),
942
951
  detail: z.string().max(500).optional()
943
952
  });
@@ -1714,35 +1723,6 @@ z.object({
1714
1723
  note: z.string().max(2e3).nullable().optional(),
1715
1724
  reviewed: z.boolean().optional()
1716
1725
  });
1717
- var ToolExposure = z.enum(["agent", "mcp"]);
1718
- z.object({
1719
- name: z.string().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/, "snake_case"),
1720
- // The string that routes the LLM/orchestrator to invoke this tool.
1721
- description: z.string().min(1).max(2e3),
1722
- // Zod serialized to JSON Schema at registration time. Persisted as
1723
- // JSON Schema; SDK and dashboard rehydrate to Zod when needed.
1724
- inputSchema: z.record(z.unknown()),
1725
- // When present, the runtime validates the handler's return value.
1726
- outputSchema: z.record(z.unknown()).optional(),
1727
- exposedVia: z.array(ToolExposure).min(1),
1728
- // ── Tool/Plugin SDK (PRD P0.2). All optional for back-compat. ──
1729
- // Latency class (PRD §4.6.3). Runtime defaults to 'in_call' when omitted.
1730
- mode: z.enum(["in_call", "async_only"]).optional(),
1731
- // Hard timeout for an in-call tool (ms).
1732
- timeoutMs: z.number().int().min(50).max(6e4).optional(),
1733
- // 'connection' resolves a credential from the vault by `connectionRef`.
1734
- auth: z.enum(["none", "connection"]).optional(),
1735
- connectionRef: z.string().max(128).optional(),
1736
- // Retry policy for safe/async verbs.
1737
- retry: z.object({
1738
- maxAttempts: z.number().int().min(1).max(5),
1739
- backoffMs: z.number().int().min(0).max(6e4)
1740
- }).optional(),
1741
- // Normalized result kinds the flow/decision layer branches on (result.kind).
1742
- resultKinds: z.array(z.string().min(1).max(64)).max(24).optional(),
1743
- // Free-form dashboard metadata (icon, group, etc.). No `category` enum.
1744
- metadata: z.record(z.unknown()).optional()
1745
- });
1746
1726
  var TranscriptTurn = z.object({
1747
1727
  speaker: z.enum(["caller", "agent"]),
1748
1728
  text: z.string(),
@@ -1759,24 +1739,28 @@ var ConsultationAudit = z.object({
1759
1739
  latencyMs: z.number().int().min(0)
1760
1740
  });
1761
1741
  var ToolCallAudit = z.object({
1742
+ invocationId: z.string(),
1762
1743
  toolName: z.string(),
1763
- // Verbatim args the LLM produced. May contain PII — see open question O2
1764
- // in docs/architecture/contracts-design.md §5.
1765
- args: z.record(z.unknown()),
1766
- result: z.unknown(),
1744
+ args: z.string(),
1745
+ result: z.string().optional(),
1767
1746
  startedAt: z.string().datetime(),
1768
1747
  durationMs: z.number().int().min(0),
1769
1748
  ok: z.boolean(),
1749
+ // refused by the Action Guard before it ran
1750
+ blocked: z.boolean(),
1770
1751
  errorMessage: z.string().optional()
1771
1752
  });
1772
1753
  var McpInteractionAudit = z.object({
1773
1754
  // One of the four runtime tools — closed set, no growth allowed.
1774
1755
  tool: z.enum(["call_say", "call_send_guidance", "call_inject_context", "call_instruct"]),
1775
- // Args verbatim — see open question O2.
1756
+ // Args with PII masked (burn-down G-6, owner decision: the audit never keeps a raw value).
1776
1757
  args: z.record(z.unknown()),
1777
1758
  ts: z.string().datetime(),
1778
1759
  // Attribution. The API key that drove the orchestrator session.
1779
- apiKeyId: z.string()
1760
+ apiKeyId: z.string(),
1761
+ // 'applied' = the agent confirmed it; 'unknown' = sent, but no confirmation in time (a 504 to the host — it may have
1762
+ // been applied).
1763
+ outcome: z.enum(["applied", "unknown"])
1780
1764
  });
1781
1765
  z.object({
1782
1766
  callId: z.string().uuid(),