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
This commit is contained in:
Vectry
2026-02-10 11:23:33 +00:00
parent 5b388484f8
commit dcc32f36d3
5 changed files with 196 additions and 33 deletions

View File

@@ -6,6 +6,8 @@
<p align="center">
<a href="https://pypi.org/project/vectry-agentlens/"><img src="https://img.shields.io/pypi/v/vectry-agentlens?color=blue" alt="PyPI"></a>
<a href="https://www.npmjs.com/package/agentlens-sdk"><img src="https://img.shields.io/npm/v/agentlens-sdk?color=blue" alt="npm"></a>
<a href="https://www.npmjs.com/package/opencode-agentlens"><img src="https://img.shields.io/npm/v/opencode-agentlens?color=blue&label=opencode-plugin" alt="OpenCode Plugin"></a>
<a href="https://gitea.repi.fun/repi/agentlens/src/branch/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="License"></a>
<a href="https://agentlens.vectry.tech"><img src="https://img.shields.io/badge/demo-live-brightgreen" alt="Demo"></a>
</p>
@@ -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