Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,10 @@
"examples"
],
"scripts": {
"gen:types": "node scripts/gen-llm-vendors.mjs",
"prebuild": "npm run gen:types",
"build": "tsup",
"dev": "tsup --watch",
"test": "vitest run",
"test:watch": "vitest",
"pretypecheck": "npm run gen:types",
"typecheck": "tsc --noEmit",
"lint": "eslint src/",
"docs": "typedoc",
Expand All @@ -98,7 +95,7 @@
"postpublish": "npm run clean-docs"
},
"dependencies": {
"@jambonz/schema": "^0.3.19",
"@jambonz/schema": "^0.4.0",
"ajv": "^8.17.1",
"ws": "^8.18.0"
},
Expand Down
62 changes: 0 additions & 62 deletions typescript/scripts/gen-llm-vendors.mjs

This file was deleted.

1 change: 1 addition & 0 deletions typescript/src/types/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export interface Recognizer {
assemblyAiOptions?: Record<string, unknown>;
speechmaticsOptions?: Record<string, unknown>;
openaiOptions?: Record<string, unknown>;
xaiOptions?: Record<string, unknown>;
houndifyOptions?: Record<string, unknown>;
gladiaOptions?: Record<string, unknown>;
elevenlabsOptions?: Record<string, unknown>;
Expand Down
5 changes: 2 additions & 3 deletions typescript/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ export type {
VerbName,
} from './verbs.js';

// LLM vendors (derived from @jambonz/schema)
export type { LlmVendor } from './llm-vendors.generated.js';
export { LLM_VENDORS } from './llm-vendors.generated.js';
// LLM vendor id (free-form string; the schema has no vendor enum by design)
export type { LlmVendor } from './verbs.js';

// Session
export type {
Expand Down
26 changes: 0 additions & 26 deletions typescript/src/types/llm-vendors.generated.ts

This file was deleted.

22 changes: 16 additions & 6 deletions typescript/src/types/verbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ import type {
Target,
Vad,
} from './components.js';
import type { LlmVendor } from './llm-vendors.generated.js';

/**
* LLM vendor id for the agent verb's `llm.vendor`. Free-form by design: the
* schema deliberately has no vendor enum so new LLMs can be added without a
* schema release; the server validates the vendor against its registered
* `@jambonz/llm` adapters at runtime.
*/
export type LlmVendor = string;

// ---------------------------------------------------------------------------
// Audio & Speech
Expand Down Expand Up @@ -162,9 +169,10 @@ export interface AgentLlmOptions {

/** `llm` block on the agent verb. */
export interface AgentLlm {
/** LLM vendor. Derived from the @jambonz/schema agent verb enum — see llm-vendors.generated.ts. */
vendor: LlmVendor;
model: string;
/** LLM vendor. Optional: falls back to the application's default LLM vendor when omitted. */
vendor?: LlmVendor;
/** Model id. Optional: falls back to the application's default LLM model when omitted. */
model?: string;
label?: string;
auth?: { apiKey?: string; [key: string]: unknown };
connectOptions?: {
Expand Down Expand Up @@ -314,8 +322,8 @@ export interface AgentVerb {
minSpeechDuration?: number;
sticky?: boolean;
};
/** LLM configuration. */
llm: AgentLlm;
/** LLM configuration. Optional: when omitted, the agent uses the application's default LLM (like stt/tts). */
llm?: AgentLlm;
/** Webhook when agent ends. */
actionHook?: ActionHook;
/** Webhook for agent events. */
Expand Down Expand Up @@ -476,6 +484,8 @@ export interface DialVerb {
referHook?: ActionHook;
/** Audio URL for ringback tone replacement. */
dialMusic?: string;
/** Request SRTP (encrypted media) on the outbound call. 'sdes' negotiates keys via SDES crypto attributes (used with sips:/TLS targets); 'dtls' via DTLS-SRTP. Applies to SIP URI targets. */
srtpEncryption?: 'sdes' | 'dtls';
/** DTMF capture patterns during bridged call. */
dtmfCapture?: Record<string, unknown>;
/** Webhook for captured DTMF patterns. */
Expand Down
21 changes: 3 additions & 18 deletions typescript/test/schema-drift.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,22 +182,7 @@ describe('Schema drift detection', () => {
}
});

// The agent verb's llm.vendor union is code-generated from the schema enum
// (src/types/llm-vendors.generated.ts, via scripts/gen-llm-vendors.mjs). The
// generated file is committed, so it can go stale if the @jambonz/schema dep is
// bumped without re-running `npm run gen:types`. This guards the committed artifact.
describe('generated LLM vendor list matches schema enum', () => {
it('LLM_VENDORS equals agent.schema.json llm.vendor.enum', async () => {
const agentSchema = JSON.parse(
readFileSync(resolve(verbsDir, 'agent.schema.json'), 'utf-8')
);
const schemaEnum: string[] = agentSchema.properties.llm.properties.vendor.enum;
const { LLM_VENDORS } = await import('../src/types/llm-vendors.generated.js');

expect(
[...LLM_VENDORS],
'generated LLM_VENDORS is stale — run `npm run gen:types`'
).toEqual(schemaEnum);
});
});
// Note: the agent verb's llm.vendor is intentionally free-form (no enum) in
// @jambonz/schema, so there is no vendor union to drift-check here — vendor
// is validated at runtime against the server's registered adapters.
});