openvibers/openvibe.sdk Commits
0.132.0: ov.wiki articles on blocks, picture suggestions and the writer (#175)
Changes
@@@ -1,5 +1,9 @@# Changelog++## 0.132.0 (2026-11-09)++++- `openvibe-sdk/wiki`: articles on blocks (`articles.create`/`update({ blocks })`, `pages.blocks`), picture suggestions from the `wiki.article.images` task (`images.suggest`), and the `content.wiki` writer (`articles.draft`), whose revision is a pending proposal a person reviews.++## 0.131.0 (2026-11-09)- openvibe-sdk/community: the Feed's types complete, with pagination guidance@@@ -10,7 +10,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.131.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.132.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.@@@ -19,7 +19,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tagsAfter v0.97.1 is tagged:```bash--npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.131.0++npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.132.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).@@@ -3,7 +3,7 @@"stage": "alpha","code": true,"wave": "W2",-- "version": "0.131.0",++ "version": "0.132.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",@@@ -1,4 +1,4 @@--// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.131.0, MIT). Do not edit.++// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.132.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.131.0';++const SDK_VERSION = '0.132.0';module.exports = {createClient,@@@ -1,12 +1,12 @@{"name": "openvibe-sdk",-- "version": "0.131.0",++ "version": "0.132.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "openvibe-sdk",-- "version": "0.131.0",++ "version": "0.132.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.375.0",++ "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.379.0","pg": "^8.23.0"},"engines": {@@@ -198,9 +198,9 @@"license": "MIT"},"node_modules/openvibe-contracts": {-- "version": "0.375.0",-- "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.375.0",-- "integrity": "sha512-+HI3XAkqkDW1ANR0SyGSXAYTko/z0SsDB9uIdswQCiYixoS/9M3RYGqPOFr+VevvZH9CG9hXvW0Tp3ecc0qaXw==",++ "version": "0.379.0",++ "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.379.0",++ "integrity": "sha512-svsHkIGui4y0K1WGnkM2X2gFr1wdHAqH+7vnefYdtybnX0Ze8j8Ue0inI1yYPVqWMPFAggTyVcKV9grLeIO2BA==","dev": true,"license": "AGPL-3.0-only","dependencies": {@@@ -1,6 +1,6 @@{"name": "openvibe-sdk",-- "version": "0.131.0",++ "version": "0.132.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.375.0",++ "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.379.0","pg": "^8.23.0"},"peerDependencies": {@@@ -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.131.0';++const SDK_VERSION = '0.132.0';module.exports = {createClient,@@@ -1,7 +1,8 @@'use strict';/*** openvibe-sdk/wiki — OpenVibe.Wiki for apps: search pages and read them (the revision the person may read, its history,-- * diffs and citations), and list the spaces. Routes at https://openvibe.wiki/api/v1; tokens for audience++ * diffs and citations), list the spaces, write articles as Markdown or blocks, ask for licensed pictures, and run the++ * wiki writer, which files a draft proposal a person reviews. Routes at https://openvibe.wiki/api/v1; tokens for audience* openvibe.wiki. A developer app acts only for the person who authorized it (on_behalf_of); without a person, only* public, published pages are visible.*@@@ -10,10 +11,14 @@* const page = await wiki.pages.get(results[0].id); // the published revision* const { revisions } = await wiki.pages.revisions(results[0].id, { limit: 10 });* const diff = await wiki.pages.diff(results[0].id, { from: 3, to: 4 });++ * await wiki.articles.create('openvibe', { title: 'Restreaming', blocks: { type: 'root', children: [] } });++ * await wiki.articles.update(page.id, { expected_revision: 3, blocks: tree });++ * const { suggestions } = await wiki.images.suggest(page.id); // the wiki.article.images task++ * const { proposal } = await wiki.articles.draft(page.id, { instruction: 'Add the setup section' });** Capabilities (public since openvibe-contracts 0.207.0): wiki.page.read and wiki.search.query. Writing pages stays* with people on openvibe.wiki and first-party services. Errors are OpenVibeError: page.not_found, space.not_found,-- * revision.not_found, capability.denied, subject.not_delegated, …++ * revision.not_found, page.invalid_blocks, capability.denied, subject.not_delegated, …*/const enc = encodeURIComponent;const PAGE_ID_RE = /^pg_[0-9A-HJKMNP-TV-Z]{26}$/; // the Wiki's own rule@@@ -49,6 +54,33 @@ function createWikiClient(client, { baseUrl } = {}) {revision: (id, n, { signal } = {}) => call({ path: page(id, `/revisions/${rev(n)}`), signal }),diff: (id, { from, to, mode, signal } = {}) => call({ path: page(id, '/diff'), query: { from: rev(from), to: rev(to), mode }, signal }),citations: (id, n, { signal } = {}) => call({ path: page(id, `/revisions/${rev(n)}/citations`), signal }),++ /** The revision's body as a block tree (GET /pages/:id?format=blocks). */++ blocks: (id, { revision, signal } = {}) => call({ path: page(id), query: { format: 'blocks', revision: revision == null ? undefined : rev(revision) }, signal }),++ },++ articles: {++ /**++ * A new page in a space the person may edit (wiki.page-write-request@1: title required) → { page, revision }.++ * The body is Markdown ({ body }) or the blocks of a body ({ blocks }): the Markdown is what the wiki keeps,++ * so blocks are written back as the Markdown they serialize to.++ */++ create: (space, fields, { signal } = {}) => {++ if (!space || typeof space !== 'string') throw new TypeError('wiki.articles.create: a space');++ if (!fields || typeof fields.title !== 'string' || !fields.title.trim()) throw new TypeError('wiki.articles.create: a title');++ if (fields.blocks != null && typeof fields.blocks !== 'object') throw new TypeError('wiki.articles.create: blocks is a block tree');++ return call({ method: 'POST', path: `/api/v1/spaces/${enc(space)}/pages`, json: fields, idempotencyKey: false, signal });++ },++ /** Edit: a new revision ({ expected_revision } guards a race); blocks work like create's → { page, revision }. */++ update: (id, fields, { signal } = {}) => {++ if (!fields || typeof fields !== 'object') throw new TypeError('wiki.articles.update: the fields to change');++ if (fields.blocks != null && typeof fields.blocks !== 'object') throw new TypeError('wiki.articles.update: blocks is a block tree');++ return call({ method: 'POST', path: page(id, '/revisions'), json: fields, idempotencyKey: false, signal });++ },++ /** Run the content.wiki writer and file its revision as a pending proposal (never published) → { proposal }. */++ draft: (id, fields = {}, { signal } = {}) => call({ method: 'POST', path: page(id, '/draft'), json: fields, idempotencyKey: false, signal }),++ },++ images: {++ /** The wiki.article.images task's candidates for an article: Commons and Openverse, Pics and Media, then AI. */++ suggest: (id, fields = {}, { signal } = {}) => call({ method: 'POST', path: page(id, '/images/suggest'), json: fields, idempotencyKey: false, signal }),},};}@@@ -294,14 +294,29 @@ const ids = { plan: `pln_${ULID}`, task: `tsk_${ULID}`, agent: `agt_${ULID}`, meawait wiki.pages.revision(ids.page, 4);await wiki.pages.diff(ids.page, { from: 3, to: 4, mode: 'words' });await wiki.pages.citations(ids.page, 4);++ await wiki.pages.blocks(ids.page, { revision: 4 });++ await busyOnce(() => wiki.articles.create('openvibe', { title: 'Restreaming', blocks: { type: 'root', children: [] } }));++ await wiki.articles.create('openvibe', { title: 'Restreaming', blocks: { type: 'root', children: [] } });++ await busyOnce(() => wiki.articles.update(ids.page, { expected_revision: 4, blocks: { type: 'root', children: [] } }));++ await wiki.articles.update(ids.page, { expected_revision: 4, blocks: { type: 'root', children: [] } });++ await busyOnce(() => wiki.images.suggest(ids.page, { query: 'Restreaming', count: 4 }));++ await wiki.images.suggest(ids.page, { query: 'Restreaming', count: 4 });++ await busyOnce(() => wiki.articles.draft(ids.page, { instruction: 'Add the setup section' }));++ await wiki.articles.draft(ids.page, { instruction: 'Add the setup section' });const W = `/api/v1/pages/${ids.page}`;assert.deepStrictEqual(mark().map((x) => `${x.method} ${x.url}`), ['GET /api/v1/search?q=restreaming&space=openvibe&limit=5', 'GET /api/v1/spaces', 'GET /api/v1/spaces/openvibe', `GET ${W}?revision=4`,`GET ${W}/revisions?limit=10`, `GET ${W}/revisions/4`, `GET ${W}/diff?from=3&to=4&mode=words`, `GET ${W}/revisions/4/citations`,++ `GET ${W}?format=blocks&revision=4`,++ 'POST /api/v1/spaces/openvibe/pages', 'POST /api/v1/spaces/openvibe/pages', `POST ${W}/revisions`, `POST ${W}/revisions`,++ `POST ${W}/images/suggest`, `POST ${W}/images/suggest`, `POST ${W}/draft`, `POST ${W}/draft`,]);assert.throws(() => wiki.search(''), /search for/);assert.throws(() => wiki.pages.get('page_1'), /pg_/);assert.throws(() => wiki.pages.diff(ids.page, { from: 0, to: 2 }), /revision number/);++ assert.throws(() => wiki.articles.create('openvibe', { blocks: { type: 'root' } }), /title/);++ assert.throws(() => wiki.articles.create('openvibe', { title: 'X', blocks: 'root' }), /block tree/);++ assert.throws(() => wiki.articles.update(ids.page, null), /fields/);// ── Coupons ───────────────────────────────────────────const coupons = createCouponsClient(client);@@@ -1,6 +1,18 @@--/** openvibe-sdk/wiki: OpenVibe.Wiki's reads — search, spaces, pages, revisions, diffs and citations. */++/** openvibe-sdk/wiki: OpenVibe.Wiki's reads, article writes, picture suggestions and the wiki writer. */type Opts = { signal?: AbortSignal };type WikiJson = Record<string, any>;++type BlockTree = { type: 'root'; children?: unknown[]; [key: string]: unknown };++export interface WikiImagesSuggestFields {++ query?: string | null;++ section?: string | null;++ count?: number;++ allow_ai?: boolean;++ choice?: { model: string; source: 'openvibe' | 'keys' | 'machines'; machine?: string };++}++export interface WikiArticleDraftFields {++ instruction?: string | null;++ choice?: { model: string; source: 'openvibe' | 'keys' | 'machines'; machine?: string };++}export interface WikiClient {search(q: string, opts?: Opts & { space?: string; limit?: number }): Promise<{ results: WikiJson[] }>;spaces: { list(opts?: Opts): Promise<WikiJson>; get(space: string, opts?: Opts): Promise<WikiJson> };@@@ -10,6 +22,15 @@ export interface WikiClient {revision(id: string, n: number, opts?: Opts): Promise<WikiJson>;diff(id: string, opts: Opts & { from: number; to: number; mode?: string }): Promise<WikiJson>;citations(id: string, n: number, opts?: Opts): Promise<WikiJson>;++ blocks(id: string, opts?: Opts & { revision?: number }): Promise<WikiJson>;++ };++ articles: {++ create(space: string, fields: { title: string; body?: string; blocks?: BlockTree; summary?: string | null; parent_id?: string | null; visibility?: 'public' | 'members' | 'vip' | 'private' }, opts?: Opts): Promise<WikiJson>;++ update(id: string, fields: { expected_revision?: number; title?: string; body?: string; blocks?: BlockTree; summary?: string | null; message?: string | null }, opts?: Opts): Promise<WikiJson>;++ draft(id: string, fields?: WikiArticleDraftFields, opts?: Opts): Promise<WikiJson>;++ };++ images: {++ suggest(id: string, fields?: WikiImagesSuggestFields, opts?: Opts): Promise<WikiJson>;};}export function createWikiClient(client: { json(opts: Record<string, unknown>): Promise<any> }, options?: { baseUrl?: string }): WikiClient;
@@ -1,5 +1,9 @@
@@ -1,5 +1,9 @@
# Changelog
# Changelog
+## 0.132.0 (2026-11-09)
+
+- `openvibe-sdk/wiki`: articles on blocks (`articles.create`/`update({ blocks })`, `pages.blocks`), picture suggestions from the `wiki.article.images` task (`images.suggest`), and the `content.wiki` writer (`articles.draft`), whose revision is a pending proposal a person reviews.
+
## 0.131.0 (2026-11-09)
## 0.131.0 (2026-11-09)
- openvibe-sdk/community: the Feed's types complete, with pagination guidance
- openvibe-sdk/community: the Feed's types complete, with pagination guidance
@@ -10,7 +10,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
@@ -10,7 +10,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
> Supported browser and server clients for the OpenVibe platform.
> Supported browser and server clients for the OpenVibe platform.
-**Status:** alpha, v0.131.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.132.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.
**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.
**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.
@@ -19,7 +19,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
@@ -19,7 +19,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
After v0.97.1 is tagged:
After v0.97.1 is tagged:
```bash
```bash
-npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.131.0
+npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.132.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).
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).
@@ -3,7 +3,7 @@
@@ -3,7 +3,7 @@
"stage": "alpha",
"stage": "alpha",
"code": true,
"code": true,
"wave": "W2",
"wave": "W2",
- "version": "0.131.0",
+ "version": "0.132.0",
"plan": "OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), \u00a73.2; roadmap \u00a730",
"plan": "OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), \u00a73.2; roadmap \u00a730",
"deployed": false,
"deployed": false,
"deployment": "none: a package released as git tags; services and apps pin a tag",
"deployment": "none: a package released as git tags; services and apps pin a tag",
@@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
-// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.131.0, MIT). Do not edit.
+// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.132.0, MIT). Do not edit.
// One self-contained ES module: core at the top level plus the browser-safe subpaths as namespaces
// 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.
// (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 */
/* eslint-disable */
@@ -56,7 +56,7 @@ const { paginate, offsetPager } = __load(7);
@@ -56,7 +56,7 @@ const { paginate, offsetPager } = __load(7);
const semver = __load(6);
const semver = __load(6);
/** The package version (test/version.test.js keeps it equal to package.json). */
/** The package version (test/version.test.js keeps it equal to package.json). */
-const SDK_VERSION = '0.131.0';
+const SDK_VERSION = '0.132.0';
module.exports = {
module.exports = {
createClient,
createClient,
@@ -1,12 +1,12 @@
@@ -1,12 +1,12 @@
{
{
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.131.0",
+ "version": "0.132.0",
"lockfileVersion": 3,
"lockfileVersion": 3,
"requires": true,
"requires": true,
"packages": {
"packages": {
"": {
"": {
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.131.0",
+ "version": "0.132.0",
"license": "MIT",
"license": "MIT",
"bin": {
"bin": {
"openvibe-download": "bin/openvibe-download.js"
"openvibe-download": "bin/openvibe-download.js"
@@ -14,7 +14,7 @@
@@ -14,7 +14,7 @@
"devDependencies": {
"devDependencies": {
"@electric-sql/pglite": "^0.5.8",
"@electric-sql/pglite": "^0.5.8",
"iovalkey": "^0.4.0",
"iovalkey": "^0.4.0",
- "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.375.0",
+ "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.379.0",
"pg": "^8.23.0"
"pg": "^8.23.0"
},
},
"engines": {
"engines": {
@@ -198,9 +198,9 @@
@@ -198,9 +198,9 @@
"license": "MIT"
"license": "MIT"
},
},
"node_modules/openvibe-contracts": {
"node_modules/openvibe-contracts": {
- "version": "0.375.0",
- "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.375.0",
- "integrity": "sha512-+HI3XAkqkDW1ANR0SyGSXAYTko/z0SsDB9uIdswQCiYixoS/9M3RYGqPOFr+VevvZH9CG9hXvW0Tp3ecc0qaXw==",
+ "version": "0.379.0",
+ "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.379.0",
+ "integrity": "sha512-svsHkIGui4y0K1WGnkM2X2gFr1wdHAqH+7vnefYdtybnX0Ze8j8Ue0inI1yYPVqWMPFAggTyVcKV9grLeIO2BA==",
"dev": true,
"dev": true,
"license": "AGPL-3.0-only",
"license": "AGPL-3.0-only",
"dependencies": {
"dependencies": {
@@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
{
{
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.131.0",
+ "version": "0.132.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.",
"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",
"main": "index.js",
"types": "types/index.d.ts",
"types": "types/index.d.ts",
@@ -624,7 +624,7 @@
@@ -624,7 +624,7 @@
"devDependencies": {
"devDependencies": {
"@electric-sql/pglite": "^0.5.8",
"@electric-sql/pglite": "^0.5.8",
"iovalkey": "^0.4.0",
"iovalkey": "^0.4.0",
- "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.375.0",
+ "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.379.0",
"pg": "^8.23.0"
"pg": "^8.23.0"
},
},
"peerDependencies": {
"peerDependencies": {
@@ -8,7 +8,7 @@ const { paginate, offsetPager } = require('./paginate');
@@ -8,7 +8,7 @@ const { paginate, offsetPager } = require('./paginate');
const semver = require('./semver');
const semver = require('./semver');
/** The package version (test/version.test.js keeps it equal to package.json). */
/** The package version (test/version.test.js keeps it equal to package.json). */
-const SDK_VERSION = '0.131.0';
+const SDK_VERSION = '0.132.0';
module.exports = {
module.exports = {
createClient,
createClient,
@@ -1,7 +1,8 @@
@@ -1,7 +1,8 @@
'use strict';
'use strict';
/**
/**
* openvibe-sdk/wiki — OpenVibe.Wiki for apps: search pages and read them (the revision the person may read, its history,
* openvibe-sdk/wiki — OpenVibe.Wiki for apps: search pages and read them (the revision the person may read, its history,
- * diffs and citations), and list the spaces. Routes at https://openvibe.wiki/api/v1; tokens for audience
+ * diffs and citations), list the spaces, write articles as Markdown or blocks, ask for licensed pictures, and run the
+ * wiki writer, which files a draft proposal a person reviews. Routes at https://openvibe.wiki/api/v1; tokens for audience
* openvibe.wiki. A developer app acts only for the person who authorized it (on_behalf_of); without a person, only
* openvibe.wiki. A developer app acts only for the person who authorized it (on_behalf_of); without a person, only
* public, published pages are visible.
* public, published pages are visible.
*
*
@@ -10,10 +11,14 @@
@@ -10,10 +11,14 @@
* const page = await wiki.pages.get(results[0].id); // the published revision
* const page = await wiki.pages.get(results[0].id); // the published revision
* const { revisions } = await wiki.pages.revisions(results[0].id, { limit: 10 });
* const { revisions } = await wiki.pages.revisions(results[0].id, { limit: 10 });
* const diff = await wiki.pages.diff(results[0].id, { from: 3, to: 4 });
* const diff = await wiki.pages.diff(results[0].id, { from: 3, to: 4 });
+ * await wiki.articles.create('openvibe', { title: 'Restreaming', blocks: { type: 'root', children: [] } });
+ * await wiki.articles.update(page.id, { expected_revision: 3, blocks: tree });
+ * const { suggestions } = await wiki.images.suggest(page.id); // the wiki.article.images task
+ * const { proposal } = await wiki.articles.draft(page.id, { instruction: 'Add the setup section' });
*
*
* Capabilities (public since openvibe-contracts 0.207.0): wiki.page.read and wiki.search.query. Writing pages stays
* Capabilities (public since openvibe-contracts 0.207.0): wiki.page.read and wiki.search.query. Writing pages stays
* with people on openvibe.wiki and first-party services. Errors are OpenVibeError: page.not_found, space.not_found,
* with people on openvibe.wiki and first-party services. Errors are OpenVibeError: page.not_found, space.not_found,
- * revision.not_found, capability.denied, subject.not_delegated, …
+ * revision.not_found, page.invalid_blocks, capability.denied, subject.not_delegated, …
*/
*/
const enc = encodeURIComponent;
const enc = encodeURIComponent;
const PAGE_ID_RE = /^pg_[0-9A-HJKMNP-TV-Z]{26}$/; // the Wiki's own rule
const PAGE_ID_RE = /^pg_[0-9A-HJKMNP-TV-Z]{26}$/; // the Wiki's own rule
@@ -49,6 +54,33 @@ function createWikiClient(client, { baseUrl } = {}) {
@@ -49,6 +54,33 @@ function createWikiClient(client, { baseUrl } = {}) {
revision: (id, n, { signal } = {}) => call({ path: page(id, `/revisions/${rev(n)}`), signal }),
revision: (id, n, { signal } = {}) => call({ path: page(id, `/revisions/${rev(n)}`), signal }),
diff: (id, { from, to, mode, signal } = {}) => call({ path: page(id, '/diff'), query: { from: rev(from), to: rev(to), mode }, signal }),
diff: (id, { from, to, mode, signal } = {}) => call({ path: page(id, '/diff'), query: { from: rev(from), to: rev(to), mode }, signal }),
citations: (id, n, { signal } = {}) => call({ path: page(id, `/revisions/${rev(n)}/citations`), signal }),
citations: (id, n, { signal } = {}) => call({ path: page(id, `/revisions/${rev(n)}/citations`), signal }),
+ /** The revision's body as a block tree (GET /pages/:id?format=blocks). */
+ blocks: (id, { revision, signal } = {}) => call({ path: page(id), query: { format: 'blocks', revision: revision == null ? undefined : rev(revision) }, signal }),
+ },
+ articles: {
+ /**
+ * A new page in a space the person may edit (wiki.page-write-request@1: title required) → { page, revision }.
+ * The body is Markdown ({ body }) or the blocks of a body ({ blocks }): the Markdown is what the wiki keeps,
+ * so blocks are written back as the Markdown they serialize to.
+ */
+ create: (space, fields, { signal } = {}) => {
+ if (!space || typeof space !== 'string') throw new TypeError('wiki.articles.create: a space');
+ if (!fields || typeof fields.title !== 'string' || !fields.title.trim()) throw new TypeError('wiki.articles.create: a title');
+ if (fields.blocks != null && typeof fields.blocks !== 'object') throw new TypeError('wiki.articles.create: blocks is a block tree');
+ return call({ method: 'POST', path: `/api/v1/spaces/${enc(space)}/pages`, json: fields, idempotencyKey: false, signal });
+ },
+ /** Edit: a new revision ({ expected_revision } guards a race); blocks work like create's → { page, revision }. */
+ update: (id, fields, { signal } = {}) => {
+ if (!fields || typeof fields !== 'object') throw new TypeError('wiki.articles.update: the fields to change');
+ if (fields.blocks != null && typeof fields.blocks !== 'object') throw new TypeError('wiki.articles.update: blocks is a block tree');
+ return call({ method: 'POST', path: page(id, '/revisions'), json: fields, idempotencyKey: false, signal });
+ },
+ /** Run the content.wiki writer and file its revision as a pending proposal (never published) → { proposal }. */
+ draft: (id, fields = {}, { signal } = {}) => call({ method: 'POST', path: page(id, '/draft'), json: fields, idempotencyKey: false, signal }),
+ },
+ images: {
+ /** The wiki.article.images task's candidates for an article: Commons and Openverse, Pics and Media, then AI. */
+ suggest: (id, fields = {}, { signal } = {}) => call({ method: 'POST', path: page(id, '/images/suggest'), json: fields, idempotencyKey: false, signal }),
},
},
};
};
}
}
@@ -294,14 +294,29 @@ const ids = { plan: `pln_${ULID}`, task: `tsk_${ULID}`, agent: `agt_${ULID}`, me
@@ -294,14 +294,29 @@ const ids = { plan: `pln_${ULID}`, task: `tsk_${ULID}`, agent: `agt_${ULID}`, me
await wiki.pages.revision(ids.page, 4);
await wiki.pages.revision(ids.page, 4);
await wiki.pages.diff(ids.page, { from: 3, to: 4, mode: 'words' });
await wiki.pages.diff(ids.page, { from: 3, to: 4, mode: 'words' });
await wiki.pages.citations(ids.page, 4);
await wiki.pages.citations(ids.page, 4);
+ await wiki.pages.blocks(ids.page, { revision: 4 });
+ await busyOnce(() => wiki.articles.create('openvibe', { title: 'Restreaming', blocks: { type: 'root', children: [] } }));
+ await wiki.articles.create('openvibe', { title: 'Restreaming', blocks: { type: 'root', children: [] } });
+ await busyOnce(() => wiki.articles.update(ids.page, { expected_revision: 4, blocks: { type: 'root', children: [] } }));
+ await wiki.articles.update(ids.page, { expected_revision: 4, blocks: { type: 'root', children: [] } });
+ await busyOnce(() => wiki.images.suggest(ids.page, { query: 'Restreaming', count: 4 }));
+ await wiki.images.suggest(ids.page, { query: 'Restreaming', count: 4 });
+ await busyOnce(() => wiki.articles.draft(ids.page, { instruction: 'Add the setup section' }));
+ await wiki.articles.draft(ids.page, { instruction: 'Add the setup section' });
const W = `/api/v1/pages/${ids.page}`;
const W = `/api/v1/pages/${ids.page}`;
assert.deepStrictEqual(mark().map((x) => `${x.method} ${x.url}`), [
assert.deepStrictEqual(mark().map((x) => `${x.method} ${x.url}`), [
'GET /api/v1/search?q=restreaming&space=openvibe&limit=5', 'GET /api/v1/spaces', 'GET /api/v1/spaces/openvibe', `GET ${W}?revision=4`,
'GET /api/v1/search?q=restreaming&space=openvibe&limit=5', 'GET /api/v1/spaces', 'GET /api/v1/spaces/openvibe', `GET ${W}?revision=4`,
`GET ${W}/revisions?limit=10`, `GET ${W}/revisions/4`, `GET ${W}/diff?from=3&to=4&mode=words`, `GET ${W}/revisions/4/citations`,
`GET ${W}/revisions?limit=10`, `GET ${W}/revisions/4`, `GET ${W}/diff?from=3&to=4&mode=words`, `GET ${W}/revisions/4/citations`,
+ `GET ${W}?format=blocks&revision=4`,
+ 'POST /api/v1/spaces/openvibe/pages', 'POST /api/v1/spaces/openvibe/pages', `POST ${W}/revisions`, `POST ${W}/revisions`,
+ `POST ${W}/images/suggest`, `POST ${W}/images/suggest`, `POST ${W}/draft`, `POST ${W}/draft`,
]);
]);
assert.throws(() => wiki.search(''), /search for/);
assert.throws(() => wiki.search(''), /search for/);
assert.throws(() => wiki.pages.get('page_1'), /pg_/);
assert.throws(() => wiki.pages.get('page_1'), /pg_/);
assert.throws(() => wiki.pages.diff(ids.page, { from: 0, to: 2 }), /revision number/);
assert.throws(() => wiki.pages.diff(ids.page, { from: 0, to: 2 }), /revision number/);
+ assert.throws(() => wiki.articles.create('openvibe', { blocks: { type: 'root' } }), /title/);
+ assert.throws(() => wiki.articles.create('openvibe', { title: 'X', blocks: 'root' }), /block tree/);
+ assert.throws(() => wiki.articles.update(ids.page, null), /fields/);
// ── Coupons ───────────────────────────────────────────
// ── Coupons ───────────────────────────────────────────
const coupons = createCouponsClient(client);
const coupons = createCouponsClient(client);
@@ -1,6 +1,18 @@
@@ -1,6 +1,18 @@
-/** openvibe-sdk/wiki: OpenVibe.Wiki's reads — search, spaces, pages, revisions, diffs and citations. */
+/** openvibe-sdk/wiki: OpenVibe.Wiki's reads, article writes, picture suggestions and the wiki writer. */
type Opts = { signal?: AbortSignal };
type Opts = { signal?: AbortSignal };
type WikiJson = Record<string, any>;
type WikiJson = Record<string, any>;
+type BlockTree = { type: 'root'; children?: unknown[]; [key: string]: unknown };
+export interface WikiImagesSuggestFields {
+ query?: string | null;
+ section?: string | null;
+ count?: number;
+ allow_ai?: boolean;
+ choice?: { model: string; source: 'openvibe' | 'keys' | 'machines'; machine?: string };
+}
+export interface WikiArticleDraftFields {
+ instruction?: string | null;
+ choice?: { model: string; source: 'openvibe' | 'keys' | 'machines'; machine?: string };
+}
export interface WikiClient {
export interface WikiClient {
search(q: string, opts?: Opts & { space?: string; limit?: number }): Promise<{ results: WikiJson[] }>;
search(q: string, opts?: Opts & { space?: string; limit?: number }): Promise<{ results: WikiJson[] }>;
spaces: { list(opts?: Opts): Promise<WikiJson>; get(space: string, opts?: Opts): Promise<WikiJson> };
spaces: { list(opts?: Opts): Promise<WikiJson>; get(space: string, opts?: Opts): Promise<WikiJson> };
@@ -10,6 +22,15 @@ export interface WikiClient {
@@ -10,6 +22,15 @@ export interface WikiClient {
revision(id: string, n: number, opts?: Opts): Promise<WikiJson>;
revision(id: string, n: number, opts?: Opts): Promise<WikiJson>;
diff(id: string, opts: Opts & { from: number; to: number; mode?: string }): Promise<WikiJson>;
diff(id: string, opts: Opts & { from: number; to: number; mode?: string }): Promise<WikiJson>;
citations(id: string, n: number, opts?: Opts): Promise<WikiJson>;
citations(id: string, n: number, opts?: Opts): Promise<WikiJson>;
+ blocks(id: string, opts?: Opts & { revision?: number }): Promise<WikiJson>;
+ };
+ articles: {
+ create(space: string, fields: { title: string; body?: string; blocks?: BlockTree; summary?: string | null; parent_id?: string | null; visibility?: 'public' | 'members' | 'vip' | 'private' }, opts?: Opts): Promise<WikiJson>;
+ update(id: string, fields: { expected_revision?: number; title?: string; body?: string; blocks?: BlockTree; summary?: string | null; message?: string | null }, opts?: Opts): Promise<WikiJson>;
+ draft(id: string, fields?: WikiArticleDraftFields, opts?: Opts): Promise<WikiJson>;
+ };
+ images: {
+ suggest(id: string, fields?: WikiImagesSuggestFields, opts?: Opts): Promise<WikiJson>;
};
};
}
}
export function createWikiClient(client: { json(opts: Record<string, unknown>): Promise<any> }, options?: { baseUrl?: string }): WikiClient;
export function createWikiClient(client: { json(opts: Record<string, unknown>): Promise<any> }, options?: { baseUrl?: string }): WikiClient;