.agents/memory/2026-02-23-opencode-plugin-package-creation.md

1.7 KiB

2026-02-23 Session Notes

OpenCode Plugin Package Creation

The plugin-builder agent was assigned to create a new packages/opencode-plugin/ package—a self-contained runtime plugin for OpenCode that integrates with the Signet daemon. The session began by reviewing task assignments and understanding the architectural requirements.

Key Requirements

The new package must be independently distributable with no workspace dependencies on @signet/* packages. It implements the OpenCode Plugin API using tools from @opencode-ai/plugin and mirrors patterns from the existing OpenClaw adapter. The implementation includes lifecycle hooks, event handlers, and 8 tool definitions adapted from the OpenClaw adapter.

Technical Specifications

Version aligned to 0.1.87 for consistency across the monorepo. Package targets Node.js with bun build output to dist/signet.mjs. Strict TypeScript discipline enforced: no any types, no as assertions, explicit return types, and readonly modifiers where possible. The daemon client pattern uses pluginHeaders() with x-signet-runtime-path: "plugin" and x-signet-actor: "opencode-plugin".

Task Breakdown

Five sequential tasks identified with dependency blocks:

  1. Package scaffolding (package.json, tsconfig.json)
  2. Type definitions (types.ts)
  3. Daemon client implementation (daemon-client.ts)
  4. Tool definitions (tools.ts)
  5. Main plugin entry (index.ts)

Additional work includes refactoring connector-opencode install/uninstall and updating root build config.

Reference Architecture

The implementation mirrors packages/adapters/openclaw/src/index.ts for client patterns and packages/adapters/openclaw/src/tool-schemas.ts for tool structure, but adapted to the OpenCode plugin API surface.