From dcc32f36d3aa0075786e0caf3a1c188403bf9074 Mon Sep 17 00:00:00 2001 From: Vectry Date: Tue, 10 Feb 2026 11:23:33 +0000 Subject: [PATCH] fix: plugin event shape mismatches, nav highlight bug, and README update - Fix session.created/deleted reading props.info.id instead of props.id - Fix session.diff reading FileDiff[] array instead of string - Fix file.edited reading props.file instead of props.filePath - Add auto-session creation fallback from tool/chat hooks - Add flushSession() for intermediate trace sends on session.idle - Fix dashboard nav: /dashboard exact match prevents false active state - Update README with TypeScript SDK and OpenCode plugin sections --- README.md | 75 +++++++++++++-- apps/web/src/app/dashboard/layout.tsx | 6 +- packages/opencode-plugin/package.json | 2 +- packages/opencode-plugin/src/index.ts | 127 +++++++++++++++++++++----- packages/opencode-plugin/src/state.ts | 19 ++++ 5 files changed, 196 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index edadad5..4dda01e 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@

PyPI + npm + OpenCode Plugin License Demo

@@ -44,6 +46,8 @@ Open `https://agentlens.vectry.tech/dashboard` to see your traces. ## Features - **Decision Tracing** -- Log every decision point with reasoning, alternatives, and confidence scores +- **OpenCode Plugin** -- Trace your coding agent sessions with `opencode-agentlens` +- **TypeScript SDK** -- First-class TypeScript support with `agentlens-sdk` - **OpenAI Integration** -- Auto-instrument OpenAI calls with one line: `wrap_openai(client)` - **LangChain Integration** -- Drop-in callback handler for LangChain agents - **Nested Traces** -- Multi-agent workflows with parent-child span relationships @@ -52,13 +56,62 @@ Open `https://agentlens.vectry.tech/dashboard` to see your traces. - **Analytics** -- Token usage, cost tracking, duration timelines per trace - **Self-Hostable** -- Docker Compose deployment, bring your own Postgres + Redis +## OpenCode Plugin + +Trace your [OpenCode](https://opencode.ai) coding agent sessions automatically. + +```bash +npm install -g opencode-agentlens +``` + +Add to your `opencode.json`: + +```json +{ + "plugin": ["opencode-agentlens"] +} +``` + +Set environment variables: + +```bash +export AGENTLENS_API_KEY="your-key" +export AGENTLENS_ENDPOINT="https://agentlens.vectry.tech" +``` + +Every coding session automatically captures tool calls, LLM interactions, file edits, and permission flows. + +## TypeScript SDK + +```bash +npm install agentlens-sdk +``` + +```typescript +import { init, TraceBuilder, SpanType, SpanStatus } from "agentlens-sdk"; + +init({ apiKey: "your-key", endpoint: "https://agentlens.vectry.tech" }); + +const trace = new TraceBuilder("my-agent-task", { + tags: ["production"], +}); + +trace.addSpan({ + name: "tool-call", + type: SpanType.TOOL_CALL, + status: SpanStatus.COMPLETED, +}); + +trace.end(); +``` + ## Architecture ``` -SDK (Python) API (Next.js) Dashboard (React) +SDK (Python/TS) API (Next.js) Dashboard (React) agentlens.trace() ------> POST /api/traces ------> Real-time SSE stream - agentlens.log_decision() Prisma + Postgres Decision tree viz - wrap_openai(client) Redis pub/sub Analytics & filters + TraceBuilder.end() Prisma + Postgres Decision tree viz + OpenCode plugin Redis pub/sub Analytics & filters ``` ## Integrations @@ -142,16 +195,20 @@ The dashboard will be available at `http://localhost:4200`. ``` agentlens/ - apps/web/ # Next.js 15 dashboard + API - packages/database/ # Prisma schema + client - packages/sdk-python/ # Python SDK (PyPI: vectry-agentlens) - examples/ # Example agent scripts - docker-compose.yml # Production deployment + apps/web/ # Next.js 15 dashboard + API + packages/database/ # Prisma schema + client + packages/sdk-python/ # Python SDK (PyPI: vectry-agentlens) + packages/sdk-ts/ # TypeScript SDK (npm: agentlens-sdk) + packages/opencode-plugin/ # OpenCode plugin (npm: opencode-agentlens) + examples/ # Example agent scripts + docker-compose.yml # Production deployment ``` ## SDK Reference -See the full [Python SDK documentation](packages/sdk-python/README.md). +- [Python SDK documentation](packages/sdk-python/README.md) +- [TypeScript SDK documentation](packages/sdk-ts/README.md) +- [OpenCode plugin documentation](packages/opencode-plugin/README.md) ## Examples diff --git a/apps/web/src/app/dashboard/layout.tsx b/apps/web/src/app/dashboard/layout.tsx index dddfd98..50d4673 100644 --- a/apps/web/src/app/dashboard/layout.tsx +++ b/apps/web/src/app/dashboard/layout.tsx @@ -51,7 +51,11 @@ function Sidebar({ onNavigate }: { onNavigate?: () => void }) {