mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 07:04:48 +00:00
fix: opencode compat tool call rendering and default to no-token (#95)
- Fix tool name lost on ToolResult events (persist via tool_name_by_call) - Fix tool input lost on ToolResult events (persist via tool_args_by_call) - Fix tool output in wrong field (error -> output) - Fix text doubling in streaming (defer emit to ItemCompleted) - Fix missing delta field in text streaming events - Default server mode to no-token when --token not specified - Add install-fast-sa and install-fast-gigacode justfile targets
This commit is contained in:
parent
a02393436c
commit
6a3345b954
32 changed files with 9193 additions and 38 deletions
10
justfile
10
justfile
|
|
@ -48,6 +48,16 @@ check:
|
|||
fmt:
|
||||
cargo fmt --all
|
||||
|
||||
[group('dev')]
|
||||
install-fast-sa:
|
||||
cargo build --release -p sandbox-agent
|
||||
cp target/release/sandbox-agent ~/.cargo/bin/sandbox-agent
|
||||
|
||||
[group('dev')]
|
||||
install-fast-gigacode:
|
||||
cargo build --release -p gigacode
|
||||
cp target/release/gigacode ~/.cargo/bin/gigacode
|
||||
|
||||
[group('dev')]
|
||||
dev-docs:
|
||||
cd docs && pnpm dlx mintlify dev
|
||||
|
|
|
|||
|
|
@ -4,11 +4,13 @@ Research notes on Sourcegraph Amp's configuration, credential discovery, and run
|
|||
|
||||
## Overview
|
||||
|
||||
- **Provider**: Anthropic (via Sourcegraph)
|
||||
- **Provider**: Anthropic (via Sourcegraph, proxied through ampcode.com)
|
||||
- **Execution Method**: CLI subprocess (`amp` command)
|
||||
- **Session Persistence**: Session ID (string)
|
||||
- **SDK**: `@sourcegraph/amp-sdk` (closed source)
|
||||
- **Binary**: Bun-bundled JS application (ELF wrapping Bun runtime + embedded JS)
|
||||
- **Binary Location**: `/usr/local/bin/amp`
|
||||
- **Backend**: `https://ampcode.com/` (server-side proxy for all LLM requests)
|
||||
|
||||
## CLI Usage
|
||||
|
||||
|
|
@ -208,6 +210,211 @@ curl -fsSL "https://storage.googleapis.com/amp-public-assets-prod-0/cli/${VERSIO
|
|||
- Default timeout: 5 minutes (300,000 ms)
|
||||
- Process killed with `SIGTERM` on timeout
|
||||
|
||||
## Model Discovery
|
||||
|
||||
**No model discovery mechanism exists.** Amp uses a server-side proxy architecture where model selection is abstracted behind "modes".
|
||||
|
||||
### Architecture (Reverse Engineered)
|
||||
|
||||
Amp is **NOT a Go binary** as previously thought — it is a **Bun-bundled JavaScript application** (ELF binary wrapping Bun runtime + embedded JS). The CLI logs confirm: `"argv":["bun","/$bunfs/root/amp-linux-x64",...]`.
|
||||
|
||||
**Amp is a server-side proxy.** All LLM requests go through `https://ampcode.com/`:
|
||||
1. CLI authenticates via `AMP_API_KEY` env var or browser-based OAuth to `https://ampcode.com/auth/cli-login`
|
||||
2. On startup, calls `getUserInfo` against `https://ampcode.com/`
|
||||
3. Model selection is handled **server-side**, not client-side
|
||||
|
||||
### Modes Instead of Models
|
||||
|
||||
Amp uses **modes** (`--mode` / `-m` flag) instead of direct model selection. Each mode bundles a model, system prompt, and tool selection together server-side.
|
||||
|
||||
#### Agent Modes
|
||||
|
||||
| Mode | Primary Model | Description |
|
||||
|------|---------------|-------------|
|
||||
| `smart` | Claude Opus 4.6 | Default. Unconstrained state-of-the-art model use, maximum capability and autonomy |
|
||||
| `rush` | Claude Haiku 4.5 | Faster and cheaper, suitable for small, well-defined tasks |
|
||||
| `deep` | GPT-5.2 Codex | Deep reasoning with extended thinking for complex problems. Requires `amp.experimental.modes: ["deep"]` |
|
||||
| `free` | Unknown | Free tier (listed in CLI `--help` but not on docs site) |
|
||||
| `large` | Unknown | Hidden/undocumented mode (referenced in docs but no details) |
|
||||
|
||||
Source: [ampcode.com/manual](https://ampcode.com/manual), [ampcode.com/models](https://ampcode.com/models)
|
||||
|
||||
#### Specialized Models (not user-selectable)
|
||||
|
||||
Amp also uses additional models for specific subtasks:
|
||||
|
||||
| Role | Model | Purpose |
|
||||
|------|-------|---------|
|
||||
| Review | Gemini 3 Pro | Code review and bug detection |
|
||||
| Search subagent | Gemini 3 Flash | Codebase retrieval |
|
||||
| Oracle subagent | GPT-5.2 | Complex code reasoning |
|
||||
| Librarian subagent | Claude Sonnet 4.5 | External code research |
|
||||
| Image/PDF analysis | Gemini 3 Flash | Multimodal input processing |
|
||||
| Content generation | Gemini 3 Pro Image (Painter) | Image generation |
|
||||
| Handoff (context) | Gemini 2.5 Flash | Context management |
|
||||
| Thread categorization | Gemini 2.5 Flash-Lite | Thread organization |
|
||||
| Title generation | Claude Haiku 4.5 | Thread title generation |
|
||||
|
||||
#### Mode Subsettings
|
||||
|
||||
- **`amp.experimental.modes`** — Array of experimental mode names to enable. Currently only `["deep"]` is documented.
|
||||
- **`amp.internal.deepReasoningEffort`** — Override reasoning effort for GPT-5.2 Codex in deep mode. Options: `medium`, `high`, `xhigh`. Default: `medium`. Keyboard shortcut `Alt+D` cycles through `deep` → `deep²` → `deep³` (corresponding to medium → high → xhigh).
|
||||
|
||||
#### Switching Modes
|
||||
|
||||
- **CLI flag**: `--mode <value>` or `-m <value>`
|
||||
- **Interactive TUI**: `Ctrl+O` → type "mode"
|
||||
- **Editor extension**: Mode selector in the prompt field
|
||||
|
||||
#### No Programmatic Mode Listing
|
||||
|
||||
There is no CLI command (`amp modes list`) or API endpoint to list available modes. The modes are:
|
||||
- Hardcoded in the `--help` text: `deep, free, rush, smart`
|
||||
- Documented on [ampcode.com/manual](https://ampcode.com/manual) and [ampcode.com/models](https://ampcode.com/models)
|
||||
- Up-to-date list available at [ampcode.com/manual#agent-modes](https://ampcode.com/manual#agent-modes)
|
||||
|
||||
The `--model` flag also still exists on the CLI but modes are the primary interface. It's unclear if `--model` bypasses mode selection or if it's ignored.
|
||||
|
||||
### Reverse Engineering Methodology
|
||||
|
||||
#### Step 1: CLI help analysis
|
||||
|
||||
```bash
|
||||
amp --help
|
||||
```
|
||||
|
||||
Revealed:
|
||||
- `-m, --mode <value>` flag with `deep`, `free`, `rush`, `smart` options (not `--model` for models)
|
||||
- `AMP_URL` env var defaults to `https://ampcode.com/`
|
||||
- `AMP_API_KEY` env var for authentication
|
||||
- Settings at `~/.config/amp/settings.json`
|
||||
- Logs at `~/.cache/amp/logs/cli.log`
|
||||
|
||||
#### Step 2: Binary analysis
|
||||
|
||||
```bash
|
||||
file ~/.local/bin/amp # → ELF 64-bit LSB executable, 117MB
|
||||
ls -lh ~/.local/bin/amp # → 117M
|
||||
strings ~/.local/bin/amp | grep 'ampcode' # → 43 matches, embedded JS visible
|
||||
```
|
||||
|
||||
The `file` command showed an ELF binary, initially suggesting a compiled Go binary. But `strings` revealed embedded JavaScript source code, and the debug logs later confirmed it's actually a **Bun-bundled application** (`argv: ["bun", "/$bunfs/root/amp-linux-x64", ...]`).
|
||||
|
||||
The embedded JS is minified but partially readable via `strings`. Found tool definitions (`edit_file`, `write_file`, `create_file`), skill loading code, and MCP integration code. Did not find hardcoded model lists or mode→model mappings — these are server-side.
|
||||
|
||||
#### Step 3: strace (failed for network, useful for file IO)
|
||||
|
||||
```bash
|
||||
strace -e trace=connect -f amp --execute "say hello" ...
|
||||
```
|
||||
|
||||
**Result: No `AF_INET` connections captured.** Only saw:
|
||||
- `AF_UNIX` socket to `/tmp/tmux-1000/default` (tmux IPC)
|
||||
- `socketpair()` for internal IPC between threads
|
||||
|
||||
**Why it failed:** Bun uses `io_uring` for async network IO on Linux, which bypasses traditional `connect()`/`sendto()` syscalls. strace hooks into the syscall layer, but io_uring submits work directly to the kernel via shared memory rings, making it invisible to strace.
|
||||
|
||||
Even with full syscall tracing (`strace -f -s 512` capturing 27,000 lines), zero TCP connections appeared.
|
||||
|
||||
#### Step 4: Process network inspection (partial success)
|
||||
|
||||
```bash
|
||||
# While amp was running:
|
||||
ss -tnp | grep amp
|
||||
cat /proc/<pid>/net/tcp6
|
||||
```
|
||||
|
||||
From `/proc/net/tcp6`, decoded a connection to port `01BB` (443/HTTPS). Resolved the destination to `34.54.147.251` via:
|
||||
|
||||
```bash
|
||||
dig ampcode.com +short # → 34.54.147.251
|
||||
```
|
||||
|
||||
Confirmed Amp connects to `ampcode.com:443`. But `ss -tnp` couldn't attribute the connection to the amp process (process had already exited or Bun's process model confused ss).
|
||||
|
||||
#### Step 5: Debug logging (most useful)
|
||||
|
||||
```bash
|
||||
env AMP_API_KEY=fake-key amp --execute "say hello" --stream-json --log-level debug
|
||||
# Then read: ~/.cache/amp/logs/cli.log
|
||||
```
|
||||
|
||||
The debug log revealed the complete startup sequence and API flow. Key log messages:
|
||||
- `"Initializing CLI context"` — shows `hasAmpAPIKey`, `hasAmpURL`, `hasSettingsFile`
|
||||
- `"Resolved Amp URL"` → `https://ampcode.com/`
|
||||
- `"API key lookup before login"` — `found: true/false`
|
||||
- `"API request for getUserInfo failed: 401"` — confirms API call to ampcode.com with our fake key
|
||||
- `"Starting Amp background services"` — proceeds even after auth failure
|
||||
|
||||
#### Step 6: Fake API key to bypass login (success)
|
||||
|
||||
Without `AMP_API_KEY`, Amp hangs indefinitely trying to open a browser for OAuth at `https://ampcode.com/auth/cli-login?authToken=...&callbackPort=...`. Setting `AMP_API_KEY=fake-key` bypasses the browser login flow and reaches the API call stage (where it gets a 401).
|
||||
|
||||
#### Step 7: NODE_DEBUG (failed)
|
||||
|
||||
```bash
|
||||
env NODE_DEBUG=http,https,net amp ...
|
||||
```
|
||||
|
||||
No output — Bun ignores Node.js debug environment variables.
|
||||
|
||||
### What Was NOT Captured
|
||||
|
||||
- **Actual HTTP request/response bodies** — Would require mitmproxy with HTTPS interception (set `amp.proxy` or `HTTPS_PROXY` env var, install custom CA cert). Not attempted.
|
||||
- **Mode→model mappings** — These are server-side in ampcode.com. The CLI sends a mode name and the server selects the model.
|
||||
- **Full API schema** — Only saw `getUserInfo` endpoint name in error message. Thread creation, message streaming, and other endpoints are unknown.
|
||||
- **Whether `--model` bypasses mode selection** — Couldn't test without a valid API key.
|
||||
|
||||
### Future Investigation
|
||||
|
||||
To capture full HTTP traffic, set up mitmproxy:
|
||||
|
||||
```bash
|
||||
# Install mitmproxy
|
||||
pip install mitmproxy
|
||||
|
||||
# Start proxy
|
||||
mitmproxy --listen-port 8080
|
||||
|
||||
# Run amp through proxy (amp.proxy setting or env var)
|
||||
# amp respects amp.proxy setting in ~/.config/amp/settings.json:
|
||||
# { "amp.proxy": "http://localhost:8080" }
|
||||
#
|
||||
# Then install mitmproxy's CA cert for TLS interception.
|
||||
```
|
||||
|
||||
Alternatively, since amp is a Bun binary, it may respect `HTTPS_PROXY` env var by default (Go's `net/http` does, Bun's `fetch` may as well).
|
||||
|
||||
### API Flow (from debug logs)
|
||||
|
||||
```
|
||||
1. "Starting Amp CLI" (version 0.0.1770352274-gd36e02)
|
||||
2. "Initializing CLI context" (hasAmpAPIKey: true/false)
|
||||
3. "Resolved Amp URL" → https://ampcode.com/
|
||||
4. Skills loading, MCP initialization, toolbox registration
|
||||
5. "API key lookup before login"
|
||||
6. getUserInfo API call → https://ampcode.com/ (401 with invalid key)
|
||||
7. "Starting Amp background services"
|
||||
8. Thread creation + message streaming via ampcode.com
|
||||
```
|
||||
|
||||
### Current Behavior
|
||||
|
||||
The sandbox-agent passes `--model` through to Amp without validation:
|
||||
|
||||
```rust
|
||||
if let Some(model) = options.model.as_deref() {
|
||||
command.arg("--model").arg(model);
|
||||
}
|
||||
```
|
||||
|
||||
### Possible Approaches
|
||||
|
||||
1. **Proxy provider APIs** — Not applicable; Amp proxies through ampcode.com, not directly to model providers
|
||||
2. **Hardcode known modes** — Expose the four modes (`deep`, `free`, `rush`, `smart`) as the available "model" options
|
||||
3. **Wait for Amp API** — Amp may add model/mode discovery in a future release
|
||||
4. **Scrape ampcode.com** — Check if the web UI exposes available modes/models
|
||||
|
||||
## Notes
|
||||
|
||||
- Amp is similar to Claude Code (same streaming format)
|
||||
|
|
|
|||
|
|
@ -226,6 +226,59 @@ Claude output is converted via `convertClaudeOutput()`:
|
|||
3. Parse with `ClaudeCliResponseSchema` as fallback
|
||||
4. Extract `structured_output` as metadata if present
|
||||
|
||||
## Model Discovery
|
||||
|
||||
Claude Code's `/models` slash command uses the **standard Anthropic Models API**.
|
||||
|
||||
### API Endpoint
|
||||
|
||||
```
|
||||
GET https://api.anthropic.com/v1/models?beta=true
|
||||
```
|
||||
|
||||
Found by reverse engineering the CLI bundle at `node_modules/@anthropic-ai/claude-code/cli.js`.
|
||||
|
||||
### API Client
|
||||
|
||||
The CLI contains an internal `Models` class with two methods:
|
||||
|
||||
```javascript
|
||||
// List all models
|
||||
GET /v1/models?beta=true
|
||||
|
||||
// Retrieve a single model
|
||||
GET /v1/models/${modelId}?beta=true
|
||||
```
|
||||
|
||||
Uses `this._client.getAPIList()` which handles paginated responses. The `?beta=true` query parameter is hardcoded to include beta/preview models.
|
||||
|
||||
### Authentication
|
||||
|
||||
Uses the same Anthropic API key / OAuth credentials that Claude Code uses for conversations. The request goes to the standard Anthropic API base URL.
|
||||
|
||||
### Hardcoded Context Window Data
|
||||
|
||||
The CLI also contains hardcoded output token limits for certain models (used as fallback):
|
||||
|
||||
```javascript
|
||||
{
|
||||
"claude-opus-4-20250514": 8192,
|
||||
"claude-opus-4-0": 8192,
|
||||
"claude-opus-4-1-20250805": 8192,
|
||||
// ... more entries
|
||||
}
|
||||
```
|
||||
|
||||
### How to Replicate
|
||||
|
||||
Call the Anthropic API directly — no need to go through the Claude CLI:
|
||||
|
||||
```
|
||||
GET https://api.anthropic.com/v1/models?beta=true
|
||||
x-api-key: <ANTHROPIC_API_KEY>
|
||||
anthropic-version: 2023-06-01
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- Claude CLI manages its own OAuth refresh internally
|
||||
|
|
|
|||
|
|
@ -318,6 +318,35 @@ fn codex_thread_id_from_server_notification(notification) -> Option<String> {
|
|||
}
|
||||
```
|
||||
|
||||
## Model Discovery
|
||||
|
||||
Codex exposes a `model/list` JSON-RPC method through its app-server process.
|
||||
|
||||
### JSON-RPC Method
|
||||
|
||||
```json
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"method": "model/list",
|
||||
"params": {
|
||||
"cursor": null,
|
||||
"limit": null
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Supports pagination via `cursor` and `limit` parameters. Defined in `resources/agent-schemas/artifacts/json-schema/codex.json`.
|
||||
|
||||
### How to Replicate
|
||||
|
||||
Requires a running Codex app-server process. Send the JSON-RPC request to the app-server over stdio. The response contains the list of models available to the Codex instance (depends on configured API keys / providers).
|
||||
|
||||
### Limitations
|
||||
|
||||
- Requires an active app-server process (cannot query models without starting one)
|
||||
- No standalone CLI command like `codex models`
|
||||
|
||||
## Notes
|
||||
|
||||
- SDK is dynamically imported to reduce bundle size
|
||||
|
|
|
|||
|
|
@ -509,6 +509,82 @@ const pollInterval = setInterval(async () => {
|
|||
}, 2000);
|
||||
```
|
||||
|
||||
## Model Discovery
|
||||
|
||||
OpenCode has the richest model discovery support with both CLI and HTTP API.
|
||||
|
||||
### CLI Commands
|
||||
|
||||
```bash
|
||||
opencode models # List all available models
|
||||
opencode models <provider> # List models for a specific provider
|
||||
```
|
||||
|
||||
### HTTP Endpoint
|
||||
|
||||
```
|
||||
GET /provider
|
||||
```
|
||||
|
||||
### Response Schema
|
||||
|
||||
```json
|
||||
{
|
||||
"all": [
|
||||
{
|
||||
"id": "anthropic",
|
||||
"name": "Anthropic",
|
||||
"api": "string",
|
||||
"env": ["ANTHROPIC_API_KEY"],
|
||||
"npm": "string",
|
||||
"models": {
|
||||
"model-key": {
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"family": "string",
|
||||
"release_date": "string",
|
||||
"attachment": true,
|
||||
"reasoning": false,
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0.003,
|
||||
"output": 0.015,
|
||||
"cache_read": 0.0003,
|
||||
"cache_write": 0.00375
|
||||
},
|
||||
"limit": {
|
||||
"context": 200000,
|
||||
"input": 200000,
|
||||
"output": 8192
|
||||
},
|
||||
"modalities": {
|
||||
"input": ["text", "image"],
|
||||
"output": ["text"]
|
||||
},
|
||||
"experimental": false,
|
||||
"status": "beta"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"default": {
|
||||
"anthropic": "claude-sonnet-4-20250514"
|
||||
},
|
||||
"connected": ["anthropic"]
|
||||
}
|
||||
```
|
||||
|
||||
### SDK Usage
|
||||
|
||||
```typescript
|
||||
const client = createOpencodeClient();
|
||||
const response = await client.provider.list();
|
||||
```
|
||||
|
||||
### How to Replicate
|
||||
|
||||
When an OpenCode server is running, call `GET /provider` on its HTTP port. Returns full model metadata including capabilities, costs, context limits, and modalities.
|
||||
|
||||
## Notes
|
||||
|
||||
- OpenCode is the most feature-rich runtime (streaming, questions, permissions)
|
||||
|
|
|
|||
70
research/opencode-compat/COMPARISON.md
Normal file
70
research/opencode-compat/COMPARISON.md
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
# Native OpenCode vs Sandbox-Agent: OpenCode API Comparison
|
||||
|
||||
## Overview
|
||||
|
||||
Captured API output from both native OpenCode server (v1.1.49) and sandbox-agent's
|
||||
OpenCode compatibility layer, sending identical request patterns:
|
||||
1. Message 1: Simple text response (echo/text)
|
||||
2. Message 2: Tool call (ls/mock.search)
|
||||
|
||||
## Bugs Found and Fixed
|
||||
|
||||
### 1. Tool name (`tool` field) changed between events [FIXED]
|
||||
|
||||
**Bug**: The `tool` field in tool part events changed between `pending` and `running`/`completed`
|
||||
states. In the `pending` event it correctly showed `"mock.search"`, but in subsequent events
|
||||
(from ToolResult) it showed `"tool"` because `extract_tool_content` doesn't return tool_name
|
||||
for ToolResult items.
|
||||
|
||||
**Fix**: Added `tool_name_by_call` HashMap to `OpenCodeSessionRuntime` to persist tool names
|
||||
from ToolCall events and look them up during ToolResult processing.
|
||||
|
||||
### 2. Tool `input` lost on ToolResult events [FIXED]
|
||||
|
||||
**Bug**: When the ToolResult event came in, the tool's input arguments were lost because
|
||||
ToolResult content only contains `call_id` and `output`, not arguments.
|
||||
|
||||
**Fix**: Added `tool_args_by_call` HashMap to `OpenCodeSessionRuntime` to persist arguments
|
||||
from ToolCall events and look them up during ToolResult processing.
|
||||
|
||||
### 3. Tool `output` in wrong field (`error` instead of `output`) [FIXED]
|
||||
|
||||
**Bug**: When tool result status was `Failed`, the output text was put in `"error"` field.
|
||||
Native OpenCode uses `"output"` field for tool output regardless of success/failure.
|
||||
|
||||
**Fix**: Changed the failed tool result JSON to use `"output"` instead of `"error"`.
|
||||
|
||||
### 4. Text doubling in streaming [FIXED]
|
||||
|
||||
**Bug**: During text streaming, `ItemStarted` emitted a text part with full content, then
|
||||
`ItemDelta` appended delta text, then `ItemCompleted` emitted again, causing doubled text.
|
||||
|
||||
**Fix**: `ItemStarted` now only initializes empty text in runtime without emitting a part event.
|
||||
`ItemCompleted` emits the final text using accumulated delta text or fallback to content text.
|
||||
|
||||
### 5. Missing `delta` field in text streaming events [FIXED]
|
||||
|
||||
**Bug**: `delta` field was not included in `message.part.updated` events for text streaming.
|
||||
Native OpenCode includes `delta` on streaming events and omits it on the final event.
|
||||
|
||||
**Fix**: Changed `apply_item_delta` to use `part_event_with_delta` instead of `part_event`.
|
||||
|
||||
### 6. Not bugs (noted for completeness)
|
||||
|
||||
- **Missing `step-start`/`step-finish` parts**: These are OpenCode-specific (git snapshot
|
||||
tracking) and not expected from sandbox-agent.
|
||||
- **Missing `time` on text parts**: Minor; could be added in future.
|
||||
- **Missing `time.completed` on some assistant messages**: Minor timing issue.
|
||||
|
||||
## Verification
|
||||
|
||||
After fixes, all tool events now correctly show:
|
||||
- `"tool": "mock.search"` across all states (pending, running, error)
|
||||
- `"input": {"query": "example"}` preserved across all states
|
||||
- `"output": "mock search results"` on the error event (not `"error"`)
|
||||
- Text streaming includes `delta` field
|
||||
- No text doubling
|
||||
|
||||
All 28 OpenCode compat tests pass.
|
||||
All 10 session snapshot tests pass.
|
||||
All 3 HTTP endpoint tests pass.
|
||||
260
research/opencode-compat/capture-native.ts
Normal file
260
research/opencode-compat/capture-native.ts
Normal file
|
|
@ -0,0 +1,260 @@
|
|||
/**
|
||||
* Capture native OpenCode server API output for comparison.
|
||||
*
|
||||
* Usage:
|
||||
* npx tsx capture-native.ts
|
||||
*
|
||||
* Starts a native OpenCode headless server, creates a Claude session,
|
||||
* sends 2 messages (one that triggers tool calls), and captures all
|
||||
* session events and message snapshots.
|
||||
*/
|
||||
import { spawn, type ChildProcess } from "node:child_process";
|
||||
import { writeFileSync, mkdirSync, existsSync } from "node:fs";
|
||||
import { createServer, type AddressInfo } from "node:net";
|
||||
|
||||
const OUTPUT_DIR = new URL("./snapshots/native", import.meta.url).pathname;
|
||||
|
||||
async function getFreePort(): Promise<number> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const server = createServer();
|
||||
server.unref();
|
||||
server.on("error", reject);
|
||||
server.listen(0, "127.0.0.1", () => {
|
||||
const address = server.address() as AddressInfo;
|
||||
server.close(() => resolve(address.port));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function waitForHealth(baseUrl: string, timeoutMs = 30_000): Promise<void> {
|
||||
const start = Date.now();
|
||||
while (Date.now() - start < timeoutMs) {
|
||||
try {
|
||||
const res = await fetch(`${baseUrl}/global/health`);
|
||||
if (res.ok) return;
|
||||
} catch {}
|
||||
await new Promise((r) => setTimeout(r, 300));
|
||||
}
|
||||
throw new Error("Timed out waiting for native opencode health");
|
||||
}
|
||||
|
||||
function saveJson(name: string, data: unknown) {
|
||||
if (!existsSync(OUTPUT_DIR)) mkdirSync(OUTPUT_DIR, { recursive: true });
|
||||
const path = `${OUTPUT_DIR}/${name}.json`;
|
||||
writeFileSync(path, JSON.stringify(data, null, 2));
|
||||
console.log(` [saved] ${path}`);
|
||||
}
|
||||
|
||||
async function waitForIdle(baseUrl: string, sessionId: string, timeoutMs: number): Promise<void> {
|
||||
const start = Date.now();
|
||||
// Give a small initial delay for the status to change to busy
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
while (Date.now() - start < timeoutMs) {
|
||||
try {
|
||||
const statusRes = await fetch(`${baseUrl}/session/status`);
|
||||
const statuses = await statusRes.json();
|
||||
const sessionStatus = statuses?.[sessionId];
|
||||
if (sessionStatus?.type === "idle" || sessionStatus === undefined) {
|
||||
return;
|
||||
}
|
||||
} catch {}
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
}
|
||||
throw new Error("Timed out waiting for session to become idle");
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const port = await getFreePort();
|
||||
const baseUrl = `http://127.0.0.1:${port}`;
|
||||
|
||||
console.log(`Starting native OpenCode server on port ${port}...`);
|
||||
|
||||
const child: ChildProcess = spawn("opencode", ["serve", "--port", String(port)], {
|
||||
stdio: "pipe",
|
||||
env: { ...process.env },
|
||||
});
|
||||
|
||||
let stderr = "";
|
||||
child.stderr?.on("data", (chunk) => {
|
||||
stderr += chunk.toString();
|
||||
});
|
||||
child.stdout?.on("data", (chunk) => {
|
||||
const text = chunk.toString();
|
||||
if (text.includes("listening")) console.log(` [opencode] ${text.trim()}`);
|
||||
});
|
||||
|
||||
// Track all SSE events in a separate array
|
||||
const allEvents: any[] = [];
|
||||
let sseAbort: AbortController | null = null;
|
||||
let currentBaseUrl = "";
|
||||
|
||||
try {
|
||||
await waitForHealth(baseUrl);
|
||||
currentBaseUrl = baseUrl;
|
||||
console.log("Native OpenCode server is healthy!");
|
||||
|
||||
// 1. Capture initial metadata
|
||||
const [agentRes, configRes] = await Promise.all([
|
||||
fetch(`${baseUrl}/agent`).then((r) => r.json()),
|
||||
fetch(`${baseUrl}/config`).then((r) => r.json()),
|
||||
]);
|
||||
saveJson("metadata-agent", agentRes);
|
||||
saveJson("metadata-config", configRes);
|
||||
|
||||
// 2. Start SSE event collection
|
||||
sseAbort = new AbortController();
|
||||
const ssePromise = (async () => {
|
||||
try {
|
||||
const res = await fetch(`${baseUrl}/event`, {
|
||||
signal: sseAbort!.signal,
|
||||
headers: { Accept: "text/event-stream" },
|
||||
});
|
||||
if (!res.ok || !res.body) {
|
||||
console.error("SSE connection failed:", res.status);
|
||||
return;
|
||||
}
|
||||
const reader = res.body.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
let buffer = "";
|
||||
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
buffer += decoder.decode(value, { stream: true });
|
||||
|
||||
const lines = buffer.split("\n");
|
||||
buffer = lines.pop() || "";
|
||||
|
||||
for (const line of lines) {
|
||||
if (line.startsWith("data: ")) {
|
||||
try {
|
||||
const parsed = JSON.parse(line.slice(6));
|
||||
allEvents.push(parsed);
|
||||
// Auto-approve permissions
|
||||
if (parsed.type === "permission.asked" && parsed.properties?.id) {
|
||||
const permId = parsed.properties.id;
|
||||
console.log(` [auto-approving permission ${permId}]`);
|
||||
fetch(`${currentBaseUrl}/permission/${permId}/reply`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ allow: true }),
|
||||
}).catch(() => {});
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err: any) {
|
||||
if (err.name !== "AbortError") {
|
||||
// Ignore - expected when server closes
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
// Give SSE time to connect
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
|
||||
// 3. Create a session
|
||||
console.log("Creating session...");
|
||||
const sessionRes = await fetch(`${baseUrl}/session`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({}),
|
||||
});
|
||||
const session = await sessionRes.json();
|
||||
saveJson("session-create", session);
|
||||
const sessionId = session.id;
|
||||
console.log(` Session ID: ${sessionId}`);
|
||||
|
||||
// Use anthropic provider with a cheap model for testing
|
||||
const model = { providerID: "anthropic", modelID: "claude-haiku-4-5" };
|
||||
|
||||
// 4. Send first message (simple text response) - use prompt_async + wait
|
||||
console.log("Sending message 1 (simple text)...");
|
||||
await fetch(`${baseUrl}/session/${sessionId}/prompt_async`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
model,
|
||||
parts: [{ type: "text", text: "Respond with exactly: 'Hello from OpenCode'. Nothing else." }],
|
||||
}),
|
||||
});
|
||||
|
||||
// Wait for the response to be fully processed
|
||||
console.log(" Waiting for message 1 to complete...");
|
||||
await waitForIdle(baseUrl, sessionId, 60_000);
|
||||
await new Promise((r) => setTimeout(r, 1000));
|
||||
|
||||
// 5. Get messages after first request
|
||||
const messagesAfter1 = await fetch(`${baseUrl}/session/${sessionId}/message`).then((r) =>
|
||||
r.json()
|
||||
);
|
||||
saveJson("messages-after-1", messagesAfter1);
|
||||
console.log(` Got ${messagesAfter1.length} messages after msg 1`);
|
||||
|
||||
// 6. Send second message (ask for a tool call - file write) - use prompt_async
|
||||
console.log("Sending message 2 (should trigger tool calls)...");
|
||||
await fetch(`${baseUrl}/session/${sessionId}/prompt_async`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
model,
|
||||
parts: [
|
||||
{
|
||||
type: "text",
|
||||
text: "List the files in the current directory. Use the list/ls tool. Only list the top-level contents, do not recurse.",
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
|
||||
// Wait for completion (longer timeout for tool calls + permissions)
|
||||
console.log(" Waiting for message 2 to complete...");
|
||||
try {
|
||||
await waitForIdle(baseUrl, sessionId, 120_000);
|
||||
} catch (e) {
|
||||
console.log(" Warning: timed out waiting for idle, capturing what we have...");
|
||||
}
|
||||
await new Promise((r) => setTimeout(r, 2000));
|
||||
|
||||
// 7. Get messages after second request
|
||||
const messagesAfter2 = await fetch(`${baseUrl}/session/${sessionId}/message`).then((r) =>
|
||||
r.json()
|
||||
);
|
||||
saveJson("messages-after-2", messagesAfter2);
|
||||
console.log(` Got ${messagesAfter2.length} messages after msg 2`);
|
||||
|
||||
// 8. Get session details
|
||||
const sessionDetails = await fetch(`${baseUrl}/session/${sessionId}`).then((r) => r.json());
|
||||
saveJson("session-details", sessionDetails);
|
||||
|
||||
// 9. Get session status
|
||||
const sessionStatus = await fetch(`${baseUrl}/session/status`).then((r) => r.json());
|
||||
saveJson("session-status", sessionStatus);
|
||||
|
||||
// 10. Stop SSE and save events
|
||||
sseAbort.abort();
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
saveJson("all-events", allEvents);
|
||||
|
||||
// Filter events for this session
|
||||
const sessionEvents = allEvents.filter(
|
||||
(e) => e.properties?.sessionID === sessionId ||
|
||||
(e.type === "session.created" && e.properties?.info?.id === sessionId)
|
||||
);
|
||||
saveJson("session-events", sessionEvents);
|
||||
|
||||
console.log(`\nCapture complete! ${allEvents.length} total events, ${sessionEvents.length} session events.`);
|
||||
console.log(`Output saved to: ${OUTPUT_DIR}/`);
|
||||
} finally {
|
||||
if (sseAbort) sseAbort.abort();
|
||||
child.kill("SIGTERM");
|
||||
await new Promise((r) => setTimeout(r, 1000));
|
||||
if (child.exitCode === null) child.kill("SIGKILL");
|
||||
}
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error("Fatal error:", err);
|
||||
process.exit(1);
|
||||
});
|
||||
249
research/opencode-compat/capture-sandbox-agent.ts
Normal file
249
research/opencode-compat/capture-sandbox-agent.ts
Normal file
|
|
@ -0,0 +1,249 @@
|
|||
/**
|
||||
* Capture sandbox-agent OpenCode compatibility API output for comparison.
|
||||
*
|
||||
* Usage:
|
||||
* npx tsx capture-sandbox-agent.ts
|
||||
*
|
||||
* Starts sandbox-agent with mock agent, creates a session via /opencode API,
|
||||
* sends 2 messages (text + tool call), and captures all events/messages.
|
||||
*/
|
||||
import { spawn, type ChildProcess } from "node:child_process";
|
||||
import { writeFileSync, mkdirSync, existsSync } from "node:fs";
|
||||
import { createServer, type AddressInfo } from "node:net";
|
||||
import { randomBytes } from "node:crypto";
|
||||
|
||||
const OUTPUT_DIR = new URL("./snapshots/sandbox-agent", import.meta.url).pathname;
|
||||
|
||||
async function getFreePort(): Promise<number> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const server = createServer();
|
||||
server.unref();
|
||||
server.on("error", reject);
|
||||
server.listen(0, "127.0.0.1", () => {
|
||||
const address = server.address() as AddressInfo;
|
||||
server.close(() => resolve(address.port));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function waitForHealth(baseUrl: string, token: string, timeoutMs = 30_000): Promise<void> {
|
||||
const start = Date.now();
|
||||
while (Date.now() - start < timeoutMs) {
|
||||
try {
|
||||
const res = await fetch(`${baseUrl}/v1/health`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (res.ok) return;
|
||||
} catch {}
|
||||
await new Promise((r) => setTimeout(r, 300));
|
||||
}
|
||||
throw new Error("Timed out waiting for sandbox-agent health");
|
||||
}
|
||||
|
||||
function saveJson(name: string, data: unknown) {
|
||||
if (!existsSync(OUTPUT_DIR)) mkdirSync(OUTPUT_DIR, { recursive: true });
|
||||
const path = `${OUTPUT_DIR}/${name}.json`;
|
||||
writeFileSync(path, JSON.stringify(data, null, 2));
|
||||
console.log(` [saved] ${path}`);
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const port = await getFreePort();
|
||||
const host = "127.0.0.1";
|
||||
const baseUrl = `http://${host}:${port}`;
|
||||
const opencodeUrl = `${baseUrl}/opencode`;
|
||||
const token = randomBytes(24).toString("hex");
|
||||
|
||||
console.log(`Starting sandbox-agent on port ${port}...`);
|
||||
|
||||
// Use the locally built binary, not the installed one
|
||||
const binaryPath = new URL("../../target/release/sandbox-agent", import.meta.url).pathname;
|
||||
const child: ChildProcess = spawn(
|
||||
binaryPath,
|
||||
["server", "--host", host, "--port", String(port), "--token", token],
|
||||
{
|
||||
stdio: "pipe",
|
||||
env: {
|
||||
...process.env,
|
||||
SANDBOX_AGENT_SKIP_INSPECTOR: "1",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
let stderr = "";
|
||||
child.stderr?.on("data", (chunk) => {
|
||||
stderr += chunk.toString();
|
||||
});
|
||||
|
||||
const allEvents: any[] = [];
|
||||
let sseAbort: AbortController | null = null;
|
||||
|
||||
try {
|
||||
await waitForHealth(baseUrl, token);
|
||||
console.log("sandbox-agent is healthy!");
|
||||
|
||||
// 1. Capture initial metadata via /opencode routes
|
||||
const headers = { Authorization: `Bearer ${token}` };
|
||||
const [agentRes, configRes] = await Promise.all([
|
||||
fetch(`${opencodeUrl}/agent`, { headers }).then((r) => r.json()),
|
||||
fetch(`${opencodeUrl}/config`, { headers }).then((r) => r.json()),
|
||||
]);
|
||||
saveJson("metadata-agent", agentRes);
|
||||
saveJson("metadata-config", configRes);
|
||||
|
||||
// 2. Start SSE event collection
|
||||
sseAbort = new AbortController();
|
||||
const ssePromise = (async () => {
|
||||
try {
|
||||
const res = await fetch(`${opencodeUrl}/event`, {
|
||||
signal: sseAbort!.signal,
|
||||
headers: { ...headers, Accept: "text/event-stream" },
|
||||
});
|
||||
if (!res.ok || !res.body) {
|
||||
console.error("SSE connection failed:", res.status, await res.text());
|
||||
return;
|
||||
}
|
||||
const reader = res.body.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
let buffer = "";
|
||||
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
buffer += decoder.decode(value, { stream: true });
|
||||
|
||||
const lines = buffer.split("\n");
|
||||
buffer = lines.pop() || "";
|
||||
|
||||
for (const line of lines) {
|
||||
if (line.startsWith("data: ")) {
|
||||
try {
|
||||
const parsed = JSON.parse(line.slice(6));
|
||||
allEvents.push(parsed);
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err: any) {
|
||||
if (err.name !== "AbortError") {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
// Give SSE time to connect
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
|
||||
// 3. Create a session
|
||||
console.log("Creating session...");
|
||||
const sessionRes = await fetch(`${opencodeUrl}/session`, {
|
||||
method: "POST",
|
||||
headers: { ...headers, "Content-Type": "application/json" },
|
||||
body: JSON.stringify({}),
|
||||
});
|
||||
const session = await sessionRes.json();
|
||||
saveJson("session-create", session);
|
||||
const sessionId = session.id;
|
||||
console.log(` Session ID: ${sessionId}`);
|
||||
|
||||
// 4. Send first message (simple text response) using mock agent's "echo" command
|
||||
console.log("Sending message 1 (simple text - echo)...");
|
||||
const msg1Res = await fetch(`${opencodeUrl}/session/${sessionId}/prompt_async`, {
|
||||
method: "POST",
|
||||
headers: { ...headers, "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
model: { providerID: "sandbox-agent", modelID: "mock" },
|
||||
parts: [{ type: "text", text: "echo Hello from sandbox-agent" }],
|
||||
}),
|
||||
});
|
||||
console.log(` prompt_async status: ${msg1Res.status}`);
|
||||
|
||||
// Wait for idle
|
||||
console.log(" Waiting for message 1 to complete...");
|
||||
await waitForIdle(opencodeUrl, sessionId, headers, 30_000);
|
||||
await new Promise((r) => setTimeout(r, 1000));
|
||||
|
||||
// 5. Get messages after first request
|
||||
const messagesAfter1 = await fetch(`${opencodeUrl}/session/${sessionId}/message`, { headers }).then((r) => r.json());
|
||||
saveJson("messages-after-1", messagesAfter1);
|
||||
console.log(` Got ${messagesAfter1.length} messages after msg 1`);
|
||||
|
||||
// 6. Send second message (trigger tool calls) using mock agent's "tool" command
|
||||
console.log("Sending message 2 (tool calls)...");
|
||||
const msg2Res = await fetch(`${opencodeUrl}/session/${sessionId}/prompt_async`, {
|
||||
method: "POST",
|
||||
headers: { ...headers, "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
model: { providerID: "sandbox-agent", modelID: "mock" },
|
||||
parts: [{ type: "text", text: "tool" }],
|
||||
}),
|
||||
});
|
||||
console.log(` prompt_async status: ${msg2Res.status}`);
|
||||
|
||||
// Wait for completion
|
||||
console.log(" Waiting for message 2 to complete...");
|
||||
await waitForIdle(opencodeUrl, sessionId, headers, 30_000);
|
||||
await new Promise((r) => setTimeout(r, 1000));
|
||||
|
||||
// 7. Get messages after second request
|
||||
const messagesAfter2 = await fetch(`${opencodeUrl}/session/${sessionId}/message`, { headers }).then((r) => r.json());
|
||||
saveJson("messages-after-2", messagesAfter2);
|
||||
console.log(` Got ${messagesAfter2.length} messages after msg 2`);
|
||||
|
||||
// 8. Get session details
|
||||
const sessionDetails = await fetch(`${opencodeUrl}/session/${sessionId}`, { headers }).then((r) => r.json());
|
||||
saveJson("session-details", sessionDetails);
|
||||
|
||||
// 9. Get session status
|
||||
const sessionStatus = await fetch(`${opencodeUrl}/session/status`, { headers }).then((r) => r.json());
|
||||
saveJson("session-status", sessionStatus);
|
||||
|
||||
// 10. Stop SSE and save events
|
||||
sseAbort.abort();
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
saveJson("all-events", allEvents);
|
||||
|
||||
// Filter session events
|
||||
const sessionEvents = allEvents.filter(
|
||||
(e) =>
|
||||
e.properties?.sessionID === sessionId ||
|
||||
(e.type === "session.created" && e.properties?.info?.id === sessionId)
|
||||
);
|
||||
saveJson("session-events", sessionEvents);
|
||||
|
||||
console.log(`\nCapture complete! ${allEvents.length} total events, ${sessionEvents.length} session events.`);
|
||||
console.log(`Output saved to: ${OUTPUT_DIR}/`);
|
||||
} finally {
|
||||
if (sseAbort) sseAbort.abort();
|
||||
child.kill("SIGTERM");
|
||||
await new Promise((r) => setTimeout(r, 1000));
|
||||
if (child.exitCode === null) child.kill("SIGKILL");
|
||||
}
|
||||
}
|
||||
|
||||
async function waitForIdle(
|
||||
opencodeUrl: string,
|
||||
sessionId: string,
|
||||
headers: Record<string, string>,
|
||||
timeoutMs: number
|
||||
): Promise<void> {
|
||||
const start = Date.now();
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
while (Date.now() - start < timeoutMs) {
|
||||
try {
|
||||
const statusRes = await fetch(`${opencodeUrl}/session/status`, { headers });
|
||||
const statuses = await statusRes.json();
|
||||
const sessionStatus = statuses?.[sessionId];
|
||||
if (sessionStatus?.type === "idle" || sessionStatus === undefined) {
|
||||
return;
|
||||
}
|
||||
} catch {}
|
||||
await new Promise((r) => setTimeout(r, 300));
|
||||
}
|
||||
throw new Error("Timed out waiting for session to become idle");
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error("Fatal error:", err);
|
||||
process.exit(1);
|
||||
});
|
||||
1281
research/opencode-compat/snapshots/native/all-events.json
Normal file
1281
research/opencode-compat/snapshots/native/all-events.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"info": {
|
||||
"id": "msg_c31b8e048001p0fSvme0VWmKR0",
|
||||
"sessionID": "ses_3ce471fc8ffeS9ZUpB7rVDen7k",
|
||||
"role": "assistant",
|
||||
"time": {
|
||||
"created": 1770360725576,
|
||||
"completed": 1770360727252
|
||||
},
|
||||
"parentID": "msg_c31b8e040001pIkL4AzVtzdVRd",
|
||||
"modelID": "claude-haiku-4-5",
|
||||
"providerID": "anthropic",
|
||||
"mode": "build",
|
||||
"agent": "build",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent"
|
||||
},
|
||||
"cost": 0,
|
||||
"tokens": {
|
||||
"input": 2,
|
||||
"output": 7,
|
||||
"reasoning": 0,
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 13540
|
||||
}
|
||||
},
|
||||
"finish": "stop"
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "prt_c31b8e6b10012vw5mZVWX51UQm",
|
||||
"sessionID": "ses_3ce471fc8ffeS9ZUpB7rVDen7k",
|
||||
"messageID": "msg_c31b8e048001p0fSvme0VWmKR0",
|
||||
"type": "step-start",
|
||||
"snapshot": "f93f1b3f790c9b1fe51007d1b4a46bcb2d528a91"
|
||||
},
|
||||
{
|
||||
"id": "prt_c31b8e6b1002OBaD5M55iOVva6",
|
||||
"sessionID": "ses_3ce471fc8ffeS9ZUpB7rVDen7k",
|
||||
"messageID": "msg_c31b8e048001p0fSvme0VWmKR0",
|
||||
"type": "text",
|
||||
"text": "Hello from OpenCode",
|
||||
"time": {
|
||||
"start": 1770360727218,
|
||||
"end": 1770360727218
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "prt_c31b8e6cd0012b1geOngJvrf2q",
|
||||
"sessionID": "ses_3ce471fc8ffeS9ZUpB7rVDen7k",
|
||||
"messageID": "msg_c31b8e048001p0fSvme0VWmKR0",
|
||||
"type": "step-finish",
|
||||
"reason": "stop",
|
||||
"snapshot": "f93f1b3f790c9b1fe51007d1b4a46bcb2d528a91",
|
||||
"cost": 0,
|
||||
"tokens": {
|
||||
"input": 2,
|
||||
"output": 7,
|
||||
"reasoning": 0,
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 13540
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"info": {
|
||||
"id": "msg_c31b349c3001C3jUz57fj5vRae",
|
||||
"sessionID": "ses_3ce4cbd76ffeHVa3mLvB00FXDV",
|
||||
"role": "assistant",
|
||||
"time": {
|
||||
"created": 1770360359363,
|
||||
"completed": 1770360359565
|
||||
},
|
||||
"error": {
|
||||
"name": "APIError",
|
||||
"data": {
|
||||
"message": "Unauthorized: {\"type\":\"error\",\"error\":{\"type\":\"AuthError\",\"message\":\"Invalid API key.\"}}",
|
||||
"statusCode": 401,
|
||||
"isRetryable": false,
|
||||
"responseHeaders": {
|
||||
"cf-placement": "local-SJC",
|
||||
"cf-ray": "9c98b01658355024-SJC",
|
||||
"connection": "keep-alive",
|
||||
"content-length": "74",
|
||||
"content-type": "text/plain;charset=UTF-8",
|
||||
"date": "Fri, 06 Feb 2026 06:45:59 GMT",
|
||||
"server": "cloudflare"
|
||||
},
|
||||
"responseBody": "{\"type\":\"error\",\"error\":{\"type\":\"AuthError\",\"message\":\"Invalid API key.\"}}",
|
||||
"metadata": {
|
||||
"url": "https://opencode.ai/zen/v1/models/gemini-3-pro:streamGenerateContent?alt=sse"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parentID": "msg_c31b349c2001kJD7I7MRSAVo57",
|
||||
"modelID": "gemini-3-pro",
|
||||
"providerID": "opencode",
|
||||
"mode": "build",
|
||||
"agent": "build",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent"
|
||||
},
|
||||
"cost": 0,
|
||||
"tokens": {
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0,
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"parts": []
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
[
|
||||
{
|
||||
"info": {
|
||||
"id": "msg_c31bd424c001ICzhibLcSkazYE",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"role": "user",
|
||||
"time": {
|
||||
"created": 1770361012812
|
||||
},
|
||||
"summary": {
|
||||
"title": "Hello from OpenCode",
|
||||
"diffs": []
|
||||
},
|
||||
"agent": "build",
|
||||
"model": {
|
||||
"providerID": "anthropic",
|
||||
"modelID": "claude-haiku-4-5"
|
||||
}
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "prt_c31bd424c002I8ASgZXZGMnUf2",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd424c001ICzhibLcSkazYE",
|
||||
"type": "text",
|
||||
"text": "Respond with exactly: 'Hello from OpenCode'. Nothing else."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": {
|
||||
"id": "msg_c31bd4260001o9JzwTa1Ops17t",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"role": "assistant",
|
||||
"time": {
|
||||
"created": 1770361012832,
|
||||
"completed": 1770361014171
|
||||
},
|
||||
"parentID": "msg_c31bd424c001ICzhibLcSkazYE",
|
||||
"modelID": "claude-haiku-4-5",
|
||||
"providerID": "anthropic",
|
||||
"mode": "build",
|
||||
"agent": "build",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent"
|
||||
},
|
||||
"cost": 0,
|
||||
"tokens": {
|
||||
"input": 2,
|
||||
"output": 7,
|
||||
"reasoning": 0,
|
||||
"cache": {
|
||||
"read": 13540,
|
||||
"write": 0
|
||||
}
|
||||
},
|
||||
"finish": "stop"
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "prt_c31bd4779001QLU4EXzj63WQ4W",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd4260001o9JzwTa1Ops17t",
|
||||
"type": "step-start",
|
||||
"snapshot": "302d31eedbdd77a5b1eb84e2fbc4e99e8b97e549"
|
||||
},
|
||||
{
|
||||
"id": "prt_c31bd477c001Gq3CWQQXR1h7fD",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd4260001o9JzwTa1Ops17t",
|
||||
"type": "text",
|
||||
"text": "Hello from OpenCode",
|
||||
"time": {
|
||||
"start": 1770361014146,
|
||||
"end": 1770361014146
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "prt_c31bd4793001LdK7WQwiUgzctY",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd4260001o9JzwTa1Ops17t",
|
||||
"type": "step-finish",
|
||||
"reason": "stop",
|
||||
"snapshot": "302d31eedbdd77a5b1eb84e2fbc4e99e8b97e549",
|
||||
"cost": 0,
|
||||
"tokens": {
|
||||
"input": 2,
|
||||
"output": 7,
|
||||
"reasoning": 0,
|
||||
"cache": {
|
||||
"read": 13540,
|
||||
"write": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
281
research/opencode-compat/snapshots/native/messages-after-2.json
Normal file
281
research/opencode-compat/snapshots/native/messages-after-2.json
Normal file
|
|
@ -0,0 +1,281 @@
|
|||
[
|
||||
{
|
||||
"info": {
|
||||
"id": "msg_c31bd424c001ICzhibLcSkazYE",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"role": "user",
|
||||
"time": {
|
||||
"created": 1770361012812
|
||||
},
|
||||
"summary": {
|
||||
"title": "Hello from OpenCode",
|
||||
"diffs": []
|
||||
},
|
||||
"agent": "build",
|
||||
"model": {
|
||||
"providerID": "anthropic",
|
||||
"modelID": "claude-haiku-4-5"
|
||||
}
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "prt_c31bd424c002I8ASgZXZGMnUf2",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd424c001ICzhibLcSkazYE",
|
||||
"type": "text",
|
||||
"text": "Respond with exactly: 'Hello from OpenCode'. Nothing else."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": {
|
||||
"id": "msg_c31bd4260001o9JzwTa1Ops17t",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"role": "assistant",
|
||||
"time": {
|
||||
"created": 1770361012832,
|
||||
"completed": 1770361014171
|
||||
},
|
||||
"parentID": "msg_c31bd424c001ICzhibLcSkazYE",
|
||||
"modelID": "claude-haiku-4-5",
|
||||
"providerID": "anthropic",
|
||||
"mode": "build",
|
||||
"agent": "build",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent"
|
||||
},
|
||||
"cost": 0,
|
||||
"tokens": {
|
||||
"input": 2,
|
||||
"output": 7,
|
||||
"reasoning": 0,
|
||||
"cache": {
|
||||
"read": 13540,
|
||||
"write": 0
|
||||
}
|
||||
},
|
||||
"finish": "stop"
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "prt_c31bd4779001QLU4EXzj63WQ4W",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd4260001o9JzwTa1Ops17t",
|
||||
"type": "step-start",
|
||||
"snapshot": "302d31eedbdd77a5b1eb84e2fbc4e99e8b97e549"
|
||||
},
|
||||
{
|
||||
"id": "prt_c31bd477c001Gq3CWQQXR1h7fD",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd4260001o9JzwTa1Ops17t",
|
||||
"type": "text",
|
||||
"text": "Hello from OpenCode",
|
||||
"time": {
|
||||
"start": 1770361014146,
|
||||
"end": 1770361014146
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "prt_c31bd4793001LdK7WQwiUgzctY",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd4260001o9JzwTa1Ops17t",
|
||||
"type": "step-finish",
|
||||
"reason": "stop",
|
||||
"snapshot": "302d31eedbdd77a5b1eb84e2fbc4e99e8b97e549",
|
||||
"cost": 0,
|
||||
"tokens": {
|
||||
"input": 2,
|
||||
"output": 7,
|
||||
"reasoning": 0,
|
||||
"cache": {
|
||||
"read": 13540,
|
||||
"write": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": {
|
||||
"id": "msg_c31bd4c1b001xWoyoqqLd1Y28L",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"role": "user",
|
||||
"time": {
|
||||
"created": 1770361015323
|
||||
},
|
||||
"summary": {
|
||||
"title": "List directory contents",
|
||||
"diffs": []
|
||||
},
|
||||
"agent": "build",
|
||||
"model": {
|
||||
"providerID": "anthropic",
|
||||
"modelID": "claude-haiku-4-5"
|
||||
}
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "prt_c31bd4c1b00250iBBBWSNWnE4G",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd4c1b001xWoyoqqLd1Y28L",
|
||||
"type": "text",
|
||||
"text": "List the files in the current directory. Use the list/ls tool. Only list the top-level contents, do not recurse."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": {
|
||||
"id": "msg_c31bd4c1c001iWeGOWfwf5UD2Y",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"role": "assistant",
|
||||
"time": {
|
||||
"created": 1770361015324,
|
||||
"completed": 1770361016339
|
||||
},
|
||||
"parentID": "msg_c31bd4c1b001xWoyoqqLd1Y28L",
|
||||
"modelID": "claude-haiku-4-5",
|
||||
"providerID": "anthropic",
|
||||
"mode": "build",
|
||||
"agent": "build",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent"
|
||||
},
|
||||
"cost": 0,
|
||||
"tokens": {
|
||||
"input": 2,
|
||||
"output": 78,
|
||||
"reasoning": 0,
|
||||
"cache": {
|
||||
"read": 13547,
|
||||
"write": 31
|
||||
}
|
||||
},
|
||||
"finish": "tool-calls"
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "prt_c31bd4ef7001AOk3Asd0o7j5fD",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd4c1c001iWeGOWfwf5UD2Y",
|
||||
"type": "step-start",
|
||||
"snapshot": "8793fb311ffba7bff79cd1b25f87942c22349ae3"
|
||||
},
|
||||
{
|
||||
"id": "prt_c31bd4ef8001ovzy76OXAT5Qin",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd4c1c001iWeGOWfwf5UD2Y",
|
||||
"type": "tool",
|
||||
"callID": "toolu_017THj1iZNELroZgmFbqC6Ma",
|
||||
"tool": "bash",
|
||||
"state": {
|
||||
"status": "completed",
|
||||
"input": {
|
||||
"command": "ls -la",
|
||||
"description": "List files in current directory"
|
||||
},
|
||||
"output": "total 24\ndrwxr-xr-x 3 nathan nathan 4096 Feb 5 22:56 .\ndrwxr-xr-x 5 nathan nathan 4096 Feb 5 22:44 ..\n-rw-r--r-- 1 nathan nathan 9120 Feb 5 22:56 capture-native.ts\ndrwxr-xr-x 3 nathan nathan 4096 Feb 5 22:45 snapshots\n",
|
||||
"title": "List files in current directory",
|
||||
"metadata": {
|
||||
"output": "total 24\ndrwxr-xr-x 3 nathan nathan 4096 Feb 5 22:56 .\ndrwxr-xr-x 5 nathan nathan 4096 Feb 5 22:44 ..\n-rw-r--r-- 1 nathan nathan 9120 Feb 5 22:56 capture-native.ts\ndrwxr-xr-x 3 nathan nathan 4096 Feb 5 22:45 snapshots\n",
|
||||
"exit": 0,
|
||||
"description": "List files in current directory",
|
||||
"truncated": false
|
||||
},
|
||||
"time": {
|
||||
"start": 1770361016309,
|
||||
"end": 1770361016330
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "prt_c31bd500e001MnhwCXaWI2pfAw",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd4c1c001iWeGOWfwf5UD2Y",
|
||||
"type": "step-finish",
|
||||
"reason": "tool-calls",
|
||||
"snapshot": "8793fb311ffba7bff79cd1b25f87942c22349ae3",
|
||||
"cost": 0,
|
||||
"tokens": {
|
||||
"input": 2,
|
||||
"output": 78,
|
||||
"reasoning": 0,
|
||||
"cache": {
|
||||
"read": 13547,
|
||||
"write": 31
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": {
|
||||
"id": "msg_c31bd5014001lZUdLPnaNuUzrb",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"role": "assistant",
|
||||
"time": {
|
||||
"created": 1770361016340,
|
||||
"completed": 1770361017458
|
||||
},
|
||||
"parentID": "msg_c31bd4c1b001xWoyoqqLd1Y28L",
|
||||
"modelID": "claude-haiku-4-5",
|
||||
"providerID": "anthropic",
|
||||
"mode": "build",
|
||||
"agent": "build",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent"
|
||||
},
|
||||
"cost": 0,
|
||||
"tokens": {
|
||||
"input": 5,
|
||||
"output": 38,
|
||||
"reasoning": 0,
|
||||
"cache": {
|
||||
"read": 13578,
|
||||
"write": 207
|
||||
}
|
||||
},
|
||||
"finish": "stop"
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "prt_c31bd53580017z4yaEbtkZX0zx",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd5014001lZUdLPnaNuUzrb",
|
||||
"type": "step-start",
|
||||
"snapshot": "8793fb311ffba7bff79cd1b25f87942c22349ae3"
|
||||
},
|
||||
{
|
||||
"id": "prt_c31bd53580021848cNw3geDcGF",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd5014001lZUdLPnaNuUzrb",
|
||||
"type": "text",
|
||||
"text": "Here are the top-level contents of the current directory:\n\n- **capture-native.ts** - A TypeScript file\n- **snapshots/** - A directory",
|
||||
"time": {
|
||||
"start": 1770361017436,
|
||||
"end": 1770361017436
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "prt_c31bd546d001cppsZFrg2ZJy7S",
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"messageID": "msg_c31bd5014001lZUdLPnaNuUzrb",
|
||||
"type": "step-finish",
|
||||
"reason": "stop",
|
||||
"snapshot": "8793fb311ffba7bff79cd1b25f87942c22349ae3",
|
||||
"cost": 0,
|
||||
"tokens": {
|
||||
"input": 5,
|
||||
"output": 38,
|
||||
"reasoning": 0,
|
||||
"cache": {
|
||||
"read": 13578,
|
||||
"write": 207
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
605
research/opencode-compat/snapshots/native/metadata-agent.json
Normal file
605
research/opencode-compat/snapshots/native/metadata-agent.json
Normal file
|
|
@ -0,0 +1,605 @@
|
|||
[
|
||||
{
|
||||
"name": "build",
|
||||
"description": "The default agent. Executes tools based on configured permissions.",
|
||||
"options": {},
|
||||
"permission": [
|
||||
{
|
||||
"permission": "*",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "doom_loop",
|
||||
"action": "ask",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "question",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_enter",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_exit",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.example",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "question",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_enter",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
}
|
||||
],
|
||||
"mode": "primary",
|
||||
"native": true
|
||||
},
|
||||
{
|
||||
"name": "plan",
|
||||
"description": "Plan mode. Disallows all edit tools.",
|
||||
"options": {},
|
||||
"permission": [
|
||||
{
|
||||
"permission": "*",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "doom_loop",
|
||||
"action": "ask",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "question",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_enter",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_exit",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.example",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "question",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_exit",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/plans/*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "edit",
|
||||
"pattern": "*",
|
||||
"action": "deny"
|
||||
},
|
||||
{
|
||||
"permission": "edit",
|
||||
"pattern": ".opencode/plans/*.md",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "edit",
|
||||
"pattern": "../.local/share/opencode/plans/*.md",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
}
|
||||
],
|
||||
"mode": "primary",
|
||||
"native": true
|
||||
},
|
||||
{
|
||||
"name": "general",
|
||||
"description": "General-purpose agent for researching complex questions and executing multi-step tasks. Use this agent to execute multiple units of work in parallel.",
|
||||
"permission": [
|
||||
{
|
||||
"permission": "*",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "doom_loop",
|
||||
"action": "ask",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "question",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_enter",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_exit",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.example",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "todoread",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "todowrite",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
}
|
||||
],
|
||||
"options": {},
|
||||
"mode": "subagent",
|
||||
"native": true
|
||||
},
|
||||
{
|
||||
"name": "explore",
|
||||
"permission": [
|
||||
{
|
||||
"permission": "*",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "doom_loop",
|
||||
"action": "ask",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "question",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_enter",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_exit",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.example",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "*",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "grep",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "glob",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "list",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "bash",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "webfetch",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "websearch",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "codesearch",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
}
|
||||
],
|
||||
"description": "Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. \"src/components/**/*.tsx\"), search code for keywords (eg. \"API endpoints\"), or answer questions about the codebase (eg. \"how do API endpoints work?\"). When calling this agent, specify the desired thoroughness level: \"quick\" for basic searches, \"medium\" for moderate exploration, or \"very thorough\" for comprehensive analysis across multiple locations and naming conventions.",
|
||||
"prompt": "You are a file search specialist. You excel at thoroughly navigating and exploring codebases.\n\nYour strengths:\n- Rapidly finding files using glob patterns\n- Searching code and text with powerful regex patterns\n- Reading and analyzing file contents\n\nGuidelines:\n- Use Glob for broad file pattern matching\n- Use Grep for searching file contents with regex\n- Use Read when you know the specific file path you need to read\n- Use Bash for file operations like copying, moving, or listing directory contents\n- Adapt your search approach based on the thoroughness level specified by the caller\n- Return file paths as absolute paths in your final response\n- For clear communication, avoid using emojis\n- Do not create any files, or run bash commands that modify the user's system state in any way\n\nComplete the user's search request efficiently and report your findings clearly.\n",
|
||||
"options": {},
|
||||
"mode": "subagent",
|
||||
"native": true
|
||||
},
|
||||
{
|
||||
"name": "compaction",
|
||||
"mode": "primary",
|
||||
"native": true,
|
||||
"hidden": true,
|
||||
"prompt": "You are a helpful AI assistant tasked with summarizing conversations.\n\nWhen asked to summarize, provide a detailed but concise summary of the conversation. \nFocus on information that would be helpful for continuing the conversation, including:\n- What was done\n- What is currently being worked on\n- Which files are being modified\n- What needs to be done next\n- Key user requests, constraints, or preferences that should persist\n- Important technical decisions and why they were made\n\nYour summary should be comprehensive enough to provide context but concise enough to be quickly understood.\n",
|
||||
"permission": [
|
||||
{
|
||||
"permission": "*",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "doom_loop",
|
||||
"action": "ask",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "question",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_enter",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_exit",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.example",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "*",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
}
|
||||
],
|
||||
"options": {}
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"mode": "primary",
|
||||
"options": {},
|
||||
"native": true,
|
||||
"hidden": true,
|
||||
"temperature": 0.5,
|
||||
"permission": [
|
||||
{
|
||||
"permission": "*",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "doom_loop",
|
||||
"action": "ask",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "question",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_enter",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_exit",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.example",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "*",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
}
|
||||
],
|
||||
"prompt": "You are a title generator. You output ONLY a thread title. Nothing else.\n\n<task>\nGenerate a brief title that would help the user find this conversation later.\n\nFollow all rules in <rules>\nUse the <examples> so you know what a good title looks like.\nYour output must be:\n- A single line\n- ≤50 characters\n- No explanations\n</task>\n\n<rules>\n- you MUST use the same language as the user message you are summarizing\n- Title must be grammatically correct and read naturally - no word salad\n- Never include tool names in the title (e.g. \"read tool\", \"bash tool\", \"edit tool\")\n- Focus on the main topic or question the user needs to retrieve\n- Vary your phrasing - avoid repetitive patterns like always starting with \"Analyzing\"\n- When a file is mentioned, focus on WHAT the user wants to do WITH the file, not just that they shared it\n- Keep exact: technical terms, numbers, filenames, HTTP codes\n- Remove: the, this, my, a, an\n- Never assume tech stack\n- Never use tools\n- NEVER respond to questions, just generate a title for the conversation\n- The title should NEVER include \"summarizing\" or \"generating\" when generating a title\n- DO NOT SAY YOU CANNOT GENERATE A TITLE OR COMPLAIN ABOUT THE INPUT\n- Always output something meaningful, even if the input is minimal.\n- If the user message is short or conversational (e.g. \"hello\", \"lol\", \"what's up\", \"hey\"):\n → create a title that reflects the user's tone or intent (such as Greeting, Quick check-in, Light chat, Intro message, etc.)\n</rules>\n\n<examples>\n\"debug 500 errors in production\" → Debugging production 500 errors\n\"refactor user service\" → Refactoring user service\n\"why is app.js failing\" → app.js failure investigation\n\"implement rate limiting\" → Rate limiting implementation\n\"how do I connect postgres to my API\" → Postgres API connection\n\"best practices for React hooks\" → React hooks best practices\n\"@src/auth.ts can you add refresh token support\" → Auth refresh token support\n\"@utils/parser.ts this is broken\" → Parser bug fix\n\"look at @config.json\" → Config review\n\"@App.tsx add dark mode toggle\" → Dark mode toggle in App\n</examples>\n"
|
||||
},
|
||||
{
|
||||
"name": "summary",
|
||||
"mode": "primary",
|
||||
"options": {},
|
||||
"native": true,
|
||||
"hidden": true,
|
||||
"permission": [
|
||||
{
|
||||
"permission": "*",
|
||||
"action": "allow",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "doom_loop",
|
||||
"action": "ask",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "question",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_enter",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "plan_exit",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.*",
|
||||
"action": "ask"
|
||||
},
|
||||
{
|
||||
"permission": "read",
|
||||
"pattern": "*.env.example",
|
||||
"action": "allow"
|
||||
},
|
||||
{
|
||||
"permission": "*",
|
||||
"action": "deny",
|
||||
"pattern": "*"
|
||||
},
|
||||
{
|
||||
"permission": "external_directory",
|
||||
"pattern": "/home/nathan/.local/share/opencode/tool-output/*",
|
||||
"action": "allow"
|
||||
}
|
||||
],
|
||||
"prompt": "Summarize what was done in this conversation. Write like a pull request description.\n\nRules:\n- 2-3 sentences max\n- Describe the changes made, not the process\n- Do not mention running tests, builds, or other validation steps\n- Do not explain what the user asked for\n- Write in first person (I added..., I fixed...)\n- Never ask questions or add new questions\n- If the conversation ends with an unanswered question to the user, preserve that exact question\n- If the conversation ends with an imperative statement or request to the user (e.g. \"Now please run the command and paste the console output\"), always include that exact request in the summary\n"
|
||||
}
|
||||
]
|
||||
102
research/opencode-compat/snapshots/native/metadata-config.json
Normal file
102
research/opencode-compat/snapshots/native/metadata-config.json
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
{
|
||||
"agent": {},
|
||||
"mode": {},
|
||||
"plugin": [],
|
||||
"command": {},
|
||||
"username": "nathan",
|
||||
"keybinds": {
|
||||
"leader": "ctrl+x",
|
||||
"app_exit": "ctrl+c,ctrl+d,<leader>q",
|
||||
"editor_open": "<leader>e",
|
||||
"theme_list": "<leader>t",
|
||||
"sidebar_toggle": "<leader>b",
|
||||
"scrollbar_toggle": "none",
|
||||
"username_toggle": "none",
|
||||
"status_view": "<leader>s",
|
||||
"session_export": "<leader>x",
|
||||
"session_new": "<leader>n",
|
||||
"session_list": "<leader>l",
|
||||
"session_timeline": "<leader>g",
|
||||
"session_fork": "none",
|
||||
"session_rename": "ctrl+r",
|
||||
"session_delete": "ctrl+d",
|
||||
"stash_delete": "ctrl+d",
|
||||
"model_provider_list": "ctrl+a",
|
||||
"model_favorite_toggle": "ctrl+f",
|
||||
"session_share": "none",
|
||||
"session_unshare": "none",
|
||||
"session_interrupt": "escape",
|
||||
"session_compact": "<leader>c",
|
||||
"messages_page_up": "pageup,ctrl+alt+b",
|
||||
"messages_page_down": "pagedown,ctrl+alt+f",
|
||||
"messages_line_up": "ctrl+alt+y",
|
||||
"messages_line_down": "ctrl+alt+e",
|
||||
"messages_half_page_up": "ctrl+alt+u",
|
||||
"messages_half_page_down": "ctrl+alt+d",
|
||||
"messages_first": "ctrl+g,home",
|
||||
"messages_last": "ctrl+alt+g,end",
|
||||
"messages_next": "none",
|
||||
"messages_previous": "none",
|
||||
"messages_last_user": "none",
|
||||
"messages_copy": "<leader>y",
|
||||
"messages_undo": "<leader>u",
|
||||
"messages_redo": "<leader>r",
|
||||
"messages_toggle_conceal": "<leader>h",
|
||||
"tool_details": "none",
|
||||
"model_list": "<leader>m",
|
||||
"model_cycle_recent": "f2",
|
||||
"model_cycle_recent_reverse": "shift+f2",
|
||||
"model_cycle_favorite": "none",
|
||||
"model_cycle_favorite_reverse": "none",
|
||||
"command_list": "ctrl+p",
|
||||
"agent_list": "<leader>a",
|
||||
"agent_cycle": "tab",
|
||||
"agent_cycle_reverse": "shift+tab",
|
||||
"variant_cycle": "ctrl+t",
|
||||
"input_clear": "ctrl+c",
|
||||
"input_paste": "ctrl+v",
|
||||
"input_submit": "return",
|
||||
"input_newline": "shift+return,ctrl+return,alt+return,ctrl+j",
|
||||
"input_move_left": "left,ctrl+b",
|
||||
"input_move_right": "right,ctrl+f",
|
||||
"input_move_up": "up",
|
||||
"input_move_down": "down",
|
||||
"input_select_left": "shift+left",
|
||||
"input_select_right": "shift+right",
|
||||
"input_select_up": "shift+up",
|
||||
"input_select_down": "shift+down",
|
||||
"input_line_home": "ctrl+a",
|
||||
"input_line_end": "ctrl+e",
|
||||
"input_select_line_home": "ctrl+shift+a",
|
||||
"input_select_line_end": "ctrl+shift+e",
|
||||
"input_visual_line_home": "alt+a",
|
||||
"input_visual_line_end": "alt+e",
|
||||
"input_select_visual_line_home": "alt+shift+a",
|
||||
"input_select_visual_line_end": "alt+shift+e",
|
||||
"input_buffer_home": "home",
|
||||
"input_buffer_end": "end",
|
||||
"input_select_buffer_home": "shift+home",
|
||||
"input_select_buffer_end": "shift+end",
|
||||
"input_delete_line": "ctrl+shift+d",
|
||||
"input_delete_to_line_end": "ctrl+k",
|
||||
"input_delete_to_line_start": "ctrl+u",
|
||||
"input_backspace": "backspace,shift+backspace",
|
||||
"input_delete": "ctrl+d,delete,shift+delete",
|
||||
"input_undo": "ctrl+-,super+z",
|
||||
"input_redo": "ctrl+.,super+shift+z",
|
||||
"input_word_forward": "alt+f,alt+right,ctrl+right",
|
||||
"input_word_backward": "alt+b,alt+left,ctrl+left",
|
||||
"input_select_word_forward": "alt+shift+f,alt+shift+right",
|
||||
"input_select_word_backward": "alt+shift+b,alt+shift+left",
|
||||
"input_delete_word_forward": "alt+d,alt+delete,ctrl+delete",
|
||||
"input_delete_word_backward": "ctrl+w,ctrl+backspace,alt+backspace",
|
||||
"history_previous": "up",
|
||||
"history_next": "down",
|
||||
"session_child_cycle": "<leader>right",
|
||||
"session_child_cycle_reverse": "<leader>left",
|
||||
"session_parent": "<leader>up",
|
||||
"terminal_suspend": "ctrl+z",
|
||||
"terminal_title_toggle": "none",
|
||||
"tips_toggle": "<leader>h"
|
||||
}
|
||||
}
|
||||
3716
research/opencode-compat/snapshots/native/metadata-providers.json
Normal file
3716
research/opencode-compat/snapshots/native/metadata-providers.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"id": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"slug": "witty-eagle",
|
||||
"version": "1.1.49",
|
||||
"projectID": "c4153c5335dc81f0e622888f1f387c4b84dc54d5",
|
||||
"directory": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"title": "New session - 2026-02-06T06:56:52.806Z",
|
||||
"time": {
|
||||
"created": 1770361012806,
|
||||
"updated": 1770361012806
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"id": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"slug": "witty-eagle",
|
||||
"version": "1.1.49",
|
||||
"projectID": "c4153c5335dc81f0e622888f1f387c4b84dc54d5",
|
||||
"directory": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"title": "Hello from OpenCode",
|
||||
"time": {
|
||||
"created": 1770361012806,
|
||||
"updated": 1770361017462
|
||||
},
|
||||
"summary": {
|
||||
"additions": 0,
|
||||
"deletions": 0,
|
||||
"files": 0
|
||||
}
|
||||
}
|
||||
156
research/opencode-compat/snapshots/native/session-events.json
Normal file
156
research/opencode-compat/snapshots/native/session-events.json
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
[
|
||||
{
|
||||
"type": "session.created",
|
||||
"properties": {
|
||||
"info": {
|
||||
"id": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"slug": "witty-eagle",
|
||||
"version": "1.1.49",
|
||||
"projectID": "c4153c5335dc81f0e622888f1f387c4b84dc54d5",
|
||||
"directory": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"title": "New session - 2026-02-06T06:56:52.806Z",
|
||||
"time": {
|
||||
"created": 1770361012806,
|
||||
"updated": 1770361012806
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.status",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"status": {
|
||||
"type": "busy"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.status",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"status": {
|
||||
"type": "busy"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.diff",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"diff": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.status",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"status": {
|
||||
"type": "busy"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.status",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"status": {
|
||||
"type": "idle"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.idle",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.diff",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"diff": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.status",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"status": {
|
||||
"type": "busy"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.status",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"status": {
|
||||
"type": "busy"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.diff",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"diff": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.status",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"status": {
|
||||
"type": "busy"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.status",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"status": {
|
||||
"type": "busy"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.diff",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"diff": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.status",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"status": {
|
||||
"type": "busy"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.status",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"status": {
|
||||
"type": "idle"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.idle",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "session.diff",
|
||||
"properties": {
|
||||
"sessionID": "ses_3ce42bdb9ffeEIUUu08AuKTJms",
|
||||
"diff": []
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1 @@
|
|||
{}
|
||||
682
research/opencode-compat/snapshots/sandbox-agent/all-events.json
Normal file
682
research/opencode-compat/snapshots/sandbox-agent/all-events.json
Normal file
|
|
@ -0,0 +1,682 @@
|
|||
[
|
||||
{
|
||||
"properties": {},
|
||||
"type": "server.connected"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"branch": "main",
|
||||
"name": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"type": "worktree.ready"
|
||||
},
|
||||
{
|
||||
"properties": {},
|
||||
"type": "server.heartbeat"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"directory": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"id": "ses_1",
|
||||
"projectID": "proj_1",
|
||||
"slug": "session-ses_1",
|
||||
"time": {
|
||||
"created": 1770362164904,
|
||||
"updated": 1770362164904
|
||||
},
|
||||
"title": "Session ses_1",
|
||||
"version": "0"
|
||||
}
|
||||
},
|
||||
"type": "session.created"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"sessionID": "ses_1",
|
||||
"status": {
|
||||
"type": "busy"
|
||||
}
|
||||
},
|
||||
"type": "session.status"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"id": "msg_1",
|
||||
"model": {
|
||||
"modelID": "mock",
|
||||
"providerID": "sandbox-agent"
|
||||
},
|
||||
"role": "user",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362164907,
|
||||
"created": 1770362164907
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_1",
|
||||
"part": {
|
||||
"id": "part_1",
|
||||
"messageID": "msg_1",
|
||||
"sessionID": "ses_1",
|
||||
"text": "echo Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_1_assistant",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_1",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362165109
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"delta": "echo Hello from sandbox-agent",
|
||||
"messageID": "msg_1_assistant",
|
||||
"part": {
|
||||
"id": "msg_1_assistant_text",
|
||||
"messageID": "msg_1_assistant",
|
||||
"sessionID": "ses_1",
|
||||
"text": "echo Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_1_assistant_00000000000000000005",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_1",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362165309
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_1_assistant_00000000000000000005",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_1",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362165511
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"delta": "Hello from sandbox-agent",
|
||||
"messageID": "msg_1_assistant_00000000000000000005",
|
||||
"part": {
|
||||
"id": "msg_1_assistant_00000000000000000005_text",
|
||||
"messageID": "msg_1_assistant_00000000000000000005",
|
||||
"sessionID": "ses_1",
|
||||
"text": "Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_1_assistant_00000000000000000005",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_1",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362165511,
|
||||
"created": 1770362165511
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_1_assistant_00000000000000000005",
|
||||
"part": {
|
||||
"id": "msg_1_assistant_00000000000000000005_text",
|
||||
"messageID": "msg_1_assistant_00000000000000000005",
|
||||
"sessionID": "ses_1",
|
||||
"text": "Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"sessionID": "ses_1",
|
||||
"status": {
|
||||
"type": "idle"
|
||||
}
|
||||
},
|
||||
"type": "session.status"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "session.idle"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"sessionID": "ses_1",
|
||||
"status": {
|
||||
"type": "busy"
|
||||
}
|
||||
},
|
||||
"type": "session.status"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"id": "msg_2",
|
||||
"model": {
|
||||
"modelID": "mock",
|
||||
"providerID": "sandbox-agent"
|
||||
},
|
||||
"role": "user",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362166412,
|
||||
"created": 1770362166412
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2",
|
||||
"part": {
|
||||
"id": "part_2",
|
||||
"messageID": "msg_2",
|
||||
"sessionID": "ses_1",
|
||||
"text": "tool",
|
||||
"type": "text"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_2_assistant",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_2",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362166614
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"delta": "tool",
|
||||
"messageID": "msg_2_assistant",
|
||||
"part": {
|
||||
"id": "msg_2_assistant_text",
|
||||
"messageID": "msg_2_assistant",
|
||||
"sessionID": "ses_1",
|
||||
"text": "tool",
|
||||
"type": "text"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_2_assistant_00000000000000000011",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_2",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362166815
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"callID": "mock_2_call",
|
||||
"id": "part_3",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"metadata": {},
|
||||
"sessionID": "ses_1",
|
||||
"state": {
|
||||
"input": {
|
||||
"query": "example"
|
||||
},
|
||||
"raw": "{\"query\":\"example\"}",
|
||||
"status": "pending"
|
||||
},
|
||||
"tool": "mock.search",
|
||||
"type": "tool"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_2_assistant_00000000000000000011",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_2",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362167016,
|
||||
"created": 1770362167016
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"callID": "mock_2_call",
|
||||
"id": "part_3",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"metadata": {},
|
||||
"sessionID": "ses_1",
|
||||
"state": {
|
||||
"input": {
|
||||
"query": "example"
|
||||
},
|
||||
"status": "running",
|
||||
"time": {
|
||||
"start": 1770362167016
|
||||
}
|
||||
},
|
||||
"tool": "mock.search",
|
||||
"type": "tool"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_2_assistant_00000000000000000011",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_2",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362167218
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"callID": "mock_2_call",
|
||||
"id": "part_3",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"metadata": {},
|
||||
"sessionID": "ses_1",
|
||||
"state": {
|
||||
"input": {
|
||||
"query": "example"
|
||||
},
|
||||
"status": "running",
|
||||
"time": {
|
||||
"start": 1770362167218
|
||||
}
|
||||
},
|
||||
"tool": "mock.search",
|
||||
"type": "tool"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_2_assistant_00000000000000000011",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_2",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362167418,
|
||||
"created": 1770362167418
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"filename": "mock_2/readme.md",
|
||||
"id": "part_4",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"mime": "text/plain",
|
||||
"sessionID": "ses_1",
|
||||
"type": "file",
|
||||
"url": "file://mock_2/readme.md"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"filename": "mock_2/output.txt",
|
||||
"id": "part_5",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"mime": "text/plain",
|
||||
"sessionID": "ses_1",
|
||||
"source": {
|
||||
"path": "mock_2/output.txt",
|
||||
"text": {
|
||||
"end": 13,
|
||||
"start": 0,
|
||||
"value": "+mock output\n"
|
||||
},
|
||||
"type": "file"
|
||||
},
|
||||
"type": "file",
|
||||
"url": "file://mock_2/output.txt"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"file": "mock_2/output.txt"
|
||||
},
|
||||
"type": "file.edited"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"filename": "mock_2/patch.txt",
|
||||
"id": "part_6",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"mime": "text/x-diff",
|
||||
"sessionID": "ses_1",
|
||||
"source": {
|
||||
"path": "mock_2/patch.txt",
|
||||
"text": {
|
||||
"end": 26,
|
||||
"start": 0,
|
||||
"value": "@@ -1,1 +1,1 @@\n-old\n+new\n"
|
||||
},
|
||||
"type": "file"
|
||||
},
|
||||
"type": "file",
|
||||
"url": "file://mock_2/patch.txt"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"file": "mock_2/patch.txt"
|
||||
},
|
||||
"type": "file.edited"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"callID": "mock_2_call",
|
||||
"id": "part_3",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"metadata": {},
|
||||
"sessionID": "ses_1",
|
||||
"state": {
|
||||
"input": {
|
||||
"query": "example"
|
||||
},
|
||||
"metadata": {},
|
||||
"output": "mock search results",
|
||||
"status": "error",
|
||||
"time": {
|
||||
"end": 1770362167418,
|
||||
"start": 1770362167418
|
||||
}
|
||||
},
|
||||
"tool": "mock.search",
|
||||
"type": "tool"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
[
|
||||
{
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"id": "msg_1",
|
||||
"model": {
|
||||
"modelID": "mock",
|
||||
"providerID": "sandbox-agent"
|
||||
},
|
||||
"role": "user",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362164907,
|
||||
"created": 1770362164907
|
||||
}
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "part_1",
|
||||
"messageID": "msg_1",
|
||||
"sessionID": "ses_1",
|
||||
"text": "echo Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_1_assistant",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_1",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362165109
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "msg_1_assistant_text",
|
||||
"messageID": "msg_1_assistant",
|
||||
"sessionID": "ses_1",
|
||||
"text": "echo Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_1_assistant_00000000000000000005",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_1",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362165511,
|
||||
"created": 1770362165511
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "msg_1_assistant_00000000000000000005_text",
|
||||
"messageID": "msg_1_assistant_00000000000000000005",
|
||||
"sessionID": "ses_1",
|
||||
"text": "Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,269 @@
|
|||
[
|
||||
{
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"id": "msg_1",
|
||||
"model": {
|
||||
"modelID": "mock",
|
||||
"providerID": "sandbox-agent"
|
||||
},
|
||||
"role": "user",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362164907,
|
||||
"created": 1770362164907
|
||||
}
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "part_1",
|
||||
"messageID": "msg_1",
|
||||
"sessionID": "ses_1",
|
||||
"text": "echo Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_1_assistant",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_1",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362165109
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "msg_1_assistant_text",
|
||||
"messageID": "msg_1_assistant",
|
||||
"sessionID": "ses_1",
|
||||
"text": "echo Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_1_assistant_00000000000000000005",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_1",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362165511,
|
||||
"created": 1770362165511
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "msg_1_assistant_00000000000000000005_text",
|
||||
"messageID": "msg_1_assistant_00000000000000000005",
|
||||
"sessionID": "ses_1",
|
||||
"text": "Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"id": "msg_2",
|
||||
"model": {
|
||||
"modelID": "mock",
|
||||
"providerID": "sandbox-agent"
|
||||
},
|
||||
"role": "user",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362166412,
|
||||
"created": 1770362166412
|
||||
}
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "part_2",
|
||||
"messageID": "msg_2",
|
||||
"sessionID": "ses_1",
|
||||
"text": "tool",
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_2_assistant",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_2",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362166614
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"id": "msg_2_assistant_text",
|
||||
"messageID": "msg_2_assistant",
|
||||
"sessionID": "ses_1",
|
||||
"text": "tool",
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_2_assistant_00000000000000000011",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_2",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362167418,
|
||||
"created": 1770362167418
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"parts": [
|
||||
{
|
||||
"callID": "mock_2_call",
|
||||
"id": "part_3",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"metadata": {},
|
||||
"sessionID": "ses_1",
|
||||
"state": {
|
||||
"input": {
|
||||
"query": "example"
|
||||
},
|
||||
"metadata": {},
|
||||
"output": "mock search results",
|
||||
"status": "error",
|
||||
"time": {
|
||||
"end": 1770362167418,
|
||||
"start": 1770362167418
|
||||
}
|
||||
},
|
||||
"tool": "mock.search",
|
||||
"type": "tool"
|
||||
},
|
||||
{
|
||||
"filename": "mock_2/readme.md",
|
||||
"id": "part_4",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"mime": "text/plain",
|
||||
"sessionID": "ses_1",
|
||||
"type": "file",
|
||||
"url": "file://mock_2/readme.md"
|
||||
},
|
||||
{
|
||||
"filename": "mock_2/output.txt",
|
||||
"id": "part_5",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"mime": "text/plain",
|
||||
"sessionID": "ses_1",
|
||||
"source": {
|
||||
"path": "mock_2/output.txt",
|
||||
"text": {
|
||||
"end": 13,
|
||||
"start": 0,
|
||||
"value": "+mock output\n"
|
||||
},
|
||||
"type": "file"
|
||||
},
|
||||
"type": "file",
|
||||
"url": "file://mock_2/output.txt"
|
||||
},
|
||||
{
|
||||
"filename": "mock_2/patch.txt",
|
||||
"id": "part_6",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"mime": "text/x-diff",
|
||||
"sessionID": "ses_1",
|
||||
"source": {
|
||||
"path": "mock_2/patch.txt",
|
||||
"text": {
|
||||
"end": 26,
|
||||
"start": 0,
|
||||
"value": "@@ -1,1 +1,1 @@\n-old\n+new\n"
|
||||
},
|
||||
"type": "file"
|
||||
},
|
||||
"type": "file",
|
||||
"url": "file://mock_2/patch.txt"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[
|
||||
{
|
||||
"description": "Sandbox Agent compatibility layer",
|
||||
"hidden": false,
|
||||
"mode": "all",
|
||||
"name": "Sandbox Agent",
|
||||
"native": false,
|
||||
"options": {},
|
||||
"permission": []
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1 @@
|
|||
{}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"directory": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"id": "ses_1",
|
||||
"projectID": "proj_1",
|
||||
"slug": "session-ses_1",
|
||||
"time": {
|
||||
"created": 1770362164904,
|
||||
"updated": 1770362164904
|
||||
},
|
||||
"title": "Session ses_1",
|
||||
"version": "0"
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"directory": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"id": "ses_1",
|
||||
"projectID": "proj_1",
|
||||
"slug": "session-ses_1",
|
||||
"time": {
|
||||
"created": 1770362164904,
|
||||
"updated": 1770362164904
|
||||
},
|
||||
"title": "Session ses_1",
|
||||
"version": "0"
|
||||
}
|
||||
|
|
@ -0,0 +1,655 @@
|
|||
[
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"directory": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"id": "ses_1",
|
||||
"projectID": "proj_1",
|
||||
"slug": "session-ses_1",
|
||||
"time": {
|
||||
"created": 1770362164904,
|
||||
"updated": 1770362164904
|
||||
},
|
||||
"title": "Session ses_1",
|
||||
"version": "0"
|
||||
}
|
||||
},
|
||||
"type": "session.created"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"sessionID": "ses_1",
|
||||
"status": {
|
||||
"type": "busy"
|
||||
}
|
||||
},
|
||||
"type": "session.status"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"id": "msg_1",
|
||||
"model": {
|
||||
"modelID": "mock",
|
||||
"providerID": "sandbox-agent"
|
||||
},
|
||||
"role": "user",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362164907,
|
||||
"created": 1770362164907
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_1",
|
||||
"part": {
|
||||
"id": "part_1",
|
||||
"messageID": "msg_1",
|
||||
"sessionID": "ses_1",
|
||||
"text": "echo Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_1_assistant",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_1",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362165109
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"delta": "echo Hello from sandbox-agent",
|
||||
"messageID": "msg_1_assistant",
|
||||
"part": {
|
||||
"id": "msg_1_assistant_text",
|
||||
"messageID": "msg_1_assistant",
|
||||
"sessionID": "ses_1",
|
||||
"text": "echo Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_1_assistant_00000000000000000005",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_1",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362165309
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_1_assistant_00000000000000000005",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_1",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362165511
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"delta": "Hello from sandbox-agent",
|
||||
"messageID": "msg_1_assistant_00000000000000000005",
|
||||
"part": {
|
||||
"id": "msg_1_assistant_00000000000000000005_text",
|
||||
"messageID": "msg_1_assistant_00000000000000000005",
|
||||
"sessionID": "ses_1",
|
||||
"text": "Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_1_assistant_00000000000000000005",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_1",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362165511,
|
||||
"created": 1770362165511
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_1_assistant_00000000000000000005",
|
||||
"part": {
|
||||
"id": "msg_1_assistant_00000000000000000005_text",
|
||||
"messageID": "msg_1_assistant_00000000000000000005",
|
||||
"sessionID": "ses_1",
|
||||
"text": "Hello from sandbox-agent",
|
||||
"type": "text"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"sessionID": "ses_1",
|
||||
"status": {
|
||||
"type": "idle"
|
||||
}
|
||||
},
|
||||
"type": "session.status"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "session.idle"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"sessionID": "ses_1",
|
||||
"status": {
|
||||
"type": "busy"
|
||||
}
|
||||
},
|
||||
"type": "session.status"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"id": "msg_2",
|
||||
"model": {
|
||||
"modelID": "mock",
|
||||
"providerID": "sandbox-agent"
|
||||
},
|
||||
"role": "user",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362166412,
|
||||
"created": 1770362166412
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2",
|
||||
"part": {
|
||||
"id": "part_2",
|
||||
"messageID": "msg_2",
|
||||
"sessionID": "ses_1",
|
||||
"text": "tool",
|
||||
"type": "text"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_2_assistant",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_2",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362166614
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"delta": "tool",
|
||||
"messageID": "msg_2_assistant",
|
||||
"part": {
|
||||
"id": "msg_2_assistant_text",
|
||||
"messageID": "msg_2_assistant",
|
||||
"sessionID": "ses_1",
|
||||
"text": "tool",
|
||||
"type": "text"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_2_assistant_00000000000000000011",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_2",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362166815
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"callID": "mock_2_call",
|
||||
"id": "part_3",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"metadata": {},
|
||||
"sessionID": "ses_1",
|
||||
"state": {
|
||||
"input": {
|
||||
"query": "example"
|
||||
},
|
||||
"raw": "{\"query\":\"example\"}",
|
||||
"status": "pending"
|
||||
},
|
||||
"tool": "mock.search",
|
||||
"type": "tool"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_2_assistant_00000000000000000011",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_2",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362167016,
|
||||
"created": 1770362167016
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"callID": "mock_2_call",
|
||||
"id": "part_3",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"metadata": {},
|
||||
"sessionID": "ses_1",
|
||||
"state": {
|
||||
"input": {
|
||||
"query": "example"
|
||||
},
|
||||
"status": "running",
|
||||
"time": {
|
||||
"start": 1770362167016
|
||||
}
|
||||
},
|
||||
"tool": "mock.search",
|
||||
"type": "tool"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_2_assistant_00000000000000000011",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_2",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"created": 1770362167218
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"callID": "mock_2_call",
|
||||
"id": "part_3",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"metadata": {},
|
||||
"sessionID": "ses_1",
|
||||
"state": {
|
||||
"input": {
|
||||
"query": "example"
|
||||
},
|
||||
"status": "running",
|
||||
"time": {
|
||||
"start": 1770362167218
|
||||
}
|
||||
},
|
||||
"tool": "mock.search",
|
||||
"type": "tool"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"info": {
|
||||
"agent": "build",
|
||||
"cost": 0,
|
||||
"finish": "stop",
|
||||
"id": "msg_2_assistant_00000000000000000011",
|
||||
"mode": "default",
|
||||
"modelID": "mock",
|
||||
"parentID": "msg_2",
|
||||
"path": {
|
||||
"cwd": "/home/nathan/sandbox-agent/research/opencode-compat",
|
||||
"root": "/home/nathan/sandbox-agent/research/opencode-compat"
|
||||
},
|
||||
"providerID": "sandbox-agent",
|
||||
"role": "assistant",
|
||||
"sessionID": "ses_1",
|
||||
"time": {
|
||||
"completed": 1770362167418,
|
||||
"created": 1770362167418
|
||||
},
|
||||
"tokens": {
|
||||
"cache": {
|
||||
"read": 0,
|
||||
"write": 0
|
||||
},
|
||||
"input": 0,
|
||||
"output": 0,
|
||||
"reasoning": 0
|
||||
}
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"filename": "mock_2/readme.md",
|
||||
"id": "part_4",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"mime": "text/plain",
|
||||
"sessionID": "ses_1",
|
||||
"type": "file",
|
||||
"url": "file://mock_2/readme.md"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"filename": "mock_2/output.txt",
|
||||
"id": "part_5",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"mime": "text/plain",
|
||||
"sessionID": "ses_1",
|
||||
"source": {
|
||||
"path": "mock_2/output.txt",
|
||||
"text": {
|
||||
"end": 13,
|
||||
"start": 0,
|
||||
"value": "+mock output\n"
|
||||
},
|
||||
"type": "file"
|
||||
},
|
||||
"type": "file",
|
||||
"url": "file://mock_2/output.txt"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"filename": "mock_2/patch.txt",
|
||||
"id": "part_6",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"mime": "text/x-diff",
|
||||
"sessionID": "ses_1",
|
||||
"source": {
|
||||
"path": "mock_2/patch.txt",
|
||||
"text": {
|
||||
"end": 26,
|
||||
"start": 0,
|
||||
"value": "@@ -1,1 +1,1 @@\n-old\n+new\n"
|
||||
},
|
||||
"type": "file"
|
||||
},
|
||||
"type": "file",
|
||||
"url": "file://mock_2/patch.txt"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"part": {
|
||||
"callID": "mock_2_call",
|
||||
"id": "part_3",
|
||||
"messageID": "msg_2_assistant_00000000000000000011",
|
||||
"metadata": {},
|
||||
"sessionID": "ses_1",
|
||||
"state": {
|
||||
"input": {
|
||||
"query": "example"
|
||||
},
|
||||
"metadata": {},
|
||||
"output": "mock search results",
|
||||
"status": "error",
|
||||
"time": {
|
||||
"end": 1770362167418,
|
||||
"start": 1770362167418
|
||||
}
|
||||
},
|
||||
"tool": "mock.search",
|
||||
"type": "tool"
|
||||
},
|
||||
"sessionID": "ses_1"
|
||||
},
|
||||
"type": "message.part.updated"
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"ses_1": {
|
||||
"type": "idle"
|
||||
}
|
||||
}
|
||||
|
|
@ -419,8 +419,6 @@ pub struct CredentialsExtractEnvArgs {
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CliError {
|
||||
#[error("missing --token or --no-token for server mode")]
|
||||
MissingToken,
|
||||
#[error("invalid cors origin: {0}")]
|
||||
InvalidCorsOrigin(String),
|
||||
#[error("invalid cors method: {0}")]
|
||||
|
|
@ -489,12 +487,10 @@ pub fn run_command(command: &Command, cli: &CliConfig) -> Result<(), CliError> {
|
|||
}
|
||||
|
||||
fn run_server(cli: &CliConfig, server: &ServerArgs) -> Result<(), CliError> {
|
||||
let auth = if cli.no_token {
|
||||
AuthConfig::disabled()
|
||||
} else if let Some(token) = cli.token.clone() {
|
||||
let auth = if let Some(token) = cli.token.clone() {
|
||||
AuthConfig::with_token(token)
|
||||
} else {
|
||||
return Err(CliError::MissingToken);
|
||||
AuthConfig::disabled()
|
||||
};
|
||||
|
||||
let agent_manager = AgentManager::new(default_install_dir())
|
||||
|
|
|
|||
|
|
@ -222,12 +222,8 @@ pub fn spawn_sandbox_agent_daemon(
|
|||
.stdout(Stdio::from(log_file))
|
||||
.stderr(Stdio::from(log_file_err));
|
||||
|
||||
if cli.no_token {
|
||||
cmd.arg("--no-token");
|
||||
} else if let Some(token) = token {
|
||||
if let Some(token) = token {
|
||||
cmd.arg("--token").arg(token);
|
||||
} else {
|
||||
return Err(CliError::MissingToken);
|
||||
}
|
||||
|
||||
cmd.spawn().map_err(CliError::from)
|
||||
|
|
|
|||
|
|
@ -212,6 +212,10 @@ struct OpenCodeSessionRuntime {
|
|||
part_id_by_message: HashMap<String, String>,
|
||||
tool_part_by_call: HashMap<String, String>,
|
||||
tool_message_by_call: HashMap<String, String>,
|
||||
/// Tool name by call_id, persisted from ToolCall for use in ToolResult events
|
||||
tool_name_by_call: HashMap<String, String>,
|
||||
/// Tool arguments by call_id, persisted from ToolCall for use in ToolResult events
|
||||
tool_args_by_call: HashMap<String, String>,
|
||||
}
|
||||
|
||||
pub struct OpenCodeState {
|
||||
|
|
@ -1586,25 +1590,48 @@ async fn apply_item_event(
|
|||
.entry(message_id.clone())
|
||||
.or_insert_with(|| format!("{}_text", message_id))
|
||||
.clone();
|
||||
runtime
|
||||
.text_by_message
|
||||
.insert(message_id.clone(), text.clone());
|
||||
let part = build_text_part_with_id(&session_id, &message_id, &part_id, &text);
|
||||
upsert_message_part(&state.opencode, &session_id, &message_id, part.clone()).await;
|
||||
state
|
||||
.opencode
|
||||
.emit_event(part_event("message.part.updated", &part));
|
||||
let _ = state
|
||||
.opencode
|
||||
.update_runtime(&session_id, |runtime| {
|
||||
runtime
|
||||
.text_by_message
|
||||
.insert(message_id.clone(), text.clone());
|
||||
runtime
|
||||
.part_id_by_message
|
||||
.insert(message_id.clone(), part_id.clone());
|
||||
})
|
||||
.await;
|
||||
if event.event_type == UniversalEventType::ItemStarted {
|
||||
// For ItemStarted, only store the text in runtime as the initial value
|
||||
// without emitting a part event. Deltas will handle streaming, and
|
||||
// ItemCompleted will emit the final text part.
|
||||
let _ = state
|
||||
.opencode
|
||||
.update_runtime(&session_id, |runtime| {
|
||||
runtime
|
||||
.text_by_message
|
||||
.insert(message_id.clone(), String::new());
|
||||
runtime
|
||||
.part_id_by_message
|
||||
.insert(message_id.clone(), part_id.clone());
|
||||
})
|
||||
.await;
|
||||
} else {
|
||||
// For ItemCompleted, emit the final text part with the complete text.
|
||||
// Use the accumulated text from deltas if available, otherwise use
|
||||
// the text from the completed event.
|
||||
let final_text = runtime
|
||||
.text_by_message
|
||||
.get(&message_id)
|
||||
.filter(|t| !t.is_empty())
|
||||
.cloned()
|
||||
.unwrap_or_else(|| text.clone());
|
||||
let part = build_text_part_with_id(&session_id, &message_id, &part_id, &final_text);
|
||||
upsert_message_part(&state.opencode, &session_id, &message_id, part.clone()).await;
|
||||
state
|
||||
.opencode
|
||||
.emit_event(part_event("message.part.updated", &part));
|
||||
let _ = state
|
||||
.opencode
|
||||
.update_runtime(&session_id, |runtime| {
|
||||
runtime
|
||||
.text_by_message
|
||||
.insert(message_id.clone(), final_text.clone());
|
||||
runtime
|
||||
.part_id_by_message
|
||||
.insert(message_id.clone(), part_id.clone());
|
||||
})
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
for part in item.content.iter() {
|
||||
|
|
@ -1634,9 +1661,10 @@ async fn apply_item_event(
|
|||
.entry(call_id.clone())
|
||||
.or_insert_with(|| next_id("part_", &PART_COUNTER))
|
||||
.clone();
|
||||
let input_value = tool_input_from_arguments(Some(arguments.as_str()));
|
||||
let state_value = json!({
|
||||
"status": "pending",
|
||||
"input": {"arguments": arguments},
|
||||
"input": input_value,
|
||||
"raw": arguments,
|
||||
});
|
||||
let tool_part = build_tool_part(
|
||||
|
|
@ -1661,6 +1689,12 @@ async fn apply_item_event(
|
|||
runtime
|
||||
.tool_message_by_call
|
||||
.insert(call_id.clone(), message_id.clone());
|
||||
runtime
|
||||
.tool_name_by_call
|
||||
.insert(call_id.clone(), name.clone());
|
||||
runtime
|
||||
.tool_args_by_call
|
||||
.insert(call_id.clone(), arguments.clone());
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
|
@ -1670,9 +1704,22 @@ async fn apply_item_event(
|
|||
.entry(call_id.clone())
|
||||
.or_insert_with(|| next_id("part_", &PART_COUNTER))
|
||||
.clone();
|
||||
// Resolve tool name from stored ToolCall data
|
||||
let tool_name = runtime
|
||||
.tool_name_by_call
|
||||
.get(call_id)
|
||||
.cloned()
|
||||
.unwrap_or_else(|| "tool".to_string());
|
||||
// Resolve input from stored ToolCall arguments
|
||||
let input_value = runtime
|
||||
.tool_args_by_call
|
||||
.get(call_id)
|
||||
.and_then(|args| tool_input_from_arguments(Some(args.as_str())).as_object().cloned())
|
||||
.map(Value::Object)
|
||||
.unwrap_or_else(|| json!({}));
|
||||
let state_value = json!({
|
||||
"status": "completed",
|
||||
"input": {},
|
||||
"input": input_value,
|
||||
"output": output,
|
||||
"title": "Tool result",
|
||||
"metadata": {},
|
||||
|
|
@ -1684,7 +1731,7 @@ async fn apply_item_event(
|
|||
&message_id,
|
||||
&part_id,
|
||||
call_id,
|
||||
"tool",
|
||||
&tool_name,
|
||||
state_value,
|
||||
);
|
||||
upsert_message_part(&state.opencode, &session_id, &message_id, tool_part.clone())
|
||||
|
|
@ -1877,12 +1924,19 @@ async fn apply_tool_item_event(
|
|||
.get(&call_id)
|
||||
.cloned()
|
||||
.unwrap_or_else(|| next_id("part_", &PART_COUNTER));
|
||||
// Resolve tool name: prefer current event's data, fall back to stored value from ToolCall
|
||||
let tool_name = tool_info
|
||||
.tool_name
|
||||
.clone()
|
||||
.or_else(|| runtime.tool_name_by_call.get(&call_id).cloned())
|
||||
.unwrap_or_else(|| "tool".to_string());
|
||||
let input_value = tool_input_from_arguments(tool_info.arguments.as_deref());
|
||||
let raw_args = tool_info.arguments.clone().unwrap_or_default();
|
||||
// Resolve arguments: prefer current event's data, fall back to stored value from ToolCall
|
||||
let effective_arguments = tool_info
|
||||
.arguments
|
||||
.clone()
|
||||
.or_else(|| runtime.tool_args_by_call.get(&call_id).cloned());
|
||||
let input_value = tool_input_from_arguments(effective_arguments.as_deref());
|
||||
let raw_args = effective_arguments.clone().unwrap_or_default();
|
||||
let output_value = tool_info
|
||||
.output
|
||||
.clone()
|
||||
|
|
@ -1910,7 +1964,7 @@ async fn apply_tool_item_event(
|
|||
json!({
|
||||
"status": "error",
|
||||
"input": input_value,
|
||||
"error": output_value.unwrap_or_else(|| "Tool failed".to_string()),
|
||||
"output": output_value.unwrap_or_else(|| "Tool failed".to_string()),
|
||||
"metadata": {},
|
||||
"time": {"start": now, "end": now},
|
||||
})
|
||||
|
|
@ -1962,6 +2016,17 @@ async fn apply_tool_item_event(
|
|||
runtime
|
||||
.tool_message_by_call
|
||||
.insert(call_id.clone(), message_id.clone());
|
||||
// Persist tool name and arguments from ToolCall for later ToolResult events
|
||||
if let Some(name) = tool_info.tool_name.as_ref() {
|
||||
runtime
|
||||
.tool_name_by_call
|
||||
.insert(call_id.clone(), name.clone());
|
||||
}
|
||||
if let Some(args) = tool_info.arguments.as_ref() {
|
||||
runtime
|
||||
.tool_args_by_call
|
||||
.insert(call_id.clone(), args.clone());
|
||||
}
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
|
@ -2071,7 +2136,7 @@ async fn apply_item_delta(
|
|||
upsert_message_part(&state.opencode, &session_id, &message_id, part.clone()).await;
|
||||
state
|
||||
.opencode
|
||||
.emit_event(part_event("message.part.updated", &part));
|
||||
.emit_event(part_event_with_delta("message.part.updated", &part, Some(&delta)));
|
||||
let _ = state
|
||||
.opencode
|
||||
.update_runtime(&session_id, |runtime| {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue