@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
|
@@ -21,10 +21,12 @@ import { View, div } from "gpui-kit";
|
|
|
21
21
|
import { v_flex, h_flex, TextareaState, Textarea, InputState, Input } from "gpui-base";
|
|
22
22
|
import { run, spaces, props, theme, openOverlay, closeOverlay, notify, shared, setShared, exec } from "herdr";
|
|
23
23
|
import { api, hcGet, apiUrl } from "./api.js";
|
|
24
|
+
import { CONFIG } from "./config.js";
|
|
24
25
|
import {
|
|
25
26
|
COLUMNS, POLL_MS, buildCards, groupByColumn, loadBoard, launchTicket, cancelRun, launchSummary,
|
|
26
27
|
deliverRun, nudgeRun, finishRun, approveHubFixes, deleteTicket, getDeletePreview,
|
|
27
28
|
columnCounts, filterOptions, filterCards, validateNewTicket, createTicket, AGENTS, TICKET_MODES, TEAM_ENGINES,
|
|
29
|
+
cleanRepoChips, listAssignedIssues, issueTicketId, searchRepos, listRepoIssues, needsWizard,
|
|
28
30
|
} from "./model.js";
|
|
29
31
|
import { stateColor, UI } from "./brand.js";
|
|
30
32
|
|
|
@@ -33,6 +35,10 @@ const REFRESH_KEY = "bond.board.refresh";
|
|
|
33
35
|
const FILTER_KEY = "bond.board.filter";
|
|
34
36
|
const SELECTED_RUN_KEY = "bond.selected_run";
|
|
35
37
|
const SELECTED_TICKET_KEY = "bond.selected_ticket";
|
|
38
|
+
// W-P2: the wizard is offered once per session (D-W2: afterwards it lives in Ajustes).
|
|
39
|
+
let wizardOffered = false;
|
|
40
|
+
|
|
41
|
+
const slug = (s) => String(s).replace(/[^A-Za-z0-9_.-]/g, "_");
|
|
36
42
|
|
|
37
43
|
function spanishStateLabel(col, status) {
|
|
38
44
|
const s = String(status || col || "").toLowerCase();
|
|
@@ -44,34 +50,6 @@ function spanishStateLabel(col, status) {
|
|
|
44
50
|
return `● ${s.toUpperCase()}`;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
|
-
function cleanRepoChips(repos, hubName = "") {
|
|
48
|
-
if (!Array.isArray(repos) || repos.length === 0) return [];
|
|
49
|
-
const names = repos.map((r) =>
|
|
50
|
-
String(typeof r === "object" ? (r?.name || r?.url || "") : (r ?? "")).split("/").pop().replace(/\.git$/, "")
|
|
51
|
-
).filter(Boolean);
|
|
52
|
-
if (names.length > 1) {
|
|
53
|
-
const hubClean = String(hubName).split("/").pop().replace(/\.git$/, "").replace(/-hub$/, "");
|
|
54
|
-
if (hubClean) {
|
|
55
|
-
const parts = hubClean.split("-");
|
|
56
|
-
for (let i = parts.length; i >= 1; i--) {
|
|
57
|
-
const p = parts.slice(0, i).join("-") + "-";
|
|
58
|
-
if (names.every((n) => n.startsWith(p) && n.length > p.length)) {
|
|
59
|
-
return names.map((n) => n.slice(p.length));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
const first = names[0];
|
|
64
|
-
const parts = first.split("-");
|
|
65
|
-
if (parts.length >= 3) {
|
|
66
|
-
const p = parts.slice(0, -2).join("-") + "-";
|
|
67
|
-
if (p.length > 0 && names.every((n) => n.startsWith(p) && n.length > p.length)) {
|
|
68
|
-
return names.map((n) => n.slice(p.length));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return names;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
53
|
export default class BondBoard extends View {
|
|
76
54
|
init(_props, cx) {
|
|
77
55
|
const p = props() ?? {};
|
|
@@ -87,6 +65,9 @@ export default class BondBoard extends View {
|
|
|
87
65
|
try {
|
|
88
66
|
run("layout.hide", { id: "console" });
|
|
89
67
|
} catch {}
|
|
68
|
+
try {
|
|
69
|
+
run("layout.resize", { id: "board", weight: 3 });
|
|
70
|
+
} catch {}
|
|
90
71
|
}
|
|
91
72
|
if (this.view === "launch") {
|
|
92
73
|
// D20: the clone uses the GitHub credential stored in Ajustes (the user's gh
|
|
@@ -127,26 +108,60 @@ export default class BondBoard extends View {
|
|
|
127
108
|
this.agent = "pi";
|
|
128
109
|
this.team_engine = "hc";
|
|
129
110
|
this.errors = {};
|
|
111
|
+
this.setup = null;
|
|
112
|
+
this.selectedModel = null; // null = '(por defecto)'
|
|
113
|
+
cx.spawn(async (cx) => {
|
|
114
|
+
try {
|
|
115
|
+
this.setup = await api("/setup");
|
|
116
|
+
} catch {
|
|
117
|
+
this.setup = null;
|
|
118
|
+
}
|
|
119
|
+
cx.notify();
|
|
120
|
+
});
|
|
130
121
|
this.fields = {
|
|
131
122
|
title: InputState.new({ placeholder: "título del ticket" }),
|
|
132
|
-
|
|
123
|
+
model: InputState.new({ placeholder: "por defecto" }),
|
|
124
|
+
issue: InputState.new({ placeholder: "https://github.com/org/repo/issues/123 (o pulsa Buscar)" }),
|
|
133
125
|
repo: InputState.new({ placeholder: "https://github.com/org/repo" }),
|
|
134
126
|
repos: TextareaState.new({ placeholder: "un repo por línea: https://github.com/org/repo [agente]" }),
|
|
135
127
|
hub: InputState.new({ placeholder: "https://github.com/org/hub" }),
|
|
136
128
|
base: InputState.new({ placeholder: "rama base (opcional: main)" }),
|
|
137
129
|
budget: InputState.new({ value: "2" }),
|
|
138
130
|
timeout: InputState.new({ value: "30" }),
|
|
139
|
-
description: TextareaState.new({ placeholder: "qué hay que hacer (va al PR)" }),
|
|
140
|
-
prompt: TextareaState.new({ placeholder: "encargo al agente (opcional)" }),
|
|
141
|
-
verify: TextareaState.new({ placeholder: "comandos de verificación, uno por línea (opcional)" }),
|
|
142
131
|
};
|
|
132
|
+
// Plan bond-app-nuevo-ticket (P2): la issue se busca, no se pega (D2/D4). Jira hasta P3.
|
|
133
|
+
this.issueProvider = "github";
|
|
134
|
+
this.pickedIssue = null;
|
|
135
|
+
this.carryBody = true; // lleva el cuerpo de la issue a la historia salvo que se desmarque
|
|
136
|
+
this.bondify = true; // bondifica el repo si no lo está salvo que se desmarque (P4, D-U)
|
|
137
|
+
this.issuePanel = null;
|
|
138
|
+
this.issues = null;
|
|
139
|
+
this.issuesLoading = false;
|
|
140
|
+
this.issuesError = null;
|
|
141
|
+
this.issueQuery = InputState.new({ placeholder: "filtrar por título…" });
|
|
142
|
+
this.issueQuery.on("change", (_e, cx) => cx.notify());
|
|
143
|
+
this.issueRepo = null;
|
|
144
|
+
this.repoQuery = InputState.new({ placeholder: "buscar repo…" });
|
|
145
|
+
this.repoQuery.on("change", (_e, cx) => cx.notify());
|
|
146
|
+
this.assignedPool = null;
|
|
147
|
+
this.poolLoading = false;
|
|
148
|
+
this.repoResults = [];
|
|
149
|
+
this.reposLoading = false;
|
|
150
|
+
this.reposError = null;
|
|
143
151
|
this.fields.title.focus();
|
|
144
152
|
return;
|
|
145
153
|
}
|
|
146
154
|
|
|
147
155
|
// The text filter is typed here; repo and agent come from the picker (FILTER_KEY).
|
|
148
|
-
|
|
149
|
-
|
|
156
|
+
const filter = shared(FILTER_KEY) ?? {};
|
|
157
|
+
const initialText = String(filter.text ?? shared("bond.search") ?? "");
|
|
158
|
+
this.search = InputState.new({ value: initialText, placeholder: "Buscar ticket o rama..." });
|
|
159
|
+
this.search.on("change", (_e, cx) => {
|
|
160
|
+
const val = this.search.value();
|
|
161
|
+
setShared("bond.search", val);
|
|
162
|
+
setShared(FILTER_KEY, { ...(shared(FILTER_KEY) ?? {}), text: val });
|
|
163
|
+
cx.notify();
|
|
164
|
+
});
|
|
150
165
|
this.tickets = [];
|
|
151
166
|
this.runs = [];
|
|
152
167
|
this.agentStatus = {};
|
|
@@ -159,10 +174,38 @@ export default class BondBoard extends View {
|
|
|
159
174
|
// after a dialog of this mod launched, cancelled or deleted a run (it bumps the shared marker).
|
|
160
175
|
cx.timer.every(1000, (cx) => {
|
|
161
176
|
const marker = shared(REFRESH_KEY) ?? null;
|
|
177
|
+
let dirty = false;
|
|
162
178
|
if (marker !== this.seenRefresh) {
|
|
163
179
|
this.seenRefresh = marker;
|
|
164
180
|
this.refresh(cx);
|
|
165
181
|
}
|
|
182
|
+
const currentText = (shared(FILTER_KEY) ?? {}).text ?? shared("bond.search");
|
|
183
|
+
if (currentText !== undefined && currentText !== this.search.value()) {
|
|
184
|
+
this.search.set_value(String(currentText ?? ""));
|
|
185
|
+
dirty = true;
|
|
186
|
+
}
|
|
187
|
+
if (dirty) cx.notify();
|
|
188
|
+
});
|
|
189
|
+
this.checkSetup(cx);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// W-P2: first launch — GET /setup says the orchestrator is not configured and the
|
|
193
|
+
// wizard never finished, open the bond-settings wizard once per session. Everything
|
|
194
|
+
// the person does is stored in the orchestrator, so closing it with Esc loses nothing.
|
|
195
|
+
checkSetup(cx) {
|
|
196
|
+
cx.spawn(async () => {
|
|
197
|
+
if (wizardOffered) return;
|
|
198
|
+
try {
|
|
199
|
+
const state = await api("/setup");
|
|
200
|
+
if (!needsWizard(state)) return;
|
|
201
|
+
wizardOffered = true;
|
|
202
|
+
openOverlay({
|
|
203
|
+
mod: "bond-settings", kind: "dialog", modal: true, width: 560, height: 0.92,
|
|
204
|
+
props: { view: "wizard", step: 1 },
|
|
205
|
+
});
|
|
206
|
+
} catch {
|
|
207
|
+
// no API: the board already shows its own «sin conexión» card.
|
|
208
|
+
}
|
|
166
209
|
});
|
|
167
210
|
}
|
|
168
211
|
|
|
@@ -321,10 +364,20 @@ export default class BondBoard extends View {
|
|
|
321
364
|
if (this.busy) return;
|
|
322
365
|
const p = props();
|
|
323
366
|
const v = (k) => this.fields[k].value();
|
|
367
|
+
let modelVal = null;
|
|
368
|
+
if (this.agent === "pi") {
|
|
369
|
+
const models = Array.isArray(this.setup?.models) ? this.setup.models : [];
|
|
370
|
+
if (models.length > 0) {
|
|
371
|
+
modelVal = this.selectedModel || null;
|
|
372
|
+
} else {
|
|
373
|
+
modelVal = v("model") || null;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
324
376
|
const check = validateNewTicket({
|
|
325
377
|
title: v("title"), issue: v("issue"), mode: this.mode, repo: v("repo"), repos: v("repos"), hub: v("hub"),
|
|
326
|
-
base: v("base"), agent: this.agent, team_engine: this.team_engine, budget: v("budget"), timeout: v("timeout"),
|
|
327
|
-
|
|
378
|
+
base: v("base"), model: modelVal, agent: this.agent, team_engine: this.team_engine, budget: v("budget"), timeout: v("timeout"),
|
|
379
|
+
story: this.carryBody && this.pickedIssue ? String(this.pickedIssue.body ?? "") : "",
|
|
380
|
+
bondify: this.bondify,
|
|
328
381
|
});
|
|
329
382
|
this.errors = check.errors;
|
|
330
383
|
this.error = null;
|
|
@@ -360,6 +413,11 @@ export default class BondBoard extends View {
|
|
|
360
413
|
closeOverlay(props().overlay);
|
|
361
414
|
cx.stop_propagation();
|
|
362
415
|
}
|
|
416
|
+
// Enter en el panel de repos busca en GitHub sin salir del teclado.
|
|
417
|
+
if (e.key === "enter" && this.view === "create" && this.issuePanel === "repos") {
|
|
418
|
+
this.searchReposOn(cx);
|
|
419
|
+
cx.stop_propagation();
|
|
420
|
+
}
|
|
363
421
|
}
|
|
364
422
|
|
|
365
423
|
// ---- board actions ----
|
|
@@ -374,7 +432,7 @@ export default class BondBoard extends View {
|
|
|
374
432
|
openLaunch(card) {
|
|
375
433
|
openOverlay({
|
|
376
434
|
mod: "bond-board", kind: "dialog", modal: true, width: 460,
|
|
377
|
-
props: { view: "launch", ticket: this.ticketOf(card), runs: this.runs },
|
|
435
|
+
props: { view: "launch", ticket: this.ticketOf(card), runs: this.runs, destinations: card.destinations },
|
|
378
436
|
});
|
|
379
437
|
}
|
|
380
438
|
|
|
@@ -388,7 +446,7 @@ export default class BondBoard extends View {
|
|
|
388
446
|
openDeliver(card) {
|
|
389
447
|
openOverlay({
|
|
390
448
|
mod: "bond-board", kind: "dialog", modal: true, width: 460,
|
|
391
|
-
props: { view: "deliver", runId: card.run.id, title: card.title, branch: card.branch, repo: card.repo },
|
|
449
|
+
props: { view: "deliver", runId: card.run.id, title: card.title, branch: card.branch, repo: card.repo, destinations: card.destinations },
|
|
392
450
|
});
|
|
393
451
|
}
|
|
394
452
|
|
|
@@ -532,6 +590,16 @@ export default class BondBoard extends View {
|
|
|
532
590
|
}
|
|
533
591
|
|
|
534
592
|
selectCard(card, cx) {
|
|
593
|
+
// Un ticket Ready sin run no tiene sesión propia: no se salta a ninguna consola
|
|
594
|
+
// (antes caía en el espacio que estuviera seleccionado, que no era el suyo);
|
|
595
|
+
// el clic abre el lanzador, que es la acción de un Ready (D4).
|
|
596
|
+
if (!card.run) {
|
|
597
|
+
this.selectedCardId = card.id;
|
|
598
|
+
setShared(SELECTED_TICKET_KEY, card.id);
|
|
599
|
+
if (cx) cx.notify();
|
|
600
|
+
this.openLaunch(card);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
535
603
|
this.selectedCardId = card.id;
|
|
536
604
|
setShared(SELECTED_RUN_KEY, card.run?.id ?? null);
|
|
537
605
|
setShared(SELECTED_TICKET_KEY, card.id);
|
|
@@ -678,10 +746,24 @@ export default class BondBoard extends View {
|
|
|
678
746
|
)
|
|
679
747
|
)
|
|
680
748
|
)
|
|
681
|
-
.
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
749
|
+
.child(
|
|
750
|
+
h_flex().items_center().gap(4)
|
|
751
|
+
.when(Boolean(card.canOpen), (el) =>
|
|
752
|
+
el.child(
|
|
753
|
+
div().text_size(UI.text.tiny).font_family("JetBrains Mono").text_color(t.accent).child("Abrir sesión →")
|
|
754
|
+
)
|
|
755
|
+
)
|
|
756
|
+
.child(
|
|
757
|
+
div().id(`card-menu-btn-${card.id}`).px(4).py(0.5).rounded(UI.radius)
|
|
758
|
+
.text_size(UI.text.small).font_family("JetBrains Mono").text_color(t.muted).cursor_pointer()
|
|
759
|
+
.hover((s) => s.bg(t.hover).text_color(t.foreground))
|
|
760
|
+
.on_mouse_down("left", (_e, cx) => cx.stop_propagation())
|
|
761
|
+
.on_click((_e, cx) => {
|
|
762
|
+
cx.stop_propagation();
|
|
763
|
+
this.openCardMenu(card);
|
|
764
|
+
})
|
|
765
|
+
.child("⋯")
|
|
766
|
+
)
|
|
685
767
|
)
|
|
686
768
|
)
|
|
687
769
|
// Ticket title in sans UI font
|
|
@@ -693,7 +775,7 @@ export default class BondBoard extends View {
|
|
|
693
775
|
.child(
|
|
694
776
|
h_flex().gap(4).items_center().truncate()
|
|
695
777
|
.child(div().text_color(t.dim).child("hub:"))
|
|
696
|
-
.child(div().text_color(t.accent).truncate().child(hubLabel))
|
|
778
|
+
.child(div().text_color(t.accent).truncate().child(hubLabel.replace(/^hub\s+/i, "")))
|
|
697
779
|
)
|
|
698
780
|
.when(hubRepos.length > 0, (sub) =>
|
|
699
781
|
sub.child(
|
|
@@ -715,21 +797,22 @@ export default class BondBoard extends View {
|
|
|
715
797
|
)
|
|
716
798
|
// Agent & state
|
|
717
799
|
.child(dim(`${card.agent || "agente"} · ${card.agentState || "listo"}`))
|
|
718
|
-
// Metrics bar: Cost + Time
|
|
719
|
-
.
|
|
800
|
+
// Metrics bar: Cost + Time. Los costes están desactivados por defecto
|
|
801
|
+
// (CONFIG.costs); el tiempo se sigue mostrando si hay run.
|
|
802
|
+
.when(CONFIG.costs || Boolean(time), (bar) => bar.child(
|
|
720
803
|
h_flex().items_center().justify_between().p(5).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border).font_family("JetBrains Mono").text_size(UI.text.small)
|
|
721
|
-
.child(
|
|
804
|
+
.when(CONFIG.costs, (el) => el.child(
|
|
722
805
|
h_flex().gap(3).items_center()
|
|
723
806
|
.child(div().text_color(t.dim).child("Gasto:"))
|
|
724
807
|
.child(div().font_semibold().text_color(t.working).child(money))
|
|
725
808
|
.child(div().text_color(t.dim).text_size(UI.text.tiny).child(budget))
|
|
726
|
-
)
|
|
809
|
+
))
|
|
727
810
|
.when(Boolean(time), (el) =>
|
|
728
811
|
el.child(
|
|
729
812
|
div().text_color(t.bond_waiting ?? t.blocked).font_medium().child(String(time))
|
|
730
813
|
)
|
|
731
814
|
)
|
|
732
|
-
)
|
|
815
|
+
))
|
|
733
816
|
// Diagnostic box with motivo: and bond hub check:
|
|
734
817
|
.when(Boolean(card.failureReason) || Boolean(card.hub && card.analysis), (el) =>
|
|
735
818
|
el.child(
|
|
@@ -763,7 +846,8 @@ export default class BondBoard extends View {
|
|
|
763
846
|
.when(Boolean(card.prUrl) && (card.deliveries || []).length === 0, (el) => el.child(div().text_size(UI.text.small).font_family("JetBrains Mono").text_color(t.accent).truncate().child(String(`PR #${card.prNumber} · ${card.prUrl}`))))
|
|
764
847
|
// Footer
|
|
765
848
|
.child(
|
|
766
|
-
div().pt(2).text_size(UI.text.tiny).font_family(UI.fontSans).text_color(t.dim).text_right()
|
|
849
|
+
div().pt(2).text_size(UI.text.tiny).font_family(UI.fontSans).text_color(t.dim).text_right()
|
|
850
|
+
.child(card.run ? "Haz clic para abrir sesión y consola" : "Haz clic para lanzar")
|
|
767
851
|
);
|
|
768
852
|
|
|
769
853
|
return h_flex().id(`card-${card.id}`).flex_none().items_stretch().rounded(UI.radiusLg).overflow_hidden()
|
|
@@ -797,7 +881,8 @@ export default class BondBoard extends View {
|
|
|
797
881
|
.items_center()
|
|
798
882
|
.justify_center()
|
|
799
883
|
.rounded(UI.radius)
|
|
800
|
-
.
|
|
884
|
+
.border_2()
|
|
885
|
+
.border_dashed()
|
|
801
886
|
.border_color(t.border)
|
|
802
887
|
.text_center()
|
|
803
888
|
.font_family(UI.fontSans)
|
|
@@ -899,16 +984,25 @@ export default class BondBoard extends View {
|
|
|
899
984
|
.child(String(card.branch))
|
|
900
985
|
)
|
|
901
986
|
)
|
|
902
|
-
.when(Boolean(card.repo), (el) =>
|
|
903
|
-
|
|
987
|
+
.when(Boolean(card.repo), (el) => {
|
|
988
|
+
let repoText = "";
|
|
989
|
+
if (card.hub) {
|
|
990
|
+
const raw = (card.hub && Array.isArray(card.hub.repos)) ? card.hub.repos : [];
|
|
991
|
+
const rawLabel = String(card.hub.label || card.hub.url || (typeof card.hub === "string" ? card.hub : "hub"));
|
|
992
|
+
const chips = cleanRepoChips(raw, rawLabel);
|
|
993
|
+
repoText = chips.length > 0 ? `· repos: ${chips.join(", ")}` : `· hub: ${rawLabel.replace(/^hub\s+/i, "")}`;
|
|
994
|
+
} else {
|
|
995
|
+
repoText = `· repo: ${String(card.repo)}`;
|
|
996
|
+
}
|
|
997
|
+
return el.child(
|
|
904
998
|
div()
|
|
905
999
|
.text_size(UI.text.small)
|
|
906
1000
|
.font_family("JetBrains Mono")
|
|
907
1001
|
.text_color(t.dim)
|
|
908
1002
|
.truncate()
|
|
909
|
-
.child(
|
|
910
|
-
)
|
|
911
|
-
)
|
|
1003
|
+
.child(repoText)
|
|
1004
|
+
);
|
|
1005
|
+
})
|
|
912
1006
|
// Copyable docker exec command pill (D23)
|
|
913
1007
|
.when(Boolean(card.containerCommand), (el) =>
|
|
914
1008
|
el.child(
|
|
@@ -991,6 +1085,47 @@ export default class BondBoard extends View {
|
|
|
991
1085
|
);
|
|
992
1086
|
}
|
|
993
1087
|
|
|
1088
|
+
// El orquestador nunca respondió: tarjeta centrada que explica cómo arreglarlo y permite
|
|
1089
|
+
// reintentar ya; el error crudo queda pequeño y tenue, para revisar (decisión 2026-11-19).
|
|
1090
|
+
renderApiDown() {
|
|
1091
|
+
const t = theme();
|
|
1092
|
+
return v_flex()
|
|
1093
|
+
.id("bond-api-down")
|
|
1094
|
+
.size_full()
|
|
1095
|
+
.items_center()
|
|
1096
|
+
.justify_center()
|
|
1097
|
+
.p(10)
|
|
1098
|
+
.bg(t.canvas)
|
|
1099
|
+
.text_color(t.foreground)
|
|
1100
|
+
.font_family("JetBrains Mono")
|
|
1101
|
+
.child(
|
|
1102
|
+
v_flex()
|
|
1103
|
+
.w(520)
|
|
1104
|
+
.max_w_full()
|
|
1105
|
+
.p(24)
|
|
1106
|
+
.gap(8)
|
|
1107
|
+
.items_center()
|
|
1108
|
+
.rounded(UI.radiusLg)
|
|
1109
|
+
.bg(t.chrome)
|
|
1110
|
+
.border_1()
|
|
1111
|
+
.border_color(t.border)
|
|
1112
|
+
.child(div().text_size(26).child("🔌"))
|
|
1113
|
+
.child(div().text_size(UI.text.title + 2).font_semibold().child("Sin conexión con el orquestador"))
|
|
1114
|
+
.child(div().text_size(UI.text.small).text_center().text_color(t.muted)
|
|
1115
|
+
.child(`El tablero necesita la API local en ${apiUrl()}. Arranca «bond-app start» en una terminal.`))
|
|
1116
|
+
.child(div().text_size(UI.text.tiny).text_color(t.dim).child("Se reintenta cada 3 segundos; al responder, el tablero solo se refresca."))
|
|
1117
|
+
.child(this.button("btn-api-retry", "Reintentar", "primary", (cx) => this.refresh(cx)))
|
|
1118
|
+
.child(div().pt(6).text_size(UI.text.tiny).text_center().text_color(t.dim).child(String(this.apiError ?? "")))
|
|
1119
|
+
);
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
// Primer refresco en vuelo: nada de kanbanes falsos con ceros.
|
|
1123
|
+
renderLoading() {
|
|
1124
|
+
const t = theme();
|
|
1125
|
+
return v_flex().id("bond-loading").size_full().items_center().justify_center().bg(t.canvas)
|
|
1126
|
+
.child(div().font_family("JetBrains Mono").text_size(UI.text.small).text_color(t.dim).child("Cargando el tablero…"));
|
|
1127
|
+
}
|
|
1128
|
+
|
|
994
1129
|
renderBoard() {
|
|
995
1130
|
const t = theme();
|
|
996
1131
|
const cards = buildCards(this.tickets, this.runs, this.agentStatus);
|
|
@@ -1003,12 +1138,18 @@ export default class BondBoard extends View {
|
|
|
1003
1138
|
totalCost += c.costUsd || 0;
|
|
1004
1139
|
totalBudget += c.budgetUsd || 0;
|
|
1005
1140
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1141
|
+
// Las estadísticas solo se publican con carga real: sin ellas la barra de título
|
|
1142
|
+
// muestra «—» en vez de mentir con ceros (decisión 2026-11-19).
|
|
1143
|
+
if (this.loaded) {
|
|
1144
|
+
setShared("bond.board_stats", {
|
|
1145
|
+
total: cards.length,
|
|
1146
|
+
counts,
|
|
1147
|
+
cost: totalCost,
|
|
1148
|
+
budget: totalBudget,
|
|
1149
|
+
});
|
|
1150
|
+
} else {
|
|
1151
|
+
setShared("bond.board_stats", null);
|
|
1152
|
+
}
|
|
1012
1153
|
|
|
1013
1154
|
if (this.boardMode === "session" && this.selectedCardId) {
|
|
1014
1155
|
const activeCard = cards.find((c) => c.id === this.selectedCardId);
|
|
@@ -1021,13 +1162,24 @@ export default class BondBoard extends View {
|
|
|
1021
1162
|
const filter = shared(FILTER_KEY) ?? {};
|
|
1022
1163
|
const sharedSearch = shared("bond.search");
|
|
1023
1164
|
const inputSearch = this.search?.value?.() ?? "";
|
|
1024
|
-
const
|
|
1165
|
+
const activeSearch = (typeof filter.text === "string" && filter.text.length > 0)
|
|
1166
|
+
? filter.text
|
|
1167
|
+
: (inputSearch.length > 0 ? inputSearch : (sharedSearch ? String(sharedSearch) : ""));
|
|
1168
|
+
const searchVal = activeSearch.trim();
|
|
1169
|
+
// El primer refresco no ha completado: no se finge un tablero vacio, se dice lo que pasa
|
|
1170
|
+
// (decisión 2026-11-19).
|
|
1171
|
+
if (!this.loaded) {
|
|
1172
|
+
return this.apiError ? this.renderApiDown() : this.renderLoading();
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1025
1175
|
const shown = filterCards(cards, { repo: filter.repo, agent: filter.agent, text: searchVal });
|
|
1026
1176
|
const columns = groupByColumn(shown);
|
|
1027
1177
|
|
|
1028
1178
|
return v_flex().id("bond-board").size_full().p(10).gap(8).bg(t.canvas).text_color(t.foreground)
|
|
1029
|
-
|
|
1030
|
-
|
|
1179
|
+
// La API cae tras haber cargado: se conserva el último kanban; el aviso no lleva el crudo.
|
|
1180
|
+
.when(Boolean(this.apiError), (el) => el.child(div().px(10).py(6).rounded(UI.radius).bg(t.raised).border_1().border_color(t.blocked)
|
|
1181
|
+
.text_size(UI.text.small).font_family("JetBrains Mono").text_color(t.blocked)
|
|
1182
|
+
.child(`Sin respuesta del orquestador (${apiUrl()}); se reintenta cada 3 s`)))
|
|
1031
1183
|
.child(h_flex().id("bond-columns").flex_1().min_h(0).gap(8).items_stretch().overflow_x_scrollbar()
|
|
1032
1184
|
.children(columns.map((col) => this.column(col))));
|
|
1033
1185
|
}
|
|
@@ -1062,6 +1214,230 @@ export default class BondBoard extends View {
|
|
|
1062
1214
|
.child(label);
|
|
1063
1215
|
}
|
|
1064
1216
|
|
|
1217
|
+
// Plan bond-app-nuevo-ticket (P2): búsqueda combinada en el diálogo. Paso 1: repos —
|
|
1218
|
+
// los de tus issues asignadas, y búsqueda por nombre en GitHub (buscar + Buscar/Enter).
|
|
1219
|
+
// Paso 2: issues abiertas del repo elegido (ready primero, luego las tuyas).
|
|
1220
|
+
ghErrorText(e) {
|
|
1221
|
+
const msg = String(e?.message ?? e);
|
|
1222
|
+
return msg === "github_not_configured"
|
|
1223
|
+
? "No hay sesión de GitHub: conéctala en Ajustes («Usar mi sesión de gh») y reintenta."
|
|
1224
|
+
: msg === "github_api_error" || msg.startsWith("HTTP")
|
|
1225
|
+
? "GitHub no responde ahora mismo; reintenta."
|
|
1226
|
+
: msg;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
searchIssues(cx) {
|
|
1230
|
+
this.issuePanel = "repos";
|
|
1231
|
+
this.loadPool(cx);
|
|
1232
|
+
if (String(this.repoQuery.value() ?? "").trim()) this.searchReposOn(cx);
|
|
1233
|
+
else cx.notify();
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
loadPool(cx) {
|
|
1237
|
+
if (this.assignedPool || this.poolLoading) { cx.notify(); return; }
|
|
1238
|
+
this.poolLoading = true;
|
|
1239
|
+
cx.notify();
|
|
1240
|
+
cx.spawn(async (cx) => {
|
|
1241
|
+
try {
|
|
1242
|
+
const data = await listAssignedIssues(api, this.issueProvider);
|
|
1243
|
+
this.assignedPool = Array.isArray(data?.issues) ? data.issues : [];
|
|
1244
|
+
} catch (e) {
|
|
1245
|
+
this.reposError = this.ghErrorText(e);
|
|
1246
|
+
} finally {
|
|
1247
|
+
this.poolLoading = false;
|
|
1248
|
+
cx.notify();
|
|
1249
|
+
}
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
searchReposOn(cx) {
|
|
1254
|
+
const term = String(this.repoQuery.value() ?? "").trim();
|
|
1255
|
+
if (!term || this.reposLoading) return;
|
|
1256
|
+
this.reposLoading = true;
|
|
1257
|
+
this.reposError = null;
|
|
1258
|
+
cx.notify();
|
|
1259
|
+
cx.spawn(async (cx) => {
|
|
1260
|
+
try {
|
|
1261
|
+
const data = await searchRepos(api, term);
|
|
1262
|
+
this.repoResults = (Array.isArray(data?.repos) ? data.repos : []).map((r) => ({ key: String(r.full_name) }));
|
|
1263
|
+
} catch (e) {
|
|
1264
|
+
this.reposError = this.ghErrorText(e);
|
|
1265
|
+
} finally {
|
|
1266
|
+
this.reposLoading = false;
|
|
1267
|
+
cx.notify();
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
pickRepo(key, cx) {
|
|
1273
|
+
this.issueRepo = key;
|
|
1274
|
+
this.issuePanel = "issues";
|
|
1275
|
+
this.issues = null;
|
|
1276
|
+
this.issuesLoading = true;
|
|
1277
|
+
this.issuesError = null;
|
|
1278
|
+
cx.notify();
|
|
1279
|
+
const [owner, repo] = String(key).split("/");
|
|
1280
|
+
cx.spawn(async (cx) => {
|
|
1281
|
+
try {
|
|
1282
|
+
const data = await listRepoIssues(api, owner, repo);
|
|
1283
|
+
this.issues = Array.isArray(data?.issues) ? data.issues : [];
|
|
1284
|
+
} catch (e) {
|
|
1285
|
+
this.issuesError = this.ghErrorText(e);
|
|
1286
|
+
} finally {
|
|
1287
|
+
this.issuesLoading = false;
|
|
1288
|
+
cx.notify();
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
// Check del alta: el cuerpo de la issue viaja como historia del ticket (primer mensaje
|
|
1294
|
+
// del agente). Sin esto el agente arranca sin la US.
|
|
1295
|
+
issueBodyRow() {
|
|
1296
|
+
const t = theme();
|
|
1297
|
+
const bodyText = String(this.pickedIssue?.body ?? "").trim();
|
|
1298
|
+
if (!bodyText) return null;
|
|
1299
|
+
return h_flex()
|
|
1300
|
+
.id("iss-carry-body")
|
|
1301
|
+
.gap(7)
|
|
1302
|
+
.items_center()
|
|
1303
|
+
.px(2)
|
|
1304
|
+
.py(3)
|
|
1305
|
+
.cursor_pointer()
|
|
1306
|
+
.text_color(t.foreground)
|
|
1307
|
+
.font_family(UI.fontSans)
|
|
1308
|
+
.text_size(UI.text.small)
|
|
1309
|
+
.on_click((_e, cx) => {
|
|
1310
|
+
this.carryBody = !this.carryBody;
|
|
1311
|
+
cx.notify();
|
|
1312
|
+
})
|
|
1313
|
+
.child(
|
|
1314
|
+
div()
|
|
1315
|
+
.w(13).h(13).rounded(3).border_1()
|
|
1316
|
+
.border_color(this.carryBody ? t.accent : t.border)
|
|
1317
|
+
.bg(this.carryBody ? t.accent : t.input)
|
|
1318
|
+
.child(div().text_size(10).text_center().text_color(t.chrome).child(this.carryBody ? "✓" : ""))
|
|
1319
|
+
)
|
|
1320
|
+
.child(`Llevar el cuerpo de la issue a la historia (${bodyText.length} caracteres). Sin marcar, el agente arranca sin la US.`);
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
// P4 (D-U): bondificar automáticamente el repo si no tiene .bond/bond.toml
|
|
1324
|
+
bondifyRow() {
|
|
1325
|
+
const t = theme();
|
|
1326
|
+
return h_flex()
|
|
1327
|
+
.id("ticket-bondify")
|
|
1328
|
+
.gap(7)
|
|
1329
|
+
.items_center()
|
|
1330
|
+
.px(2)
|
|
1331
|
+
.py(3)
|
|
1332
|
+
.cursor_pointer()
|
|
1333
|
+
.text_color(t.foreground)
|
|
1334
|
+
.font_family(UI.fontSans)
|
|
1335
|
+
.text_size(UI.text.small)
|
|
1336
|
+
.on_click((_e, cx) => {
|
|
1337
|
+
this.bondify = !this.bondify;
|
|
1338
|
+
cx.notify();
|
|
1339
|
+
})
|
|
1340
|
+
.child(
|
|
1341
|
+
div()
|
|
1342
|
+
.w(13).h(13).rounded(3).border_1()
|
|
1343
|
+
.border_color(this.bondify ? t.accent : t.border)
|
|
1344
|
+
.bg(this.bondify ? t.accent : t.input)
|
|
1345
|
+
.child(div().text_size(10).text_center().text_color(t.chrome).child(this.bondify ? "✓" : ""))
|
|
1346
|
+
)
|
|
1347
|
+
.child("Bondificar el repo si no lo está (bond init + commit propio)");
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
pickIssue(it) {
|
|
1351
|
+
this.pickedIssue = it;
|
|
1352
|
+
this.issuePanel = null;
|
|
1353
|
+
this.fields.issue.set_value(it.url ?? "");
|
|
1354
|
+
if (it.title) this.fields.title.set_value(it.title); // D4: automático y editable
|
|
1355
|
+
if (this.mode === "repo" && it.owner && it.repo) {
|
|
1356
|
+
this.fields.repo.set_value(`https://github.com/${it.owner}/${it.repo}`);
|
|
1357
|
+
}
|
|
1358
|
+
this.errors = {};
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
useIssueUrl() {
|
|
1362
|
+
const url = String(this.fields.issue.value() ?? "").trim();
|
|
1363
|
+
if (!url) {
|
|
1364
|
+
this.errors = { ...this.errors, issue: "Pega antes la URL de la issue" };
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
this.pickedIssue = { url, title: "", manual: true };
|
|
1368
|
+
this.issuePanel = null;
|
|
1369
|
+
this.errors = {};
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
clearIssue() {
|
|
1373
|
+
this.pickedIssue = null;
|
|
1374
|
+
this.fields.issue.set_value("");
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
// Repos con issues tuyas abiertas (pool asignado), ready primero; base del paso 1.
|
|
1378
|
+
issueRepoGroups() {
|
|
1379
|
+
const map = new Map();
|
|
1380
|
+
for (const it of this.assignedPool ?? []) {
|
|
1381
|
+
const key = `${it.owner}/${it.repo}`;
|
|
1382
|
+
const g = map.get(key) ?? { key, n: 0, ready: 0 };
|
|
1383
|
+
g.n += 1;
|
|
1384
|
+
if (it.ready) g.ready += 1;
|
|
1385
|
+
map.set(key, g);
|
|
1386
|
+
}
|
|
1387
|
+
return [...map.values()].sort((a, b) => b.ready - a.ready || b.n - a.n || a.key.localeCompare(b.key));
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
// Los de tus issues asignadas primero; debajo, los golpes de la búsqueda en GitHub.
|
|
1391
|
+
issueRepoChoices() {
|
|
1392
|
+
const local = this.issueRepoGroups();
|
|
1393
|
+
const seen = new Set(local.map((g) => g.key));
|
|
1394
|
+
const remote = (this.repoResults ?? [])
|
|
1395
|
+
.filter((r) => r.key.includes("/") && !seen.has(r.key))
|
|
1396
|
+
.map((r) => ({ key: r.key, n: 0, ready: 0, remote: true }));
|
|
1397
|
+
return [...local, ...remote];
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
repoRow(g) {
|
|
1401
|
+
const t = theme();
|
|
1402
|
+
return h_flex().id(`iss-repo-${g.key.replace("/", "-")}`).h(26).px(8).gap(6).items_center()
|
|
1403
|
+
.rounded(UI.radius).text_size(12).font_family("JetBrains Mono").cursor_pointer()
|
|
1404
|
+
.text_color(t.foreground).hover((s) => s.bg(t.hover))
|
|
1405
|
+
.on_click((_e, cx) => this.pickRepo(g.key, cx))
|
|
1406
|
+
.child(div().flex_1().truncate().child(g.key))
|
|
1407
|
+
.when(Boolean(g.remote), (el) => el.child(div().text_size(UI.text.tiny).text_color(t.dim).child("GitHub")))
|
|
1408
|
+
.when(!g.remote && g.ready > 0, (el) => el.child(div().text_size(UI.text.tiny).text_color(t.accent).child(`ready ${g.ready}`)))
|
|
1409
|
+
.when(!g.remote, (el) => el.child(div().text_size(UI.text.tiny).text_color(t.dim).child(`${g.n} ${g.n === 1 ? "issue" : "issues"}`)));
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
issueRow(it) {
|
|
1413
|
+
const t = theme();
|
|
1414
|
+
return h_flex().id(`iss-row-${it.owner}-${it.repo}-${it.number}`).h(26).px(8).gap(6).items_center()
|
|
1415
|
+
.rounded(UI.radius).text_size(12).font_family("JetBrains Mono").cursor_pointer()
|
|
1416
|
+
.text_color(t.foreground).hover((s) => s.bg(t.hover))
|
|
1417
|
+
.on_click((_e, cx) => { this.pickIssue(it); cx.notify(); })
|
|
1418
|
+
.child(div().w(12).text_center().text_color(it.ready ? t.accent : t.dim).child(it.ready ? "✓" : "#"))
|
|
1419
|
+
.child(div().w(46).text_color(t.dim).child(`#${it.number}`))
|
|
1420
|
+
.child(div().flex_1().truncate().child(String(it.title ?? "")))
|
|
1421
|
+
.when(Boolean(it.ready), (el) => el.child(div().text_size(UI.text.tiny).text_color(t.accent).child("ready")));
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
renderModelSelector(models) {
|
|
1425
|
+
const defaultLabel = this.setup?.default_model
|
|
1426
|
+
? `(por defecto — ${this.setup.default_model})`
|
|
1427
|
+
: "(por defecto)";
|
|
1428
|
+
const isDefault = !this.selectedModel;
|
|
1429
|
+
return h_flex().id("model-selector").gap(6).flex_wrap()
|
|
1430
|
+
.child(this.choice("model-choice-default", defaultLabel, isDefault, () => {
|
|
1431
|
+
this.selectedModel = null;
|
|
1432
|
+
}))
|
|
1433
|
+
.children(models.map((m) => {
|
|
1434
|
+
const on = this.selectedModel === m;
|
|
1435
|
+
return this.choice(`model-choice-${slug(m)}`, m, on, () => {
|
|
1436
|
+
this.selectedModel = m;
|
|
1437
|
+
});
|
|
1438
|
+
}));
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1065
1441
|
renderCreate(p) {
|
|
1066
1442
|
const t = theme();
|
|
1067
1443
|
const e = this.errors ?? {};
|
|
@@ -1074,25 +1450,105 @@ export default class BondBoard extends View {
|
|
|
1074
1450
|
: this.mode === "list"
|
|
1075
1451
|
? this.field("Repos (se crea un hub con ellos)", area("repos", 70), e.repos)
|
|
1076
1452
|
: this.field("Hub existente", input("hub"), e.hub);
|
|
1077
|
-
|
|
1453
|
+
|
|
1454
|
+
// Panel de búsqueda combinada: primero repos, luego las issues del repo elegido.
|
|
1455
|
+
// Filtro «contiene»: cada palabra escrita debe aparecer (en cualquier orden); los
|
|
1456
|
+
// separadores no importan — «bond app» encuentra «bond-app».
|
|
1457
|
+
const lq = (s) => String(s ?? "").trim().toLowerCase();
|
|
1458
|
+
const has = (text, words) => words.every((w) => String(text).toLowerCase().includes(w));
|
|
1459
|
+
const rq = lq(this.repoQuery.value()).split(/\s+/).filter(Boolean);
|
|
1460
|
+
const iq = lq(this.issueQuery.value()).split(/\s+/).filter(Boolean);
|
|
1461
|
+
const repos = this.issueRepoChoices().filter((g) => has(g.key, rq));
|
|
1462
|
+
const shown = (this.issues ?? [])
|
|
1463
|
+
.filter((it) => `${it.owner}/${it.repo}` === this.issueRepo)
|
|
1464
|
+
.filter((it) => has(`${it.title} #${it.number}`, iq));
|
|
1465
|
+
const withStatus = (el, loading, error, loadingText, tag) => el
|
|
1466
|
+
.when(Boolean(loading), (x) => x.child(div().px(6).py(2).text_size(UI.text.small).text_color(t.dim).child(String(loadingText))))
|
|
1467
|
+
.when(Boolean(error), (x) => x.child(h_flex().gap(8).items_center()
|
|
1468
|
+
.child(div().flex_1().text_size(UI.text.small).text_color(t.blocked).child(String(error)))
|
|
1469
|
+
.when(String(error).includes("Ajustes"), (y) => y.child(this.button(`iss-open-settings-${tag}`, "Abrir Ajustes", "plain", () => run("layout.toggle", { id: "settings" }))))));
|
|
1470
|
+
const urlRow = h_flex().gap(6).items_center()
|
|
1471
|
+
.child(div().flex_1().child(Input.new(this.fields.issue).h(26).px(8).rounded(UI.radius).border_1()
|
|
1472
|
+
.border_color(e.issue ? t.blocked : t.input).bg(t.background).text_size(11)))
|
|
1473
|
+
.child(this.button("iss-use-url", "Usar URL", "plain", () => this.useIssueUrl()));
|
|
1474
|
+
let panel = null;
|
|
1475
|
+
if (this.issuePanel === "repos") {
|
|
1476
|
+
panel = withStatus(v_flex().id("iss-repos-panel").gap(6).p(8).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border)
|
|
1477
|
+
.child(h_flex().gap(6).items_center()
|
|
1478
|
+
.child(div().flex_1().child(Input.new(this.repoQuery).h(26).px(8).rounded(UI.radius).border_1().border_color(t.input).bg(t.background).text_size(12)))
|
|
1479
|
+
.child(this.button("iss-repo-go", this.reposLoading ? "Buscando…" : "Buscar", "plain", (cx) => this.searchReposOn(cx))))
|
|
1480
|
+
.child(v_flex().max_h(170).overflow_y_scrollbar().gap(1)
|
|
1481
|
+
.when(!this.reposLoading && !this.poolLoading && !this.reposError && repos.length === 0, (el) => el.child(
|
|
1482
|
+
div().px(6).py(3).text_size(UI.text.small).text_color(t.dim).child(rq.length ? "Ningún repo coincide; pulsa Buscar para mirar en GitHub" : "No tienes issues asignadas abiertas")))
|
|
1483
|
+
.children(repos.map((g) => this.repoRow(g))))
|
|
1484
|
+
.child(urlRow),
|
|
1485
|
+
this.reposLoading || this.poolLoading, this.reposError,
|
|
1486
|
+
this.reposLoading ? "Buscando repositorios en GitHub…" : "Buscando tus issues asignadas…", "repos");
|
|
1487
|
+
} else if (this.issuePanel === "issues") {
|
|
1488
|
+
panel = withStatus(v_flex().id("iss-issues-panel").gap(6).p(8).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border)
|
|
1489
|
+
.child(h_flex().gap(6).items_center()
|
|
1490
|
+
.child(this.button("iss-back-repos", "←", "plain", () => { this.issuePanel = "repos"; }))
|
|
1491
|
+
.child(div().text_size(12).font_medium().child(String(this.issueRepo ?? "")))
|
|
1492
|
+
.child(div().flex_1())
|
|
1493
|
+
.child(div().w(220).child(Input.new(this.issueQuery).h(26).px(8).rounded(UI.radius).border_1()
|
|
1494
|
+
.border_color(t.input).bg(t.background).text_size(12))))
|
|
1495
|
+
.child(v_flex().max_h(170).overflow_y_scrollbar().gap(1)
|
|
1496
|
+
.when(!this.issuesLoading && !this.issuesError && shown.length === 0, (el) => el.child(
|
|
1497
|
+
div().px(6).py(3).text_size(UI.text.small).text_color(t.dim).child(iq.length ? "Ninguna issue coincide" : "Sin issues abiertas en este repo")))
|
|
1498
|
+
.children(shown.map((it) => this.issueRow(it))))
|
|
1499
|
+
.child(urlRow),
|
|
1500
|
+
this.issuesLoading, this.issuesError, "Buscando issues del repo…", "issues");
|
|
1501
|
+
}
|
|
1502
|
+
const badge = this.pickedIssue ? (() => {
|
|
1503
|
+
const id = issueTicketId(this.pickedIssue);
|
|
1504
|
+
const text = this.pickedIssue.manual
|
|
1505
|
+
? `issue enlazada → ${this.pickedIssue.url}`
|
|
1506
|
+
: `issue enlazada → ${id ?? this.pickedIssue.url}${id ? ` · rama feat/${id}` : ""} · ${String(this.pickedIssue.title ?? "")}`;
|
|
1507
|
+
return div().id("iss-picked").px(8).py(5).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border)
|
|
1508
|
+
.text_size(UI.text.tiny).text_color(t.muted).child(text);
|
|
1509
|
+
})() : null;
|
|
1510
|
+
|
|
1511
|
+
// El panel va justo debajo de la fila de Buscar, no al pie del diálogo.
|
|
1512
|
+
const body = [
|
|
1078
1513
|
this.field("Título", input("title"), e.title),
|
|
1079
|
-
this.field("Historia de usuario (
|
|
1514
|
+
this.field("Historia de usuario (issue)", h_flex().gap(6).flex_wrap().items_center()
|
|
1515
|
+
.child(this.choice("iss-provider-github", "GitHub", this.issueProvider === "github", () => { this.issueProvider = "github"; }))
|
|
1516
|
+
.child(this.choice("iss-provider-jira", "Jira (después)", false, () => { this.errors = { ...this.errors, issue: "Jira llega en su fase del plan" }; }))
|
|
1517
|
+
.child(this.button("iss-search", this.issuesLoading ? "Buscando…" : "Buscar", "plain", (cx) => this.searchIssues(cx)))
|
|
1518
|
+
.when(Boolean(this.pickedIssue), (el) => el.child(this.button("iss-clear", "quitar", "plain", () => this.clearIssue()))), e.issue),
|
|
1519
|
+
];
|
|
1520
|
+
if (badge) body.push(badge);
|
|
1521
|
+
if (panel) body.push(panel);
|
|
1522
|
+
if (this.pickedIssue && String(this.pickedIssue.body ?? "").trim()) {
|
|
1523
|
+
const row = this.issueBodyRow();
|
|
1524
|
+
if (row) body.push(row);
|
|
1525
|
+
}
|
|
1526
|
+
body.push(this.bondifyRow());
|
|
1527
|
+
body.push(
|
|
1080
1528
|
this.field("Dónde trabaja", h_flex().gap(6).flex_wrap()
|
|
1081
1529
|
.children(TICKET_MODES.map((m) => this.choice(`mode-${m.id}`, m.label, this.mode === m.id, () => { this.mode = m.id; }))), null),
|
|
1082
1530
|
where,
|
|
1083
1531
|
h_flex().gap(10)
|
|
1084
1532
|
.child(div().flex_1().child(this.field(this.mode === "hub" ? "Rama base del hub" : "Rama base", input("base"), e.base)))
|
|
1085
|
-
.child(div().w(90).child(this.field("Tope USD", input("budget"), e.budget)))
|
|
1533
|
+
.when(CONFIG.costs, (el) => el.child(div().w(90).child(this.field("Tope USD", input("budget"), e.budget))))
|
|
1086
1534
|
.child(div().w(90).child(this.field("Timeout min", input("timeout"), e.timeout))),
|
|
1087
1535
|
this.field("Agente", h_flex().gap(6).flex_wrap()
|
|
1088
1536
|
.children(AGENTS.map((a) => this.choice(`agent-${a}`, a, this.agent === a, () => { this.agent = a; }))), e.agent),
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
this.
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1537
|
+
);
|
|
1538
|
+
if (this.agent === "pi") {
|
|
1539
|
+
const models = Array.isArray(this.setup?.models) ? this.setup.models : [];
|
|
1540
|
+
if (models.length > 0) {
|
|
1541
|
+
body.push(this.field("Modelo", this.renderModelSelector(models), e.model));
|
|
1542
|
+
} else {
|
|
1543
|
+
body.push(this.field("Modelo", input("model"), e.model));
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
if (this.mode !== "repo") {
|
|
1547
|
+
body.push(this.field("Motor de equipo", h_flex().gap(6).flex_wrap()
|
|
1548
|
+
.children(TEAM_ENGINES.map((en) => this.choice(`engine-${en.id}`, en.label, this.team_engine === en.id, () => { this.team_engine = en.id; }))), null));
|
|
1549
|
+
}
|
|
1550
|
+
body.push(div().text_size(UI.text.small).text_color(t.dim).child("El ticket queda en Ready: no arranca hasta que lo lances (D4)."));
|
|
1551
|
+
return this.renderDialog("Nuevo ticket", body, [
|
|
1096
1552
|
this.button("dlg-back", "Volver", "plain", () => closeOverlay(p.overlay)),
|
|
1097
1553
|
this.button("dlg-create", this.busy ? "Creando…" : "Crear ticket", "primary", (cx) => this.create(cx)),
|
|
1098
1554
|
]);
|
|
@@ -1118,7 +1574,7 @@ export default class BondBoard extends View {
|
|
|
1118
1574
|
renderCardMenu(p) {
|
|
1119
1575
|
const t = theme();
|
|
1120
1576
|
const card = p.card ?? (this.tickets && this.runs ? buildCards(this.tickets, this.runs, this.agentStatus).find((c) => c.id === p.cardId) : null) ?? {};
|
|
1121
|
-
const item = (id, label, icon, danger, action) =>
|
|
1577
|
+
const item = (id, label, icon, danger, action, keep = false) =>
|
|
1122
1578
|
h_flex()
|
|
1123
1579
|
.id(id)
|
|
1124
1580
|
.h(28)
|
|
@@ -1133,7 +1589,7 @@ export default class BondBoard extends View {
|
|
|
1133
1589
|
.hover((s) => s.bg(t.hover))
|
|
1134
1590
|
.on_click((_e, cx) => {
|
|
1135
1591
|
cx.stop_propagation();
|
|
1136
|
-
closeOverlay(p.overlay);
|
|
1592
|
+
if (!keep) closeOverlay(p.overlay);
|
|
1137
1593
|
action(cx);
|
|
1138
1594
|
})
|
|
1139
1595
|
.child(div().w(16).text_size(UI.text.small).text_center().child(icon))
|
|
@@ -1158,19 +1614,19 @@ export default class BondBoard extends View {
|
|
|
1158
1614
|
el.child(item(`menu-shell-${card.id}`, "Shell del contenedor", "", false, (cx) => this.openContainerShell(card, cx)))
|
|
1159
1615
|
)
|
|
1160
1616
|
.when(Boolean(card.canLaunch), (el) =>
|
|
1161
|
-
el.child(item(`menu-launch-${card.id}`, "Lanzar run", "▶", false, () => this.openLaunch(card)))
|
|
1617
|
+
el.child(item(`menu-launch-${card.id}`, "Lanzar run", "▶", false, () => this.openLaunch(card), true))
|
|
1162
1618
|
)
|
|
1163
1619
|
.when(Boolean(card.canDeliver), (el) =>
|
|
1164
|
-
el.child(item(`menu-deliver-${card.id}`, "Entregar…", "↑", false, () => this.openDeliver(card)))
|
|
1620
|
+
el.child(item(`menu-deliver-${card.id}`, "Entregar…", "↑", false, () => this.openDeliver(card), true))
|
|
1165
1621
|
)
|
|
1166
1622
|
.when(Boolean(card.canNudge), (el) =>
|
|
1167
|
-
el.child(item(`menu-nudge-${card.id}`, "Desbloquear…", "💬", false, () => this.openNudge(card)))
|
|
1623
|
+
el.child(item(`menu-nudge-${card.id}`, "Desbloquear…", "💬", false, () => this.openNudge(card), true))
|
|
1168
1624
|
)
|
|
1169
1625
|
.when(Boolean(card.canFinish), (el) =>
|
|
1170
|
-
el.child(item(`menu-finish-${card.id}`, "Terminado…", "✓", false, () => this.openFinish(card)))
|
|
1626
|
+
el.child(item(`menu-finish-${card.id}`, "Terminado…", "✓", false, () => this.openFinish(card), true))
|
|
1171
1627
|
)
|
|
1172
1628
|
.when(Boolean(card.canApprove), (el) =>
|
|
1173
|
-
el.child(item(`menu-approve-${card.id}`, "Aprobar arreglos…", "✓", false, () => this.openApprove(card)))
|
|
1629
|
+
el.child(item(`menu-approve-${card.id}`, "Aprobar arreglos…", "✓", false, () => this.openApprove(card), true))
|
|
1174
1630
|
)
|
|
1175
1631
|
.when(Boolean(card.prUrl) && (card.deliveries || []).length === 0, (el) =>
|
|
1176
1632
|
el.child(item(`menu-pr-${card.id}`, "Abrir PR", "↗", false, () => this.openPr(card)))
|
|
@@ -1184,10 +1640,10 @@ export default class BondBoard extends View {
|
|
|
1184
1640
|
el.child(item(`menu-copy-docker-${card.id}`, "Copiar docker exec", "📋", false, (cx) => this.copyToClipboard(card.containerCommand, cx)))
|
|
1185
1641
|
)
|
|
1186
1642
|
.when(Boolean(card.canCancel), (el) =>
|
|
1187
|
-
el.child(item(`menu-cancel-${card.id}`, "Cancelar run…", "✕", true, () => this.openCancel(card)))
|
|
1643
|
+
el.child(item(`menu-cancel-${card.id}`, "Cancelar run…", "✕", true, () => this.openCancel(card), true))
|
|
1188
1644
|
)
|
|
1189
1645
|
.child(div().h(1).my(2).bg(t.border))
|
|
1190
|
-
.child(item(`menu-delete-${card.id}`, "Borrar ticket…", "🗑", true, () => this.openDelete(card)));
|
|
1646
|
+
.child(item(`menu-delete-${card.id}`, "Borrar ticket…", "🗑", true, () => this.openDelete(card), true));
|
|
1191
1647
|
}
|
|
1192
1648
|
|
|
1193
1649
|
render() {
|
|
@@ -1205,8 +1661,15 @@ export default class BondBoard extends View {
|
|
|
1205
1661
|
: ready
|
|
1206
1662
|
? div().text_size(11.5).text_color(t.dim).child(`El clon usa la sesión de GitHub${gh.login ? ` de ${gh.login}` : ""} guardada en Ajustes; llega al contenedor por stdin.`)
|
|
1207
1663
|
: div().text_size(12).text_color(t.blocked).child("No hay credencial de GitHub: conéctala en Ajustes («Usar mi sesión de gh») y vuelve a lanzar.");
|
|
1664
|
+
const destLines = (p.destinations?.length || 0) > 0 ? [
|
|
1665
|
+
div().text_size(11.5).text_color(t.dim).child("Destinos de push (hub.toml):"),
|
|
1666
|
+
...p.destinations.map((d) =>
|
|
1667
|
+
div().text_size(11.5).text_color(t.muted).child(`• ${d.name}: ${d.url || "(sin remoto)"} (base ${d.base})`)
|
|
1668
|
+
),
|
|
1669
|
+
] : [];
|
|
1208
1670
|
return this.renderDialog(`Lanzar «${ticket.title ?? ""}»`, [
|
|
1209
1671
|
div().text_size(12.5).text_color(t.muted).child(launchSummary(ticket)),
|
|
1672
|
+
...destLines,
|
|
1210
1673
|
ghLine,
|
|
1211
1674
|
], [
|
|
1212
1675
|
this.button("dlg-cancel", "Volver", "plain", () => closeOverlay(p.overlay)),
|
|
@@ -1277,9 +1740,17 @@ export default class BondBoard extends View {
|
|
|
1277
1740
|
]);
|
|
1278
1741
|
}
|
|
1279
1742
|
if (this.view === "deliver") {
|
|
1743
|
+
const destLines = (p.destinations?.length || 0) > 0 ? [
|
|
1744
|
+
div().text_size(11.5).text_color(t.dim).child("Destinos de push (hub.toml):"),
|
|
1745
|
+
...p.destinations.map((d) =>
|
|
1746
|
+
div().text_size(11.5).text_color(t.muted).child(`• ${d.name}: ${d.url || "(sin remoto)"} (base ${d.base})`)
|
|
1747
|
+
),
|
|
1748
|
+
] : [
|
|
1749
|
+
div().text_size(11.5).text_color(t.dim).child(`Rama ${p.branch ?? "?"} → ${p.repo ?? "?"} (solo esa rama y ese repo).`),
|
|
1750
|
+
];
|
|
1280
1751
|
return this.renderDialog(`Entregar «${p.title ?? ""}»`, [
|
|
1281
1752
|
div().text_size(12.5).text_color(t.muted).child("Se ejecutan los comandos de verificación del ticket; si pasan, se hace commit de lo que dejó el agente, se empuja la rama y se abre el PR (en un run con hub, en cada repo con cambios y en el hub si cambió)."),
|
|
1282
|
-
|
|
1753
|
+
...destLines,
|
|
1283
1754
|
], [
|
|
1284
1755
|
this.button("dlg-back", "Volver", "plain", () => closeOverlay(p.overlay)),
|
|
1285
1756
|
this.button("dlg-deliver", this.busy ? "Entregando…" : "Entregar", "primary", (cx) => this.deliver(cx)),
|