openvibers/openvibe.sdk Commits

0.135.0: ov.ai.files and the typed AI turn shapes (#179)

OP OpenVibers committed 3 days ago · 39e4fcdcc7 · 10 files, +155 −20

* Add AI file operations to the SDK

* AI files: Media-backed attach, read, list and remove (0.135.0)

Changes

ddiff --git a/CHANGELOG.md b/CHANGELOG.md
iindex 9b7349c..cf619e9 100644
---- a/CHANGELOG.md
++++ b/CHANGELOG.md
@@@ -1,9 +1,14 @@
# Changelog
++## 0.135.0 (2026-11-10)
++
++- `ov.ai.files`: attach files through Media, list/read/remove them, and expose typed `ai.file@1` and conversational turn shapes.
++
## 0.134.0 (2026-11-09)
- `ov.ai.creations()`: the public catalogue of everything AI can make on OpenVibe (`GET /api/v1/creations`, `ai.creation-list@1`) — id, product, a plain name, what you give it and what comes back, the workflow or registered task behind it, who may use it (guest, signed-in, 18+ floor), whether it can cost coins, and where to start. Cached five minutes and CORS open; no token is sent. Types: `AiCreation`, `AiCreationList`.
++
## 0.133.0 (2026-11-09)
- ov.blog.changelog({ service, kind, area, q, limit, before }): the network changelog's blog.changelog-entry@2 rows, newest first
ddiff --git a/README.md b/README.md
iindex 06620b0..c4e76c5 100644
---- a/README.md
++++ b/README.md
@@@ -13,7 +13,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
> Supported browser and server clients for the OpenVibe platform.
--**Status:** alpha, v0.134.0 (the five 1.0 core entries — `core`, `auth`, `events`, `db` and `media` — are frozen: their exported names change only with a major release; roadmap Wave 2; developer apps from Wave 20; Media objects v2 from Wave 4; the Tools platform API; Search, Chat, AI, Vision and consent clients; sign-in with recovery and a client health check). Every release is tagged (see [CHANGELOG.md](CHANGELOG.md)). Tested against local stub servers and the built-in mock platform only, never against the live platform. Services pin release tags; each repository's `STATUS.json` names the one it uses.
++**Status:** alpha, v0.135.0 (the five 1.0 core entries — `core`, `auth`, `events`, `db` and `media` — are frozen: their exported names change only with a major release; roadmap Wave 2; developer apps from Wave 20; Media objects v2 from Wave 4; the Tools platform API; Search, Chat, AI, Vision and consent clients; sign-in with recovery and a client health check). Every release is tagged (see [CHANGELOG.md](CHANGELOG.md)). Tested against local stub servers and the built-in mock platform only, never against the live platform. Services pin release tags; each repository's `STATUS.json` names the one it uses.
**Plan:** OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), §3.2; roadmap §30.
**License:** MIT ([LICENSE](LICENSE)). This package is a library that apps outside the network embed, so it uses MIT. The OpenVibe services themselves stay AGPL-3.0.
@@@ -22,7 +22,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
After v0.97.1 is tagged:
```bash
--npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.134.0
++npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.135.0
```
It has no runtime dependencies. It needs Node ≥ 20, or any browser with `fetch`, Web Crypto and `TextDecoder`. There is no build step. The package is CommonJS with ESM entry points (`import` works). Each subpath has its own `.d.ts`. For a page with no bundler, `browser/openvibe-sdk.mjs` is one self-contained ES module of the browser-safe subpaths (see [Browser without a bundler](#browser-without-a-bundler)). It does not depend on `openvibe-contracts` at runtime: it copies the contract types it uses (from the temporary Contracts sharing branch, a devDependency the tests check them against).
ddiff --git a/STATUS.json b/STATUS.json
iindex 00a3163..b3a791a 100644
---- a/STATUS.json
++++ b/STATUS.json
@@@ -3,11 +3,11 @@
"stage": "alpha",
"code": true,
"wave": "W2",
-- "version": "0.134.0",
-- "plan": "OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), §3.2; roadmap §30",
++ "version": "0.135.0",
++ "plan": "OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), \u00a73.2; roadmap \u00a730",
"deployed": false,
"deployment": "none: a package released as git tags; services and apps pin a tag",
-- "contracts": "openvibe-contracts v0.384.0",
++ "contracts": "openvibe-contracts v0.385.0",
"features": [
"menu (openvibe-sdk/menu): menuCard() builds one validated frame.menu-card@1 (plain text, the contract caps, https links on the site own origin or an openvibe.* host, an optional item picture) and menuRoute() is the Express/node:http GET /.well-known/openvibe-menu.json handler (public cache, CORS *, [] and one log line when the cards cannot be built)",
"cam (openvibe-sdk/cam): defineOvCamera({ src }) injects the <ov-camera> element from openvibe.cam once and resolves to its class, with typed attributes, events and methods (start/stop/capture/flip); browser-only, upload=\"off\" by default",
ddiff --git a/browser/openvibe-sdk.mjs b/browser/openvibe-sdk.mjs
iindex 891bd57..6d7ffa5 100644
---- a/browser/openvibe-sdk.mjs
++++ b/browser/openvibe-sdk.mjs
@@@ -1,4 +1,4 @@
--// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.134.0, MIT). Do not edit.
++// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.135.0, MIT). Do not edit.
// One self-contained ES module: core at the top level plus the browser-safe subpaths as namespaces
// (auth, locker, registry, trust, modules, realtime, media, cam, mediaUpload, ui, community, homeFeed, bot, search, bench, meme, vision, themes, design, redact, chat, ai, credentials, jobs, tools, projects, geo). No server-only code: no service tokens, JWT verification, events, identity.
/* eslint-disable */
@@@ -56,7 +56,7 @@ const { paginate, offsetPager } = __load(7);
const semver = __load(6);
/** The package version (test/version.test.js keeps it equal to package.json). */
--const SDK_VERSION = '0.134.0';
++const SDK_VERSION = '0.135.0';
module.exports = {
createClient,
@@@ -5116,7 +5116,50 @@ function createAiClient(client, defaults = {}) {
cancel: (id, o = {}) => call({ method: 'POST', path: `/api/v1/batches/${enc(id)}/cancel`, idempotencyKey: false }, o),
};
-- const api = { tasks, creations, choices, run, admin, runs, batches, TERMINAL, CLASSES };
++ // Files live in Media; turns carry only their Media object references.
++ const fileObjects = defaults.objectsClient || (defaults.media ? __load(26).createObjectsClient(defaults.media) : null);
++ const requireFiles = (method) => { if (!fileObjects) throw new TypeError(`ai.files.${method}: configure defaults.media or defaults.objectsClient`); };
++ const files = {
++ async attach(data, { filename, mediaType, subject, signal, ...options } = {}) {
++ requireFiles('attach');
++ const owner = subject || (defaults.media && defaults.media.subject);
++ if (!owner) throw new TypeError('ai.files.attach: subject (the person who may read this file) is required');
++ // Unlisted, not listed anywhere, and readable by its (unguessable) Media id: the AI service reads a
++ // turn's file by reference from Media's public bytes URL, which a private object would refuse. A caller
++ // that has a Media read path of its own may pass visibility: 'private' and send the read result instead.
++ const obj = await fileObjects.upload(data, { kind: 'file', visibility: 'unlisted', filename, mimeType: mediaType, subject: owner, signal, ...options });
++ return { id: obj.id, name: obj.filename || filename || 'file', media_type: obj.mime_type || mediaType || 'application/octet-stream', size: obj.size_bytes,
++ storage: { provider: 'media', key: obj.id }, access: { readers: [owner] },
++ read: { method: 'not_readable', reason: 'File is attached; AI has not read it yet.' }, role: 'input' };
++ },
++ async list(options = {}) {
++ requireFiles('list');
++ const page = await fileObjects.list({ kind: 'file', ...options });
++ return { ...page, files: (page.objects || []).map((obj) => ({ id: obj.id, name: obj.filename, media_type: obj.mime_type, size: obj.size_bytes,
++ storage: { provider: 'media', key: obj.id }, access: { readers: [obj.owner_id].filter(Boolean) },
++ read: { method: 'not_readable', reason: 'Read this file to obtain its contents.' }, role: 'input' })) };
++ },
++ async read(id, { ttl = 300, signal } = {}) {
++ requireFiles('read');
++ const fetchImpl = defaults.fetch || globalThis.fetch;
++ // A signed URL is the private read path. An unlisted object (an attached file, or an artifact in
++ // another tenant's namespace) is also served by its public bytes URL, so a caller without a Media
++ // read grant for that tenant can still read it by its unguessable med_… id.
++ let url = null;
++ try { url = (await fileObjects.signedUrl(id, { ttl })).url; } catch { url = null; }
++ let response = url ? await fetchImpl(url, { signal }) : null;
++ if (!response || !response.ok) {
++ const base = String((defaults.media && defaults.media.baseUrl) || (typeof fileObjects.baseUrl === 'function' ? await fileObjects.baseUrl() : '')).replace(/\/+$/, '');
++ if (!base) throw new Error(`ai.files.read: Media answered ${response ? response.status : 'no signed URL'}`);
++ response = await fetchImpl(`${base}/o/${enc(id)}`, { signal });
++ }
++ if (!response.ok) throw new Error(`ai.files.read: Media answered ${response.status}`);
++ return { file: await fileObjects.get(id), bytes: new Uint8Array(await response.arrayBuffer()) };
++ },
++ remove(id) { requireFiles('remove'); return fileObjects.delete(id); },
++ };
++
++ const api = { tasks, creations, choices, run, admin, runs, batches, files, TERMINAL, CLASSES };
// Direct operations: a run of workflow ai.<op> with the input as the body, waited for by AI.
for (const op of OPS) {
api[op] = (input = {}, o = {}) => call({ method: 'POST', path: `/api/v1/${op}`, query: waitQuery(o),
ddiff --git a/package-lock.json b/package-lock.json
iindex 4ef9d83..ec34643 100644
---- a/package-lock.json
++++ b/package-lock.json
@@@ -1,12 +1,12 @@
{
"name": "openvibe-sdk",
-- "version": "0.134.0",
++ "version": "0.135.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "openvibe-sdk",
-- "version": "0.134.0",
++ "version": "0.135.0",
"license": "MIT",
"bin": {
"openvibe-download": "bin/openvibe-download.js"
@@@ -14,7 +14,7 @@
"devDependencies": {
"@electric-sql/pglite": "^0.5.8",
"iovalkey": "^0.4.0",
-- "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.384.0",
++ "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.385.0",
"pg": "^8.23.0"
},
"engines": {
@@@ -198,9 +198,9 @@
"license": "MIT"
},
"node_modules/openvibe-contracts": {
-- "version": "0.384.0",
-- "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.384.0",
-- "integrity": "sha512-tPQTkz3os5b2olND5LUICvMOKaH1EOz3usDxRMZCplDlMuvixgZpFbofXtGj1mt2acW3+H/5CBfLCObA1CWe6Q==",
++ "version": "0.385.0",
++ "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.385.0",
++ "integrity": "sha512-3wf2bLck5fcOblMYOcIutxRCYeJRqEOqf1bEReCUkJ/AvzVS7/Uq2Cpp9zmSjNkajTd8b3DKQ7WRSaMppQ92yg==",
"dev": true,
"license": "AGPL-3.0-only",
"dependencies": {
ddiff --git a/package.json b/package.json
iindex 7600ec3..1faa6d7 100644
---- a/package.json
++++ b/package.json
@@@ -1,6 +1,6 @@
{
"name": "openvibe-sdk",
-- "version": "0.134.0",
++ "version": "0.135.0",
"description": "Supported browser and server clients for the OpenVibe platform: auth (incl. developer apps), registry discovery, identity, user modules, events, realtime, media, community, Bot robots, search, chat, AI runs, Tools (registry, run API and jobs), VIP memberships and developer projects, the async PostgreSQL data layer (db) and the Valkey cache, limits store, queue and pub/sub, with deadlines, safe retries, problem errors and trace propagation.",
"main": "index.js",
"types": "types/index.d.ts",
@@@ -624,7 +624,7 @@
"devDependencies": {
"@electric-sql/pglite": "^0.5.8",
"iovalkey": "^0.4.0",
-- "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.384.0",
++ "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.385.0",
"pg": "^8.23.0"
},
"peerDependencies": {
ddiff --git a/src/ai.js b/src/ai.js
iindex 5d82751..ee953b2 100644
---- a/src/ai.js
++++ b/src/ai.js
@@@ -131,7 +131,50 @@ function createAiClient(client, defaults = {}) {
cancel: (id, o = {}) => call({ method: 'POST', path: `/api/v1/batches/${enc(id)}/cancel`, idempotencyKey: false }, o),
};
-- const api = { tasks, creations, choices, run, admin, runs, batches, TERMINAL, CLASSES };
++ // Files live in Media; turns carry only their Media object references.
++ const fileObjects = defaults.objectsClient || (defaults.media ? require('./objects').createObjectsClient(defaults.media) : null);
++ const requireFiles = (method) => { if (!fileObjects) throw new TypeError(`ai.files.${method}: configure defaults.media or defaults.objectsClient`); };
++ const files = {
++ async attach(data, { filename, mediaType, subject, signal, ...options } = {}) {
++ requireFiles('attach');
++ const owner = subject || (defaults.media && defaults.media.subject);
++ if (!owner) throw new TypeError('ai.files.attach: subject (the person who may read this file) is required');
++ // Unlisted, not listed anywhere, and readable by its (unguessable) Media id: the AI service reads a
++ // turn's file by reference from Media's public bytes URL, which a private object would refuse. A caller
++ // that has a Media read path of its own may pass visibility: 'private' and send the read result instead.
++ const obj = await fileObjects.upload(data, { kind: 'file', visibility: 'unlisted', filename, mimeType: mediaType, subject: owner, signal, ...options });
++ return { id: obj.id, name: obj.filename || filename || 'file', media_type: obj.mime_type || mediaType || 'application/octet-stream', size: obj.size_bytes,
++ storage: { provider: 'media', key: obj.id }, access: { readers: [owner] },
++ read: { method: 'not_readable', reason: 'File is attached; AI has not read it yet.' }, role: 'input' };
++ },
++ async list(options = {}) {
++ requireFiles('list');
++ const page = await fileObjects.list({ kind: 'file', ...options });
++ return { ...page, files: (page.objects || []).map((obj) => ({ id: obj.id, name: obj.filename, media_type: obj.mime_type, size: obj.size_bytes,
++ storage: { provider: 'media', key: obj.id }, access: { readers: [obj.owner_id].filter(Boolean) },
++ read: { method: 'not_readable', reason: 'Read this file to obtain its contents.' }, role: 'input' })) };
++ },
++ async read(id, { ttl = 300, signal } = {}) {
++ requireFiles('read');
++ const fetchImpl = defaults.fetch || globalThis.fetch;
++ // A signed URL is the private read path. An unlisted object (an attached file, or an artifact in
++ // another tenant's namespace) is also served by its public bytes URL, so a caller without a Media
++ // read grant for that tenant can still read it by its unguessable med_… id.
++ let url = null;
++ try { url = (await fileObjects.signedUrl(id, { ttl })).url; } catch { url = null; }
++ let response = url ? await fetchImpl(url, { signal }) : null;
++ if (!response || !response.ok) {
++ const base = String((defaults.media && defaults.media.baseUrl) || (typeof fileObjects.baseUrl === 'function' ? await fileObjects.baseUrl() : '')).replace(/\/+$/, '');
++ if (!base) throw new Error(`ai.files.read: Media answered ${response ? response.status : 'no signed URL'}`);
++ response = await fetchImpl(`${base}/o/${enc(id)}`, { signal });
++ }
++ if (!response.ok) throw new Error(`ai.files.read: Media answered ${response.status}`);
++ return { file: await fileObjects.get(id), bytes: new Uint8Array(await response.arrayBuffer()) };
++ },
++ remove(id) { requireFiles('remove'); return fileObjects.delete(id); },
++ };
++
++ const api = { tasks, creations, choices, run, admin, runs, batches, files, TERMINAL, CLASSES };
// Direct operations: a run of workflow ai.<op> with the input as the body, waited for by AI.
for (const op of OPS) {
api[op] = (input = {}, o = {}) => call({ method: 'POST', path: `/api/v1/${op}`, query: waitQuery(o),
ddiff --git a/src/core/index.js b/src/core/index.js
iindex 0918347..a029f03 100644
---- a/src/core/index.js
++++ b/src/core/index.js
@@@ -8,7 +8,7 @@ const { paginate, offsetPager } = require('./paginate');
const semver = require('./semver');
/** The package version (test/version.test.js keeps it equal to package.json). */
--const SDK_VERSION = '0.134.0';
++const SDK_VERSION = '0.135.0';
module.exports = {
createClient,
ddiff --git a/test/ai-files.test.js b/test/ai-files.test.js
nnew file mode 100644
iindex 0000000..63d7b21
---- /dev/null
++++ b/test/ai-files.test.js
@@@ -0,0 +1,39 @@
++'use strict';
++const assert = require('node:assert/strict');
++const { run } = require('./helpers');
++const { createAiClient } = require('../src/ai');
++
++run([
++ ['ov.ai.files attaches unlisted Media files, lists, reads and removes by Media object id', async () => {
++ const calls = [];
++ const objects = {
++ upload: async (data, opts) => { calls.push(['upload', data, opts]); return { id: 'med_01ARZ3NDEKTSV4RRFFQ69G5FAV', filename: opts.filename, mime_type: opts.mimeType, size_bytes: 3 }; },
++ list: async (q) => { calls.push(['list', q]); return { objects: [{ id: 'med_01ARZ3NDEKTSV4RRFFQ69G5FAV', filename: 'a.txt', mime_type: 'text/plain', size_bytes: 3, owner_id: 'usr_01ARZ3NDEKTSV4RRFFQ69G5FAV' }], next_cursor: null }; },
++ signedUrl: async (id) => ({ url: `https://media.test/${id}` }),
++ get: async (id) => ({ id }), delete: async (id) => { calls.push(['delete', id]); return true; },
++ };
++ const ai = createAiClient({ json: async () => ({}) }, { objectsClient: objects, fetch: async () => ({ ok: true, arrayBuffer: async () => Uint8Array.from([1, 2, 3]).buffer }) });
++ const file = await ai.files.attach('abc', { filename: 'a.txt', mediaType: 'text/plain', subject: 'usr_01ARZ3NDEKTSV4RRFFQ69G5FAV' });
++ assert.equal(file.storage.provider, 'media');
++ assert.deepEqual(file.access.readers, ['usr_01ARZ3NDEKTSV4RRFFQ69G5FAV']);
++ assert.equal(calls[0][2].visibility, 'unlisted', 'the AI service reads it by its public Media bytes URL');
++ assert.equal((await ai.files.list()).files[0].name, 'a.txt');
++ assert.deepEqual([...((await ai.files.read(file.id)).bytes)], [1, 2, 3]);
++ assert.equal(await ai.files.remove(file.id), true);
++ }],
++ ['a read falls back to the public Media bytes URL when this caller has no signed URL for the tenant', async () => {
++ const urls = [];
++ const objects = {
++ upload: async () => ({ id: 'med_01ARZ3NDEKTSV4RRFFQ69G5FAV', filename: 'a.txt', mime_type: 'text/plain', size_bytes: 3 }),
++ list: async () => ({ objects: [] }), get: async (id) => ({ id }), delete: async () => true,
++ signedUrl: async () => { throw new Error('media.object.read not granted'); },
++ baseUrl: async () => 'https://openvibe.media/',
++ };
++ const ai = createAiClient({ json: async () => ({}) }, {
++ objectsClient: objects,
++ fetch: async (url) => { urls.push(url); return { ok: true, arrayBuffer: async () => Uint8Array.from([7]).buffer }; },
++ });
++ assert.deepEqual([...(await ai.files.read('med_01ARZ3NDEKTSV4RRFFQ69G5FAV')).bytes], [7]);
++ assert.deepEqual(urls, ['https://openvibe.media/o/med_01ARZ3NDEKTSV4RRFFQ69G5FAV']);
++ }],
++]);
ddiff --git a/types/ai.d.ts b/types/ai.d.ts
iindex 83ddca4..c68ea47 100644
---- a/types/ai.d.ts
++++ b/types/ai.d.ts
@@@ -1,6 +1,11 @@
import type { OpenVibeClient } from './core';
export interface AiRun { id: string; status: 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled' | string; workflow?: { key: string; version: number }; output?: unknown; error?: unknown; latency_class?: LatencyClass; service_tier?: ServiceTier | null; latency_clamped?: { asked: LatencyClass; used: LatencyClass } | null; [field: string]: unknown; }
++export interface AiFile { id: string; name: string; media_type: string; size: number; storage: { provider: 'media'; key: string }; access: { readers: string[] }; read: { method: 'text' | 'pages' | 'image' | 'audio_transcript' | 'not_readable'; content?: string; pages?: string[]; reason?: string }; role?: 'input' | 'artifact'; }
++export interface AiTurnMessage { role: 'user' | 'assistant'; content: string; files?: AiFile[]; }
++export interface AiTurnRequest { messages: AiTurnMessage[]; files?: AiFile[]; }
++export interface AiTurnResult { content: string; artifacts: AiFile[]; }
++export interface AiFiles { attach(data: Blob | ArrayBuffer | ArrayBufferView | string, opts?: { filename?: string; mediaType?: string; subject?: string; signal?: AbortSignal; [option: string]: unknown }): Promise<AiFile>; list(opts?: Record<string, unknown>): Promise<{ files: AiFile[]; [field: string]: unknown }>; read(id: string, opts?: { ttl?: number; signal?: AbortSignal }): Promise<{ file: unknown; bytes: Uint8Array }>; remove(id: string): Promise<boolean>; }
/** How long the caller may wait: interactive (as soon as the provider can), background (minutes, priced on the cheapest tier that can wait), batch (hours, answered through the provider's own batch API). */
export type LatencyClass = 'interactive' | 'background' | 'batch';
/** The tier a run was priced on: the one the provider served (standard, flex, batch) or the one the router chose (offpeak, local). */
@@@ -65,8 +70,8 @@ export interface AiBatches {
cancel(id: string, opts?: { signal?: AbortSignal }): Promise<{ batch: AiBatch }>;
}
type Op = (input?: Record<string, unknown>, opts?: Omit<RunOptions, 'version' | 'onBehalfOf'>) => Promise<RunResponse>;
--export interface AiClient { tasks(opts?: {signal?: AbortSignal}): Promise<{tasks: AiTask[]}>; creations(opts?: {signal?: AbortSignal}): Promise<AiCreationList>; run(task: string, input?: Record<string, unknown>, opts?: RunOptions): Promise<RunResponse>; choices: { get(task: string, opts?: {signal?: AbortSignal}): Promise<{task: AiTask; choice: AiChoice; why: string; options: Record<string, unknown[]>}>; set(task: string, choice: AiChoice, opts?: {signal?: AbortSignal}): Promise<{choice: AiChoice}> }; admin: { defaults(value?: {defaults: Array<{task: string; value: AiTaskDefaults}>}, opts?: {signal?: AbortSignal}): Promise<{tasks?: AiTask[]; defaults: Record<string, AiTaskDefaults>}> }; runs: AiRuns; batches: AiBatches; TERMINAL: Set<string>; CLASSES: string[]; chat: Op; generate: Op; summarize: Op; classify: Op; extract: Op; enrich: Op; embed: Op; }
--export function createAiClient(client: OpenVibeClient, defaults?: { baseUrl?: string }): AiClient;
++export interface AiClient { tasks(opts?: {signal?: AbortSignal}): Promise<{tasks: AiTask[]}>; creations(opts?: {signal?: AbortSignal}): Promise<AiCreationList>; run(task: string, input?: Record<string, unknown>, opts?: RunOptions): Promise<RunResponse>; choices: { get(task: string, opts?: {signal?: AbortSignal}): Promise<{task: AiTask; choice: AiChoice; why: string; options: Record<string, unknown[]>}>; set(task: string, choice: AiChoice, opts?: {signal?: AbortSignal}): Promise<{choice: AiChoice}> }; admin: { defaults(value?: {defaults: Array<{task: string; value: AiTaskDefaults}>}, opts?: {signal?: AbortSignal}): Promise<{tasks?: AiTask[]; defaults: Record<string, AiTaskDefaults>}> }; runs: AiRuns; batches: AiBatches; files: AiFiles; TERMINAL: Set<string>; CLASSES: string[]; chat: Op; generate: Op; summarize: Op; classify: Op; extract: Op; enrich: Op; embed: Op; }
++export function createAiClient(client: OpenVibeClient, defaults?: { baseUrl?: string; media?: Record<string, unknown> & { app: string; subject?: string }; objectsClient?: { upload: Function; list: Function; signedUrl: Function; get: Function; delete: Function }; fetch?: typeof fetch }): AiClient;
export const TERMINAL: Set<string>;
export const OPS: string[];
export const CLASSES: string[];