@zilliz/memsearch-opencode 0.3.0 → 0.3.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/README.md CHANGED
@@ -148,13 +148,22 @@ memsearch config set embedding.provider openai
148
148
  export OPENAI_API_KEY=sk-...
149
149
  ```
150
150
 
151
- To override only the OpenCode capture summarization model:
151
+ To override only the OpenCode native capture summarization model:
152
152
 
153
153
  ```bash
154
154
  memsearch config set plugins.opencode.summarize.model anthropic/claude-haiku
155
155
  ```
156
156
 
157
- Leave it empty or unset to keep the current `small_model` / plugin default behavior. This setting does not fall back to `llm.model`.
157
+ To use a memsearch-managed API provider instead:
158
+
159
+ ```bash
160
+ memsearch config set llm.providers.openai.type openai
161
+ memsearch config set llm.providers.openai.model gpt-4o-mini
162
+ memsearch config set llm.providers.openai.api_key env:OPENAI_API_KEY
163
+ memsearch config set plugins.opencode.summarize.provider openai
164
+ ```
165
+
166
+ Leave `plugins.opencode.summarize.provider` empty or set it to `native` to keep the current `small_model` / plugin default behavior. This setting does not fall back to `llm.model`.
158
167
 
159
168
  ## How It Works
160
169
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zilliz/memsearch-opencode",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "memsearch plugin for OpenCode — semantic memory search across sessions",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -90,6 +90,22 @@ def get_plugin_summarize_model(memsearch_cmd: str | None = None) -> str:
90
90
  return ""
91
91
 
92
92
 
93
+ def get_plugin_summarize_provider(memsearch_cmd: str | None = None) -> str:
94
+ """Read the memsearch OpenCode summarize provider route."""
95
+ if not memsearch_cmd:
96
+ return ""
97
+ try:
98
+ result = subprocess.run(
99
+ [*split_memsearch_cmd(memsearch_cmd), "config", "get", "plugins.opencode.summarize.provider"],
100
+ capture_output=True,
101
+ text=True,
102
+ timeout=5,
103
+ )
104
+ return result.stdout.strip()
105
+ except Exception:
106
+ return ""
107
+
108
+
93
109
  def ensure_isolated_config() -> str:
94
110
  """Create isolated config dir without plugins/ to prevent recursion."""
95
111
  isolated = os.path.expanduser("~/.codex/tmp/opencode-memsearch-summarize/opencode")
@@ -137,9 +153,33 @@ def _load_summarize_prompt(agent_name: str, memsearch_cmd: str | None = None) ->
137
153
 
138
154
 
139
155
  def summarize_with_llm(turn_text: str, small_model: str, memsearch_cmd: str | None = None) -> str | None:
140
- """Summarize using opencode run in isolated env (no plugins -> no recursion)."""
156
+ """Summarize using configured provider routing."""
141
157
  system_prompt = _load_summarize_prompt("OpenCode", memsearch_cmd)
142
158
  full_prompt = f"{system_prompt}\n\nTranscript:\n{turn_text}"
159
+
160
+ summarize_provider = get_plugin_summarize_provider(memsearch_cmd)
161
+ if summarize_provider and summarize_provider != "native" and memsearch_cmd:
162
+ try:
163
+ result = subprocess.run(
164
+ [*split_memsearch_cmd(memsearch_cmd), "summarize", "--plugin", "opencode", "--agent-name", "OpenCode"],
165
+ input=turn_text,
166
+ capture_output=True,
167
+ text=True,
168
+ timeout=30,
169
+ env={**os.environ, "MEMSEARCH_NO_WATCH": "1"},
170
+ )
171
+ output = result.stdout.strip()
172
+ lines = output.split("\n")
173
+ bullets = [line for line in lines if line.strip().startswith("- ")]
174
+ if bullets:
175
+ return "\n".join(bullets)
176
+ if output:
177
+ return output
178
+ except Exception:
179
+ pass
180
+ return None
181
+
182
+ # Native path: summarize using opencode run in isolated env (no plugins -> no recursion).
143
183
  isolated_dir = ensure_isolated_config()
144
184
 
145
185
  summarize_model = get_plugin_summarize_model(memsearch_cmd) or small_model