@tanstack/ai-client 0.17.0 → 0.18.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.
@@ -17,7 +17,10 @@ export declare class NoOpChatDevtoolsBridge {
17
17
  deactivate(): void;
18
18
  supersede(): void;
19
19
  dispose(): void;
20
+ mountWithTools(_initialMessageCount: number): void;
21
+ notifyToolsChanged(): void;
20
22
  setCurrentStreamId(_streamId: string | null): void;
23
+ recordStreamId(_streamId: string): void;
21
24
  getCurrentStreamId(): string | null;
22
25
  getLastStreamId(): string | null;
23
26
  resolveStreamId(): string;
@@ -26,8 +26,14 @@ class NoOpChatDevtoolsBridge {
26
26
  dispose() {
27
27
  }
28
28
  // chat-specific surface
29
+ mountWithTools(_initialMessageCount) {
30
+ }
31
+ notifyToolsChanged() {
32
+ }
29
33
  setCurrentStreamId(_streamId) {
30
34
  }
35
+ recordStreamId(_streamId) {
36
+ }
31
37
  getCurrentStreamId() {
32
38
  return null;
33
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"devtools-noop.js","sources":["../../src/devtools-noop.ts"],"sourcesContent":["// No-op devtools bridge implementations + factories. The chat / generation /\n// video clients import the real bridge classes as types only and accept a\n// factory in options; when no factory is supplied they fall back to the\n// no-op factories here, which never touch `aiEventClient` or any of the\n// heavy preview/fixture machinery in `./devtools`. This keeps `./devtools`\n// outside the main-entry import graph — consumers opt into functional\n// devtools via `@tanstack/ai-client/devtools` (see `package.json#exports`).\nimport { ChatClientEventEmitter } from './events'\nimport type {\n AIDevtoolsToolFixture,\n ChatDevtoolsBridge,\n ChatDevtoolsBridgeOptions,\n GenerationDevtoolsBridge,\n GenerationDevtoolsBridgeOptions,\n VideoDevtoolsBridge,\n VideoDevtoolsBridgeOptions,\n} from './devtools'\nimport type { StreamChunk } from '@tanstack/ai/client'\nimport type {\n ChatClientEventContext,\n ChatClientRunEventContext,\n} from './events'\n\nexport type ChatDevtoolsBridgeFactory = (\n options: ChatDevtoolsBridgeOptions,\n) => ChatDevtoolsBridge\n\nexport type GenerationDevtoolsBridgeFactory = <TOutput>(\n options: GenerationDevtoolsBridgeOptions<TOutput>,\n) => GenerationDevtoolsBridge<TOutput>\n\nexport type VideoDevtoolsBridgeFactory = <TOutput>(\n options: VideoDevtoolsBridgeOptions<TOutput>,\n) => VideoDevtoolsBridge<TOutput>\n\n// ===========================================================================\n// No-op event emitter — extends the abstract base so it satisfies the type\n// without dragging in any of the event-bus runtime cost.\n// ===========================================================================\n\nclass NoOpChatClientEventEmitter extends ChatClientEventEmitter {\n protected emitEvent(): void {\n // intentionally empty\n }\n}\n\n// ===========================================================================\n// No-op bridges. Methods exist to satisfy the structural shape of the real\n// classes; every emit/record call short-circuits.\n// ===========================================================================\n\nexport class NoOpChatDevtoolsBridge {\n readonly events: ChatClientEventEmitter\n\n constructor(options: ChatDevtoolsBridgeOptions) {\n this.events = new NoOpChatClientEventEmitter(options.clientId)\n }\n\n // base bridge surface\n emitRegistered(): void {}\n emitUpdated(): void {}\n emitSnapshot(): void {}\n emitToolsRegistered(): void {}\n emitRunLifecycle(\n _eventType: unknown,\n _runId: string,\n _status: unknown,\n _options?: { error?: string },\n ): void {}\n deactivate(): void {}\n supersede(): void {}\n dispose(): void {}\n\n // chat-specific surface\n setCurrentStreamId(_streamId: string | null): void {}\n getCurrentStreamId(): string | null {\n return null\n }\n getLastStreamId(): string | null {\n return null\n }\n resolveStreamId(): string {\n return ''\n }\n observeChunk(_chunk: StreamChunk): void {}\n beginRun(_runId: string, _threadId: string): void {}\n getCurrentRunEventContext(): ChatClientRunEventContext | undefined {\n return undefined\n }\n getCurrentOrLastRunEventContext(): ChatClientRunEventContext | undefined {\n return undefined\n }\n findToolCallContext(toolCallId: string): ChatClientEventContext {\n return { toolCallId }\n }\n async applyFixture(_fixture: AIDevtoolsToolFixture): Promise<void> {\n // intentionally empty\n }\n}\n\nexport class NoOpGenerationDevtoolsBridge<TOutput> {\n constructor(_options: GenerationDevtoolsBridgeOptions<TOutput>) {}\n\n // base bridge surface\n emitRegistered(): void {}\n emitUpdated(): void {}\n emitSnapshot(): void {}\n emitToolsRegistered(): void {}\n emitRunLifecycle(): void {}\n deactivate(): void {}\n supersede(): void {}\n dispose(): void {}\n\n // generation-specific surface\n beginRun(_input: unknown): string {\n // Real factories supply a stable id; the no-op still returns a\n // unique value because the generation client passes this run id to\n // the adapter's RunAgentInputContext.\n return `noop-run-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`\n }\n ensureRunStarted(_runId: string): void {}\n finishRun(\n _runId: string,\n _eventType: 'run:completed' | 'run:errored' | 'run:cancelled',\n _status: 'completed' | 'errored' | 'cancelled',\n _error?: string,\n ): void {}\n getActiveRunId(): string | null {\n return null\n }\n resetRuns(): void {}\n recordResultChange(): void {}\n recordLoadingChange(): void {}\n recordErrorChange(_error: Error | undefined): void {}\n recordStatusChange(): void {}\n recordProgressChange(): void {}\n emitState(): void {}\n}\n\nexport class NoOpVideoDevtoolsBridge<\n TOutput,\n> extends NoOpGenerationDevtoolsBridge<TOutput> {\n constructor(options: VideoDevtoolsBridgeOptions<TOutput>) {\n super(options)\n }\n\n recordJobIdChange(): void {}\n recordVideoStatusChange(): void {}\n}\n\n// Compile-time parity checks. If a public method is added to the real\n// bridge class without a matching stub on the no-op, the corresponding\n// `Exclude<...>` will resolve to a non-`never` union and the `as never`\n// assignment below will fail to typecheck — surfacing the drift at build\n// time instead of as a runtime TypeError later.\ntype _ChatBridgeMissing = Exclude<\n keyof ChatDevtoolsBridge,\n keyof NoOpChatDevtoolsBridge\n>\ntype _GenerationBridgeMissing = Exclude<\n keyof GenerationDevtoolsBridge<unknown>,\n keyof NoOpGenerationDevtoolsBridge<unknown>\n>\ntype _VideoBridgeMissing = Exclude<\n keyof VideoDevtoolsBridge<unknown>,\n keyof NoOpVideoDevtoolsBridge<unknown>\n>\nconst _chatBridgeParity: _ChatBridgeMissing = undefined as never\nconst _generationBridgeParity: _GenerationBridgeMissing = undefined as never\nconst _videoBridgeParity: _VideoBridgeMissing = undefined as never\nvoid _chatBridgeParity\nvoid _generationBridgeParity\nvoid _videoBridgeParity\n\n// ===========================================================================\n// Factories — these are what the clients call when no real factory was\n// supplied in options.\n// ===========================================================================\n\n// Casts use `unknown` because the no-op classes don't `extend` the real bridge\n// (that would pull the real implementation into the main-entry import graph).\n// Structural parity is enforced by the `_*BridgeMissing` checks above.\n\nexport const createNoOpChatDevtoolsBridge: ChatDevtoolsBridgeFactory = (\n options,\n) =>\n // eslint-disable-next-line no-restricted-syntax -- see comment above\n new NoOpChatDevtoolsBridge(options) as unknown as ChatDevtoolsBridge\n\nexport const createNoOpGenerationDevtoolsBridge: GenerationDevtoolsBridgeFactory =\n <TOutput>(options: GenerationDevtoolsBridgeOptions<TOutput>) =>\n // eslint-disable-next-line no-restricted-syntax -- see comment above\n new NoOpGenerationDevtoolsBridge<TOutput>(\n options,\n ) as unknown as GenerationDevtoolsBridge<TOutput>\n\nexport const createNoOpVideoDevtoolsBridge: VideoDevtoolsBridgeFactory = <\n TOutput,\n>(\n options: VideoDevtoolsBridgeOptions<TOutput>,\n) =>\n // eslint-disable-next-line no-restricted-syntax -- see comment above\n new NoOpVideoDevtoolsBridge<TOutput>(\n options,\n ) as unknown as VideoDevtoolsBridge<TOutput>\n"],"names":[],"mappings":";AAwCA,MAAM,mCAAmC,uBAAuB;AAAA,EACpD,YAAkB;AAAA,EAE5B;AACF;AAOO,MAAM,uBAAuB;AAAA,EACzB;AAAA,EAET,YAAY,SAAoC;AAC9C,SAAK,SAAS,IAAI,2BAA2B,QAAQ,QAAQ;AAAA,EAC/D;AAAA;AAAA,EAGA,iBAAuB;AAAA,EAAC;AAAA,EACxB,cAAoB;AAAA,EAAC;AAAA,EACrB,eAAqB;AAAA,EAAC;AAAA,EACtB,sBAA4B;AAAA,EAAC;AAAA,EAC7B,iBACE,YACA,QACA,SACA,UACM;AAAA,EAAC;AAAA,EACT,aAAmB;AAAA,EAAC;AAAA,EACpB,YAAkB;AAAA,EAAC;AAAA,EACnB,UAAgB;AAAA,EAAC;AAAA;AAAA,EAGjB,mBAAmB,WAAgC;AAAA,EAAC;AAAA,EACpD,qBAAoC;AAClC,WAAO;AAAA,EACT;AAAA,EACA,kBAAiC;AAC/B,WAAO;AAAA,EACT;AAAA,EACA,kBAA0B;AACxB,WAAO;AAAA,EACT;AAAA,EACA,aAAa,QAA2B;AAAA,EAAC;AAAA,EACzC,SAAS,QAAgB,WAAyB;AAAA,EAAC;AAAA,EACnD,4BAAmE;AACjE,WAAO;AAAA,EACT;AAAA,EACA,kCAAyE;AACvE,WAAO;AAAA,EACT;AAAA,EACA,oBAAoB,YAA4C;AAC9D,WAAO,EAAE,WAAA;AAAA,EACX;AAAA,EACA,MAAM,aAAa,UAAgD;AAAA,EAEnE;AACF;AAEO,MAAM,6BAAsC;AAAA,EACjD,YAAY,UAAoD;AAAA,EAAC;AAAA;AAAA,EAGjE,iBAAuB;AAAA,EAAC;AAAA,EACxB,cAAoB;AAAA,EAAC;AAAA,EACrB,eAAqB;AAAA,EAAC;AAAA,EACtB,sBAA4B;AAAA,EAAC;AAAA,EAC7B,mBAAyB;AAAA,EAAC;AAAA,EAC1B,aAAmB;AAAA,EAAC;AAAA,EACpB,YAAkB;AAAA,EAAC;AAAA,EACnB,UAAgB;AAAA,EAAC;AAAA;AAAA,EAGjB,SAAS,QAAyB;AAIhC,WAAO,YAAY,KAAK,IAAA,CAAK,IAAI,KAAK,OAAA,EAAS,SAAS,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;AAAA,EACzE;AAAA,EACA,iBAAiB,QAAsB;AAAA,EAAC;AAAA,EACxC,UACE,QACA,YACA,SACA,QACM;AAAA,EAAC;AAAA,EACT,iBAAgC;AAC9B,WAAO;AAAA,EACT;AAAA,EACA,YAAkB;AAAA,EAAC;AAAA,EACnB,qBAA2B;AAAA,EAAC;AAAA,EAC5B,sBAA4B;AAAA,EAAC;AAAA,EAC7B,kBAAkB,QAAiC;AAAA,EAAC;AAAA,EACpD,qBAA2B;AAAA,EAAC;AAAA,EAC5B,uBAA6B;AAAA,EAAC;AAAA,EAC9B,YAAkB;AAAA,EAAC;AACrB;AAEO,MAAM,gCAEH,6BAAsC;AAAA,EAC9C,YAAY,SAA8C;AACxD,UAAM,OAAO;AAAA,EACf;AAAA,EAEA,oBAA0B;AAAA,EAAC;AAAA,EAC3B,0BAAgC;AAAA,EAAC;AACnC;AAmCO,MAAM,+BAA0D,CACrE;AAAA;AAAA,EAGA,IAAI,uBAAuB,OAAO;AAAA;AAE7B,MAAM,qCACX,CAAU;AAAA;AAAA,EAER,IAAI;AAAA,IACF;AAAA,EAAA;AAAA;AAGC,MAAM,gCAA4D,CAGvE;AAAA;AAAA,EAGA,IAAI;AAAA,IACF;AAAA,EAAA;AAAA;"}
1
+ {"version":3,"file":"devtools-noop.js","sources":["../../src/devtools-noop.ts"],"sourcesContent":["// No-op devtools bridge implementations + factories. The chat / generation /\n// video clients import the real bridge classes as types only and accept a\n// factory in options; when no factory is supplied they fall back to the\n// no-op factories here, which never touch `aiEventClient` or any of the\n// heavy preview/fixture machinery in `./devtools`. This keeps `./devtools`\n// outside the main-entry import graph — consumers opt into functional\n// devtools via `@tanstack/ai-client/devtools` (see `package.json#exports`).\nimport { ChatClientEventEmitter } from './events'\nimport type {\n AIDevtoolsToolFixture,\n ChatDevtoolsBridge,\n ChatDevtoolsBridgeOptions,\n GenerationDevtoolsBridge,\n GenerationDevtoolsBridgeOptions,\n VideoDevtoolsBridge,\n VideoDevtoolsBridgeOptions,\n} from './devtools'\nimport type { StreamChunk } from '@tanstack/ai/client'\nimport type {\n ChatClientEventContext,\n ChatClientRunEventContext,\n} from './events'\n\nexport type ChatDevtoolsBridgeFactory = (\n options: ChatDevtoolsBridgeOptions,\n) => ChatDevtoolsBridge\n\nexport type GenerationDevtoolsBridgeFactory = <TOutput>(\n options: GenerationDevtoolsBridgeOptions<TOutput>,\n) => GenerationDevtoolsBridge<TOutput>\n\nexport type VideoDevtoolsBridgeFactory = <TOutput>(\n options: VideoDevtoolsBridgeOptions<TOutput>,\n) => VideoDevtoolsBridge<TOutput>\n\n// ===========================================================================\n// No-op event emitter — extends the abstract base so it satisfies the type\n// without dragging in any of the event-bus runtime cost.\n// ===========================================================================\n\nclass NoOpChatClientEventEmitter extends ChatClientEventEmitter {\n protected emitEvent(): void {\n // intentionally empty\n }\n}\n\n// ===========================================================================\n// No-op bridges. Methods exist to satisfy the structural shape of the real\n// classes; every emit/record call short-circuits.\n// ===========================================================================\n\nexport class NoOpChatDevtoolsBridge {\n readonly events: ChatClientEventEmitter\n\n constructor(options: ChatDevtoolsBridgeOptions) {\n this.events = new NoOpChatClientEventEmitter(options.clientId)\n }\n\n // base bridge surface\n emitRegistered(): void {}\n emitUpdated(): void {}\n emitSnapshot(): void {}\n emitToolsRegistered(): void {}\n emitRunLifecycle(\n _eventType: unknown,\n _runId: string,\n _status: unknown,\n _options?: { error?: string },\n ): void {}\n deactivate(): void {}\n supersede(): void {}\n dispose(): void {}\n\n // chat-specific surface\n mountWithTools(_initialMessageCount: number): void {}\n notifyToolsChanged(): void {}\n setCurrentStreamId(_streamId: string | null): void {}\n recordStreamId(_streamId: string): void {}\n getCurrentStreamId(): string | null {\n return null\n }\n getLastStreamId(): string | null {\n return null\n }\n resolveStreamId(): string {\n return ''\n }\n observeChunk(_chunk: StreamChunk): void {}\n beginRun(_runId: string, _threadId: string): void {}\n getCurrentRunEventContext(): ChatClientRunEventContext | undefined {\n return undefined\n }\n getCurrentOrLastRunEventContext(): ChatClientRunEventContext | undefined {\n return undefined\n }\n findToolCallContext(toolCallId: string): ChatClientEventContext {\n return { toolCallId }\n }\n async applyFixture(_fixture: AIDevtoolsToolFixture): Promise<void> {\n // intentionally empty\n }\n}\n\nexport class NoOpGenerationDevtoolsBridge<TOutput> {\n constructor(_options: GenerationDevtoolsBridgeOptions<TOutput>) {}\n\n // base bridge surface\n emitRegistered(): void {}\n emitUpdated(): void {}\n emitSnapshot(): void {}\n emitToolsRegistered(): void {}\n emitRunLifecycle(): void {}\n deactivate(): void {}\n supersede(): void {}\n dispose(): void {}\n\n // generation-specific surface\n beginRun(_input: unknown): string {\n // Real factories supply a stable id; the no-op still returns a\n // unique value because the generation client passes this run id to\n // the adapter's RunAgentInputContext.\n return `noop-run-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`\n }\n ensureRunStarted(_runId: string): void {}\n finishRun(\n _runId: string,\n _eventType: 'run:completed' | 'run:errored' | 'run:cancelled',\n _status: 'completed' | 'errored' | 'cancelled',\n _error?: string,\n ): void {}\n getActiveRunId(): string | null {\n return null\n }\n resetRuns(): void {}\n recordResultChange(): void {}\n recordLoadingChange(): void {}\n recordErrorChange(_error: Error | undefined): void {}\n recordStatusChange(): void {}\n recordProgressChange(): void {}\n emitState(): void {}\n}\n\nexport class NoOpVideoDevtoolsBridge<\n TOutput,\n> extends NoOpGenerationDevtoolsBridge<TOutput> {\n constructor(options: VideoDevtoolsBridgeOptions<TOutput>) {\n super(options)\n }\n\n recordJobIdChange(): void {}\n recordVideoStatusChange(): void {}\n}\n\n// Compile-time parity checks. If a public method is added to the real\n// bridge class without a matching stub on the no-op, the corresponding\n// `Exclude<...>` resolves to a non-`never` union, which violates the\n// `extends never` constraint below and fails the build — surfacing the\n// drift at build time instead of as a runtime TypeError later.\ntype AssertBridgeParity<TMissing extends never> = TMissing\ntype _ChatBridgeMissing = Exclude<\n keyof ChatDevtoolsBridge,\n keyof NoOpChatDevtoolsBridge\n>\ntype _GenerationBridgeMissing = Exclude<\n keyof GenerationDevtoolsBridge<unknown>,\n keyof NoOpGenerationDevtoolsBridge<unknown>\n>\ntype _VideoBridgeMissing = Exclude<\n keyof VideoDevtoolsBridge<unknown>,\n keyof NoOpVideoDevtoolsBridge<unknown>\n>\nconst _bridgeParity:\n | [\n AssertBridgeParity<_ChatBridgeMissing>,\n AssertBridgeParity<_GenerationBridgeMissing>,\n AssertBridgeParity<_VideoBridgeMissing>,\n ]\n | undefined = undefined\nvoid _bridgeParity\n\n// ===========================================================================\n// Factories — these are what the clients call when no real factory was\n// supplied in options.\n// ===========================================================================\n\n// Casts use `unknown` because the no-op classes don't `extend` the real bridge\n// (that would pull the real implementation into the main-entry import graph).\n// Structural parity is enforced by the `_*BridgeMissing` checks above.\n\nexport const createNoOpChatDevtoolsBridge: ChatDevtoolsBridgeFactory = (\n options,\n) =>\n // eslint-disable-next-line no-restricted-syntax -- see comment above\n new NoOpChatDevtoolsBridge(options) as unknown as ChatDevtoolsBridge\n\nexport const createNoOpGenerationDevtoolsBridge: GenerationDevtoolsBridgeFactory =\n <TOutput>(options: GenerationDevtoolsBridgeOptions<TOutput>) =>\n // eslint-disable-next-line no-restricted-syntax -- see comment above\n new NoOpGenerationDevtoolsBridge<TOutput>(\n options,\n ) as unknown as GenerationDevtoolsBridge<TOutput>\n\nexport const createNoOpVideoDevtoolsBridge: VideoDevtoolsBridgeFactory = <\n TOutput,\n>(\n options: VideoDevtoolsBridgeOptions<TOutput>,\n) =>\n // eslint-disable-next-line no-restricted-syntax -- see comment above\n new NoOpVideoDevtoolsBridge<TOutput>(\n options,\n ) as unknown as VideoDevtoolsBridge<TOutput>\n"],"names":[],"mappings":";AAwCA,MAAM,mCAAmC,uBAAuB;AAAA,EACpD,YAAkB;AAAA,EAE5B;AACF;AAOO,MAAM,uBAAuB;AAAA,EACzB;AAAA,EAET,YAAY,SAAoC;AAC9C,SAAK,SAAS,IAAI,2BAA2B,QAAQ,QAAQ;AAAA,EAC/D;AAAA;AAAA,EAGA,iBAAuB;AAAA,EAAC;AAAA,EACxB,cAAoB;AAAA,EAAC;AAAA,EACrB,eAAqB;AAAA,EAAC;AAAA,EACtB,sBAA4B;AAAA,EAAC;AAAA,EAC7B,iBACE,YACA,QACA,SACA,UACM;AAAA,EAAC;AAAA,EACT,aAAmB;AAAA,EAAC;AAAA,EACpB,YAAkB;AAAA,EAAC;AAAA,EACnB,UAAgB;AAAA,EAAC;AAAA;AAAA,EAGjB,eAAe,sBAAoC;AAAA,EAAC;AAAA,EACpD,qBAA2B;AAAA,EAAC;AAAA,EAC5B,mBAAmB,WAAgC;AAAA,EAAC;AAAA,EACpD,eAAe,WAAyB;AAAA,EAAC;AAAA,EACzC,qBAAoC;AAClC,WAAO;AAAA,EACT;AAAA,EACA,kBAAiC;AAC/B,WAAO;AAAA,EACT;AAAA,EACA,kBAA0B;AACxB,WAAO;AAAA,EACT;AAAA,EACA,aAAa,QAA2B;AAAA,EAAC;AAAA,EACzC,SAAS,QAAgB,WAAyB;AAAA,EAAC;AAAA,EACnD,4BAAmE;AACjE,WAAO;AAAA,EACT;AAAA,EACA,kCAAyE;AACvE,WAAO;AAAA,EACT;AAAA,EACA,oBAAoB,YAA4C;AAC9D,WAAO,EAAE,WAAA;AAAA,EACX;AAAA,EACA,MAAM,aAAa,UAAgD;AAAA,EAEnE;AACF;AAEO,MAAM,6BAAsC;AAAA,EACjD,YAAY,UAAoD;AAAA,EAAC;AAAA;AAAA,EAGjE,iBAAuB;AAAA,EAAC;AAAA,EACxB,cAAoB;AAAA,EAAC;AAAA,EACrB,eAAqB;AAAA,EAAC;AAAA,EACtB,sBAA4B;AAAA,EAAC;AAAA,EAC7B,mBAAyB;AAAA,EAAC;AAAA,EAC1B,aAAmB;AAAA,EAAC;AAAA,EACpB,YAAkB;AAAA,EAAC;AAAA,EACnB,UAAgB;AAAA,EAAC;AAAA;AAAA,EAGjB,SAAS,QAAyB;AAIhC,WAAO,YAAY,KAAK,IAAA,CAAK,IAAI,KAAK,OAAA,EAAS,SAAS,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;AAAA,EACzE;AAAA,EACA,iBAAiB,QAAsB;AAAA,EAAC;AAAA,EACxC,UACE,QACA,YACA,SACA,QACM;AAAA,EAAC;AAAA,EACT,iBAAgC;AAC9B,WAAO;AAAA,EACT;AAAA,EACA,YAAkB;AAAA,EAAC;AAAA,EACnB,qBAA2B;AAAA,EAAC;AAAA,EAC5B,sBAA4B;AAAA,EAAC;AAAA,EAC7B,kBAAkB,QAAiC;AAAA,EAAC;AAAA,EACpD,qBAA2B;AAAA,EAAC;AAAA,EAC5B,uBAA6B;AAAA,EAAC;AAAA,EAC9B,YAAkB;AAAA,EAAC;AACrB;AAEO,MAAM,gCAEH,6BAAsC;AAAA,EAC9C,YAAY,SAA8C;AACxD,UAAM,OAAO;AAAA,EACf;AAAA,EAEA,oBAA0B;AAAA,EAAC;AAAA,EAC3B,0BAAgC;AAAA,EAAC;AACnC;AAsCO,MAAM,+BAA0D,CACrE;AAAA;AAAA,EAGA,IAAI,uBAAuB,OAAO;AAAA;AAE7B,MAAM,qCACX,CAAU;AAAA;AAAA,EAER,IAAI;AAAA,IACF;AAAA,EAAA;AAAA;AAGC,MAAM,gCAA4D,CAGvE;AAAA;AAAA,EAGA,IAAI;AAAA,IACF;AAAA,EAAA;AAAA;"}
@@ -1,4 +1,4 @@
1
- import { StreamChunk } from '@tanstack/ai/client';
1
+ import { MediaPrompt, StreamChunk } from '@tanstack/ai/client';
2
2
  import { ConnectConnectionAdapter } from './connection-adapters.js';
3
3
  import { AIDevtoolsClientMetadata } from './devtools.js';
4
4
  import { GenerationDevtoolsBridgeFactory, VideoDevtoolsBridgeFactory } from './devtools-noop.js';
@@ -154,8 +154,12 @@ export interface VideoGenerationClientOptions<TOutput = VideoGenerateResult> ext
154
154
  * Input for image generation.
155
155
  */
156
156
  export interface ImageGenerateInput {
157
- /** Text description of the desired image(s) */
158
- prompt: string;
157
+ /**
158
+ * Description of the desired image(s): plain text, or an ordered array of
159
+ * content parts (text + image) for image-conditioned generation
160
+ * (image-to-image, multi-reference, edit / inpaint).
161
+ */
162
+ prompt: MediaPrompt;
159
163
  /** Number of images to generate (default: 1) */
160
164
  numberOfImages?: number;
161
165
  /** Image size in WIDTHxHEIGHT format (e.g., "1024x1024") */
@@ -223,8 +227,12 @@ export interface SummarizeGenerateInput {
223
227
  * Input for video generation.
224
228
  */
225
229
  export interface VideoGenerateInput {
226
- /** Text description of the desired video */
227
- prompt: string;
230
+ /**
231
+ * Description of the desired video: plain text, or an ordered array of
232
+ * content parts (text + image) for image-conditioned generation
233
+ * (image-to-video, start/end frames).
234
+ */
235
+ prompt: MediaPrompt;
228
236
  /** Video size — format depends on provider (e.g., "16:9", "1280x720") */
229
237
  size?: string;
230
238
  /** Video duration in seconds */
@@ -1 +1 @@
1
- {"version":3,"file":"generation-types.js","sources":["../../src/generation-types.ts"],"sourcesContent":["import type { StreamChunk } from '@tanstack/ai/client'\nimport type { ConnectConnectionAdapter } from './connection-adapters'\nimport type { AIDevtoolsClientMetadata } from './devtools'\nimport type {\n GenerationDevtoolsBridgeFactory,\n VideoDevtoolsBridgeFactory,\n} from './devtools-noop'\n\n// ===========================\n// Inference Utilities\n// ===========================\n\n/**\n * Infers the output type from an `onResult` callback's return type.\n *\n * - If the callback returns a concrete type (excluding null/void/undefined), uses that type.\n * - If the callback only returns null/void/undefined, or is not provided, falls back to TResult.\n *\n * @template TResult - The raw result type from the generation\n * @template TFn - The onResult callback type (or undefined if not provided)\n */\nexport type InferGenerationOutput<TResult, TFn> = TFn extends (\n result: any,\n) => infer R\n ? [Exclude<R, null | void | undefined>] extends [never]\n ? TResult\n : Exclude<R, null | void | undefined>\n : TResult\n\n// ===========================\n// State\n// ===========================\n\n/**\n * State machine for generation clients.\n * Simpler than ChatClientState since generation is a single request/response cycle.\n */\nexport type GenerationClientState = 'idle' | 'generating' | 'success' | 'error'\n\n// ===========================\n// Event Constants\n// ===========================\n\n/**\n * Well-known CUSTOM event names used by generation clients.\n * These events are emitted by the server-side streaming helpers\n * and consumed by the client-side GenerationClient.\n */\nexport const GENERATION_EVENTS = {\n /** The generation result payload */\n RESULT: 'generation:result',\n /** Progress update (0-100) with optional message */\n PROGRESS: 'generation:progress',\n /** Video job created with jobId */\n VIDEO_JOB_CREATED: 'video:job:created',\n /** Video job status update */\n VIDEO_STATUS: 'video:status',\n} as const\n\n// ===========================\n// Transport Types\n// ===========================\n\n/**\n * Options passed to a fetcher function by the generation client.\n */\nexport interface GenerationFetcherOptions {\n /** AbortSignal that is triggered when the user calls `stop()` */\n signal: AbortSignal\n}\n\n/**\n * A direct async function that performs a generation request.\n *\n * Can return the result directly, or return a `Response` with an SSE body\n * (e.g., from a TanStack Start server function using `toServerSentEventsResponse()`).\n * When a `Response` is returned, the client will parse it as an SSE stream.\n *\n * @template TInput - The input type for the generation request\n * @template TResult - The result type returned by the generation\n */\nexport type GenerationFetcher<TInput, TResult> = (\n input: TInput,\n options?: GenerationFetcherOptions,\n) => Promise<TResult | Response>\n\n/**\n * Transport configuration for generation clients.\n * Supports either a connect-based streaming adapter or a direct fetcher function.\n */\nexport type GenerationTransport<TInput, TResult> =\n | { connection: ConnectConnectionAdapter; fetcher?: never }\n | { fetcher: GenerationFetcher<TInput, TResult>; connection?: never }\n\n// ===========================\n// Client Options\n// ===========================\n\n/**\n * Options for the GenerationClient.\n *\n * @template TInput - The input type for the generation request (used by consuming code)\n * @template TResult - The result type returned by the generation\n * @template TOutput - The output type after optional transform (defaults to TResult)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention -- _TInput is unused in the interface body but part of the public positional generic API (callers supply it for inference)\nexport interface GenerationClientOptions<_TInput, TResult, TOutput = TResult> {\n /** Unique identifier for this generation client instance */\n id?: string\n\n /** Additional body parameters to send with connect-based adapter requests */\n body?: Record<string, any>\n\n /** Metadata used to register this generation hook with TanStack AI Devtools */\n devtools?: Partial<AIDevtoolsClientMetadata>\n\n /**\n * Factory that constructs the devtools bridge. Default is a no-op\n * factory; the real implementation lives in `@tanstack/ai-client/devtools`.\n */\n devtoolsBridgeFactory?: GenerationDevtoolsBridgeFactory\n\n /**\n * Callback when a result is received. Can optionally return a transformed value\n * that replaces the stored result.\n *\n * - Return a non-null value to transform and store it as the result\n * - Return `null` to keep the previous result unchanged\n * - Return nothing (`void`) to store the raw result as-is\n */\n onResult?: (result: TResult) => TOutput | null | void\n /** Callback when an error occurs */\n onError?: (error: Error) => void\n /** Callback when progress is reported (0-100) */\n onProgress?: (progress: number, message?: string) => void\n /** Callback for each stream chunk (connect-based adapter mode only) */\n onChunk?: (chunk: StreamChunk) => void\n\n // Framework state callbacks (set by hooks, not users)\n /** @internal Called when result changes */\n onResultChange?: (result: TOutput | null) => void\n /** @internal Called when loading state changes */\n onLoadingChange?: (isLoading: boolean) => void\n /** @internal Called when error state changes */\n onErrorChange?: (error: Error | undefined) => void\n /** @internal Called when generation status changes */\n onStatusChange?: (status: GenerationClientState) => void\n}\n\n// ===========================\n// Video-Specific Options\n// ===========================\n\n/**\n * Video status information returned during job polling.\n */\nexport interface VideoStatusInfo {\n /** Job identifier */\n jobId: string\n /** Current status of the video generation job */\n status: 'pending' | 'processing' | 'completed' | 'failed'\n /** Progress percentage (0-100), if available */\n progress?: number\n /** URL to the generated video (when completed) */\n url?: string\n /** Error message if status is 'failed' */\n error?: string\n}\n\n/**\n * Composite result for video generation (job completion).\n */\nexport interface VideoGenerateResult {\n /** Job identifier */\n jobId: string\n /** Final status */\n status: 'completed'\n /** URL to the generated video */\n url: string\n /** When the URL expires, if applicable */\n expiresAt?: Date\n}\n\n/**\n * Options for the VideoGenerationClient.\n */\nexport interface VideoGenerationClientOptions<\n TOutput = VideoGenerateResult,\n> extends Omit<\n GenerationClientOptions<VideoGenerateInput, VideoGenerateResult, TOutput>,\n 'devtoolsBridgeFactory'\n> {\n /**\n * Factory that constructs the video devtools bridge. Default is a no-op\n * factory; the real implementation lives in `@tanstack/ai-client/devtools`.\n */\n devtoolsBridgeFactory?: VideoDevtoolsBridgeFactory\n\n /** Callback when a video job is created */\n onJobCreated?: (jobId: string) => void\n /** Callback on each status update */\n onStatusUpdate?: (status: VideoStatusInfo) => void\n\n // Framework state callbacks\n /** @internal Called when jobId changes */\n onJobIdChange?: (jobId: string | null) => void\n /** @internal Called when video status changes */\n onVideoStatusChange?: (status: VideoStatusInfo | null) => void\n}\n\n// ===========================\n// Input Types\n// ===========================\n\n/**\n * Input for image generation.\n */\nexport interface ImageGenerateInput {\n /** Text description of the desired image(s) */\n prompt: string\n /** Number of images to generate (default: 1) */\n numberOfImages?: number\n /** Image size in WIDTHxHEIGHT format (e.g., \"1024x1024\") */\n size?: string\n /** Model-specific options */\n modelOptions?: Record<string, any>\n}\n\n/**\n * Input for audio generation (music, sound effects).\n */\nexport interface AudioGenerateInput {\n /** Text description of the desired audio */\n prompt: string\n /** Desired duration in seconds */\n duration?: number\n /** Model-specific options */\n modelOptions?: Record<string, any>\n}\n\n/**\n * Input for text-to-speech generation.\n */\nexport interface SpeechGenerateInput {\n /** The text to convert to speech */\n text: string\n /** The voice to use for generation */\n voice?: string\n /** The output audio format */\n format?: 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm'\n /** The speed of the generated audio (0.25 to 4.0) */\n speed?: number\n /** Model-specific options */\n modelOptions?: Record<string, any>\n}\n\n/**\n * Input for audio transcription.\n */\nexport interface TranscriptionGenerateInput {\n /** The audio data to transcribe - can be base64 string, File, Blob, or ArrayBuffer */\n audio: string | File | Blob | ArrayBuffer\n /** The language of the audio in ISO-639-1 format (e.g., 'en') */\n language?: string\n /** An optional prompt to guide the transcription */\n prompt?: string\n /** The format of the transcription output */\n responseFormat?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt'\n /** Model-specific options */\n modelOptions?: Record<string, any>\n}\n\n/**\n * Input for text summarization.\n */\nexport interface SummarizeGenerateInput {\n /** The text to summarize */\n text: string\n /** Maximum length of the summary */\n maxLength?: number\n /** Style of the summary */\n style?: 'bullet-points' | 'paragraph' | 'concise'\n /** Topics to focus on */\n focus?: Array<string>\n /** Model-specific options */\n modelOptions?: Record<string, any>\n}\n\n/**\n * Input for video generation.\n */\nexport interface VideoGenerateInput {\n /** Text description of the desired video */\n prompt: string\n /** Video size — format depends on provider (e.g., \"16:9\", \"1280x720\") */\n size?: string\n /** Video duration in seconds */\n duration?: number\n /** Model-specific options */\n modelOptions?: Record<string, any>\n}\n"],"names":[],"mappings":"AAgDO,MAAM,oBAAoB;AAAA;AAAA,EAE/B,QAAQ;AAAA;AAAA,EAER,UAAU;AAAA;AAAA,EAEV,mBAAmB;AAAA;AAAA,EAEnB,cAAc;AAChB;"}
1
+ {"version":3,"file":"generation-types.js","sources":["../../src/generation-types.ts"],"sourcesContent":["import type { MediaPrompt, StreamChunk } from '@tanstack/ai/client'\nimport type { ConnectConnectionAdapter } from './connection-adapters'\nimport type { AIDevtoolsClientMetadata } from './devtools'\nimport type {\n GenerationDevtoolsBridgeFactory,\n VideoDevtoolsBridgeFactory,\n} from './devtools-noop'\n\n// ===========================\n// Inference Utilities\n// ===========================\n\n/**\n * Infers the output type from an `onResult` callback's return type.\n *\n * - If the callback returns a concrete type (excluding null/void/undefined), uses that type.\n * - If the callback only returns null/void/undefined, or is not provided, falls back to TResult.\n *\n * @template TResult - The raw result type from the generation\n * @template TFn - The onResult callback type (or undefined if not provided)\n */\nexport type InferGenerationOutput<TResult, TFn> = TFn extends (\n result: any,\n) => infer R\n ? [Exclude<R, null | void | undefined>] extends [never]\n ? TResult\n : Exclude<R, null | void | undefined>\n : TResult\n\n// ===========================\n// State\n// ===========================\n\n/**\n * State machine for generation clients.\n * Simpler than ChatClientState since generation is a single request/response cycle.\n */\nexport type GenerationClientState = 'idle' | 'generating' | 'success' | 'error'\n\n// ===========================\n// Event Constants\n// ===========================\n\n/**\n * Well-known CUSTOM event names used by generation clients.\n * These events are emitted by the server-side streaming helpers\n * and consumed by the client-side GenerationClient.\n */\nexport const GENERATION_EVENTS = {\n /** The generation result payload */\n RESULT: 'generation:result',\n /** Progress update (0-100) with optional message */\n PROGRESS: 'generation:progress',\n /** Video job created with jobId */\n VIDEO_JOB_CREATED: 'video:job:created',\n /** Video job status update */\n VIDEO_STATUS: 'video:status',\n} as const\n\n// ===========================\n// Transport Types\n// ===========================\n\n/**\n * Options passed to a fetcher function by the generation client.\n */\nexport interface GenerationFetcherOptions {\n /** AbortSignal that is triggered when the user calls `stop()` */\n signal: AbortSignal\n}\n\n/**\n * A direct async function that performs a generation request.\n *\n * Can return the result directly, or return a `Response` with an SSE body\n * (e.g., from a TanStack Start server function using `toServerSentEventsResponse()`).\n * When a `Response` is returned, the client will parse it as an SSE stream.\n *\n * @template TInput - The input type for the generation request\n * @template TResult - The result type returned by the generation\n */\nexport type GenerationFetcher<TInput, TResult> = (\n input: TInput,\n options?: GenerationFetcherOptions,\n) => Promise<TResult | Response>\n\n/**\n * Transport configuration for generation clients.\n * Supports either a connect-based streaming adapter or a direct fetcher function.\n */\nexport type GenerationTransport<TInput, TResult> =\n | { connection: ConnectConnectionAdapter; fetcher?: never }\n | { fetcher: GenerationFetcher<TInput, TResult>; connection?: never }\n\n// ===========================\n// Client Options\n// ===========================\n\n/**\n * Options for the GenerationClient.\n *\n * @template TInput - The input type for the generation request (used by consuming code)\n * @template TResult - The result type returned by the generation\n * @template TOutput - The output type after optional transform (defaults to TResult)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention -- _TInput is unused in the interface body but part of the public positional generic API (callers supply it for inference)\nexport interface GenerationClientOptions<_TInput, TResult, TOutput = TResult> {\n /** Unique identifier for this generation client instance */\n id?: string\n\n /** Additional body parameters to send with connect-based adapter requests */\n body?: Record<string, any>\n\n /** Metadata used to register this generation hook with TanStack AI Devtools */\n devtools?: Partial<AIDevtoolsClientMetadata>\n\n /**\n * Factory that constructs the devtools bridge. Default is a no-op\n * factory; the real implementation lives in `@tanstack/ai-client/devtools`.\n */\n devtoolsBridgeFactory?: GenerationDevtoolsBridgeFactory\n\n /**\n * Callback when a result is received. Can optionally return a transformed value\n * that replaces the stored result.\n *\n * - Return a non-null value to transform and store it as the result\n * - Return `null` to keep the previous result unchanged\n * - Return nothing (`void`) to store the raw result as-is\n */\n onResult?: (result: TResult) => TOutput | null | void\n /** Callback when an error occurs */\n onError?: (error: Error) => void\n /** Callback when progress is reported (0-100) */\n onProgress?: (progress: number, message?: string) => void\n /** Callback for each stream chunk (connect-based adapter mode only) */\n onChunk?: (chunk: StreamChunk) => void\n\n // Framework state callbacks (set by hooks, not users)\n /** @internal Called when result changes */\n onResultChange?: (result: TOutput | null) => void\n /** @internal Called when loading state changes */\n onLoadingChange?: (isLoading: boolean) => void\n /** @internal Called when error state changes */\n onErrorChange?: (error: Error | undefined) => void\n /** @internal Called when generation status changes */\n onStatusChange?: (status: GenerationClientState) => void\n}\n\n// ===========================\n// Video-Specific Options\n// ===========================\n\n/**\n * Video status information returned during job polling.\n */\nexport interface VideoStatusInfo {\n /** Job identifier */\n jobId: string\n /** Current status of the video generation job */\n status: 'pending' | 'processing' | 'completed' | 'failed'\n /** Progress percentage (0-100), if available */\n progress?: number\n /** URL to the generated video (when completed) */\n url?: string\n /** Error message if status is 'failed' */\n error?: string\n}\n\n/**\n * Composite result for video generation (job completion).\n */\nexport interface VideoGenerateResult {\n /** Job identifier */\n jobId: string\n /** Final status */\n status: 'completed'\n /** URL to the generated video */\n url: string\n /** When the URL expires, if applicable */\n expiresAt?: Date\n}\n\n/**\n * Options for the VideoGenerationClient.\n */\nexport interface VideoGenerationClientOptions<\n TOutput = VideoGenerateResult,\n> extends Omit<\n GenerationClientOptions<VideoGenerateInput, VideoGenerateResult, TOutput>,\n 'devtoolsBridgeFactory'\n> {\n /**\n * Factory that constructs the video devtools bridge. Default is a no-op\n * factory; the real implementation lives in `@tanstack/ai-client/devtools`.\n */\n devtoolsBridgeFactory?: VideoDevtoolsBridgeFactory\n\n /** Callback when a video job is created */\n onJobCreated?: (jobId: string) => void\n /** Callback on each status update */\n onStatusUpdate?: (status: VideoStatusInfo) => void\n\n // Framework state callbacks\n /** @internal Called when jobId changes */\n onJobIdChange?: (jobId: string | null) => void\n /** @internal Called when video status changes */\n onVideoStatusChange?: (status: VideoStatusInfo | null) => void\n}\n\n// ===========================\n// Input Types\n// ===========================\n\n/**\n * Input for image generation.\n */\nexport interface ImageGenerateInput {\n /**\n * Description of the desired image(s): plain text, or an ordered array of\n * content parts (text + image) for image-conditioned generation\n * (image-to-image, multi-reference, edit / inpaint).\n */\n prompt: MediaPrompt\n /** Number of images to generate (default: 1) */\n numberOfImages?: number\n /** Image size in WIDTHxHEIGHT format (e.g., \"1024x1024\") */\n size?: string\n /** Model-specific options */\n modelOptions?: Record<string, any>\n}\n\n/**\n * Input for audio generation (music, sound effects).\n */\nexport interface AudioGenerateInput {\n /** Text description of the desired audio */\n prompt: string\n /** Desired duration in seconds */\n duration?: number\n /** Model-specific options */\n modelOptions?: Record<string, any>\n}\n\n/**\n * Input for text-to-speech generation.\n */\nexport interface SpeechGenerateInput {\n /** The text to convert to speech */\n text: string\n /** The voice to use for generation */\n voice?: string\n /** The output audio format */\n format?: 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm'\n /** The speed of the generated audio (0.25 to 4.0) */\n speed?: number\n /** Model-specific options */\n modelOptions?: Record<string, any>\n}\n\n/**\n * Input for audio transcription.\n */\nexport interface TranscriptionGenerateInput {\n /** The audio data to transcribe - can be base64 string, File, Blob, or ArrayBuffer */\n audio: string | File | Blob | ArrayBuffer\n /** The language of the audio in ISO-639-1 format (e.g., 'en') */\n language?: string\n /** An optional prompt to guide the transcription */\n prompt?: string\n /** The format of the transcription output */\n responseFormat?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt'\n /** Model-specific options */\n modelOptions?: Record<string, any>\n}\n\n/**\n * Input for text summarization.\n */\nexport interface SummarizeGenerateInput {\n /** The text to summarize */\n text: string\n /** Maximum length of the summary */\n maxLength?: number\n /** Style of the summary */\n style?: 'bullet-points' | 'paragraph' | 'concise'\n /** Topics to focus on */\n focus?: Array<string>\n /** Model-specific options */\n modelOptions?: Record<string, any>\n}\n\n/**\n * Input for video generation.\n */\nexport interface VideoGenerateInput {\n /**\n * Description of the desired video: plain text, or an ordered array of\n * content parts (text + image) for image-conditioned generation\n * (image-to-video, start/end frames).\n */\n prompt: MediaPrompt\n /** Video size — format depends on provider (e.g., \"16:9\", \"1280x720\") */\n size?: string\n /** Video duration in seconds */\n duration?: number\n /** Model-specific options */\n modelOptions?: Record<string, any>\n}\n"],"names":[],"mappings":"AAgDO,MAAM,oBAAoB;AAAA;AAAA,EAE/B,QAAQ;AAAA;AAAA,EAER,UAAU;AAAA;AAAA,EAEV,mBAAmB;AAAA;AAAA,EAEnB,cAAc;AAChB;"}
package/package.json CHANGED
@@ -1,14 +1,22 @@
1
1
  {
2
2
  "name": "@tanstack/ai-client",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Framework-agnostic headless client for TanStack AI chat, realtime sessions, streaming transports, and media generations.",
5
- "author": "",
5
+ "author": "Tanner Linsley",
6
6
  "license": "MIT",
7
+ "homepage": "https://tanstack.com/ai",
7
8
  "repository": {
8
9
  "type": "git",
9
10
  "url": "git+https://github.com/TanStack/ai.git",
10
11
  "directory": "packages/ai-client"
11
12
  },
13
+ "bugs": {
14
+ "url": "https://github.com/TanStack/ai/issues"
15
+ },
16
+ "funding": {
17
+ "type": "github",
18
+ "url": "https://github.com/sponsors/tannerlinsley"
19
+ },
12
20
  "keywords": [
13
21
  "ai",
14
22
  "ai-sdk",
@@ -41,8 +49,8 @@
41
49
  "src"
42
50
  ],
43
51
  "dependencies": {
44
- "@tanstack/ai": "0.29.0",
45
- "@tanstack/ai-event-client": "0.6.0"
52
+ "@tanstack/ai": "0.32.0",
53
+ "@tanstack/ai-event-client": "0.6.3"
46
54
  },
47
55
  "devDependencies": {
48
56
  "@standard-schema/spec": "^1.1.0",
@@ -72,7 +72,10 @@ export class NoOpChatDevtoolsBridge {
72
72
  dispose(): void {}
73
73
 
74
74
  // chat-specific surface
75
+ mountWithTools(_initialMessageCount: number): void {}
76
+ notifyToolsChanged(): void {}
75
77
  setCurrentStreamId(_streamId: string | null): void {}
78
+ recordStreamId(_streamId: string): void {}
76
79
  getCurrentStreamId(): string | null {
77
80
  return null
78
81
  }
@@ -150,9 +153,10 @@ export class NoOpVideoDevtoolsBridge<
150
153
 
151
154
  // Compile-time parity checks. If a public method is added to the real
152
155
  // bridge class without a matching stub on the no-op, the corresponding
153
- // `Exclude<...>` will resolve to a non-`never` union and the `as never`
154
- // assignment below will fail to typecheck — surfacing the drift at build
155
- // time instead of as a runtime TypeError later.
156
+ // `Exclude<...>` resolves to a non-`never` union, which violates the
157
+ // `extends never` constraint below and fails the build — surfacing the
158
+ // drift at build time instead of as a runtime TypeError later.
159
+ type AssertBridgeParity<TMissing extends never> = TMissing
156
160
  type _ChatBridgeMissing = Exclude<
157
161
  keyof ChatDevtoolsBridge,
158
162
  keyof NoOpChatDevtoolsBridge
@@ -165,12 +169,14 @@ type _VideoBridgeMissing = Exclude<
165
169
  keyof VideoDevtoolsBridge<unknown>,
166
170
  keyof NoOpVideoDevtoolsBridge<unknown>
167
171
  >
168
- const _chatBridgeParity: _ChatBridgeMissing = undefined as never
169
- const _generationBridgeParity: _GenerationBridgeMissing = undefined as never
170
- const _videoBridgeParity: _VideoBridgeMissing = undefined as never
171
- void _chatBridgeParity
172
- void _generationBridgeParity
173
- void _videoBridgeParity
172
+ const _bridgeParity:
173
+ | [
174
+ AssertBridgeParity<_ChatBridgeMissing>,
175
+ AssertBridgeParity<_GenerationBridgeMissing>,
176
+ AssertBridgeParity<_VideoBridgeMissing>,
177
+ ]
178
+ | undefined = undefined
179
+ void _bridgeParity
174
180
 
175
181
  // ===========================================================================
176
182
  // Factories — these are what the clients call when no real factory was
@@ -1,4 +1,4 @@
1
- import type { StreamChunk } from '@tanstack/ai/client'
1
+ import type { MediaPrompt, StreamChunk } from '@tanstack/ai/client'
2
2
  import type { ConnectConnectionAdapter } from './connection-adapters'
3
3
  import type { AIDevtoolsClientMetadata } from './devtools'
4
4
  import type {
@@ -216,8 +216,12 @@ export interface VideoGenerationClientOptions<
216
216
  * Input for image generation.
217
217
  */
218
218
  export interface ImageGenerateInput {
219
- /** Text description of the desired image(s) */
220
- prompt: string
219
+ /**
220
+ * Description of the desired image(s): plain text, or an ordered array of
221
+ * content parts (text + image) for image-conditioned generation
222
+ * (image-to-image, multi-reference, edit / inpaint).
223
+ */
224
+ prompt: MediaPrompt
221
225
  /** Number of images to generate (default: 1) */
222
226
  numberOfImages?: number
223
227
  /** Image size in WIDTHxHEIGHT format (e.g., "1024x1024") */
@@ -290,8 +294,12 @@ export interface SummarizeGenerateInput {
290
294
  * Input for video generation.
291
295
  */
292
296
  export interface VideoGenerateInput {
293
- /** Text description of the desired video */
294
- prompt: string
297
+ /**
298
+ * Description of the desired video: plain text, or an ordered array of
299
+ * content parts (text + image) for image-conditioned generation
300
+ * (image-to-video, start/end frames).
301
+ */
302
+ prompt: MediaPrompt
295
303
  /** Video size — format depends on provider (e.g., "16:9", "1280x720") */
296
304
  size?: string
297
305
  /** Video duration in seconds */