feat: SEO improvements and npm publish prep
- Expand sitemap from 2 to 13 URLs (all docs pages) - Update JSON-LD featureList with Anthropic, OpenCode, TypeScript SDK - Update llms.txt with docs links, TS SDK, OpenCode plugin sections - Add READMEs for agentlens-sdk and opencode-agentlens packages - Add repository, homepage, author, bugs fields to both package.json
This commit is contained in:
88
packages/opencode-plugin/README.md
Normal file
88
packages/opencode-plugin/README.md
Normal file
@@ -0,0 +1,88 @@
|
||||
# opencode-agentlens
|
||||
|
||||
OpenCode plugin for AgentLens — trace your coding agent's decisions, tool calls, and sessions.
|
||||
|
||||
[](https://www.npmjs.com/package/opencode-agentlens)
|
||||
[](https://github.com/repi/agentlens/blob/main/LICENSE)
|
||||
|
||||
## Requirements
|
||||
|
||||
- OpenCode >= 1.1.0
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install opencode-agentlens
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Variable | Required | Default | Description |
|
||||
|---|---|---|---|
|
||||
| `AGENTLENS_API_KEY` | Yes | — | Your AgentLens API key. |
|
||||
| `AGENTLENS_ENDPOINT` | No | AgentLens cloud | API endpoint URL. |
|
||||
| `AGENTLENS_ENABLED` | No | `true` | Set to `false` to disable tracing. |
|
||||
| `AGENTLENS_CAPTURE_CONTENT` | No | `true` | Capture message and tool output content. |
|
||||
| `AGENTLENS_MAX_OUTPUT_LENGTH` | No | `10000` | Max characters to capture per output. |
|
||||
| `AGENTLENS_FLUSH_INTERVAL` | No | `5000` | Flush interval in milliseconds. |
|
||||
| `AGENTLENS_BATCH_SIZE` | No | `100` | Max items per batch before auto-flush. |
|
||||
|
||||
### OpenCode Setup
|
||||
|
||||
Add the plugin to your OpenCode configuration at `~/.config/opencode/opencode.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
{
|
||||
"name": "agentlens",
|
||||
"module": "opencode-agentlens"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Set your API key:
|
||||
|
||||
```bash
|
||||
export AGENTLENS_API_KEY="your-api-key"
|
||||
```
|
||||
|
||||
The plugin activates automatically when OpenCode starts. No code changes required.
|
||||
|
||||
## What Gets Captured
|
||||
|
||||
The plugin hooks into OpenCode's event system and records:
|
||||
|
||||
- **Sessions** — Full session lifecycle from start to finish, including duration and metadata.
|
||||
- **Tool calls** — Every tool invocation with input arguments and output results (e.g., file reads, shell commands, code edits).
|
||||
- **LLM calls** — Chat messages sent to and received from the model, including token usage.
|
||||
- **Permission flows** — When the agent requests permission and whether it was granted or denied.
|
||||
- **File edits** — File paths and change summaries produced by the agent.
|
||||
|
||||
All data is sent to your AgentLens instance where you can inspect traces, replay sessions, and analyze agent behavior.
|
||||
|
||||
## How It Works
|
||||
|
||||
The plugin registers handlers for OpenCode's event hooks:
|
||||
|
||||
| Event | What is recorded |
|
||||
|---|---|
|
||||
| Session start/end | Trace lifecycle, session metadata |
|
||||
| `tool.execute.before` | Tool name, input arguments |
|
||||
| `tool.execute.after` | Tool output, duration, success/failure |
|
||||
| `chat.message` | LLM responses and assistant messages |
|
||||
| `chat.params` | Model parameters and prompt configuration |
|
||||
| `permission.ask` | Permission requests and user decisions |
|
||||
|
||||
Each OpenCode session maps to a single AgentLens trace. Tool calls and LLM interactions become spans within that trace.
|
||||
|
||||
## Documentation
|
||||
|
||||
Full documentation: [agentlens.vectry.tech/docs/opencode-plugin](https://agentlens.vectry.tech/docs/opencode-plugin)
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
@@ -43,5 +43,15 @@
|
||||
"tracing",
|
||||
"coding-agent"
|
||||
],
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"author": "Vectry <hunter@repi.fun>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://gitea.repi.fun/repi/agentlens",
|
||||
"directory": "packages/opencode-plugin"
|
||||
},
|
||||
"homepage": "https://agentlens.vectry.tech",
|
||||
"bugs": {
|
||||
"url": "https://gitea.repi.fun/repi/agentlens/issues"
|
||||
}
|
||||
}
|
||||
|
||||
124
packages/sdk-ts/README.md
Normal file
124
packages/sdk-ts/README.md
Normal file
@@ -0,0 +1,124 @@
|
||||
# agentlens-sdk
|
||||
|
||||
TypeScript SDK for AgentLens — Agent observability that traces decisions, not just API calls.
|
||||
|
||||
[](https://www.npmjs.com/package/agentlens-sdk)
|
||||
[](https://github.com/repi/agentlens/blob/main/LICENSE)
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install agentlens-sdk
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
```typescript
|
||||
import { init, TraceBuilder, shutdown } from "agentlens-sdk";
|
||||
|
||||
// Initialize the SDK
|
||||
init({
|
||||
apiKey: "your-api-key",
|
||||
endpoint: "https://agentlens.vectry.tech/api",
|
||||
});
|
||||
|
||||
// Create a trace
|
||||
const trace = new TraceBuilder("agent-run-123", "My Agent Task");
|
||||
|
||||
// Add a span (tool call, LLM call, etc.)
|
||||
trace.addSpan({
|
||||
name: "search-documents",
|
||||
type: "tool",
|
||||
input: { query: "quarterly report" },
|
||||
output: { results: 5 },
|
||||
});
|
||||
|
||||
// Record a decision point
|
||||
trace.addDecision({
|
||||
name: "select-tool",
|
||||
type: "tool_selection",
|
||||
options: ["search", "calculate", "summarize"],
|
||||
selected: "search",
|
||||
reasoning: "User asked for document lookup",
|
||||
});
|
||||
|
||||
// Finalize and send
|
||||
await trace.end();
|
||||
|
||||
// Flush remaining data before exit
|
||||
await shutdown();
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### Core Functions
|
||||
|
||||
| Function | Description |
|
||||
|---|---|
|
||||
| `init(options)` | Initialize the SDK with your API key and configuration. |
|
||||
| `shutdown()` | Flush pending data and shut down the transport. |
|
||||
| `flush()` | Manually flush the current batch without shutting down. |
|
||||
| `getClient()` | Return the initialized client instance. |
|
||||
|
||||
### TraceBuilder
|
||||
|
||||
The primary interface for constructing traces.
|
||||
|
||||
```typescript
|
||||
const trace = new TraceBuilder(traceId: string, name: string);
|
||||
|
||||
trace.addSpan(span: SpanPayload); // Add a span to the trace
|
||||
trace.addDecision(decision: DecisionPointPayload); // Record a decision point
|
||||
trace.end(): Promise<void>; // Finalize and send the trace
|
||||
```
|
||||
|
||||
### Standalone Helpers
|
||||
|
||||
| Function | Description |
|
||||
|---|---|
|
||||
| `createDecision(decision)` | Create and send a standalone decision point outside a trace. |
|
||||
|
||||
## Types
|
||||
|
||||
Core payload types used throughout the SDK:
|
||||
|
||||
- **`TracePayload`** — Top-level trace structure containing spans and metadata.
|
||||
- **`SpanPayload`** — Individual unit of work (tool call, LLM request, retrieval, etc.).
|
||||
- **`DecisionPointPayload`** — A recorded decision: what options existed, what was chosen, and why.
|
||||
- **`EventPayload`** — Discrete event within a span or trace.
|
||||
- **`JsonValue`** — Flexible JSON-compatible value type for inputs/outputs.
|
||||
|
||||
## Enums
|
||||
|
||||
| Enum | Values |
|
||||
|---|---|
|
||||
| `TraceStatus` | Status of the overall trace (e.g., running, completed, failed). |
|
||||
| `SpanType` | Category of span (e.g., tool, llm, retrieval). |
|
||||
| `SpanStatus` | Status of an individual span. |
|
||||
| `DecisionType` | Category of decision (e.g., tool_selection, routing). |
|
||||
| `EventType` | Category of event within a span. |
|
||||
|
||||
## Configuration
|
||||
|
||||
Pass `InitOptions` to `init()`:
|
||||
|
||||
```typescript
|
||||
init({
|
||||
apiKey: "your-api-key", // Required. Your AgentLens API key.
|
||||
endpoint: "https://...", // API endpoint. Defaults to AgentLens cloud.
|
||||
maxBatchSize: 100, // Max items per batch before auto-flush.
|
||||
flushInterval: 5000, // Auto-flush interval in milliseconds.
|
||||
});
|
||||
```
|
||||
|
||||
## Transport
|
||||
|
||||
The SDK ships with `BatchTransport`, which batches payloads and flushes them on an interval or when the batch size threshold is reached. This is used internally by `init()` — you typically do not need to instantiate it directly.
|
||||
|
||||
## Documentation
|
||||
|
||||
Full documentation: [agentlens.vectry.tech/docs/typescript-sdk](https://agentlens.vectry.tech/docs/typescript-sdk)
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
@@ -31,6 +31,24 @@
|
||||
"node": ">=20"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "Vectry <hunter@repi.fun>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://gitea.repi.fun/repi/agentlens",
|
||||
"directory": "packages/sdk-ts"
|
||||
},
|
||||
"homepage": "https://agentlens.vectry.tech",
|
||||
"bugs": {
|
||||
"url": "https://gitea.repi.fun/repi/agentlens/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"agentlens",
|
||||
"observability",
|
||||
"tracing",
|
||||
"ai-agents",
|
||||
"sdk",
|
||||
"typescript"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tsup": "^8.3.0",
|
||||
"typescript": "^5.7.0"
|
||||
|
||||
Reference in New Issue
Block a user