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,28 +1,36 @@
1
1
  {
2
2
  // ==========================================================================
3
- // opencode-apex — configuración de ejemplo completa
3
+ // opencode-apex — complete annotated example configuration
4
+ // (OpenCode V2 only, 2.1 or newer)
4
5
  //
5
- // JERARQUÍA Y CANALES (precedencia de menor a mayor):
6
- // 1. fichero GLOBAL ~/.config/opencode/opencode-apex.jsonc
7
- // 2. opciones inline del plugin en opencode.json { "plugins": [{ "package": "…", "options": {…} }] }
8
- // 3. fichero LOCAL <proyecto>/.opencode/opencode-apex.jsonc ← este
9
- // Reglas: el ámbito manda (local > global) y dentro de cada ámbito el
10
- // fichero gana a las opciones inline ⇒ local-inline > global-file.
6
+ // WHERE SETTINGS COME FROM (lowest to highest priority):
7
+ // 1. GLOBAL file ~/.config/opencode/opencode-apex.jsonc
8
+ // 2. inline plugin options in opencode.json { "plugins": [{ "package": "opencode-apex", "options": {…} }] }
9
+ // 3. LOCAL file <project>/.opencode/opencode-apex.jsonc ← like this one
10
+ // Rule: scope wins (local over global) and, within a scope, the file wins
11
+ // over the inline options ⇒ inline options override the global file but
12
+ // are overridden by the local file. Objects merge; arrays are REPLACED.
11
13
  //
12
- // COMENTARIOS: se aceptan #, // y /* */ (los # dentro de strings se respetan)
14
+ // COMMENTS: #, // and /* */ are accepted (a # inside a string is kept).
15
+ // Strings cannot span lines: write line breaks as \n. Regex backslashes are
16
+ // doubled: \\b.
13
17
  //
14
- // PLANTILLAS (events.promptTemplateFile, advisor.promptTemplateFile):
15
- // solo rutas relativas — al proyecto ("prompts/x.md") o al home ("~/x.md").
16
- // Las absolutas se rechazan; si el fichero no existe se CREA con defaults.
18
+ // TEMPLATES (events.subscriptions[].promptTemplateFile, advisor.promptTemplateFile):
19
+ // relative paths only — to the project ("prompts/x.md") or to home ("~/x.md").
20
+ // Absolute paths and ../ escapes are rejected; a missing file is CREATED
21
+ // with the default template.
17
22
  //
18
- // Todos los campos son opcionales: el plugin arranca con defaults si no hay
19
- // ninguna fuente. Las variables de entorno se interpolan con ${VAR} o ${VAR:-default}.
23
+ // Every field is optional: with no source at all the plugin starts with the
24
+ // defaults. Environment variables in this file: ${VAR}, ${VAR:-default} or
25
+ // $VAR. (A ${VAR} that is not set invalidates the config → all defaults; use
26
+ // ${VAR:-} for an empty fallback.) {env:VAR} is OpenCode syntax and only
27
+ // works inside opencode.json.
20
28
  // ==========================================================================
21
29
 
22
30
  // --------------------------------------------------------------------------
23
- // Módulos: activa/desactiva cada uno individualmente.
24
- // FUENTE ÚNICA: el toggle vive SOLO aquí — no existe <modulo>.enabled.
25
- // Si se omite una clave, el módulo queda activo por defecto.
31
+ // Modules: turn each one on or off.
32
+ // SINGLE SWITCH: it lives ONLY here — there is no <module>.enabled.
33
+ // An omitted key means the module's default: all ON except guard (OFF).
26
34
  // --------------------------------------------------------------------------
27
35
  "modules": {
28
36
  "redact": true,
@@ -34,33 +42,35 @@
34
42
 
35
43
 
36
44
  // --------------------------------------------------------------------------
37
- // redact — redacción de secretos por cifrado (AES-256-GCM).
45
+ // redact — keep secrets away from the model by encrypting them (AES-256-GCM).
38
46
  //
39
- // Cada coincidencia se cifra y se sustituye por el marcador legible:
40
- // ${prefix}${nombreDelPatron}:${base64url(iv||tag||ciphertext)}${suffix}
41
- // p. ej. [SECRET:github-pat:AbC123...]
42
- // La restauración descifra el propio marcador (no hay mapping en memoria).
43
- // Se redacta solo de cara al modelo (hook context) y se restaura solo en los
44
- // argumentos de tool (hook execute.before): la respuesta del modelo no se
45
- // restaura, el usuario ve el marcador legible.
47
+ // Each match is encrypted and replaced by a readable marker:
48
+ // ${prefix}${patternName}:${base64url(iv||tag||ciphertext)}${suffix}
49
+ // e.g. [SECRET:github-pat:AbC123...]
50
+ // Restoring decrypts the marker itself (there is no in-memory mapping).
51
+ // Redaction applies only to what is sent to the model ("context" hook);
52
+ // restoration only to tool arguments ("execute.before" hook). Model answers
53
+ // are not restored: you see the readable marker.
46
54
  //
47
- // patterns: regex propias (se suman a los bundles)
48
- // bundles: conjuntos de patrones por nombre. Por defecto se activan TODOS
49
- // menos los opt-in. Disponibles: aws, github, gitlab, slack, jwt,
50
- // pem, bearer, env, openai, anthropic, google, stripe, npm, database,
55
+ // patterns: your own regexes (added on top of the bundles); each is named
56
+ // custom-<index> and is always active
57
+ // bundles: named groups of detectors. Setting this REPLACES the default
58
+ // list. Default (38): aws, github, gitlab, slack, jwt, pem,
59
+ // bearer, env, openai, anthropic, google, stripe, npm, database,
51
60
  // azure, terraform, vault, heroku, vercel, supabase, digitalocean,
52
61
  // cloudflare, observability, pypi, rubygems, twilio, sendgrid,
53
62
  // postman, mailgun, mailchimp, linear, shopify, square, docker,
54
63
  // kubernetes, cohere, huggingface, discord.
55
- // Opt-in (ruidosos/PII, NO activos por defecto): pii, network, datadog.
56
- // minConfidence: low | medium | high — filtra patrones ruidosos (default medium)
57
- // allowlist: regex que NUNCA se redactan
58
- // key: material de clave -> literal | env:VAR | file:/ruta | hex:... | base64:...
59
- // También se interpola ${VAR} / ${VAR:-default} en cualquier string.
60
- // Si no se resuelve, se genera una clave aleatoria y se persiste en
61
- // ~/.config/opencode/apex.key (0600) para que la restauración funcione.
62
- // mode: "strict" (redacta) | "warn" (solo registra)
63
- // restore: qué salidas se descifran (solo input de tool por ahora)
64
+ // Opt-in (noisy / personal data, NOT on by default): pii, network, datadog.
65
+ // minConfidence: low | medium | high — drops noisy detectors (default medium)
66
+ // allowlist: regexes tested against each matched secret; matches stay in clear
67
+ // key: key material -> literal | env:VAR | file:/absolute/path | hex:... | base64:...
68
+ // (file: does not expand ~). Empty → the APEX_REDACT_KEY variable.
69
+ // If nothing resolves, the key saved in ~/.config/opencode/apex.key
70
+ // is reused, or a random one is generated there (0600).
71
+ // Changing the key orphans markers made with the old one.
72
+ // mode: "strict" (replaces) | "warn" (only logs)
73
+ // restore: which outputs are decrypted (only tool input for now)
64
74
  // --------------------------------------------------------------------------
65
75
  "redact": {
66
76
  "mode": "strict",
@@ -75,44 +85,50 @@
75
85
  },
76
86
 
77
87
  // --------------------------------------------------------------------------
78
- // events — ingesta genérica de eventos, suscripciones y entrega.
79
- // routing: "all" (fan-out a todas las suscripciones) | "first" (solo la de mayor prioridad)
80
- // Cada suscripción filtra eventos y los entrega a una sesión. La plantilla
81
- // puede ser inline (promptTemplate) o un fichero (promptTemplateFile, tiene
82
- // prioridad). Placeholders: {{payload.campo}}, {{source}}, {{type}}, {{eventID}}.
83
- // deliverAs: "prompt" (user prompt, por defecto) | "synthetic" (mensaje sintético).
84
- // resume: SOLO con deliverAs="synthetic". true → despierta el bucle del agente
85
- // (execution.wake) y el modelo procesa el mensaje; false → inyección
86
- // pasiva, solo aparece en la sesión (default false).
88
+ // events — wake an agent from outside the conversation: callbacks, webhooks,
89
+ // scheduled checks. An external process calls the OpenCode server's RPC
90
+ // endpoint; matching subscriptions deliver the event to a session.
91
+ // routing: "all" (fan-out to every matching subscription) | "first" (only the
92
+ // highest priority one)
93
+ // Each subscription filters events and delivers them to a session. The text
94
+ // comes from promptTemplate (inline) or promptTemplateFile (wins).
95
+ // Placeholders: {{payload.field}}, {{source}}, {{type}}, {{eventID}}.
96
+ // agent: switch the target session to this agent before delivering (optional).
97
+ // deliverAs: "prompt" (a user prompt: starts a turn; default) | "synthetic".
98
+ // resume: ONLY with deliverAs="synthetic". true → wakes the agent loop and
99
+ // the model processes the message; false → passive, it waits for
100
+ // the next turn (default false).
87
101
  // sessionID:
88
- // - "" / null / ausente → AUTO-VINCULACIÓN a la sesión principal activa
89
- // (la raíz que se crea al abrir opencode). NO se vincula a la sesión del
90
- // advisor ni a sesiones de subagentes (parentID).
91
- // Al cerrarse esa sesión, la suscripción se DESVINCULA automáticamente;
92
- // una nueva sesión principal la vuelve a vincular.
93
- // - "ses_xxx" → sesión explícita (si no existe, la entrega falla y se registra).
94
- // Los ejemplos van con "enabled": false.
102
+ // - "" / null / missing → AUTO-BINDING to the active main session of THIS
103
+ // project: the root session you work in. Never the advisor, the
104
+ // tools.run runner, or subagent sessions (parentID).
105
+ // When that session is deleted the subscription is UNBOUND; the next
106
+ // main session binds it again.
107
+ // - "ses_xxx" → that session (if it does not exist, delivery fails and is logged).
108
+ // The examples below have "enabled": false.
95
109
  // operator: equals | contains | matches | gt | lt | in | notIn | exists | notExists
96
- // delivery: "queue" (espera turno) | "steer" (inyecta en el turno actual)
110
+ // delivery: "queue" (waits its turn) | "steer" (injected into the running turn)
97
111
  // --------------------------------------------------------------------------
98
112
  "events": {
99
113
  "routing": "all",
100
- // Todo entra por el RPC del servidor (POST /api/rpc/apex/<método>, Basic auth).
101
- // No hay listener propio: OpenCode descarga los plugins tras 60 min sin uso y
102
- // el RPC levanta el directorio en la propia llamada. Webhooks → un relay (n8n,
103
- // un daemon) que traduce la llamada HTTP a events.ingest (skill apex-callbacks).
114
+ // Everything enters through the server's RPC (POST /api/rpc/apex/<method>,
115
+ // HTTP Basic auth). There is no listener of its own: OpenCode unloads plugins
116
+ // after 60 min without activity, and an RPC call loads the project again.
117
+ // Webhooks → a relay (n8n, a small daemon) that turns the HTTP call into
118
+ // events.ingest (see the apex-callbacks skill and docs/EVENTS.md).
104
119
  "server": {
105
- // URL base del servidor para scripts locales. Vacío = descubrirla (registro
106
- // del servicio o --port de `opencode serve`). Fíjala detrás de un proxy.
120
+ // Base URL of the server for local scripts. Empty = discover it (the
121
+ // background service record, or --port of `opencode serve`). Set it when
122
+ // the server sits behind a proxy.
107
123
  "url": "",
108
- // URL pública (túnel/proxy) para emisores de otras máquinas. El agente puede
109
- // fijarla en runtime con apex_set_callback_url (precedencia: runtime > config).
124
+ // Public URL (tunnel/proxy) for senders on other machines. The agent can
125
+ // set it at runtime with apex_set_callback_url (precedence: runtime > config).
110
126
  "publicUrl": ""
111
127
  },
112
- // RPC apex/tools.run: un proceso externo ejecuta una herramienta de OpenCode
113
- // (nativa, de plugin o MCP) sin modelo. Gana deny; luego deciden los permisos
114
- // del agente `agent` (o el que pase la llamada). Sin nadie delante, un "ask"
115
- // espera al advisor o hasta timeoutMs.
128
+ // RPC apex/tools.run: an external process runs one OpenCode tool (built-in,
129
+ // from a plugin, or MCP) without a model. deny wins over allow; then the
130
+ // permissions of `agent` (or the agent passed in the call) decide. With
131
+ // nobody watching, an "ask" waits for the advisor or until timeoutMs.
116
132
  "tools": {
117
133
  "enabled": true,
118
134
  "allow": ["*"],
@@ -126,7 +142,8 @@
126
142
  "agent": "plan",
127
143
  "filters": [
128
144
  { "field": "type", "operator": "equals", "value": "ci.failed" },
129
- { "field": "payload.branch", "operator": "in", "value": ["main", "release/*"] }
145
+ // `in` compares exact values; for prefixes or wildcards use `matches` with a regex.
146
+ { "field": "payload.branch", "operator": "matches", "pattern": "^(main|release/.+)$" }
130
147
  ],
131
148
  "promptTemplate": "CI failed on {{payload.branch}} ({{payload.commit}}). Investigate and propose a fix.",
132
149
  "promptTemplateFile": "prompts/ci-failure.md",
@@ -138,7 +155,7 @@
138
155
  {
139
156
  "sessionID": "",
140
157
  "filters": [{ "field": "type", "operator": "matches", "pattern": "^deploy\\." }],
141
- "promptTemplate": "Deploy detectado: {{payload.env}}",
158
+ "promptTemplate": "Deploy detected: {{payload.env}}",
142
159
  "deliverAs": "synthetic",
143
160
  "resume": true,
144
161
  "delivery": "steer",
@@ -151,57 +168,59 @@
151
168
 
152
169
 
153
170
  // --------------------------------------------------------------------------
154
- // browser — las tools browser.* contra un Chromium EXTERNO por CDP.
171
+ // browser — serves the browser.* tools against an EXTERNAL Chromium over CDP
172
+ // (Chrome DevTools Protocol).
155
173
  //
156
- // El plugin-browser del host ya registra esas tools, pero su attachment solo
157
- // existe si alguien se engancha (en un servidor sin app de escritorio está
158
- // vacío y todo falla con "browser is disconnected"). Este módulo se engancha
159
- // y las sirve contra un navegador real.
174
+ // OpenCode's browser plugin already registers those tools, but they only work
175
+ // when something attaches a browser. On a server without the desktop app
176
+ // nothing does, and every call fails with "browser is disconnected". This
177
+ // module attaches a real browser and serves them.
160
178
  //
161
179
  // mode:
162
- // "auto" (default) espera a que se lo pidan. Cero sorpresas.
163
- // "external" se engancha en cuanto detecta una sesión activa.
164
- // "in-app" no se engancha: deja servir a la app de escritorio.
180
+ // "auto" (default) and "external": attach only when asked to — by the
181
+ // agent (tool browser.target) or by you (/browser-target), never
182
+ // on every tool call. No surprises.
183
+ // "in-app" never attaches, and releases any attachment so the desktop
184
+ // app can serve the session.
165
185
  //
166
- // OJO con el conflicto: el protocolo admite UN attachment por sesión
167
- // (connection.ts:59 reemplaza al anterior). El plugin y la app Electron nunca
168
- // sirven la misma sesión a la vez; el que pierde ve "browser.disconnected".
169
- // Se cambia en caliente con la tool browser.target o /browser-target.
186
+ // MIND THE CONFLICT: the protocol allows ONE attachment per session (each
187
+ // attach replaces the previous one). The plugin and the Electron desktop app
188
+ // never serve the same session at once; the loser sees "browser.disconnected".
189
+ // Switch at runtime with the browser.target tool or /browser-target.
170
190
  //
171
- // cdpUrl: "auto" (lee DevToolsActivePort de los perfiles conocidos)
172
- // | "puerto" | "ws://host:puerto/ruta" | "wss://…" para remoto
173
- // profile: perfil explícito. "" = deducir. Pisar esto sobre
174
- // ai.opencode.desktop exige que la app Electron esté CERRADA: dos
175
- // procesos sobre el mismo user-data-dir corrompen el SQLite de cookies.
176
- // headers/caFile/insecureSkipVerify: para un wss:// remoto detrás de un proxy
177
- // inverso. El CDP nativo de Chrome no habla TLS ni pide cabeceras, así
178
- // que un navegador en otra máquina necesita túnel (ssh -L, tailscale,
179
- // cloudflared, nginx) delante.
191
+ // cdpUrl: "auto" (reads DevToolsActivePort from known profiles)
192
+ // | "port" | "ws://host:port/path" | "wss://…" for a remote browser
193
+ // profile: explicit profile directory. "" = detect. Pointing this at
194
+ // ai.opencode.desktop requires the Electron app to be CLOSED: two
195
+ // processes on the same user-data-dir corrupt the cookie SQLite.
196
+ // headers/caFile/insecureSkipVerify: for a remote wss:// behind a reverse
197
+ // proxy. Chrome's native CDP speaks neither TLS nor headers, so a
198
+ // browser on another machine needs a tunnel in front (ssh -L,
199
+ // tailscale, cloudflared, nginx).
180
200
  //
181
- // ESTO ES EL DEFAULT, NO LO ÚNICO. browser.target y /browser-target aceptan
182
- // un destino y mandan sobre la config, en caliente:
201
+ // THIS IS THE DEFAULT, NOT THE ONLY OPTION. browser.target and /browser-target
202
+ // accept a target and override the config at runtime:
183
203
  // browser.target({ mode: "external", cdpUrl: "9333" })
184
204
  // browser.target({ mode: "external", profile: "~/.config/google-chrome" })
185
205
  // /browser-target external 9333
186
206
  // /browser-target external wss://tunnel.example/devtools
187
- // Un destino que empieza por / o ~ es un perfil; el resto, URL o puerto.
188
- // Omitirlo NO lo cambia. Cambiarlo cierra el socket y suelta los
189
- // attachments; la sesión que lo cambió se reengancha en la misma llamada y
190
- // las demás lo piden de nuevo con browser.target o /browser-target (el
191
- // enganche es siempre a petición, nunca en cada tool call).
207
+ // A target starting with / or ~ is a profile; anything else is a URL or port.
208
+ // Omitting it keeps the current one. Changing it closes the socket and drops
209
+ // the attachments; the session that changed it re-attaches in the same call
210
+ // and the others ask again with browser.target or /browser-target.
192
211
  //
193
- // MODOS DE CHROME QUE IMPORTAN:
194
- // --remote-debugging-port → /json/version responde 200. INERTE sobre el
195
- // user-data-dir por defecto desde Chrome 136, así que necesita perfil
196
- // propio. Sin popup.
197
- // chrome://inspect/#remote-debugging (toggle) → /json/version da 404 POR
198
- // DISEÑO y la URL sale de DevToolsActivePort. Pide un popup "Allow remote
199
- // debugging?" POR CONEXIÓN. El socket se mantiene abierto, pero recargar
200
- // el plugin lo pide de nuevo.
212
+ // CHROME MODES THAT MATTER:
213
+ // --remote-debugging-port → /json/version answers 200. IGNORED on the
214
+ // default user-data-dir since Chrome 136, so it needs its own profile.
215
+ // No popup.
216
+ // chrome://inspect/#remote-debugging (toggle) → /json/version answers 404
217
+ // BY DESIGN and the URL comes from DevToolsActivePort. It shows an
218
+ // "Allow remote debugging?" popup FOR EACH CONNECTION. The socket stays
219
+ // open, but reloading the plugin asks again.
201
220
  //
202
- // Varios perfiles pueden declarar el mismo puerto (los ficheros quedan stale
203
- // al cerrar Chrome), así que se prueban en orden y gana el primero que
204
- // responde de verdad. Por eso conectar puede tardar.
221
+ // Several profiles can declare the same port (the files go stale when Chrome
222
+ // closes), so they are tried in order and the first that really answers
223
+ // wins. That is why connecting can take a while.
205
224
  // --------------------------------------------------------------------------
206
225
  "browser": {
207
226
  "mode": "auto",
@@ -216,27 +235,31 @@
216
235
 
217
236
 
218
237
  // --------------------------------------------------------------------------
219
- // advisor — decisiones de permiso mediante una sesión advisor dedicada.
238
+ // advisor — permission decisions made by a dedicated advisor session.
220
239
  //
221
- // El plugin define (upsert) el agente oculto "apex-advisor" con su propio
222
- // modelo y permisos: SOLO puede usar la herramienta apex_advisor_decide.
223
- // Existe UNA sesión advisor por ÁRBOL: la sesión agente-usuario (raíz) y todos
224
- // sus subagentes comparten la misma sesión advisor, que queda registrada
225
- // entera → auditoría completa de cada allow/deny.
240
+ // The plugin defines (upserts) the hidden agent "apex-advisor" with its own
241
+ // model and permissions: it can ONLY use the apex_advisor_decide tool.
242
+ // There is ONE advisor session per session TREE: your root session and all
243
+ // its subagents share it, and it is kept whole → a full audit trail of every
244
+ // allow/deny.
226
245
  //
227
- // Vocabulario: aprobar = "allow"; denegar = "deny" + reason.
228
- // model: modelo del agente advisor (rápido/barato; corre con contexto completo)
229
- // decisive: true = su decisión se aplica al permiso · false = solo informa
230
- // evaluate: "ask-only" (default) solo cuando tus reglas no resolvieron ·
231
- // "all" consulta en CADA tool call
232
- // timeoutMs: sin decisión a tiempo no se altera el permiso (no bloquea)
233
- // location: directorio de la sesión advisor. Por defecto uno dedicado FUERA
234
- // del proyecto: la discovery de instrucciones es por location, así
235
- // no se le inyecta el AGENTS.md del repo. (El AGENTS.md global de
236
- // ~/.config/opencode sí aplica siempre.)
237
- // actions: filtro de nombres de tool (vacío = todas)
238
- // system: system prompt del agente advisor (opcional)
239
- // promptTemplate: plantilla de la petición ({{requestID}}, {{action}}, {{resources}}…)
246
+ // Vocabulary: approve = "allow"; deny = "deny" + reason.
247
+ // model: the advisor's model (fast/cheap; it runs with full context)
248
+ // decisive: true = its decision is applied to the permission · false = advisory only
249
+ // (default false)
250
+ // evaluate: "ask-only" (default) only when your rules did not decide ·
251
+ // "all" consults it on EVERY tool call
252
+ // timeoutMs: no decision in time → the permission is left as it was (never blocks)
253
+ // (default 10000)
254
+ // location: directory of the advisor session. Default: a dedicated one
255
+ // OUTSIDE the project (<tmp>/opencode-apex-advisor). Instruction
256
+ // discovery is per location, so the repo's AGENTS.md is not
257
+ // injected. (The global AGENTS.md in ~/.config/opencode always applies.)
258
+ // actions: filter by tool name (empty = all)
259
+ // system: system prompt of the advisor agent (optional)
260
+ // promptTemplate: template of each request ({{requestID}}, {{action}}, {{resources}},
261
+ // {{sessionID}}, {{agent}}, {{enforcement}}, {{metadata.<field>}}). A single-line JSON
262
+ // string: write line breaks as \n.
240
263
  // --------------------------------------------------------------------------
241
264
  "advisor": {
242
265
  "model": "opencode/big-pickle",
@@ -245,12 +268,7 @@
245
268
  "timeoutMs": 10000,
246
269
  "location": "",
247
270
  "actions": [],
248
- "promptTemplate": "Solicitud {{requestID}}
249
- Tool: {{action}}
250
- Recursos: {{resources}}
251
- Sesión: {{sessionID}} ({{agent}})
252
- {{enforcement}}
253
- Decidí con apex_advisor_decide."
271
+ "promptTemplate": "Request {{requestID}}\nTool: {{action}}\nResources: {{resources}}\nSession: {{sessionID}} ({{agent}})\n{{enforcement}}\nDecide with apex_advisor_decide."
254
272
  }
255
273
 
256
274
  }
package/package.json CHANGED
@@ -1,12 +1,37 @@
1
1
  {
2
2
  "name": "opencode-apex",
3
- "version": "0.2.1",
4
- "description": "Modular monolithic plugin for OpenCode V2 — redaction, events, advisor permissions, guard meta-permissions, external browser over CDP",
5
- "type": "module",
6
- "main": "index.ts",
3
+ "version": "0.2.2",
4
+ "description": "Modular plugin for OpenCode V2 (>= 2.1): secret redaction, RPC callbacks/webhooks/watchers that wake agents, tools.run, AI permission advisor, guard meta-permissions, external browser over CDP",
5
+ "license": "MIT",
6
+ "author": "Antonio Orizondo Leyva",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/aorizondo/opencode-apex.git"
10
+ },
11
+ "homepage": "https://github.com/aorizondo/opencode-apex#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/aorizondo/opencode-apex/issues"
14
+ },
15
+ "keywords": [
16
+ "opencode",
17
+ "opencode-plugin",
18
+ "opencode-v2",
19
+ "plugin",
20
+ "redaction",
21
+ "secrets",
22
+ "webhooks",
23
+ "callbacks",
24
+ "rpc",
25
+ "automation",
26
+ "permissions",
27
+ "cdp",
28
+ "browser"
29
+ ],
7
30
  "engines": {
8
- "opencode": ">=2.0.0 <3"
31
+ "opencode": ">=2.1.0"
9
32
  },
33
+ "type": "module",
34
+ "main": "index.ts",
10
35
  "files": [
11
36
  "index.ts",
12
37
  "redact.ts",
@@ -19,7 +44,8 @@
19
44
  "docs",
20
45
  "opencode-apex.jsonc",
21
46
  "skills",
22
- "CHANGELOG.md"
47
+ "CHANGELOG.md",
48
+ "LICENSE"
23
49
  ],
24
50
  "dependencies": {
25
51
  "@opencode/plugin": "^2.1.1",
package/redact.ts CHANGED
@@ -57,6 +57,7 @@ export function createDefaultRedactConfig(): RedactConfig & { enabled: boolean }
57
57
  export interface CompiledRedact {
58
58
  readonly engine: RedactEngine
59
59
  readonly patterns: PatternDefinition[]
60
+ readonly allowlist: RegExp[]
60
61
  }
61
62
 
62
63
  export function compileRedactConfig(config: RedactConfig): CompiledRedact {
@@ -85,7 +86,7 @@ export function compileRedactConfig(config: RedactConfig): CompiledRedact {
85
86
  },
86
87
  })
87
88
 
88
- return { engine, patterns }
89
+ return { engine, patterns, allowlist }
89
90
  }
90
91
 
91
92
  // ---------------------------------------------------------------------------
@@ -99,18 +100,18 @@ export function register(
99
100
  return Effect.gen(function* () {
100
101
  if (!config.enabled) return
101
102
 
102
- const { engine, patterns } = compileRedactConfig(config)
103
+ const { engine, patterns, allowlist } = compileRedactConfig(config)
103
104
  const key = resolveKey(config.key).key
104
105
 
105
106
  // Motores precompilados para el RPC (evita recompilar y re-resolver la clave
106
107
  // en cada llamada).
107
108
  const rpcEngines = {
108
109
  strict: createRedactEngine({
109
- patterns, allowlist: [], prefix: config.prefix, suffix: config.suffix,
110
+ patterns, allowlist, prefix: config.prefix, suffix: config.suffix,
110
111
  key, mode: "strict", onFinding: (f) => rpcFindings.push({ pattern: f.pattern }),
111
112
  }),
112
113
  warn: createRedactEngine({
113
- patterns, allowlist: [], prefix: config.prefix, suffix: config.suffix,
114
+ patterns, allowlist, prefix: config.prefix, suffix: config.suffix,
114
115
  key, mode: "warn", onFinding: (f) => rpcFindings.push({ pattern: f.pattern }),
115
116
  }),
116
117
  }