mirror of
https://github.com/volcengine/OpenViking.git
synced 2026-09-30 17:28:07 +08:00
* feat(plugins): add Agent Plugins 1.0 portable package Add agent-plugins/, an Agent Plugins 1.0 conformant package (https://agent-plugins.org/specification) that any conforming client can load: plugin.json manifest, an openviking-memory skill teaching the hook-less recall + persist loop, and an mcp.json stdio entry running a stdio -> streamable-HTTP proxy that resolves credentials from OPENVIKING_* env -> ~/.openviking/ovcli.conf -> ~/.openviking/ov.conf, same as the ov CLI. servers/shared/* are generated copies of memory-plugin-shared/lib, wired into sync.mjs / sync.test.mjs TARGETS so they cannot drift silently. config.mjs / debug-log.mjs / mcp-proxy.mjs are adapted from claude-code-memory-plugin with the hook-tuning knobs dropped. plugin.test.mjs validates spec conformance (schema URLs and matching spec versions, name rules, closed manifest root, semver, skill frontmatter, referenced files staying inside the plugin root, node --check on all .mjs) and runs in CI via pr.yml. The skill treats tree/write/edit as optional, since they only exist on servers that carry #3936. Docs: docs/{en,zh}/agent-integrations/15-agent-plugins.md, registered in the VitePress sidebar and the integration overview tables, plus a link from the three root READMEs. The docs recommend the per-client plugin whenever the harness has hooks, with the shared installer one-liner. Based on #3994 by @ZaynJarvis. Co-Authored-By: Zayn Jarvis <zaynjarvis@gmail.com> * docs(agent-plugins): pluralize README title --------- Co-authored-by: Zayn Jarvis <zaynjarvis@gmail.com>
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
/**
|
|
* Structured debug logger for the OpenViking Agent Plugins 1.0 package.
|
|
*
|
|
* VENDORED (adapted) from examples/claude-code-memory-plugin/scripts/debug-log.mjs —
|
|
* keep in sync with that file.
|
|
*
|
|
* Activation: OPENVIKING_DEBUG=1 env var.
|
|
* Log path: OPENVIKING_DEBUG_LOG env var OR ~/.openviking/logs/agent-plugins.log.
|
|
* Format: JSON Lines — { ts, hook, stage, data } | { ts, hook, stage, error }.
|
|
*
|
|
* When inactive, log() and logError() are zero-cost no-ops.
|
|
*/
|
|
|
|
import { loadConfig } from "./config.mjs";
|
|
import { createLogger as createSharedLogger } from "./shared/debug-log.mjs";
|
|
|
|
let _cfg;
|
|
function cfg() {
|
|
if (!_cfg) _cfg = loadConfig();
|
|
return _cfg;
|
|
}
|
|
|
|
/**
|
|
* @param {string} hookName — e.g. "mcp-proxy"
|
|
* @param {{ debug?: boolean, debugLogPath?: string }} [overrideCfg]
|
|
* Pass a config object directly (avoids re-loading config in tests).
|
|
* @returns {{ log: (stage: string, data: any) => void, logError: (stage: string, err: any) => void }}
|
|
*/
|
|
export function createLogger(hookName, overrideCfg) {
|
|
return createSharedLogger(hookName, overrideCfg || cfg());
|
|
}
|