@openviking/opencode-plugin 0.1.6 → 0.2.1
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-ZH.md +50 -49
- package/INSTALL.md +50 -49
- package/README.md +57 -126
- package/index.mjs +20 -12
- package/lib/config.mjs +284 -0
- package/lib/mcp-config.mjs +21 -0
- package/lib/memory-recall.mjs +21 -172
- package/lib/memory-session.mjs +301 -478
- package/lib/repo-context.mjs +5 -5
- package/lib/session-inject.mjs +71 -0
- package/lib/shared/capture-utils.mjs +500 -0
- package/lib/shared/credentials.mjs +207 -0
- package/lib/shared/debug-log.mjs +58 -0
- package/lib/shared/mcp-proxy-core.mjs +451 -0
- package/lib/shared/pending-queue.mjs +439 -0
- package/lib/shared/profile-inject.mjs +294 -0
- package/lib/shared/recall-core.mjs +302 -0
- package/lib/shared/session-model.mjs +57 -0
- package/lib/shared/setup-wizard.mjs +111 -0
- package/lib/shared/uri-guard.mjs +56 -0
- package/lib/shared/workspace-peer.mjs +16 -0
- package/lib/utils.mjs +34 -117
- package/lib/viking-uri-guard.mjs +9 -24
- package/package.json +8 -7
- package/scripts/setup.mjs +8 -0
- package/servers/mcp-proxy.mjs +69 -0
- package/servers/mcp-proxy.test.mjs +100 -0
- package/lib/code-tools.mjs +0 -134
- package/lib/memadd-local.mjs +0 -118
- package/lib/memory-tools.mjs +0 -410
package/INSTALL-ZH.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
这个插件新增了一个面向 OpenCode 的统一 OpenViking 插件:
|
|
4
4
|
|
|
5
|
-
-
|
|
5
|
+
- 面向 memory、resources 和 code context 的 OpenViking MCP 工具
|
|
6
6
|
- 长期记忆、session 同步、生命周期边界 commit、自动 recall
|
|
7
7
|
|
|
8
|
-
这是仓库中唯一继续维护的 OpenCode 插件示例。这个插件不再安装 `skills/openviking/SKILL.md`,也不要求 agent 使用 `ov`
|
|
8
|
+
这是仓库中唯一继续维护的 OpenCode 插件示例。这个插件不再安装 `skills/openviking/SKILL.md`,也不要求 agent 使用 `ov` 命令。模型工具由 Claude Code 和 Codex 记忆插件同款的 stdio MCP proxy 提供。
|
|
9
9
|
|
|
10
10
|
## 前置条件
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
- OpenCode
|
|
15
15
|
- OpenViking HTTP Server
|
|
16
|
-
- Node.js
|
|
16
|
+
- Node.js 18+
|
|
17
17
|
- 如果服务端启用了认证,需要可用的 OpenViking API Key
|
|
18
18
|
|
|
19
19
|
建议先启动 OpenViking:
|
|
@@ -53,8 +53,7 @@ mkdir -p ~/.config/opencode/plugins/openviking
|
|
|
53
53
|
cp examples/opencode-plugin/wrappers/openviking.js ~/.config/opencode/plugins/openviking.js
|
|
54
54
|
cp examples/opencode-plugin/index.mjs examples/opencode-plugin/package.json ~/.config/opencode/plugins/openviking/
|
|
55
55
|
cp -r examples/opencode-plugin/lib ~/.config/opencode/plugins/openviking/
|
|
56
|
-
|
|
57
|
-
npm install
|
|
56
|
+
cp -r examples/opencode-plugin/servers ~/.config/opencode/plugins/openviking/
|
|
58
57
|
```
|
|
59
58
|
|
|
60
59
|
安装后结构应类似:
|
|
@@ -66,7 +65,7 @@ npm install
|
|
|
66
65
|
├── index.mjs
|
|
67
66
|
├── package.json
|
|
68
67
|
├── lib/
|
|
69
|
-
└──
|
|
68
|
+
└── servers/
|
|
70
69
|
```
|
|
71
70
|
|
|
72
71
|
顶层 `openviking.js` 只负责把 OpenCode 能发现的一级 `.js` 入口转发到插件目录:
|
|
@@ -92,22 +91,22 @@ export { OpenVikingPlugin, default } from "./openviking/index.mjs"
|
|
|
92
91
|
|
|
93
92
|
```json
|
|
94
93
|
{
|
|
95
|
-
"endpoint": "http://localhost:1933",
|
|
96
|
-
"apiKey": "",
|
|
97
|
-
"account": "",
|
|
98
|
-
"user": "",
|
|
99
|
-
"peerId": "",
|
|
100
94
|
"enabled": true,
|
|
101
95
|
"timeoutMs": 30000,
|
|
102
96
|
"repoContext": { "enabled": true, "cacheTtlMs": 60000 },
|
|
103
97
|
"autoRecall": {
|
|
104
98
|
"enabled": true,
|
|
105
99
|
"limit": 6,
|
|
106
|
-
"scoreThreshold": 0.
|
|
100
|
+
"scoreThreshold": 0.35,
|
|
107
101
|
"maxContentChars": 500,
|
|
108
102
|
"preferAbstract": true,
|
|
109
|
-
"tokenBudget": 2000
|
|
110
|
-
|
|
103
|
+
"tokenBudget": 2000,
|
|
104
|
+
"minQueryLength": 3
|
|
105
|
+
},
|
|
106
|
+
"commitTokenThreshold": 20000,
|
|
107
|
+
"commitKeepRecentCount": 10,
|
|
108
|
+
"profileTokenBudget": 10000,
|
|
109
|
+
"resumeContextBudget": 32000
|
|
111
110
|
}
|
|
112
111
|
```
|
|
113
112
|
|
|
@@ -117,7 +116,7 @@ export { OpenVikingPlugin, default } from "./openviking/index.mjs"
|
|
|
117
116
|
export OPENVIKING_API_KEY="your-api-key-here"
|
|
118
117
|
```
|
|
119
118
|
|
|
120
|
-
`
|
|
119
|
+
API key 会从环境变量或 `~/.openviking/ovcli.conf` 读取,并由 hooks 和 MCP proxy 作为 `Authorization: Bearer ...` 发送。`account` 和 `user` 是 trusted mode
|
|
121
120
|
身份头,会作为 `X-OpenViking-Account`、`X-OpenViking-User` 发送;使用
|
|
122
121
|
user/admin API key 的 API_KEY mode 时应留空。
|
|
123
122
|
`peerId` 会作为 `X-OpenViking-Actor-Peer` 用于数据面的 memory/resource 请求;捕获 session message 时仍写入 body `peer_id`。需要 peer 维度路由时请显式配置。
|
|
@@ -132,13 +131,13 @@ user/admin API key 的 API_KEY mode 时应留空。
|
|
|
132
131
|
|
|
133
132
|
修改插件或 OpenViking 配置后,需要重启 OpenCode。
|
|
134
133
|
|
|
135
|
-
进入新的 OpenCode session 后,可以让 agent 浏览 OpenViking memory
|
|
134
|
+
进入新的 OpenCode session 后,可以让 agent 浏览 OpenViking memory,或搜索一个已索引的资源。插件应暴露 OpenViking MCP server,OpenCode 中的工具名会带 `openviking_` 前缀:
|
|
136
135
|
|
|
137
|
-
- `
|
|
138
|
-
- `
|
|
139
|
-
- `
|
|
140
|
-
- `
|
|
141
|
-
- `
|
|
136
|
+
- `openviking_recall`、`openviking_search`、`openviking_find`
|
|
137
|
+
- `openviking_read`、`openviking_list`、`openviking_grep`、`openviking_glob`
|
|
138
|
+
- `openviking_remember`、`openviking_add_resource`、`openviking_forget`、`openviking_health`
|
|
139
|
+
- `openviking_list_watches`、`openviking_cancel_watch`
|
|
140
|
+
- `openviking_code_search`、`openviking_code_outline`、`openviking_code_expand`
|
|
142
141
|
|
|
143
142
|
如果行为异常,先查看运行时文件:
|
|
144
143
|
|
|
@@ -153,35 +152,37 @@ tail -n 100 ~/.config/opencode/openviking/openviking-memory.log
|
|
|
153
152
|
curl http://localhost:1933/health
|
|
154
153
|
```
|
|
155
154
|
|
|
156
|
-
##
|
|
155
|
+
## 可用 MCP 工具
|
|
157
156
|
|
|
158
|
-
插件会通过 OpenCode `
|
|
157
|
+
插件会通过 OpenCode config 注册 OpenViking stdio MCP proxy。服务端实际返回的 `tools/list` 是最终工具清单;当前 OpenViking server 暴露:
|
|
159
158
|
|
|
160
|
-
- `
|
|
161
|
-
- `
|
|
162
|
-
- `
|
|
163
|
-
- `
|
|
164
|
-
- `
|
|
165
|
-
- `
|
|
166
|
-
- `
|
|
167
|
-
- `
|
|
168
|
-
- `
|
|
169
|
-
- `
|
|
159
|
+
- `openviking_recall`:面向当前任务的平衡召回
|
|
160
|
+
- `openviking_search`:跨 memories/resources/skills 的深度语义检索
|
|
161
|
+
- `openviking_find`:快速语义检索
|
|
162
|
+
- `openviking_remember`:存储重要事实或决策,供记忆提取
|
|
163
|
+
- `openviking_read`:读取一个或多个 `viking://` 文件
|
|
164
|
+
- `openviking_list`:列出 `viking://` 目录
|
|
165
|
+
- `openviking_grep`:精确文本或正则搜索
|
|
166
|
+
- `openviking_glob`:glob 文件匹配
|
|
167
|
+
- `openviking_add_resource`:添加 URL、本地文件、sitemap 或 feed
|
|
168
|
+
- `openviking_forget`:在用户明确确认后删除 `viking://` URI
|
|
169
|
+
- `openviking_list_watches` / `openviking_cancel_watch`:查看或取消资源 watch
|
|
170
|
+
- `openviking_code_search`、`openviking_code_outline`、`openviking_code_expand`:查看已索引代码符号
|
|
171
|
+
- `openviking_health`:检查 OpenViking server 健康状态
|
|
170
172
|
|
|
171
173
|
使用建议:
|
|
172
174
|
|
|
173
|
-
- 概念性问题用 `
|
|
174
|
-
- 精确符号、函数名、类名、报错字符串用 `
|
|
175
|
-
- 枚举文件用 `
|
|
176
|
-
- 读取内容用 `
|
|
177
|
-
- 探索目录结构用 `
|
|
178
|
-
-
|
|
179
|
-
-
|
|
180
|
-
- 如果 agent 误用 OpenCode 本地 `read`、`glob`、`grep` 工具访问 `viking://` URI,插件会阻止这次本地文件系统调用,并提示改用 `memread`、`membrowse` 或 `memsearch`。
|
|
175
|
+
- 概念性问题用 `openviking_search`
|
|
176
|
+
- 精确符号、函数名、类名、报错字符串用 `openviking_grep`
|
|
177
|
+
- 枚举文件用 `openviking_glob`
|
|
178
|
+
- 读取内容用 `openviking_read`
|
|
179
|
+
- 探索目录结构用 `openviking_list`
|
|
180
|
+
- 删除前必须先获得用户明确确认,再调用 `openviking_forget`
|
|
181
|
+
- 如果 agent 误用 OpenCode 本地 `read`、`glob`、`grep` 工具访问 `viking://` URI,插件会阻止这次本地文件系统调用,并提示改用 MCP 工具。
|
|
181
182
|
|
|
182
|
-
## `
|
|
183
|
+
## `openviking_add_resource` 本地文件
|
|
183
184
|
|
|
184
|
-
`
|
|
185
|
+
`openviking_add_resource` 支持三类输入:
|
|
185
186
|
|
|
186
187
|
- 远端 `http(s)` URL:直接调用 `/api/v1/resources`
|
|
187
188
|
- 本地文件路径:先调用 `/api/v1/resources/temp_upload`,再用返回的 `temp_file_id` 添加资源
|
|
@@ -190,9 +191,9 @@ curl http://localhost:1933/health
|
|
|
190
191
|
相对路径会按 OpenCode 当前项目目录解析。示例:
|
|
191
192
|
|
|
192
193
|
```text
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
openviking_add_resource(path="https://example.com/spec.md", to="viking://resources/spec")
|
|
195
|
+
openviking_add_resource(path="./docs/notes.md", to="viking://resources/notes.md")
|
|
196
|
+
openviking_add_resource(path="file:///home/alice/project/notes.md", description="project notes")
|
|
196
197
|
```
|
|
197
198
|
|
|
198
199
|
当前仍不支持本地目录自动打 zip 上传;传入目录时会返回明确错误。
|
|
@@ -208,7 +209,7 @@ memadd path="file:///home/alice/project/notes.md" reason="project notes"
|
|
|
208
209
|
可能包含:
|
|
209
210
|
|
|
210
211
|
- `openviking-memory.log`
|
|
211
|
-
- `openviking-session-
|
|
212
|
+
- `openviking-session-state.json`
|
|
212
213
|
|
|
213
214
|
可以通过配置里的 `runtime.dataDir` 修改这个目录。
|
|
214
215
|
|
|
@@ -219,7 +220,7 @@ memadd path="file:///home/alice/project/notes.md" reason="project notes"
|
|
|
219
220
|
| 问题 | 排查方向 |
|
|
220
221
|
|------|----------|
|
|
221
222
|
| 插件没有加载 | package 安装检查 `~/.config/opencode/opencode.json` 是否包含 `@openviking/opencode-plugin`;源码安装检查 `~/.config/opencode/plugins/openviking.js` 是否存在 |
|
|
222
|
-
|
|
|
223
|
+
| MCP tools 连到了错误的 server | 检查 `~/.openviking/ovcli.conf`,或用 `OPENVIKING_*` 环境变量 / `OPENVIKING_PLUGIN_CONFIG` 指向正确配置 |
|
|
223
224
|
| OpenViking 返回 401 / 403 | 检查 `OPENVIKING_API_KEY`;trusted-mode 部署还要检查 `OPENVIKING_ACCOUNT` 和 `OPENVIKING_USER` |
|
|
224
225
|
| recall 为空 | 确认 OpenViking 中已有 memories/resources,并且 `autoRecall.enabled` 为 `true` |
|
|
225
|
-
| 本地 `
|
|
226
|
+
| 本地 `openviking_add_resource` 失败 | 传入文件路径而不是目录;目前还不支持自动上传本地目录 |
|
package/INSTALL.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
This plugin adds one unified OpenViking plugin for OpenCode:
|
|
4
4
|
|
|
5
|
-
-
|
|
5
|
+
- OpenViking MCP tools for memory, resources, and code context
|
|
6
6
|
- Long-term memory, session synchronization, lifecycle commit, and automatic recall
|
|
7
7
|
|
|
8
|
-
This is the only OpenCode plugin example maintained in this repository. It does not install `skills/openviking/SKILL.md`, and it does not require the agent to use the `ov` command.
|
|
8
|
+
This is the only OpenCode plugin example maintained in this repository. It does not install `skills/openviking/SKILL.md`, and it does not require the agent to use the `ov` command. Model tools are provided by the same stdio MCP proxy used by the Claude Code and Codex memory plugins.
|
|
9
9
|
|
|
10
10
|
## Prerequisites
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ Prepare the following first:
|
|
|
13
13
|
|
|
14
14
|
- OpenCode
|
|
15
15
|
- OpenViking HTTP Server
|
|
16
|
-
- Node.js
|
|
16
|
+
- Node.js 18+
|
|
17
17
|
- A valid OpenViking API key if authentication is enabled on the server
|
|
18
18
|
|
|
19
19
|
Start OpenViking first:
|
|
@@ -53,8 +53,7 @@ mkdir -p ~/.config/opencode/plugins/openviking
|
|
|
53
53
|
cp examples/opencode-plugin/wrappers/openviking.js ~/.config/opencode/plugins/openviking.js
|
|
54
54
|
cp examples/opencode-plugin/index.mjs examples/opencode-plugin/package.json ~/.config/opencode/plugins/openviking/
|
|
55
55
|
cp -r examples/opencode-plugin/lib ~/.config/opencode/plugins/openviking/
|
|
56
|
-
|
|
57
|
-
npm install
|
|
56
|
+
cp -r examples/opencode-plugin/servers ~/.config/opencode/plugins/openviking/
|
|
58
57
|
```
|
|
59
58
|
|
|
60
59
|
After installation, the layout should look like this:
|
|
@@ -66,7 +65,7 @@ After installation, the layout should look like this:
|
|
|
66
65
|
├── index.mjs
|
|
67
66
|
├── package.json
|
|
68
67
|
├── lib/
|
|
69
|
-
└──
|
|
68
|
+
└── servers/
|
|
70
69
|
```
|
|
71
70
|
|
|
72
71
|
The top-level `openviking.js` forwards the first-level `.js` entry that OpenCode can discover to the actual plugin directory:
|
|
@@ -92,22 +91,22 @@ Example configuration:
|
|
|
92
91
|
|
|
93
92
|
```json
|
|
94
93
|
{
|
|
95
|
-
"endpoint": "http://localhost:1933",
|
|
96
|
-
"apiKey": "",
|
|
97
|
-
"account": "",
|
|
98
|
-
"user": "",
|
|
99
|
-
"peerId": "",
|
|
100
94
|
"enabled": true,
|
|
101
95
|
"timeoutMs": 30000,
|
|
102
96
|
"repoContext": { "enabled": true, "cacheTtlMs": 60000 },
|
|
103
97
|
"autoRecall": {
|
|
104
98
|
"enabled": true,
|
|
105
99
|
"limit": 6,
|
|
106
|
-
"scoreThreshold": 0.
|
|
100
|
+
"scoreThreshold": 0.35,
|
|
107
101
|
"maxContentChars": 500,
|
|
108
102
|
"preferAbstract": true,
|
|
109
|
-
"tokenBudget": 2000
|
|
110
|
-
|
|
103
|
+
"tokenBudget": 2000,
|
|
104
|
+
"minQueryLength": 3
|
|
105
|
+
},
|
|
106
|
+
"commitTokenThreshold": 20000,
|
|
107
|
+
"commitKeepRecentCount": 10,
|
|
108
|
+
"profileTokenBudget": 10000,
|
|
109
|
+
"resumeContextBudget": 32000
|
|
111
110
|
}
|
|
112
111
|
```
|
|
113
112
|
|
|
@@ -117,7 +116,7 @@ It is recommended to provide the API key through an environment variable instead
|
|
|
117
116
|
export OPENVIKING_API_KEY="your-api-key-here"
|
|
118
117
|
```
|
|
119
118
|
|
|
120
|
-
`
|
|
119
|
+
API keys are resolved from environment variables or `~/.openviking/ovcli.conf` and sent as `Authorization: Bearer ...` by both hooks and the MCP proxy. `account` and `user` are trusted-mode identity headers sent as `X-OpenViking-Account` and `X-OpenViking-User`; leave them empty when using API-key mode with user/admin API keys. `peerId` is sent as `X-OpenViking-Actor-Peer` on data-plane memory/resource requests; captured session messages store it as body `peer_id`.
|
|
121
120
|
|
|
122
121
|
`OPENVIKING_API_KEY`, `OPENVIKING_ACCOUNT`, `OPENVIKING_USER`, and `OPENVIKING_PEER_ID` take precedence over the corresponding values in `openviking-config.json`.
|
|
123
122
|
|
|
@@ -127,13 +126,13 @@ For advanced setups, use `OPENVIKING_PLUGIN_CONFIG` to point to another configur
|
|
|
127
126
|
|
|
128
127
|
Restart OpenCode after changing plugin or OpenViking configuration.
|
|
129
128
|
|
|
130
|
-
In a new OpenCode session, ask the agent to browse OpenViking memory or search for a known indexed resource. The plugin should expose
|
|
129
|
+
In a new OpenCode session, ask the agent to browse OpenViking memory or search for a known indexed resource. The plugin should expose the OpenViking MCP server, with tools namespaced by OpenCode as `openviking_*`:
|
|
131
130
|
|
|
132
|
-
- `
|
|
133
|
-
- `
|
|
134
|
-
- `
|
|
135
|
-
- `
|
|
136
|
-
- `
|
|
131
|
+
- `openviking_recall`, `openviking_search`, `openviking_find`
|
|
132
|
+
- `openviking_read`, `openviking_list`, `openviking_grep`, `openviking_glob`
|
|
133
|
+
- `openviking_remember`, `openviking_add_resource`, `openviking_forget`, `openviking_health`
|
|
134
|
+
- `openviking_list_watches`, `openviking_cancel_watch`
|
|
135
|
+
- `openviking_code_search`, `openviking_code_outline`, `openviking_code_expand`
|
|
137
136
|
|
|
138
137
|
If anything looks wrong, check the runtime files:
|
|
139
138
|
|
|
@@ -148,35 +147,37 @@ For a local server, also confirm OpenViking is reachable:
|
|
|
148
147
|
curl http://localhost:1933/health
|
|
149
148
|
```
|
|
150
149
|
|
|
151
|
-
## Available Tools
|
|
150
|
+
## Available MCP Tools
|
|
152
151
|
|
|
153
|
-
The plugin
|
|
152
|
+
The plugin registers OpenViking's stdio MCP proxy through OpenCode config. The server's real `tools/list` response is the source of truth; current OpenViking servers expose:
|
|
154
153
|
|
|
155
|
-
- `
|
|
156
|
-
- `
|
|
157
|
-
- `
|
|
158
|
-
- `
|
|
159
|
-
- `
|
|
160
|
-
- `
|
|
161
|
-
- `
|
|
162
|
-
- `
|
|
163
|
-
- `
|
|
164
|
-
- `
|
|
154
|
+
- `openviking_recall`: balanced current-task recall.
|
|
155
|
+
- `openviking_search`: deep semantic retrieval across memories, resources, and skills.
|
|
156
|
+
- `openviking_find`: fast semantic retrieval.
|
|
157
|
+
- `openviking_remember`: store important facts or decisions for memory extraction.
|
|
158
|
+
- `openviking_read`: read one or more `viking://` files.
|
|
159
|
+
- `openviking_list`: list a `viking://` directory.
|
|
160
|
+
- `openviking_grep`: exact text or regex search.
|
|
161
|
+
- `openviking_glob`: glob file matching.
|
|
162
|
+
- `openviking_add_resource`: add a URL, local file, sitemap, or feed.
|
|
163
|
+
- `openviking_forget`: delete a `viking://` URI after explicit user confirmation.
|
|
164
|
+
- `openviking_list_watches` / `openviking_cancel_watch`: inspect or cancel resource watches.
|
|
165
|
+
- `openviking_code_search`, `openviking_code_outline`, `openviking_code_expand`: inspect indexed code symbols.
|
|
166
|
+
- `openviking_health`: check OpenViking server health.
|
|
165
167
|
|
|
166
168
|
Usage guidance:
|
|
167
169
|
|
|
168
|
-
- Use `
|
|
169
|
-
- Use `
|
|
170
|
-
- Use `
|
|
171
|
-
- Use `
|
|
172
|
-
- Use `
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
- If an agent tries to use OpenCode's local `read`, `glob`, or `grep` tools on a `viking://` URI, the plugin blocks that call and points it to `memread`, `membrowse`, or `memsearch`.
|
|
170
|
+
- Use `openviking_search` for conceptual questions.
|
|
171
|
+
- Use `openviking_grep` for exact symbols, function names, class names, or error strings.
|
|
172
|
+
- Use `openviking_glob` to enumerate files.
|
|
173
|
+
- Use `openviking_read` to read content.
|
|
174
|
+
- Use `openviking_list` to explore directory structure.
|
|
175
|
+
- Before deleting anything, obtain explicit user confirmation first; then call `openviking_forget`.
|
|
176
|
+
- If an agent tries to use OpenCode's local `read`, `glob`, or `grep` tools on a `viking://` URI, the plugin blocks that call and points it to the MCP tools.
|
|
176
177
|
|
|
177
|
-
## Local Files with `
|
|
178
|
+
## Local Files with `openviking_add_resource`
|
|
178
179
|
|
|
179
|
-
`
|
|
180
|
+
`openviking_add_resource` supports three input types:
|
|
180
181
|
|
|
181
182
|
- Remote `http(s)` URL: directly calls `/api/v1/resources`
|
|
182
183
|
- Local file path: first calls `/api/v1/resources/temp_upload`, then adds the resource using the returned `temp_file_id`
|
|
@@ -185,9 +186,9 @@ Usage guidance:
|
|
|
185
186
|
Relative paths are resolved against the current OpenCode project directory. Examples:
|
|
186
187
|
|
|
187
188
|
```text
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
openviking_add_resource(path="https://example.com/spec.md", to="viking://resources/spec")
|
|
190
|
+
openviking_add_resource(path="./docs/notes.md", to="viking://resources/notes.md")
|
|
191
|
+
openviking_add_resource(path="file:///home/alice/project/notes.md", description="project notes")
|
|
191
192
|
```
|
|
192
193
|
|
|
193
194
|
Automatic zip upload for local directories is not supported yet. Passing a directory will return a clear error.
|
|
@@ -203,7 +204,7 @@ By default, the plugin writes runtime files to:
|
|
|
203
204
|
Possible files include:
|
|
204
205
|
|
|
205
206
|
- `openviking-memory.log`
|
|
206
|
-
- `openviking-session-
|
|
207
|
+
- `openviking-session-state.json`
|
|
207
208
|
|
|
208
209
|
You can change this directory with `runtime.dataDir` in the configuration.
|
|
209
210
|
|
|
@@ -214,7 +215,7 @@ These are local runtime files and should not be committed to the repository.
|
|
|
214
215
|
| Issue | What to check |
|
|
215
216
|
|-------|---------------|
|
|
216
217
|
| Plugin does not load | For package installs, confirm `~/.config/opencode/opencode.json` contains `@openviking/opencode-plugin`; for source installs, confirm `~/.config/opencode/plugins/openviking.js` exists |
|
|
217
|
-
|
|
|
218
|
+
| MCP tools call the wrong server | Check `~/.openviking/ovcli.conf`, or set `OPENVIKING_*` env vars / `OPENVIKING_PLUGIN_CONFIG` to the intended config path |
|
|
218
219
|
| 401 / 403 from OpenViking | Verify `OPENVIKING_API_KEY`; for trusted-mode deployments, also verify `OPENVIKING_ACCOUNT` and `OPENVIKING_USER` |
|
|
219
220
|
| Recall is empty | Confirm OpenViking has indexed memories/resources and `autoRecall.enabled` is `true` |
|
|
220
|
-
| Local `
|
|
221
|
+
| Local `openviking_add_resource` fails | Pass a file path, not a directory; local directories are not uploaded automatically yet |
|