@jambonz/sdk 0.3.2 → 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.
@@ -1,4 +1,4 @@
1
- import { y as Verb, S as SayVerb, p as PlayVerb, G as GatherVerb, n as LlmVerb, I as S2sVerb, K as LlmBaseOptions, N as DialogflowVerb, c as AgentVerb, m as ListenVerb, u as StreamVerb, x as TranscribeVerb, j as DialVerb, C as ConferenceVerb, E as EnqueueVerb, D as DequeueVerb, H as HangupVerb, q as RedirectVerb, P as PauseVerb, L as LeaveVerb, r as SipDeclineVerb, t as SipRequestVerb, s as SipReferVerb, i as ConfigVerb, g as AnswerVerb, d as AlertVerb, T as TagVerb, k as DtmfVerb, l as DubVerb, o as MessageVerb } from './verbs-DKy6nGIH.cjs';
1
+ import { Q as Verb, S as SayVerb, v as PlayVerb, G as GatherVerb, t as LlmVerb, W as S2sVerb, X as LlmBaseOptions, Y as DialogflowVerb, e as AgentVerb, o as ListenVerb, I as StreamVerb, O as TranscribeVerb, l as DialVerb, C as ConferenceVerb, E as EnqueueVerb, D as DequeueVerb, H as HangupVerb, w as RedirectVerb, P as PauseVerb, L as LeaveVerb, x as SipDeclineVerb, z as SipRequestVerb, y as SipReferVerb, k as ConfigVerb, i as AnswerVerb, f as AlertVerb, T as TagVerb, m as DtmfVerb, n as DubVerb, u as MessageVerb } from './verbs-mXzecf0-.cjs';
2
2
 
3
3
  /**
4
4
  * Schema-based validation using AJV.
@@ -340,6 +340,60 @@ interface McpServerConfig {
340
340
  auth?: Record<string, unknown>;
341
341
  roots?: Record<string, unknown>[];
342
342
  }
343
+ /** A conversation-history message passed via `llmOptions.messages`. */
344
+ interface LlmMessage {
345
+ role: 'system' | 'user' | 'assistant' | 'tool';
346
+ content: string | unknown;
347
+ [key: string]: unknown;
348
+ }
349
+ /** Tool / function definition (MCP-flat canonical shape). */
350
+ interface LlmTool {
351
+ name: string;
352
+ description?: string;
353
+ parameters?: Record<string, unknown>;
354
+ }
355
+ /** OpenAI-wrapped tool shape — also accepted for back-compat. */
356
+ interface LlmToolOpenAIWrapped {
357
+ type: 'function';
358
+ function: LlmTool;
359
+ }
360
+ /** Canonical tool-output payload carried by `llm:tool-output` commands. */
361
+ interface LlmToolOutputData {
362
+ result?: unknown;
363
+ [key: string]: unknown;
364
+ }
365
+ /** Per-call LLM configuration for the agent verb. */
366
+ interface AgentLlmOptions {
367
+ /** System prompt. Placed vendor-appropriately by the feature-server wrapper. */
368
+ systemPrompt?: string;
369
+ /** Seed conversation history. A role:'system' entry is extracted into systemPrompt. */
370
+ messages?: LlmMessage[];
371
+ /** Alias of `messages` (historical). */
372
+ initialMessages?: LlmMessage[];
373
+ /** Maximum tokens the model may generate per turn. */
374
+ maxTokens?: number;
375
+ /** Sampling temperature. */
376
+ temperature?: number;
377
+ /** Tools / functions the model may call. */
378
+ tools?: (LlmTool | LlmToolOpenAIWrapped)[];
379
+ }
380
+ /** `llm` block on the agent verb. */
381
+ interface AgentLlm {
382
+ vendor: 'openai' | 'anthropic' | 'google' | 'vertex-gemini' | 'vertex-openai' | 'bedrock' | 'deepseek';
383
+ model: string;
384
+ label?: string;
385
+ auth?: {
386
+ apiKey?: string;
387
+ [key: string]: unknown;
388
+ };
389
+ connectOptions?: {
390
+ timeout?: number;
391
+ maxRetries?: number;
392
+ endpoint?: string;
393
+ baseURL?: string;
394
+ };
395
+ llmOptions?: AgentLlmOptions;
396
+ }
343
397
  /** Shared properties for llm, s2s, and vendor-specific s2s verbs. */
