opencode-apex 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,89 +1,91 @@
1
1
  ---
2
2
  name: apex-callbacks
3
- description: Automatizaciones que despiertan a un agente desde fuera de la conversación con opencode-apex. Úsala cuando te pidan vigilar algo periódicamente ("comprueba cada 5 minutos si X funciona y si cae diagnostica"), avisar al terminar un job o tras un reinicio, recibir webhooks de servicios externos (GitHub, n8n, Stripe…) o usar herramientas de OpenCode (MCP, navegador) desde un script. Cubre descubrir la URL del servidor, suscribirse, el script vigilante, programarlo con systemd/cron, el relay de webhooks y el RPC tools.run.
3
+ description: Automations that wake an agent up from outside the conversation with opencode-apex (OpenCode V2). Use it when asked to watch something periodically ("check every 5 minutes whether X is up and diagnose it if it goes down"), to notify when a job finishes or after a reboot, to receive webhooks from external services (GitHub, n8n, Stripe…) or to use OpenCode tools (MCP, browser) from a script. Covers finding the server URL, subscribing, writing the watcher script, scheduling it with systemd/cron, the webhook relay and the tools.run RPC.
4
4
  ---
5
5
 
6
- # Automatizaciones con apex: callbacks, webhooks y vigilancias
6
+ # Automations with apex: callbacks, webhooks and watchers
7
7
 
8
- ## La idea en una frase
8
+ ## The idea in one sentence
9
9
 
10
- El **reloj** (cron/systemd) y la **puerta** (relay de webhooks) viven FUERA de OpenCode;
11
- OpenCode solo trabaja cuando le llaman por **RPC**. Cuando algo merece atención, el
12
- proceso externo llama a `events.ingest` y una **suscripción** despierta al agente con
13
- el encargo.
10
+ The **clock** (cron/systemd) and the **door** (a webhook relay) live OUTSIDE OpenCode;
11
+ OpenCode only works when it is called through **RPC** (an authenticated HTTP request to
12
+ the OpenCode server). When something deserves attention, the outside process calls
13
+ `events.ingest` and a **subscription** wakes the agent up with the task.
14
14
 
15
15
  ```
16
- proceso externo ──(tools.run: usa herramientas de OpenCode, opcional)──▶ OpenCode
16
+ outside process ──(tools.run: uses OpenCode tools, optional)──▶ OpenCode
17
17
  │
18
- └─ ¿criterio cumplido? ──(events.ingest)──▶ suscripción ──▶ el agente despierta
18
+ └─ criterion met? ──(events.ingest)──▶ subscription ──▶ the agent wakes up
19
19
  ```
20
20
 
21
- **Nunca** dejes la vigilancia dentro de OpenCode (un `sleep` en bucle en el shell, un
22
- temporizador en un plugin): OpenCode descarga los plugins de un directorio tras **60
23
- minutos sin actividad** y no los recarga tras un reinicio hasta que alguien usa ese
24
- directorio. El RPC, en cambio, levanta el directorio en la propia llamada (unos
25
- segundos la primera vez).
21
+ **Never** keep the watching inside OpenCode (a `sleep` loop in the shell tool, a timer in a
22
+ plugin): OpenCode unloads the plugins of a directory after **60 minutes without activity**
23
+ and, after a restart, does not load them again until someone uses that directory. An RPC
24
+ call, instead, loads the directory by itself (a few seconds on the first call).
26
25
 
27
- ## Paso 0 — ¿A dónde apunto? (pregúntalo, no lo adivines)
26
+ ## Step 0 — Where do I point? (ask, do not guess)
28
27
 
29
- Llama a la tool **`apex_callback_endpoint`**. Devuelve:
28
+ Call the tool **`apex_callback_endpoint`**. It returns:
30
29
 
31
- | Campo | Qué es |
30
+ | Field | What it is |
32
31
  | --- | --- |
