openvibers/openvibe.sdk Commits

feat(sdk): expose DM view preferences (#154)

OP OpenVibers committed 4 days ago · 8bbdc8bcc3 · 11 files, +27 −10

* feat(sdk): expose DM view preference methods

* test(sdk): cover DM view preference methods

* build(sdk): regenerate browser chat bundle

* Merge main

* 0.122.0

Changes

ddiff --git a/CHANGELOG.md b/CHANGELOG.md
iindex e459236..2409ae5 100644
---- a/CHANGELOG.md
++++ b/CHANGELOG.md
@@@ -1,5 +1,9 @@
# Changelog
++## 0.122.0 (2026-11-09)
++
++- dms.viewPreference() and setViewPreference(): a conversation's saved view, bubbles or room
++
## 0.121.0 (2026-11-09)
- ov.cam.settings.get/put: a person's saved camera choices (Cam #116)
ddiff --git a/README.md b/README.md
iindex 75872cd..beb3854 100644
---- a/README.md
++++ b/README.md
@@@ -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.121.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.122.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/tags
After v0.97.1 is tagged:
```bash
--npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.121.0
++npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.122.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 a08f370..cc85165 100644
---- a/STATUS.json
++++ b/STATUS.json
@@@ -3,7 +3,7 @@
"stage": "alpha",
"code": true,
"wave": "W2",
-- "version": "0.121.0",
++ "version": "0.122.0",
"plan": "OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), §3.2; roadmap §30",
"deployed": false,
"deployment": "none: a package released as git tags; services and apps pin a tag",
ddiff --git a/browser/openvibe-sdk.mjs b/browser/openvibe-sdk.mjs
iindex 44a60c9..5f93b75 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.121.0, MIT). Do not edit.
++// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.122.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.121.0';
++const SDK_VERSION = '0.122.0';
module.exports = {
createClient,
@@@ -4797,6 +4797,9 @@ function createChatClient(client, defaults = {}) {
blocks: (o = {}) => call({ path: '/api/dm/blocks' }, o),
block: (userId, o = {}) => call({ method: 'POST', path: `/api/dm/blocks/${enc(userId)}`, ...once }, o),
unblock: (userId, o = {}) => call({ method: 'DELETE', path: `/api/dm/blocks/${enc(userId)}`, ...once }, o),
++ /** Saved view for one conversation: { view: 'bubbles' | 'room' }. */
++ viewPreference: (id, o = {}) => call({ path: `${conv(id)}/view` }, o),
++ setViewPreference: (id, view, o = {}) => call({ method: 'PUT', path: `${conv(id)}/view`, json: { view }, ...once }, o),
},
/** Every message you sent that is still visible: { username, total, truncated, messages } (JSON). */
exportMine: (o = {}) => call({ path: '/api/chat/me/export' }, o),
ddiff --git a/package-lock.json b/package-lock.json
iindex d70790d..fe75146 100644
---- a/package-lock.json
++++ b/package-lock.json
@@@ -1,12 +1,12 @@
{
"name": "openvibe-sdk",
-- "version": "0.121.0",
++ "version": "0.122.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "openvibe-sdk",
-- "version": "0.121.0",
++ "version": "0.122.0",
"license": "MIT",
"bin": {
"openvibe-download": "bin/openvibe-download.js"
ddiff --git a/package.json b/package.json
iindex f0c7359..f2636a6 100644
---- a/package.json
++++ b/package.json
@@@ -1,6 +1,6 @@
{
"name": "openvibe-sdk",
-- "version": "0.121.0",
++ "version": "0.122.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",
ddiff --git a/src/chat.js b/src/chat.js
iindex dd831ff..0a27f29 100644
---- a/src/chat.js
++++ b/src/chat.js
@@@ -83,6 +83,9 @@ function createChatClient(client, defaults = {}) {
blocks: (o = {}) => call({ path: '/api/dm/blocks' }, o),
block: (userId, o = {}) => call({ method: 'POST', path: `/api/dm/blocks/${enc(userId)}`, ...once }, o),
unblock: (userId, o = {}) => call({ method: 'DELETE', path: `/api/dm/blocks/${enc(userId)}`, ...once }, o),
++ /** Saved view for one conversation: { view: 'bubbles' | 'room' }. */
++ viewPreference: (id, o = {}) => call({ path: `${conv(id)}/view` }, o),
++ setViewPreference: (id, view, o = {}) => call({ method: 'PUT', path: `${conv(id)}/view`, json: { view }, ...once }, o),
},
/** Every message you sent that is still visible: { username, total, truncated, messages } (JSON). */
exportMine: (o = {}) => call({ path: '/api/chat/me/export' }, o),
ddiff --git a/src/core/index.js b/src/core/index.js
iindex 203cf36..d9f07c4 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.121.0';
++const SDK_VERSION = '0.122.0';
module.exports = {
createClient,
ddiff --git a/test/chat.test.js b/test/chat.test.js
iindex 6aacdcd..9dc4010 100644
---- a/test/chat.test.js
++++ b/test/chat.test.js
@@@ -42,6 +42,8 @@ run([
await chat.dms.create([42], { name: 'pair' });
await chat.dms.send(7, 'hi');
await chat.dms.messages(7, { limit: 20 });
++ await chat.dms.viewPreference(7);
++ await chat.dms.setViewPreference(7, 'bubbles');
await chat.global.history({ after_id: 5 });
const got = srv.requests.map((r) => [r.method, r.url, r.body && String(r.body).length ? JSON.parse(String(r.body)) : null]);
assert.deepEqual(got, [
@@@ -52,6 +54,8 @@ run([
['POST', '/api/dm/conversations', { user_ids: [42], name: 'pair' }],
['POST', '/api/dm/conversations/7/messages', { message: 'hi' }],
['GET', '/api/dm/conversations/7/messages?limit=20', null],
++ ['GET', '/api/dm/conversations/7/view', null],
++ ['PUT', '/api/dm/conversations/7/view', { view: 'bubbles' }],
['GET', '/api/chat/global/history?after_id=5', null],
]);
assert.equal(srv.requests[0].headers.authorization, 'Bearer user-jwt');
ddiff --git a/test/pack.test.js b/test/pack.test.js
iindex d9a63dd..437b66e 100644
---- a/test/pack.test.js
++++ b/test/pack.test.js
@@@ -72,7 +72,7 @@ run([
})().catch((err) => { console.error(err); process.exit(1); });`;
const res = execFileSync(process.execPath, ['-e', script], { cwd: app, encoding: 'utf8' });
assert.match(res, new RegExp(`consumer ok: ${subpaths.length} subpaths \\+ the browser bundle`));
-- assert.equal(subpaths.length, 98); // Adds the upload client and the UI entry (0.121.0); the wallet came in 0.119.0.
++ assert.equal(subpaths.length, 98); // Adds the upload client and the UI entry (0.122.0); the wallet came in 0.119.0.
assert.ok(!fs.existsSync(path.join(app, 'node_modules/openvibe-contracts')), 'the optional peer is not installed');
} finally {
fs.rmSync(tmp, { recursive: true, force: true });
ddiff --git a/types/chat.d.ts b/types/chat.d.ts
iindex 139dbc2..d02cdff 100644
---- a/types/chat.d.ts
++++ b/types/chat.d.ts
@@@ -2,6 +2,7 @@ import type { OpenVibeClient } from './core';
type Opts = { signal?: AbortSignal };
type Json = Record<string, unknown>;
++export type ChatMessageView = 'bubbles' | 'room';
export interface ChatClient {
/** Ask Vibe using Auto, one catalogue model, or two to three models side by side. */
ask(input: { message: string; models?: string[]; slug?: string; fresh?: boolean; system_prompt?: string; temperature?: number }, opts?: Opts): Promise<{ chat: Json; message: Json }>;
@@@ -38,6 +39,8 @@ export interface ChatClient {
blocks(opts?: Opts): Promise<Json>;
block(userId: number | string, opts?: Opts): Promise<Json>;
unblock(userId: number | string, opts?: Opts): Promise<Json>;
++ viewPreference(id: number | string, opts?: Opts): Promise<{ view: ChatMessageView; conversation_id: number }>;
++ setViewPreference(id: number | string, view: ChatMessageView, opts?: Opts): Promise<{ view: ChatMessageView; conversation_id: number }>;
};
exportMine(opts?: Opts): Promise<{ username: string; exported_at: string; total: number; truncated: boolean; messages: Json[] }>;
vibe: {