@grudanov-nikolay/agenttrace-opencode-plugin 0.0.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.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Raindrop AI
4
+ Modifications and additional code Copyright (c) 2026 Nikolai Grudanov
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # `@grudanov-nikolay/agenttrace-opencode-plugin`
2
+
3
+ agenttrace observability plugin for OpenCode. Streams OpenCode sessions,
4
+ events, and OTLP-style spans into the local agenttrace (formerly Workshop)
5
+ daemon on `http://localhost:5899` (and to Raindrop Cloud if a
6
+ `RAINDROP_WRITE_KEY` is set).
7
+
8
+ This is the first public release under the new name (`0.1.0`, renamed from
9
+ `@grudanov-nikolay/opencode-workshop-plugin@0.0.1` on 2026-09-17, F-024). It is
10
+ a **drop-in replacement** for the closed-source `@raindrop-ai/opencode-plugin`
11
+ and ships additional fixes on top. The daemon name moved from
12
+ `opencode-workshop` to `agenttrace`; companion packages now are
13
+ `@grudanov-nikolay/agenttrace` (daemon) and
14
+ `@grudanov-nikolay/agenttrace-opencode-plugin` (this plugin).
15
+
16
+ | | |
17
+ |---|---|
18
+ | **Upstream** | `@raindrop-ai/opencode-plugin@0.0.18` (npm-only, no public git) |
19
+ | **This fork** | `@grudanov-nikolay/agenttrace-opencode-plugin@0.1.0` |
20
+ | **Repo** | https://github.com/nikolay-grudanov/agenttrace-opencode-plugin |
21
+ | **License** | MIT (see [LICENSE](./LICENSE) — dual copyright Raindrop AI + Nikolai Grudanov) |
22
+ | **Verified** | A/B smoke test against upstream on `fff_find_files` MCP tool — 0 errors, 2 tool calls landed in agenttrace with status=OK |
23
+
24
+ ## Install
25
+
26
+ ```bash
27
+ pnpm add @grudanov-nikolay/agenttrace-opencode-plugin @opencode-ai/plugin
28
+ ```
29
+
30
+ If your integration also uses the OpenCode SDK directly, install `@opencode-ai/sdk` as well.
31
+
32
+ Then add to your project or `~/.config/opencode/opencode.json`:
33
+
34
+ ```json
35
+ {
36
+ "plugin": ["@grudanov-nikolay/agenttrace-opencode-plugin@0.1.0"]
37
+ }
38
+ ```
39
+
40
+ For per-project `eventName` (so agenttrace UI splits runs by project), set:
41
+
42
+ ```json
43
+ {
44
+ "local_workshop_url": "http://127.0.0.1:5899/v1",
45
+ "project_id": "support-prod"
46
+ }
47
+ ```
48
+
49
+ or via env: `RAINDROP_PROJECT_ID=support-prod`.
50
+
51
+ ## Local development
52
+
53
+ If you're working on the plugin itself, OpenCode 1.17.x loads plugins only from its own cache — `npm link` and `package.json` `file:` references are ignored. Use the install helper:
54
+
55
+ ```bash
56
+ git clone https://github.com/nikolay-grudanov/agenttrace-opencode-plugin.git
57
+ cd agenttrace-opencode-plugin
58
+ ./scripts/install-local.sh
59
+ ```
60
+
61
+ Then add to `~/.config/opencode/opencode.json`:
62
+
63
+ ```json
64
+ {
65
+ "plugin": ["@grudanov-nikolay/agenttrace-opencode-plugin@0.1.0"]
66
+ }
67
+ ```
68
+
69
+ To pick up code changes after editing `dist/`:
70
+
71
+ ```bash
72
+ ./scripts/install-local.sh --reinstall # or just restart OpenCode — symlink is hot
73
+ ```
74
+
75
+ ## What's different from upstream
76
+
77
+ 1. **MCP `tool.execute.after` fix** — for MCP tool calls (GigaChat via MLProxy, jupyter_executor, anything using MCP), OpenCode passes raw `CallToolResult` (`{content: [{type, text}]}`) instead of the documented `{title, output, metadata}` shape. Upstream throws; this fork assembles `result.output` from `result.content[]` and continues.
78
+
79
+ 2. **`RAINDROP_LOCAL_WORKSHOP_URL` non-local fallback** — if the env var is set to a non-local URL (stale `.bashrc` export, copy-paste mistake), fall back to `raindrop.json` `local_workshop_url` (or auto-detect) and emit a single rate-limited warning. Hardens the 2026-06-30 incident where we lost spans for 2 hours.
80
+
81
+ 3. **`subagent_name` recovery on nested sub-agents (OpenCode 1.18)** — labels every level of `orchestrator → research → file-search → explore` chain on task spans + Subagent root + child LLM spans. Survives 4-level nesting. Workshop UI's `subagent_name` pill works out of the box.
82
+
83
+ 4. **`result.error` → `status=ERROR`** — propagate OpenCode SDK `result.error` into the OTLP span's `status`, so failed tool calls actually show up as failures in the Workshop Statistics panel (was always `UNSET` upstream).
84
+
85
+ 5. **Workshop sidepanel bootstrap** — when `RAINDROP_SIDEPANEL_ACTIVE=1` and a local Workshop daemon is detected, the plugin registers a `workshop` MCP server via the `config` hook and prepends a sidepanel system prompt via `experimental.chat.system.transform`. Sidepanel chat in the Workshop UI can drive the same `opencode run` child process.
86
+
87
+ 6. **Verified against original** — A/B smoke test on real MCP tool: original 0.0.18 produced 2× `result.output is required` errors; this fork produced 0.
88
+
89
+ 7. **Drop-in replacement** — same npm name shape, same OpenCode plugin interface, same event payload format. Just swap the package name in your config.
90
+
91
+ See [`ai-docs/PLAN.md`](ai-docs/PLAN.md) for the full development plan (F-001 through F-006 closed, F-002 in progress with install helper, CI smoke test, and prettier reformat; F-007+ in backlog).
92
+
93
+ ## Notes
94
+
95
+ - `@opencode-ai/plugin` is required (peer dependency).
96
+ - `@opencode-ai/sdk` is an optional peer dependency.
97
+ - The plugin source is in `dist/` (minified bundles). F-002.1 will add section markers; F-003 in the backlog will produce a readable `src/index.ts`.
98
+ - Pre-1.0 alpha. APIs may shift before `1.0.0`. Pin exact versions in production.
99
+
100
+ ## License
101
+
102
+ MIT — same as upstream. See [`LICENSE`](LICENSE).