openviking-opencode 0.2.1 → 0.2.3

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.
Files changed (3) hide show
  1. package/README.md +47 -11
  2. package/index.mjs +15 -20
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -21,28 +21,64 @@ pip install openviking
21
21
 
22
22
  ### 2. Configure OpenViking
23
23
 
24
- OpenViking requires an embedding model and a VLM (for generating directory summaries). Create `~/.openviking/ov.conf`:
25
-
26
- ```bash
27
- cp /path/to/OpenViking/examples/ov.conf.example ~/.openviking/ov.conf
28
- ```
29
-
30
- Then fill in your API keys. Minimum required fields:
24
+ OpenViking requires an embedding model and a VLM (for generating directory summaries). Create `~/.openviking/ov.conf` with the following structure:
31
25
 
32
26
  ```json
33
27
  {
28
+ "server": {
29
+ "host": "0.0.0.0",
30
+ "port": 1933,
31
+ "api_key": null,
32
+ "cors_origins": ["*"]
33
+ },
34
+ "storage": {
35
+ "workspace": "/path/to/your/workspace",
36
+ "vectordb": {
37
+ "name": "context",
38
+ "backend": "local",
39
+ "project": "default"
40
+ },
41
+ "agfs": {
42
+ "port": 1833,
43
+ "log_level": "warn",
44
+ "backend": "local",
45
+ "timeout": 10,
46
+ "retry_times": 3
47
+ }
48
+ },
34
49
  "embedding": {
35
- "provider": "openai",
36
- "api_key": "sk-..."
50
+ "dense": {
51
+ "model": "your-embedding-model",
52
+ "api_key": "your-api-key",
53
+ "api_base": "https://your-provider/api/v3",
54
+ "dimension": 1024,
55
+ "provider": "openai",
56
+ "input": "multimodal"
57
+ },
58
+ "max_concurrent": 100
37
59
  },
38
60
  "vlm": {
61
+ "model": "your-vlm-model",
62
+ "api_key": "your-api-key",
63
+ "api_base": "https://your-provider/api/v3",
64
+ "temperature": 0,
65
+ "max_retries": 2,
39
66
  "provider": "openai",
40
- "model": "gpt-4o-mini",
41
- "api_key": "sk-..."
67
+ "thinking": false
68
+ },
69
+ "auto_generate_l0": true,
70
+ "auto_generate_l1": true,
71
+ "default_search_mode": "thinking",
72
+ "default_search_limit": 3,
73
+ "log": {
74
+ "level": "WARNING"
42
75
  }
43
76
  }
44
77
  ```
45
78
 
79
+ > **Important: set `embedding.max_concurrent` to at least `100`.**
80
+ > The default value is too low — indexing a repo will be extremely slow without this. Each file requires an embedding call, and low concurrency means they queue up one by one.
81
+
46
82
  > See the [OpenViking docs](https://github.com/OpenVikingDB/OpenViking) for all supported providers.
47
83
 
48
84
  ### 3. Install OpenCode
package/index.mjs CHANGED
@@ -15,18 +15,9 @@ async function run(cmd, opts = {}) {
15
15
  return execAsync(cmd, { timeout: 10000, ...opts })
16
16
  }
17
17
 
18
- async function isInstalled() {
19
- try {
20
- await run("openviking --version")
21
- return true
22
- } catch {
23
- return false
24
- }
25
- }
26
-
27
18
  async function isHealthy() {
28
19
  try {
29
- await run("openviking health")
20
+ await run("openviking health", { timeout: 3000 })
30
21
  return true
31
22
  } catch {
32
23
  return false
@@ -95,25 +86,29 @@ async function init(client) {
95
86
  body: { title: "OpenViking", message, variant, duration: 8000 },
96
87
  }).catch(() => {})
97
88
 
98
- // 1. openviking 没装
99
- if (!(await isInstalled())) {
89
+ // 服务已在跑,直接返回
90
+ if (await isHealthy()) return true
91
+
92
+ // 没跑,先看是哪种情况
93
+ try {
94
+ await run("command -v openviking", { timeout: 2000 })
95
+ } catch {
96
+ // command not found → 没装
100
97
  await toast("openviking 未安装,请运行: pip install openviking", "error")
101
98
  return false
102
99
  }
103
100
 
104
- // 2. ov.conf 不存在(装了但没配置)
101
+ // 装了但没有配置文件 无法启动
105
102
  if (!existsSync(OV_CONF)) {
106
103
  await toast("未找到 ~/.openviking/ov.conf,请先配置 API keys 后再启动服务", "warning")
107
104
  return false
108
105
  }
109
106
 
110
- // 3. 服务没跑 → 静默自动启动
111
- if (!(await isHealthy())) {
112
- const started = await startServer()
113
- if (!started) {
114
- await toast("openviking 服务启动失败,查看日志: /tmp/openviking.log", "error")
115
- return false
116
- }
107
+ // 装了有配置,服务没跑 → 静默自动启动
108
+ const started = await startServer()
109
+ if (!started) {
110
+ await toast("openviking 服务启动失败,查看日志: /tmp/openviking.log", "error")
111
+ return false
117
112
  }
118
113
 
119
114
  return true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openviking-opencode",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "OpenCode plugin for OpenViking — injects indexed repo context into the AI assistant and auto-installs the openviking skill",
5
5
  "type": "module",
6
6
  "main": "index.mjs",