@jmanuelcorral/bond-app 0.1.4 → 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.
@@ -0,0 +1,144 @@
1
+ // bond-settings: builder de la config de pi (W-P3). El paso 2 del wizard pregunta
2
+ // cuatro campos de un endpoint «modelo local / OpenAI-compatible» —nombre del provider,
3
+ // base URL, API key opcional y modelos (ids, uno por línea)— y aquí se construye la
4
+ // entrada `providers.<nombre>` de `models.json`, que es lo que guarda
5
+ // PUT /settings/credentials/pi (runner/setup.sh la hornea en ~/.pi/agent/models.json).
6
+ //
7
+ // Puro JavaScript, sin imports de herdr ni gpui, para que Node pueda importarlo en
8
+ // tests (tests/unit/pi-models-builder.test.ts).
9
+ //
10
+ // El esquema es el mínimo estable documentado por pi (docs de models.json): un provider
11
+ // nuevo necesita `baseUrl` y `api`; cada modelo, el mínimo con lo que pi exige o fija
12
+ // mal por defecto: `cost` a 0 (los cuatro campos), `input` texto+imagen, ventana de
13
+ // contexto y salida máxima. Todo lo demás (headers, compat, sampling…) se cubre
14
+ // pegando el JSON completo en el modo avanzado del diálogo.
15
+
16
+ /** Ventana de contexto con la que se emite cada modelo (plan W-P3). */
17
+ export const PI_CONTEXT_WINDOW = 131072;
18
+ /** Máximo de tokens de salida con el que se emite cada modelo (plan W-P3). */
19
+ export const PI_MAX_TOKENS = 8192;
20
+
21
+ /** Los ids de `models.json` suelen ir en minúsculas; se conservan tal cual los escribe. */
22
+ const URL_RE = /^(https?:\/\/)([^\s/]+)(\/[^\s]*)?$/i;
23
+
24
+ /** Texto del textarea de modelos → ids únicos, en orden, sin líneas vacías. */
25
+ export function parseModelIds(text) {
26
+ const seen = new Set();
27
+ for (const line of String(text ?? "").split(/\r?\n/)) {
28
+ const id = line.trim();
29
+ if (id) seen.add(id);
30
+ }
31
+ return [...seen];
32
+ }
33
+
34
+ /**
35
+ * Valida y normaliza la base URL. Devuelve null si no es http(s) con host.
36
+ * Sin ruta (o ruta "/") se añade "/v1", que es donde sirven Ollama, LM Studio, vLLM
37
+ * y compañía; con ruta se respeta tal cual, solo se quita la barra final.
38
+ */
39
+ export function normalizeBaseUrl(raw) {
40
+ const url = String(raw ?? "").trim();
41
+ const m = URL_RE.exec(url);
42
+ if (!m) return null;
43
+ const [, scheme, host, path] = m;
44
+ if (!host) return null;
45
+ if (!path || path === "/") return `${scheme}${host}/v1`;
46
+ return url.endsWith("/") ? url.slice(0, -1) : url;
47
+ }
48
+
49
+ /**
50
+ * Construye el documento `models.json` para un provider OpenAI-compatible.
51
+ * Devuelve { error } si algo no valida, o { name, configJson } con el documento ya
52
+ * serializado (lo que se envía como config_json a PUT /settings/credentials/pi).
53
+ */
54
+ export function buildPiModelsDoc({ name, baseUrl, apiKey, modelsText } = {}) {
55
+ const pname = String(name ?? "").trim();
56
+ if (!pname) return { error: "El provider necesita un nombre." };
57
+ if (/\s/.test(pname)) return { error: "El nombre del provider no puede llevar espacios." };
58
+ const url = normalizeBaseUrl(baseUrl);
59
+ if (!url) return { error: "La base URL tiene que empezar por http:// o https://." };
60
+ const models = parseModelIds(modelsText);
61
+ if (models.length === 0) return { error: "Escribe al menos un modelo, uno por línea." };
62
+ const entry = { baseUrl: url, api: "openai-completions" };
63
+ const key = String(apiKey ?? "").trim();
64
+ if (key) entry.apiKey = key; // vacía → campo ausente, no vacío (criterio 2)
65
+ entry.models = models.map((id) => ({
66
+ id,
67
+ input: ["text", "image"],
68
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
69
+ contextWindow: PI_CONTEXT_WINDOW,
70
+ maxTokens: PI_MAX_TOKENS,
71
+ }));
72
+ const doc = {
73
+ $schema: "https://pi.dev/schemas/models.schema.json",
74
+ providers: { [pname]: entry },
75
+ };
76
+ return { error: null, name: pname, configJson: JSON.stringify(doc, null, 2) };
77
+ }
78
+
79
+ /** null si `text` es JSON válido; si no, el mensaje de error para el diálogo. */
80
+ export function validateConfigJson(text) {
81
+ try {
82
+ JSON.parse(String(text ?? ""));
83
+ return null;
84
+ } catch (e) {
85
+ return `JSON no válido: ${String(e?.message ?? e)}`;
86
+ }
87
+ }
88
+
89
+ // --- W-P4: multiselector de modelos y modelo de sugerencias ------------------------------
90
+
91
+ /** Marcas de nombre que delatan un modelo barato/ligero (heurística estilo bond setup). */
92
+ const CHEAP_MODEL_RE = /flash|mini|small|nano|lite|haiku|express|0[.-]6b|1[.-]5b/i;
93
+
94
+ /**
95
+ * Heurística para proponer «el modelo de sugerencias» (supi) entre los marcados, como
96
+ * hace bond setup: primero uno gratis (OpenRouter los marca con «:free»), luego uno de
97
+ * nombre barato/ligero (flash, mini, small, nano, 0.6b…), y si no, el primero.
98
+ * Devuelve null con la lista vacía («sin sugerencias»).
99
+ */
100
+ export function suggestSuggestionModel(ids) {
101
+ const list = (Array.isArray(ids) ? ids : []).map((id) => String(id ?? "").trim()).filter(Boolean);
102
+ if (list.length === 0) return null;
103
+ return (
104
+ list.find((id) => /free/i.test(id)) ||
105
+ list.find((id) => CHEAP_MODEL_RE.test(id)) ||
106
+ list[0]
107
+ );
108
+ }
109
+
110
+ /** Marcas que delatan modelos diminutos habitualmente sin soporte de tools/function calling. */
111
+ const NO_TOOLS_RE = /(?:^|[-_/])(?:0\.[0-9]+|[1-3](?:\.[0-9]+)?)b\b|nano|tiny/i;
112
+ /** Indicios de soporte de herramientas / código / instrucciones. */
113
+ const TOOL_HINT_RE = /tool|func|coder|code|instruct|agent/i;
114
+
115
+ /**
116
+ * Heurística para proponer «el modelo de trabajo por defecto» para pi entre los marcados:
117
+ * primero uno con indicios de tools sin ser enano, si no el primero que no sea enano
118
+ * (sin tools como 2b), y si todos son enanos, el primero de la lista.
119
+ * Devuelve null con la lista vacía.
120
+ */
121
+ export function suggestDefaultModel(ids) {
122
+ const list = (Array.isArray(ids) ? ids : []).map((id) => String(id ?? "").trim()).filter(Boolean);
123
+ if (list.length === 0) return null;
124
+ const withTool = list.find((id) => TOOL_HINT_RE.test(id) && !NO_TOOLS_RE.test(id));
125
+ if (withTool) return withTool;
126
+ const nonTiny = list.find((id) => !NO_TOOLS_RE.test(id));
127
+ if (nonTiny) return nonTiny;
128
+ return list[0];
129
+ }
130
+
131
+ /**
132
+ * El textarea de modelos es la fuente de verdad de los ids marcados; el multiselector
133
+ * cargado del provider añade y quita líneas aquí (criterio 2: en el models.json solo
134
+ * entran los modelos marcados). Devuelve el texto nuevo, un id por línea.
135
+ */
136
+ export function toggleModelLine(text, id) {
137
+ const ids = parseModelIds(text);
138
+ const wanted = String(id ?? "").trim();
139
+ if (!wanted) return ids.join("\n");
140
+ const i = ids.indexOf(wanted);
141
+ if (i >= 0) ids.splice(i, 1);
142
+ else ids.push(wanted);
143
+ return ids.join("\n");
144
+ }
@@ -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
  };
