feat: OpenCode Observability Plugin#73
Conversation
Signed-off-by: Binfeng Xu <binfengx@nvidia.com>
…to feature/bx-opencode
WalkthroughThis PR adds an OpenCode server plugin package, core server implementation, docs, and tests that record OpenCode session/message/tool events into NeMo Flow and emit ATOF JSONL and ATIF trajectory files with safe serialization and graceful runtime-fallback behavior. ChangesNeMo Flow OpenCode Plugin Integration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
Signed-off-by: Binfeng Xu <binfengx@nvidia.com>
…to feature/bx-opencode
|
/retest |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@integrations/opencode-plugin/server.js`:
- Around line 214-216: The subscriber registered via
lib.registerSubscriber(using atofSubscriberName) writes with
fsSync.appendFileSync(options.atofPath, ...) with no error handling; wrap the
appendFileSync call inside a try/catch inside the subscriber callback, and on
error log or swallow the error (use existing logger or console.error) so
ENOSPC/EACCES or other sync I/O failures do not throw out of the event delivery
path; keep the callback signature and behavior otherwise unchanged so NeMo
Flow/framework behavior is preserved.
- Around line 33-60: The write function currently lets filesystem errors bubble
up and reject plugin hooks; wrap the entire body of write (the path-handling,
ensureParentDir, fs.appendFile and the console logging branches) in a try/catch
so any thrown error is swallowed (or downgraded to a non-fatal fallback) and
write always resolves; on fs failures fall back to console logging the same
formatted message (include PLUGIN_ID, message and toJsonSafe(extra)), and ensure
warnOnce/info/warn/error callers (and the seen set logic) continue to return a
resolved Promise rather than letting errors propagate from write (keep the
existing Promise.resolve() return for the seen shortcut). Use the existing
symbols write, PLUGIN_ID, logPath, ensureParentDir, fs.appendFile, toJsonSafe
and seen to locate where to add the try/catch and fallback.
- Around line 197-198: recentFlushes is an unbounded Map used as a 2s dedupe
cache and needs pruning; change its entries so each key maps to insertion
timestamp (or schedule a per-key setTimeout) and remove entries older than 2
seconds. Locate the recentFlushes usage in server.js (the const recentFlushes =
new Map() declaration and any code that checks/sets keys) and: when adding a
key, store Date.now() (or schedule a setTimeout to delete that key after
2000ms); when checking a key, consider it expired if its timestamp is >2000ms
old and delete it before proceeding; optionally add a short periodic cleanup
(setInterval) to remove stale keys if you choose timestamp-based approach.
Ensure the semantics of the dedupe window remain 2 seconds and that no other
code relies on Map values being non-timestamps.
- Around line 1-2: Replace the line-style SPDX header comments at the top of
integrations/opencode-plugin/server.js with a C-style comment block;
specifically, change the two leading single-line comments containing
"SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES.
All rights reserved." and "SPDX-License-Identifier: Apache-2.0" into a single /*
... */ block so the file has a C-style SPDX header as required by the repo's
licensing guidelines.
- Around line 251-259: In withStack, always restore the prior thread scope stack
instead of only when previous is truthy: capture priorStack via
lib.currentScopeStack(), set lib.setThreadScopeStack(session.stack) before
running callback, and in the finally block call
lib.setThreadScopeStack(previousStack) (even if previousStack is undefined) so
the thread scope is always reset; reference the withStack function and the
lib.currentScopeStack / lib.setThreadScopeStack calls to locate where to change
the restore logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: ff9f6b37-40d8-4c6f-8698-7fab042a2722
📒 Files selected for processing (1)
integrations/opencode-plugin/server.js
📜 Review details
🧰 Additional context used
📓 Path-based instructions (12)
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use camelCase naming convention for Node.js code
Files:
integrations/opencode-plugin/server.js
**/*.{rs,go,js,ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Include SPDX license headers in all Rust, Go, JavaScript, and TypeScript source files using C-style comment syntax
Files:
integrations/opencode-plugin/server.js
**/*.{rs,py,go,js,ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use
SONAR_IGNORE_START/SONAR_IGNORE_ENDmarkers only for documented false positives that cannot be resolved in code; keep ignored blocks small, add explanatory comments, and require reviewer sign-off
Files:
integrations/opencode-plugin/server.js
**/*.{md,markdown,py,sh,bash,js,ts,java,cpp,go,rust}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Keep package names, repo references, and build commands current in documentation
Files:
integrations/opencode-plugin/server.js
**/*.{md,markdown,py,sh,bash,js,ts,example}
📄 CodeRabbit inference engine (.agents/skills/contribute-docs/SKILL.md)
Example commands must match current package names and paths
Files:
integrations/opencode-plugin/server.js
**/{integrations,integration,*-integration}/**
📄 CodeRabbit inference engine (.agents/skills/contribute-integration/SKILL.md)
**/{integrations,integration,*-integration}/**: Keep NeMo Flow optional in framework integrations
Preserve the framework's original behavior when NeMo Flow is absent
Wrap tool and LLM paths at the correct framework boundary
Integration pattern must followdocs/integrate-frameworks/adding-scopes.md
Files:
integrations/opencode-plugin/server.js
{crates/adaptive/**,python/nemo_flow/{adaptive,plugin}.py,go/nemo_flow/{adaptive,**}/*.go,**/*.{ts,js,wasm}}
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Keep adaptive config schema, plugin lifecycle, and bindings in sync across crates/adaptive, core, bindings, Python (python/nemo_flow/adaptive.py and python/nemo_flow/plugin.py), Go (go/nemo_flow/adaptive and go/nemo_flow), and Node/WebAssembly helpers
Files:
integrations/opencode-plugin/server.js
**/*.{js,ts,tsx,jsx,py,rs,go,java,c,cpp,h,cc,cxx,cs,rb,php,swift,kt}
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changed files must be formatted with the language-native formatter
Files:
integrations/opencode-plugin/server.js
**/*.{rs,py,js,ts,go,sh,toml,yaml,yml,json,md,rst}
📄 CodeRabbit inference engine (AGENTS.md)
Keep SPDX headers on source, docs, scripts, and configuration files. The project is Apache-2.0.
Files:
integrations/opencode-plugin/server.js
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If Node.js language surface changed, always run Node.js test target even when Rust core did not change
Files:
integrations/opencode-plugin/server.js
**/*.{py,js,ts,tsx,go,rs,md}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
Format changed files with the language-native formatter before the final lint/test pass
Files:
integrations/opencode-plugin/server.js
**/*.{rs,py,js,ts,tsx,go}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
During iteration, prefer
uv run pre-commit run --files <changed files...>for targeted validation
Files:
integrations/opencode-plugin/server.js
| // SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 |
There was a problem hiding this comment.
Use a C-style SPDX header in this JavaScript file.
The repo requires JS SPDX headers in C-style comment syntax; the current // form can be missed by license tooling.
Suggested fix
-// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
-// SPDX-License-Identifier: Apache-2.0
+/*
+ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ */As per coding guidelines, **/*.{rs,go,js,ts,tsx}: Include SPDX license headers in all Rust, Go, JavaScript, and TypeScript source files using C-style comment syntax.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |
| // SPDX-License-Identifier: Apache-2.0 | |
| /* | |
| * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |
| * SPDX-License-Identifier: Apache-2.0 | |
| */ |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@integrations/opencode-plugin/server.js` around lines 1 - 2, Replace the
line-style SPDX header comments at the top of
integrations/opencode-plugin/server.js with a C-style comment block;
specifically, change the two leading single-line comments containing
"SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES.
All rights reserved." and "SPDX-License-Identifier: Apache-2.0" into a single /*
... */ block so the file has a C-style SPDX header as required by the repo's
licensing guidelines.
| async function write(level, message, extra) { | ||
| const record = { | ||
| timestamp: new Date().toISOString(), | ||
| level, | ||
| plugin: PLUGIN_ID, | ||
| message, | ||
| ...(extra === undefined ? {} : { extra: toJsonSafe(extra) }), | ||
| } | ||
| const line = JSON.stringify(record) + "\n" | ||
| if (logPath) { | ||
| await ensureParentDir(logPath) | ||
| await fs.appendFile(logPath, line) | ||
| return | ||
| } | ||
| const text = `[${PLUGIN_ID}] ${message}` | ||
| if (level === "error") console.error(text, extra ?? "") | ||
| else if (level === "warn") console.warn(text, extra ?? "") | ||
| else console.info(text, extra ?? "") | ||
| } | ||
|
|
||
| return { | ||
| info: (message, extra) => write("info", message, extra), | ||
| warn: (message, extra) => write("warn", message, extra), | ||
| error: (message, extra) => write("error", message, extra), | ||
| warnOnce: (key, message, extra) => { | ||
| if (seen.has(key)) return Promise.resolve() | ||
| seen.add(key) | ||
| return write("warn", message, extra) |
There was a problem hiding this comment.
Do not let logger I/O failures reject plugin hooks.
write() currently propagates filesystem errors. An unwritable .nemoflow directory can turn plugin initialization into a rejected load, and every fire-and-forget void logger.* call elsewhere becomes an unhandled rejection. The logger should swallow/fallback internally so observability failures stay non-fatal.
As per coding guidelines, **/{integrations,integration,*-integration}/**: Keep NeMo Flow optional in framework integrationsandPreserve the framework's original behavior when NeMo Flow is absent`.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@integrations/opencode-plugin/server.js` around lines 33 - 60, The write
function currently lets filesystem errors bubble up and reject plugin hooks;
wrap the entire body of write (the path-handling, ensureParentDir, fs.appendFile
and the console logging branches) in a try/catch so any thrown error is
swallowed (or downgraded to a non-fatal fallback) and write always resolves; on
fs failures fall back to console logging the same formatted message (include
PLUGIN_ID, message and toJsonSafe(extra)), and ensure warnOnce/info/warn/error
callers (and the seen set logic) continue to return a resolved Promise rather
than letting errors propagate from write (keep the existing Promise.resolve()
return for the seen shortcut). Use the existing symbols write, PLUGIN_ID,
logPath, ensureParentDir, fs.appendFile, toJsonSafe and seen to locate where to
add the try/catch and fallback.
| const recentFlushes = new Map() | ||
| const trajectories = [] |
There was a problem hiding this comment.
Expire recentFlushes; this dedupe cache currently grows forever.
The map is only used for a 2s duplicate-flush window, but entries are never pruned. On a long-lived OpenCode process it grows with every completed session.
Also applies to: 343-343, 402-403
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@integrations/opencode-plugin/server.js` around lines 197 - 198, recentFlushes
is an unbounded Map used as a 2s dedupe cache and needs pruning; change its
entries so each key maps to insertion timestamp (or schedule a per-key
setTimeout) and remove entries older than 2 seconds. Locate the recentFlushes
usage in server.js (the const recentFlushes = new Map() declaration and any code
that checks/sets keys) and: when adding a key, store Date.now() (or schedule a
setTimeout to delete that key after 2000ms); when checking a key, consider it
expired if its timestamp is >2000ms old and delete it before proceeding;
optionally add a short periodic cleanup (setInterval) to remove stale keys if
you choose timestamp-based approach. Ensure the semantics of the dedupe window
remain 2 seconds and that no other code relies on Map values being
non-timestamps.
| lib.registerSubscriber(atofSubscriberName, (event) => { | ||
| fsSync.appendFileSync(options.atofPath, JSON.stringify(event) + "\n") | ||
| }) |
There was a problem hiding this comment.
Contain ATOF export write failures inside the subscriber callback.
appendFileSync() is executed directly on the subscriber path with no error handling. ENOSPC/EACCES here will throw synchronously while the runtime is delivering events, which can break the host flow instead of degrading observability only.
As per coding guidelines, **/{integrations,integration,*-integration}/**: Keep NeMo Flow optional in framework integrationsandPreserve the framework's original behavior when NeMo Flow is absent`.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@integrations/opencode-plugin/server.js` around lines 214 - 216, The
subscriber registered via lib.registerSubscriber(using atofSubscriberName)
writes with fsSync.appendFileSync(options.atofPath, ...) with no error handling;
wrap the appendFileSync call inside a try/catch inside the subscriber callback,
and on error log or swallow the error (use existing logger or console.error) so
ENOSPC/EACCES or other sync I/O failures do not throw out of the event delivery
path; keep the callback signature and behavior otherwise unchanged so NeMo
Flow/framework behavior is preserved.
| function withStack(session, callback) { | ||
| if (!session.stack || typeof lib.setThreadScopeStack !== "function") return callback() | ||
| const previous = typeof lib.currentScopeStack === "function" ? lib.currentScopeStack() : undefined | ||
| lib.setThreadScopeStack(session.stack) | ||
| try { | ||
| return callback() | ||
| } finally { | ||
| if (previous) lib.setThreadScopeStack(previous) | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
fd -t f "server.js" integrations/Repository: NVIDIA/NeMo-Flow
Length of output: 99
🏁 Script executed:
wc -l integrations/opencode-plugin/server.jsRepository: NVIDIA/NeMo-Flow
Length of output: 103
🏁 Script executed:
sed -n '245,265p' integrations/opencode-plugin/server.jsRepository: NVIDIA/NeMo-Flow
Length of output: 695
🏁 Script executed:
head -50 integrations/opencode-plugin/server.jsRepository: NVIDIA/NeMo-Flow
Length of output: 1456
🏁 Script executed:
rg "setThreadScopeStack|currentScopeStack" integrations/opencode-plugin/server.js -B 2 -A 2Repository: NVIDIA/NeMo-Flow
Length of output: 459
🏁 Script executed:
rg "setThreadScopeStack|currentScopeStack" --type js --type tsRepository: NVIDIA/NeMo-Flow
Length of output: 619
🏁 Script executed:
cat crates/wasm/wrappers/esm/index.jsRepository: NVIDIA/NeMo-Flow
Length of output: 3030
🏁 Script executed:
rg "export.*setThreadScopeStack|export.*currentScopeStack" --type jsRepository: NVIDIA/NeMo-Flow
Length of output: 42
🏁 Script executed:
find crates -name "*.rs" -type f | xargs rg "fn setThreadScopeStack|fn currentScopeStack" -A 5Repository: NVIDIA/NeMo-Flow
Length of output: 44
🏁 Script executed:
find crates/adaptive -name "*.rs" | head -20Repository: NVIDIA/NeMo-Flow
Length of output: 882
🏁 Script executed:
rg "setThreadScopeStack|currentScopeStack" crates/adaptive/ -A 3 -B 1Repository: NVIDIA/NeMo-Flow
Length of output: 42
🏁 Script executed:
rg "setThreadScopeStack" crates/ -A 3 -B 1Repository: NVIDIA/NeMo-Flow
Length of output: 6336
🏁 Script executed:
fd -e rs -e ts -e js | xargs rg "pub fn setThreadScopeStack|pub.*setThreadScopeStack" -A 5Repository: NVIDIA/NeMo-Flow
Length of output: 44
🏁 Script executed:
rg "thread.*scope.*stack|scope.*stack.*thread" crates/ --type rs -iRepository: NVIDIA/NeMo-Flow
Length of output: 87
🏁 Script executed:
cat crates/wasm/src/api/mod.rs | sed -n '1,100p'Repository: NVIDIA/NeMo-Flow
Length of output: 4343
🏁 Script executed:
rg "bind_thread_scope_stack|set_thread_scope_stack" crates/ --type rs -B 2 -A 8Repository: NVIDIA/NeMo-Flow
Length of output: 87
🏁 Script executed:
cat crates/node/tests/context_tests.mjs | grep -A 20 "setThreadScopeStack isolates"Repository: NVIDIA/NeMo-Flow
Length of output: 849
🏁 Script executed:
rg "pub fn set_thread_scope_stack|pub.*setThreadScopeStack" crates/wasm/src/api/mod.rs -A 10Repository: NVIDIA/NeMo-Flow
Length of output: 478
🏁 Script executed:
rg "TASK_SCOPE_STACK|set_thread_scope_stack" crates/node/src/api/mod.rs -B 2 -A 10Repository: NVIDIA/NeMo-Flow
Length of output: 6474
🏁 Script executed:
cat crates/node/tests/context_tests.mjs | grep -B 5 -A 15 "Switch back to stack1"Repository: NVIDIA/NeMo-Flow
Length of output: 510
🏁 Script executed:
rg "currentScopeStack.*undefined|undefined.*setThreadScopeStack" crates/node/tests/ -B 3 -A 3Repository: NVIDIA/NeMo-Flow
Length of output: 42
🏁 Script executed:
cat crates/node/tests/context_tests.mjs | grep -B 10 -A 10 "original = currentScopeStack"Repository: NVIDIA/NeMo-Flow
Length of output: 1591
Always restore the previous scope stack.
If currentScopeStack() returns no prior stack, the finally block leaves session.stack installed on the thread. Subsequent marks/spans can then inherit the wrong session scope and corrupt cross-session telemetry.
Suggested fix
function withStack(session, callback) {
if (!session.stack || typeof lib.setThreadScopeStack !== "function") return callback()
const previous = typeof lib.currentScopeStack === "function" ? lib.currentScopeStack() : undefined
lib.setThreadScopeStack(session.stack)
try {
return callback()
} finally {
- if (previous) lib.setThreadScopeStack(previous)
+ lib.setThreadScopeStack(previous)
}
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| function withStack(session, callback) { | |
| if (!session.stack || typeof lib.setThreadScopeStack !== "function") return callback() | |
| const previous = typeof lib.currentScopeStack === "function" ? lib.currentScopeStack() : undefined | |
| lib.setThreadScopeStack(session.stack) | |
| try { | |
| return callback() | |
| } finally { | |
| if (previous) lib.setThreadScopeStack(previous) | |
| } | |
| function withStack(session, callback) { | |
| if (!session.stack || typeof lib.setThreadScopeStack !== "function") return callback() | |
| const previous = typeof lib.currentScopeStack === "function" ? lib.currentScopeStack() : undefined | |
| lib.setThreadScopeStack(session.stack) | |
| try { | |
| return callback() | |
| } finally { | |
| lib.setThreadScopeStack(previous) | |
| } | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@integrations/opencode-plugin/server.js` around lines 251 - 259, In withStack,
always restore the prior thread scope stack instead of only when previous is
truthy: capture priorStack via lib.currentScopeStack(), set
lib.setThreadScopeStack(session.stack) before running callback, and in the
finally block call lib.setThreadScopeStack(previousStack) (even if previousStack
is undefined) so the thread scope is always reset; reference the withStack
function and the lib.currentScopeStack / lib.setThreadScopeStack calls to locate
where to change the restore logic.
| @@ -0,0 +1,55 @@ | |||
| { | |||
| "name": "@nvidia/nemoflow-opencode-plugin", | |||
There was a problem hiding this comment.
| "name": "@nvidia/nemoflow-opencode-plugin", | |
| "name": "nemo-flow-opencode", |
| "atof", | ||
| "plugin" | ||
| ], | ||
| "homepage": "https://github.com/NVIDIA/NeMo-Flow#readme", |
There was a problem hiding this comment.
This shouldn't be necessary.
Add integrations/opencode to the root package.json
| ``` | ||
|
|
||
| When the plugin package is published, use | ||
| `@nvidia/nemoflow-opencode-plugin` in the OpenCode config instead of the local |
There was a problem hiding this comment.
package should be: nemo-flow-opencode
| { | ||
| "plugin": [ | ||
| [ | ||
| "file:///absolute/path/to/NeMo-Flow/integrations/opencode-plugin", |
There was a problem hiding this comment.
Since we will be publishing a node package, we should refer to the node package name itself.
| "file:///absolute/path/to/NeMo-Flow/integrations/opencode-plugin", | |
| "nemo-flow-opencode", |
| ## Demo Video Script | ||
|
|
||
| Use this storyboard to record a short walkthrough. | ||
|
|
||
| | Shot | Show | Narration | | ||
| |---|---|---| | ||
| | 1 | `opencode.json` with the plugin file URL | Stock OpenCode loads the NeMo Flow plugin through normal plugin config. | | ||
| | 2 | `opencode debug info` output | OpenCode sees the plugin without applying an OpenCode patch. | | ||
| | 3 | `opencode run` or the interactive OpenCode UI | The developer uses OpenCode normally. | | ||
| | 4 | `ls -la .nemoflow` | The plugin writes observability files in the background. | | ||
| | 5 | `grep` against `opencode.atof.jsonl` | ATOF contains session, message, LLM request, and tool lifecycle events. | | ||
| | 6 | `jq` against `opencode.atif.json` | ATIF contains the exported session trajectory. | | ||
| | 7 | Disabled or forced-failure smoke | OpenCode still runs when the plugin is disabled or pass-through. | | ||
|
|
||
| Keep the recording focused on the user-visible contract: install the plugin, | ||
| use OpenCode normally, and inspect `.nemoflow` output after the session. |
There was a problem hiding this comment.
I don't understand the purpose of this. The document here is for end users. Documentation should be relevant to them, not to developers
| setThreadScopeStack(_stack) {}, | ||
| pushScope(name, scopeType, _parent, attributes, data, metadata, input) { | ||
| const handle = { | ||
| uuid: `scope-${++counter}`, |
There was a problem hiding this comment.
This is not a valid UUID. When in doubt, let UUIDs be generated automatically.
| { | ||
| "plugin": [ | ||
| [ | ||
| "file:///absolute/path/to/NeMo-Flow/integrations/opencode-plugin", | ||
| { | ||
| "enabled": true, | ||
| "atofPath": "./.nemoflow/opencode.atof.jsonl", | ||
| "atifPath": "./.nemoflow/opencode.atif.json", | ||
| "logPath": "./.nemoflow/opencode-plugin.log" | ||
| } | ||
| ] | ||
| ] | ||
| } |
There was a problem hiding this comment.
This is okay for now, but the configuration shape should be relatively consistent across all integrations (and support plugins in the future)
| model: modelName(input.model), | ||
| }) | ||
| if (!session) return | ||
| emitMark( |
There was a problem hiding this comment.
why is this a mark and not llmCall ?
| model: modelName(input.model ?? output?.message?.model), | ||
| }) | ||
| if (!session) return | ||
| emitMark( |
There was a problem hiding this comment.
why is this a mark and not llmCallEnd ?
Overview
Details
integrations/opencode-pluginas an npm package for OpenCode server plugin usage.crates/nodeopencodeopencode.jsonwith the plugin file URLopencodeand inspect.nemoflowoutputexample
opencode.jsonWhere should the reviewer start?
Start with
integrations/opencode-plugin/server.js, then reviewintegrations/opencode-plugin/test/server.test.mjs.Summary by CodeRabbit
New Features
Documentation
Tests
Chores