@tanstack/ai 0.53.0 → 0.55.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.
Files changed (68) hide show
  1. package/README.md +14 -13
  2. package/dist/esm/activities/chat/index.js +22 -4
  3. package/dist/esm/activities/chat/index.js.map +1 -1
  4. package/dist/esm/activities/chat/messages.d.ts +21 -1
  5. package/dist/esm/activities/chat/messages.js +50 -1
  6. package/dist/esm/activities/chat/messages.js.map +1 -1
  7. package/dist/esm/activities/chat/stream/processor.d.ts +17 -0
  8. package/dist/esm/activities/chat/stream/processor.js +27 -0
  9. package/dist/esm/activities/chat/stream/processor.js.map +1 -1
  10. package/dist/esm/activities/generateLiveVideo/adapter.d.ts +69 -0
  11. package/dist/esm/activities/generateLiveVideo/adapter.js +23 -0
  12. package/dist/esm/activities/generateLiveVideo/adapter.js.map +1 -0
  13. package/dist/esm/activities/generateLiveVideo/index.d.ts +99 -0
  14. package/dist/esm/activities/generateLiveVideo/index.js +162 -0
  15. package/dist/esm/activities/generateLiveVideo/index.js.map +1 -0
  16. package/dist/esm/activities/generateVideo/index.js +3 -1
  17. package/dist/esm/activities/generateVideo/index.js.map +1 -1
  18. package/dist/esm/activities/generateWorld/adapter.d.ts +69 -0
  19. package/dist/esm/activities/generateWorld/adapter.js +23 -0
  20. package/dist/esm/activities/generateWorld/adapter.js.map +1 -0
  21. package/dist/esm/activities/generateWorld/index.d.ts +99 -0
  22. package/dist/esm/activities/generateWorld/index.js +162 -0
  23. package/dist/esm/activities/generateWorld/index.js.map +1 -0
  24. package/dist/esm/activities/index.d.ts +8 -2
  25. package/dist/esm/activities/index.js +11 -7
  26. package/dist/esm/activities/middleware/types.d.ts +1 -1
  27. package/dist/esm/client.d.ts +4 -2
  28. package/dist/esm/client.js +3 -1
  29. package/dist/esm/client.js.map +1 -1
  30. package/dist/esm/index.d.ts +4 -2
  31. package/dist/esm/index.js +3 -1
  32. package/dist/esm/middlewares/otel.js +3 -1
  33. package/dist/esm/middlewares/otel.js.map +1 -1
  34. package/dist/esm/types.d.ts +112 -0
  35. package/package.json +3 -3
  36. package/skills/ai-core/adapter-configuration/SKILL.md +91 -43
  37. package/skills/ai-core/adapter-configuration/references/anthropic-adapter.md +39 -21
  38. package/skills/ai-core/adapter-configuration/references/byteplus-adapter.md +5 -0
  39. package/skills/ai-core/adapter-configuration/references/gemini-adapter.md +14 -6
  40. package/skills/ai-core/adapter-configuration/references/grok-adapter.md +33 -25
  41. package/skills/ai-core/adapter-configuration/references/groq-adapter.md +7 -2
  42. package/skills/ai-core/adapter-configuration/references/ollama-adapter.md +25 -12
  43. package/skills/ai-core/adapter-configuration/references/openai-adapter.md +19 -9
  44. package/skills/ai-core/adapter-configuration/references/openrouter-adapter.md +34 -21
  45. package/skills/ai-core/ag-ui-protocol/SKILL.md +16 -10
  46. package/skills/ai-core/chat-experience/SKILL.md +228 -108
  47. package/skills/ai-core/client-persistence/SKILL.md +21 -9
  48. package/skills/ai-core/custom-backend-integration/SKILL.md +86 -52
  49. package/skills/ai-core/debug-logging/SKILL.md +100 -18
  50. package/skills/ai-core/locks/SKILL.md +35 -7
  51. package/skills/ai-core/media-generation/SKILL.md +136 -61
  52. package/skills/ai-core/middleware/SKILL.md +174 -69
  53. package/skills/ai-core/structured-outputs/SKILL.md +98 -49
  54. package/skills/ai-core/tool-calling/SKILL.md +245 -158
  55. package/src/activities/chat/index.ts +29 -7
  56. package/src/activities/chat/messages.ts +60 -0
  57. package/src/activities/chat/stream/processor.ts +31 -0
  58. package/src/activities/generateLiveVideo/adapter.ts +99 -0
  59. package/src/activities/generateLiveVideo/index.ts +339 -0
  60. package/src/activities/generateVideo/index.ts +3 -4
  61. package/src/activities/generateWorld/adapter.ts +96 -0
  62. package/src/activities/generateWorld/index.ts +339 -0
  63. package/src/activities/index.ts +44 -0
  64. package/src/activities/middleware/types.ts +2 -0
  65. package/src/client.ts +8 -0
  66. package/src/index.ts +8 -0
  67. package/src/middlewares/otel.ts +2 -0
  68. package/src/types.ts +128 -0
package/src/types.ts CHANGED
@@ -2218,6 +2218,134 @@ export interface VideoUrlResult {
2218
2218
  artifacts?: Array<PersistedArtifactRef>
2219
2219
  }
2220
2220
 
