Skip to content

docs(opencode): drop npm install step, document Hindsight Cloud#1056

Merged
nicoloboschi merged 2 commits intomainfrom
docs-opencode-install-and-cloud
Apr 14, 2026
Merged

docs(opencode): drop npm install step, document Hindsight Cloud#1056
nicoloboschi merged 2 commits intomainfrom
docs-opencode-install-and-cloud

Conversation

@nicoloboschi
Copy link
Copy Markdown
Collaborator

Summary

  • Remove misleading `npm install @vectorize-io/opencode-hindsight` step — OpenCode auto-installs plugins listed in the `"plugin"` array at startup via Bun (per https://opencode.ai/docs/plugins/).
  • Add a dedicated Using Hindsight Cloud section with the managed API URL (`https://api.hindsight.vectorize.io\`) and token guidance in both the integration README and the docs site page.

Test plan

  • Verify rendered docs page reads correctly
  • Confirm a fresh install using only the documented `opencode.json` snippet works (plugin auto-installs on first `opencode` run)

…Cloud

OpenCode auto-installs plugins listed in the "plugin" array at startup via
Bun; the prior instructions to `npm install` the package were misleading.
Also add a dedicated Hindsight Cloud section with api.hindsight.vectorize.io
and token guidance.
OpenCode's plugin loader iterates Object.entries(mod) and invokes every
export as a Plugin factory `(input) => Promise<Hooks>`, deduping by
identity. Our prior default export was a PluginModule object
(`{ id, server }`), which opencode tried to call as a function and
crashed with `fn3 is not a function. (In 'fn3(input)', 'fn3' is an
instance of Object)` at load time.

Default-export the HindsightPlugin function itself so both default and
named `HindsightPlugin` exports point to the same reference (dedupe
suppresses a second call). Update the default-export smoke test to
assert this invariant.

Verified end-to-end against opencode 1.1.49 with the built dist — the
plugin now initializes, registers tools/hooks, and processes session
events without error.
@nicoloboschi
Copy link
Copy Markdown
Collaborator Author

Scope expanded — now includes a plugin load crash fix

Second commit 87856fcc fixes a real bug: OpenCode iterates Object.entries(mod) and invokes every export as a Plugin factory. Our default export was a PluginModule object ({ id, server }), so opencode called it and crashed at load time with:

TypeError: fn3 is not a function. (In 'fn3(input)', 'fn3' is an instance of Object)
  at src/plugin/index.ts:87

Default-exporting the HindsightPlugin function itself (same reference as the named export — opencode dedupes by identity) resolves it. Default-export smoke test updated to lock in the invariant.

Verified end-to-end against opencode 1.1.49 with the built dist: plugin initializes, registers tools/hooks, opencode run returns a response, session.idle fires retain. 91/91 unit tests pass.

After merge, cut integrations/opencode/v0.1.4 via ./scripts/release-integration.sh opencode patch.

@nicoloboschi nicoloboschi merged commit d00c843 into main Apr 14, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant