opencode-apex 0.2.1 → 0.2.3

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.
package/CHANGELOG.md CHANGED
@@ -1,70 +1,124 @@
1
1
  # Changelog
2
2
 
3
+ All notable changes to `opencode-apex`. Format based on
4
+ [Keep a Changelog](https://keepachangelog.com/); versioning follows [SemVer](https://semver.org/).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [0.2.3] — 2026-10-25
9
+
10
+ ### Changed
11
+
12
+ - The `apex-callbacks` skill now teaches relays in general, not only watchers and webhooks.
13
+ It covers:
14
+ - any source: messaging, email, SSE/WebSocket streams, queues, webhooks;
15
+ - any language and OS;
16
+ - what relay code can do with OpenCode and MCP tools through `tools.run`, and its limits;
17
+ - reachability: a relay behind NAT can't receive Internet webhooks without an outbound
18
+ mode, a tunnel (Cloudflare, Tailscale, ngrok), reverse SSH or store-and-forward.
19
+
20
+ `SKILL.md` stays short. The detail moved to `references/` (relays, reachability,
21
+ run-anywhere, examples), with a Python SSE relay, PowerShell ingest and GitHub signature
22
+ checks in the Node webhook relay. It also documents the subscription filter operators.
23
+
24
+ - Corrected the dependency explanation. OpenCode ≥ 2.1 serves `effect` and
25
+ `@opencode/plugin` to plugins from its own copy. What has to match the host are the other
26
+ `@opencode/*` packages installed with apex.
27
+
28
+ ## [0.2.2] — 2026-10-23
29
+
30
+ ### Fixed
31
+
32
+ - The guard's built-in rules for `apex-advisor` were dropped: the validated config always
33
+ carries `guard.agents: {}`, and a shallow merge replaced the defaults. `agents` is now
34
+ merged per agent.
35
+ - `{{payload}}` (the whole payload as JSON) was not substituted in prompt templates. The
36
+ default template uses it, so its prompts came out with the literal placeholder.
37
+ - `apex_list_subscriptions` now also lists the subscriptions from config (`readonly: true`),
38
+ as its description already said.
39
+ - The `apex_subscribe` tool described `agent` as a filter. It is the agent the target session
40
+ is switched to before delivery.
41
+ - The `redact.process` RPC ignored `redact.allowlist`.
42
+ - `~/` was not expanded in `browser.profile` or in `redact.key: "file:~/…"`.
43
+ - Config files with syntax errors were applied partially without any notice. apex now logs
44
+ `config syntax errors in <file> (… @ line N)`.
45
+ - The `browser_target` tool description claimed a `profile` needs no remote debugging. It
46
+ does: apex reads that profile's `DevToolsActivePort`.
47
+ - The template `opencode-apex.jsonc` was invalid JSONC: a multi-line string was silently
48
+ cut. Its `in` filter example also used a wildcard that `in` doesn't support.
49
+
50
+ ### Changed
51
+
52
+ - Runtime messages of `tools.run`, server discovery, compatibility warnings and the events
53
+ tool descriptions are now in English.
54
+ - The documentation is now in English and written for readers new to OpenCode plugins and RPC.
55
+ It states that apex is **OpenCode V2 only (≥ 2.1)**.
56
+ - Added an MIT license, and repository metadata pointing to
57
+ https://github.com/aorizondo/opencode-apex.
58
+
3
59
  ## [0.2.1] — 2026-10-23
4
60
 
5
61
  ### Fixed
6
62
 
7
- - El aviso de versiones desalineadas recomendaba `opencode plugin update`, que en OpenCode
8
- 2.1 solo gestiona plugins de TUI (`Plugin is not configured` para los de servidor). Ahora
9
- indica el procedimiento que funciona: con OpenCode parado, borrar
10
- `~/.cache/opencode/npm/opencode-apex@*` y arrancarlo.
63
+ - The version-mismatch warning recommended `opencode plugin update`. In OpenCode 2.1 that
64
+ command only handles TUI plugins, and for server plugins it answers `Plugin is not
65
+ configured`. The warning now gives the procedure that works: stop OpenCode, delete
66
+ `~/.cache/opencode/npm/opencode-apex@*`, start it again.
11
67
 
12
68
  ## [0.2.0] — 2026-10-23
13
69
 
14
- Automatizaciones que sobreviven a la descarga de plugins de OpenCode V2: todo entra por
15
- el RPC del servidor.
70
+ Automations that survive OpenCode V2 unloading plugins: everything comes in through the
71
+ server's RPC.
16
72
 
17
73
  ### Breaking
18
74
 
19
- - **Listener HTTP plano eliminado** (`events.listener`, puerto 4599). OpenCode descarga
20
- los plugins de un directorio tras 60 min sin actividad de sesiones, y el listener se
21
- cerraba con el plugin. La clave se ignora con un aviso. Los callbacks entran por
22
- `apex/events.ingest`, y los webhooks por un relay (n8n o un daemon) que llama a ese RPC.
23
- - `apex_set_callback_url` fija ahora la URL **pública del servidor**, para emisores de
24
- otras máquinas (túnel o proxy hacia la URL base). Antes fijaba la URL del listener.
25
- - `apex.status` devuelve `endpoint` en lugar de `callback`.
75
+ - **Plain HTTP listener removed** (`events.listener`, port 4599). OpenCode unloads a project's
76
+ plugins after 60 minutes without session activity, and the listener closed with the plugin.
77
+ The key is now ignored with a warning. Callbacks come in through `apex/events.ingest`;
78
+ webhooks come in through a relay (n8n or a small daemon) that calls that RPC.
79
+ - `apex_set_callback_url` now sets the **server's public URL**, for senders on other machines
80
+ (a tunnel or reverse proxy to the server's base URL). It used to set the listener's URL.
81
+ - `apex.status` returns `endpoint` instead of `callback`.
26
82
 
27
83
  ### Fixed
28
84
 
29
- - **El RPC `apex` no se registraba en OpenCode ≥ 2.1.** La definición usaba `name`, y V2
30
- indexa por `id`, así que todas las llamadas devolvían `rpc.unavailable`.
31
- - **Estado compartido entre directorios.** El módulo se importa una vez por proceso, y
32
- la sesión principal, el handler de ingest y la deduplicación eran variables de
33
- módulo: un directorio podía entregar eventos en la sesión de otro, y descargar uno
34
- rompía el ingest de los demás. Ahora el estado es por directorio.
35
- - **Sesión principal ajena.** El bus de eventos de OpenCode es global, así que cada
36
- instancia de apex se vinculaba también a las sesiones nuevas de OTROS directorios.
37
- Ahora se ignoran los eventos de otro directorio.
38
- - **No cargaba con OpenCode 2.1**: se fijaba `effect` 4.0.0-rc.112, mientras
39
- `@opencode/plugin` 2.1 usa 4.0.1 (`Schema.isStartsWith is not a function`).
85
+ - **The `apex` RPC was never registered on OpenCode ≥ 2.1.** The definition used `name`, but
86
+ V2 indexes RPCs by `id`, so every call returned `rpc.unavailable`.
87
+ - **State shared across projects.** The module is imported once per process, yet the main
88
+ session, the ingest handler and the dedup cache were module-level variables. One project
89
+ could deliver events into another project's session, and unloading one project broke
90
+ ingest for the others. The state is now per project.
91
+ - **Binding to another project's session.** OpenCode's event bus is global, so every apex
92
+ instance also bound to new sessions of *other* projects. Events from other projects are
93
+ now ignored.
94
+ - **Did not load on OpenCode 2.1.** apex pinned `effect` 4.0.0-rc.112, while
95
+ `@opencode/plugin` 2.1 uses 4.0.1 (`Schema.isStartsWith is not a function`).
40
96
 
41
97
  ### Added
42
98
 
43
- - **RPC `apex/tools.run`.** Un proceso externo ejecuta una herramienta de OpenCode
44
- (nativa, de plugin o MCP) sin modelo.
45
- - Configuración `events.tools`: `allow`, `deny`, `agent` cuyos permisos se aplican y
99
+ - **`apex/tools.run` RPC.** An external program runs one OpenCode tool (built-in, plugin or
100
+ MCP), with no model involved.
101
+ - Configured in `events.tools`: `allow`, `deny`, the `agent` whose permissions apply, and
46
102
  `timeoutMs`.
47
- - Se ejecuta en una sesión runner oculta por directorio, con el agente `apex-runner`.
48
- - **Descubrimiento del servidor:** la tool `apex_callback_endpoint` y el RPC `server.info`.
49
- - Devuelven la URL base, las URLs RPC del directorio, la auth Basic y de dónde leer
50
- el password (nunca el password), y ejemplos curl.
51
- - La URL base sale de `events.server.url` > el registro del servicio (por pid) >
52
- `opencode serve --port`.
53
- - **La skill `apex-callbacks` viaja con el paquete** y se registra sola. Cubre:
54
- - vigilantes con estado;
55
- - systemd/cron;
56
- - relay de webhooks y n8n;
57
- - `tools.run`.
58
- - **Compatibilidad sostenida con OpenCode.**
59
- - `effect` deja de ser dependencia propia: pasa a peer opcional y usa la copia de
60
- `@opencode/plugin`.
61
- - `@opencode/plugin` y `@opencode/plugin-browser` pasan a `^2.1.1`.
62
- - Aviso al cargar (`core/compat.ts`) si hay dos copias de effect o si OpenCode es más
63
- nuevo que el `@opencode/plugin` instalado.
64
- - `prepublishOnly` instala el paquete como OpenCode y falla si las dependencias se
65
- desalinean (ver docs/TROUBLESHOOTING.md).
66
- - Tests `test/events.test.ts` y scripts `npm test`, `npm run typecheck` y `npm run check:install`.
103
+ - Runs in a hidden per-project runner session (agent `apex-runner`).
104
+ - **Server discovery:** the `apex_callback_endpoint` tool and the `server.info` RPC.
105
+ - They return the base URL, the project's RPC URLs, Basic auth and *where* to read the
106
+ password (never the password itself), plus curl examples.
107
+ - The base URL comes from `events.server.url`, then the background service record (matched
108
+ by pid), then `opencode serve --port`.
109
+ - **The `apex-callbacks` skill ships with the package** and registers itself. It covers
110
+ stateful watchers, systemd/cron, the webhook relay and n8n, and `tools.run`.
111
+ - **Staying compatible with OpenCode releases.**
112
+ - `effect` is no longer a direct dependency: it is an optional peer, satisfied by
113
+ `@opencode/plugin`'s copy.
114
+ - `@opencode/plugin` and `@opencode/plugin-browser` use `^2.1.1`.
115
+ - Load-time warning (`core/compat.ts`) when there are two copies of `effect`, or when
116
+ OpenCode is newer than the installed `@opencode/plugin`.
117
+ - `prepublishOnly` installs the package the way OpenCode does and fails if the
118
+ dependencies drift (see docs/TROUBLESHOOTING.md).
119
+ - Tests in `test/events.test.ts`, and the `npm test`, `npm run typecheck` and
120
+ `npm run check:install` scripts.
67
121
 
68
122
  ## [0.1.0]
69
123
 
70
- Primera versión publicada.
124
+ First published version.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Antonio Orizondo Leyva
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.