2221
+ // ============================================================================
2222
+ // World Generation Types (Experimental)
2223
+ // ============================================================================
2224
+
2225
+ /**
2226
+ * Options for world generation (live, prompt-steerable sessions).
2227
+ *
2228
+ * @experimental World generation is an experimental feature and may change.
2229
+ */
2230
+ export interface WorldGenerationOptions<
2231
+ TProviderOptions extends object = object,
2232
+ > {
2233
+ /** The model to use for world generation */
2234
+ model: string
2235
+ /** Natural-language description of the world or scene */
2236
+ prompt: string
2237
+ /**
2238
+ * Provider mint options. Reactor resolution/seed/audio are browser
2239
+ * `sendCommand` fields, not token-mint fields.
2240
+ */
2241
+ modelOptions?: TProviderOptions
2242
+ /**
2243
+ * Internal logger threaded from the generateWorld() entry point. Adapters
2244
+ * must call logger.request() before the SDK call and logger.errors() in
2245
+ * catch blocks.
2246
+ */
2247
+ logger: InternalLogger
2248
+ /**
2249
+ * Effective abort signal composed by the activity from caller `abortSignal`
2250
+ * and/or `timeout`. Adapters should forward this to the provider SDK when
2251
+ * supported. Request-specific — never store on a global client config.
2252
+ */
2253
+ abortSignal?: AbortSignal
2254
+ }
2255
+
2256
+ /**
2257
+ * Result of world generation. JSON-serializable so a server route can return
2258
+ * it to a browser. The browser uses `token` + `model` to open the live
2259
+ * session (set the prompt, start streaming, steer mid-run).
2260
+ *
2261
+ * @experimental World generation is an experimental feature and may change.
2262
+ */
2263
+ export interface WorldGenerationResult {
2264
+ /** Unique identifier for this generation */
2265
+ id: string
2266
+ /** Model used for generation (provider connect slug) */
2267
+ model: string
2268
+ /** Short-lived session token for the client connection */
2269
+ token: string
2270
+ /** Token expiry as milliseconds since epoch */
2271
+ expiresAt: number
2272
+ /** Prompt the client should send when it starts the session */
2273
+ prompt: string
2274
+ /** Session status after the server half finishes */
2275
+ status: 'ready' | 'waiting'
2276
+ /** Provider session id, when the adapter created one */
2277
+ sessionId?: string
2278
+ /** Token usage / billing, when the adapter can report it */
2279
+ usage?: TokenUsage
2280
+ }
2281
+
2282
+ // ============================================================================
2283
+ // Live Generation Types (Experimental)
2284
+ // ============================================================================
2285
+
2286
+ /**
2287
+ * Options for live generation (prompt-steerable video sessions).
2288
+ *
2289
+ * @experimental Live generation is an experimental feature and may change.
2290
+ */
2291
+ export interface LiveVideoGenerationOptions<
2292
+ TProviderOptions extends object = object,
2293
+ > {
2294
+ /** The model to use for live generation */
2295
+ model: string
2296
+ /** Natural-language description of the shot or scene */
2297
+ prompt: string
2298
+ /**
2299
+ * Provider mint options. For fal live this is `tokenDuration`. Reactor
2300
+ * resolution/seed/audio are browser `sendCommand` fields.
2301
+ */
2302
+ modelOptions?: TProviderOptions
2303
+ /**
2304
+ * Internal logger threaded from the generateLiveVideo() entry point. Adapters
2305
+ * must call logger.request() before the SDK call and logger.errors() in
2306
+ * catch blocks.
2307
+ */
2308
+ logger: InternalLogger
2309
+ /**
2310
+ * Effective abort signal composed by the activity from caller `abortSignal`
2311
+ * and/or `timeout`. Adapters should forward this to the provider SDK when
2312
+ * supported. Request-specific — never store on a global client config.
2313
+ */
2314
+ abortSignal?: AbortSignal
2315
+ }
2316
+
2317
+ /**
2318
+ * Result of live generation. JSON-serializable so a server route can return
2319
+ * it to a browser.
2320
+ *
2321
+ * Reactor: connect with `token` and `model` (the connect slug).
2322
+ * fal: `model` is the WMA app id. Open `wma(model)` through a server proxy
2323
+ * that attaches `FAL_KEY`. Do not send `token` as Key credentials.
2324
+ *
2325
+ * @experimental Live generation is an experimental feature and may change.
2326
+ */
2327
+ export interface LiveVideoGenerationResult {
2328
+ /** Unique identifier for this generation */
2329
+ id: string
2330
+ /**
2331
+ * Connect id for the browser client. Reactor: `reactor/helios`.
2332
+ * fal: WMA app id `fal-ai/minimax-h3-max-director`.
2333
+ */
2334
+ model: string
2335
+ /** Short-lived session token. Reactor uses this to connect. fal does not. */
2336
+ token: string
2337
+ /** Token expiry as milliseconds since epoch */
2338
+ expiresAt: number
2339
+ /** Prompt the client should send when it starts the session */
2340
+ prompt: string
2341
+ /** Session status after the server half finishes */
2342
+ status: 'ready' | 'waiting'
2343
+ /** Provider session id, when the adapter created one */
2344
+ sessionId?: string
2345
+ /** Token usage / billing, when the adapter can report it */
2346
+ usage?: TokenUsage
2347
+ }
2348
+
2221
2349
  // ============================================================================
2222
2350
  // Text-to-Speech (TTS) Types
2223
2351
  // ============================================================================