openvibers/openvibe.sdk Commits
Expose popular and trending tool discovery in the SDK (#163)
Changes
@@@ -1,5 +1,9 @@# Changelog++## 0.115.0 (2026-11-09)++++- Tools discovery: ov.tools.popular() and ov.tools.trending()++## 0.114.0 (2026-11-09)- Dock v2: Vibe conversations (ov.chat.vibe.conversations) and Actor skill runs (ov.actor.skills.run)@@@ -2,7 +2,7 @@> Supported browser and server clients for the OpenVibe platform.--**Status:** alpha, v0.114.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.115.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.@@@ -11,7 +11,7 @@After v0.97.1 is tagged:```bash--npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.114.0++npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.115.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.114.0",++ "version": "0.115.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",@@@ -1,4 +1,4 @@--// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.114.0, MIT). Do not edit.++// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.115.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, community, homeFeed, bot, search, bench, meme, vision, themes, redact, chat, ai, credentials, jobs, tools, projects, geo). No server-only code: no service tokens, JWT verification, events, identity./* eslint-disable */@@@ -52,7 +52,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.114.0';++const SDK_VERSION = '0.115.0';module.exports = {createClient,@@@ -5450,7 +5450,17 @@ function createToolsClient(client, { baseUrl, service = 'tools', audience = 'opeasync lists({ limit, signal } = {}) { return read('/api/v1/domains', { limit }, signal); },};-- return { list, get, schema, run, jobs, domains };++ /** Public successful-run rankings, cached by Tools for one minute. */++ async function trending({ window = 'week', limit = 12, signal } = {}) {++ if (!['hour', 'week'].includes(window)) throw new TypeError('tools.trending: window must be hour or week');++ if (!Number.isInteger(limit) || limit < 1 || limit > 50) throw new TypeError('tools.trending: limit must be 1–50');++ return read('/api/v1/tools/trending', { window, limit }, signal);++ }++ async function popular({ limit = 12, signal } = {}) {++ if (!Number.isInteger(limit) || limit < 1 || limit > 50) throw new TypeError('tools.popular: limit must be 1–50');++ return read('/api/v1/tools/popular', { limit }, signal);++ }++ return { list, get, schema, run, jobs, domains, trending, popular };}module.exports = { createToolsClient, ToolRunError, isToolRunError };nnew file mode 100644@@@ -0,0 +1,14 @@++# Tool discovery++++```js++const rising = await ov.tools.trending({ window: 'hour', limit: 12 });++const popular = await ov.tools.popular({ limit: 12 });++```++++`trending()` defaults to `window: 'week'`. Limits are integers from 1 to 50; both methods accept an AbortSignal. Registry reads are anonymous by default, just like `tools.list()`.++++Both return `{ metric: 'successful_api_runs', window, updated_at, uses_today, tools, count }`. Each tool has `id`, `name`, `description`, `family`, `icon`, `url` and `uses`. Trending entries also have `previous_uses` and `increase`; only rising tools appear, ordered by absolute increase, use count and ID. Empty lists mean no recorded activity, while unavailable data rejects the request.++++Counts cover successful inline API requests (including cache hits but excluding idempotent replays) and successful file jobs with tool IDs. They exclude page opens, browser-only edits and failures. The current UTC hour is partial; week means the last 168 hourly buckets compared with the preceding 168. The server refreshes totals every minute. No historical use is fabricated before the counter migration.++++Requires the Tools gateway discovery API deployment. SDK releases follow the normal merge/tag process; this addition needs no new browser bundle entrypoint.@@@ -1,12 +1,12 @@{"name": "openvibe-sdk",-- "version": "0.114.0",++ "version": "0.115.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "openvibe-sdk",-- "version": "0.114.0",++ "version": "0.115.0","license": "MIT","bin": {"openvibe-download": "bin/openvibe-download.js"@@@ -1,6 +1,6 @@{"name": "openvibe-sdk",-- "version": "0.114.0",++ "version": "0.115.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",@@@ -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.114.0';++const SDK_VERSION = '0.115.0';module.exports = {createClient,@@@ -276,7 +276,17 @@ function createToolsClient(client, { baseUrl, service = 'tools', audience = 'opeasync lists({ limit, signal } = {}) { return read('/api/v1/domains', { limit }, signal); },};-- return { list, get, schema, run, jobs, domains };++ /** Public successful-run rankings, cached by Tools for one minute. */++ async function trending({ window = 'week', limit = 12, signal } = {}) {++ if (!['hour', 'week'].includes(window)) throw new TypeError('tools.trending: window must be hour or week');++ if (!Number.isInteger(limit) || limit < 1 || limit > 50) throw new TypeError('tools.trending: limit must be 1–50');++ return read('/api/v1/tools/trending', { window, limit }, signal);++ }++ async function popular({ limit = 12, signal } = {}) {++ if (!Number.isInteger(limit) || limit < 1 || limit > 50) throw new TypeError('tools.popular: limit must be 1–50');++ return read('/api/v1/tools/popular', { limit }, signal);++ }++ return { list, get, schema, run, jobs, domains, trending, popular };}module.exports = { createToolsClient, ToolRunError, isToolRunError };nnew file mode 100644@@@ -0,0 +1,22 @@++'use strict';++const assert = require('node:assert/strict');++const { createToolsClient } = require('../src/tools');++(async () => {++ const calls = [];++ const result = { metric: 'successful_api_runs', window: 'hour', updated_at: '2026-11-09T10:00:00Z', uses_today: 3, tools: [], count: 0 };++ const tools = createToolsClient({ request: async opts => { calls.push(opts); return { data: result }; } }, { baseUrl: 'https://openvibe.tools' });++ const signal = new AbortController().signal;++ assert.equal(await tools.trending({ window: 'hour', limit: 4, signal }), result);++ assert.equal(calls[0].path, '/api/v1/tools/trending');++ assert.deepEqual(calls[0].query, { window: 'hour', limit: 4 });++ assert.equal(calls[0].auth, false);++ assert.equal(calls[0].signal, signal);++ await tools.popular();++ assert.equal(calls[1].path, '/api/v1/tools/popular');++ assert.deepEqual(calls[1].query, { limit: 12 });++ await assert.rejects(tools.trending({ window: 'day' }), TypeError);++ await assert.rejects(tools.popular({ limit: 51 }), TypeError);++ const broken = createToolsClient({ request: async () => { throw new Error('unavailable'); } });++ await assert.rejects(broken.trending(), /unavailable/);++ console.log('tools discovery: all checks passed');++})().catch(e => { console.error(e); process.exit(1); });@@@ -93,7 +93,31 @@ export declare class ToolRunError extends OpenVibeError {}export declare function isToolRunError(err: unknown): err is ToolRunError;++export interface ToolRankingItem {++ id: string;++ name: string;++ description: string;++ family: string;++ icon: string;++ url: string;++ uses: number;++ /** Trending only: use count in the preceding comparison window. */++ previous_uses?: number;++ increase?: number;++}++export interface ToolRanking {++ metric: 'successful_api_runs';++ window: 'hour' | 'week';++ updated_at: string;++ uses_today: number;++ tools: ToolRankingItem[];++ count: number;++}export interface ToolsClient {++ /** Rising successful API use versus the preceding UTC hour or seven-day window. */++ trending(opts?: { window?: 'hour' | 'week'; limit?: number; signal?: AbortSignal }): Promise<ToolRanking>;++ /** Most successful API uses in the last seven days. */++ popular(opts?: { limit?: number; signal?: AbortSignal }): Promise<ToolRanking>;/** GET /api/v1/tools: tools.tool-list@1, schemas as { $ref }. */list(query?: ToolListQuery): Promise<ToolList>;/** GET /api/v1/tools/:id: the descriptor with its schemas embedded, or null. */
@@ -1,5 +1,9 @@
@@ -1,5 +1,9 @@
# Changelog
# Changelog
+## 0.115.0 (2026-11-09)
+
+- Tools discovery: ov.tools.popular() and ov.tools.trending()
+
## 0.114.0 (2026-11-09)
## 0.114.0 (2026-11-09)
- Dock v2: Vibe conversations (ov.chat.vibe.conversations) and Actor skill runs (ov.actor.skills.run)
- Dock v2: Vibe conversations (ov.chat.vibe.conversations) and Actor skill runs (ov.actor.skills.run)
@@ -2,7 +2,7 @@
@@ -2,7 +2,7 @@
> Supported browser and server clients for the OpenVibe platform.
> Supported browser and server clients for the OpenVibe platform.
-**Status:** alpha, v0.114.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.115.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.
@@ -11,7 +11,7 @@
@@ -11,7 +11,7 @@
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.114.0
+npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.115.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.114.0",
+ "version": "0.115.0",
"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",
"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.114.0, MIT). Do not edit.
+// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.115.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, community, homeFeed, bot, search, bench, meme, vision, themes, 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, community, homeFeed, bot, search, bench, meme, vision, themes, redact, chat, ai, credentials, jobs, tools, projects, geo). No server-only code: no service tokens, JWT verification, events, identity.
/* eslint-disable */
/* eslint-disable */
@@ -52,7 +52,7 @@ const { paginate, offsetPager } = __load(7);
@@ -52,7 +52,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.114.0';
+const SDK_VERSION = '0.115.0';
module.exports = {
module.exports = {
createClient,
createClient,
@@ -5450,7 +5450,17 @@ function createToolsClient(client, { baseUrl, service = 'tools', audience = 'ope
@@ -5450,7 +5450,17 @@ function createToolsClient(client, { baseUrl, service = 'tools', audience = 'ope
async lists({ limit, signal } = {}) { return read('/api/v1/domains', { limit }, signal); },
async lists({ limit, signal } = {}) { return read('/api/v1/domains', { limit }, signal); },
};
};
- return { list, get, schema, run, jobs, domains };
+ /** Public successful-run rankings, cached by Tools for one minute. */
+ async function trending({ window = 'week', limit = 12, signal } = {}) {
+ if (!['hour', 'week'].includes(window)) throw new TypeError('tools.trending: window must be hour or week');
+ if (!Number.isInteger(limit) || limit < 1 || limit > 50) throw new TypeError('tools.trending: limit must be 1–50');
+ return read('/api/v1/tools/trending', { window, limit }, signal);
+ }
+ async function popular({ limit = 12, signal } = {}) {
+ if (!Number.isInteger(limit) || limit < 1 || limit > 50) throw new TypeError('tools.popular: limit must be 1–50');
+ return read('/api/v1/tools/popular', { limit }, signal);
+ }
+ return { list, get, schema, run, jobs, domains, trending, popular };
}
}
module.exports = { createToolsClient, ToolRunError, isToolRunError };
module.exports = { createToolsClient, ToolRunError, isToolRunError };
new file mode 100644
new file mode 100644
@@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
+# Tool discovery
+
+```js
+const rising = await ov.tools.trending({ window: 'hour', limit: 12 });
+const popular = await ov.tools.popular({ limit: 12 });
+```
+
+`trending()` defaults to `window: 'week'`. Limits are integers from 1 to 50; both methods accept an AbortSignal. Registry reads are anonymous by default, just like `tools.list()`.
+
+Both return `{ metric: 'successful_api_runs', window, updated_at, uses_today, tools, count }`. Each tool has `id`, `name`, `description`, `family`, `icon`, `url` and `uses`. Trending entries also have `previous_uses` and `increase`; only rising tools appear, ordered by absolute increase, use count and ID. Empty lists mean no recorded activity, while unavailable data rejects the request.
+
+Counts cover successful inline API requests (including cache hits but excluding idempotent replays) and successful file jobs with tool IDs. They exclude page opens, browser-only edits and failures. The current UTC hour is partial; week means the last 168 hourly buckets compared with the preceding 168. The server refreshes totals every minute. No historical use is fabricated before the counter migration.
+
+Requires the Tools gateway discovery API deployment. SDK releases follow the normal merge/tag process; this addition needs no new browser bundle entrypoint.
@@ -1,12 +1,12 @@
@@ -1,12 +1,12 @@
{
{
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.114.0",
+ "version": "0.115.0",
"lockfileVersion": 3,
"lockfileVersion": 3,
"requires": true,
"requires": true,
"packages": {
"packages": {
"": {
"": {
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.114.0",
+ "version": "0.115.0",
"license": "MIT",
"license": "MIT",
"bin": {
"bin": {
"openvibe-download": "bin/openvibe-download.js"
"openvibe-download": "bin/openvibe-download.js"
@@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
{
{
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.114.0",
+ "version": "0.115.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",
@@ -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.114.0';
+const SDK_VERSION = '0.115.0';
module.exports = {
module.exports = {
createClient,
createClient,
@@ -276,7 +276,17 @@ function createToolsClient(client, { baseUrl, service = 'tools', audience = 'ope
@@ -276,7 +276,17 @@ function createToolsClient(client, { baseUrl, service = 'tools', audience = 'ope
async lists({ limit, signal } = {}) { return read('/api/v1/domains', { limit }, signal); },
async lists({ limit, signal } = {}) { return read('/api/v1/domains', { limit }, signal); },
};
};
- return { list, get, schema, run, jobs, domains };
+ /** Public successful-run rankings, cached by Tools for one minute. */
+ async function trending({ window = 'week', limit = 12, signal } = {}) {
+ if (!['hour', 'week'].includes(window)) throw new TypeError('tools.trending: window must be hour or week');
+ if (!Number.isInteger(limit) || limit < 1 || limit > 50) throw new TypeError('tools.trending: limit must be 1–50');
+ return read('/api/v1/tools/trending', { window, limit }, signal);
+ }
+ async function popular({ limit = 12, signal } = {}) {
+ if (!Number.isInteger(limit) || limit < 1 || limit > 50) throw new TypeError('tools.popular: limit must be 1–50');
+ return read('/api/v1/tools/popular', { limit }, signal);
+ }
+ return { list, get, schema, run, jobs, domains, trending, popular };
}
}
module.exports = { createToolsClient, ToolRunError, isToolRunError };
module.exports = { createToolsClient, ToolRunError, isToolRunError };
new file mode 100644
new file mode 100644
@@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
+'use strict';
+const assert = require('node:assert/strict');
+const { createToolsClient } = require('../src/tools');
+(async () => {
+ const calls = [];
+ const result = { metric: 'successful_api_runs', window: 'hour', updated_at: '2026-11-09T10:00:00Z', uses_today: 3, tools: [], count: 0 };
+ const tools = createToolsClient({ request: async opts => { calls.push(opts); return { data: result }; } }, { baseUrl: 'https://openvibe.tools' });
+ const signal = new AbortController().signal;
+ assert.equal(await tools.trending({ window: 'hour', limit: 4, signal }), result);
+ assert.equal(calls[0].path, '/api/v1/tools/trending');
+ assert.deepEqual(calls[0].query, { window: 'hour', limit: 4 });
+ assert.equal(calls[0].auth, false);
+ assert.equal(calls[0].signal, signal);
+ await tools.popular();
+ assert.equal(calls[1].path, '/api/v1/tools/popular');
+ assert.deepEqual(calls[1].query, { limit: 12 });
+ await assert.rejects(tools.trending({ window: 'day' }), TypeError);
+ await assert.rejects(tools.popular({ limit: 51 }), TypeError);
+ const broken = createToolsClient({ request: async () => { throw new Error('unavailable'); } });
+ await assert.rejects(broken.trending(), /unavailable/);
+ console.log('tools discovery: all checks passed');
+})().catch(e => { console.error(e); process.exit(1); });
@@ -93,7 +93,31 @@ export declare class ToolRunError extends OpenVibeError {
@@ -93,7 +93,31 @@ export declare class ToolRunError extends OpenVibeError {
}
}
export declare function isToolRunError(err: unknown): err is ToolRunError;
export declare function isToolRunError(err: unknown): err is ToolRunError;
+export interface ToolRankingItem {
+ id: string;
+ name: string;
+ description: string;
+ family: string;
+ icon: string;
+ url: string;
+ uses: number;
+ /** Trending only: use count in the preceding comparison window. */
+ previous_uses?: number;
+ increase?: number;
+}
+export interface ToolRanking {
+ metric: 'successful_api_runs';
+ window: 'hour' | 'week';
+ updated_at: string;
+ uses_today: number;
+ tools: ToolRankingItem[];
+ count: number;
+}
export interface ToolsClient {
export interface ToolsClient {
+ /** Rising successful API use versus the preceding UTC hour or seven-day window. */
+ trending(opts?: { window?: 'hour' | 'week'; limit?: number; signal?: AbortSignal }): Promise<ToolRanking>;
+ /** Most successful API uses in the last seven days. */
+ popular(opts?: { limit?: number; signal?: AbortSignal }): Promise<ToolRanking>;
/** GET /api/v1/tools: tools.tool-list@1, schemas as { $ref }. */
/** GET /api/v1/tools: tools.tool-list@1, schemas as { $ref }. */
list(query?: ToolListQuery): Promise<ToolList>;
list(query?: ToolListQuery): Promise<ToolList>;
/** GET /api/v1/tools/:id: the descriptor with its schemas embedded, or null. */
/** GET /api/v1/tools/:id: the descriptor with its schemas embedded, or null. */