@jmanuelcorral/bond-app 0.1.4 → 0.1.6
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 +241 -7
- package/app/brand/TOKENS.md +5 -5
- package/app/layouts/bond.json +10 -14
- package/app/mods/bond-agents/api.js +35 -0
- package/app/mods/bond-agents/branch.svg +1 -0
- package/app/mods/bond-agents/brand.js +53 -2
- package/app/mods/bond-agents/config.js +8 -0
- package/app/mods/bond-agents/eye-off.svg +1 -0
- package/app/mods/bond-agents/eye.svg +1 -0
- package/app/mods/bond-agents/main.js +316 -330
- package/app/mods/bond-agents/model.js +400 -6
- package/app/mods/bond-board/api.js +35 -0
- package/app/mods/bond-board/branch.svg +1 -0
- package/app/mods/bond-board/brand.js +53 -2
- package/app/mods/bond-board/config.js +8 -0
- package/app/mods/bond-board/main.js +1054 -366
- package/app/mods/bond-board/model.js +138 -17
- package/app/mods/bond-pane/close.svg +1 -0
- package/app/mods/bond-pane/hide.svg +1 -0
- package/app/mods/bond-pane/main.js +103 -0
- package/app/mods/bond-pane/mod.json +1 -0
- package/app/mods/bond-pane/model.js +18 -0
- package/app/mods/bond-pane/split-down.svg +1 -0
- package/app/mods/bond-pane/split-right.svg +1 -0
- package/app/mods/bond-pane/unzoom.svg +1 -0
- package/app/mods/bond-pane/zoom.svg +1 -0
- package/app/mods/bond-settings/api.js +35 -0
- package/app/mods/bond-settings/brand.js +53 -2
- package/app/mods/bond-settings/config.js +8 -0
- package/app/mods/bond-settings/main.js +1645 -87
- package/app/mods/bond-settings/mod.json +1 -1
- package/app/mods/bond-settings/pi-models.js +144 -0
- package/app/mods/bond-status/api.js +35 -0
- package/app/mods/bond-status/brand.js +53 -2
- package/app/mods/bond-status/config.js +8 -0
- package/app/mods/bond-status/main.js +37 -15
- package/app/mods/bond-status/model.js +19 -1
- package/app/mods/bond-tabs/brand.js +53 -2
- package/app/mods/bond-tabs/main.js +45 -3
- package/app/mods/bond-titlebar/brand.js +53 -2
- package/app/mods/bond-titlebar/main.js +115 -55
- package/app/mods/bond-titlebar/version.js +3 -0
- package/app/themes/bond-dark.json +5 -5
- package/app/themes/bond-light.json +5 -5
- package/package.json +1 -1
- package/runner/Dockerfile +58 -15
- package/runner/SPIKE-BOND.md +89 -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/entrypoint.sh +16 -0
- package/runner/setup.sh +927 -0
- package/runner/versions.env +61 -0
- package/scripts/app-install.ts +64 -1
- package/src/cli.ts +53 -3
- package/src/config.ts +8 -0
- package/src/core/agy-login.ts +682 -0
- package/src/core/delivery.ts +3 -1
- package/src/core/hub-session.ts +9 -7
- package/src/core/orchestrator.ts +1186 -168
- package/src/core/repo-host.ts +60 -0
- package/src/core/setup.ts +239 -0
- package/src/core/watchdog.ts +6 -6
- package/src/db/database.ts +55 -1
- package/src/db/settings-repo.ts +440 -7
- package/src/db/ticket-repo.ts +73 -17
- package/src/index.ts +4 -4
- package/src/runner/azure-devops-client.ts +163 -0
- package/src/runner/docker-client.ts +84 -5
- package/src/runner/github-client.ts +146 -0
- package/src/runner/hc-client.ts +40 -5
- package/src/runner/image-builder.ts +268 -10
- package/src/runner/jira-client.ts +368 -0
- package/src/runner/tool-catalog.ts +84 -0
- package/src/server/app.ts +585 -9
- package/src/types.ts +168 -1
|
@@ -4,18 +4,62 @@
|
|
|
4
4
|
// minimize, maximize/restore and close; on macOS the traffic lights stay, so it leaves room.
|
|
5
5
|
//
|
|
6
6
|
// Top Navigation Bar matching opendesign:
|
|
7
|
-
// - Left: Bond logo (isotype + wordmark) and version chip (
|
|
7
|
+
// - Left: Bond logo (isotype + wordmark) and version chip (version.js, from package.json)
|
|
8
8
|
// - Center: Global metrics banner: Tablero: N tickets, per-state dot counters, Gasto: $x / $y
|
|
9
9
|
// - Right: Search input ("Buscar ticket o rama..."), + Nuevo Ticket (primary), Theme switcher (sun icon), Settings (layout.toggle)
|
|
10
10
|
import { View, div, svg, image } from "gpui-kit";
|
|
11
11
|
import { h_flex, Input, InputState } from "gpui-base";
|
|
12
|
-
import { run, theme, layout, window as win, shared, setShared, openOverlay } from "herdr";
|
|
13
|
-
import { logo, UI, stateColor, isDark } from "./brand.js";
|
|
12
|
+
import { run, theme, layout, window as win, shared, setShared, openOverlay, appHome, readTextFile, writeTextFile, settings, notify } from "herdr";
|
|
13
|
+
import { logo, UI, stateColor, isDark, settingsOverlay, createOverlay, markColor } from "./brand.js";
|
|
14
|
+
import { VERSION } from "./version.js";
|
|
14
15
|
|
|
15
16
|
const ICONS = "mods/bond-titlebar";
|
|
17
|
+
/** The counters of the title bar: column, singular, plural (the board's words). */
|
|
18
|
+
const COUNT_CHIPS = [
|
|
19
|
+
["ready", "listo", "listos"],
|
|
20
|
+
["running", "en curso", "en curso"],
|
|
21
|
+
["waiting", "en espera", "en espera"],
|
|
22
|
+
["finished", "terminado", "terminados"],
|
|
23
|
+
["error", "con error", "con error"],
|
|
24
|
+
];
|
|
25
|
+
// Costes fuera por defecto (decisión 2026-11-19); mismo flag que CONFIG.costs en
|
|
26
|
+
// los mods de API — los mods no comparten carpeta, así que se duplica (como brand.js).
|
|
27
|
+
// Cuando haya configuración en Ajustes, esto será ese valor.
|
|
28
|
+
const COSTS = false;
|
|
16
29
|
const LOGO_H = 16; // isotype height
|
|
17
30
|
|
|
18
31
|
// A control inside the draggable bar: its presses are its own, not the window's.
|
|
32
|
+
/**
|
|
33
|
+
* Light/dark: the bond layout pairs bond-light and bond-dark ({light, dark}), so the theme
|
|
34
|
+
* follows the window's appearance; `app.theme` would only swap one half of the pair. The
|
|
35
|
+
* button flips `appearance` in herdr-app's settings.json (live), keeping the rest of it.
|
|
36
|
+
*/
|
|
37
|
+
export function nextAppearance(text, dark) {
|
|
38
|
+
let conf = {};
|
|
39
|
+
try {
|
|
40
|
+
conf = text ? JSON.parse(text) : {};
|
|
41
|
+
} catch {
|
|
42
|
+
return null; // a settings.json we can't read is not ours to rewrite
|
|
43
|
+
}
|
|
44
|
+
if (!conf || typeof conf !== "object" || Array.isArray(conf)) return null;
|
|
45
|
+
return JSON.stringify({ ...conf, appearance: dark ? "light" : "dark" }, null, 2) + "\n";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function toggleAppearance(cx, darkNow) {
|
|
49
|
+
const dark = typeof settings().dark === "boolean" ? settings().dark : darkNow;
|
|
50
|
+
const path = `${appHome()}/settings.json`;
|
|
51
|
+
cx.spawn(async () => {
|
|
52
|
+
try {
|
|
53
|
+
const text = await readTextFile(path);
|
|
54
|
+
const next = nextAppearance(text, dark);
|
|
55
|
+
if (next === null) throw new Error("settings.json no es JSON válido");
|
|
56
|
+
await writeTextFile(path, next, text);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
notify({ title: "No se pudo cambiar el modo", body: String(e?.message ?? e), level: "error" });
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
19
63
|
function own(el) {
|
|
20
64
|
return el
|
|
21
65
|
.on_mouse_down("left", (_e, cx) => cx.stop_propagation())
|
|
@@ -38,7 +82,7 @@ export default class BondTitlebar extends View {
|
|
|
38
82
|
init(_props, cx) {
|
|
39
83
|
const filter = shared(FILTER_KEY) ?? {};
|
|
40
84
|
const initialSearch = String(filter.text ?? shared("bond.search") ?? "");
|
|
41
|
-
this.search = InputState.new({ value: initialSearch, placeholder: "Buscar ticket o rama
|
|
85
|
+
this.search = InputState.new({ value: initialSearch, placeholder: "Buscar ticket o rama…" });
|
|
42
86
|
this.search.on("change", (_e, cx) => {
|
|
43
87
|
const val = this.search.value();
|
|
44
88
|
setShared("bond.search", val);
|
|
@@ -73,6 +117,20 @@ export default class BondTitlebar extends View {
|
|
|
73
117
|
);
|
|
74
118
|
}
|
|
75
119
|
|
|
120
|
+
/** Settings opens the Ajustes dialog (a modal, not a block of the layout any more). */
|
|
121
|
+
settingsButton() {
|
|
122
|
+
const t = theme();
|
|
123
|
+
return own(
|
|
124
|
+
h_flex().id("bt-settings").flex_none().h(26).px(8).gap(5).rounded(UI.radius).items_center().cursor_pointer()
|
|
125
|
+
.text_size(UI.text.small).font_family(UI.fontSans).font_medium()
|
|
126
|
+
.bg(t.raised).text_color(t.muted).border_1().border_color(t.border)
|
|
127
|
+
.hover((s) => s.bg(t.hover).text_color(t.foreground))
|
|
128
|
+
.on_click(() => openOverlay(settingsOverlay()))
|
|
129
|
+
.child(svg(`${ICONS}/settings.svg`).size(13))
|
|
130
|
+
.child("Ajustes"),
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
76
134
|
panelButton(id, icon, label, node) {
|
|
77
135
|
const t = theme();
|
|
78
136
|
const n = findNode(layout(), node);
|
|
@@ -97,11 +155,35 @@ export default class BondTitlebar extends View {
|
|
|
97
155
|
const l = logo(t);
|
|
98
156
|
const wordH = LOGO_H * 0.8;
|
|
99
157
|
|
|
100
|
-
const stats =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
const
|
|
158
|
+
const stats = shared("bond.board_stats") ?? null;
|
|
159
|
+
// Sin una carga exitosa no hay estadísticas: «—», nunca ceros que parecen reales
|
|
160
|
+
// (decisión 2026-11-19).
|
|
161
|
+
const hasStats = Boolean(stats);
|
|
162
|
+
const totalTickets = Number(stats?.total ?? 0);
|
|
163
|
+
const counts = stats?.counts ?? { ready: 0, running: 0, waiting: 0, finished: 0, error: 0 };
|
|
164
|
+
const costText = `$${Number(stats?.cost ?? 0).toFixed(2)}`;
|
|
165
|
+
const budgetText = `/ $${Number(stats?.budget ?? 0).toFixed(2)}`;
|
|
166
|
+
// One chip per state with its name (no bare dots): a click filters the board to that
|
|
167
|
+
// column (shared FILTER_KEY.column), a second click clears it. Error only when it has some.
|
|
168
|
+
const filter = shared(FILTER_KEY) ?? {};
|
|
169
|
+
const countsBlock = hasStats
|
|
170
|
+
? h_flex().gap(2).items_center()
|
|
171
|
+
.children(COUNT_CHIPS.filter(([id]) => id !== "error" || counts.error > 0).map(([id, one, many]) => {
|
|
172
|
+
const n = Number(counts[id] ?? 0);
|
|
173
|
+
const on = filter.column === id;
|
|
174
|
+
const color = stateColor(t, id);
|
|
175
|
+
return own(h_flex().id(`count-${id}`).h(20).px(6).gap(4).items_center().rounded(UI.radius).cursor_pointer()
|
|
176
|
+
.bg(on ? t.selected : t.raised).border_1().border_color(on ? color : t.raised)
|
|
177
|
+
.hover((s) => s.bg(t.hover))
|
|
178
|
+
.tooltip(on ? "Quitar el filtro" : `Ver solo ${many}`)
|
|
179
|
+
.on_click((_e, cx) => {
|
|
180
|
+
setShared(FILTER_KEY, { ...(shared(FILTER_KEY) ?? {}), column: on ? null : id });
|
|
181
|
+
cx.notify();
|
|
182
|
+
})
|
|
183
|
+
.child(div().size(6).rounded(3).flex_none().bg(n > 0 ? color : t.dim))
|
|
184
|
+
.child(div().text_color(n > 0 ? t.foreground : t.dim).child(`${n} ${n === 1 ? one : many}`)));
|
|
185
|
+
}))
|
|
186
|
+
: div().px(2).text_color(t.dim).child("—");
|
|
105
187
|
|
|
106
188
|
return h_flex().id("bond-titlebar").size_full().items_center().bg(t.chrome).px(10).gap(8)
|
|
107
189
|
.border_b(1).border_color(t.border).font_family("JetBrains Mono")
|
|
@@ -112,7 +194,7 @@ export default class BondTitlebar extends View {
|
|
|
112
194
|
.child(image(l.isotype).w(LOGO_H * l.isotypeRatio).h(LOGO_H).flex_none())
|
|
113
195
|
.child(image(l.wordmark).w(wordH * l.wordmarkRatio).h(wordH).flex_none())
|
|
114
196
|
.child(div().px(5).py(1).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border)
|
|
115
|
-
.text_size(UI.text.tiny).font_family("JetBrains Mono").font_medium().text_color(t.accent).child(
|
|
197
|
+
.text_size(UI.text.tiny).font_family("JetBrains Mono").font_medium().text_color(t.accent).child(`v${VERSION}`))
|
|
116
198
|
)
|
|
117
199
|
.child(div().flex_1())
|
|
118
200
|
// Center: Global Metrics Banner
|
|
@@ -122,46 +204,25 @@ export default class BondTitlebar extends View {
|
|
|
122
204
|
.child(
|
|
123
205
|
h_flex().gap(3).items_center()
|
|
124
206
|
.child(div().text_color(t.muted).child("Tablero:"))
|
|
125
|
-
.child(
|
|
207
|
+
.child(hasStats
|
|
208
|
+
? div().font_bold().font_family(UI.fontSans).text_color(t.foreground).child(`${totalTickets} ${totalTickets === 1 ? "ticket" : "tickets"}`)
|
|
209
|
+
: div().font_bold().font_family(UI.fontSans).text_color(t.dim).child("—"))
|
|
126
210
|
)
|
|
127
211
|
.child(div().text_color(t.border).child("|"))
|
|
128
|
-
.child(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
.child(div().size(5).rounded(3).bg(stateColor(t, "waiting")))
|
|
143
|
-
.child(div().font_semibold().text_color(counts.waiting > 0 ? stateColor(t, "waiting") : t.dim).child(`${counts.waiting ?? 0} wait`))
|
|
144
|
-
)
|
|
145
|
-
.child(
|
|
146
|
-
h_flex().items_center().gap(2)
|
|
147
|
-
.child(div().size(5).rounded(3).bg(stateColor(t, "finished")))
|
|
148
|
-
.child(div().text_color(counts.finished > 0 ? stateColor(t, "finished") : t.dim).child(String(counts.finished ?? 0)))
|
|
149
|
-
)
|
|
150
|
-
.when(Boolean(counts.error), (el) =>
|
|
151
|
-
el.child(
|
|
152
|
-
h_flex().items_center().gap(2)
|
|
153
|
-
.child(div().size(5).rounded(3).bg(stateColor(t, "error")))
|
|
154
|
-
.child(div().text_color(stateColor(t, "error")).child(String(counts.error ?? 0)))
|
|
155
|
-
)
|
|
156
|
-
)
|
|
157
|
-
)
|
|
158
|
-
.child(div().text_color(t.border).child("|"))
|
|
159
|
-
.child(
|
|
160
|
-
h_flex().gap(3).items_center()
|
|
161
|
-
.child(div().text_color(t.muted).child("Gasto:"))
|
|
162
|
-
.child(div().font_semibold().text_color(t.working).child(costText))
|
|
163
|
-
.child(div().text_color(t.dim).text_size(UI.text.tiny).child(budgetText))
|
|
164
|
-
)
|
|
212
|
+
.child(countsBlock)
|
|
213
|
+
// Gasto fuera por defecto (CONFIG.costs): el orquestador registra costes,
|
|
214
|
+
// pero la UI no los muestra hasta que una configuración lo active.
|
|
215
|
+
.when(COSTS, (el) => el
|
|
216
|
+
.child(div().text_color(t.border).child("|"))
|
|
217
|
+
.child(
|
|
218
|
+
h_flex().gap(3).items_center()
|
|
219
|
+
.child(div().text_color(t.muted).child("Gasto:"))
|
|
220
|
+
.child(hasStats
|
|
221
|
+
? h_flex().gap(3).items_center()
|
|
222
|
+
.child(div().font_semibold().text_color(t.working).child(costText))
|
|
223
|
+
.child(div().text_color(t.dim).text_size(UI.text.tiny).child(budgetText))
|
|
224
|
+
: div().text_color(t.dim).child("—"))
|
|
225
|
+
))
|
|
165
226
|
)
|
|
166
227
|
.child(div().flex_1())
|
|
167
228
|
// Right: Search, Nuevo Ticket, Theme Switcher & Settings
|
|
@@ -184,9 +245,9 @@ export default class BondTitlebar extends View {
|
|
|
184
245
|
.text_size(UI.text.small).font_family(UI.fontSans).font_semibold()
|
|
185
246
|
.cursor_pointer().hover((s) => s.opacity(0.85))
|
|
186
247
|
.on_click(() => {
|
|
187
|
-
openOverlay(
|
|
248
|
+
openOverlay(createOverlay());
|
|
188
249
|
})
|
|
189
|
-
.child("+ Nuevo
|
|
250
|
+
.child("+ Nuevo ticket")
|
|
190
251
|
)
|
|
191
252
|
)
|
|
192
253
|
// Theme Switcher button (sun icon; switches bond-light / bond-dark)
|
|
@@ -195,14 +256,13 @@ export default class BondTitlebar extends View {
|
|
|
195
256
|
div().id("btn-theme-toggle").size(26).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border)
|
|
196
257
|
.flex().items_center().justify_center().cursor_pointer()
|
|
197
258
|
.hover((s) => s.bg(t.hover))
|
|
198
|
-
.
|
|
199
|
-
|
|
200
|
-
})
|
|
201
|
-
.child(svg(`${ICONS}/sun.svg`).size(14).text_color(t.bond_waiting ?? "#f59e0b"))
|
|
259
|
+
.tooltip(isDark(t) ? "Modo claro" : "Modo oscuro")
|
|
260
|
+
.on_click((_e, cx) => toggleAppearance(cx, isDark(t)))
|
|
261
|
+
.child(svg(`${ICONS}/sun.svg`).size(14).text_color(markColor(t, "sun")))
|
|
202
262
|
)
|
|
203
263
|
)
|
|
204
264
|
// Settings button
|
|
205
|
-
.child(this.
|
|
265
|
+
.child(this.settingsButton())
|
|
206
266
|
// Agentes button (keeps layout.toggle agents)
|
|
207
267
|
.child(this.panelButton("bt-agents", "agents", "Agentes", "agents"))
|
|
208
268
|
)
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"bond_cyan": "#0284c7",
|
|
35
35
|
"bond_indigo": "#8b5cf6",
|
|
36
36
|
"bond_ready": "#94a3b8",
|
|
37
|
-
"bond_running": "#
|
|
38
|
-
"bond_waiting": "#
|
|
39
|
-
"bond_finished": "#
|
|
37
|
+
"bond_running": "#34d399",
|
|
38
|
+
"bond_waiting": "#facc15",
|
|
39
|
+
"bond_finished": "#38bdf8",
|
|
40
40
|
"bond_error": "#ef4444",
|
|
41
41
|
"bond_verifying": "#818cf8",
|
|
42
|
-
"bond_pr_ready": "#
|
|
43
|
-
"bond_blocked": "#
|
|
42
|
+
"bond_pr_ready": "#38bdf8",
|
|
43
|
+
"bond_blocked": "#facc15",
|
|
44
44
|
"bond_failed": "#ef4444"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"bond_cyan": "#0284c7",
|
|
35
35
|
"bond_indigo": "#4f46e5",
|
|
36
36
|
"bond_ready": "#64748b",
|
|
37
|
-
"bond_running": "#
|
|
38
|
-
"bond_waiting": "#
|
|
39
|
-
"bond_finished": "#
|
|
37
|
+
"bond_running": "#047857",
|
|
38
|
+
"bond_waiting": "#a16207",
|
|
39
|
+
"bond_finished": "#0369a1",
|
|
40
40
|
"bond_error": "#dc2626",
|
|
41
41
|
"bond_verifying": "#4f46e5",
|
|
42
|
-
"bond_pr_ready": "#
|
|
43
|
-
"bond_blocked": "#
|
|
42
|
+
"bond_pr_ready": "#0369a1",
|
|
43
|
+
"bond_blocked": "#a16207",
|
|
44
44
|
"bond_failed": "#dc2626"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/package.json
CHANGED
package/runner/Dockerfile
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
# bond-app runner image (P3, D19; P5
|
|
1
|
+
# bond-app runner image (P3, D19; P5 herdr; P2/P4 del plan de agentes: AGENTS + setup.sh
|
|
2
|
+
# + bond). herdr-core (hc) and herdr are pinned here; the agent CLIs (pi, copilot, ...) and
|
|
3
|
+
# bond itself are installed by runner/setup.sh with the pins from runner/versions.env. No sshd and no
|
|
2
4
|
# published ports: the host reaches the container only through `docker exec` (hc machine
|
|
3
|
-
# --via).
|
|
4
|
-
#
|
|
5
|
-
# No credentials are baked in: the GitHub token and the agent config arrive per
|
|
6
|
-
# stdin of `docker exec` (D8, D7).
|
|
5
|
+
# --via). herdr is in so each run can host a bond team (one agent per hub repo, in herdr
|
|
6
|
+
# panes); its TUI runs inside the run's hc terminal.
|
|
7
|
+
# No credentials are baked in by default: the GitHub token and the agent config arrive per
|
|
8
|
+
# run on stdin of `docker exec` (D8, D7). Baking config (--config) or credentials
|
|
9
|
+
# (--credentials) happens only through the staged build directories below; an image built
|
|
10
|
+
# with credentials is a local secret (D-A), never pushed.
|
|
7
11
|
|
|
8
12
|
FROM node:22-bookworm-slim@sha256:5ec23b7c622b00547753bc6ffd78085dd868a68aeb41c8e0a1418f033e13d96d
|
|
9
13
|
|
|
@@ -15,8 +19,27 @@ ARG HC_SHA256=82ec44043f6894bfdb716b979b87cda43fd7fa46b0104e7b7bd93e64d1a9b877
|
|
|
15
19
|
# HERDR_VERSION must also pass the matching HERDR_SHA256.
|
|
16
20
|
ARG HERDR_VERSION=v0.9.3
|
|
17
21
|
ARG HERDR_SHA256=18a8dc65f1c2fa485884344356dea1cfd911c6f06cf46fa78e193f4087f4dba7
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
# P4 (image plan): bond comes from setup.sh --with-bond with the BOND_VERSION pin in
|
|
23
|
+
# versions.env (1.16.4+: `bond tui` exists; runner/SPIKE-BOND.md). Non-empty here
|
|
24
|
+
# overrides the pin file, like PI_VERSION below.
|
|
25
|
+
ARG BOND_VERSION=
|
|
26
|
+
# P2 (image plan): the agent list baked into the image, comma separated (setup.sh's set).
|
|
27
|
+
# The default keeps the "current" image parity: pi only.
|
|
28
|
+
ARG AGENTS=pi
|
|
29
|
+
# System CLIs: gh is in by default; azure-cli + azure-devops are heavy and only Azure
|
|
30
|
+
# DevOps tickets need them, so the rebuild skips them unless SKIP_AZ=0 is asked for.
|
|
31
|
+
ARG SKIP_AZ=1
|
|
32
|
+
ARG SKIP_GH=0
|
|
33
|
+
# Optional override of the pi pin in versions.env (empty = use the pin file).
|
|
34
|
+
ARG PI_VERSION=
|
|
35
|
+
# Plan bond-app-ajustes-imagen P2: developer tool groups (setup.sh --tools) and extra
|
|
36
|
+
# Debian packages (--apt-extra), comma separated. Default: the catalog's default groups.
|
|
37
|
+
ARG TOOLS=esenciales,busqueda,shell
|
|
38
|
+
ARG APT_EXTRA=
|
|
39
|
+
# The recipe's fingerprint (src/runner/image-builder.ts runnerRecipeHash), computed by the
|
|
40
|
+
# orchestrator and kept as a label: Ajustes marks the image stale when this recipe changes.
|
|
41
|
+
ARG RECIPE=
|
|
42
|
+
LABEL dev.bond-app.recipe="${RECIPE}"
|
|
20
43
|
|
|
21
44
|
RUN apt-get update \
|
|
22
45
|
&& apt-get install -y --no-install-recommends git ca-certificates procps curl \
|
|
@@ -36,12 +59,8 @@ RUN curl -fsSL -o /usr/local/bin/herdr \
|
|
|
36
59
|
&& echo "${HERDR_SHA256} /usr/local/bin/herdr" | sha256sum -c - \
|
|
37
60
|
&& chmod 0755 /usr/local/bin/herdr && herdr --version
|
|
38
61
|
|
|
39
|
-
#
|
|
40
|
-
|
|
41
|
-
@jmanuelcorral/bond@${BOND_VERSION} \
|
|
42
|
-
@earendil-works/pi-coding-agent@${PI_VERSION} \
|
|
43
|
-
&& npm cache clean --force \
|
|
44
|
-
&& bond --version && pi --version
|
|
62
|
+
# The agent CLIs, supi and bond no longer come from here: setup.sh installs them with
|
|
63
|
+
# versions.env pins (P2/P4).
|
|
45
64
|
|
|
46
65
|
# Unprivileged user for hc and the agent. Its uid differs from the host user's
|
|
47
66
|
# so nothing the host mounts with uid 1000 is readable by it.
|
|
@@ -57,12 +76,36 @@ COPY --chown=runner:runner herdr-config.toml /home/runner/.config/herdr/config.t
|
|
|
57
76
|
COPY --chown=runner:runner pi-trust.json /home/runner/.pi/agent/trust.json
|
|
58
77
|
RUN ln -sf /home/runner/.pi/agent/trust.json /home/runner/.pi/agent/trusted.json
|
|
59
78
|
|
|
79
|
+
# P2 (image plan): setup.sh lives in the image too (criterion: the image carries the
|
|
80
|
+
# script and the /opt/runner-agents manifest). The build stages optional config and
|
|
81
|
+
# credentials next to the Dockerfile (image-builder.ts); ".none" means "nothing staged".
|
|
82
|
+
# D-BB/D-CC: BOND_APP=1 before setup.sh, so `bond setup` (as runner) installs the hc
|
|
83
|
+
# variant of bond-delegate/bond-team; declared after it, the build saw no variable and
|
|
84
|
+
# baked the classic Herdr skills. It is a flag, not a secret (D7).
|
|
85
|
+
ENV BOND_TEAM_NO_TABLE=1 \
|
|
86
|
+
BOND_APP=1 \
|
|
87
|
+
COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
|
88
|
+
COPY setup.sh versions.env credentials.example.env /opt/runner/
|
|
89
|
+
COPY config.example /opt/runner/config.example
|
|
90
|
+
COPY build-config /tmp/build-config
|
|
91
|
+
COPY build-creds /tmp/build-creds
|
|
92
|
+
RUN chmod 0755 /opt/runner/setup.sh \
|
|
93
|
+
&& if [ -n "${PI_VERSION}" ]; then sed -i "s/^PI_VERSION=.*/PI_VERSION=${PI_VERSION}/" /opt/runner/versions.env; fi \
|
|
94
|
+
&& if [ -n "${BOND_VERSION}" ]; then sed -i "s/^BOND_VERSION=.*/BOND_VERSION=${BOND_VERSION}/" /opt/runner/versions.env; fi \
|
|
95
|
+
&& set -- --agents "${AGENTS}" --with-bond \
|
|
96
|
+
&& if [ "${SKIP_AZ}" = "1" ]; then set -- "$@" --skip-az; fi \
|
|
97
|
+
&& if [ "${SKIP_GH}" = "1" ]; then set -- "$@" --skip-gh; fi \
|
|
98
|
+
&& if [ -n "${TOOLS}" ]; then set -- "$@" --tools "${TOOLS}"; fi \
|
|
99
|
+
&& if [ -n "${APT_EXTRA}" ]; then set -- "$@" --apt-extra "${APT_EXTRA}"; fi \
|
|
100
|
+
&& { [ -f /tmp/build-config/.none ] || set -- "$@" --config /tmp/build-config; } \
|
|
101
|
+
&& { [ -f /tmp/build-creds/.none ] || set -- "$@" --credentials /tmp/build-creds/env; } \
|
|
102
|
+
&& /opt/runner/setup.sh "$@" \
|
|
103
|
+
&& rm -rf /tmp/build-config /tmp/build-creds
|
|
104
|
+
|
|
60
105
|
COPY entrypoint.sh runner-clone.sh healthcheck.sh /usr/local/lib/runner/
|
|
61
106
|
RUN chmod 0755 /usr/local/lib/runner/*.sh \
|
|
62
107
|
&& ln -s /usr/local/lib/runner/runner-clone.sh /usr/local/bin/runner-clone \
|
|
63
108
|
&& ln -s /usr/local/lib/runner/healthcheck.sh /usr/local/bin/runner-health
|
|
64
109
|
|
|
65
|
-
ENV BOND_TEAM_NO_TABLE=1
|
|
66
|
-
|
|
67
110
|
HEALTHCHECK --interval=2s --timeout=2s --start-period=5s --retries=3 CMD ["/usr/local/bin/runner-health"]
|
|
68
111
|
ENTRYPOINT ["/usr/local/lib/runner/entrypoint.sh"]
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Spike: bond dentro del contenedor del runner (plan de imagen P4, criterio 1)
|
|
2
|
+
|
|
3
|
+
Probado el 2026-11-19 en `bond-app-runner:p5` (imagen con `AGENTS=agy,pi`), contenedor
|
|
4
|
+
desecho `bond-spike`, con un repo git mínimo (`/workspace/spike` con `.bond/bond.toml`:
|
|
5
|
+
`agents = ["pi"]`, `default_agent = "pi"`).
|
|
6
|
+
|
|
7
|
+
## Qué hace `bond tui` dentro del contenedor
|
|
8
|
+
|
|
9
|
+
Fuera de Herdr, `bond tui` **arranca su propio servidor herdr y engancha la interfaz**
|
|
10
|
+
(ayuda oficial). Dentro del contenedor del run real, el terminal del agente YA está
|
|
11
|
+
dentro del servidor herdr-core de la máquina hc (`docker exec … herdr-core connect`), así
|
|
12
|
+
que bond usa ese servidor: crea el workspace `w1` con el agente en la pane `w1:p1` — que
|
|
13
|
+
es exactamente la forma que el orquestador ya mira (`pane_id === 'w1:p1'`) para el estado
|
|
14
|
+
del board.
|
|
15
|
+
|
|
16
|
+
## Resultado del arranque no interactivo
|
|
17
|
+
|
|
18
|
+
Con HOME del usuario `runner` (el del contenedor) y cwd en el repo:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
bond tui --agent pi -- "responde SOLO: hola"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- Bond **no pregunta nada**: si la config del repo está desfasada corre `bond sync` solo,
|
|
25
|
+
crea el workspace y lanza el agente. El encargo viaja tal cual: la pane ejecuta
|
|
26
|
+
`pi 'responde SOLO: hola'` (los args tras `--` van al agente como primer mensaje;
|
|
27
|
+
para el modelo: `-- --model provider/id`).
|
|
28
|
+
- Sin credenciales de provider el agente falla con error — esperado; el viaje del encargo
|
|
29
|
+
quedó probado.
|
|
30
|
+
|
|
31
|
+
## Condiciones para cero interacción
|
|
32
|
+
|
|
33
|
+
1. **Versión de bond**: la fijada en la imagen (`1.15.0`) **no tiene comando `tui`**.
|
|
34
|
+
Existe desde `1.16.4` (package npm con scope `@jmanuelcorral/bond`). P4 sube el pin.
|
|
35
|
+
2. **Fiar la carpeta en pi y agy**: pi pregunta «Trust project folder?» la primera vez. Resuelto
|
|
36
|
+
horneando/inyectando `~/.pi/agent/trust.json` con el workdir (`/workspace` ya está en
|
|
37
|
+
la imagen actual). En agy, la confianza de carpetas se persiste en
|
|
38
|
+
`~/.gemini/antigravity-cli/settings.json` bajo `"trustedWorkspaces": ["/workspace", "/workspace/repo"]`,
|
|
39
|
+
y el onboarding en `~/.gemini/antigravity-cli/cache/onboarding.json` con
|
|
40
|
+
`{"consumerOnboardingComplete":true,"enterpriseOnboardingComplete":true,"onboardingComplete":true}`,
|
|
41
|
+
ambos horneados automáticamente por `runner/setup.sh` al instalar agy.
|
|
42
|
+
3. **Repo con `.bond/bond.toml`**: llega **por git** con el clone del workdir. Si no lo
|
|
43
|
+
tiene, bond ofrece `bond init` (interactivo) → el lanzador no debe usar bond en repos
|
|
44
|
+
sin bond hasta que haya flag para eso.
|
|
45
|
+
4. **Config de máquina bond** (`~/.bond/config.toml` con `[update] auto=false`) y la
|
|
46
|
+
integración de herdr-pi (lo que pinta la barra de estado `« bond … wR:p2 …`): se hornea
|
|
47
|
+
en el build con `bond setup --yes` como el usuario `runner` (`bond doctor` lista eso
|
|
48
|
+
como pendiente sin setup). El aviso de actualización no bloqueó el arranque.
|
|
49
|
+
5. **Terminal con tamaño real**: con un pseudo-PTY de tamaño cero `hc` se niega a enganchar
|
|
50
|
+
(«zero-sized grid»). En el run real el terminal hc del orquestador tiene tamaño, OK.
|
|
51
|
+
6. **Riesgo abierto**: en el spike (root) apareció un pop-up de primer uso del cliente hc
|
|
52
|
+
(«this is a mouse-first terminal… ↵ continue»). No apareció en la corrida como `runner`
|
|
53
|
+
con attach en `/workspace`. Confirmar en el e2e de P5; si aparece, hornear el estado de
|
|
54
|
+
primer uso de hc o subir el pin de hc (imagen 0.1.17 vs 0.1.21 de escritorio).
|
|
55
|
+
|
|
56
|
+
## Manifiesto
|
|
57
|
+
|
|
58
|
+
Con `--with-bond`, `/opt/runner-agents` lista además `bond <versión>` (formato `pkg=bond
|
|
59
|
+
version=…`, junto a `pkg=supi`, que ya estaba). Sin bond en la imagen, el lanzador P5 cae
|
|
60
|
+
al agente pelado (fallback).
|
|
61
|
+
|
|
62
|
+
## Desviaciones registradas (P4)
|
|
63
|
+
|
|
64
|
+
- **Descarga**: el pin se instala del package npm con scope `@jmanuelcorral/bond@<v>`
|
|
65
|
+
(integridad verificada por npm), no del tarball de la release; es la distribución oficial
|
|
66
|
+
con scope (el `bond` de npm sin scope es otro proyecto — D-H). `ARG BOND_VERSION` vacío
|
|
67
|
+
usa el pin de `versions.env`.
|
|
68
|
+
- **Anti-claves**: la imagen no hornea proveedores de pi (el rebuild del wizard no manda
|
|
69
|
+
`config_dir`): las claves viajan solo por la inyección por run (D-E), así que es
|
|
70
|
+
imposible que acaben en la imagen. Un generador «estado del wizard → config_dir sin
|
|
71
|
+
claves» con validación explícita queda como mejora futura.
|
|
72
|
+
|
|
73
|
+
## Evidencia e2e (P5, 2026-11-19)
|
|
74
|
+
|
|
75
|
+
Imagen `bond-app-runner:p6` (AGENTS=agy,pi, bond 1.16.4). Run `run-20261119T155317-fff97b`
|
|
76
|
+
(ticket contra `jmanuelcorral/bond-app-sandbox-2`, repo con `.bond/bond.toml`):
|
|
77
|
+
|
|
78
|
+
- Proceso en el contenedor: `node /usr/local/bin/bond tui --agent pi -- --model
|
|
79
|
+
llamaswap/… <encargo>` — el encargo viajó completo al agente sin interacción.
|
|
80
|
+
- `hc read bond-run-…/t1` (desde el host) muestra el header de bond (skills, prompts,
|
|
81
|
+
extensions del repo sincronizados) y la barra de estado:
|
|
82
|
+
`bond 🤖 gru@w1:p1 📁 repo 🌿 feat/… 🧠 <modelo> off` + `📊 4% 💰 ↑0↓0 🕐 ⚡ 📝 ✅❌`.
|
|
83
|
+
- El board ve el terminal como `agent: bond`, `state: live` (extensión herdr-agent-state
|
|
84
|
+
instalada por `bond setup` en la imagen).
|
|
85
|
+
- En repos **sin** `.bond/bond.toml` (p. ej. `fluzo-labs/fluzo`) el sondeo del orquestador
|
|
86
|
+
falla y el run lanza el agente pelado como antes (fallback, criterio 3).
|
|
87
|
+
- Nota sin efecto en P5: el modelo de sugerencias `qwen3.5-2b` no admite tools (400);
|
|
88
|
+
para trabajar de verdad hay que elegir en el ticket un modelo con tools
|
|
89
|
+
(p. ej. `llamaswap/flash-halogen`).
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# runner/config.example — plantilla de config por agente para `setup.sh --config`
|
|
2
|
+
|
|
3
|
+
Config **sin secretos** (ni URLs con token, ni claves): los tokens viajan con
|
|
4
|
+
`--credentials` o, por defecto (opción A), se inyectan por stdin en cada run (D7/D8).
|
|
5
|
+
|
|
6
|
+
Carpeta: una subcarpeta por agente instalado, con un único fichero cada una
|
|
7
|
+
(`setup.sh` rechaza ficheros extra y agentes sin entrada en `--agents`):
|
|
8
|
+
|
|
9
|
+
| Agente | Fichero | Se instala en |
|
|
10
|
+
| ------- | --------------- | ----------------------------------------------- |
|
|
11
|
+
| pi | `models.json` | `/home/runner/.pi/agent/models.json` |
|
|
12
|
+
| claude | `settings.json` | `/home/runner/.claude/settings.json` |
|
|
13
|
+
| codex | `config.toml` | `/home/runner/.codex/config.toml` |
|
|
14
|
+
| copilot | `config.json` | `/home/runner/.copilot/config.json` (ver nota) |
|
|
15
|
+
| agy | `settings.json` | `/home/runner/.gemini/antigravity-cli/settings.json` |
|
|
16
|
+
|
|
17
|
+
Nota copilot/agy: el contenido lo define su CLI (verificado D-C); el script solo
|
|
18
|
+
valida el formato (JSON/TOML) y lo copia. Para `agy`, meter
|
|
19
|
+
`"modelProvider": "gemini"` en `settings.json` exige `GEMINI_API_KEY` en el
|
|
20
|
+
entorno al arrancar; no lo hornees si no vas a definir esa variable.
|
|
21
|
+
|
|
22
|
+
Esta plantilla trae el ejemplo pedido por el plan: un **provider LAN de pi**
|
|
23
|
+
(endpoint 192.0.2.10 — documentación RFC 5737; sustituir por tu IP real) con ids
|
|
24
|
+
de modelo de muestra y la clave vía `$LAN_API_KEY`, sin ficheros privados en el
|
|
25
|
+
repo. Las demás columnas de la tabla son mapeos soportados (verificados D-C); añade
|
|
26
|
+
subcarpetas para otros agentes instalados según necesites — si `--config` trae
|
|
27
|
+
una subcarpeta de un agente no pedido en `--agents`, `setup.sh` la rechaza.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://pi.dev/schemas/models.schema.json",
|
|
3
|
+
"providers": {
|
|
4
|
+
"lan": {
|
|
5
|
+
"name": "Endpoint LAN (LM Studio / Ollama / llama.cpp)",
|
|
6
|
+
"baseUrl": "http://192.0.2.10:1234/v1",
|
|
7
|
+
"api": "openai-completions",
|
|
8
|
+
"apiKey": "$LAN_API_KEY",
|
|
9
|
+
"models": [
|
|
10
|
+
{
|
|
11
|
+
"id": "qwen3-coder-30b",
|
|
12
|
+
"name": "Qwen3 Coder 30B (LAN)",
|
|
13
|
+
"reasoning": true,
|
|
14
|
+
"input": ["text"],
|
|
15
|
+
"contextWindow": 131072,
|
|
16
|
+
"maxTokens": 8192,
|
|
17
|
+
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# runner/credentials.example.env — plantilla para `setup.sh --credentials <fichero>`.
|
|
2
|
+
# Copiar a un fichero fuera del contexto de build, rellenar y chmod 0600 (obligatorio).
|
|
3
|
+
#
|
|
4
|
+
# ADVERTENCIA (D-A): una imagen construida con credenciales horneadas es un secreto
|
|
5
|
+
# local: nunca subirla a un registry ni compartirla. Los valores NUNCA se loguean.
|
|
6
|
+
#
|
|
7
|
+
# Formato: KEY=VALUE, una por línea, sin comillas. Claves soportadas:
|
|
8
|
+
# GH_TOKEN -> gh auth login --with-token (por stdin, nunca por args/env del run)
|
|
9
|
+
# CODEX_TOKEN -> $HOME/.codex/auth.json (clave OPENAI_API_KEY; también vale un
|
|
10
|
+
# token OAuth «codex login» si se adapta el JSON)
|
|
11
|
+
# CLAUDE_TOKEN -> $HOME/.claude/.credentials.json (token de larga duración de
|
|
12
|
+
# `claude setup-token`, formato claudeAiOauth)
|
|
13
|
+
#
|
|
14
|
+
# Sin soporte de fichero de credenciales (verificado D-C, 2026-11-19), NO usar estas
|
|
15
|
+
# claves: setup.sh fallará con un mensaje explícito si aparecen
|
|
16
|
+
# COPILOT_TOKEN -> la CLI de Copilot autentica por variables de entorno
|
|
17
|
+
# (COPILOT_GITHUB_TOKEN/GH_TOKEN) o por el fallback de `gh`
|
|
18
|
+
# (docs.github.com/copilot «Authenticating GitHub Copilot CLI»).
|
|
19
|
+
# Con GH_TOKEN presente, `gh auth login` cubre a copilot.
|
|
20
|
+
# AGY_TOKEN -> Antigravity CLI (agy) autentica por keyring/OAuth o por la
|
|
21
|
+
# variable GEMINI_API_KEY; no admite fichero de credenciales
|
|
22
|
+
# (antigravity.google/docs «Authenticate»). Sigue con la
|
|
23
|
+
# inyección por stdin de bond-app en cada run (D-C).
|
|
24
|
+
|
|
25
|
+
GH_TOKEN=
|
|
26
|
+
CLAUDE_TOKEN=
|
|
27
|
+
CODEX_TOKEN=
|
package/runner/entrypoint.sh
CHANGED
|
@@ -2,8 +2,24 @@
|
|
|
2
2
|
# Container entrypoint (P3): nothing listens. PID 1 is docker's init (--init) and this
|
|
3
3
|
# keeps the container alive as the unprivileged `runner` user; hc's core is started on
|
|
4
4
|
# demand by `hc machine add --via 'docker exec -i -u runner ...'` from the host.
|
|
5
|
+
#
|
|
6
|
+
# Plan bond-app-ajustes-imagen P4: with BOND_DIND=1 (only tickets with «Docker en el run»,
|
|
7
|
+
# whose container runs --privileged with its own /var/lib/docker volume) dockerd starts here
|
|
8
|
+
# as root first; runner reaches it through the docker group (setup.sh, group «docker»).
|
|
5
9
|
set -euo pipefail
|
|
6
10
|
cd /workspace
|
|
11
|
+
if [ "${BOND_DIND:-0}" = "1" ]; then
|
|
12
|
+
if command -v dockerd >/dev/null 2>&1; then
|
|
13
|
+
dockerd >/var/log/dockerd.log 2>&1 &
|
|
14
|
+
for _ in $(seq 1 60); do
|
|
15
|
+
[ -S /var/run/docker.sock ] && break
|
|
16
|
+
sleep 0.5
|
|
17
|
+
done
|
|
18
|
+
[ -S /var/run/docker.sock ] || echo "entrypoint: dockerd no arrancó (mira /var/log/dockerd.log)" >&2
|
|
19
|
+
else
|
|
20
|
+
echo "entrypoint: BOND_DIND=1 pero la imagen no lleva docker (grupo «docker» de Ajustes → Imagen)" >&2
|
|
21
|
+
fi
|
|
22
|
+
fi
|
|
7
23
|
exec setpriv --reuid=runner --regid=runner --init-groups \
|
|
8
24
|
env -i HOME=/home/runner USER=runner PATH=/usr/local/bin:/usr/bin:/bin TERM=xterm-256color \
|
|
9
25
|
sleep infinity
|