openvibers/openvibe.sdk Commits

chat.rooms.insight: a room's public AI insight (#188)

OP OpenVibers committed 3 days ago · 3e51dcc425 · 10 files, +38 −9

* chat.rooms.insight: a room's public AI insight

* SDK 0.138.0: the version constant, lockfile, README and bundle agree

* SDK: regenerate the browser bundle for chat.rooms.insight

Changes

ddiff --git a/CHANGELOG.md b/CHANGELOG.md
iindex 4bbbace..a50cc36 100644
---- a/CHANGELOG.md
++++ b/CHANGELOG.md
@@@ -1,5 +1,9 @@
# Changelog
++## 0.138.0 (2026-11-10)
++
++- **`chat.rooms.insight(id)`**: a room's public AI insight (`chat.room-insight-result@1`), as `GET /api/v1/rooms/:id/insight` answers it: `{ overview: { text, topics, people, messages, from, to, updated_at }, timeline: [{ at, kind, title, text, message_id }], state: 'ready' | 'quiet' | 'off' }`. `id` is a room slug or `global`; a room the rollout does not cover answers `null` (404 like `rooms.get`). No account is needed, so an anonymous client reads it too. Typed as `RoomInsight` in `types/chat.d.ts`.
++
## 0.137.0 (2026-11-10)
- Add `moneyReasons` (`billing.money-reason@1`): the plain words for a movement of OpenCoins, Vibes or Balance, for a service that holds the raw `reason` row. It re-exports `openvibe-contracts`' list when the installed package has it, otherwise the same list copied at Contracts 0.392.0: `describe(key, { site, resolve, subject })` answers `{ key, text, subject: { name, url } | null, site, known }`, and `describeRow(row)` reads `{ reason, app_id }`. An undeclared key reads "for something on <site>" with `known: false`.
ddiff --git a/README.md b/README.md
iindex f41fd0a..f69fa58 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.137.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.138.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.137.0
++npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.138.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 38c5187..e36d0ce 100644
---- a/STATUS.json
++++ b/STATUS.json
@@@ -3,7 +3,7 @@
"stage": "alpha",
"code": true,
"wave": "W2",
-- "version": "0.137.0",
++ "version": "0.138.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",
ddiff --git a/browser/openvibe-sdk.mjs b/browser/openvibe-sdk.mjs
iindex 91bdb52..05a9d22 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.137.0, MIT). Do not edit.
++// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.138.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, levels, 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 */
@@@ -57,7 +57,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.137.0';
++const SDK_VERSION = '0.138.0';
module.exports = {
createClient,
@@@ -4816,6 +4816,9 @@ function createChatClient(client, defaults = {}) {
list: (o = {}) => call({ path: '/api/chat/rooms' }, o),
create: (input, o = {}) => call({ method: 'POST', path: '/api/chat/rooms', json: input, ...once }, o),
get: (slug, o = {}) => orNull(call({ path: room(slug) }, o)),
++ /** The room's public AI insight (chat.room-insight-result@1): { overview, timeline, state } | null.
++ * `id` is a room slug or `global`; a room the rollout does not cover answers null (404). */
++ insight: (id, o = {}) => orNull(call({ path: `/api/v1/rooms/${enc(id)}/insight` }, o)),
update: (slug, patch, o = {}) => call({ method: 'PATCH', path: room(slug), json: patch, ...once }, o),
/** query: before | after (message id), limit */
messages: (slug, query = {}, o = {}) => call({ path: `${room(slug)}/messages`, query }, o),
ddiff --git a/package-lock.json b/package-lock.json
iindex 76f83db..5d3f1c9 100644
---- a/package-lock.json
++++ b/package-lock.json
@@@ -1,12 +1,12 @@
{
"name": "openvibe-sdk",
-- "version": "0.137.0",
++ "version": "0.138.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "openvibe-sdk",
-- "version": "0.137.0",
++ "version": "0.138.0",
"license": "MIT",
"bin": {
"openvibe-download": "bin/openvibe-download.js"
ddiff --git a/package.json b/package.json
iindex a7dc425..27589a0 100644
---- a/package.json
++++ b/package.json
@@@ -1,6 +1,6 @@
{
"name": "openvibe-sdk",
-- "version": "0.137.0",
++ "version": "0.138.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 0a27f29..90e4a4a 100644
---- a/src/chat.js
++++ b/src/chat.js
@@@ -57,6 +57,9 @@ function createChatClient(client, defaults = {}) {
list: (o = {}) => call({ path: '/api/chat/rooms' }, o),
create: (input, o = {}) => call({ method: 'POST', path: '/api/chat/rooms', json: input, ...once }, o),
get: (slug, o = {}) => orNull(call({ path: room(slug) }, o)),
++ /** The room's public AI insight (chat.room-insight-result@1): { overview, timeline, state } | null.
++ * `id` is a room slug or `global`; a room the rollout does not cover answers null (404). */
++ insight: (id, o = {}) => orNull(call({ path: `/api/v1/rooms/${enc(id)}/insight` }, o)),
update: (slug, patch, o = {}) => call({ method: 'PATCH', path: room(slug), json: patch, ...once }, o),
/** query: before | after (message id), limit */
messages: (slug, query = {}, o = {}) => call({ path: `${room(slug)}/messages`, query }, o),
ddiff --git a/src/core/index.js b/src/core/index.js
iindex aefa782..6615539 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.137.0';
++const SDK_VERSION = '0.138.0';
module.exports = {
createClient,
ddiff --git a/test/chat.test.js b/test/chat.test.js
iindex 9dc4010..0408bd7 100644
---- a/test/chat.test.js
++++ b/test/chat.test.js
@@@ -13,6 +13,7 @@ async function chatStub() {
let busy = 0;
return stubServer((req, res) => {
if (req.url.startsWith('/api/chat/rooms/private-one')) return send(res, 404, { error: 'Room not found' });
++ if (req.url === '/api/v1/rooms/missing/insight') return send(res, 404, { error: 'Room insight not found' });
if (req.url === '/api/chat/send' && busy++ === 0) return send(res, 503, { error: 'busy' });
return send(res, 200, { ok: true, url: req.url });
});
@@@ -45,6 +46,7 @@ run([
await chat.dms.viewPreference(7);
await chat.dms.setViewPreference(7, 'bubbles');
await chat.global.history({ after_id: 5 });
++ await chat.rooms.insight('global');
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, [
['POST', '/api/chat/rooms', { name: 'Builders' }],
@@@ -57,6 +59,7 @@ run([
['GET', '/api/dm/conversations/7/view', null],
['PUT', '/api/dm/conversations/7/view', { view: 'bubbles' }],
['GET', '/api/chat/global/history?after_id=5', null],
++ ['GET', '/api/v1/rooms/global/insight', null],
]);
assert.equal(srv.requests[0].headers.authorization, 'Bearer user-jwt');
await srv.close();
@@@ -67,6 +70,7 @@ run([
await assert.rejects(chat.global.send('hello'), (e) => e.status === 503);
assert.equal(srv.requests.filter((r) => r.url === '/api/chat/send').length, 1, 'one attempt only');
assert.equal(await chat.rooms.get('private-one'), null);
++ assert.equal(await chat.rooms.insight('missing'), null, 'a room without an insight is null');
await srv.close();
}],
['inboxes, feeds and Vibe go to their paths', async () => {
ddiff --git a/types/chat.d.ts b/types/chat.d.ts
iindex d02cdff..63952d0 100644
---- a/types/chat.d.ts
++++ b/types/chat.d.ts
@@@ -2,6 +2,20 @@ import type { OpenVibeClient } from './core';
type Opts = { signal?: AbortSignal };
type Json = Record<string, unknown>;
++/** chat.room-insight-result@1: a room's public AI insight (see the contract in openvibe-contracts). */
++export interface RoomInsight {
++ overview: {
++ text: string;
++ topics: { label: string; count: number }[];
++ people: number;
++ messages: number;
++ from: string | null;
++ to: string | null;
++ updated_at: string | null;
++ };
++ timeline: { at: string; kind: string; title: string; text: string; message_id: number | null }[];
++ state: 'ready' | 'quiet' | 'off';
++}
export type ChatMessageView = 'bubbles' | 'room';
export interface ChatClient {
/** Ask Vibe using Auto, one catalogue model, or two to three models side by side. */
@@@ -17,6 +31,7 @@ export interface ChatClient {
list(opts?: Opts): Promise<Json>;
create(input: { name: string; slug?: string; topic?: string; visibility?: 'public' | 'private' }, opts?: Opts): Promise<Json>;
get(slug: string, opts?: Opts): Promise<Json | null>;
++ insight(id: string, opts?: Opts): Promise<RoomInsight | null>;
update(slug: string, patch: { name?: string; topic?: string; visibility?: 'public' | 'private'; slow_seconds?: number }, opts?: Opts): Promise<Json>;
messages(slug: string, query?: { before?: number; after?: number; limit?: number }, opts?: Opts): Promise<Json>;
send(slug: string, message: string, opts?: Opts): Promise<Json>;