@craftedxp/sdk-node 0.17.0 → 0.19.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/README.md CHANGED
@@ -283,7 +283,9 @@ for await (const call of client.calls.listAll({ agentId })) {
283
283
 
284
284
  ## Changelog
285
285
 
286
+ - **0.19.0** — type-only: `CallTokenMintResult.transport` widened to `'ws' | 'webrtc' | 'livekit'` (server returns `'livekit'` when the platform media edge is LiveKit Cloud; client SDKs that don't know it fall back to `'ws'`); `CallRecord.transport` added. No runtime change; drop-in for 0.18.0 consumers.
286
287
  - **Unreleased** _(forward-looking)_ — `isPersonal?: boolean` on `Agent` and `AgentCreateInput` (and so on `AgentUpdateInput`). Assistant-only: when `true`, the learning tools (`remember_fact`, `add_correction`, `add_skill_hint`) are live on every `ct_`-token call rather than only on `mode=learning`. Server-side field — no runtime change in this package.
288
+ - **Unreleased** _(forward-looking)_ — Per-call `agentSpeaksFirst` override on `callTokens.mint` (0.18.0, publish pending; server support 2026-09-02).
287
289
  - **0.17.0** — `channel` on `CallTokenMintInput` / `CallTokenMintResult` / `CallRecord` widened to include `'multimodal'` (typed turns + live audio in one WS session). Type-only plumbing in this package — accepted at mint (assistant-only, same gate as `'text'`) and threaded through; the server's handler semantics for it shipped 2026-09-01 (phase 2/3); `chatsFor(token)` (HTTP+SSE) always rejects a `'multimodal'` token. No runtime change in this package.
288
290
  - **0.16.0** — `debug?: boolean` on `CallTokenMintInput`. Operator-gated (Firebase-admin or `sk_`-key mints only — silently stripped otherwise); when set, the call streams diagnostic frames (`tool_call` / `tool_result` / `phase_marker` / `prefetch*`) to the client. Request-only field — the mint response does not echo it back (see `docs/openapi.yaml`). No client-side behavior change; the HTTP layer already posts `body: input` verbatim, so this is a type-only addition.
289
291
  - **0.15.0** — `client.speech` namespace (`synthesize` / `enqueue` / `get` / `list` / `delete`) for pre-generated agent audio (`POST /v1/speech`), plus `speech.ready` / `speech.failed` webhook event types and the `accepted` error code (`synthesize` → 202 handoff). Requires server ≥ the 2026-08 speech release.
package/dist/index.d.mts CHANGED
@@ -249,6 +249,13 @@ interface CatalogListInput {
249
249
  userTags?: string[];
250
250
  }
251
251
  type CallStatus = 'queued' | 'ringing' | 'in_progress' | 'completed' | 'failed' | 'no_answer';
252
+ /**
253
+ * Media path a call was carried over. Shared by {@link CallRecord.transport}
254
+ * (what actually served the call) and {@link CallTokenMintResult.transport}
255
+ * (what the server tells the client to use). `'livekit'` was added in 0.19.0
256
+ * (phase 35 media edge).
257
+ */
258
+ type CallTransport = 'ws' | 'webrtc' | 'livekit';
252
259
  type EndReason = 'caller_hung_up' | 'agent_ended' | 'max_duration' | 'silence_timeout' | 'error';
253
260
  interface TranscriptTurn {
254
261
  role: 'user' | 'assistant';
@@ -286,6 +293,8 @@ interface CallRecord {
286
293
  endedAt?: number;
287
294
  durationSeconds?: number;
288
295
  endReason?: EndReason;
296
+ /** Media path that served the call (phase 35): 'livekit' = LiveKit tracks + WS control; 'webrtc' = the Cloud Run-hosted WebRTC route; 'ws' = plain WebSocket audio (also what gateway-proxied WebRTC calls record). Absent on telephony calls and records created before 2026-09-05. */
297
+ transport?: CallTransport;
289
298
  transcript?: TranscriptTurn[];
290
299
  summary?: string;
291
300
  structuredData?: Record<string, unknown>;
@@ -397,6 +406,22 @@ interface CallTokenMintInput {
397
406
  * default user-initiated connect. See docs/sdks.md "Agent-initiated calls".
398
407
  */
399
408
  initiatedBy?: 'user' | 'agent';
409
+ /**
410
+ * Per-call override of the agent's `agentSpeaksFirst`. `false` opens the
411
+ * call silently — the caller speaks first (a look-to-wake desk device, a
412
+ * "tap to talk" surface). `true` forces the agent's greeting turn even on
413
+ * an agent configured silent (an alarm the device dialled on the user's
414
+ * behalf, briefed via `context`). Omit to use the agent's own setting.
415
+ * Assistant agents only; room/transcribe agents are always silent and the
416
+ * field is accepted but ignored. The `context` briefing shapes the
417
+ * greeting only when the agent has no pre-rendered `opening`; an agent
418
+ * with `opening.enabled` plays its static opening line. With `false`, the
419
+ * platform also suppresses its idle "are you still there?" nudge until
420
+ * the caller's first turn; a caller who never speaks is simply timed out
421
+ * in silence.
422
+ * Server support: 2026-09-02.
423
+ */
424
+ agentSpeaksFirst?: boolean;
400
425
  /**
401
426
  * Session channel selector. `voice` (default) routes to WS/WebRTC audio;
402
427
  * `text` routes to HTTP+SSE chat via the `chats` resource (or the same WS
@@ -433,8 +458,14 @@ interface CallTokenMintResult {
433
458
  * SDK's `fetchToken` (rich return form) so it can dispatch correctly
434
459
  * without a second round-trip. Always present in the response;
435
460
  * defaults to `'ws'` for legacy agent docs missing the field.
461
+ *
462
+ * `'livekit'` (0.19.0, phase 35): the server's media edge is LiveKit
463
+ * Cloud — a client SDK that supports it joins a per-call LiveKit room
464
+ * for audio while control frames stay on the call WebSocket; client SDKs
465
+ * that don't recognise it fall back to `'ws'`. `webrtcGatewayBase` is
466
+ * only present for `'webrtc'`.
436
467
  */
437
- transport?: 'ws' | 'webrtc';
468
+ transport?: CallTransport;
438
469
  /**
439
470
  * Signaling gateway base URL when `transport === 'webrtc'` AND the
440
471
  * server has `WEBRTC_GATEWAY_BASE` configured. Forward alongside
@@ -1017,4 +1048,4 @@ declare class PlatformError extends Error {
1017
1048
 
1018
1049
  declare const verifyWebhookSignature: (rawBody: Buffer | string, signatureHeader: string, secret: string) => boolean;
1019
1050
 
1020
- export { type Agent, type AgentCreateInput, type AgentEndpointing, type AgentHttpTool, type AgentModel, type AgentRecording, type AgentTool, type AgentTranscriber, type AgentType, type AgentUpdateInput, type AgentVoice, type AgentWebhooksResource, type AgentsResource, type AnalysisWire, type ApiErrorCode, type BuildJoinUrlOptions, type CallListFilters, type CallRecord, type CallRecordingUrlResponse, type CallStatus, type CallSummary, type CallTokenMintInput, type CallTokenMintResult, type CallTokenSummary, type CallTokensResource, type CallsResource, type CatalogAgent, type CatalogListInput, type Chat, type ChatEvent, type ChatsResource, type CostBreakdown, type CreateRoomInput, type CreateRoomResponse, type CreateSpaceInput, type CreditsResource, type EndReason, type EndpointingMode, type GuestRole, type JoinUrlStyle, type KnowledgeBase, type KnowledgeBaseFile, type KnowledgeBasesResource, type LedgerEntry, type ListAnalysisResponse, type ListRoomsResponse, type ListSpacesResponse, type ListUtterancesResponse, type LlmProvider, type MeResource, type MeResponse, type OrgsResource, PlatformClient, type PlatformClientOptions, PlatformError, type PlatformEventName, type RecordingConfig, type RecordingMeta, type RecordingMode, type RoomDoc, type RoomEndReason, type RoomEventAck, type RoomListFilters, type RoomMetricsWire, type RoomStatus, type RoomTranscriptOptions, type RoomsResource, type SpaceKind, type SpacePatch, type SpaceView, type SpacesResource, type SpeechAsset, type SpeechFailedEvent, type SpeechJob, type SpeechListInput, type SpeechReadyEvent, type SpeechResource, type SpeechSynthesizeInput, type StartChatInput, type SttProvider, type TranscriptTurn, type TtsProvider, type UtteranceWire, type WebhookConfig, type WebhookCreateInput, type WebhookDelivery, type WebhookUpdateInput, type WebhooksResource, type WorkerStatus, buildJoinUrl, verifyWebhookSignature };
1051
+ export { type Agent, type AgentCreateInput, type AgentEndpointing, type AgentHttpTool, type AgentModel, type AgentRecording, type AgentTool, type AgentTranscriber, type AgentType, type AgentUpdateInput, type AgentVoice, type AgentWebhooksResource, type AgentsResource, type AnalysisWire, type ApiErrorCode, type BuildJoinUrlOptions, type CallListFilters, type CallRecord, type CallRecordingUrlResponse, type CallStatus, type CallSummary, type CallTokenMintInput, type CallTokenMintResult, type CallTokenSummary, type CallTokensResource, type CallTransport, type CallsResource, type CatalogAgent, type CatalogListInput, type Chat, type ChatEvent, type ChatsResource, type CostBreakdown, type CreateRoomInput, type CreateRoomResponse, type CreateSpaceInput, type CreditsResource, type EndReason, type EndpointingMode, type GuestRole, type JoinUrlStyle, type KnowledgeBase, type KnowledgeBaseFile, type KnowledgeBasesResource, type LedgerEntry, type ListAnalysisResponse, type ListRoomsResponse, type ListSpacesResponse, type ListUtterancesResponse, type LlmProvider, type MeResource, type MeResponse, type OrgsResource, PlatformClient, type PlatformClientOptions, PlatformError, type PlatformEventName, type RecordingConfig, type RecordingMeta, type RecordingMode, type RoomDoc, type RoomEndReason, type RoomEventAck, type RoomListFilters, type RoomMetricsWire, type RoomStatus, type RoomTranscriptOptions, type RoomsResource, type SpaceKind, type SpacePatch, type SpaceView, type SpacesResource, type SpeechAsset, type SpeechFailedEvent, type SpeechJob, type SpeechListInput, type SpeechReadyEvent, type SpeechResource, type SpeechSynthesizeInput, type StartChatInput, type SttProvider, type TranscriptTurn, type TtsProvider, type UtteranceWire, type WebhookConfig, type WebhookCreateInput, type WebhookDelivery, type WebhookUpdateInput, type WebhooksResource, type WorkerStatus, buildJoinUrl, verifyWebhookSignature };
package/dist/index.d.ts CHANGED
@@ -249,6 +249,13 @@ interface CatalogListInput {
249
249
  userTags?: string[];
250
250
  }
251
251
  type CallStatus = 'queued' | 'ringing' | 'in_progress' | 'completed' | 'failed' | 'no_answer';
252
+ /**
253
+ * Media path a call was carried over. Shared by {@link CallRecord.transport}
254
+ * (what actually served the call) and {@link CallTokenMintResult.transport}
255
+ * (what the server tells the client to use). `'livekit'` was added in 0.19.0
256
+ * (phase 35 media edge).
257
+ */
258
+ type CallTransport = 'ws' | 'webrtc' | 'livekit';
252
259
  type EndReason = 'caller_hung_up' | 'agent_ended' | 'max_duration' | 'silence_timeout' | 'error';
253
260
  interface TranscriptTurn {
254
261
  role: 'user' | 'assistant';
@@ -286,6 +293,8 @@ interface CallRecord {
286
293
  endedAt?: number;
287
294
  durationSeconds?: number;
288
295
  endReason?: EndReason;
296
+ /** Media path that served the call (phase 35): 'livekit' = LiveKit tracks + WS control; 'webrtc' = the Cloud Run-hosted WebRTC route; 'ws' = plain WebSocket audio (also what gateway-proxied WebRTC calls record). Absent on telephony calls and records created before 2026-09-05. */
297
+ transport?: CallTransport;
289
298
  transcript?: TranscriptTurn[];
290
299
  summary?: string;
291
300
  structuredData?: Record<string, unknown>;
@@ -397,6 +406,22 @@ interface CallTokenMintInput {
397
406
  * default user-initiated connect. See docs/sdks.md "Agent-initiated calls".
398
407
  */
399
408
  initiatedBy?: 'user' | 'agent';
409
+ /**
410
+ * Per-call override of the agent's `agentSpeaksFirst`. `false` opens the
411
+ * call silently — the caller speaks first (a look-to-wake desk device, a
412
+ * "tap to talk" surface). `true` forces the agent's greeting turn even on
413
+ * an agent configured silent (an alarm the device dialled on the user's
414
+ * behalf, briefed via `context`). Omit to use the agent's own setting.
415
+ * Assistant agents only; room/transcribe agents are always silent and the
416
+ * field is accepted but ignored. The `context` briefing shapes the
417
+ * greeting only when the agent has no pre-rendered `opening`; an agent
418
+ * with `opening.enabled` plays its static opening line. With `false`, the
419
+ * platform also suppresses its idle "are you still there?" nudge until
420
+ * the caller's first turn; a caller who never speaks is simply timed out
421
+ * in silence.
422
+ * Server support: 2026-09-02.
423
+ */
424
+ agentSpeaksFirst?: boolean;
400
425
  /**
401
426
  * Session channel selector. `voice` (default) routes to WS/WebRTC audio;
402
427
  * `text` routes to HTTP+SSE chat via the `chats` resource (or the same WS
@@ -433,8 +458,14 @@ interface CallTokenMintResult {
433
458
  * SDK's `fetchToken` (rich return form) so it can dispatch correctly
434
459
  * without a second round-trip. Always present in the response;
435
460
  * defaults to `'ws'` for legacy agent docs missing the field.
461
+ *
462
+ * `'livekit'` (0.19.0, phase 35): the server's media edge is LiveKit
463
+ * Cloud — a client SDK that supports it joins a per-call LiveKit room
464
+ * for audio while control frames stay on the call WebSocket; client SDKs
465
+ * that don't recognise it fall back to `'ws'`. `webrtcGatewayBase` is
466
+ * only present for `'webrtc'`.
436
467
  */
437
- transport?: 'ws' | 'webrtc';
468
+ transport?: CallTransport;
438
469
  /**
439
470
  * Signaling gateway base URL when `transport === 'webrtc'` AND the
440
471
  * server has `WEBRTC_GATEWAY_BASE` configured. Forward alongside
@@ -1017,4 +1048,4 @@ declare class PlatformError extends Error {
1017
1048
 
1018
1049
  declare const verifyWebhookSignature: (rawBody: Buffer | string, signatureHeader: string, secret: string) => boolean;
1019
1050
 
1020
- export { type Agent, type AgentCreateInput, type AgentEndpointing, type AgentHttpTool, type AgentModel, type AgentRecording, type AgentTool, type AgentTranscriber, type AgentType, type AgentUpdateInput, type AgentVoice, type AgentWebhooksResource, type AgentsResource, type AnalysisWire, type ApiErrorCode, type BuildJoinUrlOptions, type CallListFilters, type CallRecord, type CallRecordingUrlResponse, type CallStatus, type CallSummary, type CallTokenMintInput, type CallTokenMintResult, type CallTokenSummary, type CallTokensResource, type CallsResource, type CatalogAgent, type CatalogListInput, type Chat, type ChatEvent, type ChatsResource, type CostBreakdown, type CreateRoomInput, type CreateRoomResponse, type CreateSpaceInput, type CreditsResource, type EndReason, type EndpointingMode, type GuestRole, type JoinUrlStyle, type KnowledgeBase, type KnowledgeBaseFile, type KnowledgeBasesResource, type LedgerEntry, type ListAnalysisResponse, type ListRoomsResponse, type ListSpacesResponse, type ListUtterancesResponse, type LlmProvider, type MeResource, type MeResponse, type OrgsResource, PlatformClient, type PlatformClientOptions, PlatformError, type PlatformEventName, type RecordingConfig, type RecordingMeta, type RecordingMode, type RoomDoc, type RoomEndReason, type RoomEventAck, type RoomListFilters, type RoomMetricsWire, type RoomStatus, type RoomTranscriptOptions, type RoomsResource, type SpaceKind, type SpacePatch, type SpaceView, type SpacesResource, type SpeechAsset, type SpeechFailedEvent, type SpeechJob, type SpeechListInput, type SpeechReadyEvent, type SpeechResource, type SpeechSynthesizeInput, type StartChatInput, type SttProvider, type TranscriptTurn, type TtsProvider, type UtteranceWire, type WebhookConfig, type WebhookCreateInput, type WebhookDelivery, type WebhookUpdateInput, type WebhooksResource, type WorkerStatus, buildJoinUrl, verifyWebhookSignature };
1051
+ export { type Agent, type AgentCreateInput, type AgentEndpointing, type AgentHttpTool, type AgentModel, type AgentRecording, type AgentTool, type AgentTranscriber, type AgentType, type AgentUpdateInput, type AgentVoice, type AgentWebhooksResource, type AgentsResource, type AnalysisWire, type ApiErrorCode, type BuildJoinUrlOptions, type CallListFilters, type CallRecord, type CallRecordingUrlResponse, type CallStatus, type CallSummary, type CallTokenMintInput, type CallTokenMintResult, type CallTokenSummary, type CallTokensResource, type CallTransport, type CallsResource, type CatalogAgent, type CatalogListInput, type Chat, type ChatEvent, type ChatsResource, type CostBreakdown, type CreateRoomInput, type CreateRoomResponse, type CreateSpaceInput, type CreditsResource, type EndReason, type EndpointingMode, type GuestRole, type JoinUrlStyle, type KnowledgeBase, type KnowledgeBaseFile, type KnowledgeBasesResource, type LedgerEntry, type ListAnalysisResponse, type ListRoomsResponse, type ListSpacesResponse, type ListUtterancesResponse, type LlmProvider, type MeResource, type MeResponse, type OrgsResource, PlatformClient, type PlatformClientOptions, PlatformError, type PlatformEventName, type RecordingConfig, type RecordingMeta, type RecordingMode, type RoomDoc, type RoomEndReason, type RoomEventAck, type RoomListFilters, type RoomMetricsWire, type RoomStatus, type RoomTranscriptOptions, type RoomsResource, type SpaceKind, type SpacePatch, type SpaceView, type SpacesResource, type SpeechAsset, type SpeechFailedEvent, type SpeechJob, type SpeechListInput, type SpeechReadyEvent, type SpeechResource, type SpeechSynthesizeInput, type StartChatInput, type SttProvider, type TranscriptTurn, type TtsProvider, type UtteranceWire, type WebhookConfig, type WebhookCreateInput, type WebhookDelivery, type WebhookUpdateInput, type WebhooksResource, type WorkerStatus, buildJoinUrl, verifyWebhookSignature };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@craftedxp/sdk-node",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "Node.js / TypeScript SDK for the voice agent platform. Server-side API client — mint call tokens, manage agents, query calls, upload knowledge-base docs.",
5
5
  "author": "Crafted XP",
6
6
  "license": "MIT",