openclaw-openviking-setup-helper 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/install.js +46 -50
- package/package.json +2 -2
package/install.js
CHANGED
|
@@ -42,7 +42,7 @@ const HOME = process.env.HOME || process.env.USERPROFILE || "";
|
|
|
42
42
|
|
|
43
43
|
const DEFAULT_OPENCLAW_DIR = join(HOME, ".openclaw");
|
|
44
44
|
let OPENCLAW_DIR = DEFAULT_OPENCLAW_DIR;
|
|
45
|
-
let PLUGIN_DEST = join(OPENCLAW_DIR, "extensions", "
|
|
45
|
+
let PLUGIN_DEST = join(OPENCLAW_DIR, "extensions", "openviking");
|
|
46
46
|
|
|
47
47
|
const OPENVIKING_DIR = join(HOME, ".openviking");
|
|
48
48
|
|
|
@@ -52,19 +52,20 @@ const DEFAULT_VLM_MODEL = "doubao-seed-2-0-pro-260215";
|
|
|
52
52
|
const DEFAULT_EMBED_MODEL = "doubao-embedding-vision-251215";
|
|
53
53
|
|
|
54
54
|
const REQUIRED_PLUGIN_FILES = [
|
|
55
|
-
"examples/openclaw-
|
|
56
|
-
"examples/openclaw-
|
|
57
|
-
"examples/openclaw-
|
|
58
|
-
"examples/openclaw-
|
|
59
|
-
"examples/openclaw-
|
|
60
|
-
"examples/openclaw-
|
|
55
|
+
"examples/openclaw-plugin/index.ts",
|
|
56
|
+
"examples/openclaw-plugin/context-engine.ts",
|
|
57
|
+
"examples/openclaw-plugin/config.ts",
|
|
58
|
+
"examples/openclaw-plugin/openclaw.plugin.json",
|
|
59
|
+
"examples/openclaw-plugin/package.json",
|
|
60
|
+
"examples/openclaw-plugin/package-lock.json",
|
|
61
|
+
"examples/openclaw-plugin/.gitignore",
|
|
61
62
|
];
|
|
62
63
|
|
|
63
64
|
const OPTIONAL_PLUGIN_FILES = [
|
|
64
|
-
"examples/openclaw-
|
|
65
|
-
"examples/openclaw-
|
|
66
|
-
"examples/openclaw-
|
|
67
|
-
"examples/openclaw-
|
|
65
|
+
"examples/openclaw-plugin/client.ts",
|
|
66
|
+
"examples/openclaw-plugin/process-manager.ts",
|
|
67
|
+
"examples/openclaw-plugin/memory-ranking.ts",
|
|
68
|
+
"examples/openclaw-plugin/text-utils.ts",
|
|
68
69
|
];
|
|
69
70
|
|
|
70
71
|
let installYes = process.env.OPENVIKING_INSTALL_YES === "1";
|
|
@@ -120,7 +121,7 @@ const OPENVIKING_PIP_SPEC = openvikingVersion ? `openviking==${openvikingVersion
|
|
|
120
121
|
|
|
121
122
|
function setOpenClawDir(dir) {
|
|
122
123
|
OPENCLAW_DIR = dir;
|
|
123
|
-
PLUGIN_DEST = join(OPENCLAW_DIR, "extensions", "
|
|
124
|
+
PLUGIN_DEST = join(OPENCLAW_DIR, "extensions", "openviking");
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
function printHelp() {
|
|
@@ -549,6 +550,14 @@ async function configureOvConf() {
|
|
|
549
550
|
vectordb: { name: "context", backend: "local", project: "default" },
|
|
550
551
|
agfs: { port: agfsPortNum, log_level: "warn", backend: "local", timeout: 10, retry_times: 3 },
|
|
551
552
|
},
|
|
553
|
+
log: {
|
|
554
|
+
level: "WARNING",
|
|
555
|
+
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
556
|
+
output: "file",
|
|
557
|
+
rotation: true,
|
|
558
|
+
rotation_days: 3,
|
|
559
|
+
rotation_interval: "midnight",
|
|
560
|
+
},
|
|
552
561
|
embedding: {
|
|
553
562
|
dense: {
|
|
554
563
|
backend: "volcengine",
|
|
@@ -619,7 +628,7 @@ async function downloadPlugin() {
|
|
|
619
628
|
...OPTIONAL_PLUGIN_FILES.map((relPath) => ({ relPath, required: false })),
|
|
620
629
|
];
|
|
621
630
|
|
|
622
|
-
info(tr(`Downloading
|
|
631
|
+
info(tr(`Downloading openviking plugin from ${REPO}@${BRANCH}...`, `正在从 ${REPO}@${BRANCH} 下载 openviking 插件...`));
|
|
623
632
|
for (let i = 0; i < files.length; i++) {
|
|
624
633
|
const file = files[i];
|
|
625
634
|
await downloadPluginFile(file.relPath, file.required, i + 1, files.length);
|
|
@@ -633,51 +642,38 @@ async function downloadPlugin() {
|
|
|
633
642
|
async function configureOpenClawPlugin(pluginPath = PLUGIN_DEST) {
|
|
634
643
|
info(tr("Configuring OpenClaw plugin...", "正在配置 OpenClaw 插件..."));
|
|
635
644
|
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
if (existsSync(configPath)) {
|
|
640
|
-
try {
|
|
641
|
-
const raw = await readFile(configPath, "utf8");
|
|
642
|
-
if (raw.trim()) config = JSON.parse(raw);
|
|
643
|
-
} catch {
|
|
644
|
-
warn(tr("Existing openclaw.json invalid. Rebuilding required sections.", "已有 openclaw.json 非法,将重建相关配置节点。"));
|
|
645
|
-
}
|
|
645
|
+
const ocEnv = { ...process.env };
|
|
646
|
+
if (OPENCLAW_DIR !== DEFAULT_OPENCLAW_DIR) {
|
|
647
|
+
ocEnv.OPENCLAW_STATE_DIR = OPENCLAW_DIR;
|
|
646
648
|
}
|
|
647
649
|
|
|
648
|
-
|
|
649
|
-
if (!config.gateway) config.gateway = {};
|
|
650
|
-
if (!config.plugins.slots) config.plugins.slots = {};
|
|
651
|
-
if (!config.plugins.load) config.plugins.load = {};
|
|
652
|
-
if (!config.plugins.entries) config.plugins.entries = {};
|
|
650
|
+
const oc = (args) => runCapture("openclaw", args, { env: ocEnv, shell: IS_WIN });
|
|
653
651
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
config
|
|
658
|
-
config.plugins.load.paths = [...new Set([...existingPaths, pluginPath])];
|
|
652
|
+
// Enable plugin (files already deployed to extensions dir by deployPlugin)
|
|
653
|
+
const enableResult = await oc(["plugins", "enable", "openviking"]);
|
|
654
|
+
if (enableResult.code !== 0) throw new Error(`openclaw plugins enable failed (exit code ${enableResult.code})`);
|
|
655
|
+
await oc(["config", "set", "plugins.slots.contextEngine", "openviking"]);
|
|
659
656
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
targetUri: "viking://user/memories",
|
|
663
|
-
autoRecall: true,
|
|
664
|
-
autoCapture: true,
|
|
665
|
-
};
|
|
657
|
+
// Set gateway mode
|
|
658
|
+
await oc(["config", "set", "gateway.mode", "local"]);
|
|
666
659
|
|
|
660
|
+
// Set plugin config for the selected mode
|
|
667
661
|
if (selectedMode === "local") {
|
|
668
|
-
|
|
669
|
-
|
|
662
|
+
const ovConfPath = join(OPENVIKING_DIR, "ov.conf");
|
|
663
|
+
await oc(["config", "set", "plugins.entries.openviking.config.mode", "local"]);
|
|
664
|
+
await oc(["config", "set", "plugins.entries.openviking.config.configPath", ovConfPath]);
|
|
665
|
+
await oc(["config", "set", "plugins.entries.openviking.config.port", String(selectedServerPort)]);
|
|
670
666
|
} else {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
if (
|
|
667
|
+
await oc(["config", "set", "plugins.entries.openviking.config.mode", "remote"]);
|
|
668
|
+
await oc(["config", "set", "plugins.entries.openviking.config.baseUrl", remoteBaseUrl]);
|
|
669
|
+
if (remoteApiKey) {
|
|
670
|
+
await oc(["config", "set", "plugins.entries.openviking.config.apiKey", remoteApiKey]);
|
|
671
|
+
}
|
|
672
|
+
if (remoteAgentId) {
|
|
673
|
+
await oc(["config", "set", "plugins.entries.openviking.config.agentId", remoteAgentId]);
|
|
674
|
+
}
|
|
674
675
|
}
|
|
675
676
|
|
|
676
|
-
config.plugins.entries["memory-openviking"] = { config: pluginConfig };
|
|
677
|
-
config.gateway.mode = "local";
|
|
678
|
-
|
|
679
|
-
await mkdir(OPENCLAW_DIR, { recursive: true });
|
|
680
|
-
await writeFile(configPath, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
681
677
|
info(tr("OpenClaw plugin configured", "OpenClaw 插件配置完成"));
|
|
682
678
|
}
|
|
683
679
|
|
|
@@ -767,7 +763,7 @@ async function main() {
|
|
|
767
763
|
}
|
|
768
764
|
|
|
769
765
|
let pluginPath;
|
|
770
|
-
const localPluginDir = openvikingRepo ? join(openvikingRepo, "examples", "openclaw-
|
|
766
|
+
const localPluginDir = openvikingRepo ? join(openvikingRepo, "examples", "openclaw-plugin") : "";
|
|
771
767
|
if (openvikingRepo && existsSync(join(localPluginDir, "index.ts"))) {
|
|
772
768
|
pluginPath = localPluginDir;
|
|
773
769
|
info(tr(`Using local plugin from repo: ${pluginPath}`, `使用仓库内插件: ${pluginPath}`));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-openviking-setup-helper",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Setup helper for installing OpenViking memory plugin into OpenClaw",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
23
|
"url": "git+https://github.com/volcengine/OpenViking.git",
|
|
24
|
-
"directory": "examples/openclaw-
|
|
24
|
+
"directory": "examples/openclaw-plugin/setup-helper"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
27
|
"install.js"
|