@@ -13,6 +13,10 @@ import { run, theme, layout, window as win, shared, setShared, openOverlay } fro
13
13
  import { logo, UI, stateColor, isDark } from "./brand.js";
14
14
 
15
15
  const ICONS = "mods/bond-titlebar";
16
+ // Costes fuera por defecto (decisión 2026-11-19); mismo flag que CONFIG.costs en
17
+ // los mods de API — los mods no comparten carpeta, así que se duplica (como brand.js).
18
+ // Cuando haya configuración en Ajustes, esto será ese valor.
19
+ const COSTS = false;
16
20
  const LOGO_H = 16; // isotype height
17
21
 
18
22
  // A control inside the draggable bar: its presses are its own, not the window's.
@@ -97,11 +101,32 @@ export default class BondTitlebar extends View {
97
101
  const l = logo(t);
98
102
  const wordH = LOGO_H * 0.8;
99
103
 
100
- const stats = (shared("bond.board_stats") ?? {}) || {};
101
- const totalTickets = Number(stats.total ?? 0);
102
- const counts = stats.counts ?? { ready: 0, running: 0, waiting: 0, finished: 0, error: 0 };
103
- const costText = `$${Number(stats.cost ?? 0).toFixed(2)}`;
104
- const budgetText = `/ $${Number(stats.budget ?? 0).toFixed(2)}`;
104
+ const stats = shared("bond.board_stats") ?? null;
105
+ // Sin una carga exitosa no hay estadísticas: «—», nunca ceros que parecen reales
106
+ // (decisión 2026-11-19).
107
+ const hasStats = Boolean(stats);
108
+ const totalTickets = Number(stats?.total ?? 0);
109
+ const counts = stats?.counts ?? { ready: 0, running: 0, waiting: 0, finished: 0, error: 0 };
110
+ const costText = `$${Number(stats?.cost ?? 0).toFixed(2)}`;
111
+ const budgetText = `/ $${Number(stats?.budget ?? 0).toFixed(2)}`;
112
+ const countsBlock = hasStats
113
+ ? h_flex().gap(6).items_center()
114
+ .child(h_flex().items_center().gap(2)
115
+ .child(div().size(5).rounded(3).bg(stateColor(t, "ready")))
116
+ .child(div().text_color(counts.ready > 0 ? stateColor(t, "ready") : t.dim).child(String(counts.ready ?? 0))))
117
+ .child(h_flex().items_center().gap(2)
118
+ .child(div().size(5).rounded(3).bg(stateColor(t, "running")))
119
+ .child(div().text_color(counts.running > 0 ? stateColor(t, "running") : t.dim).child(String(counts.running ?? 0))))
120
+ .child(h_flex().items_center().gap(2)
121
+ .child(div().size(5).rounded(3).bg(stateColor(t, "waiting")))
122
+ .child(div().font_semibold().text_color(counts.waiting > 0 ? stateColor(t, "waiting") : t.dim).child(`${counts.waiting ?? 0} wait`)))
123
+ .child(h_flex().items_center().gap(2)
124
+ .child(div().size(5).rounded(3).bg(stateColor(t, "finished")))
125
+ .child(div().text_color(counts.finished > 0 ? stateColor(t, "finished") : t.dim).child(String(counts.finished ?? 0))))
126
+ .when(Boolean(counts.error), (el) => el.child(h_flex().items_center().gap(2)
127
+ .child(div().size(5).rounded(3).bg(stateColor(t, "error")))
128
+ .child(div().text_color(stateColor(t, "error")).child(String(counts.error ?? 0)))))
129
+ : div().px(2).text_color(t.dim).child("—");
105
130
 
106
131
  return h_flex().id("bond-titlebar").size_full().items_center().bg(t.chrome).px(10).gap(8)
107
132
  .border_b(1).border_color(t.border).font_family("JetBrains Mono")
@@ -122,46 +147,25 @@ export default class BondTitlebar extends View {
122
147
  .child(
123
148
  h_flex().gap(3).items_center()
124
149
  .child(div().text_color(t.muted).child("Tablero:"))
125
- .child(div().font_bold().font_family(UI.fontSans).text_color(t.foreground).child(`${totalTickets} tickets`))
150
+ .child(hasStats
151
+ ? div().font_bold().font_family(UI.fontSans).text_color(t.foreground).child(`${totalTickets} tickets`)
152
+ : div().font_bold().font_family(UI.fontSans).text_color(t.dim).child("—"))
126
153
  )
127
154
  .child(div().text_color(t.border).child("|"))
128
- .child(
129
- h_flex().gap(6).items_center()
130
- .child(
131
- h_flex().items_center().gap(2)
132
- .child(div().size(5).rounded(3).bg(stateColor(t, "ready")))
133
- .child(div().text_color(counts.ready > 0 ? stateColor(t, "ready") : t.dim).child(String(counts.ready ?? 0)))
134
- )
135
- .child(
136
- h_flex().items_center().gap(2)
137
- .child(div().size(5).rounded(3).bg(stateColor(t, "running")))
138
- .child(div().text_color(counts.running > 0 ? stateColor(t, "running") : t.dim).child(String(counts.running ?? 0)))
139
- )
140
- .child(
141
- h_flex().items_center().gap(2)
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
- )
155
+ .child(countsBlock)
156
+ // Gasto fuera por defecto (CONFIG.costs): el orquestador registra costes,
157
+ // pero la UI no los muestra hasta que una configuración lo active.
158
+ .when(COSTS, (el) => el
159
+ .child(div().text_color(t.border).child("|"))
160
+ .child(
161
+ h_flex().gap(3).items_center()
162
+ .child(div().text_color(t.muted).child("Gasto:"))
163
+ .child(hasStats
164
+ ? h_flex().gap(3).items_center()
165
+ .child(div().font_semibold().text_color(t.working).child(costText))
166
+ .child(div().text_color(t.dim).text_size(UI.text.tiny).child(budgetText))
167
+ : div().text_color(t.dim).child("—"))
168
+ ))
165
169
  )
166
170
  .child(div().flex_1())
167
171
  // Right: Search, Nuevo Ticket, Theme Switcher & Settings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jmanuelcorral/bond-app",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Local orchestrator and hub-container runner for multi-agent tickets",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
package/runner/Dockerfile CHANGED
@@ -1,9 +1,13 @@
1
- # bond-app runner image (P3, D19; P5): bond, pi, herdr-core (hc) and herdr. No sshd and no
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). P5: herdr is back so each run can host a bond team (one agent per hub repo, in
4
- # herdr panes); its TUI runs inside the run's hc terminal.
5
- # No credentials are baked in: the GitHub token and the agent config arrive per run on
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,19 @@ 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
- ARG BOND_VERSION=1.15.0
19
- ARG PI_VERSION=1.5.1
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=
20
35
 
21
36
  RUN apt-get update \
22
37
  && apt-get install -y --no-install-recommends git ca-certificates procps curl \
@@ -36,12 +51,8 @@ RUN curl -fsSL -o /usr/local/bin/herdr \
36
51
  && echo "${HERDR_SHA256} /usr/local/bin/herdr" | sha256sum -c - \
37
52
  && chmod 0755 /usr/local/bin/herdr && herdr --version
38
53
 
39
- # bond and pi from the public npm registry, exact versions. `bond team` needs herdr (P5).
40
- RUN npm install -g --registry=https://registry.npmjs.org/ \
41
- @jmanuelcorral/bond@${BOND_VERSION} \
42
- @earendil-works/pi-coding-agent@${PI_VERSION} \
43
- && npm cache clean --force \
44
- && bond --version && pi --version
54
+ # The agent CLIs, supi and bond no longer come from here: setup.sh installs them with
55
+ # versions.env pins (P2/P4).
45
56
 
46
57
  # Unprivileged user for hc and the agent. Its uid differs from the host user's
47
58
  # so nothing the host mounts with uid 1000 is readable by it.
@@ -57,6 +68,24 @@ COPY --chown=runner:runner herdr-config.toml /home/runner/.config/herdr/config.t
57
68
  COPY --chown=runner:runner pi-trust.json /home/runner/.pi/agent/trust.json
58
69
  RUN ln -sf /home/runner/.pi/agent/trust.json /home/runner/.pi/agent/trusted.json
59
70
 
71
+ # P2 (image plan): setup.sh lives in the image too (criterion: the image carries the
72
+ # script and the /opt/runner-agents manifest). The build stages optional config and
73
+ # credentials next to the Dockerfile (image-builder.ts); ".none" means "nothing staged".
74
+ COPY setup.sh versions.env credentials.example.env /opt/runner/
75
+ COPY config.example /opt/runner/config.example
76
+ COPY build-config /tmp/build-config
77
+ COPY build-creds /tmp/build-creds
78
+ RUN chmod 0755 /opt/runner/setup.sh \
79
+ && if [ -n "${PI_VERSION}" ]; then sed -i "s/^PI_VERSION=.*/PI_VERSION=${PI_VERSION}/" /opt/runner/versions.env; fi \
80
+ && if [ -n "${BOND_VERSION}" ]; then sed -i "s/^BOND_VERSION=.*/BOND_VERSION=${BOND_VERSION}/" /opt/runner/versions.env; fi \
81
+ && set -- --agents "${AGENTS}" --with-bond \
82
+ && if [ "${SKIP_AZ}" = "1" ]; then set -- "$@" --skip-az; fi \
83
+ && if [ "${SKIP_GH}" = "1" ]; then set -- "$@" --skip-gh; fi \
84
+ && { [ -f /tmp/build-config/.none ] || set -- "$@" --config /tmp/build-config; } \
85
+ && { [ -f /tmp/build-creds/.none ] || set -- "$@" --credentials /tmp/build-creds/env; } \
86
+ && /opt/runner/setup.sh "$@" \
87
+ && rm -rf /tmp/build-config /tmp/build-creds
88
+
60
89
  COPY entrypoint.sh runner-clone.sh healthcheck.sh /usr/local/lib/runner/
61
90
  RUN chmod 0755 /usr/local/lib/runner/*.sh \
62
91
  && ln -s /usr/local/lib/runner/runner-clone.sh /usr/local/bin/runner-clone \
@@ -0,0 +1,85 @@
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**: 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).
38
+ 3. **Repo con `.bond/bond.toml`**: llega **por git** con el clone del workdir. Si no lo
39
+ tiene, bond ofrece `bond init` (interactivo) → el lanzador no debe usar bond en repos
40
+ sin bond hasta que haya flag para eso.
41
+ 4. **Config de máquina bond** (`~/.bond/config.toml` con `[update] auto=false`) y la
42
+ integración de herdr-pi (lo que pinta la barra de estado `« bond … wR:p2 …`): se hornea
43
+ en el build con `bond setup --yes` como el usuario `runner` (`bond doctor` lista eso
44
+ como pendiente sin setup). El aviso de actualización no bloqueó el arranque.
45
+ 5. **Terminal con tamaño real**: con un pseudo-PTY de tamaño cero `hc` se niega a enganchar
46
+ («zero-sized grid»). En el run real el terminal hc del orquestador tiene tamaño, OK.
47
+ 6. **Riesgo abierto**: en el spike (root) apareció un pop-up de primer uso del cliente hc
48
+ («this is a mouse-first terminal… ↵ continue»). No apareció en la corrida como `runner`
49
+ con attach en `/workspace`. Confirmar en el e2e de P5; si aparece, hornear el estado de
50
+ primer uso de hc o subir el pin de hc (imagen 0.1.17 vs 0.1.21 de escritorio).
51
+
52
+ ## Manifiesto
53
+
54
+ Con `--with-bond`, `/opt/runner-agents` lista además `bond <versión>` (formato `pkg=bond
55
+ version=…`, junto a `pkg=supi`, que ya estaba). Sin bond en la imagen, el lanzador P5 cae
56
+ al agente pelado (fallback).
57
+
58
+ ## Desviaciones registradas (P4)
59
+
60
+ - **Descarga**: el pin se instala del package npm con scope `@jmanuelcorral/bond@<v>`
61
+ (integridad verificada por npm), no del tarball de la release; es la distribución oficial
62
+ con scope (el `bond` de npm sin scope es otro proyecto — D-H). `ARG BOND_VERSION` vacío
63
+ usa el pin de `versions.env`.
64
+ - **Anti-claves**: la imagen no hornea proveedores de pi (el rebuild del wizard no manda
65
+ `config_dir`): las claves viajan solo por la inyección por run (D-E), así que es
66
+ imposible que acaben en la imagen. Un generador «estado del wizard → config_dir sin
67
+ claves» con validación explícita queda como mejora futura.
68
+
69
+ ## Evidencia e2e (P5, 2026-11-19)
70
+
71
+ Imagen `bond-app-runner:p6` (AGENTS=agy,pi, bond 1.16.4). Run `run-20261119T155317-fff97b`
72
+ (ticket contra `jmanuelcorral/bond-app-sandbox-2`, repo con `.bond/bond.toml`):
73
+
74
+ - Proceso en el contenedor: `node /usr/local/bin/bond tui --agent pi -- --model
75
+ llamaswap/… <encargo>` — el encargo viajó completo al agente sin interacción.
76
+ - `hc read bond-run-…/t1` (desde el host) muestra el header de bond (skills, prompts,
77
+ extensions del repo sincronizados) y la barra de estado:
78
+ `bond 🤖 gru@w1:p1 📁 repo 🌿 feat/… 🧠 <modelo> off` + `📊 4% 💰 ↑0↓0 🕐 ⚡ 📝 ✅❌`.
79
+ - El board ve el terminal como `agent: bond`, `state: live` (extensión herdr-agent-state
80
+ instalada por `bond setup` en la imagen).
81
+ - En repos **sin** `.bond/bond.toml` (p. ej. `fluzo-labs/fluzo`) el sondeo del orquestador
82
+ falla y el run lanza el agente pelado como antes (fallback, criterio 3).
83
+ - Nota sin efecto en P5: el modelo de sugerencias `qwen3.5-2b` no admite tools (400);
84
+ para trabajar de verdad hay que elegir en el ticket un modelo con tools
85
+ (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=