Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/scripts/ci_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def changed(pattern):
r"^(examples/[^/]*(plugin|extension)[^/]*/|examples/memory-plugin-shared/|"
r"agent-plugins/|\.github/scripts/.*(plugin|marketplace|installer)|"
r"\.github/workflows/pr\.yml)|"
r"^(examples/)?(\.claude-plugin|\.agents/plugins)/marketplace\.json$"
r"^(examples/)?(\.claude-plugin|\.agents/plugins)/marketplace\.json$|"
r"^tests/fixtures/server_feature_versions\.json$"
)
# Keep unfamiliar paths on the safe side: only known independent trees
# bypass API tests. Added/removed/renamed paths are all included in the diff.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gateway.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: OpenViking Gateway
on:
pull_request:
paths: ["openviking_gateway/**", "tests/gateway/**", "scripts/gateway_*", "tests/fixtures/gateway_upstream_urls.json", "openviking_cli/utils/config/openviking_gateway_config.py", "openviking_cli/utils/config/encryption_config.py", "openviking_cli/utils/config/agfs_config.py", "openviking/server/account_stores/redis_client.py", "pyproject.toml", "MANIFEST.in", "openviking_cli/setup_wizard.py", "openviking/crypto/**", ".github/workflows/gateway.yml"]
paths: ["openviking_gateway/**", "tests/gateway/**", "scripts/gateway_*", "tests/fixtures/gateway_upstream_urls.json", "tests/fixtures/server_feature_versions.json", "openviking_cli/utils/config/openviking_gateway_config.py", "openviking_cli/utils/config/encryption_config.py", "openviking_cli/utils/config/agfs_config.py", "openviking/server/account_stores/redis_client.py", "pyproject.toml", "MANIFEST.in", "openviking_cli/setup_wizard.py", "openviking/crypto/**", ".github/workflows/gateway.yml"]
workflow_dispatch:
jobs:
test:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ jobs:
- name: Committed generator output must be up to date
run: |
# A module the closure grew reaches the committed lanes as an
# untracked file, which `git diff` does not see at all.
status=$(git status --porcelain --untracked-files=normal -- examples agent-plugins)
# untracked file, which `git diff` does not see at all. The gateway
# package holds a committed copy of the server feature table.
status=$(git status --porcelain --untracked-files=normal -- examples agent-plugins openviking_gateway)
if [ -n "$status" ]; then
printf '%s\n' "$status"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion examples/agent-hook-plugin/hosts/codebuddy/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openviking-memory",
"version": "0.5.38",
"version": "0.5.39",
"description": "Long-term semantic memory for the CodeBuddy Code CLI, powered by OpenViking. Injects relevant context at session start and on each prompt, and captures the conversation back into OpenViking.",
"author": {
"name": "OpenViking",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "openviking-memory",
"version": "0.5.38",
"version": "0.5.39",
"clients": [
"cursor"
],
Expand Down
2 changes: 1 addition & 1 deletion examples/agent-hook-plugin/hosts/kimicode/kimi.plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openviking-memory",
"version": "0.5.38",
"version": "0.5.39",
"description": "Long-term semantic memory for Kimi Code CLI, powered by OpenViking.",
"author": {
"name": "OpenViking",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "openviking-memory",
"version": "0.5.38",
"version": "0.5.39",
"clients": [
"kimicode"
],
Expand Down
2 changes: 1 addition & 1 deletion examples/agent-hook-plugin/hosts/qoder/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openviking-memory",
"version": "0.5.38",
"version": "0.5.39",
"description": "Long-term semantic memory for the Qoder CLI, powered by OpenViking. Injects relevant context at session start and on each prompt, and captures the conversation back into OpenViking.",
"author": {
"name": "OpenViking",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "openviking-memory",
"version": "0.5.38",
"version": "0.5.39",
"clients": [
"trae",
"trae-cn"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "openviking-memory",
"version": "0.5.38",
"version": "0.5.39",
"clients": [
"zcode"
],
Expand Down
2 changes: 1 addition & 1 deletion examples/agent-hook-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "agent-hook-plugin",
"version": "0.5.38",
"version": "0.5.39",
"description": "Long-term semantic memory for Cursor, TRAE, TRAE CN, ZCode, Kimi Code, CodeBuddy Code, Qoder CLI and Antigravity — powered by OpenViking. Auto-recall relevant memories and capture the conversation as it happens.",
"author": {
"name": "OpenViking",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openviking-memory",
"version": "0.7.28",
"version": "0.7.29",
"description": "Long-term semantic memory for Claude Code, powered by OpenViking. Auto-recall relevant memories at session start and capture important information during conversations.",
"author": {
"name": "OpenViking",
Expand Down
2 changes: 1 addition & 1 deletion examples/claude-code-memory-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "claude-code-openviking-memory",
"version": "0.7.28",
"version": "0.7.29",
"description": "OpenViking memory plugin for Claude Code — semantic long-term memory",
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/codex-memory-plugin/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openviking-memory",
"version": "0.11.27",
"version": "0.11.28",
"description": "Long-term semantic memory for Codex, powered by OpenViking. Recall on UserPromptSubmit, incremental add_message on Stop (per turn), commit on SessionEnd (Codex >= 0.145) and on PreCompact, with an idle/ended sweep on SessionStart as the fallback for signals, crashes and older Codex builds. Includes a local stdio MCP proxy that reads OpenViking credentials from env/ovcli.conf.",
"author": {
"name": "OpenViking",
Expand Down
4 changes: 2 additions & 2 deletions examples/dsh-memory-plugin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/dsh-memory-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openviking/dsh-memory-plugin",
"version": "0.5.42",
"version": "0.5.43",
"description": "OpenViking memory and context bundle for DeepSeek Harness",
"icon": "./icon.svg",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion examples/magpie-memory-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The standalone `@openviking/magpie-models-plugin` is no longer packaged. For man

See [Model management](models/README.md) for Root permissions, Bot detection, restart and recovery limits. Model management never enables Bot automatically.

Version 0.2.5 has not been published. Install from source below; after publication:
Version 0.2.6 has not been published. Install from source below; after publication:

```sh
magpie plugin add @openviking/magpie-plugin
Expand Down
2 changes: 1 addition & 1 deletion examples/magpie-memory-plugin/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

## 安装

统一版本 0.2.5 尚未发布;当前请按下文从源码安装。发布后可安装:
统一版本 0.2.6 尚未发布;当前请按下文从源码安装。发布后可安装:

```sh
magpie plugin add @openviking/magpie-plugin
Expand Down
2 changes: 1 addition & 1 deletion examples/magpie-memory-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openviking/magpie-plugin",
"version": "0.2.5",
"version": "0.2.6",
"description": "OpenViking integration for Magpie: memory recall/capture and model switching with automatic restart.",
"author": "OpenViking",
"homepage": "https://github.com/volcengine/OpenViking/tree/main/examples/magpie-memory-plugin",
Expand Down
18 changes: 18 additions & 0 deletions examples/memory-plugin-shared/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,24 @@ For deployments where one bot serves multiple real people, such as zouk,
vikingbot, or AstrBot, configure an explicit actor peer and use the isolation
mode so one person's memories are not recalled into another person's session.

## Server Feature Table

`lib/server-features.json` names each OpenViking server capability a client depends on, with the first server version that has it. The gateway and the plugins answer "does this server have X" from this one table: `lib/server-features.mjs` reads it for the plugins (`supports(feature, version)`, `featureStatus`, `healthVersion`), and `openviking_gateway/client.py` reads a copy the sync writes into the gateway package (`openviking_gateway/server-features.json`; `supports(feature, version)`, `VikingClient.supports(key, feature)`). The copy is committed, and CI fails a pull request whose copy differs from the source; a plugin gets the table only with a module that reads it.

Adding a row:

1. Add `"name": "X.Y.Z"` to `lib/server-features.json`.
2. Add `"name"` to the `ServerFeature` union in `lib/server-features.d.mts`, so TypeScript callers can name it.
3. Run `node examples/memory-plugin-shared/sync.mjs` and commit the regenerated `openviking_gateway/server-features.json` with the source.
4. Add boundary cases for the row (the version itself, the release before it, a development build of it) to `tests/fixtures/server_feature_versions.json`.

Rules for a row:

- The version is the next unreleased release at the time the server change merges, the release its users will first see it in.
- Only the release part of a version is compared, so a development build such as `0.5.7.dev44` counts as 0.5.7.
- A version that cannot be read, or none at all, counts as not supporting. Both readers accept the PEP 440 grammar and nothing else; `tests/fixtures/server_feature_versions.json` holds the cases both test suites check.
- Callers ask the table before they use a capability. They do not infer support from a 404 or another error from the server.

## Skill Catalog

`lib/profile-inject.mjs` ends the session-start block with `<available-skills>`, built from one `GET /api/v1/skills?node_limit=200`, which caps each root rather than the merged list: the user's own skills first, then the ones shared under `viking://agent/skills` (a shared skill whose name the user also owns is left out), each description cut to about 40 tokens. Nothing trims the list again on this side; the token budget decides what fits. Callers turn it on by passing their resolved config as `buildProfileBlock()`'s fourth argument, and claude-code, codex, cursor, trae, trae-cn, zcode, opencode, dsh and pi all do, so they build it the same way; openclaw and hermes inject no profile, and `pi-experimental-context-management` calls `buildProfileBlock()` without that argument.
Expand Down
19 changes: 19 additions & 0 deletions examples/memory-plugin-shared/lib/server-features.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export type ServerFeature = "working_memory_opt_in";

export const SERVER_FEATURES: Readonly<Record<ServerFeature, string>>;

export function requiredVersion(feature: ServerFeature): string;
export function supports(feature: ServerFeature, version: string | null | undefined): boolean;

export type FeatureStatus = {
feature: ServerFeature;
supported: boolean;
required: string;
actual: string | null;
};
export function featureStatus(feature: ServerFeature, version: string | null | undefined): FeatureStatus;

export function healthVersion(
fetchJSON: (path: string, init?: RequestInit, options?: { timeoutMs?: number }) => Promise<any>,
options?: { timeoutMs?: number },
): Promise<string | null>;
3 changes: 3 additions & 0 deletions examples/memory-plugin-shared/lib/server-features.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"working_memory_opt_in": "0.5.0"
}
91 changes: 91 additions & 0 deletions examples/memory-plugin-shared/lib/server-features.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/**
* Which OpenViking server capabilities a server has, by its version.
*
* `server-features.json` lists each capability a client depends on with the
* first server version that has it; the gateway ships the same file
* (`openviking_gateway/server-features.json`), and the sync keeps both copies
* byte-identical. Callers ask `supports` before using a capability; they do
* not infer support from a 404.
*
* Exports:
*
* SERVER_FEATURES the table, frozen
* requiredVersion(feature) -> string the first version with `feature`
* supports(feature, version) -> boolean
* Compares the release part of `version` (what `/health` reports, so
* `0.5.7.dev44` counts as 0.5.7) with the table. A version that cannot be
* read does not support anything; "readable" is PEP 440, the grammar the
* gateway's reader (Python `packaging`) accepts, so both answer the same
* for the same string. An unknown feature name throws: it is a programming
* error, not a property of the server.
* featureStatus(feature, version) -> { feature, supported, required, actual }
* The same answer with what a message to the user needs; `actual` is the
* version as given, or null.
* healthVersion(fetchJSON) -> Promise<string | null>
* The version from `GET /health` through a plugin's `fetchJSON`
* (`ov-http.mjs`: resolves `{ ok, result }`, never throws); null when the
* health check fails or reports no version.
*/
import { readFileSync } from "node:fs";

const TABLE = JSON.parse(readFileSync(new URL("./server-features.json", import.meta.url), "utf-8"));

export const SERVER_FEATURES = Object.freeze({ ...TABLE });

// packaging.version.VERSION_PATTERN, anchored and case-insensitive as
// `Version` uses it. Only the epoch and the release are read; the rest is
// matched so that a string Python rejects is rejected here too.
const PEP440 = new RegExp(
"^v?(?:(\\d+)!)?(\\d+(?:\\.\\d+)*)"
+ "(?:[-_.]?(?:alpha|a|beta|b|preview|pre|c|rc)[-_.]?\\d*)?"
+ "(?:-\\d+|[-_.]?(?:post|rev|r)[-_.]?\\d*)?"
+ "(?:[-_.]?dev[-_.]?\\d*)?"
+ "(?:\\+[a-z0-9]+(?:[-_.][a-z0-9]+)*)?$",
"i",
);

/** `[epoch, ...release]` of a version string, or null when it is not one. */
function release(version) {
if (typeof version !== "string") return null;
const match = PEP440.exec(version.trim());
if (!match) return null;
return [Number(match[1] ?? 0), ...match[2].split(".").map(Number)];
}

export function requiredVersion(feature) {
if (!Object.prototype.hasOwnProperty.call(SERVER_FEATURES, feature)) {
throw new Error(`unknown server feature: ${String(feature)}`);
}
return SERVER_FEATURES[feature];
}

export function supports(feature, version) {
const need = release(requiredVersion(feature));
const have = release(version);
if (!have) return false;
for (let i = 0; i < Math.max(have.length, need.length); i += 1) {
const a = have[i] ?? 0;
const b = need[i] ?? 0;
if (a !== b) return a > b;
}
return true;
}

export function featureStatus(feature, version) {
return {
feature,
supported: supports(feature, version),
required: requiredVersion(feature),
actual: typeof version === "string" && version ? version : null,
};
}

export async function healthVersion(fetchJSON, { timeoutMs = 5000 } = {}) {
try {
const res = await fetchJSON("/health", undefined, { timeoutMs });
const version = res?.ok ? res.result?.version : undefined;
return typeof version === "string" && version ? version : null;
} catch {
return null;
}
}
62 changes: 62 additions & 0 deletions examples/memory-plugin-shared/server-features.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";

import { SERVER_FEATURES, featureStatus, healthVersion, requiredVersion, supports } from "./lib/server-features.mjs";

// The gateway's test suite reads the same cases, so the two readers are proven
// to answer alike for every string in it.
const CASES = JSON.parse(
readFileSync(new URL("../../tests/fixtures/server_feature_versions.json", import.meta.url), "utf-8"),
);

test("the table is the source file", () => {
const source = readFileSync(new URL("./lib/server-features.json", import.meta.url), "utf-8");
assert.deepEqual(SERVER_FEATURES, JSON.parse(source));
assert.ok(Object.isFrozen(SERVER_FEATURES));
assert.equal(requiredVersion("working_memory_opt_in"), "0.5.0");
});

test("supports agrees with the shared version cases", () => {
assert.ok(CASES.length > 0);
for (const { feature, version, supported } of CASES) {
assert.equal(supports(feature, version), supported, `supports(${JSON.stringify(feature)}, ${JSON.stringify(version)})`);
}
});

test("a version that cannot be read supports nothing", () => {
for (const version of [undefined, {}, ["0.5.0"]]) assert.equal(supports("working_memory_opt_in", version), false);
});

test("an unknown feature name is a programming error", () => {
assert.throws(() => supports("time_travel", "9.9.9"), /unknown server feature: time_travel/);
assert.throws(() => requiredVersion("toString"), /unknown server feature/);
});

test("featureStatus carries what a message needs", () => {
assert.deepEqual(featureStatus("working_memory_opt_in", "0.4.23"), {
feature: "working_memory_opt_in",
supported: false,
required: "0.5.0",
actual: "0.4.23",
});
assert.deepEqual(featureStatus("working_memory_opt_in", null), {
feature: "working_memory_opt_in",
supported: false,
required: "0.5.0",
actual: null,
});
});

test("healthVersion reads /health's version and is null when the check fails", async () => {
const paths = [];
const ok = async (path) => {
paths.push(path);
return { ok: true, status: 200, result: { status: "ok", healthy: true, version: "0.5.7.dev44" } };
};
assert.equal(await healthVersion(ok), "0.5.7.dev44");
assert.deepEqual(paths, ["/health"]);
assert.equal(await healthVersion(async () => ({ ok: false, status: 503, result: null })), null);
assert.equal(await healthVersion(async () => ({ ok: true, status: 200, result: { healthy: true } })), null);
assert.equal(await healthVersion(async () => { throw new Error("down"); }), null);
});
Loading
Loading