oficina-opencode 3.0.5 → 3.1.1
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/README.md +240 -208
- package/commands/oficina.md +7 -6
- package/dashboard/.dom-check.html +1257 -0
- package/dashboard/README-DASHBOARD.md +64 -0
- package/dashboard/assets/factory.css +1543 -0
- package/dashboard/assets/tokens.css +208 -0
- package/dashboard/build-kanban-data.mjs +279 -0
- package/dashboard/dashboard.css +753 -0
- package/dashboard/dashboard.html +121 -0
- package/dashboard/dashboard.js +610 -0
- package/dashboard/data/snapshot.json +883 -0
- package/dashboard/debate.html +134 -0
- package/dashboard/factory/build-snapshot.mjs +89 -0
- package/dashboard/factory/factory-app.js +1185 -0
- package/dashboard/factory/factory-core.js +541 -0
- package/dashboard/factory/snapshot.js +850 -0
- package/dashboard/factory.html +350 -0
- package/dashboard/kanban-data.json +671 -0
- package/dashboard/kanban-source.js +643 -0
- package/dashboard/kanban.check.mjs +454 -0
- package/dashboard/kanban.html +1257 -0
- package/dashboard/leadership.html +1008 -0
- package/dashboard/lib/debate-app.js +1149 -0
- package/dashboard/lib/debate-core.js +698 -0
- package/dashboard/lib/debate-data.js +163 -0
- package/dashboard/lib/debate-demo.js +110 -0
- package/dashboard/lib/debate.css +1155 -0
- package/dashboard/lib/leadership-model.js +946 -0
- package/dashboard/probe.mjs +35 -0
- package/dashboard/scripts/serve.mjs +122 -0
- package/dashboard/scripts/snapshot-data.mjs +93 -0
- package/dashboard/scripts/snapshot.mjs +28 -0
- package/dashboard/server.mjs +242 -0
- package/dashboard/shot.mjs +54 -0
- package/dashboard/shots/desktop-gates.png +0 -0
- package/dashboard/shots/desktop-light.png +0 -0
- package/dashboard/shots/desktop-real.png +0 -0
- package/dashboard/shots/mobile.png +0 -0
- package/dashboard/test/factory-core.test.mjs +244 -0
- package/dashboard/tests/debate-core.test.mjs +336 -0
- package/dashboard/tests/leadership-model.test.mjs +404 -0
- package/dist/cli.js +148 -26
- package/dist/cli.js.map +1 -1
- package/dist/core/bus.js +3 -3
- package/dist/core/bus.js.map +1 -1
- package/dist/core/catalog.d.ts +9 -1
- package/dist/core/catalog.d.ts.map +1 -1
- package/dist/core/catalog.js +77 -2
- package/dist/core/catalog.js.map +1 -1
- package/dist/core/dashboard.d.ts +33 -0
- package/dist/core/dashboard.d.ts.map +1 -0
- package/dist/core/dashboard.js +115 -0
- package/dist/core/dashboard.js.map +1 -0
- package/dist/core/dispatch.d.ts +1 -1
- package/dist/core/dispatch.d.ts.map +1 -1
- package/dist/core/dispatch.js +84 -12
- package/dist/core/dispatch.js.map +1 -1
- package/dist/core/docsync.d.ts +0 -9
- package/dist/core/docsync.d.ts.map +1 -1
- package/dist/core/docsync.js +12 -15
- package/dist/core/docsync.js.map +1 -1
- package/dist/core/environment.d.ts +28 -0
- package/dist/core/environment.d.ts.map +1 -0
- package/dist/core/environment.js +80 -0
- package/dist/core/environment.js.map +1 -0
- package/dist/core/factory.d.ts +16 -0
- package/dist/core/factory.d.ts.map +1 -1
- package/dist/core/factory.js +143 -0
- package/dist/core/factory.js.map +1 -1
- package/dist/core/fsx.d.ts +20 -2
- package/dist/core/fsx.d.ts.map +1 -1
- package/dist/core/fsx.js +10 -6
- package/dist/core/fsx.js.map +1 -1
- package/dist/core/gates.d.ts +23 -1
- package/dist/core/gates.d.ts.map +1 -1
- package/dist/core/gates.js +83 -8
- package/dist/core/gates.js.map +1 -1
- package/dist/core/leases.d.ts.map +1 -1
- package/dist/core/leases.js +4 -1
- package/dist/core/leases.js.map +1 -1
- package/dist/core/mesa.d.ts +1 -6
- package/dist/core/mesa.d.ts.map +1 -1
- package/dist/core/mesa.js +1 -6
- package/dist/core/mesa.js.map +1 -1
- package/dist/core/office.d.ts +3 -29
- package/dist/core/office.d.ts.map +1 -1
- package/dist/core/office.js +77 -90
- package/dist/core/office.js.map +1 -1
- package/dist/core/paths.d.ts.map +1 -1
- package/dist/core/paths.js +6 -1
- package/dist/core/paths.js.map +1 -1
- package/dist/core/retry.d.ts +2 -8
- package/dist/core/retry.d.ts.map +1 -1
- package/dist/core/retry.js +3 -34
- package/dist/core/retry.js.map +1 -1
- package/dist/core/roster.js +3 -3
- package/dist/core/roster.js.map +1 -1
- package/dist/core/sandbox.d.ts +38 -1
- package/dist/core/sandbox.d.ts.map +1 -1
- package/dist/core/sandbox.js +119 -15
- package/dist/core/sandbox.js.map +1 -1
- package/dist/core/state.d.ts +2 -2
- package/dist/core/state.d.ts.map +1 -1
- package/dist/core/state.js +5 -33
- package/dist/core/state.js.map +1 -1
- package/dist/core/stores.d.ts +3 -13
- package/dist/core/stores.d.ts.map +1 -1
- package/dist/core/stores.js +8 -32
- package/dist/core/stores.js.map +1 -1
- package/dist/core/systemPrompt.d.ts.map +1 -1
- package/dist/core/systemPrompt.js +4 -1
- package/dist/core/systemPrompt.js.map +1 -1
- package/dist/core/tripwire.d.ts +22 -8
- package/dist/core/tripwire.d.ts.map +1 -1
- package/dist/core/tripwire.js +71 -26
- package/dist/core/tripwire.js.map +1 -1
- package/dist/core/types.d.ts +6 -14
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +11 -3
- package/dist/core/types.js.map +1 -1
- package/dist/hooks/scopeGuard.d.ts +15 -1
- package/dist/hooks/scopeGuard.d.ts.map +1 -1
- package/dist/hooks/scopeGuard.js +88 -73
- package/dist/hooks/scopeGuard.js.map +1 -1
- package/dist/tools/index.d.ts +9 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +29 -81
- package/dist/tools/index.js.bak +972 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/v1.d.ts.map +1 -1
- package/dist/v1.js +30 -36
- package/dist/v1.js.map +1 -1
- package/dist/v2.d.ts +5 -0
- package/dist/v2.d.ts.map +1 -1
- package/dist/v2.js +79 -46
- package/dist/v2.js.bak +517 -0
- package/dist/v2.js.map +1 -1
- package/docs/GARANTIAS.md +2 -2
- package/docs/PRUEBA-E2E.md +4 -4
- package/docs/QUE-ES.md +4 -5
- package/docs/SEGURIDAD-REPO.md +83 -0
- package/docs/assets/banner.svg +42 -0
- package/docs/catalog-facts.json +3 -3
- package/docs/superpowers/specs/2026-10-29-factory-skill-creator-and-remove-budget.md +182 -0
- package/package.json +14 -6
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Hardening del repo y de npm — cierre a maldades
|
|
2
|
+
|
|
3
|
+
Checklist operativa para que **nadie que no sea el mantenedor** pueda pushear,
|
|
4
|
+
publicar o borrar nada. Divide las medidas en lo que ya vive en el repo
|
|
5
|
+
(aplicado en archivos) y lo que se activa una vez en la web de GitHub y de npm.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Parte A — Ya aplicado en el repo
|
|
10
|
+
|
|
11
|
+
| Medida | Archivo | Qué cierra |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Revisión del owner obligatoria en todo el árbol | `.github/CODEOWNERS` | PRs que tocan código sin el visto bueno del owner |
|
|
14
|
+
| Superficie CI/seguridad/empaquetado con protección explícita | `.github/CODEOWNERS` | Manipulación de workflows, policy de seguridad o manifest |
|
|
15
|
+
| Dependabot semanal (npm + Actions) | `.github/dependabot.yml` | Dependencias y actions que quedan viejas; majors manuales a propósito |
|
|
16
|
+
| Publicación OIDC con provenance, environment protegido, sin token de larga vida | `.github/workflows/publish.yml` | Spoofing de publicación, robo de token, publicar algo que no pasó el suite |
|
|
17
|
+
| Corredor de verificación previa en el publish | `prepublishOnly` + workflow | Publicar typecheck/test/docs en rojo |
|
|
18
|
+
| Política de seguridad sin datos de contacto inventados | `SECURITY.md` | Reportes por canales no verificados |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Parte B — Activar una vez en GitHub (UI del repositorio)
|
|
23
|
+
|
|
24
|
+
Settings → Saltar al punto → clícalo y listo:
|
|
25
|
+
|
|
26
|
+
1. **Branch protection de `main`** (Settings → Branches → Add branch ruleset):
|
|
27
|
+
- ✅ *Require a pull request before merging* (1 revisión mínima).
|
|
28
|
+
- ✅ *Require review from Code Owners* — activa la CODEOWNERS de arriba.
|
|
29
|
+
- ✅ *Require status checks to pass before merging* con estos jobs:
|
|
30
|
+
`verify (ubuntu-latest, 24) · verify (ubuntu-latest, 22) · verify (windows-latest, 24) · verify (windows-latest, 22) · docs · smoke · install-verify`.
|
|
31
|
+
- ✅ *Require branches to be up to date before merging*.
|
|
32
|
+
- ✅ *Do not allow bypassing the above settings* (ni apps ni admins).
|
|
33
|
+
- ❌ **Nunca**: *Allow force pushes* · *Allow deletions*.
|
|
34
|
+
|
|
35
|
+
2. **Ruleset de tags** (Settings → Rules → Rulesets → New → Tag ruleset):
|
|
36
|
+
- Protege `v*`: solo el owner crea tags. Evita que un tag spurio dispare
|
|
37
|
+
publicidad falsa de versiones.
|
|
38
|
+
|
|
39
|
+
3. **Permisos de Actions** (Settings → Actions → General):
|
|
40
|
+
- ⛔ *Read and write permissions* → cambiar a **Read repository contents** por defecto.
|
|
41
|
+
- ✅ Requiere aprobación de colaboradores para workflows de PRs de primera vez.
|
|
42
|
+
- ✅ Alta del *GitHub Actions* no admite escalación: el token ahora no puede
|
|
43
|
+
pushear ni publicar aunque un agente se piratee.
|
|
44
|
+
|
|
45
|
+
4. **Secretos** (Settings → Secrets and variables):
|
|
46
|
+
- No necesitas `NPM_TOKEN` si configuras *Trusted Publishing* (punto C.3).
|
|
47
|
+
- Si igual la almacenas: granular (`oficina-opencode` únicamente), con 2FA
|
|
48
|
+
obligatoria y vencido corto mejor que eterno.
|
|
49
|
+
|
|
50
|
+
5. **Dependabot alerts + security notifications** (Settings → Security):
|
|
51
|
+
- ✅ Dependabot alerts · Code scanning (si se suma CodeQL luego) · Secret scanning.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Parte C — Activar una vez en npm (npmjs.com)
|
|
56
|
+
|
|
57
|
+
1. **2FA en la cuenta** (Account settings → Security): siempre, obligatoria.
|
|
58
|
+
2. **Package settings de `oficina-opencode`**:
|
|
59
|
+
- ✅ *Require two-factor authentication to publish or change settings* (ON — es el default ahora).
|
|
60
|
+
- Mantenedores: **solo el owner**. Cualquier colaboración va por PR, no por copropiedad del paquete.
|
|
61
|
+
3. **Trusted Publishing** (Package settings → Publishing access):
|
|
62
|
+
- Vincula el repo `SOCRAMbt/AI-OFFICE` con el workflow `.github/workflows/publish.yml`.
|
|
63
|
+
- Con esto la publicación usa OIDC: **no existe token que filtrar** y npm
|
|
64
|
+
firma la provenance (SLSA 3) del artefacto.
|
|
65
|
+
4. **Publicar siempre con provenance**:
|
|
66
|
+
```bash
|
|
67
|
+
npm publish --provenance
|
|
68
|
+
```
|
|
69
|
+
El workflow ya lo hace. Instaladores verosificables con
|
|
70
|
+
`npm view oficina-opencode dist.attestations`.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Verificación rápida del cierre
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# ¿Quién puede tocar main? → nadie sin PR del owner (Parte B.1)
|
|
78
|
+
# ¿Quién puede publicar? → solo el workflow OIDC del repo (Parte C.3)
|
|
79
|
+
# ¿Un PR de un extraño tocará CODEOWNERS? → GitHub lo exige en aprobación automática
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Si algo de la Parte B/C no está activado, el cierre técnico queda a medias:
|
|
83
|
+
los archivos del repo son la mitad grosera; los toggles de la web son la otra.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<svg width="1000" height="240" viewBox="0 0 1000 240" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="AI-OFFICE — una oficina de agentes para OpenCode">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="accent" x1="0" y1="0" x2="1000" y2="0" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop offset="0" stop-color="#7c3aed"/>
|
|
5
|
+
<stop offset="0.55" stop-color="#22a06b"/>
|
|
6
|
+
<stop offset="1" stop-color="#f59e0b"/>
|
|
7
|
+
</linearGradient>
|
|
8
|
+
<linearGradient id="heroText" x1="120" y1="60" x2="880" y2="160" gradientUnits="userSpaceOnUse">
|
|
9
|
+
<stop offset="0" stop-color="#f8fafc"/>
|
|
10
|
+
<stop offset="1" stop-color="#cbd5f5"/>
|
|
11
|
+
</linearGradient>
|
|
12
|
+
<pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">
|
|
13
|
+
<path d="M 40 0 L 0 0 0 40" stroke="#1c2333" stroke-width="1"/>
|
|
14
|
+
</pattern>
|
|
15
|
+
</defs>
|
|
16
|
+
|
|
17
|
+
<rect width="1000" height="240" rx="18" fill="#0b0f19"/>
|
|
18
|
+
<rect width="1000" height="240" rx="18" fill="url(#grid)" opacity="0.55"/>
|
|
19
|
+
<rect x="0.5" y="0.5" width="999" height="239" rx="17.5" stroke="#232b3e"/>
|
|
20
|
+
|
|
21
|
+
<!-- desk motif: a minimal "office" abstract -->
|
|
22
|
+
<g opacity="0.9">
|
|
23
|
+
<rect x="856" y="150" width="7" height="62" rx="3" fill="#22a06b"/>
|
|
24
|
+
<rect x="869" y="132" width="7" height="80" rx="3" fill="#7c3aed"/>
|
|
25
|
+
<rect x="882" y="164" width="7" height="48" rx="3" fill="#f59e0b"/>
|
|
26
|
+
<rect x="808" y="204" width="170" height="8" rx="4" fill="#1c2333"/>
|
|
27
|
+
<circle cx="823" cy="132" r="9" stroke="#3b4664" stroke-width="2"/>
|
|
28
|
+
<rect x="808" y="146" width="30" height="4" rx="2" fill="#2a3350"/>
|
|
29
|
+
</g>
|
|
30
|
+
|
|
31
|
+
<g opacity="0.65">
|
|
32
|
+
<circle cx="92" cy="196" r="3" fill="#7c3aed"/>
|
|
33
|
+
<circle cx="110" cy="196" r="3" fill="#22a06b"/>
|
|
34
|
+
<circle cx="128" cy="196" r="3" fill="#f59e0b"/>
|
|
35
|
+
</g>
|
|
36
|
+
|
|
37
|
+
<text x="72" y="104" font-family="'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="76" font-weight="800" letter-spacing="4" fill="url(#heroText)">AI-OFFICE</text>
|
|
38
|
+
<rect x="74" y="126" width="212" height="4" rx="2" fill="url(#accent)"/>
|
|
39
|
+
|
|
40
|
+
<text x="74" y="168" font-family="'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="23" fill="#9aa4b2">Una oficina de agentes para OpenCode donde el trabajo</text>
|
|
41
|
+
<text x="74" y="198" font-family="'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="23" fill="#9aa4b2">no se detiene cuando el modelo dice «terminé».</text>
|
|
42
|
+
</svg>
|
package/docs/catalog-facts.json
CHANGED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Plan: Factory Auto-Crea Skills Persistentes + Eliminación Total del Sistema de Coste/Límites
|
|
2
|
+
|
|
3
|
+
## Objetivo
|
|
4
|
+
1. **Factory → Skill Creator automático**: Cuando el despacho no encuentra match (cobertura < 30%), en vez de fabricar un rol efímero de corrida, **invoca la lógica de `agency-agent-creator` para generar un archivo de agente persistente** en `<projectRoot>/.opencode/agents/<slug>.md` con la plantilla de 10 secciones Agency-Agents, que queda disponible para futuras corridas y para invocación directa (`@oficina-...`).
|
|
5
|
+
2. **Catálogo vivo**: El catálogo de matching (`catalog.ts`) debe descubrir dinámicamente los agentes creados en `.opencode/agents/` e incluirlos en futuros despachos.
|
|
6
|
+
3. **Eliminar todo el sistema de coste/tokens/límites**: Borrar `cost.ts`, `oficina_cost`, `Budget`, `Limits` (maxCards, maxAgentCalls, maxSpawnsTotal, etc.), enforcement en `state.ts`, `dispatch.ts`, `office.ts`, `retry.ts`, `mesa.ts`, `docsync.ts`, `systemPrompt.ts`, `cli.ts`, `router.ts`, y tests asociados.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Archivos a modificar
|
|
11
|
+
|
|
12
|
+
### Fase 1: Eliminar sistema de coste/límites (breaking change)
|
|
13
|
+
|
|
14
|
+
| Archivo | Cambios |
|
|
15
|
+
|---|---|
|
|
16
|
+
| `src/core/types.ts` | Eliminar `Budget` interface, campos `maxCards`, `maxAgentCalls`, `maxSpawnsTotal` de `Limits`, campos `budget` de `OfficeState`, `Card` |
|
|
17
|
+
| `src/core/state.ts` | Eliminar validaciones de presupuesto en `validateState`, simplificar `migrateState` |
|
|
18
|
+
| `src/core/dispatch.ts` | Eliminar `maxAgents` de `DispatchOptions`, eliminar tracking de `budget`, eliminar checks de presupuesto |
|
|
19
|
+
| `src/core/office.ts` | Eliminar `Limits` import, eliminar checks de `maxCards`, simplificar constructor |
|
|
20
|
+
| `src/core/retry.ts` | Eliminar `hasBudget` o simplificar a siempre `ok: true` |
|
|
21
|
+
| `src/core/mesa.ts` | Eliminar display de presupuesto |
|
|
22
|
+
| `src/core/docsync.ts` | Eliminar `maxCards` de `CatalogFacts`, eliminar display de límites |
|
|
23
|
+
| `src/core/systemPrompt.ts` | Eliminar presupuesto del prompt |
|
|
24
|
+
| `src/core/router.ts` | Eliminar `delegateBudget` defaults |
|
|
25
|
+
| `src/core/factory.ts` | Eliminar `delegateBudget` de `FactoryInput` |
|
|
26
|
+
| `src/cli.ts` | Eliminar display de presupuesto en `status`, eliminar flags de presupuesto en comandos |
|
|
27
|
+
| `src/tools/index.ts` | Eliminar tool `oficina_cost`, eliminar imports de `cost.ts` |
|
|
28
|
+
| `src/core/cost.ts` | **ELIMINAR ARCHIVO COMPLETO** |
|
|
29
|
+
|
|
30
|
+
### Fase 2: Factory crea agentes persistentes (skill creator automático)
|
|
31
|
+
|
|
32
|
+
| Archivo | Cambios |
|
|
33
|
+
|---|---|
|
|
34
|
+
| `src/core/factory.ts` | Nueva función `createPersistentAgentSkill()` que genera el archivo `.md` en `.opencode/agents/` usando la plantilla 10-secciones de agency-agent-creator |
|
|
35
|
+
| `src/core/dispatch.ts` | En `instantiateFactory`: en vez de crear `Ficha` runtime, llamar a `createPersistentAgentSkill()`, guardar archivo, y registrar en catálogo dinámico |
|
|
36
|
+
| `src/core/catalog.ts` | Nueva función `loadDynamicAgents()` que escanea `.opencode/agents/` y parsea capabilities del frontmatter/cuerpo |
|
|
37
|
+
| `src/core/catalog.ts` | `buildPanel` y `resolveRole` deben incluir agentes dinámicos en el catálogo |
|
|
38
|
+
| `src/core/office.ts` | Cargar catálogo dinámico al inicializar |
|
|
39
|
+
|
|
40
|
+
### Fase 3: Tests y limpieza
|
|
41
|
+
|
|
42
|
+
| Archivo | Cambios |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `tests/*.test.ts` | Actualizar tests que dependen de budget/cost/factory vieja |
|
|
45
|
+
| `tests/dispatch.test.ts` | Tests nuevos para factory persistente + catálogo vivo |
|
|
46
|
+
| `tests/catalog.test.ts` | Tests para matching con agentes dinámicos |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Detalle técnico: Factory persistente
|
|
51
|
+
|
|
52
|
+
### Plantilla del agente (basada en agency-agent-creator)
|
|
53
|
+
|
|
54
|
+
El archivo generado en `.opencode/agents/<slug>.md`:
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
---
|
|
58
|
+
name: {{display_name}}
|
|
59
|
+
description: {{one_line_description}}
|
|
60
|
+
vibe: {{curated_vibe_mindset}}
|
|
61
|
+
mode: subagent
|
|
62
|
+
permission:
|
|
63
|
+
edit: allow
|
|
64
|
+
shell: allow
|
|
65
|
+
task: allow
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
# {{display_name}} Agent Personality
|
|
69
|
+
|
|
70
|
+
You are **{{display_name}}**, a specialist in {{capabilities_list}} focused on {{mission_phrase}}.
|
|
71
|
+
|
|
72
|
+
## Your Identity & Memory
|
|
73
|
+
- **Role**: Specialist in {{primary_domain}} with deep expertise in {{key_technologies}}.
|
|
74
|
+
- **Personality**: Direct, pragmatic, and detail-oriented.
|
|
75
|
+
- **Memory**: Durable disk artifacts and communication logs; never hidden session memory.
|
|
76
|
+
- **Experience**: Edge cases, error recovery, and security boundaries.
|
|
77
|
+
|
|
78
|
+
## Your Core Mission
|
|
79
|
+
### {{Mission_1_Title}}
|
|
80
|
+
{{Mission_1_Description}}
|
|
81
|
+
|
|
82
|
+
## Critical Rules You Must Follow
|
|
83
|
+
1. Scope is a hard boundary, not a suggestion. Touch only authorized files.
|
|
84
|
+
2. No evidence, no work. Claims without command output (evidence.md) are hypotheses.
|
|
85
|
+
3. Never review or approve your own work.
|
|
86
|
+
4. Ask before guessing via the office bus (oficina_bus).
|
|
87
|
+
5. Acknowledge omissions and gaps explicitly in handoff.md.
|
|
88
|
+
|
|
89
|
+
## Your Technical Deliverables
|
|
90
|
+
- Clean code within assigned scope.
|
|
91
|
+
- handoff.md: Technical summary and decisions.
|
|
92
|
+
- evidence.md: Verbatim terminal output with exit codes.
|
|
93
|
+
|
|
94
|
+
## Your Workflow Process
|
|
95
|
+
### Step 1: Understand the Terrain
|
|
96
|
+
### Step 2: Decide the Approach
|
|
97
|
+
### Step 3: Execute Within Scope
|
|
98
|
+
### Step 4: Verify and Hand Off
|
|
99
|
+
|
|
100
|
+
## Your Communication Style
|
|
101
|
+
Direct, structured triage of incoming bus requests, zero ambiguity.
|
|
102
|
+
|
|
103
|
+
## Learning & Memory
|
|
104
|
+
Avoid domain-specific failure modes: {{failure_modes_list}}.
|
|
105
|
+
|
|
106
|
+
## Your Success Metrics
|
|
107
|
+
1. All acceptance criteria satisfied with verifiable evidence.
|
|
108
|
+
2. Gates (build, typecheck, test, security) exit 0.
|
|
109
|
+
3. Zero out-of-scope files touched.
|
|
110
|
+
|
|
111
|
+
## Advanced Capabilities
|
|
112
|
+
{{capability_tokens_space_separated}}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Extracción de capabilities para matching
|
|
116
|
+
|
|
117
|
+
El catálogo necesita leer `capabilities` del agente. Opciones:
|
|
118
|
+
- **Frontmatter**: agregar `capabilities: [token1, token2, ...]` al YAML
|
|
119
|
+
- **Parsing del cuerpo**: extraer de "Advanced Capabilities" o "Your Core Mission"
|
|
120
|
+
- **Archivo sidecar**: `<slug>.capabilities.json` (más robusto)
|
|
121
|
+
|
|
122
|
+
**Decisión**: Agregar `capabilities` al frontmatter YAML como array. El parser del catálogo lo lee directamente.
|
|
123
|
+
|
|
124
|
+
### Catálogo dinámico
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
// En catalog.ts
|
|
128
|
+
export interface DynamicAgent {
|
|
129
|
+
slug: string
|
|
130
|
+
displayName: string
|
|
131
|
+
description: string
|
|
132
|
+
capabilities: string[]
|
|
133
|
+
division: string // inferida del slug o "factory"
|
|
134
|
+
path: string // ruta al archivo .md
|
|
135
|
+
source: "dynamic"
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export async function loadDynamicAgents(projectRoot: string): Promise<DynamicAgent[]> {
|
|
139
|
+
const agentsDir = path.join(projectRoot, ".opencode", "agents")
|
|
140
|
+
// leer todos los .md, parsear frontmatter, extraer capabilities
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`buildPanel` recibe `catalog: CatalogAgent[]` + `dynamicAgents: DynamicAgent[]` y los mezcla para matching.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Orden de ejecución
|
|
149
|
+
|
|
150
|
+
1. **Eliminar cost.ts** y tool `oficina_cost` (aislado, bajo riesgo)
|
|
151
|
+
2. **Eliminar Budget/Limits** de types.ts y state.ts (core, alto riesgo - tests fallen)
|
|
152
|
+
3. **Eliminar budget checks** de dispatch.ts, office.ts, retry.ts, mesa.ts, docsync.ts, systemPrompt.ts, router.ts, factory.ts, cli.ts
|
|
153
|
+
4. **Tests**: arreglar tests rotos por eliminación de budget
|
|
154
|
+
5. **Factory persistente**: nueva función en factory.ts + modificar instantiateFactory en dispatch.ts
|
|
155
|
+
6. **Catálogo dinámico**: loadDynamicAgents en catalog.ts + integración en buildPanel/resolveRole
|
|
156
|
+
7. **Tests nuevos** para factory persistente + catálogo vivo
|
|
157
|
+
8. **Verificación**: `npm run typecheck && npm test` → todo verde
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Criterios de aceptación
|
|
162
|
+
|
|
163
|
+
- [ ] `npm run typecheck` exit 0
|
|
164
|
+
- [ ] `npm test` 100% passed (tests existentes adaptados + nuevos)
|
|
165
|
+
- [ ] `oficina_cost` ya no existe (tool removida)
|
|
166
|
+
- [ ] No hay referencias a `maxCards`, `maxAgentCalls`, `maxSpawnsTotal`, `Budget` en el código (excepto migración v1→v2)
|
|
167
|
+
- [ ] Dispatch sin match (<30%) crea archivo en `.opencode/agents/<slug>.md` con plantilla completa
|
|
168
|
+
- [ ] El agente creado aparece en futuros `oficina_dispatch` como candidato de matching
|
|
169
|
+
- [ ] El agente creado es invocable directamente como `@oficina-<slug>`
|
|
170
|
+
- [ ] `.opencode/agents/` está en `.gitignore` (ya está) pero los archivos generados son parte del repo para persistencia
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Riesgos y mitigaciones
|
|
175
|
+
|
|
176
|
+
| Riesgo | Mitigación |
|
|
177
|
+
|---|---|
|
|
178
|
+
| Tests rotos masivamente por eliminación de Budget | Ejecutar tests tras cada archivo modificado; fixes incrementales |
|
|
179
|
+
| Catálogo dinámico no detecta cambios en caliente | `loadDynamicAgents` se llama en cada `dispatchOffice` (no cacheado agresivamente) |
|
|
180
|
+
| Parsing de frontmatter frágil | Usar regex simple o librería `gray-matter` si ya está en deps; sino regex robusto |
|
|
181
|
+
| Agentes dinámicos sin `capabilities` en frontmatter | Validar en `createPersistentAgentSkill` que el frontmatter incluya `capabilities` |
|
|
182
|
+
| Migración de state v1→v2 rompe | `migrateState` ya maneja defaults; solo quitar campos de budget |
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oficina-opencode",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Oficina de Agents — malla de coordinadores + peer mesh para OpenCode. Orquestación durable de subagentes con bus de mensajes en disco, roster de roles, leases, gates de calidad y escalamiento por invariantes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": ">=
|
|
8
|
+
"node": ">=22"
|
|
9
9
|
},
|
|
10
10
|
"main": "./dist/v2.js",
|
|
11
11
|
"types": "./dist/v2.d.ts",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"skills",
|
|
32
32
|
"agents",
|
|
33
33
|
"commands",
|
|
34
|
+
"dashboard",
|
|
34
35
|
"docs",
|
|
35
36
|
"examples",
|
|
36
37
|
"DESIGN.md",
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
"cli",
|
|
53
54
|
"ai"
|
|
54
55
|
],
|
|
55
|
-
"author": "
|
|
56
|
+
"author": "SOCRAMbt <noreply@github.com>",
|
|
56
57
|
"repository": {
|
|
57
58
|
"type": "git",
|
|
58
59
|
"url": "git+https://github.com/SOCRAMbt/AI-OFFICE.git"
|
|
@@ -73,6 +74,7 @@
|
|
|
73
74
|
"test:watch": "vitest",
|
|
74
75
|
"coverage": "npm run build && vitest run --coverage",
|
|
75
76
|
"prepublishOnly": "npm run typecheck && npm run test && npm run build && npm run docs:check",
|
|
77
|
+
"dashboard": "node dashboard/server.mjs",
|
|
76
78
|
"docs:sync": "tsx scripts/sync-docs.ts",
|
|
77
79
|
"docs:check": "tsx scripts/sync-docs.ts --check",
|
|
78
80
|
"bench:selection": "tsx benchmarks/selection/run.ts",
|
|
@@ -80,7 +82,7 @@
|
|
|
80
82
|
},
|
|
81
83
|
"dependencies": {
|
|
82
84
|
"@opencode/plugin": "^2.1.2",
|
|
83
|
-
"zod": "4.
|
|
85
|
+
"zod": "^4.6.7"
|
|
84
86
|
},
|
|
85
87
|
"peerDependencies": {
|
|
86
88
|
"@opencode-ai/plugin": "^1.15.11"
|
|
@@ -91,12 +93,18 @@
|
|
|
91
93
|
}
|
|
92
94
|
},
|
|
93
95
|
"devDependencies": {
|
|
96
|
+
"@opencode-ai/plugin": "^1.19.5",
|
|
94
97
|
"@opencode/client": "^2.1.2",
|
|
95
98
|
"@opencode/plugin": "^2.1.2",
|
|
96
99
|
"@types/node": "^24.12.2",
|
|
97
|
-
"@vitest/coverage-v8": "^
|
|
100
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
101
|
+
"playwright": "^1.64.1",
|
|
98
102
|
"tsx": "^4.20.3",
|
|
99
103
|
"typescript": "^5.8.2",
|
|
100
|
-
"vitest": "^
|
|
104
|
+
"vitest": "^5.0.5"
|
|
105
|
+
},
|
|
106
|
+
"overrides": {
|
|
107
|
+
"toml": "^5.0.1",
|
|
108
|
+
"effect": "^4.0.0-rc.118"
|
|
101
109
|
}
|
|
102
110
|
}
|