Skip to content
Back to skills

Opencode2 Probe

ASecurity

Observe and drive the running opencode2 (v2) daemon's SSE event stream from inside an agents-sandbox VM - reach the authed daemon, create a session with an `effect: ask` permission rule, capture `/api/event`, and reply to permission requests. Use when you need to see real opencode2 events, reproduce an input/awaiting-input trigger, or verify a notify change against the live daemon.

  • 93 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 9, 2026
ai-agentsshellbashapi

Works with

  • api

Security analysis

A100/100

Scanned November 9, 2026

npx -y skills add inoio/agents-sandbox --skill opencode2-probe --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Opencode2 Probe?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Opencode2 Probe
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/inoio-opencode2-probe/badge)](https://www.skillsdirectory.com/skills/inoio-opencode2-probe)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: opencode2-probe
description: Observe and drive the running opencode2 (v2) daemon's SSE event stream from inside an agents-sandbox VM - reach the authed daemon, create a session with an `effect: ask` permission rule, capture `/api/event`, and reply to permission requests. Use when you need to see real opencode2 events, reproduce an input/awaiting-input trigger, or verify a notify change against the live daemon.
---

# Probing the running opencode2 daemon's event stream

How to observe the real `opencode2` (v2) SSE events from inside an agents-sandbox VM, without a
second machine or a KVM host. The agent's own VM runs the daemon, so it can probe itself.

## Reach the daemon

- Address and auth: `http://127.0.0.1:4096`, HTTP basic auth `opencode:<OPENCODE_SERVER_PASSWORD>`
  (both are in the VM's env; v2 hardcodes the username to `opencode`).
- `GET /api/info` is the health/version endpoint; `GET /openapi.json` is the full HTTP API schema.
- The event stream is `GET /api/event` (SSE). v1's `/global/event` exists on v2 but serves the web UI
  HTML, not SSE — do not use it to probe v2.
- Capture: `curl -N -s -u "opencode:$OPENCODE_SERVER_PASSWORD" http://127.0.0.1:4096/api/event`.

Envelope: `{"id":"evt_…","created":…,"type":"…","data":{…},"durable":{"aggregateID":…,"seq":…}}`.
`id` is unique per emission; `type` is top-level; the session id is `.data.sessionID` (for
`form.created` it is nested at `.data.form.sessionID`).

## Drive a turn that asks for permission

The default config allows tools, so `permission.asked` never fires. Force it with a per-session
permission rule whose `effect` is `ask` and whose `action` is the *tool name* (opencode2's shell tool
is `shell`, not `bash`):

```
# 1. create a session with an ask rule
curl -s -u "opencode:$OPENCODE_SERVER_PASSWORD" -H 'Content-Type: application/json' \
  -X POST http://127.0.0.1:4096/api/session \
  -d '{"permissions":[{"action":"shell","resource":"*","effect":"ask"}]}'
# -> {…,"id":"ses_…"}

# 2. start a capture first, then prompt it
curl -N -s -u "opencode:$OPENCODE_SERVER_PASSWORD" http://127.0.0.1:4096/api/event > stream.log &
curl -s -u "opencode:$OPENCODE_SERVER_PASSWORD" -H 'Content-Type: application/json' \
  -X POST http://127.0.0.1:4096/api/session/<SID>/prompt \
  -d '{"text":"Run two independent shell commands, each with its own shell tool call, in one message: echo one and echo two."}'

# 3. answer each pending request (decision: once | always | reject)
curl -s -u "opencode:$OPENCODE_SERVER_PASSWORD" http://127.0.0.1:4096/api/session/<SID>/permission
curl -s -u "opencode:$OPENCODE_SERVER_PASSWORD" -H 'Content-Type: application/json' \
  -X POST http://127.0.0.1:4096/api/session/<SID>/permission/<perID>/reply -d '{"decision":"once"}'
```

`Permission.Rule` is `{action, resource, effect}`, effect `allow|deny|ask`. `Permission.Reply` is
`once|always|reject`.

## Input-event shapes

- `permission.asked` → `data` is `Permission.Request`: `.data.id` (`per_…`), `.data.sessionID`,
  `.data.action`, `.data.resources`, `.data.source` (`{type:"tool", messageID, id}`).
- `form.created` → `.data.form.id` (`frm_…`), `.data.form.sessionID`.
- `permission.replied` → `.data.sessionID`, `.data.requestID`, `.data.reply`.

## Why this matters: two requests in one step

A prompt that makes the model call two tools in one assistant message produces both permission
requests **in the same step**, with no `session.step.started` between them. Observed order:

```
session.step.started
session.tool.input.started   (call A)
session.tool.input.started   (call B)
session.tool.input.ended / session.tool.called   (A, then B)
permission.asked             (A)
permission.asked             (B)      <- no step boundary between the two asks
permission.replied           (A) / session.tool.progress / session.tool.success
permission.replied           (B) / session.tool.progress / session.tool.success
session.step.ended
session.step.started         (next step)
session.text.*
session.execution.succeeded
```

So a watcher that re-arms only on a step boundary cannot fire the second ask; the two asks are
distinguishable only by their event ids. This is the evidence behind `specs/agents/notify.md`.

## Cleanup

Probe sessions stay in the daemon's session list; delete them with
`DELETE /api/session/<SID>` (see `/openapi.json`) when done so they do not clutter the workspace.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.