@jmanuelcorral/bond-app 0.1.3 → 0.1.5
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 +41 -1
- package/app/mods/bond-agents/config.js +4 -0
- package/app/mods/bond-agents/main.js +10 -5
- package/app/mods/bond-agents/model.js +52 -4
- package/app/mods/bond-board/config.js +4 -0
- package/app/mods/bond-board/main.js +555 -84
- package/app/mods/bond-board/model.js +115 -2
- package/app/mods/bond-settings/config.js +4 -0
- package/app/mods/bond-settings/main.js +689 -12
- package/app/mods/bond-settings/pi-models.js +144 -0
- package/app/mods/bond-status/config.js +4 -0
- package/app/mods/bond-titlebar/main.js +63 -46
- package/package.json +1 -1
- package/runner/Dockerfile +42 -13
- package/runner/SPIKE-BOND.md +85 -0
- package/runner/build-config/.none +0 -0
- package/runner/build-creds/.none +0 -0
- package/runner/config.example/README.md +27 -0
- package/runner/config.example/pi/models.json +22 -0
- package/runner/credentials.example.env +27 -0
- package/runner/setup.sh +496 -0
- package/runner/versions.env +30 -0
- package/scripts/app-install.ts +38 -7
- package/src/config.ts +11 -0
- package/src/core/delivery.ts +61 -7
- package/src/core/hub-session.ts +154 -17
- package/src/core/hub.ts +55 -20
- package/src/core/orchestrator.ts +844 -200
- package/src/core/setup.ts +178 -0
- package/src/core/watchdog.ts +2 -2
- package/src/db/database.ts +14 -0
- package/src/db/run-repo.ts +8 -1
- package/src/db/settings-repo.ts +108 -0
- package/src/db/ticket-repo.ts +34 -4
- package/src/runner/docker-client.ts +42 -0
- package/src/runner/github-client.ts +126 -2
- package/src/runner/hc-client.ts +67 -9
- package/src/runner/image-builder.ts +146 -6
- package/src/server/app.ts +263 -36
- package/src/types.ts +40 -0
package/README.md
CHANGED
|
@@ -10,7 +10,9 @@ Orquestador local de runs en hub-contenedores Docker, con herdr-app como interfa
|
|
|
10
10
|
lanzar y cancelar runs, selección de tarjeta para enfocar la consola inferior de herdr-app
|
|
11
11
|
con la sesión activa (`terminal.show`), crear tickets con historia enlazada (GitHub issue),
|
|
12
12
|
diálogo de borrado con comprobación de integración de rama remota, contadores y filtros.
|
|
13
|
-
`bond-settings` es el panel plegable de Ajustes (
|
|
13
|
+
`bond-settings` es el panel plegable de Ajustes: panel «Configuración» (estado del setup,
|
|
14
|
+
«Reabrir asistente»), credenciales de agentes, GitHub y «Rebuild», y la vista del asistente
|
|
15
|
+
de primera configuración (`view: "wizard"`, W-P2).
|
|
14
16
|
`bond-titlebar` es la barra de título propia: logo de bond, botones Agentes y Ajustes,
|
|
15
17
|
arrastrable, con minimizar, maximizar y cerrar en Linux y Windows. `bond-status` es la barra
|
|
16
18
|
de estado: API, GitHub, versiones y runs activos. Todo vive en `app/` y se instala con un
|
|
@@ -32,6 +34,42 @@ hay credencial y su login). Lanzar un run no pide token: usa ese, que llega al c
|
|
|
32
34
|
por stdin. Sin credencial, el lanzamiento se rechaza y el diálogo lo dice. Si gh no tiene
|
|
33
35
|
sesión, «Iniciar sesión» abre una pestaña con `gh auth login --web`.
|
|
34
36
|
|
|
37
|
+
**Estado de configuración (W-P1, wizard):** `GET /api/v1/setup` responde el agregado
|
|
38
|
+
`{ complete, setup_done, agents_selected, agents: [{agent, configured}], github:
|
|
39
|
+
{configured, login}, image: {present, agents?}, suggestions_model }`: la selección de
|
|
40
|
+
agentes y si el asistente
|
|
41
|
+
ya terminó (`setup_done`, solo se escribe con `PUT /api/v1/setup`), si cada agente del script
|
|
42
|
+
de imagen (pi, claude, codex, copilot, agy — D-W3) tiene credencial, la sesión de gh y el
|
|
43
|
+
estado de la imagen runner (`docker image inspect`; los agentes horneados salen del manifiesto
|
|
44
|
+
`/opt/runner-agents` cuando existe). `complete` es gh con credencial + al menos un agente con
|
|
45
|
+
credencial + imagen presente; se recalcula en cada llamada, sin reiniciar. `PUT /api/v1/setup`
|
|
46
|
+
valida `agents_selected` (solo esos cinco; desconocido → 400), `setup_done` y
|
|
47
|
+
`suggestions_model` (id de string o null, validación laxa); nunca viajan
|
|
48
|
+
credenciales por aquí. El agregado no contiene secretos (D13).
|
|
49
|
+
|
|
50
|
+
**Asistente de configuración (W-P2):** al cargar el tablero, si `GET /setup` dice
|
|
51
|
+
`!complete && !setup_done`, `bond-board` abre una vez por sesión el overlay del asistente en
|
|
52
|
+
`bond-settings`: paso 1 multiselección de los cinco agentes (se guarda con `PUT /setup`),
|
|
53
|
+
paso 2 credenciales por agente elegido (el diálogo existente; «Finalizar» exige al menos una),
|
|
54
|
+
paso 3 el bloque de gh tal cual, paso 4 estado de la imagen y rebuild — plano, anotado en
|
|
55
|
+
pantalla, porque `/system/rebuild` aún no acepta la lista de agentes (P2 del plan de la
|
|
56
|
+
imagen, no aceptada); al aceptarse, el paso enviará la selección. «Finalizar» escribe
|
|
57
|
+
`setup_done` y el asistente no vuelve a salir; Esc lo cierra sin perder nada (todo vive en el
|
|
58
|
+
orquestador). Ajustes muestra la sección «Configuración» con los huecos concretos y el botón
|
|
59
|
+
«Reabrir asistente» siempre visible (D-W2).
|
|
60
|
+
|
|
61
|
+
**Modelos y sugerencias en el asistente (W-P4):** en el formulario de pi nadie teclea ids de
|
|
62
|
+
modelos: «Cargar del provider» pide al orquestador hacer de proxy —`POST /setup/models
|
|
63
|
+
{base_url, api_key?}` hace `GET {base}/models` con timeout, la clave solo viaja en el body de
|
|
64
|
+
esa petición y no se registra ni se devuelve— y los ids salen como multiselector de
|
|
65
|
+
checkboxes; solo los marcados entran en el models.json, y si la red falla la entrada manual
|
|
66
|
+
sigue operativa. Entre los marcados se elige el de «sugerencias» (heurística estilo bond
|
|
67
|
+
setup: gratis → nombre barato → primero, o «sin sugerencias» = null), que viaja con
|
|
68
|
+
`PUT /setup { suggestions_model }`. El orquestador lo inyecta por run de pi como
|
|
69
|
+
`~/.pi/agent/supi/config.json` junto al models.json (misma home del agente hub incluido); el
|
|
70
|
+
paquete supi solo vendrá en la imagen con la P2 del plan de la imagen, pendiente: hasta entonces
|
|
71
|
+
la elección se guarda y queda inactiva.
|
|
72
|
+
|
|
35
73
|
**Fin del run y entrega (P7):** el run pasa de `running` a **Finished** cuando el agente
|
|
36
74
|
termina con código 0, o por entrega explícita. El contenedor Docker y la sesión de herdr
|
|
37
75
|
permanecen vivos. La entrega (crear PR) ya no es automática: el usuario la solicita a través
|
|
@@ -60,6 +98,8 @@ borrar la rama remota `feat/<ticket>`, el orquestador comprueba contra GitHub si
|
|
|
60
98
|
ya fue integrada (merged) en la rama base (`main`); si no está integrada, la UI advierte al
|
|
61
99
|
usuario y requiere pulsar «Borrar igualmente» para forzar la eliminación remota.
|
|
62
100
|
|
|
101
|
+
**Bondificación automática de repos en el run (P4, D-U):** si el repo clonado de un run no está bondificado (no existe `/workspace/repo/.bond/bond.toml`) y el ticket tiene `bondify !== false` (activo por defecto en tickets y con checkbox en el diálogo «Nuevo ticket»), el orquestador ejecuta en el contenedor `bond init --yes --agents <ticket.agent>` antes de resolver el comando del agente y commitea el resultado con `git -c user.name=bond-app -c user.email=bond-app@localhost commit -m "chore: bond init"`. Al estar `/workspace` ya incluido con confianza en `/home/runner/.pi/agent/trust.json` en la imagen runner (`runner/Dockerfile` y `runner/pi-trust.json`), cualquier ruta bajo `/workspace/repo` hereda la confianza de proyecto de forma no interactiva (por resolución de la carpeta superior más cercana en pi y bond), garantizando que `pi` cargue las Bond Extensions y `.pi/` automáticamente sin diálogo interactivo de confirmación. Si el repo ya está bondificado no se toca nada; si `bond init` o el commit fallan, se registra el evento y el run continúa con el fallback pelado sin fallar.
|
|
102
|
+
|
|
63
103
|
### Correspondencia entre estados del run y columnas del tablero (P7)
|
|
64
104
|
|
|
65
105
|
El tablero de `bond-board` organiza las tarjetas en cinco columnas de ancho fijo. Cada estado interno del run (`RunState`) mapea a una columna:
|
|
@@ -5,4 +5,8 @@ export const CONFIG = {
|
|
|
5
5
|
api: "http://127.0.0.1:3000/api/v1",
|
|
6
6
|
// null: ~/.bond-app/token (the orchestrator's default data dir)
|
|
7
7
|
tokenFile: null,
|
|
8
|
+
// Gasto/costes fuera por defecto (decisión 2026-11-19): el orquestador sigue
|
|
9
|
+
// registrando cost_usd, pero la UI no lo muestra hasta que una configuración
|
|
10
|
+
// en Ajustes lo active. Entonces esto será el valor de esa configuración.
|
|
11
|
+
costs: false,
|
|
8
12
|
};
|
|
@@ -93,8 +93,8 @@ export default class BondAgents extends View {
|
|
|
93
93
|
const label = String(row.style?.label ?? "Desconocido");
|
|
94
94
|
const ahead = String(row.aheadLabel ?? "-");
|
|
95
95
|
const files = String(row.filesLabel ?? "-");
|
|
96
|
-
const isLeader = agentName === "hub leader" || repoLabel === "orquestador" || row.agent?.name === "hub leader" || row.path === "/workspace/hub";
|
|
97
|
-
const roleTag = isLeader ? "
|
|
96
|
+
const isLeader = agentName === "hub leader" || agentName === "Orquestador" || repoLabel === "orquestador" || row.agent?.name === "hub leader" || row.agent?.name === "Orquestador" || row.path === "/workspace/hub";
|
|
97
|
+
const roleTag = isLeader ? "Orquestador" : "Worker";
|
|
98
98
|
const rowBorder = isLeader ? (t.bond_indigo ?? t.accent) : t.border;
|
|
99
99
|
const initials = isLeader ? "👑" : agentName.slice(0, 2).toUpperCase();
|
|
100
100
|
|
|
@@ -410,7 +410,12 @@ export default class BondAgents extends View {
|
|
|
410
410
|
this.teamStatusByRun,
|
|
411
411
|
this.selectedTicketId
|
|
412
412
|
);
|
|
413
|
+
const hasRun = Boolean(sections[0]?.run);
|
|
413
414
|
const activeCount = sections[0]?.rows?.length ?? 0;
|
|
415
|
+
const pillText = hasRun
|
|
416
|
+
? (activeCount > 0 ? `${activeCount} ${activeCount === 1 ? "activo" : "activos"}` : "1 activo")
|
|
417
|
+
: "Sin run activo";
|
|
418
|
+
const pillActive = hasRun;
|
|
414
419
|
|
|
415
420
|
return v_flex()
|
|
416
421
|
.id("bond-agents")
|
|
@@ -450,12 +455,12 @@ export default class BondAgents extends View {
|
|
|
450
455
|
.rounded(12)
|
|
451
456
|
.bg(t.raised)
|
|
452
457
|
.border_1()
|
|
453
|
-
.border_color(
|
|
458
|
+
.border_color(pillActive ? (t.bond_indigo ?? t.accent) : t.border)
|
|
454
459
|
.text_size(UI.text.tiny)
|
|
455
460
|
.font_family("JetBrains Mono")
|
|
456
461
|
.font_semibold()
|
|
457
|
-
.text_color(
|
|
458
|
-
.child(
|
|
462
|
+
.text_color(pillActive ? (t.bond_indigo ?? t.accent) : t.dim)
|
|
463
|
+
.child(pillText)
|
|
459
464
|
)
|
|
460
465
|
.child(
|
|
461
466
|
div()
|
|
@@ -22,6 +22,10 @@ export const STATE_STYLES = {
|
|
|
22
22
|
"idle-waiting": { icon: "⏳", label: "En espera", tone: "blocked" },
|
|
23
23
|
working: { icon: "🔄", label: "Trabajando", tone: "working" },
|
|
24
24
|
blocked: { icon: "⛔", label: "Bloqueado", tone: "blocked" },
|
|
25
|
+
arrancando: { icon: "🚀", label: "Arrancando", tone: "working" },
|
|
26
|
+
live: { icon: "⚡", label: "Live", tone: "working" },
|
|
27
|
+
idle: { icon: "💤", label: "Idle", tone: "dim" },
|
|
28
|
+
"sin estado": { icon: "•", label: "Sin estado", tone: "dim" },
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
export function stateInfo(state) {
|
|
@@ -39,7 +43,7 @@ export function formatFiles(files) {
|
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
export function repoDisplayName(row, ticket) {
|
|
42
|
-
if (row?.agent?.name === "hub leader" || row?.path === "/workspace/hub") {
|
|
46
|
+
if (row?.agent?.name === "hub leader" || row?.path === "/workspace/hub" || row?.repo === "orquestador") {
|
|
43
47
|
return row?.repo || "orquestador";
|
|
44
48
|
}
|
|
45
49
|
if (row?.repo && row.repo !== ".") return String(row.repo);
|
|
@@ -74,7 +78,48 @@ export function buildAgentsSections(runs, tickets, selectedRunId, teamStatusByRu
|
|
|
74
78
|
|
|
75
79
|
if (targetRun) {
|
|
76
80
|
const ticket = ticketMap.get(targetRun.ticket_id) || null;
|
|
77
|
-
|
|
81
|
+
let rows = teamStatusByRun?.[targetRun.id] || [];
|
|
82
|
+
|
|
83
|
+
// Fallback if rows is empty (e.g. while API request is in flight)
|
|
84
|
+
if (rows.length === 0) {
|
|
85
|
+
let state = "sin estado";
|
|
86
|
+
let status = "sin estado";
|
|
87
|
+
let question = undefined;
|
|
88
|
+
if (targetRun.state === "queued" || targetRun.state === "ready") {
|
|
89
|
+
state = "arrancando";
|
|
90
|
+
status = "arrancando";
|
|
91
|
+
} else if (targetRun.state === "waiting") {
|
|
92
|
+
state = "en espera";
|
|
93
|
+
status = "en espera";
|
|
94
|
+
question = targetRun.failure_reason || undefined;
|
|
95
|
+
} else if (targetRun.state === "running") {
|
|
96
|
+
state = "arrancando";
|
|
97
|
+
status = "arrancando";
|
|
98
|
+
} else if (targetRun.state === "finished") {
|
|
99
|
+
state = "lista";
|
|
100
|
+
status = "finished";
|
|
101
|
+
} else if (targetRun.state === "failed") {
|
|
102
|
+
state = "bloqueado";
|
|
103
|
+
status = "failed";
|
|
104
|
+
}
|
|
105
|
+
rows = [{
|
|
106
|
+
branch: ticket?.target_branch || "",
|
|
107
|
+
path: ticket?.mode === "hub" ? "/workspace/hub" : "/workspace/repo",
|
|
108
|
+
repo: "orquestador",
|
|
109
|
+
state,
|
|
110
|
+
ahead: 0,
|
|
111
|
+
files: [],
|
|
112
|
+
dirty: 0,
|
|
113
|
+
integrated: false,
|
|
114
|
+
agent: {
|
|
115
|
+
name: ticket?.mode === "hub" ? "hub leader" : (ticket?.agent || "pi"),
|
|
116
|
+
kind: ticket?.agent || "pi",
|
|
117
|
+
status,
|
|
118
|
+
question,
|
|
119
|
+
pane: targetRun.hc_terminal || (targetRun.hc_machine ? `${targetRun.hc_machine}/t1` : null),
|
|
120
|
+
},
|
|
121
|
+
}];
|
|
122
|
+
}
|
|
78
123
|
|
|
79
124
|
return [{
|
|
80
125
|
run: targetRun,
|
|
@@ -84,11 +129,14 @@ export function buildAgentsSections(runs, tickets, selectedRunId, teamStatusByRu
|
|
|
84
129
|
state: targetRun.state,
|
|
85
130
|
rows: rows.map((r) => {
|
|
86
131
|
const agent = r?.agent || {};
|
|
87
|
-
const stateKey = agent.status === "idle-waiting"
|
|
132
|
+
const stateKey = agent.status === "idle-waiting" || agent.status === "en espera" || r?.state === "en espera"
|
|
133
|
+
? "en espera"
|
|
134
|
+
: (r?.state || agent.status || "desconocido");
|
|
135
|
+
const agentStatus = agent.status === "idle-waiting" ? "en espera" : (agent.status || r?.state || "desconocido");
|
|
88
136
|
return {
|
|
89
137
|
...r,
|
|
90
138
|
agentName: agent.name || agent.kind || "agente",
|
|
91
|
-
agentStatus
|
|
139
|
+
agentStatus,
|
|
92
140
|
pane: agent.pane ?? null,
|
|
93
141
|
question: agent.question ?? null,
|
|
94
142
|
aheadLabel: formatAhead(r?.ahead),
|
|
@@ -5,4 +5,8 @@ export const CONFIG = {
|
|
|
5
5
|
api: "http://127.0.0.1:3000/api/v1",
|
|
6
6
|
// null: ~/.bond-app/token (the orchestrator's default data dir)
|
|
7
7
|
tokenFile: null,
|
|
8
|
+
// Gasto/costes fuera por defecto (decisión 2026-11-19): el orquestador sigue
|
|
9
|
+
// registrando cost_usd, pero la UI no lo muestra hasta que una configuración
|
|
10
|
+
// en Ajustes lo active. Entonces esto será el valor de esa configuración.
|
|
11
|
+
costs: false,
|
|
8
12
|
};
|