33
- | `baseUrl` | URL del servidor de OpenCode desde esta máquina (`null` → pide al usuario `events.server.url`) |
34
- | `rpc.ingest` / `rpc.toolsRun` | URLs completas de los métodos, ya con `location[directory]` de este proyecto |
35
- | `auth.username` | siempre `opencode` (HTTP Basic) |
36
- | `auth.password` | DÓNDE está el password: `{kind:"file", file, field}` (registro 0600 del servicio) o `{kind:"env", env}`; `shell` lo imprime en una terminal |
37
- | `publicUrl` | URL para emisores de **otras** máquinas (túnel/proxy), si existe |
38
- | `examples` | curl listos para copiar |
39
-
40
- Reglas:
41
- - **El password no se escribe nunca** en scripts, unidades systemd, crontab ni en la
42
- conversación: los scripts lo leen al ejecutarse de `auth.password.file` (función
43
- `pw` de abajo) o de la variable `auth.password.env`.
44
- - Usa las URLs `rpc.*` tal cual: el `location[directory]` dirige la llamada a ESTE
45
- proyecto (sus suscripciones, sus herramientas MCP).
46
- - Otra máquina no alcanza `127.0.0.1`: necesita un túnel o proxy hacia `baseUrl`;
47
- anúncialo con `apex_set_callback_url({url})` y límpialo con `{url: null}` al acabar.
48
-
49
- ## Paso 1 — Suscribirse (quién despierta y con qué encargo)
50
-
51
- Con la tool **`apex_subscribe`** (queda ligada a la sesión que la llama):
32
+ | `baseUrl` | URL of the OpenCode server from this machine (`null` → ask the user to set `events.server.url`) |
33
+ | `rpc.ingest` / `rpc.toolsRun` | Full URLs of the methods, already carrying this project's `location[directory]` |
34
+ | `auth.username` | always `opencode` (HTTP Basic) |
35
+ | `auth.password` | WHERE the password is: `{kind:"file", file, field}` (the service's `0600` record) or `{kind:"env", env}`; `shell` prints it in a terminal |
36
+ | `publicUrl` | URL for senders on **other** machines (tunnel/proxy), if one exists |
37
+ | `examples` | `curl` commands ready to copy |
38
+
39
+ Rules:
40
+ - **Never write the password** into scripts, systemd units, crontab or the conversation:
41
+ scripts read it when they run, from `auth.password.file` (the `pw` function below) or
42
+ from the variable named in `auth.password.env`.
43
+ - Use the `rpc.*` URLs as they are: `location[directory]` routes the call to THIS project
44
+ (its subscriptions, its MCP tools).
45
+ - Another machine cannot reach `127.0.0.1`: it needs a tunnel or proxy to `baseUrl`. Announce
46
+ it with `apex_set_callback_url({url})`, have the sender use that base instead of
47
+ `baseUrl`, and clear it with `{url: null}` when done.
48
+
49
+ ## Step 1 — Subscribe (who wakes up, and with which task)
50
+
51
+ With the tool **`apex_subscribe`** (the subscription is bound to the session that calls it):
52
52
 
53
53
  ```jsonc
54
54
  {
55
55
  "filters": [{ "field": "type", "operator": "equals", "value": "server.down" }],
56
- "agent": "build", // agente que debe despertar (opcional)
57
- "promptTemplate": "El servidor {{payload.host}} está caído ({{payload.detail}}). Diagnostica la causa y propón el arreglo.",
58
- "deliverAs": "prompt", // prompt = turno nuevo del agente
56
+ "agent": "build", // agent the session switches to before delivery (optional)
57
+ "promptTemplate": "Server {{payload.host}} is down ({{payload.detail}}). Diagnose the cause and propose a fix.",
58
+ "deliverAs": "prompt", // prompt = a new turn of the agent
59
59
  "delivery": "queue"
60
60
  }
61
61
  ```
62
62
 
63
- - Filtra por `type` (y por `source` si hay varios emisores): un evento sin filtro
64
- despertaría a todas las suscripciones.
65
- - El encargo va en la plantilla: es el prompt que recibirá el agente.
66
- - `deliverAs: "synthetic"` + `resume: true` también despierta; con `resume: false` el
67
- mensaje queda pasivo hasta el siguiente turno.
68
-
69
- ## Paso 2 — El script vigilante
70
-
71
- Requisitos de un buen vigilante:
72
- 1. **Solo avisa en los cambios de estado** (OK → caído, y opcionalmente caído → OK),
73
- no en cada comprobación: guarda el último estado en un fichero.
74
- 2. **`eventID` estable por incidente** (p. ej. `server.down-<host>-<timestamp de caída>`):
75
- reenviarlo no duplica la entrega.
76
- 3. Distingue "el servicio está caído" de "no pude comprobarlo" (timeout de red, MCP
77
- que falla): son eventos distintos.
78
- 4. Reintenta la llamada a OpenCode con backoff: tras un reinicio tarda unos segundos.
63
+ - Filter by `type` (and by `source` if there are several senders): a subscription without
64
+ filters matches **every** event.
65
+ - The task goes in the template: it is the prompt the agent will receive. Placeholders:
66
+ `{{type}}`, `{{source}}`, `{{eventID}}`, `{{payload}}` (whole payload as JSON),
67
+ `{{payload.<field>}}`.
68
+ - `deliverAs: "synthetic"` + `resume: true` also wakes the agent; with `resume: false` the
69
+ message stays passive until the next turn.
70
+
71
+ ## Step 2 — The watcher script
72
+
73
+ What a good watcher does:
74
+ 1. **Only notifies on state changes** (up → down, and optionally down → up), not on every
75
+ check: it keeps the last state in a file.
76
+ 2. **Stable `eventID` per incident** (e.g. `server.down-<host>-<time it went down>`): sending
77
+ it again does not duplicate the delivery.
78
+ 3. Tells "the service is down" apart from "I could not check" (network timeout, failing
79
+ MCP server): they are different events.
80
+ 4. Retries the call to OpenCode with backoff: right after a restart it takes a few seconds.
79
81
 
80
82
  ```sh
81
83
  #!/bin/sh
82
- # watch-http.sh — avisa a apex cuando una URL pasa de OK a caída (y al recuperarse).
83
- TARGET="https://mi-servidor.example.com/health"
84
- INGEST='<rpc.ingest de apex_callback_endpoint>'
85
- PASSWORD_FILE='<auth.password.file de apex_callback_endpoint>'
86
- # El password se lee en cada ejecución (si auth.password.kind es "env": printf %s "$OPENCODE_SERVER_PASSWORD").
84
+ # watch-http.sh — tells apex when a URL goes from up to down (and when it recovers).
85
+ TARGET="https://my-server.example.com/health"
86
+ INGEST='<rpc.ingest from apex_callback_endpoint>'
87
+ PASSWORD_FILE='<auth.password.file from apex_callback_endpoint>'
88
+ # The password is read on every run (if auth.password.kind is "env": printf %s "$OPENCODE_SERVER_PASSWORD").
87
89
  pw() { sed -n 's/.*"password" *: *"\([^"]*\)".*/\1/p' "$PASSWORD_FILE"; }
88
90
  STATE="$HOME/.local/state/apex-watch/$(printf %s "$TARGET" | md5sum | cut -c1-12)"
89
91
  mkdir -p "$(dirname "$STATE")"
@@ -91,7 +93,7 @@ mkdir -p "$(dirname "$STATE")"
91
93
  code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 15 "$TARGET")
92
94
  case "$code" in 2??|3??) now=up ;; *) now=down ;; esac
93
95
  before=$(cat "$STATE" 2>/dev/null || echo up)
94
- [ "$now" = "$before" ] && exit 0 # sin cambio: no se molesta a nadie
96
+ [ "$now" = "$before" ] && exit 0 # no change: nobody gets bothered
95
97
  echo "$now" > "$STATE"
96
98
 
97
99
  type="server.$now"; since=$(date +%s)
@@ -105,88 +107,90 @@ done
105
107
  exit 1
106
108
  ```
107
109
 
108
- ### Si la comprobación necesita una herramienta de OpenCode → `tools.run`
110
+ ### If the check needs an OpenCode tool → `tools.run`
109
111
 
110
- Cuando lo que hay que consultar solo existe dentro de OpenCode (un MCP como Easypanel,
111
- el navegador, `webfetch`…), el script la ejecuta por RPC, sin modelo:
112
+ When what you have to check only exists inside OpenCode (an MCP server such as Easypanel,
113
+ the browser, `webfetch`…), the script runs that tool through RPC, without a model:
112
114
 
113
115
  ```sh
114
- TOOLS_RUN='<rpc.toolsRun de apex_callback_endpoint>'
116
+ TOOLS_RUN='<rpc.toolsRun from apex_callback_endpoint>'
115
117
  out=$(curl -sS --max-time 150 -X POST "$TOOLS_RUN" -u "opencode:$(pw)" \
116
118
  -H 'content-type: application/json' \
117
- -d '{"input":{"tool":"<id exacto de la herramienta>","input":{ ... }}}')
118
- echo "$out" | jq -e '.output.ok' >/dev/null || { echo "no pude comprobar: $(echo "$out" | jq -r '.output.error // .')"; exit 2; }
119
+ -d '{"input":{"tool":"<exact tool id>","input":{ ... }}}')
120
+ echo "$out" | jq -e '.output.ok' >/dev/null || { echo "could not check: $(echo "$out" | jq -r '.output.error // .')"; exit 2; }
119
121
  echo "$out" | jq -r '.output.content'
120
122
  ```
121
123
 
122
- - `tool` es el id exacto de la herramienta tal como la ves tú (las MCP suelen ser
123
- `<servidor>_<tool>`). Pruébala antes a mano y copia su input.
124
- - Respuesta: `{"output":{"ok","tool","agent","output?","content?","metadata?","error?","durationMs"}}`.
125
- - Se aplican los **permisos** del agente `events.tools.agent` (por defecto `build`) o el
126
- `agent` que pases en la llamada. Sin nadie delante, un permiso "ask" espera al advisor
127
- o hasta `timeoutMs` (120 s por defecto): pide al usuario una regla `allow` si hace falta.
128
- - `events.tools.allow` / `deny` limitan qué herramientas se pueden lanzar así
129
- (`question`, `subagent`, `execute` y las `apex_*` están denegadas por defecto).
124
+ - `tool` is the exact id of the tool as you see it (MCP tools are usually
125
+ `<server>_<tool>`). Try it by hand first and copy its input.
126
+ - Reply: `{"output":{"ok","tool","agent","output?","content?","metadata?","error?","durationMs"}}`.
127
+ Failures (denied, unknown tool, permission blocked, timeout) come as `ok: false` + `error`.
128
+ - The **permissions** of the agent `events.tools.agent` (default `build`) apply, or those of
129
+ the `agent` you pass in the call. With nobody watching, an "ask" permission waits for the
130
+ apex advisor or until `timeoutMs` (120 s by default): ask the user for an `allow` rule if
131
+ needed.
132
+ - `events.tools.allow` / `deny` limit which tools can be run this way (`question`,
133
+ `subagent`, `execute` and the `apex_*` tools are denied by default).
130
134
 
131
- ## Paso 3 — Programarlo (el reloj)
135
+ ## Step 3 — Schedule it (the clock)
132
136
 
133
- Preferido: **temporizador systemd de usuario** (sobrevive a reinicios, guarda logs):
137
+ Preferred: a **systemd user timer** (survives reboots, keeps logs):
134
138
 
135
139
  ```sh
136
140
  mkdir -p ~/.config/systemd/user ~/.local/bin
137
- install -m 0755 watch-http.sh ~/.local/bin/apex-watch-mi-servidor.sh
138
- cat > ~/.config/systemd/user/apex-watch-mi-servidor.service <<'EOF'
141
+ install -m 0755 watch-http.sh ~/.local/bin/apex-watch-my-server.sh
142
+ cat > ~/.config/systemd/user/apex-watch-my-server.service <<'EOF'
139
143
  [Unit]
140
- Description=apex watch: mi-servidor
144
+ Description=apex watch: my-server
141
145
  [Service]
142
146
  Type=oneshot
143
- ExecStart=%h/.local/bin/apex-watch-mi-servidor.sh
147
+ ExecStart=%h/.local/bin/apex-watch-my-server.sh
144
148
  EOF
145
- cat > ~/.config/systemd/user/apex-watch-mi-servidor.timer <<'EOF'
149
+ cat > ~/.config/systemd/user/apex-watch-my-server.timer <<'EOF'
146
150
  [Unit]
147
- Description=apex watch: mi-servidor cada 5 min
151
+ Description=apex watch: my-server every 5 min
148
152
  [Timer]
149
153
  OnBootSec=2min
150
154
  OnUnitActiveSec=5min
151
155
  [Install]
152
156
  WantedBy=timers.target
153
157
  EOF
154
- systemctl --user daemon-reload && systemctl --user enable --now apex-watch-mi-servidor.timer
155
- systemctl --user list-timers | grep apex-watch # comprobar
156
- journalctl --user -u apex-watch-mi-servidor -n 20 # logs
158
+ systemctl --user daemon-reload && systemctl --user enable --now apex-watch-my-server.timer
159
+ systemctl --user list-timers | grep apex-watch # check
160
+ journalctl --user -u apex-watch-my-server -n 20 # logs
157
161
  ```
158
162
 
159
- Alternativa: `crontab -e` → `*/5 * * * * ~/.local/bin/apex-watch-mi-servidor.sh`.
163
+ Alternative: `crontab -e` → `*/5 * * * * ~/.local/bin/apex-watch-my-server.sh`.
160
164
 
161
- Antes de dar por terminado el encargo: **ejecuta el script una vez a mano** y, si
162
- puedes, provoca el evento (o envía un `events.ingest` de prueba) para ver que la
163
- suscripción despierta al agente. Dile al usuario qué instalaste y cómo quitarlo:
165
+ Before calling the task done: **run the script once by hand** and, if you can, trigger the
166
+ event (or send a test `events.ingest`) to see the subscription wake the agent. Tell the user
167
+ what you installed and how to remove it:
164
168
 
165
169
  ```sh
166
- systemctl --user disable --now apex-watch-mi-servidor.timer
167
- rm ~/.config/systemd/user/apex-watch-mi-servidor.{service,timer} ~/.local/bin/apex-watch-mi-servidor.sh
170
+ systemctl --user disable --now apex-watch-my-server.timer
171
+ rm ~/.config/systemd/user/apex-watch-my-server.{service,timer} ~/.local/bin/apex-watch-my-server.sh
168
172
  ```
169
- …y `apex_unsubscribe({id})` para la suscripción.
173
+ …plus `apex_unsubscribe({id})` for the subscription.
170
174
 
171
- ## Webhooks (servicios externos que llaman por HTTP)
175
+ ## Webhooks (external services that call over HTTP)
172
176
 
173
- Un webhook es un callback con un **proceso intermedio** que traduce la llamada HTTP del
174
- servicio a `events.ingest`. OpenCode no expone una URL de webhook propia.
177
+ A webhook is a callback with an **intermediate process** that turns the service's HTTP call
178
+ into `events.ingest`. OpenCode does not expose a webhook URL of its own.
175
179
 
176
- - **n8n**: nodo *Webhook* → nodo *HTTP Request* `POST <rpc.ingest>`, auth Basic
177
- (credencial `opencode` + password), body
180
+ - **n8n**: *Webhook* node → *HTTP Request* node `POST <rpc.ingest>`, Basic auth (credential
181
+ `opencode` + password), body
178
182
  `{"input":{"source":"github","type":"{{$json.headers['x-github-event']}}","eventID":"{{$json.headers['x-github-delivery']}}","payload":{{JSON.stringify($json.body)}}}}`.
179
- Si n8n corre en otra máquina necesita alcanzar el servidor (túnel/proxy, `publicUrl`).
180
- - **Relay mínimo** (Node ≥ 18, sin dependencias) en la máquina de OpenCode, como servicio
181
- systemd de usuario. Valida un token propio antes de reenviar nada:
183
+ If n8n runs on another machine it needs to reach the server (tunnel/proxy, `publicUrl`).
184
+ - **Minimal relay** (Node ≥ 18, no dependencies) on the OpenCode machine, as a systemd user
185
+ service. It checks its own token before forwarding anything:
182
186
 
183
187
  ```js
184
188
  // webhook-relay.mjs — POST http://<host>:<port>/<type>?token=<RELAY_TOKEN> → apex events.ingest
185
189
  import { createServer } from "node:http"
186
190
  import { readFileSync } from "node:fs"
187
191
  const { INGEST, PASSWORD_FILE, RELAY_TOKEN, PORT = "8787", HOST = "127.0.0.1", SOURCE = "webhook" } = process.env
188
- if (!INGEST || !RELAY_TOKEN) throw new Error("faltan INGEST o RELAY_TOKEN")
189
- // Se lee en cada petición: sobrevive a reinicios del servicio sin reiniciar el relay.
192
+ if (!INGEST || !RELAY_TOKEN) throw new Error("INGEST or RELAY_TOKEN missing")
193
+ // Read on every request: survives service restarts without restarting the relay.
190
194
  const password = () =>
191
195
  PASSWORD_FILE ? JSON.parse(readFileSync(PASSWORD_FILE, "utf8")).password : process.env.OPENCODE_SERVER_PASSWORD
192
196
  createServer(async (req, res) => {
@@ -207,33 +211,35 @@ createServer(async (req, res) => {
207
211
  const r = await fetch(INGEST, { method: "POST", headers: { authorization: auth, "content-type": "application/json" }, body: JSON.stringify({ input }) })
208
212
  res.writeHead(r.ok ? 202 : 502, { "content-type": "application/json" }).end(await r.text())
209
213
  } catch (error) {
210
- res.writeHead(502).end(String(error)) // OpenCode parado: el emisor reintentará
214
+ res.writeHead(502).end(String(error)) // OpenCode stopped: the sender will retry
211
215
  }
212
216
  }).listen(Number(PORT), HOST)
213
217
  ```
214
218
 
215
- Configúralo con `INGEST` y `PASSWORD_FILE` (de `apex_callback_endpoint`; si
216
- `auth.password.kind` es `env`, exporta `OPENCODE_SERVER_PASSWORD` en su lugar) y un
217
- `RELAY_TOKEN` aleatorio (`openssl rand -hex 24`). Para recibir desde Internet,
218
- expón **el relay** (no el servidor de OpenCode) con un túnel.
219
+ Configure it with `INGEST` and `PASSWORD_FILE` (from `apex_callback_endpoint`; if
220
+ `auth.password.kind` is `env`, export `OPENCODE_SERVER_PASSWORD` instead) and a random
221
+ `RELAY_TOKEN` (`openssl rand -hex 24`). To receive from the Internet, expose **the relay**
222
+ (not the OpenCode server) through a tunnel.
219
223
 
220
- ## Seguridad
224
+ ## Security
221
225
 
222
- - Quien pueda llamar a `events.ingest` dirige al agente, y `tools.run` ejecuta
223
- herramientas: ambos exigen el password del servidor. Trátalo como una credencial.
224
- - Ficheros con secretos: `0600`. Un relay o túnel expuesto a Internet lleva su propio
225
- token y nunca reenvía sin validarlo.
226
- - No amplíes permisos para que un vigilante funcione sin decírselo al usuario.
226
+ - Whoever can call `events.ingest` steers the agent, and `tools.run` runs tools: both
227
+ require the server password. Treat it as a credential.
228
+ - Files holding secrets: `0600`. A relay or tunnel exposed to the Internet carries its own
229
+ token and never forwards without checking it.
230
+ - Do not widen permissions to make a watcher work without telling the user.
227
231
 
228
- ## Contrato
232
+ ## Contract
229
233
 
230
- | Método RPC | Entrada | Salida |
234
+ | RPC method | Input | Output |
231
235
  | --- | --- | --- |
232
- | `events.ingest` | `{source, type?, payload, eventID?}` | `{accepted, eventID, delivered[]}` |
236
+ | `events.ingest` | `{source, type?, payload, eventID?}` | `{accepted, eventID, delivered[]}` (or `error`) |
233
237
  | `tools.run` | `{tool, input?, agent?, timeoutMs?}` | `{ok, tool, agent, output?, content?, metadata?, error?, durationMs}` |
234
- | `server.info` | `{}` | lo mismo que `apex_callback_endpoint` |
235
- | `status` / `ping` | `{}` | estado del plugin / `{pong, timestamp}` |
236
-
237
- Todas: `POST <baseUrl>/api/rpc/apex/<método>?location[directory]=<proyecto>`, cuerpo
238
- `{"input":{…}}`, respuesta `{"output":{…}}`, Basic `opencode:<password>`.
239
- `delivered: []` significa que ninguna suscripción casó (revisa filtros y sesión).
238
+ | `server.info` | `{}` | the same as `apex_callback_endpoint` (without `examples`) |
239
+ | `status` / `ping` | `{}` | plugin status / `{pong, timestamp}` |
240
+
241
+ All of them: `POST <baseUrl>/api/rpc/apex/<method>?location[directory]=<project>`, body
242
+ `{"input":{…}}`, reply `{"output":{…}}`, Basic `opencode:<password>`. A call missing a
243
+ required field is rejected with HTTP 400 (`rpc.invalid_input`). `delivered: []` means no
244
+ subscription received the event (check the filters and the target session) or the
245
+ `eventID` was already delivered in the last 5 minutes.