@voicelayer/sdk 0.5.1 → 0.6.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.
@@ -476,6 +476,14 @@ declare const ProcessSchemaDTO: z.ZodObject<{
476
476
  * worker (it holds the internal service token) never honours it.
477
477
  */
478
478
  allowPrivateNetwork: z.ZodOptional<z.ZodBoolean>;
479
+ /**
480
+ * Burn-down G-33: the model reads the caller's PII as tokens (`<PII_PHONE_1>`). `true` — this tool's arguments carry
481
+ * the caller's real values instead, when its URL fixes the host (publish refuses it on a host the call fills in).
482
+ * Absent — real values only when it signs in with a connection; otherwise the endpoint gets the tokens. `false` —
483
+ * always the tokens.
484
+ * (packages/sdk/test/tool-detokenise.test.ts)
485
+ */
486
+ sendRealValues: z.ZodOptional<z.ZodBoolean>;
479
487
  }, "strip", z.ZodTypeAny, {
480
488
  name: string;
481
489
  description: string;
@@ -486,6 +494,7 @@ declare const ProcessSchemaDTO: z.ZodObject<{
486
494
  headers?: Record<string, string> | undefined;
487
495
  connectionRef?: string | undefined;
488
496
  allowPrivateNetwork?: boolean | undefined;
497
+ sendRealValues?: boolean | undefined;
489
498
  }, {
490
499
  name: string;
491
500
  description: string;
@@ -496,6 +505,7 @@ declare const ProcessSchemaDTO: z.ZodObject<{
496
505
  headers?: Record<string, string> | undefined;
497
506
  connectionRef?: string | undefined;
498
507
  allowPrivateNetwork?: boolean | undefined;
508
+ sendRealValues?: boolean | undefined;
499
509
  }>, "many">>;
500
510
  displayName: z.ZodOptional<z.ZodString>;
501
511
  speech: z.ZodOptional<z.ZodObject<{
@@ -721,6 +731,7 @@ declare const ProcessSchemaDTO: z.ZodObject<{
721
731
  headers?: Record<string, string> | undefined;
722
732
  connectionRef?: string | undefined;
723
733
  allowPrivateNetwork?: boolean | undefined;
734
+ sendRealValues?: boolean | undefined;
724
735
  }[] | undefined;
725
736
  displayName?: string | undefined;
726
737
  program?: {
@@ -809,6 +820,7 @@ declare const ProcessSchemaDTO: z.ZodObject<{
809
820
  headers?: Record<string, string> | undefined;
810
821
  connectionRef?: string | undefined;
811
822
  allowPrivateNetwork?: boolean | undefined;
823
+ sendRealValues?: boolean | undefined;
812
824
  }[] | undefined;
813
825
  displayName?: string | undefined;
814
826
  program?: {
@@ -990,6 +1002,14 @@ declare const AgentDTO: z.ZodObject<{
990
1002
  * worker (it holds the internal service token) never honours it.
991
1003
  */
992
1004
  allowPrivateNetwork: z.ZodOptional<z.ZodBoolean>;
1005
+ /**
1006
+ * Burn-down G-33: the model reads the caller's PII as tokens (`<PII_PHONE_1>`). `true` — this tool's arguments carry
1007
+ * the caller's real values instead, when its URL fixes the host (publish refuses it on a host the call fills in).
1008
+ * Absent — real values only when it signs in with a connection; otherwise the endpoint gets the tokens. `false` —
1009
+ * always the tokens.
1010
+ * (packages/sdk/test/tool-detokenise.test.ts)
1011
+ */
1012
+ sendRealValues: z.ZodOptional<z.ZodBoolean>;
993
1013
  }, "strip", z.ZodTypeAny, {
994
1014
  name: string;
995
1015
  description: string;
@@ -1000,6 +1020,7 @@ declare const AgentDTO: z.ZodObject<{
1000
1020
  headers?: Record<string, string> | undefined;
1001
1021
  connectionRef?: string | undefined;
1002
1022
  allowPrivateNetwork?: boolean | undefined;
1023
+ sendRealValues?: boolean | undefined;
1003
1024
  }, {
1004
1025
  name: string;
1005
1026
  description: string;
@@ -1010,6 +1031,7 @@ declare const AgentDTO: z.ZodObject<{
1010
1031
  headers?: Record<string, string> | undefined;
1011
1032
  connectionRef?: string | undefined;
1012
1033
  allowPrivateNetwork?: boolean | undefined;
1034
+ sendRealValues?: boolean | undefined;
1013
1035
  }>, "many">>;
1014
1036
  displayName: z.ZodOptional<z.ZodString>;
1015
1037
  speech: z.ZodOptional<z.ZodObject<{
@@ -1235,6 +1257,7 @@ declare const AgentDTO: z.ZodObject<{
1235
1257
  headers?: Record<string, string> | undefined;
1236
1258
  connectionRef?: string | undefined;
1237
1259
  allowPrivateNetwork?: boolean | undefined;
1260
+ sendRealValues?: boolean | undefined;
1238
1261
  }[] | undefined;
1239
1262
  displayName?: string | undefined;
1240
1263
  program?: {
@@ -1323,6 +1346,7 @@ declare const AgentDTO: z.ZodObject<{
1323
1346
  headers?: Record<string, string> | undefined;
1324
1347
  connectionRef?: string | undefined;
1325
1348
  allowPrivateNetwork?: boolean | undefined;
1349
+ sendRealValues?: boolean | undefined;
1326
1350
  }[] | undefined;
1327
1351
  displayName?: string | undefined;
1328
1352
  program?: {
@@ -1433,6 +1457,7 @@ declare const AgentDTO: z.ZodObject<{
1433
1457
  headers?: Record<string, string> | undefined;
1434
1458
  connectionRef?: string | undefined;
1435
1459
  allowPrivateNetwork?: boolean | undefined;
1460
+ sendRealValues?: boolean | undefined;
1436
1461
  }[] | undefined;
1437
1462
  displayName?: string | undefined;
1438
1463
  program?: {
@@ -1541,6 +1566,7 @@ declare const AgentDTO: z.ZodObject<{
1541
1566
  headers?: Record<string, string> | undefined;
1542
1567
  connectionRef?: string | undefined;
1543
1568
  allowPrivateNetwork?: boolean | undefined;
1569
+ sendRealValues?: boolean | undefined;
1544
1570
  }[] | undefined;
1545
1571
  displayName?: string | undefined;
1546
1572
  program?: {
@@ -2154,6 +2180,18 @@ interface AgentEventEmitter {
2154
2180
  emit(event: AgentLifecycleEvent): void;
2155
2181
  }
2156
2182
 
2183
+ /** Where a tool's arguments go — what decides whether it gets the caller's real values or the call's tokens. */
2184
+ interface ToolDestination {
2185
+ /** `code`: the agent's own code, in its own worker. `http`: a request to `host`. */
2186
+ readonly kind: 'code' | 'http';
2187
+ /** The host the request goes to when its URL fixes it; null when a placeholder picks it. Audited; never a value. */
2188
+ readonly host?: string | null;
2189
+ /** It signs in with a vault connection. */
2190
+ readonly connection?: boolean;
2191
+ /** Explicit: true — real values (an HTTP tool: only to a host its URL fixes); false — the tokens, whatever else holds. */
2192
+ readonly sendRealValues?: boolean;
2193
+ }
2194
+
2157
2195
  /** Primitive field types accepted in a process definition. */
2158
2196
  type ProcessFieldType = 'string' | 'string[]' | 'number' | 'boolean' | 'datetime' | 'email' | 'phone';
2159
2197
  interface ProcessField {
@@ -2300,6 +2338,11 @@ interface ConnectorInstance<TName extends string = string, TApi = unknown> {
2300
2338
  readonly api: TApi;
2301
2339
  /** If true, every method on `api` becomes an LLM-callable tool. */
2302
2340
  readonly expose?: boolean;
2341
+ /**
2342
+ * Its exposed tools get the caller's real values in place of the call's PII tokens (`<PII_PHONE_1>`) — a connector
2343
+ * is your code. `false` keeps the tokens. (burn-down G-33 — test/tool-detokenise.test.ts)
2344
+ */
2345
+ readonly sendRealValues?: boolean;
2303
2346
  }
2304
2347
  type ComplianceTag = 'tcpa' | 'hipaa' | 'pci' | 'gdpr' | 'soc2';
2305
2348
  /**
@@ -2525,10 +2568,16 @@ interface EndCallPolicy {
2525
2568
  }
2526
2569
  type ShorthandPrimitive = 'string' | 'number' | 'boolean';
2527
2570
  type ToolInputShape = Record<string, ShorthandPrimitive> | z.ZodTypeAny;
2571
+ /** What the runtime tells a tool about the input it hands it (burn-down G-33). */
2572
+ interface ToolRunInfo {
2573
+ /** The call's PII tokens in the input were swapped for the caller's real values: a request built from it is
2574
+ * sensitive — never let a redirect carry it to another origin (`httpTool` refuses one). */
2575
+ readonly carriesRealValues: boolean;
2576
+ }
2528
2577
  interface ToolDefinition<I = unknown, R = unknown> {
2529
2578
  readonly description: string;
2530
2579
  readonly input: ToolInputShape;
2531
- readonly run: (input: I, ctx: AgentContext) => Promise<R> | R;
2580
+ readonly run: (input: I, ctx: AgentContext, info?: ToolRunInfo) => Promise<R> | R;
2532
2581
  /**
2533
2582
  * Capability this tool requires. Action Guard hard-blocks the call if not
2534
2583
  * declared (PRD §B.5 — "no soft failures, ever"). Defaults to
@@ -2537,6 +2586,19 @@ interface ToolDefinition<I = unknown, R = unknown> {
2537
2586
  * for centralised policy.
2538
2587
  */
2539
2588
  readonly capability?: string;
2589
+ /**
2590
+ * The model reads the caller's PII as tokens (`<PII_PHONE_1>`); the platform swaps them back for the real values in a
2591
+ * tool's arguments right before it runs, only where the destination is trusted (burn-down G-33). A code tool — this
2592
+ * one, run in your worker — gets the real values by default; `false` keeps the tokens. An HTTP tool gets tokens
2593
+ * unless it signs in with a vault connection or is `true` — and `true` counts only when its URL fixes the host.
2594
+ * (test/tool-detokenise.test.ts)
2595
+ */
2596
+ readonly sendRealValues?: boolean;
2597
+ /**
2598
+ * Where the arguments go, for the trust rule above — set by the SDK's own builders (`httpTool`, dashboard registry
2599
+ * tools, a flow's tools). Unset: the tool is your code.
2600
+ */
2601
+ readonly destination?: ToolDestination;
2540
2602
  }
2541
2603
  /**
2542
2604
  * Optional security adapters. The SDK always enforces the local-only synchronous
@@ -2792,6 +2854,8 @@ interface AgentToolSpec {
2792
2854
  readonly name: string;
2793
2855
  readonly description: string;
2794
2856
  readonly input: Record<string, 'string' | 'number' | 'boolean'>;
2857
+ /** Where its arguments go — for the tool boundary's trust rule (burn-down G-33); never shown to the model. */
2858
+ readonly destination?: ToolDestination;
2795
2859
  }
2796
2860
  interface AgentToolCall {
2797
2861
  readonly name: string;
@@ -2895,6 +2959,8 @@ type ToolExecutor = (req: {
2895
2959
  readonly input?: Record<string, unknown>;
2896
2960
  readonly auth?: 'connection';
2897
2961
  readonly connectionRef?: string;
2962
+ /** The input holds the caller's real values (G-33): the executor refuses a redirect to another origin. */
2963
+ readonly carriesRealValues?: boolean;
2898
2964
  }) => Promise<{
2899
2965
  readonly ok: boolean;
2900
2966
  readonly status: number;
@@ -2964,7 +3030,11 @@ type PlaybookResolver = (name: string) => Promise<{
2964
3030
  * the server-side endpoint, so the URL/credential never reach this worker. */
2965
3031
  interface RegistryToolsResolver {
2966
3032
  catalog(): Promise<ReadonlyArray<AgentToolSpec>>;
2967
- run(name: string, args: Record<string, unknown>): Promise<{
3033
+ run(name: string, args: Record<string, unknown>,
3034
+ /** carriesRealValues: the args hold the caller's real values (G-33) — the server refuses a cross-origin redirect. */
3035
+ opts?: {
3036
+ readonly carriesRealValues?: boolean;
3037
+ }): Promise<{
2968
3038
  ok: boolean;
2969
3039
  status: number;
2970
3040
  data: unknown;
@@ -2974,6 +3044,13 @@ interface RegistryToolsResolver {
2974
3044
  * interpreter can run inline. null when the referenced flow isn't found / unpublished
2975
3045
  * (the subflow executor then degrades to a recorded no-op and advances). */
2976
3046
  type FlowResolver = (ref: string) => Promise<FlowProgram | null>;
3047
+ /** The tool boundary's rule for a graph tool step's inputs (G-33, #18): `params` as `destination` may receive them, and
3048
+ * whether they carry the caller's real values (the request then refuses a redirect to another origin). */
3049
+ type ToolInputsPolicy = (params: Record<string, unknown>, destination: ToolDestination) => {
3050
+ readonly params: Record<string, unknown>;
3051
+ readonly carriesRealValues: boolean;
3052
+ readonly trusted: boolean;
3053
+ };
2977
3054
  /** Side-effect surface injected once by runFlowProgram. Every member is optional;
2978
3055
  * a missing resolver makes its executor degrade to a recorded no-op (never throws,
2979
3056
  * never blocks the call). Kept off AgentContext so the contract stays small and
@@ -2994,6 +3071,12 @@ interface GraphResolvers {
2994
3071
  readonly agentRunner?: AgentRunner;
2995
3072
  /** Name-referenced project tool registry (catalog + server-side execute). */
2996
3073
  readonly registryTools?: RegistryToolsResolver;
3074
+ /** The tool boundary's rule for a graph tool step's inputs where the run has no SecurityPrimitive of its own (a flow
3075
+ * over text in the API — one destination, one treatment, on every surface: #18). A call's own guard wins. */
3076
+ readonly toolInputs?: ToolInputsPolicy;
3077
+ /** What the caller said, fed by the text driver on every caller message — the boundary tokenises for an untrusted
3078
+ * tool only values the caller said (`SecurityPrimitive.noteCallerText`, G-33 final review). */
3079
+ readonly noteCallerText?: (text: string) => void;
2997
3080
  }
2998
3081
 
2999
3082
  /**
@@ -3161,4 +3244,4 @@ type RunLiveTextOptions = Omit<RunTextSessionOptions, 'onAgentText' | 'onAwaitIn
3161
3244
  * interpreter blocks for the next message, or the flow ends. */
3162
3245
  declare function runLiveTextConversation(opts: RunLiveTextOptions): LiveTextConversation;
3163
3246
 
3164
- export { NON_BUSY_STATES as $, AgentEnvironment as A, type DtmfHandler as B, type ConnectorInstance as C, type DtmfEvent as D, type EndCallControllerHandle as E, type EndCallInfo as F, type EndCallOutcome as G, type HandoffConfig as H, type EndCallPolicy as I, type EndCallTrigger as J, type EndpointingConfig as K, type LLMProvider as L, type ModelConfig as M, type FakeSessionAdapter as N, type FloorControlConfig as O, ProcessSchemaDTO as P, type InboundOptions as Q, type ReadinessProbe as R, type STTProvider as S, type TTSProvider as T, type InferProcessData as U, type VADProvider as V, type InterruptionConfig as W, LK_AGENT_STATE_MAP as X, type MemoryHandle as Y, type MemoryScope as Z, type MetricsEvent as _, type AgentLifecycleEvent as a, urlProbe as a$, type Participant as a0, ParticipantId as a1, type ParticipantKind as a2, type ParticipantSet as a3, type ParticipantsConfig as a4, type ProcessBackendAck as a5, type ProcessFieldType as a6, type ProcessSnapshot as a7, type ReadinessReport as a8, type ReadinessResult as a9, type TriggerAction as aA, type TriggerCondition as aB, type TtsVoiceConfig as aC, type TurnEvent as aD, type Unsubscribe as aE, type UserInputEvent as aF, type UserStateEvent as aG, type UserTurn as aH, VoiceLayerAuthError as aI, VoiceLayerError as aJ, VoiceLayerHttpError as aK, VoiceLayerNetworkError as aL, VoiceLayerValidationError as aM, applySpeechTurnHandling as aN, asyncProbe as aO, defineProcess as aP, dtmfCodeToDigit as aQ, dtmfDigitToCode as aR, duck as aS, envProbe as aT, mute as aU, normalizeState as aV, passthrough as aW, runProbes as aX, runTextSession as aY, runTextTranscript as aZ, transform as a_, type RespondOptions as aa, type Room as ab, type RouteEntry as ac, type RoutingRule as ad, type RoutingSnapshot as ae, type RunTextSessionOptions as af, type RunTextTranscriptOptions as ag, type SayOptions as ah, type SecurityConfig as ai, type SendDtmfOptions as aj, type SessionAdapter as ak, type SessionCapabilities as al, type SessionErrorEvent as am, type SessionEvent as an, type SessionEventMap as ao, type SessionFactory as ap, type SessionFactoryInput as aq, type SessionOutbound as ar, type SessionState as as, type ShorthandPrimitive as at, type SpeechResult as au, type SpeechTarget as av, type StateChangeEvent as aw, type TextSession as ax, type TextTranscriptResult as ay, type ToolInputShape as az, AgentDTO as b, type EmailResolver as b0, type FlowResolver as b1, type GraphResolvers as b2, type GraphTraceEvent as b3, type KnowledgeResolver as b4, type LiveTextConversation as b5, type LiveTurnResult as b6, type PlaybookLibraryEntry as b7, type PlaybookResolver as b8, type RegistryToolsResolver as b9, type RunLiveTextOptions as ba, dedupeConversationEmails as bb, denyPrivateNetwork as bc, privateNetworkOptInHonoured as bd, runLiveTextConversation as be, runWithOpenAIScope as bf, toPlaybookResolution as bg, type AgentEventEmitter as c, type AgentContext as d, type AgentConfig as e, type ProcessField as f, type ProviderFactory as g, type RealtimeProvider as h, type TurnDetectorProvider as i, type ProcessDefinition as j, type TriggerDefinition as k, type MemoryConfig as l, type ToolDefinition as m, type SpeechConfig as n, type ToolExecutor as o, type HostLookup as p, type AgentEventListener as q, type AgentTurnEvent as r, type AudioProfile as s, type AudioSurface as t, type CallInfo as u, type CallOutcomeSummary as v, type ChannelKind as w, type CompletionStrategy as x, type ComplianceTag as y, ConsultationPolicy as z };
3247
+ export { type MetricsEvent as $, AgentEnvironment as A, ConsultationPolicy as B, type ConnectorInstance as C, type DtmfEvent as D, type DtmfHandler as E, type EndCallControllerHandle as F, type EndCallInfo as G, type HandoffConfig as H, type EndCallOutcome as I, type EndCallPolicy as J, type EndCallTrigger as K, type LLMProvider as L, type ModelConfig as M, type EndpointingConfig as N, type FakeSessionAdapter as O, ProcessSchemaDTO as P, type FloorControlConfig as Q, type ReadinessProbe as R, type STTProvider as S, type ToolDefinition as T, type InboundOptions as U, type VADProvider as V, type InferProcessData as W, type InterruptionConfig as X, LK_AGENT_STATE_MAP as Y, type MemoryHandle as Z, type MemoryScope as _, type AgentLifecycleEvent as a, transform as a$, NON_BUSY_STATES as a0, type Participant as a1, ParticipantId as a2, type ParticipantKind as a3, type ParticipantSet as a4, type ParticipantsConfig as a5, type ProcessBackendAck as a6, type ProcessFieldType as a7, type ProcessSnapshot as a8, type ReadinessReport as a9, type ToolInputShape as aA, type TriggerAction as aB, type TriggerCondition as aC, type TtsVoiceConfig as aD, type TurnEvent as aE, type Unsubscribe as aF, type UserInputEvent as aG, type UserStateEvent as aH, type UserTurn as aI, VoiceLayerAuthError as aJ, VoiceLayerError as aK, VoiceLayerHttpError as aL, VoiceLayerNetworkError as aM, VoiceLayerValidationError as aN, applySpeechTurnHandling as aO, asyncProbe as aP, defineProcess as aQ, dtmfCodeToDigit as aR, dtmfDigitToCode as aS, duck as aT, envProbe as aU, mute as aV, normalizeState as aW, passthrough as aX, runProbes as aY, runTextSession as aZ, runTextTranscript as a_, type ReadinessResult as aa, type RespondOptions as ab, type Room as ac, type RouteEntry as ad, type RoutingRule as ae, type RoutingSnapshot as af, type RunTextSessionOptions as ag, type RunTextTranscriptOptions as ah, type SayOptions as ai, type SecurityConfig as aj, type SendDtmfOptions as ak, type SessionAdapter as al, type SessionCapabilities as am, type SessionErrorEvent as an, type SessionEvent as ao, type SessionEventMap as ap, type SessionFactory as aq, type SessionFactoryInput as ar, type SessionOutbound as as, type SessionState as at, type ShorthandPrimitive as au, type SpeechResult as av, type SpeechTarget as aw, type StateChangeEvent as ax, type TextSession as ay, type TextTranscriptResult as az, AgentDTO as b, urlProbe as b0, type EmailResolver as b1, type FlowResolver as b2, type GraphResolvers as b3, type GraphTraceEvent as b4, type KnowledgeResolver as b5, type LiveTextConversation as b6, type LiveTurnResult as b7, type PlaybookLibraryEntry as b8, type PlaybookResolver as b9, type RegistryToolsResolver as ba, type RunLiveTextOptions as bb, dedupeConversationEmails as bc, denyPrivateNetwork as bd, privateNetworkOptInHonoured as be, runLiveTextConversation as bf, runWithOpenAIScope as bg, toPlaybookResolution as bh, type AgentEventEmitter as c, type AgentConfig as d, type ProcessField as e, type ProviderFactory as f, type TTSProvider as g, type RealtimeProvider as h, type TurnDetectorProvider as i, type ProcessDefinition as j, type TriggerDefinition as k, type MemoryConfig as l, type SpeechConfig as m, type ToolExecutor as n, type AgentContext as o, type ToolRunInfo as p, type HostLookup as q, type AgentEventListener as r, type AgentTurnEvent as s, type AudioProfile as t, type AudioSurface as u, type CallInfo as v, type CallOutcomeSummary as w, type ChannelKind as x, type CompletionStrategy as y, type ComplianceTag as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voicelayer/sdk",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "Official SDK for VoiceLayer — define, run, and orchestrate voice AI agents on the VoiceLayer control plane.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "VoiceLayer",
@@ -78,17 +78,21 @@
78
78
  "tsup": "^8.5.1",
79
79
  "typescript": "^5.6.0",
80
80
  "vitest": "^4.1.5",
81
- "@voicelayer/llm-client": "0.1.0",
82
81
  "@voicelayer/contracts": "0.1.0",
82
+ "@voicelayer/llm-client": "0.1.0",
83
83
  "@voicelayer/observability": "0.1.0",
84
84
  "@voicelayer/primitive-audio-experience": "0.1.0",
85
85
  "@voicelayer/primitive-audio-routing": "0.1.0",
86
- "@voicelayer/primitive-process-schema": "0.1.0",
87
- "@voicelayer/primitive-security": "0.1.0",
86
+ "@voicelayer/agents-plugin-assemblyai": "1.0.1",
87
+ "@voicelayer/agents-plugin-cartesia": "1.0.1",
88
88
  "@voicelayer/agents-plugin-deepgram": "1.0.1",
89
- "@voicelayer/agents-plugin-openai": "1.0.1",
89
+ "@voicelayer/agents-plugin-elevenlabs": "1.0.1",
90
+ "@voicelayer/agents-plugin-google": "1.0.1",
91
+ "@voicelayer/primitive-security": "0.1.0",
90
92
  "@voicelayer/agents-plugin-livekit": "1.0.1",
91
- "@voicelayer/agents-plugin-silero": "1.0.1"
93
+ "@voicelayer/agents-plugin-silero": "1.0.1",
94
+ "@voicelayer/primitive-process-schema": "0.1.0",
95
+ "@voicelayer/agents-plugin-openai": "1.0.1"
92
96
  },
93
97
  "scripts": {
94
98
  "typecheck": "tsc -b --pretty false",