344
398
  interface LlmBaseOptions {
345
399
  id?: string;
@@ -457,7 +511,7 @@ interface AgentVerb {
457
511
  sticky?: boolean;
458
512
  };
459
513
  /** LLM configuration. */
460
- llm: Record<string, unknown>;
514
+ llm: AgentLlm;
461
515
  /** Webhook when agent ends. */
462
516
  actionHook?: ActionHook;
463
517
  /** Webhook for agent events. */
@@ -888,4 +942,4 @@ type JambonzApp = Verb[];
888
942
  /** All valid verb names. */
889
943
  type VerbName = Verb['verb'];
890
944
 
891
- export type { ActionHook as A, BidirectionalAudio as B, ConferenceVerb as C, DequeueVerb as D, EnqueueVerb as E, FillerNoise as F, GatherVerb as G, HangupVerb as H, S2sVerb as I, JambonzApp as J, LlmBaseOptions as K, LeaveVerb as L, McpServerConfig as M, DialogflowVerb as N, PauseVerb as P, Recognizer as R, SayVerb as S, TagVerb as T, Vad as V, ActionHookDelayAction as a, ActionHookObject as b, AgentVerb as c, AlertVerb as d, Amd as e, AmdTimers as f, AnswerVerb as g, Auth as h, ConfigVerb as i, DialVerb as j, DtmfVerb as k, DubVerb as l, ListenVerb as m, LlmVerb as n, MessageVerb as o, PlayVerb as p, RedirectVerb as q, SipDeclineVerb as r, SipReferVerb as s, SipRequestVerb as t, StreamVerb as u, Synthesizer as v, Target as w, TranscribeVerb as x, Verb as y, VerbName as z };
945
+ export type { ActionHook as A, BidirectionalAudio as B, ConferenceVerb as C, DequeueVerb as D, EnqueueVerb as E, FillerNoise as F, GatherVerb as G, HangupVerb as H, StreamVerb as I, JambonzApp as J, Synthesizer as K, LeaveVerb as L, McpServerConfig as M, Target as N, TranscribeVerb as O, PauseVerb as P, Verb as Q, Recognizer as R, SayVerb as S, TagVerb as T, VerbName as U, Vad as V, S2sVerb as W, LlmBaseOptions as X, DialogflowVerb as Y, ActionHookDelayAction as a, ActionHookObject as b, AgentLlm as c, AgentLlmOptions as d, AgentVerb as e, AlertVerb as f, Amd as g, AmdTimers as h, AnswerVerb as i, Auth as j, ConfigVerb as k, DialVerb as l, DtmfVerb as m, DubVerb as n, ListenVerb as o, LlmMessage as p, LlmTool as q, LlmToolOpenAIWrapped as r, LlmToolOutputData as s, LlmVerb as t, MessageVerb as u, PlayVerb as v, RedirectVerb as w, SipDeclineVerb as x, SipReferVerb as y, SipRequestVerb as z };
@@ -340,6 +340,60 @@ interface McpServerConfig {
340
340
  auth?: Record<string, unknown>;
341
341
  roots?: Record<string, unknown>[];
342
342
  }
343
+ /** A conversation-history message passed via `llmOptions.messages`. */
344
+ interface LlmMessage {
345
+ role: 'system' | 'user' | 'assistant' | 'tool';
346
+ content: string | unknown;
347
+ [key: string]: unknown;
348
+ }
349
+ /** Tool / function definition (MCP-flat canonical shape). */
350
+ interface LlmTool {
351
+ name: string;
352
+ description?: string;
353
+ parameters?: Record<string, unknown>;
354
+ }
355
+ /** OpenAI-wrapped tool shape — also accepted for back-compat. */
356
+ interface LlmToolOpenAIWrapped {
357
+ type: 'function';
358
+ function: LlmTool;
359
+ }
360
+ /** Canonical tool-output payload carried by `llm:tool-output` commands. */
361
+ interface LlmToolOutputData {
362
+ result?: unknown;
363
+ [key: string]: unknown;
364
+ }
365
+ /** Per-call LLM configuration for the agent verb. */
366
+ interface AgentLlmOptions {
367
+ /** System prompt. Placed vendor-appropriately by the feature-server wrapper. */
368
+ systemPrompt?: string;
369
+ /** Seed conversation history. A role:'system' entry is extracted into systemPrompt. */
370
+ messages?: LlmMessage[];
371
+ /** Alias of `messages` (historical). */
372
+ initialMessages?: LlmMessage[];
373
+ /** Maximum tokens the model may generate per turn. */
374
+ maxTokens?: number;
375
+ /** Sampling temperature. */
376
+ temperature?: number;
377
+ /** Tools / functions the model may call. */
378
+ tools?: (LlmTool | LlmToolOpenAIWrapped)[];
379
+ }
380
+ /** `llm` block on the agent verb. */
381
+ interface AgentLlm {
382
+ vendor: 'openai' | 'anthropic' | 'google' | 'vertex-gemini' | 'vertex-openai' | 'bedrock' | 'deepseek';
383
+ model: string;
384
+ label?: string;
385
+ auth?: {
386
+ apiKey?: string;
387
+ [key: string]: unknown;
388
+ };
389
+ connectOptions?: {
390
+ timeout?: number;
391
+ maxRetries?: number;
392
+ endpoint?: string;
393
+ baseURL?: string;
394
+ };
395
+ llmOptions?: AgentLlmOptions;
396
+ }
343
397
  /** Shared properties for llm, s2s, and vendor-specific s2s verbs. */
344
398
  interface LlmBaseOptions {
345
399
  id?: string;
@@ -457,7 +511,7 @@ interface AgentVerb {
457
511
  sticky?: boolean;
458
512
  };
459
513
  /** LLM configuration. */
460
- llm: Record<string, unknown>;
514
+ llm: AgentLlm;
461
515
  /** Webhook when agent ends. */
462
516
  actionHook?: ActionHook;
463
517
  /** Webhook for agent events. */
@@ -888,4 +942,4 @@ type JambonzApp = Verb[];
888
942
  /** All valid verb names. */
889
943
  type VerbName = Verb['verb'];
890
944
 
891
- export type { ActionHook as A, BidirectionalAudio as B, ConferenceVerb as C, DequeueVerb as D, EnqueueVerb as E, FillerNoise as F, GatherVerb as G, HangupVerb as H, S2sVerb as I, JambonzApp as J, LlmBaseOptions as K, LeaveVerb as L, McpServerConfig as M, DialogflowVerb as N, PauseVerb as P, Recognizer as R, SayVerb as S, TagVerb as T, Vad as V, ActionHookDelayAction as a, ActionHookObject as b, AgentVerb as c, AlertVerb as d, Amd as e, AmdTimers as f, AnswerVerb as g, Auth as h, ConfigVerb as i, DialVerb as j, DtmfVerb as k, DubVerb as l, ListenVerb as m, LlmVerb as n, MessageVerb as o, PlayVerb as p, RedirectVerb as q, SipDeclineVerb as r, SipReferVerb as s, SipRequestVerb as t, StreamVerb as u, Synthesizer as v, Target as w, TranscribeVerb as x, Verb as y, VerbName as z };
945
+ export type { ActionHook as A, BidirectionalAudio as B, ConferenceVerb as C, DequeueVerb as D, EnqueueVerb as E, FillerNoise as F, GatherVerb as G, HangupVerb as H, StreamVerb as I, JambonzApp as J, Synthesizer as K, LeaveVerb as L, McpServerConfig as M, Target as N, TranscribeVerb as O, PauseVerb as P, Verb as Q, Recognizer as R, SayVerb as S, TagVerb as T, VerbName as U, Vad as V, S2sVerb as W, LlmBaseOptions as X, DialogflowVerb as Y, ActionHookDelayAction as a, ActionHookObject as b, AgentLlm as c, AgentLlmOptions as d, AgentVerb as e, AlertVerb as f, Amd as g, AmdTimers as h, AnswerVerb as i, Auth as j, ConfigVerb as k, DialVerb as l, DtmfVerb as m, DubVerb as n, ListenVerb as o, LlmMessage as p, LlmTool as q, LlmToolOpenAIWrapped as r, LlmToolOutputData as s, LlmVerb as t, MessageVerb as u, PlayVerb as v, RedirectVerb as w, SipDeclineVerb as x, SipReferVerb as y, SipRequestVerb as z };
@@ -1,5 +1,5 @@
1
- import { b as VerbBuilder, c as VerbBuilderOptions } from '../verb-builder-CFPD9yWI.cjs';
2
- import { J as JambonzApp } from '../verbs-DKy6nGIH.cjs';
1
+ import { b as VerbBuilder, c as VerbBuilderOptions } from '../verb-builder-DoLeroIU.cjs';
2
+ import { J as JambonzApp } from '../verbs-mXzecf0-.cjs';
3
3
  import { IncomingMessage, ServerResponse } from 'http';
4
4
  import { a as EnvVarSchema } from '../common-BSJZX7WO.cjs';
5
5
 
@@ -1,5 +1,5 @@
1
- import { b as VerbBuilder, c as VerbBuilderOptions } from '../verb-builder-D5XRbTtu.js';
2
- import { J as JambonzApp } from '../verbs-DKy6nGIH.js';
1
+ import { b as VerbBuilder, c as VerbBuilderOptions } from '../verb-builder-BRsGhe7j.js';
2
+ import { J as JambonzApp } from '../verbs-mXzecf0-.js';
3
3
  import { IncomingMessage, ServerResponse } from 'http';
4
4
  import { a as EnvVarSchema } from '../common-BSJZX7WO.js';
5
5
 
@@ -639,7 +639,17 @@ var Session = class extends events.EventEmitter {
639
639
  data
640
640
  });
641
641
  }
642
- /** Send tool output to an active LLM conversation. */
642
+ /**
643
+ * Send tool output to an active LLM conversation.
644
+ *
645
+ * Canonical wire shape (validated by `@jambonz/schema`):
646
+ * `{type: 'command', command: 'llm:tool-output', tool_call_id, data}`
647
+ *
648
+ * `data` should be an object; `{result: ...}` is the preferred carrier but
649
+ * any object shape is accepted (feature-server JSON-stringifies it into the
650
+ * tool_result on the wire). For caller convenience, a non-object `data`
651
+ * argument is wrapped as `{result: data}` before send.
652
+ */
643
653
  sendToolOutput(toolCallId, data) {
644
654
  const payload = typeof data === "object" && data !== null ? data : { result: data };
645
655
  this.wsSend({