opencode-sessions-explorer 0.1.1 → 0.1.2

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.
@@ -0,0 +1,230 @@
1
+ # Troubleshooting
2
+
3
+ ## How To Use This Page
4
+
5
+ Find the symptom that matches what you are seeing, run its quick checks, then apply
6
+ the fix. Each block is phrased the way the problem usually appears — an error code in
7
+ a tool response, an empty result, or a failed restore. Run the baseline checks below
8
+ first; they resolve or explain most issues on their own.
9
+
10
+ ## Baseline Checks
11
+
12
+ Two commands cover the health of every layer the plugin depends on.
13
+
14
+ 1. Probe the install end to end:
15
+
16
+ ```bash
17
+ bunx opencode-sessions-explorer-check-deps
18
+ ```
19
+
20
+ This reports database reachability, schema head and drift, SQLite `json1`,
21
+ `busy_timeout`, export tree presence, curated channel views, `ck` CLI, `ck`
22
+ index, and the tool-output directory. Add `--json` for machine-readable output.
23
+
24
+ 2. Probe the database from inside OpenCode with the `db-stats` tool. It returns the
25
+ migration head, table counts, json1 status, `busy_timeout`, and any schema-drift
26
+ warnings.
27
+
28
+ If both come back clean, the plugin core is healthy and the issue is likely scoped
29
+ to one tool or to the optional `ck` search path.
30
+
31
+ ## Plugin Tools Do Not Appear After Config Change
32
+
33
+ OpenCode starts, but the `opencode-sessions-explorer-*` tools are not available to
34
+ the model after editing config.
35
+
36
+ Quick checks:
37
+
38
+ - Confirm you edited the active OpenCode config path, usually
39
+ `~/.config/opencode/opencode.json`.
40
+ - Confirm the `plugin` array contains either the package spec
41
+ (`"opencode-sessions-explorer"` or a pinned version) or an absolute local path.
42
+ - Confirm you fully quit and restarted OpenCode; do not assume plugin hot reload.
43
+ - If using source TypeScript, confirm the path to `src/plugin.ts` exists.
44
+ - If using built JavaScript, confirm `bun run build` produced `dist/plugin.js`.
45
+ - Confirm `src/plugin.ts` exports only the plugin function; extra non-function
46
+ exports can make OpenCode reject the plugin entrypoint.
47
+
48
+ Fix:
49
+
50
+ - Correct the config, then fully restart OpenCode.
51
+ - For source checkouts, see the supported source TS and built JS options in
52
+ [install.md#from-source-dev](../install.md#from-source-dev).
53
+ - If a local source path still fails, run a local import check from the checkout:
54
+
55
+ ```bash
56
+ bun -e 'import("./src/plugin.ts").then((m) => { if (typeof m.default !== "function") throw new Error("default export is not a function") })'
57
+ ```
58
+
59
+ ## Search Returns CK_NOT_FOUND
60
+
61
+ `search-text` or `grep-session` returns the error code `CK_NOT_FOUND`.
62
+
63
+ Quick checks:
64
+
65
+ - Confirm whether `ck` is installed and on `PATH`: `ck --version`.
66
+ - Run `bunx opencode-sessions-explorer-check-deps` and look at the `ck` line.
67
+
68
+ Fix:
69
+
70
+ - Install [`ck`](https://github.com/BeaconBay/ck) (>= 0.7). If it is installed
71
+ outside `PATH`, point the plugin at it with
72
+ `OPENCODE_SESSIONS_EXPLORER_CK_BIN=/abs/path/to/ck`.
73
+ - `ck` is only needed for `search-text` and `grep-session`. The other 16 tools work
74
+ without it, so recall, browse, cost, and analysis tools remain available
75
+ meanwhile. See [configuration.md](../reference/configuration.md).
76
+
77
+ ## Database Not Found
78
+
79
+ A tool returns `DB_NOT_FOUND`, or `check-deps` fails the "OpenCode DB" line.
80
+
81
+ Quick checks:
82
+
83
+ - Confirm the database exists at the default path
84
+ (`~/.local/share/opencode/opencode.db` on common macOS/Linux installs).
85
+ - Confirm OpenCode has run at least once so the database has been created.
86
+
87
+ Fix:
88
+
89
+ - If the database lives elsewhere, set `OPENCODE_SESSIONS_EXPLORER_DB` to its
90
+ absolute path. If `$XDG_DATA_HOME` or Windows `%LOCALAPPDATA%` changes the data
91
+ root, use that actual path.
92
+ - If the path is correct but access is blocked, add the `external_directory`
93
+ permission rule (next block) and restart OpenCode.
94
+ - See [configuration.md](../reference/configuration.md) for the full override table.
95
+
96
+ ## Search Finds Nothing
97
+
98
+ A search returns zero hits for a term you expect to exist.
99
+
100
+ Quick checks:
101
+
102
+ - Confirm the export tree has been materialized at least once.
103
+ - Note whether the session you expect is very new — its parts may not be exported
104
+ yet.
105
+ - Confirm the term is not being narrowed away by `role`, `surface`, or a time/scope
106
+ filter.
107
+
108
+ Fix:
109
+
110
+ - Run the one-time export, then retry:
111
+
112
+ ```bash
113
+ bunx opencode-sessions-explorer-bulk-export
114
+ ```
115
+
116
+ - New parts are delta-synced automatically before each `search-text` /
117
+ `grep-session` call, so a missing recent part usually resolves on the next search.
118
+ - Widen the search: try `surface:'forensics'` (or `channels:['raw']`) to include raw
119
+ bodies, and confirm `role` is `any`. See
120
+ [search-surfaces.md](../reference/search-surfaces.md).
121
+
122
+ ## grep-session Returns INDEX_MISSING
123
+
124
+ `grep-session` returns `INDEX_MISSING`, usually with a message that the session is
125
+ not in the export tree.
126
+
127
+ Quick checks:
128
+
129
+ - Verify the `session_id` is correct with `get-session` or `list-sessions`.
130
+ - Confirm the export tree exists and includes that session under `by-session/`.
131
+ - If you requested a curated surface/channel, confirm channel views are complete in
132
+ `check-deps`.
133
+
134
+ Fix:
135
+
136
+ - Run the one-time export, then retry `grep-session`:
137
+
138
+ ```bash
139
+ bunx opencode-sessions-explorer-bulk-export
140
+ ```
141
+
142
+ - If the session is very new, retry after the tool's auto-sync has had a chance to
143
+ export recent parts.
144
+ - If channel views are partial or missing, rebuild them:
145
+
146
+ ```bash
147
+ bunx opencode-sessions-explorer-bulk-export --reset
148
+ ```
149
+
150
+ ## Permission Denied / external_directory
151
+
152
+ A tool cannot reach the database even though the path is correct, or OpenCode
153
+ reports an external-directory permission error.
154
+
155
+ Quick checks:
156
+
157
+ - Confirm the `external_directory` allow rule is present in your OpenCode config.
158
+ - Confirm you fully restarted OpenCode after editing the config.
159
+
160
+ Fix:
161
+
162
+ - Add the allow rule and restart OpenCode:
163
+
164
+ ```jsonc
165
+ // ~/.config/opencode/opencode.json
166
+ {
167
+ "permission": {
168
+ "external_directory": {
169
+ "~/.local/share/opencode/**": "allow"
170
+ }
171
+ }
172
+ }
173
+ ```
174
+
175
+ - The database lives outside your project workspace, so this rule is required. The
176
+ default snippet covers the common macOS/Linux path. If `$XDG_DATA_HOME`, Windows
177
+ `%LOCALAPPDATA%`, or `OPENCODE_SESSIONS_EXPLORER_DB` points elsewhere, allow the
178
+ actual containing directory and restart. Some global configs use
179
+ `external_directory: "allow"`; that also permits access, but a scoped allow rule is
180
+ preferred for normal users. The change only takes effect after a full restart. See
181
+ [configuration.md](../reference/configuration.md).
182
+
183
+ ## Schema Drift Warnings
184
+
185
+ A tool returns `SCHEMA_DRIFT`, or `db-stats` / `check-deps` reports drift warnings.
186
+
187
+ Quick checks:
188
+
189
+ - Run `db-stats` and read `migrations_head` and `drift_warnings`.
190
+ - Run `bunx opencode-sessions-explorer-check-deps` and check the schema line.
191
+ - Note whether you recently upgraded OpenCode.
192
+
193
+ Fix:
194
+
195
+ - Drift warnings usually mean the installed OpenCode version moved the database
196
+ schema ahead of (or behind) what the plugin expects. Align the plugin version with
197
+ your OpenCode version.
198
+ - If the warning is soft, read tools still work; treat the warning as a prompt to
199
+ update. If `hard_drift` is reported, update the plugin before relying on affected
200
+ tools.
201
+
202
+ ## get-part Returns PATH_TRAVERSAL
203
+
204
+ `get-part` with `dereference_output_path:true` returns `PATH_TRAVERSAL`.
205
+
206
+ Quick checks:
207
+
208
+ - Confirm the part's externalized output path resolves inside the tool-output
209
+ directory.
210
+ - Confirm `OPENCODE_SESSIONS_EXPLORER_TOOL_OUTPUT_DIR`, if set, points at the
211
+ directory that actually holds the externalized files.
212
+
213
+ Fix:
214
+
215
+ - Dereference is deliberately whitelisted to the tool-output directory; any path
216
+ outside it (including a symlink that escapes the root) is rejected by design. This
217
+ is a guardrail, not a bug.
218
+ - If your externalized output lives in a non-default location, set
219
+ `OPENCODE_SESSIONS_EXPLORER_TOOL_OUTPUT_DIR` to that root and retry. See
220
+ [configuration.md](../reference/configuration.md) and the redaction/guard policy in
221
+ [SECURITY.md](../../.github/SECURITY.md).
222
+
223
+ ## Related Docs
224
+
225
+ - Tool catalog: [../reference/tools.md](../reference/tools.md)
226
+ - Configuration and environment overrides: [../reference/configuration.md](../reference/configuration.md)
227
+ - Search surfaces and channels: [../reference/search-surfaces.md](../reference/search-surfaces.md)
228
+ - Four-layer architecture: [../reference/architecture.md](../reference/architecture.md)
229
+ - Export and maintenance workflow: [../guides/export-and-maintenance.md](../guides/export-and-maintenance.md)
230
+ - Data exposure and redaction policy: [../../.github/SECURITY.md](../../.github/SECURITY.md)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "opencode-sessions-explorer",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "description": "OpenCode plugin for recall and analysis of past OpenCode sessions: search, grep, and cost/usage insights across your session history via 18 LLM tools (17 read-only plus one write, unarchive-session).",
6
6
  "keywords": [
7
7
  "opencode",
@@ -34,6 +34,7 @@
34
34
  "files": [
35
35
  "dist/",
36
36
  "types/",
37
+ "docs/",
37
38
  "README.md",
38
39
  "LICENSE",
39
40
  "CHANGELOG.md"