@jmanuelcorral/bond-app 0.1.5 → 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.
Files changed (70) hide show
  1. package/README.md +211 -17
  2. package/app/brand/TOKENS.md +5 -5
  3. package/app/layouts/bond.json +10 -14
  4. package/app/mods/bond-agents/api.js +35 -0
  5. package/app/mods/bond-agents/branch.svg +1 -0
  6. package/app/mods/bond-agents/brand.js +53 -2
  7. package/app/mods/bond-agents/config.js +4 -0
  8. package/app/mods/bond-agents/eye-off.svg +1 -0
  9. package/app/mods/bond-agents/eye.svg +1 -0
  10. package/app/mods/bond-agents/main.js +308 -327
  11. package/app/mods/bond-agents/model.js +354 -5
  12. package/app/mods/bond-board/api.js +35 -0
  13. package/app/mods/bond-board/branch.svg +1 -0
  14. package/app/mods/bond-board/brand.js +53 -2
  15. package/app/mods/bond-board/config.js +4 -0
  16. package/app/mods/bond-board/main.js +686 -444
  17. package/app/mods/bond-board/model.js +99 -25
  18. package/app/mods/bond-pane/close.svg +1 -0
  19. package/app/mods/bond-pane/hide.svg +1 -0
  20. package/app/mods/bond-pane/main.js +103 -0
  21. package/app/mods/bond-pane/mod.json +1 -0
  22. package/app/mods/bond-pane/model.js +18 -0
  23. package/app/mods/bond-pane/split-down.svg +1 -0
  24. package/app/mods/bond-pane/split-right.svg +1 -0
  25. package/app/mods/bond-pane/unzoom.svg +1 -0
  26. package/app/mods/bond-pane/zoom.svg +1 -0
  27. package/app/mods/bond-settings/api.js +35 -0
  28. package/app/mods/bond-settings/brand.js +53 -2
  29. package/app/mods/bond-settings/config.js +4 -0
  30. package/app/mods/bond-settings/main.js +1159 -278
  31. package/app/mods/bond-settings/mod.json +1 -1
  32. package/app/mods/bond-status/api.js +35 -0
  33. package/app/mods/bond-status/brand.js +53 -2
  34. package/app/mods/bond-status/config.js +4 -0
  35. package/app/mods/bond-status/main.js +37 -15
  36. package/app/mods/bond-status/model.js +19 -1
  37. package/app/mods/bond-tabs/brand.js +53 -2
  38. package/app/mods/bond-tabs/main.js +45 -3
  39. package/app/mods/bond-titlebar/brand.js +53 -2
  40. package/app/mods/bond-titlebar/main.js +85 -29
  41. package/app/mods/bond-titlebar/version.js +3 -0
  42. package/app/themes/bond-dark.json +5 -5
  43. package/app/themes/bond-light.json +5 -5
  44. package/package.json +1 -1
  45. package/runner/Dockerfile +16 -2
  46. package/runner/SPIKE-BOND.md +6 -2
  47. package/runner/entrypoint.sh +16 -0
  48. package/runner/setup.sh +439 -8
  49. package/runner/versions.env +32 -1
  50. package/scripts/app-install.ts +60 -1
  51. package/src/cli.ts +53 -3
  52. package/src/core/agy-login.ts +682 -0
  53. package/src/core/delivery.ts +3 -1
  54. package/src/core/orchestrator.ts +736 -78
  55. package/src/core/repo-host.ts +60 -0
  56. package/src/core/setup.ts +62 -1
  57. package/src/core/watchdog.ts +6 -6
  58. package/src/db/database.ts +41 -1
  59. package/src/db/settings-repo.ts +332 -7
  60. package/src/db/ticket-repo.ts +46 -20
  61. package/src/index.ts +4 -4
  62. package/src/runner/azure-devops-client.ts +163 -0
  63. package/src/runner/docker-client.ts +59 -9
  64. package/src/runner/github-client.ts +30 -3
  65. package/src/runner/hc-client.ts +33 -5
  66. package/src/runner/image-builder.ts +123 -5
  67. package/src/runner/jira-client.ts +368 -0
  68. package/src/runner/tool-catalog.ts +84 -0
  69. package/src/server/app.ts +377 -5
  70. package/src/types.ts +129 -2
@@ -12,12 +12,12 @@
12
12
  //
13
13
  // P6: bond's look. A header with a counter per state, filters (repo, agent, text) and
14
14
  // «Nuevo ticket» (a dialog with validation; the ticket lands in Ready, D4); each column
15
- // in its state's color; empty columns folded to a narrow strip. Colors come from the
15
+ // in its state's color; empty columns keep their width with a short line. Colors come from the
16
16
  // theme through brand.js (stateColor), never as literals here.
17
17
  //
18
18
  // Props: none (the board), or { view: "launch" | "cancel" | "deliver" | "nudge" | "approve"
19
19
  // | "create" | "pick", ... } when this mod is opened as a dialog or popup by the board.
20
- import { View, div } from "gpui-kit";
20
+ import { View, div, svg, image } 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";
@@ -25,10 +25,13 @@ import { CONFIG } from "./config.js";
25
25
  import {
26
26
  COLUMNS, POLL_MS, buildCards, groupByColumn, loadBoard, launchTicket, cancelRun, launchSummary,
27
27
  deliverRun, nudgeRun, finishRun, approveHubFixes, deleteTicket, getDeletePreview,
28
- columnCounts, filterOptions, filterCards, validateNewTicket, createTicket, AGENTS, TICKET_MODES, TEAM_ENGINES,
29
- cleanRepoChips, listAssignedIssues, issueTicketId, searchRepos, listRepoIssues, needsWizard,
28
+ columnCounts, filterOptions, filterCards, issueChip, validateNewTicket, createTicket, AGENTS, TICKET_MODES, TEAM_ENGINES,
29
+ cleanRepoChips, listAssignedIssues, issueTicketId, searchRepos, listRepoIssues, searchJiraIssues, resetIssueProviderState, needsWizard, timeoutLabel,
30
30
  } from "./model.js";
31
- import { stateColor, UI } from "./brand.js";
31
+ import { stateColor, UI, settingsOverlay, createOverlay, markColor } from "./brand.js";
32
+
33
+ /** The Shell button's program: zsh when the run's container has it, else bash (login shells). */
34
+ const SHELL_ARGV = ["sh", "-c", "if command -v zsh >/dev/null 2>&1; then exec zsh -l; else exec bash -l; fi"];
32
35
 
33
36
  const REFRESH_KEY = "bond.board.refresh";
34
37
  // The board's repo/agent filter: a picker popup of this mod sets it, the board reads it.
@@ -50,6 +53,12 @@ function spanishStateLabel(col, status) {
50
53
  return `● ${s.toUpperCase()}`;
51
54
  }
52
55
 
56
+ /** Height of an empty column's placeholder: one for all five, subtitle or not. */
57
+ const EMPTY_COLUMN_H = 132;
58
+
59
+ /** The line an empty column shows under its header. */
60
+ const EMPTY_LINE = { ready: "Nada pendiente", running: "Nada en curso", waiting: "Nada en espera", finished: "Nada terminado", error: "Sin errores" };
61
+
53
62
  export default class BondBoard extends View {
54
63
  init(_props, cx) {
55
64
  const p = props() ?? {};
@@ -122,32 +131,73 @@ export default class BondBoard extends View {
122
131
  title: InputState.new({ placeholder: "título del ticket" }),
123
132
  model: InputState.new({ placeholder: "por defecto" }),
124
133
  issue: InputState.new({ placeholder: "https://github.com/org/repo/issues/123 (o pulsa Buscar)" }),
125
- repo: InputState.new({ placeholder: "https://github.com/org/repo" }),
134
+ repo: InputState.new({ placeholder: "https://github.com/org/repo o https://dev.azure.com/org/proyecto/_git/repo" }),
126
135
  repos: TextareaState.new({ placeholder: "un repo por línea: https://github.com/org/repo [agente]" }),
127
136
  hub: InputState.new({ placeholder: "https://github.com/org/hub" }),
128
137
  base: InputState.new({ placeholder: "rama base (opcional: main)" }),
129
138
  budget: InputState.new({ value: "2" }),
130
- timeout: InputState.new({ value: "30" }),
139
+ timeout: InputState.new({ value: "0", placeholder: "0 = sin timeout" }),
131
140
  };
132
141
  // Plan bond-app-nuevo-ticket (P2): la issue se busca, no se pega (D2/D4). Jira hasta P3.
133
142
  this.issueProvider = "github";
134
143
  this.pickedIssue = null;
135
144
  this.carryBody = true; // lleva el cuerpo de la issue a la historia salvo que se desmarque
136
145
  this.bondify = true; // bondifica el repo si no lo está salvo que se desmarque (P4, D-U)
146
+ // Plan bond-app-ajustes-imagen P4: «Docker en el run». Se pre-marca si el repo trae
147
+ // devcontainer, salvo que la persona ya lo haya tocado.
148
+ this.docker = false;
149
+ this.dockerTouched = false;
150
+ this.devcontainerRepo = null; // "owner/repo" con devcontainer detectado
151
+ this.devcontainerChecked = null; // último "owner/repo@base" consultado
152
+ // Dónde: el repo elegido es un hub (hub.toml) → el ticket va en modo hub, salvo que
153
+ // la persona pida tratarlo como un repo normal.
154
+ this.hubDetected = null; // URL del repo elegido cuando trae hub.toml
155
+ this.hubAsRepo = false;
137
156
  this.issuePanel = null;
138
157
  this.issues = null;
139
158
  this.issuesLoading = false;
140
159
  this.issuesError = null;
141
- this.issueQuery = InputState.new({ placeholder: "filtrar por título…" });
160
+ this.issueQuery = InputState.new({ placeholder: "filtra tus issues, escribe owner/repo para ver las de un repo, o pega la URL de una issue" });
142
161
  this.issueQuery.on("change", (_e, cx) => cx.notify());
162
+ this.jiraQuery = InputState.new({ placeholder: "buscar por texto o clave en Jira (KEY-123)…" });
163
+ this.jiraQuery.on("change", (_e, cx) => cx.notify());
164
+ this.jiraResults = null;
165
+ this.jiraSearching = false;
166
+ // «Asignadas a mí»: on, the list is your open issues and «Buscar» stays within them;
167
+ // off, it searches the whole site (and with no text lists its open issues).
168
+ this.jiraMine = true;
143
169
  this.issueRepo = null;
144
- this.repoQuery = InputState.new({ placeholder: "buscar repo…" });
170
+ this.repoQuery = InputState.new({ placeholder: "buscar repo en favoritos, recientes, GitHub y Azure Repos (o pega su URL)" });
145
171
  this.repoQuery.on("change", (_e, cx) => cx.notify());
172
+ // P4: con un repo de GitHub completo (escrito o elegido con su issue) se mira si trae
173
+ // devcontainer; checkDevcontainer no repite la misma consulta.
174
+ for (const f of [this.fields.repo, this.fields.base]) {
175
+ f.on("change", (_e, cx) => this.checkDevcontainer(cx));
176
+ f.on("blur", (_e, cx) => this.checkDevcontainer(cx));
177
+ }
146
178
  this.assignedPool = null;
147
179
  this.poolLoading = false;
148
180
  this.repoResults = [];
149
181
  this.reposLoading = false;
150
182
  this.reposError = null;
183
+ // Alta en tres bloques (Qué · Dónde · Quién; decisión 2026-11-24): la historia se ve y
184
+ // se edita; el repo se elige aparte de la issue, con favoritos, recientes, GitHub y Azure.
185
+ this.source = "github"; // github | jira | manual
186
+ this.choosing = true; // la lista de issues abierta (al elegir una se pliega)
187
+ this.story = TextareaState.new({ placeholder: "qué tiene que hacer el agente: lo lee como primer mensaje" });
188
+ this.story.set_rows(4);
189
+ this.repoSel = null; // { url, label, host, base? } del bloque Dónde
190
+ this.repoChoosing = true;
191
+ this.repoFilter = "todos"; // todos | recientes | github | azure
192
+ this.repoSuggest = null;
193
+ this.repoSuggestLoading = false;
194
+ this.repoSuggestErrors = {};
195
+ this.repoSuggestFor = null;
196
+ this.listRepos = []; // «Varios (hub)»: { url, label }
197
+ this.optionsOpen = false;
198
+ this.repoQuery.on("change", (_e, cx) => this.suggestReposSoon(cx));
199
+ this.loadPool(cx);
200
+ this.suggestRepos(cx, "");
151
201
  this.fields.title.focus();
152
202
  return;
153
203
  }
@@ -199,10 +249,7 @@ export default class BondBoard extends View {
199
249
  const state = await api("/setup");
200
250
  if (!needsWizard(state)) return;
201
251
  wizardOffered = true;
202
- openOverlay({
203
- mod: "bond-settings", kind: "dialog", modal: true, width: 560, height: 0.92,
204
- props: { view: "wizard", step: 1 },
205
- });
252
+ openOverlay(settingsOverlay({ view: "wizard", step: 1 }));
206
253
  } catch {
207
254
  // no API: the board already shows its own «sin conexión» card.
208
255
  }
@@ -246,6 +293,9 @@ export default class BondBoard extends View {
246
293
  closeOverlay(p.overlay);
247
294
  } catch (e) {
248
295
  this.error = String(e?.message ?? e);
296
+ // Also as a toast: the dialog may be gone by the time the start fails.
297
+ notify({ title: "No se pudo lanzar el run", body: this.error, level: "error" });
298
+ setShared(REFRESH_KEY, Date.now());
249
299
  this.busy = false;
250
300
  cx.notify();
251
301
  }
@@ -373,11 +423,20 @@ export default class BondBoard extends View {
373
423
  modelVal = v("model") || null;
374
424
  }
375
425
  }
426
+ // Dónde: the chosen repo (or the typed URL) and the chips of «Varios (hub)».
427
+ const repoUrl = this.repoSel?.url ?? v("repo");
428
+ const reposText = this.listRepos.map((r) => r.url).join("\n");
429
+ const storyText = String(this.story.value() ?? "");
376
430
  const check = validateNewTicket({
377
- title: v("title"), issue: v("issue"), mode: this.mode, repo: v("repo"), repos: v("repos"), hub: v("hub"),
431
+ title: v("title"), issue: v("issue"), mode: this.mode, repo: repoUrl, repos: reposText, hub: v("hub"),
378
432
  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 ?? "") : "",
433
+ // Desmarcado con issue que trae cuerpo = story "" explícita (el agente arranca sin
434
+ // historia); sin issue o sin cuerpo = undefined (comportamiento heredado).
435
+ // The story is what the box holds: emptied on purpose with an issue = "" (the agent
436
+ // starts without it); nothing typed and no issue = undefined (legacy behaviour).
437
+ story: storyText.trim() ? storyText : this.pickedIssue ? "" : undefined,
380
438
  bondify: this.bondify,
439
+ docker: this.docker,
381
440
  });
382
441
  this.errors = check.errors;
383
442
  this.error = null;
@@ -493,7 +552,7 @@ export default class BondBoard extends View {
493
552
  }
494
553
 
495
554
  openCreate() {
496
- openOverlay({ mod: "bond-board", kind: "dialog", modal: true, width: 560, props: { view: "create" } });
555
+ openOverlay(createOverlay());
497
556
  }
498
557
 
499
558
  openPick(field, options) {
@@ -623,6 +682,13 @@ export default class BondBoard extends View {
623
682
  try {
624
683
  run("space.select", { id: sp.id });
625
684
  } catch {}
685
+ } else if (card.run?.hc_machine && ["running", "waiting", "verifying", "blocked", "analyzing"].includes(String(card.run.state))) {
686
+ // E1 (plan bond-app-pestanas-paneles): the run gets its own space on its machine,
687
+ // never a terminal.show over whatever tab was open. space.new brings a shell in the
688
+ // "bond-init" tab; bond-agents gives the orchestrator its own tab and closes that one.
689
+ try {
690
+ run("space.new", { machine: card.run.hc_machine, name: card.title || card.id, tab: "bond-init" });
691
+ } catch {}
626
692
  } else if (card.terminal) {
627
693
  try {
628
694
  run("terminal.show", { terminal: card.terminal });
@@ -669,6 +735,9 @@ export default class BondBoard extends View {
669
735
 
670
736
  const folder = card.hub ? "/workspace/hub" : "/workspace";
671
737
  const tabName = "shell";
738
+ // Plan bond-app-ajustes-imagen P3: zsh (oh-my-zsh, grupo «shell» de la imagen) when the
739
+ // container has it, bash otherwise. Only this human shell: the agents keep bash.
740
+ const argv = SHELL_ARGV;
672
741
 
673
742
  try {
674
743
  const sp = this.spaceForCard(card);
@@ -677,6 +746,7 @@ export default class BondBoard extends View {
677
746
  space: sp.id,
678
747
  name: tabName,
679
748
  folder,
749
+ argv,
680
750
  });
681
751
  } else {
682
752
  run("space.new", {
@@ -684,6 +754,7 @@ export default class BondBoard extends View {
684
754
  name: card.title || card.id,
685
755
  tab: tabName,
686
756
  folder,
757
+ argv,
687
758
  });
688
759
  }
689
760
  } catch {
@@ -715,168 +786,114 @@ export default class BondBoard extends View {
715
786
 
716
787
  card(card) {
717
788
  const t = theme();
718
- const dim = (text) => div().text_size(UI.text.small).font_family("JetBrains Mono").text_color(t.dim).truncate().child(String(text ?? ""));
719
- const money = card.run ? `$${(card.costUsd || 0).toFixed(2)}` : "$0.00";
720
- const budget = `/$${(card.budgetUsd || 0).toFixed(2)}`;
721
- const time = card.elapsed ? `⏱ ${card.elapsed}` : "";
789
+ const mono = (el) => el.font_family("JetBrains Mono");
722
790
  const color = stateColor(t, card.column);
723
791
  const isSelected = this.selectedCardId === card.id;
724
- const isWaiting = card.column === "waiting" || card.status === "waiting";
725
- const cardBorder = isSelected ? t.ring : (isWaiting ? (t.bond_waiting ?? t.blocked) : (card.canOpen ? t.accent : t.border));
726
-
727
- const hubLabel = card.hub ? String(card.hub.label || card.hub.url || (typeof card.hub === "string" ? card.hub : "hub")) : "";
728
- const rawRepos = (card.hub && Array.isArray(card.hub.repos)) ? card.hub.repos : [];
729
- const hubRepos = cleanRepoChips(rawRepos, hubLabel);
792
+ // The state's color goes on the card's border for the columns that ask for attention
793
+ // (running, waiting, error); ready and finished stay neutral.
794
+ const attention = ["running", "waiting", "error"].includes(card.column) || card.status === "waiting";
795
+ const cardBorder = isSelected ? t.ring : (attention ? color : t.border);
796
+ const hovered = this.hoveredCard === card.id;
797
+ const action = this.primaryAction(card);
798
+ const chip = issueChip(card.issueUrl, card.repoKeys?.[0]);
799
+ const azure = /dev\.azure\.com|visualstudio\.com/.test(String(card.repoUrl ?? ""));
800
+ const hubLabel = card.hub ? String(card.hub.label || card.hub.url || "hub").replace(/^hub\s+/i, "") : "";
801
+ const hubRepos = card.hub ? cleanRepoChips(Array.isArray(card.hub.repos) ? card.hub.repos : [], hubLabel) : [];
802
+ const money = card.run ? `$${(card.costUsd || 0).toFixed(2)}` : "$0.00";
730
803
 
731
- const body = v_flex().flex_1().min_w(0).p(8).gap(4)
732
- // Top row: status chip + branch + open session link
733
- .child(
734
- h_flex().items_center().justify_between().gap(4)
735
- .child(
736
- h_flex().items_center().gap(4).flex_wrap()
737
- .child(
738
- div().px(6).py(1).rounded(UI.radius).bg(t.raised).border_1().border_color(color)
739
- .text_size(UI.text.tiny).font_family("JetBrains Mono").font_semibold().text_color(color)
740
- .child(spanishStateLabel(card.column, card.status))
741
- )
742
- .when(Boolean(card.branch), (el) =>
743
- el.child(
744
- div().px(5).py(1).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border)
745
- .text_size(UI.text.tiny).font_family("JetBrains Mono").text_color(t.muted).truncate().child(String(card.branch))
746
- )
747
- )
748
- )
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
- )
767
- )
768
- )
769
- // Ticket title in sans UI font
770
- .child(div().text_size(UI.text.title).font_semibold().font_family(UI.fontSans).text_color(t.foreground).child(String(card.title || card.id || "")))
771
- // Hub and Repositories
772
- .when(Boolean(card.hub), (el) =>
773
- el.child(
774
- v_flex().gap(2).font_family("JetBrains Mono").text_size(UI.text.small)
775
- .child(
776
- h_flex().gap(4).items_center().truncate()
777
- .child(div().text_color(t.dim).child("hub:"))
778
- .child(div().text_color(t.accent).truncate().child(hubLabel.replace(/^hub\s+/i, "")))
779
- )
780
- .when(hubRepos.length > 0, (sub) =>
781
- sub.child(
782
- h_flex().gap(3).items_center().truncate()
783
- .child(div().text_color(t.dim).child("repos:"))
784
- .children(hubRepos.map((r) =>
785
- div().px(4).py(0.5).rounded(4).bg(t.raised).border_1().border_color(t.border).text_color(t.muted).text_size(UI.text.tiny).child(r)
786
- ))
787
- )
788
- )
789
- )
790
- )
791
- .when(!card.hub && Boolean(card.repo), (el) =>
792
- el.child(
793
- h_flex().gap(4).items_center().font_family("JetBrains Mono").text_size(UI.text.small).truncate()
794
- .child(div().text_color(t.dim).child("repo:"))
795
- .child(div().text_color(t.muted).truncate().child(String(card.repo)))
796
- )
797
- )
798
- // Agent & state
799
- .child(dim(`${card.agent || "agente"} · ${card.agentState || "listo"}`))
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(
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)
804
- .when(CONFIG.costs, (el) => el.child(
805
- h_flex().gap(3).items_center()
806
- .child(div().text_color(t.dim).child("Gasto:"))
807
- .child(div().font_semibold().text_color(t.working).child(money))
808
- .child(div().text_color(t.dim).text_size(UI.text.tiny).child(budget))
809
- ))
810
- .when(Boolean(time), (el) =>
811
- el.child(
812
- div().text_color(t.bond_waiting ?? t.blocked).font_medium().child(String(time))
813
- )
814
- )
815
- ))
816
- // Diagnostic box with motivo: and bond hub check:
804
+ const body = v_flex().flex_1().min_w(0).p(8).gap(5)
805
+ // 1. State, issue and, on hover, the state's main action; «⋯» always.
806
+ .child(h_flex().items_center().gap(4).min_w(0)
807
+ .child(mono(div().flex_none().px(6).py(1).rounded(UI.radius).bg(t.raised).border_1().border_color(color)
808
+ .text_size(UI.text.tiny).font_semibold().text_color(color)).child(spanishStateLabel(card.column, card.status)))
809
+ .when(Boolean(chip), (el) => el.child(mono(div().id(`card-issue-${card.id}`).flex_none().px(5).py(1).rounded(UI.radius)
810
+ .bg(t.raised).border_1().border_color(t.border).text_size(UI.text.tiny).text_color(markColor(t, chip.host)).cursor_pointer()
811
+ .hover((s) => s.bg(t.hover)).tooltip(`Abrir ${chip.url}`)
812
+ .on_mouse_down("left", (_e, cx) => cx.stop_propagation())
813
+ .on_click((_e, cx) => { cx.stop_propagation(); exec("xdg-open", [chip.url]).catch(() => {}); }))
814
+ .child(chip.label)))
815
+ .child(div().flex_1())
816
+ .when(hovered && Boolean(action), (el) => el.child(this.button(`card-act-${card.id}`, action[1], "primary", () => action[2](), true)))
817
+ .child(mono(div().id(`card-menu-btn-${card.id}`).flex_none().px(4).rounded(UI.radius)
818
+ .text_size(UI.text.small).text_color(t.muted).cursor_pointer()
819
+ .hover((s) => s.bg(t.hover).text_color(t.foreground))
820
+ .on_mouse_down("left", (_e, cx) => cx.stop_propagation())
821
+ .on_click((_e, cx) => { cx.stop_propagation(); this.openCardMenu(card); }))
822
+ .child("⋯")))
823
+ // 2. Title, two lines at most (the full one in its tooltip).
824
+ .child(div().id(`card-title-${card.id}`).max_h(36).overflow_hidden().tooltip(String(card.title || card.id || ""))
825
+ .text_size(UI.text.title).font_semibold().font_family(UI.fontSans).text_color(t.foreground)
826
+ .child(String(card.title || card.id || "")))
827
+ // 3. Where: host, repo (or hub and its repos) and branch.
828
+ .child(mono(h_flex().gap(5).items_center().min_w(0).text_size(UI.text.small))
829
+ .when(Boolean(card.hub), (el) => el
830
+ .child(div().flex_none().text_color(t.accent).child("⬡"))
831
+ .child(div().flex_none().max_w(140).truncate().text_color(t.muted).child(hubLabel))
832
+ .when(hubRepos.length > 0, (sub) => sub.child(div().flex_none().text_color(t.dim).child(`${hubRepos.length} repos`))))
833
+ .when(!card.hub && Boolean(card.repo), (el) => el
834
+ .child(div().flex_none().text_size(UI.text.tiny).text_color(markColor(t, azure ? "azure" : "github")).child(azure ? "AZ" : "GH"))
835
+ .child(div().flex_none().max_w(160).truncate().text_color(t.muted).child(String(card.repo))))
836
+ .when(Boolean(card.branch), (el) => el
837
+ .child(div().flex_none().text_color(t.dim).child("·"))
838
+ .child(div().flex_1().min_w(0).truncate().text_color(t.dim).child(String(card.branch)))))
839
+ // 4. Who and how long.
840
+ .child(mono(h_flex().gap(6).items_center().text_size(UI.text.small).text_color(t.dim))
841
+ .child(div().flex_1().min_w(0).truncate().child(`${card.agent || "agente"} · ${card.agentState || "listo"}`))
842
+ .when(CONFIG.costs, (el) => el.child(div().flex_none().text_color(t.working).child(money)))
843
+ .when(Boolean(card.elapsed), (el) => el.child(div().flex_none().text_color(t.muted).child(`⏱ ${card.elapsed}`))))
844
+ // Why it stopped, and a hub's check.
817
845
  .when(Boolean(card.failureReason) || Boolean(card.hub && card.analysis), (el) =>
818
- el.child(
819
- v_flex().p(6).rounded(UI.radius).bg(t.popover).border_1().border_color(t.border).gap(3).font_family("JetBrains Mono").text_size(UI.text.tiny)
820
- .when(Boolean(card.failureReason), (sub) =>
821
- sub.child(
822
- h_flex().items_center().justify_between().gap(4)
823
- .child(div().font_semibold().text_color(t.bond_waiting ?? t.blocked).flex_none().child("motivo:"))
824
- .child(div().text_color(t.foreground).truncate().child(String(card.failureReason)))
825
- )
826
- )
827
- .when(Boolean(card.hub), (sub) => {
828
- const analysisReady = !card.analysis || card.analysis.status === "ready" || card.analysis.status === "ok" || (card.analysis.fixable === 0 && !card.hubBlocked);
829
- const analysisLabel = analysisReady ? "análisis: listo" : (card.analysis?.fixable ? `${card.analysis.fixable} arreglos pendientes` : "análisis: revisión");
830
- const analysisColor = analysisReady ? t.working : (t.bond_waiting ?? t.blocked);
831
- return sub.child(
832
- h_flex().items_center().justify_between().gap(4)
833
- .child(div().text_color(t.dim).child("bond hub check:"))
834
- .child(div().font_medium().text_color(analysisColor).child(analysisLabel))
835
- );
836
- })
837
- )
838
- )
839
- .when(Boolean(card.story), (el) => el.child(div().text_size(UI.text.small).font_family("JetBrains Mono").text_color(t.muted).truncate().child(`historia: ${String(card.story)}`)))
840
- .when(Boolean(card.issueUrl) && !card.story, (el) => el.child(dim(`issue: ${String(card.issueUrl).split("/").slice(-3).join("/")}`)))
841
- .children((card.deliveries || []).filter((d) => d.prUrl).map((d) => div().text_size(UI.text.small).font_family("JetBrains Mono").truncate()
842
- .text_color(d.status === "failed" ? t.blocked : t.accent)
843
- .child(String(`${d.name}: PR #${d.prNumber} · ${d.prUrl}`))))
846
+ el.child(mono(v_flex().p(6).rounded(UI.radius).bg(t.popover).border_1().border_color(t.border).gap(3).text_size(UI.text.tiny))
847
+ .when(Boolean(card.failureReason), (sub) => sub.child(h_flex().items_center().gap(4)
848
+ .child(div().font_semibold().text_color(color).flex_none().child("motivo:"))
849
+ .child(div().text_color(t.foreground).truncate().child(String(card.failureReason)))))
850
+ .when(Boolean(card.hub), (sub) => {
851
+ const ready = !card.analysis || card.analysis.status === "ready" || card.analysis.status === "ok" || (card.analysis.fixable === 0 && !card.hubBlocked);
852
+ return sub.child(h_flex().items_center().justify_between().gap(4)
853
+ .child(div().text_color(t.dim).child("bond hub check:"))
854
+ .child(div().font_medium().text_color(ready ? t.working : stateColor(t, "waiting"))
855
+ .child(ready ? "análisis: listo" : (card.analysis?.fixable ? `${card.analysis.fixable} arreglos pendientes` : "análisis: revisión"))));
856
+ })))
857
+ .children((card.deliveries || []).filter((d) => d.prUrl).map((d) => mono(div().text_size(UI.text.small).truncate()
858
+ .text_color(d.status === "failed" ? t.blocked : t.accent)).child(String(`${d.name}: PR #${d.prNumber}`))))
859
+ .when(Boolean(card.prUrl) && (card.deliveries || []).length === 0, (el) => el.child(mono(div().text_size(UI.text.small).text_color(t.accent).truncate()).child(`PR #${card.prNumber}`)))
844
860
  .when(card.verifyFailures > 0 && card.status !== "pr_ready" && card.status !== "finished",
845
- (el) => el.child(dim(`verificación fallida ${card.verifyFailures} ${card.verifyFailures === 1 ? "vez" : "veces"}`)))
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}`))))
847
- // Footer
848
- .child(
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")
851
- );
861
+ (el) => el.child(mono(div().text_size(UI.text.small).text_color(t.dim)).child(`verificación fallida ${card.verifyFailures} ${card.verifyFailures === 1 ? "vez" : "veces"}`)));
852
862
 
853
863
  return h_flex().id(`card-${card.id}`).flex_none().items_stretch().rounded(UI.radiusLg).overflow_hidden()
854
864
  .bg(isSelected ? t.selected : t.surface)
855
865
  .border_1().border_color(cardBorder)
856
866
  .cursor_pointer().hover((s) => s.bg(t.hover))
867
+ .tooltip(card.run ? "Abrir la sesión" : "Lanzar el ticket")
868
+ .on_hover((h, cx) => {
869
+ const next = h ? card.id : (this.hoveredCard === card.id ? null : this.hoveredCard);
870
+ if (next !== this.hoveredCard) { this.hoveredCard = next; cx.notify(); }
871
+ })
857
872
  .on_click((_e, cx) => this.selectCard(card, cx))
858
873
  .on_mouse_down("right", (_e, cx) => {
859
874
  cx.stop_propagation();
860
875
  this.openCardMenu(card);
861
876
  })
862
- .child(div().w(3).flex_none().bg(color))
863
877
  .child(body);
864
878
  }
865
879
 
866
- // An empty column placeholder matching design
880
+ // An empty column placeholder matching design (only «Listos» on a board with no ticket)
867
881
  emptyColumnPlaceholder(colId) {
868
882
  const t = theme();
869
883
  const conf = {
870
- ready: { icon: "📋", title: "Sin tareas pendientes", subtitle: "Crea un ticket o arrastra aquí" },
884
+ ready: { icon: "📋", title: "Sin tareas pendientes", subtitle: "Crea uno con «+ Nuevo ticket»" },
871
885
  running: { icon: "⚡", title: "Ningún run en proceso", subtitle: null },
872
886
  waiting: { icon: "⏳", title: "Sin tareas en espera", subtitle: null },
873
887
  finished: { icon: "✓", title: "Ninguna tarea finalizada hoy", subtitle: null },
874
888
  error: { icon: "⚠️", title: "Sin errores reportados", subtitle: null },
875
889
  };
876
890
  const c = conf[colId] ?? { icon: "▫", title: "Columna vacía", subtitle: null };
891
+ // Same height in every column, with or without a subtitle (content centered).
877
892
  return v_flex()
878
893
  .w_full()
879
- .p(16)
894
+ .h(EMPTY_COLUMN_H)
895
+ .flex_none()
896
+ .px(12)
880
897
  .gap(4)
881
898
  .items_center()
882
899
  .justify_center()
@@ -893,196 +910,99 @@ export default class BondBoard extends View {
893
910
  );
894
911
  }
895
912
 
896
- column(col) {
913
+ /** One column. All of them share the board's width evenly; an empty one shows a short line
914
+ * under its header (the full hint only in «Listos» while the board has no ticket). With a
915
+ * column chosen in the title bar's counters it is the only one, its cards in a grid, and its
916
+ * header offers going back to every column. */
917
+ column(col, only = null) {
897
918
  const t = theme();
898
919
  const color = stateColor(t, col.id);
899
920
  const count = col.cards.length;
900
- const isWaiting = col.id === "waiting";
901
- const colBorder = (isWaiting && count > 0) ? (t.bond_waiting ?? t.blocked) : t.border;
902
- return v_flex().id(`col-${col.id}`).flex_none().w(UI.columnWidth || 270).h_full().gap(6).p(8).bg(t.chrome).rounded(UI.radiusLg)
921
+ const alone = only === col.id;
922
+ const colBorder = t.border;
923
+ const header = h_flex().items_center().justify_between().gap(6).p(4).border_b(1).border_color(colBorder)
924
+ .child(h_flex().items_center().gap(6).min_w(0)
925
+ .child(div().size(8).rounded(4).flex_none().bg(count > 0 ? color : t.dim))
926
+ .child(div().truncate().text_size(UI.text.small).font_bold().font_family(UI.fontSans).text_color(count > 0 ? color : t.muted).child(col.label.toUpperCase())))
927
+ .child(h_flex().items_center().gap(6).flex_none()
928
+ .when(alone, (el) => el.child(div().id("col-show-all").px(6).py(1).rounded(UI.radius).cursor_pointer()
929
+ .text_size(UI.text.tiny).text_color(t.muted).hover((st) => st.bg(t.hover).text_color(t.foreground))
930
+ .on_click((_e, cx) => { setShared(FILTER_KEY, { ...(shared(FILTER_KEY) ?? {}), column: null }); cx.notify(); })
931
+ .child("Ver todas las columnas")))
932
+ .child(div().px(7).py(1).rounded(12).bg(t.raised).border_1().border_color(count > 0 ? color : t.border)
933
+ .text_size(UI.text.tiny).font_family("JetBrains Mono").font_semibold().text_color(count > 0 ? color : t.dim).child(String(count))));
934
+ const empty = count === 0 && (col.id !== "ready" || this.boardHasCards)
935
+ ? div().w_full().py(14).text_center().text_size(UI.text.small).font_family(UI.fontSans).text_color(t.dim).child(EMPTY_LINE[col.id] ?? "Vacía")
936
+ : this.emptyColumnPlaceholder(col.id);
937
+ return v_flex().id(`col-${col.id}`).flex_1().min_w(0).h_full().gap(6).p(8).bg(t.chrome).rounded(UI.radiusLg)
903
938
  .border_1().border_color(colBorder)
904
939
  .overflow_y_scrollbar()
905
- .child(
906
- h_flex().items_center().justify_between().p(4).border_b(1).border_color(colBorder)
907
- .child(
908
- h_flex().items_center().gap(6)
909
- .child(div().size(8).rounded(4).flex_none().bg(color))
910
- .child(div().text_size(UI.text.small).font_bold().font_family(UI.fontSans).text_color(color).child(col.label.toUpperCase()))
911
- )
912
- .child(
913
- div().px(7).py(1).rounded(12).bg(t.raised).border_1().border_color(count > 0 ? color : t.border)
914
- .text_size(UI.text.tiny).font_family("JetBrains Mono").font_semibold().text_color(count > 0 ? color : t.dim).child(String(count))
915
- )
916
- )
917
- .when(count === 0, (el) => el.child(this.emptyColumnPlaceholder(col.id)))
918
- .children(col.cards.map((c) => this.card(c)));
940
+ .child(header)
941
+ .when(count === 0, (el) => el.child(empty))
942
+ .when(alone && count > 0, (el) => el.child(h_flex().w_full().flex_wrap().gap(8).items_start()
943
+ .children(col.cards.map((c) => div().w(UI.columnWidth + 70).flex_none().child(this.card(c))))))
944
+ .when(!alone, (el) => el.children(col.cards.map((c) => this.card(c))));
919
945
  }
920
946
 
947
+ /** The main action of a card's state, shown as the one primary button of the session
948
+ * header (the rest goes to its «⋯» menu): [id, label, action] or null. */
949
+ primaryAction(card) {
950
+ if (card.canNudge) return ["nudge", "Desbloquear…", () => this.openNudge(card)];
951
+ if (card.canApprove) return ["approve", "Aprobar…", () => this.openApprove(card)];
952
+ if (card.canDeliver) return ["deliver", "Entregar…", () => this.openDeliver(card)];
953
+ if (card.canLaunch) return ["launch", "Lanzar…", () => this.openLaunch(card)];
954
+ return null;
955
+ }
956
+
957
+ /** Session header (one line, 2026-11-23): back · state + title + short branch · Shell, the
958
+ * state's main action and «⋯» (Terminado, PR, copy docker exec, Cancelar, Borrar). The
959
+ * title's tooltip carries the full title, repo and branch. */
921
960
  renderSessionBar(card) {
922
961
  const t = theme();
923
962
  const colColor = stateColor(t, card.column);
963
+ const primary = this.primaryAction(card);
964
+ const repo = card.hub
965
+ ? String(card.hub.label || card.hub.url || "hub").replace(/^hub\s+/i, "")
966
+ : String(card.repo || "");
967
+ const tip = [String(card.title || card.id), repo && `repo: ${repo}`, card.branch && `rama: ${card.branch}`].filter(Boolean).join("\n");
968
+ const iconBtn = (id, label, tooltip, action) => div().id(id).flex_none().size(26).rounded(UI.radius)
969
+ .flex().items_center().justify_center().text_size(UI.text.body).text_color(t.muted).cursor_pointer()
970
+ .hover((st) => st.bg(t.hover).text_color(t.foreground)).tooltip(tooltip)
971
+ .on_mouse_down("left", (_e, cx) => cx.stop_propagation())
972
+ .on_click((_e, cx) => { cx.stop_propagation(); action(cx); })
973
+ .child(label);
924
974
  return h_flex()
925
975
  .id("bond-session-bar")
926
976
  .size_full()
927
- .px(10)
977
+ .min_w(0)
978
+ .px(8)
928
979
  .gap(8)
929
980
  .items_center()
930
981
  .bg(t.chrome)
931
982
  .border_b(1)
932
983
  .border_color(t.border)
933
984
  .text_color(t.foreground)
934
- .font_family("JetBrains Mono")
935
- .child(
936
- h_flex()
937
- .id("btn-back-to-kanban")
938
- .h(26)
939
- .px(8)
940
- .gap(4)
941
- .items_center()
942
- .rounded(UI.radius)
943
- .bg(t.raised)
944
- .border_1()
945
- .border_color(t.border)
946
- .text_size(UI.text.small)
947
- .font_family(UI.fontSans)
948
- .font_semibold()
949
- .text_color(t.accent)
950
- .cursor_pointer()
951
- .hover((s) => s.bg(t.hover).text_color(t.foreground))
952
- .on_click((_e, cx) => this.backToKanban(cx))
953
- .child("← Volver al kanban")
954
- )
955
- .child(div().w(1).h(16).bg(t.border))
956
- .child(
957
- h_flex()
958
- .gap(6)
959
- .items_center()
960
- .child(div().size(7).rounded(4).bg(colColor))
961
- .child(
962
- div()
963
- .font_semibold()
964
- .text_size(UI.text.body)
965
- .font_family(UI.fontSans)
966
- .text_color(t.foreground)
967
- .truncate()
968
- .child(String(card.title || card.id))
969
- )
970
- )
971
- .when(Boolean(card.branch), (el) =>
972
- el.child(
973
- div()
974
- .px(5)
975
- .py(1)
976
- .rounded(UI.radius)
977
- .bg(t.raised)
978
- .border_1()
979
- .border_color(t.border)
980
- .text_size(UI.text.tiny)
981
- .font_family("JetBrains Mono")
982
- .text_color(t.muted)
983
- .truncate()
984
- .child(String(card.branch))
985
- )
985
+ .child(iconBtn("btn-back-to-kanban", "←", "Volver al kanban", (cx) => this.backToKanban(cx)))
986
+ .child(div().w(1).h(16).flex_none().bg(t.border))
987
+ // State, title and short branch: the only part that shrinks
988
+ .child(h_flex().flex_1().min_w(0).items_center().gap(8)
989
+ .child(div().flex_none().font_family("JetBrains Mono").text_size(UI.text.tiny).font_semibold().text_color(colColor)
990
+ .child(spanishStateLabel(card.column, card.status)))
991
+ .child(div().id(`session-title-${card.id}`).flex_1().min_w(0).truncate().tooltip(tip)
992
+ .font_semibold().text_size(UI.text.body).font_family(UI.fontSans).text_color(t.foreground)
993
+ .child(String(card.title || card.id)))
994
+ .when(Boolean(card.branch), (el) => el.child(h_flex().flex_none().max_w(180).items_center().gap(4).text_color(t.dim)
995
+ .child(svg("mods/bond-board/branch.svg").size(12).flex_none())
996
+ .child(div().min_w(0).truncate().font_family("JetBrains Mono").text_size(UI.text.tiny).child(String(card.branch).replace(/^feat\//, "")))))
986
997
  )
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(
998
- div()
999
- .text_size(UI.text.small)
1000
- .font_family("JetBrains Mono")
1001
- .text_color(t.dim)
1002
- .truncate()
1003
- .child(repoText)
1004
- );
1005
- })
1006
- // Copyable docker exec command pill (D23)
1007
- .when(Boolean(card.containerCommand), (el) =>
1008
- el.child(
1009
- h_flex()
1010
- .id(`session-docker-cmd-${card.id}`)
1011
- .items_center()
1012
- .gap(5)
1013
- .px(6)
1014
- .h(24)
1015
- .rounded(UI.radius)
1016
- .bg(t.raised)
1017
- .border_1()
1018
- .border_color(t.border)
1019
- .cursor_pointer()
1020
- .hover((s) => s.bg(t.hover))
1021
- .on_click((_e, cx) => {
1022
- cx.stop_propagation();
1023
- this.copyToClipboard(String(card.containerCommand), cx);
1024
- })
1025
- .child(
1026
- div()
1027
- .font_family("JetBrains Mono")
1028
- .text_size(UI.text.tiny)
1029
- .text_color(t.muted)
1030
- .truncate()
1031
- .child(String(card.containerCommand))
1032
- )
1033
- .child(
1034
- div()
1035
- .text_size(UI.text.tiny)
1036
- .text_color(t.dim)
1037
- .flex_none()
1038
- .child("📋")
1039
- )
1040
- )
1041
- )
1042
- .child(div().flex_1())
1043
- // Action buttons in session bar
1044
- .when(Boolean(card.canShell), (el) =>
1045
- el.child(this.button(`session-shell-${card.id}`, "Shell del contenedor", "plain", (cx) => this.openContainerShell(card, cx), true))
1046
- )
1047
- .when(Boolean(card.canLaunch), (el) =>
1048
- el.child(this.button(`session-launch-${card.id}`, "Lanzar…", "primary", () => this.openLaunch(card), true))
1049
- )
1050
- .when(Boolean(card.canDeliver), (el) =>
1051
- el.child(this.button(`session-deliver-${card.id}`, "Entregar…", "primary", () => this.openDeliver(card), true))
1052
- )
1053
- .when(Boolean(card.canNudge), (el) =>
1054
- el.child(this.button(`session-nudge-${card.id}`, "Desbloquear…", "primary", () => this.openNudge(card), true))
1055
- )
1056
- .when(Boolean(card.canFinish), (el) =>
1057
- el.child(this.button(`session-finish-${card.id}`, "Terminado…", "plain", () => this.openFinish(card), true))
1058
- )
1059
- .when(Boolean(card.canApprove), (el) =>
1060
- el.child(this.button(`session-approve-${card.id}`, "Aprobar…", "primary", () => this.openApprove(card), true))
1061
- )
1062
- .when(Boolean(card.prUrl) && (card.deliveries || []).length === 0, (el) =>
1063
- el.child(this.button(`session-pr-${card.id}`, "Abrir PR", "plain", () => this.openPr(card), true))
1064
- )
1065
- .children((card.deliveries || []).filter((d) => d.prUrl).map((d) =>
1066
- this.button(`session-pr-${card.id}-${d.name}`, `PR ${d.name}`, "plain", () => this.openPr({ ...card, prUrl: d.prUrl, prNumber: d.prNumber }), true)))
1067
- .when(Boolean(card.canCancel), (el) =>
1068
- el.child(this.button(`session-cancel-${card.id}`, "Cancelar…", "danger", () => this.openCancel(card), true))
1069
- )
1070
- .child(this.button(`session-delete-${card.id}`, "Borrar…", "danger", () => this.openDelete(card), true))
1071
- // State chip
1072
- .child(
1073
- div()
1074
- .px(6)
1075
- .py(2)
1076
- .rounded(UI.radius)
1077
- .bg(t.raised)
1078
- .border_1()
1079
- .border_color(colColor)
1080
- .text_size(UI.text.tiny)
1081
- .font_family("JetBrains Mono")
1082
- .font_semibold()
1083
- .text_color(colColor)
1084
- .child(spanishStateLabel(card.column, card.status))
1085
- );
998
+ // Actions: Shell, the state's main action, «⋯»
999
+ .child(h_flex().flex_none().items_center().gap(6)
1000
+ .when(Boolean(card.canShell), (el) => el.child(this.button(`session-shell-${card.id}`, "Shell", "plain", (cx) => this.openContainerShell(card, cx), true)))
1001
+ .when(Boolean(primary), (el) => el.child(this.button(`session-${primary[0]}-${card.id}`, primary[1], "primary", () => primary[2](), true)))
1002
+ .child(iconBtn(`session-more-${card.id}`, "⋯", "Más acciones", () => openOverlay({
1003
+ mod: "bond-board", kind: "popup", width: 220,
1004
+ props: { view: "card-menu", cardId: card.id, card, session: true },
1005
+ }))));
1086
1006
  }
1087
1007
 
1088
1008
  // El orquestador nunca respondió: tarjeta centrada que explica cómo arreglarlo y permite
@@ -1173,15 +1093,20 @@ export default class BondBoard extends View {
1173
1093
  }
1174
1094
 
1175
1095
  const shown = filterCards(cards, { repo: filter.repo, agent: filter.agent, text: searchVal });
1176
- const columns = groupByColumn(shown);
1096
+ // A column chosen in the title bar's counters is shown alone; «Con error» goes away
1097
+ // while it has nothing.
1098
+ const only = COLUMNS.some((c) => c.id === filter.column) ? filter.column : null;
1099
+ this.boardHasCards = shown.length > 0;
1100
+ const columns = groupByColumn(shown)
1101
+ .filter((col) => (only ? col.id === only : (col.id !== "error" || col.cards.length > 0)));
1177
1102
 
1178
1103
  return v_flex().id("bond-board").size_full().p(10).gap(8).bg(t.canvas).text_color(t.foreground)
1179
1104
  // La API cae tras haber cargado: se conserva el último kanban; el aviso no lleva el crudo.
1180
1105
  .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
1106
  .text_size(UI.text.small).font_family("JetBrains Mono").text_color(t.blocked)
1182
1107
  .child(`Sin respuesta del orquestador (${apiUrl()}); se reintenta cada 3 s`)))
1183
- .child(h_flex().id("bond-columns").flex_1().min_h(0).gap(8).items_stretch().overflow_x_scrollbar()
1184
- .children(columns.map((col) => this.column(col))));
1108
+ .child(h_flex().id("bond-columns").w_full().min_w(0).flex_1().min_h(0).gap(8).items_stretch()
1109
+ .children(columns.map((col) => this.column(col, only))));
1185
1110
  }
1186
1111
 
1187
1112
  renderDialog(title, body, actions) {
@@ -1210,7 +1135,7 @@ export default class BondBoard extends View {
1210
1135
  return h_flex().id(id).flex_none().h(24).px(9).items_center().rounded(UI.radius).border_1()
1211
1136
  .border_color(on ? t.accent : t.input).bg(on ? t.selected : t.surface)
1212
1137
  .text_size(12).text_color(on ? t.foreground : t.muted).cursor_pointer()
1213
- .hover((s) => s.bg(t.hover)).on_click((_e, cx) => { action(); cx.notify(); })
1138
+ .hover((s) => s.bg(t.hover)).on_click((_e, cx) => { action(cx); cx.notify(); })
1214
1139
  .child(label);
1215
1140
  }
1216
1141
 
@@ -1219,6 +1144,15 @@ export default class BondBoard extends View {
1219
1144
  // Paso 2: issues abiertas del repo elegido (ready primero, luego las tuyas).
1220
1145
  ghErrorText(e) {
1221
1146
  const msg = String(e?.message ?? e);
1147
+ if (this.issueProvider === "jira") {
1148
+ return msg === "jira_not_configured"
1149
+ ? "No hay credencial de Jira: conéctala en Ajustes (sección Jira) y reintenta."
1150
+ : msg === "jira_authentication_failed"
1151
+ ? "Credencial de Jira inválida: revísala en Ajustes (sección Jira)."
1152
+ : msg === "jira_api_error" || msg.startsWith("HTTP")
1153
+ ? "Jira Cloud no responde ahora mismo; reintenta."
1154
+ : msg;
1155
+ }
1222
1156
  return msg === "github_not_configured"
1223
1157
  ? "No hay sesión de GitHub: conéctala en Ajustes («Usar mi sesión de gh») y reintenta."
1224
1158
  : msg === "github_api_error" || msg.startsWith("HTTP")
@@ -1227,6 +1161,15 @@ export default class BondBoard extends View {
1227
1161
  }
1228
1162
 
1229
1163
  searchIssues(cx) {
1164
+ if (this.issueProvider === "jira") {
1165
+ this.issuePanel = "jira";
1166
+ this.loadPool(cx);
1167
+ // Sin consulta se muestran las asignadas: los resultados de una búsqueda anterior
1168
+ // taparían el refresco de assignedPool (la panel prioriza jiraResults).
1169
+ if (String(this.jiraQuery.value() ?? "").trim() || !this.jiraMine) this.searchJiraOn(cx);
1170
+ else { this.jiraResults = null; cx.notify(); }
1171
+ return;
1172
+ }
1230
1173
  this.issuePanel = "repos";
1231
1174
  this.loadPool(cx);
1232
1175
  if (String(this.repoQuery.value() ?? "").trim()) this.searchReposOn(cx);
@@ -1236,6 +1179,7 @@ export default class BondBoard extends View {
1236
1179
  loadPool(cx) {
1237
1180
  if (this.assignedPool || this.poolLoading) { cx.notify(); return; }
1238
1181
  this.poolLoading = true;
1182
+ this.reposError = null;
1239
1183
  cx.notify();
1240
1184
  cx.spawn(async (cx) => {
1241
1185
  try {
@@ -1250,6 +1194,34 @@ export default class BondBoard extends View {
1250
1194
  });
1251
1195
  }
1252
1196
 
1197
+ /** «Asignadas a mí» on/off: back to your list, or the site's search with the same text. */
1198
+ toggleJiraMine(cx) {
1199
+ this.jiraMine = !this.jiraMine;
1200
+ this.jiraResults = null;
1201
+ const term = String(this.jiraQuery.value() ?? "").trim();
1202
+ if (term || !this.jiraMine) this.searchJiraOn(cx);
1203
+ else { this.loadPool(cx); cx.notify(); }
1204
+ }
1205
+
1206
+ searchJiraOn(cx) {
1207
+ const term = String(this.jiraQuery.value() ?? "").trim();
1208
+ if ((!term && this.jiraMine) || this.jiraSearching) return;
1209
+ this.jiraSearching = true;
1210
+ this.reposError = null;
1211
+ cx.notify();
1212
+ cx.spawn(async (cx) => {
1213
+ try {
1214
+ const data = await searchJiraIssues(api, { q: term, mine: this.jiraMine });
1215
+ this.jiraResults = Array.isArray(data?.issues) ? data.issues : [];
1216
+ } catch (e) {
1217
+ this.reposError = this.ghErrorText(e);
1218
+ } finally {
1219
+ this.jiraSearching = false;
1220
+ cx.notify();
1221
+ }
1222
+ });
1223
+ }
1224
+
1253
1225
  searchReposOn(cx) {
1254
1226
  const term = String(this.repoQuery.value() ?? "").trim();
1255
1227
  if (!term || this.reposLoading) return;
@@ -1347,17 +1319,151 @@ export default class BondBoard extends View {
1347
1319
  .child("Bondificar el repo si no lo está (bond init + commit propio)");
1348
1320
  }
1349
1321
 
1350
- pickIssue(it) {
1322
+ // P4: «Docker en el run». Avisa del riesgo (contenedor privilegiado) en la propia casilla.
1323
+ dockerRow() {
1324
+ const t = theme();
1325
+ return v_flex().gap(2)
1326
+ .child(h_flex()
1327
+ .id("ticket-docker")
1328
+ .gap(7).items_center().px(2).py(3).cursor_pointer()
1329
+ .text_color(t.foreground).font_family(UI.fontSans).text_size(UI.text.small)
1330
+ .on_click((_e, cx) => {
1331
+ this.docker = !this.docker;
1332
+ this.dockerTouched = true;
1333
+ cx.notify();
1334
+ })
1335
+ .child(div().w(13).h(13).rounded(3).border_1()
1336
+ .border_color(this.docker ? t.accent : t.border)
1337
+ .bg(this.docker ? t.accent : t.input)
1338
+ .child(div().text_size(10).text_center().text_color(t.chrome).child(this.docker ? "✓" : "")))
1339
+ .child("Docker en el run (devcontainers, compose…)")
1340
+ .when(Boolean(this.devcontainerRepo), (el) => el.child(div().id("ticket-docker-devcontainer").text_size(UI.text.tiny).text_color(t.accent).child("el repo trae devcontainer"))))
1341
+ .when(this.docker, (el) => el.child(div().pl(22).text_size(UI.text.tiny).font_family(UI.fontSans).text_color(t.dim)
1342
+ .child("El contenedor del run va privilegiado: un agente podría tomar este equipo (en Windows y Mac, la VM de Docker Desktop). La imagen necesita el grupo «Docker en el run».")));
1343
+ }
1344
+
1345
+ /** P4: asks the orchestrator whether the repo carries a devcontainer; pre-ticks Docker. */
1346
+ checkDevcontainer(cx) {
1347
+ const m = /github\.com[/:]([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+?)(?:\.git)?\/?$/.exec(String(this.fields.repo.value() ?? "").trim());
1348
+ if (!m || this.mode === "list") return;
1349
+ const base = String(this.fields.base?.value?.() ?? "").trim();
1350
+ const key = `${m[1]}/${m[2]}@${base}`;
1351
+ if (key === this.devcontainerChecked) return;
1352
+ this.devcontainerChecked = key;
1353
+ cx.spawn(async (cx) => {
1354
+ try {
1355
+ const q = `owner=${encodeURIComponent(m[1])}&repo=${encodeURIComponent(m[2])}${base ? `&ref=${encodeURIComponent(base)}` : ""}`;
1356
+ const res = await api(`/repos/devcontainer?${q}`);
1357
+ if (key !== this.devcontainerChecked) return;
1358
+ this.devcontainerRepo = res?.devcontainer ? `${m[1]}/${m[2]}` : null;
1359
+ if (res?.devcontainer && !this.dockerTouched) this.docker = true;
1360
+ this.hubDetected = res?.hub ? (this.repoSel?.url ?? String(this.fields.repo.value() ?? "").trim()) : null;
1361
+ this.applyHubMode();
1362
+ cx.notify();
1363
+ } catch {}
1364
+ });
1365
+ }
1366
+
1367
+ /** Hub detectado (y no tratado como repo): modo hub con ese repo; si no, un repo. */
1368
+ applyHubMode() {
1369
+ if (this.mode === "list") return;
1370
+ const url = this.repoSel?.url ?? String(this.fields.repo.value() ?? "").trim();
1371
+ const hub = Boolean(this.hubDetected) && this.hubDetected === url && !this.hubAsRepo;
1372
+ this.mode = hub ? "hub" : "repo";
1373
+ this.fields.hub.set_value(hub ? url : "");
1374
+ }
1375
+
1376
+ pickIssue(it, cx) {
1351
1377
  this.pickedIssue = it;
1352
1378
  this.issuePanel = null;
1353
1379
  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}`);
1380
+ const title = it.title || it.summary || "";
1381
+ if (title) this.fields.title.set_value(title); // D4: automático y editable
1382
+ const desc = it.description || it.body || "";
1383
+ if (it.key) {
1384
+ this.pickedIssue.body = title + (desc ? `\n\n${desc}` : "");
1385
+ }
1386
+ // Qué: the story box gets the issue's text (editable); the list folds to this issue.
1387
+ this.story.set_value(String(this.pickedIssue.body ?? desc ?? ""));
1388
+ this.choosing = false;
1389
+ // Dónde: a GitHub issue only preloads its repo, and only when none is chosen yet.
1390
+ if (it.owner && it.repo && !this.repoSel) {
1391
+ this.selectRepo({ url: `https://github.com/${it.owner}/${it.repo}`, label: `${it.owner}/${it.repo}`, host: "github" });
1392
+ if (cx) this.checkDevcontainer(cx);
1357
1393
  }
1358
1394
  this.errors = {};
1359
1395
  }
1360
1396
 
1397
+ // ---- Alta en tres bloques: Dónde (repos) ---------------------------------------------
1398
+
1399
+ /** Asks the orchestrator for repos (favorites, recent, Azure, GitHub) for the query. */
1400
+ suggestRepos(cx, q) {
1401
+ this.repoSuggestFor = q;
1402
+ this.repoSuggestLoading = true;
1403
+ cx.notify();
1404
+ cx.spawn(async (cx) => {
1405
+ try {
1406
+ const res = await api(`/repos/suggest?q=${encodeURIComponent(q)}`);
1407
+ if (this.repoSuggestFor !== q) return;
1408
+ this.repoSuggest = Array.isArray(res?.repos) ? res.repos : [];
1409
+ this.repoSuggestErrors = res?.errors ?? {};
1410
+ } catch (e) {
1411
+ this.repoSuggestErrors = { api: String(e?.message ?? e) };
1412
+ }
1413
+ this.repoSuggestLoading = false;
1414
+ cx.notify();
1415
+ });
1416
+ }
1417
+
1418
+ /** On typing: the shown list filters at once; the search (GitHub) waits a little. */
1419
+ suggestReposSoon(cx) {
1420
+ const asked = String(this.repoQuery.value() ?? "").trim();
1421
+ cx.notify();
1422
+ if (asked === this.repoSuggestFor) return;
1423
+ cx.spawn(async (cx) => {
1424
+ await cx.sleep(350);
1425
+ if (String(this.repoQuery.value() ?? "").trim() !== asked) return;
1426
+ this.suggestRepos(cx, asked);
1427
+ });
1428
+ }
1429
+
1430
+ selectRepo(r) {
1431
+ if (this.mode === "list") {
1432
+ if (r.host !== "github") {
1433
+ this.errors = { ...this.errors, repos: "Un hub solo admite repos de GitHub" };
1434
+ return;
1435
+ }
1436
+ if (!this.listRepos.some((x) => x.url === r.url)) this.listRepos = [...this.listRepos, { url: r.url, label: r.label }];
1437
+ return;
1438
+ }
1439
+ this.repoSel = r;
1440
+ this.repoChoosing = false;
1441
+ // Otro repo: su detección empieza de cero (checkDevcontainer la repite).
1442
+ this.hubDetected = null;
1443
+ this.hubAsRepo = false;
1444
+ this.devcontainerChecked = null;
1445
+ this.devcontainerRepo = null;
1446
+ this.applyHubMode();
1447
+ this.fields.repo.set_value(r.url);
1448
+ if (r.base) this.fields.base.set_value(r.base);
1449
+ this.errors = { ...this.errors, repo: undefined };
1450
+ }
1451
+
1452
+ /** ★: adds or removes the repo from the favorites (Ajustes keeps the list too). */
1453
+ toggleFavorite(cx, r) {
1454
+ const current = (this.repoSuggest ?? []).filter((x) => x.favorite).map((x) => x.url);
1455
+ const next = r.favorite ? current.filter((u) => u !== r.url) : [...current, r.url];
1456
+ cx.spawn(async (cx) => {
1457
+ try {
1458
+ await api("/repos/favorites", { method: "PUT", body: { favorites: next } });
1459
+ this.suggestRepos(cx, String(this.repoQuery.value() ?? "").trim());
1460
+ } catch (e) {
1461
+ this.error = String(e?.message ?? e);
1462
+ cx.notify();
1463
+ }
1464
+ });
1465
+ }
1466
+
1361
1467
  useIssueUrl() {
1362
1468
  const url = String(this.fields.issue.value() ?? "").trim();
1363
1469
  if (!url) {
@@ -1411,13 +1517,15 @@ export default class BondBoard extends View {
1411
1517
 
1412
1518
  issueRow(it) {
1413
1519
  const t = theme();
1414
- return h_flex().id(`iss-row-${it.owner}-${it.repo}-${it.number}`).h(26).px(8).gap(6).items_center()
1520
+ const id = it.key ? `iss-row-${it.key}` : `iss-row-${it.owner}-${it.repo}-${it.number}`;
1521
+ const label = it.key ?? `#${it.number}`;
1522
+ return h_flex().id(id).h(26).px(8).gap(6).items_center()
1415
1523
  .rounded(UI.radius).text_size(12).font_family("JetBrains Mono").cursor_pointer()
1416
1524
  .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 ?? "")))
1525
+ .on_click((_e, cx) => { this.pickIssue(it, cx); cx.notify(); })
1526
+ .child(div().w(12).text_center().text_color(it.ready ? t.accent : t.dim).child(it.ready ? "✓" : (it.key ? "●" : "#")))
1527
+ .child(div().w(it.key ? 75 : 46).text_color(t.dim).child(label))
1528
+ .child(div().flex_1().truncate().child(String(it.title ?? it.summary ?? "")))
1421
1529
  .when(Boolean(it.ready), (el) => el.child(div().text_size(UI.text.tiny).text_color(t.accent).child("ready")));
1422
1530
  }
1423
1531
 
@@ -1438,120 +1546,251 @@ export default class BondBoard extends View {
1438
1546
  }));
1439
1547
  }
1440
1548
 
1441
- renderCreate(p) {
1549
+ // ---- Alta en tres bloques (Qué · Dónde · Quién; decisión 2026-11-24) -----------------
1550
+
1551
+ createBlock(n, title, hint, children, error) {
1442
1552
  const t = theme();
1443
- const e = this.errors ?? {};
1444
- const input = (k) => Input.new(this.fields[k]).h(30).px(9).rounded(UI.radius).border_1()
1445
- .border_color(e[k] ? t.blocked : t.input).bg(t.background).text_size(12.5);
1446
- const area = (k, h) => Textarea.new(this.fields[k]).h(h).p(8).rounded(UI.radius).border_1()
1447
- .border_color(e[k] ? t.blocked : t.input).bg(t.background).text_size(12);
1448
- const where = this.mode === "repo"
1449
- ? this.field("Repo de GitHub", input("repo"), e.repo)
1450
- : this.mode === "list"
1451
- ? this.field("Repos (se crea un hub con ellos)", area("repos", 70), e.repos)
1452
- : this.field("Hub existente", input("hub"), e.hub);
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();
1553
+ return v_flex().id(`create-block-${n}`).gap(8).px(14).py(11).rounded(UI.radiusLg).border_1()
1554
+ .border_color(error ? t.blocked : t.border).bg(t.background)
1555
+ .child(h_flex().gap(10).items_center()
1556
+ .child(div().w(22).h(22).rounded(11).bg(t.accent).flex().items_center().justify_center()
1557
+ .text_size(11).font_semibold().text_color(t.accent_foreground ?? t.background).child(String(n)))
1558
+ .child(div().text_size(UI.text.title + 1).font_family(UI.fontSans).font_semibold().child(title))
1559
+ .child(div().flex_1())
1560
+ .when(Boolean(hint), (el) => el.child(div().text_size(UI.text.small).font_family(UI.fontSans).text_color(t.dim).child(hint))))
1561
+ .children(children)
1562
+ .when(Boolean(error), (el) => el.child(div().text_size(UI.text.small).text_color(t.blocked).child(error)));
1563
+ }
1564
+
1565
+ hostBadge(host) {
1566
+ const t = theme();
1567
+ const azure = host === "azure";
1568
+ return div().flex_none().px(6).h(18).rounded(4).flex().items_center()
1569
+ .bg(azure ? "#0078d422" : "#8b5cf622").text_size(10).font_semibold()
1570
+ .text_color(markColor(t, azure ? "azure" : "github")).child(azure ? "Azure" : "GitHub");
1571
+ }
1572
+
1573
+ /** One issue of the «Qué» list (GitHub #n or Jira KEY), clickable. */
1574
+ createIssueRow(it, picked = false) {
1575
+ const t = theme();
1576
+ const label = it.key ?? (it.number ? `#${it.number}` : "URL");
1577
+ const where = it.key ? (it.project ?? "") : (it.owner && it.repo ? `${it.owner}/${it.repo}` : "");
1578
+ return h_flex().id(it.key ? `iss-row-${it.key}` : `iss-row-${it.owner}-${it.repo}-${it.number}`)
1579
+ .h(30).px(8).gap(10).items_center().rounded(UI.radius).cursor_pointer().min_w(0)
1580
+ .bg(picked ? t.selected : t.background).border_1().border_color(picked ? t.accent : t.background)
1581
+ .hover((s) => s.bg(t.hover)).on_click((_e, cx) => { this.pickIssue(it, cx); cx.notify(); })
1582
+ .child(div().w(it.key ? 72 : 50).flex_none().text_size(12).font_semibold().text_color(t.accent).child(label))
1583
+ .child(div().flex_1().min_w(0).truncate().text_size(12.5).font_family(UI.fontSans).child(String(it.title ?? it.summary ?? it.url ?? "")))
1584
+ .when(Boolean(where), (el) => el.child(div().flex_none().text_size(UI.text.small).text_color(t.dim).child(where)))
1585
+ .when(Boolean(it.status), (el) => el.child(div().flex_none().px(6).h(18).rounded(4).flex().items_center().border_1().border_color(t.border)
1586
+ .text_size(10).text_color(t.muted).child(String(it.status))))
1587
+ .when(Boolean(it.ready), (el) => el.child(div().flex_none().text_size(UI.text.tiny).text_color(t.accent).child("ready")));
1588
+ }
1589
+
1590
+ /** One repo of the «Dónde» list: ★ toggles the favorite, the row picks it. */
1591
+ createRepoRow(r, picked = false) {
1592
+ const t = theme();
1593
+ return h_flex().id(`repo-row-${slug(r.url)}`).h(30).px(8).gap(10).items_center().rounded(UI.radius).cursor_pointer().min_w(0)
1594
+ .bg(picked ? t.selected : t.background).border_1().border_color(picked ? t.accent : t.background)
1595
+ .hover((s) => s.bg(t.hover)).on_click((_e, cx) => { this.selectRepo(r); this.checkDevcontainer(cx); cx.notify(); })
1596
+ .child(div().id(`repo-fav-${slug(r.url)}`).w(16).flex_none().text_size(13).cursor_pointer()
1597
+ .text_color(r.favorite ? markColor(t, "star") : t.dim).tooltip(r.favorite ? "Quitar de favoritos" : "Añadir a favoritos")
1598
+ .on_click((_e, cx) => { cx.stop_propagation(); this.toggleFavorite(cx, r); })
1599
+ .child(r.favorite ? "★" : r.recent ? "↺" : "☆"))
1600
+ .child(this.hostBadge(r.host))
1601
+ .child(div().flex_1().min_w(0).truncate().text_size(12.5).child(String(r.label ?? r.url)))
1602
+ .when(Boolean(r.base), (el) => el.child(div().flex_none().text_size(UI.text.small).text_color(t.dim).child(r.base)));
1603
+ }
1604
+
1605
+ createWhat() {
1606
+ const t = theme();
1607
+ const lq = (s) => String(s ?? "").trim().toLowerCase().split(/\s+/).filter(Boolean);
1458
1608
  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");
1609
+ const src = (id, label) => this.choice(`src-${id}`, label, this.source === id, () => {
1610
+ if (this.source === id) return;
1611
+ this.source = id;
1612
+ this.issueProvider = id === "jira" ? "jira" : "github";
1613
+ resetIssueProviderState(this);
1614
+ this.choosing = true;
1615
+ this.pickedIssue = null;
1616
+ this.fields.issue.set_value("");
1617
+ });
1618
+ const rows = [h_flex().gap(6).child(src("github", "GitHub")).child(src("jira", "Jira")).child(src("manual", "Escribirla yo"))];
1619
+ if (this.source !== "manual") {
1620
+ if (this.pickedIssue && !this.choosing) {
1621
+ rows.push(h_flex().gap(8).items_center()
1622
+ .child(div().flex_1().min_w(0).child(this.createIssueRow(this.pickedIssue, true)))
1623
+ .child(this.button("iss-change", "Cambiar", "plain", () => { this.choosing = true; })));
1624
+ } else {
1625
+ const jira = this.source === "jira";
1626
+ const q = String((jira ? this.jiraQuery : this.issueQuery).value() ?? "").trim();
1627
+ const words = lq(q);
1628
+ const repoKey = !jira && /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(q) ? q : null;
1629
+ const looksUrl = /^https:\/\//.test(q);
1630
+ let list = jira ? (this.jiraResults ?? this.assignedPool ?? []) : (this.issuePanel === "issues" ? (this.issues ?? []) : (this.assignedPool ?? []));
1631
+ if (!(jira && this.jiraResults) && !repoKey && !looksUrl) list = list.filter((it) => has(`${it.key ?? `#${it.number}`} ${it.title ?? it.summary ?? ""} ${it.owner ?? ""}/${it.repo ?? ""}`, words));
1632
+ const loading = this.poolLoading || this.jiraSearching || this.issuesLoading;
1633
+ rows.push(h_flex().gap(6).items_center()
1634
+ .child(div().flex_1().child(Input.new(jira ? this.jiraQuery : this.issueQuery).h(28).px(8).rounded(UI.radius).border_1().border_color(t.input).bg(t.background).text_size(12)))
1635
+ .when(jira, (el) => el
1636
+ .child(this.choice("iss-jira-mine", this.jiraMine ? "✓ Asignadas a mí" : "Asignadas a mí", this.jiraMine, (cx) => this.toggleJiraMine(cx)))
1637
+ .child(this.button("iss-jira-go", this.jiraSearching ? "Buscando…" : "Buscar", "plain", (cx) => this.searchJiraOn(cx))))
1638
+ .when(Boolean(repoKey), (el) => el.child(this.button("iss-repo-go", `Issues de ${repoKey}`, "plain", (cx) => this.pickRepo(repoKey, cx))))
1639
+ .when(looksUrl, (el) => el.child(this.button("iss-use-url", "Usar URL", "plain", () => { this.fields.issue.set_value(q); this.useIssueUrl(); this.choosing = false; }))));
1640
+ rows.push(v_flex().id("iss-list").max_h(150).overflow_y_scrollbar().gap(1)
1641
+ .when(loading, (el) => el.child(div().px(6).py(3).text_size(UI.text.small).text_color(t.dim).child(jira ? "Buscando en Jira…" : "Buscando en GitHub…")))
1642
+ .when(Boolean(this.reposError || this.issuesError), (el) => el.child(h_flex().gap(8).items_center()
1643
+ .child(div().flex_1().text_size(UI.text.small).text_color(t.blocked).child(String(this.reposError || this.issuesError)))
1644
+ .child(this.button("iss-open-settings", "Abrir Ajustes", "plain", () => openOverlay(settingsOverlay({ section: jira ? "jira" : "github" }))))))
1645
+ .when(!loading && !this.reposError && list.length === 0, (el) => el.child(div().px(6).py(3).text_size(UI.text.small).text_color(t.dim)
1646
+ .child(jira ? (this.jiraMine ? "Sin issues asignadas a ti: busca por texto o clave (VEL-123), o quita «Asignadas a mí»" : "Sin issues: busca por texto o clave (VEL-123)") : "Sin issues asignadas: escribe owner/repo o pega la URL de una issue")))
1647
+ .children(list.slice(0, 40).map((it) => this.createIssueRow(it))));
1648
+ }
1501
1649
  }
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 = [
1513
- this.field("Título", input("title"), e.title),
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);
1650
+ const e = this.errors ?? {};
1651
+ rows.push(h_flex().gap(10).items_start()
1652
+ .child(v_flex().flex_1().gap(3).child(div().text_size(UI.text.small).font_medium().text_color(t.muted).child("Título"))
1653
+ .child(Input.new(this.fields.title).h(30).px(9).rounded(UI.radius).border_1().border_color(e.title ? t.blocked : t.input).bg(t.background).text_size(12.5))
1654
+ .when(Boolean(e.title), (el) => el.child(div().text_size(UI.text.small).text_color(t.blocked).child(e.title)))));
1655
+ rows.push(v_flex().gap(3)
1656
+ .child(h_flex().items_center()
1657
+ .child(div().flex_1().text_size(UI.text.small).font_medium().text_color(t.muted).child("Historia (lo que lee el agente; editable)"))
1658
+ .child(div().text_size(UI.text.small).text_color(t.dim).child(this.pickedIssue ? `desde ${this.pickedIssue.key ?? (this.pickedIssue.number ? `#${this.pickedIssue.number}` : "la issue")}` : "escrita a mano")))
1659
+ .child(Textarea.new(this.story).h(80).p(8).rounded(UI.radius).border_1().border_color(t.input).bg(t.background).text_size(12)));
1660
+ return this.createBlock(1, "Qué", "de dónde sale la historia", rows, e.issue);
1661
+ }
1662
+
1663
+ createWhere() {
1664
+ const t = theme();
1665
+ const e = this.errors ?? {};
1666
+ // Un repo o un hub: se elige igual; si trae hub.toml, el alta lo detecta y pasa a modo hub.
1667
+ const rows = [];
1668
+ {
1669
+ if (this.mode === "list" && this.listRepos.length) {
1670
+ rows.push(h_flex().gap(6).flex_wrap().children(this.listRepos.map((r) => h_flex().id(`list-chip-${slug(r.url)}`).h(24).pl(8).pr(4).gap(6).items_center()
1671
+ .rounded(UI.radius).bg(t.selected).border_1().border_color(t.accent).text_size(12)
1672
+ .child(r.label)
1673
+ .child(div().id(`list-chip-x-${slug(r.url)}`).px(3).cursor_pointer().text_color(t.dim).on_click((_e, cx) => { this.listRepos = this.listRepos.filter((x) => x.url !== r.url); cx.notify(); }).child("✕")))));
1674
+ }
1675
+ if (this.mode !== "list" && this.repoSel && !this.repoChoosing) {
1676
+ const fav = (this.repoSuggest ?? []).find((x) => x.url === this.repoSel.url);
1677
+ rows.push(h_flex().gap(8).items_center()
1678
+ .child(div().flex_1().min_w(0).child(this.createRepoRow({ ...this.repoSel, favorite: Boolean(fav?.favorite), recent: Boolean(fav?.recent) }, true)))
1679
+ .child(this.button("repo-change", "Cambiar", "plain", () => { this.repoChoosing = true; })));
1680
+ if (this.hubDetected && this.hubDetected === this.repoSel.url) {
1681
+ const asHub = this.mode === "hub";
1682
+ rows.push(h_flex().id("repo-hub-detected").gap(10).items_center().px(10).py(7).rounded(UI.radius)
1683
+ .bg(asHub ? t.selected : t.raised).border_1().border_color(asHub ? t.accent : t.border)
1684
+ .child(v_flex().flex_1().min_w(0).gap(2)
1685
+ .child(div().text_size(12).font_semibold().text_color(asHub ? t.accent : t.foreground).child(asHub ? "⬡ Tipo hub detectado" : "⬡ Hub detectado, tratado como repo normal"))
1686
+ .child(div().text_size(UI.text.small).text_color(t.dim).child(asHub
1687
+ ? "Trae hub.toml: el ticket trabaja en los repos del hub, un agente por repo (motor en «Opciones»)."
1688
+ : "Trae hub.toml, pero el ticket trabaja solo en este repo.")))
1689
+ .child(this.choice("repo-hub-toggle", asHub ? "Tratarlo como repo normal" : "Usarlo como hub", false, () => {
1690
+ this.hubAsRepo = asHub;
1691
+ this.applyHubMode();
1692
+ })));
1693
+ }
1694
+ } else {
1695
+ const q = String(this.repoQuery.value() ?? "").trim();
1696
+ const words = q.toLowerCase().split(/\s+/).filter(Boolean);
1697
+ const filters = [["todos", "Todos"], ["recientes", "★ Recientes"], ["github", "GitHub"], ["azure", "Azure"]];
1698
+ let list = (this.repoSuggest ?? []).filter((r) => this.repoFilter === "todos"
1699
+ || (this.repoFilter === "recientes" ? r.favorite || r.recent : r.host === this.repoFilter));
1700
+ if (!/^https:\/\//.test(q)) list = list.filter((r) => words.every((w) => `${r.label} ${r.url}`.toLowerCase().includes(w)));
1701
+ if (this.mode === "list") list = list.filter((r) => r.host === "github");
1702
+ const pasted = /^https:\/\/(github\.com|dev\.azure\.com|[A-Za-z0-9_.-]+\.visualstudio\.com)\//.test(q) && !list.some((r) => r.url === q);
1703
+ rows.push(h_flex().gap(6).items_center()
1704
+ .child(div().flex_1().child(Input.new(this.repoQuery).h(28).px(8).rounded(UI.radius).border_1().border_color(t.input).bg(t.background).text_size(12)))
1705
+ .child(h_flex().gap(4).children(filters.map(([id, label]) => this.choice(`rf-${id}`, label, this.repoFilter === id, () => { this.repoFilter = id; })))));
1706
+ const errs = Object.entries(this.repoSuggestErrors ?? {}).map(([k, v]) => `${k === "azure" ? "Azure" : k === "github" ? "GitHub" : "API"}: ${v}`);
1707
+ rows.push(v_flex().id("repo-list").max_h(160).overflow_y_scrollbar().gap(1)
1708
+ .when(pasted, (el) => el.child(this.createRepoRow({ url: q, label: q, host: /github\.com/.test(q) ? "github" : "azure" })))
1709
+ .when(this.repoSuggestLoading && !(this.repoSuggest ?? []).length, (el) => el.child(div().px(6).py(3).text_size(UI.text.small).text_color(t.dim).child("Buscando repos…")))
1710
+ .when(errs.length > 0, (el) => el.child(div().px(6).py(2).text_size(UI.text.small).text_color(t.blocked).child(errs.join(" · "))))
1711
+ .when(!this.repoSuggestLoading && list.length === 0 && !pasted, (el) => el.child(div().px(6).py(3).text_size(UI.text.small).text_color(t.dim)
1712
+ .child(q ? "Ningún repo coincide: prueba otro nombre o pega su URL" : "Sin favoritos ni recientes todavía: busca un repo o pega su URL")))
1713
+ .children(list.slice(0, 40).map((r) => this.createRepoRow(r))));
1714
+ if (this.mode === "list") rows.push(div().text_size(UI.text.small).text_color(t.dim).child("Un hub solo admite repos de GitHub; elige dos o más."));
1715
+ }
1525
1716
  }
1526
- body.push(this.bondifyRow());
1527
- body.push(
1528
- this.field("Dónde trabaja", h_flex().gap(6).flex_wrap()
1529
- .children(TICKET_MODES.map((m) => this.choice(`mode-${m.id}`, m.label, this.mode === m.id, () => { this.mode = m.id; }))), null),
1530
- where,
1531
- h_flex().gap(10)
1532
- .child(div().flex_1().child(this.field(this.mode === "hub" ? "Rama base del hub" : "Rama base", input("base"), e.base)))
1533
- .when(CONFIG.costs, (el) => el.child(div().w(90).child(this.field("Tope USD", input("budget"), e.budget))))
1534
- .child(div().w(90).child(this.field("Timeout min", input("timeout"), e.timeout))),
1535
- this.field("Agente", h_flex().gap(6).flex_wrap()
1536
- .children(AGENTS.map((a) => this.choice(`agent-${a}`, a, this.agent === a, () => { this.agent = a; }))), e.agent),
1537
- );
1717
+ rows.push(h_flex().gap(10).items_center()
1718
+ .child(v_flex().w(220).gap(3).child(div().text_size(UI.text.small).font_medium().text_color(t.muted).child(this.mode === "hub" ? "Rama base del hub" : "Rama base"))
1719
+ .child(Input.new(this.fields.base).h(30).px(9).rounded(UI.radius).border_1().border_color(e.base ? t.blocked : t.input).bg(t.background).text_size(12.5)))
1720
+ .when(Boolean(this.devcontainerRepo), (el) => el.child(div().flex_1().pt(16).text_size(UI.text.small).font_family(UI.fontSans).text_color(t.accent)
1721
+ .child("Este repo trae devcontainer: «Docker en el run» queda marcado."))));
1722
+ return this.createBlock(2, "Dónde", "el repo no tiene por qué ser el de la issue", rows, e.repo || e.repos || e.hub || e.base);
1723
+ }
1724
+
1725
+ createWho() {
1726
+ const t = theme();
1727
+ const e = this.errors ?? {};
1728
+ const icons = { pi: ["icons/pi.svg", true], claude: ["icons/claude.svg", false], codex: ["icons/codex.svg", false], copilot: ["icons/copilot.svg", true], agy: ["icons/antigravity.svg", false] };
1729
+ const agentChip = (a) => {
1730
+ const on = this.agent === a;
1731
+ const ic = icons[a];
1732
+ return h_flex().id(`agent-${a}`).flex_none().h(26).px(10).gap(6).items_center().rounded(UI.radius).border_1()
1733
+ .border_color(on ? t.accent : t.input).bg(on ? t.selected : t.surface).text_size(12).text_color(on ? t.foreground : t.muted)
1734
+ .cursor_pointer().hover((s) => s.bg(t.hover)).on_click((_e, cx) => { this.agent = a; cx.notify(); })
1735
+ .when(Boolean(ic), (el) => el.child(ic[1] ? svg(ic[0]).size(13).text_color(t.foreground) : image(ic[0]).w(13).h(13)))
1736
+ .child(a);
1737
+ };
1738
+ const rows = [h_flex().gap(6).flex_wrap().children(AGENTS.map(agentChip))];
1538
1739
  if (this.agent === "pi") {
1539
1740
  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
- }
1741
+ rows.push(this.field("Modelo", models.length > 0 ? this.renderModelSelector(models)
1742
+ : Input.new(this.fields.model).h(30).px(9).rounded(UI.radius).border_1().border_color(t.input).bg(t.background).text_size(12.5), e.model));
1545
1743
  }
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));
1744
+ const summary = [`bondificar ${this.bondify ? "sí" : "no"}`, `Docker ${this.docker ? "sí" : "no"}`, timeoutLabel(String(this.fields.timeout.value() ?? "").trim() || 0)];
1745
+ rows.push(h_flex().id("opts-toggle").gap(6).items_center().cursor_pointer().on_click((_e, cx) => { this.optionsOpen = !this.optionsOpen; cx.notify(); })
1746
+ .child(div().text_size(12).text_color(t.muted).child(this.optionsOpen ? "▾ Opciones" : "▸ Opciones"))
1747
+ .when(!this.optionsOpen, (el) => el.child(div().text_size(UI.text.small).text_color(t.dim).child(summary.join(" · ")))));
1748
+ if (this.optionsOpen) {
1749
+ const box = v_flex().gap(6).pl(14).child(this.bondifyRow()).child(this.dockerRow())
1750
+ .child(h_flex().gap(10)
1751
+ .child(div().w(110).child(this.field("Timeout min (0 = sin)", Input.new(this.fields.timeout).h(30).px(9).rounded(UI.radius).border_1().border_color(e.timeout ? t.blocked : t.input).bg(t.background).text_size(12.5), e.timeout)))
1752
+ .when(CONFIG.costs, (el) => el.child(div().w(110).child(this.field("Tope USD", Input.new(this.fields.budget).h(30).px(9).rounded(UI.radius).border_1().border_color(e.budget ? t.blocked : t.input).bg(t.background).text_size(12.5), e.budget)))))
1753
+ .when(this.mode !== "repo", (el) => el.child(this.field("Motor de equipo", h_flex().gap(6).flex_wrap()
1754
+ .children(TEAM_ENGINES.map((en) => this.choice(`engine-${en.id}`, en.label, this.team_engine === en.id, () => { this.team_engine = en.id; }))), null)));
1755
+ rows.push(box);
1549
1756
  }
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, [
1552
- this.button("dlg-back", "Volver", "plain", () => closeOverlay(p.overlay)),
1553
- this.button("dlg-create", this.busy ? "Creando…" : "Crear ticket", "primary", (cx) => this.create(cx)),
1554
- ]);
1757
+ return this.createBlock(3, "Quién", null, rows, e.agent || (!this.optionsOpen ? e.timeout || e.budget : null));
1758
+ }
1759
+
1760
+ createSummary() {
1761
+ const t = theme();
1762
+ const it = this.pickedIssue;
1763
+ const what = it ? (it.key ?? (it.number ? `#${it.number}` : "issue")) : this.source === "manual" ? "historia a mano" : "sin issue";
1764
+ const where = this.mode === "hub" ? (this.repoSel?.label ? `${this.repoSel.label} (hub)` : String(this.fields.hub.value() ?? "") || "hub sin elegir")
1765
+ : this.mode === "list" ? (this.listRepos.length ? `${this.listRepos.length} repos (hub)` : "repos sin elegir")
1766
+ : this.repoSel?.label ?? (String(this.fields.repo.value() ?? "") || "repo sin elegir");
1767
+ const id = it ? issueTicketId(it) : null;
1768
+ return h_flex().id("create-summary").gap(8).items_center().px(14).py(9).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border).text_size(12).min_w(0)
1769
+ .child(div().flex_none().text_color(t.accent).font_semibold().child(what))
1770
+ .child(div().flex_none().text_color(t.dim).child("→"))
1771
+ .when(this.mode !== "list" && Boolean(this.repoSel), (el) => el.child(this.hostBadge(this.repoSel.host)))
1772
+ .child(div().flex_none().child(where))
1773
+ .child(div().flex_none().text_color(t.dim).child("·"))
1774
+ .child(div().flex_none().child(this.agent))
1775
+ .when(Boolean(id), (el) => el.child(div().flex_none().text_color(t.dim).child("·")).child(div().flex_1().min_w(0).truncate().text_color(t.muted).child(`rama feat/${id}`)));
1776
+ }
1777
+
1778
+ renderCreate(p) {
1779
+ const t = theme();
1780
+ return v_flex().id("bond-dialog").track_focus(this.handle).on_key_down((ev, cx) => this.key(ev, cx))
1781
+ .size_full().bg(t.popover).rounded(UI.radiusLg).border_1().border_color(t.border).text_color(t.foreground).font_family("JetBrains Mono")
1782
+ .child(h_flex().h(46).flex_none().px(16).items_center().border_b_1().border_color(t.border)
1783
+ .child(div().flex_1().text_size(UI.text.title + 2).font_family(UI.fontSans).font_semibold().child("Nuevo ticket"))
1784
+ .child(div().text_size(UI.text.small).text_color(t.dim).child("Esc")))
1785
+ .child(v_flex().id("create-body").flex_1().min_h(0).px(16).py(12).gap(10).overflow_y_scrollbar()
1786
+ .child(this.createWhat()).child(this.createWhere()).child(this.createWho()))
1787
+ .child(v_flex().flex_none().gap(8).px(16).py(12).border_t_1().border_color(t.border)
1788
+ .child(this.createSummary())
1789
+ .when(Boolean(this.error), (el) => el.child(div().text_size(UI.text.small).text_color(t.blocked).child(this.error)))
1790
+ .child(h_flex().gap(8).items_center()
1791
+ .child(div().flex_1().text_size(UI.text.small).text_color(t.dim).child("El ticket queda en Ready: no arranca hasta que lo lances."))
1792
+ .child(this.button("dlg-back", "Volver", "plain", () => closeOverlay(p.overlay)))
1793
+ .child(this.button("dlg-create", this.busy ? "Creando…" : "Crear ticket", "primary", (cx) => this.create(cx)))));
1555
1794
  }
1556
1795
 
1557
1796
  renderPick(p) {
@@ -1574,6 +1813,9 @@ export default class BondBoard extends View {
1574
1813
  renderCardMenu(p) {
1575
1814
  const t = theme();
1576
1815
  const card = p.card ?? (this.tickets && this.runs ? buildCards(this.tickets, this.runs, this.agentStatus).find((c) => c.id === p.cardId) : null) ?? {};
1816
+ // From the session header: no «Abrir sesión», Shell nor the main action (already shown there).
1817
+ const inSession = Boolean(p.session);
1818
+ const shown = inSession ? this.primaryAction(card)?.[0] ?? null : null;
1577
1819
  const item = (id, label, icon, danger, action, keep = false) =>
1578
1820
  h_flex()
1579
1821
  .id(id)
@@ -1607,25 +1849,25 @@ export default class BondBoard extends View {
1607
1849
  .border_1()
1608
1850
  .border_color(t.border)
1609
1851
  .text_color(t.foreground)
1610
- .when(Boolean(card.canOpen), (el) =>
1852
+ .when(Boolean(card.canOpen) && !inSession, (el) =>
1611
1853
  el.child(item(`menu-open-${card.id}`, "Abrir sesión", "→", false, (cx) => this.selectCard(card, cx)))
1612
1854
  )
1613
- .when(Boolean(card.canShell), (el) =>
1855
+ .when(Boolean(card.canShell) && !inSession, (el) =>
1614
1856
  el.child(item(`menu-shell-${card.id}`, "Shell del contenedor", "", false, (cx) => this.openContainerShell(card, cx)))
1615
1857
  )
1616
- .when(Boolean(card.canLaunch), (el) =>
1858
+ .when(Boolean(card.canLaunch) && shown !== "launch", (el) =>
1617
1859
  el.child(item(`menu-launch-${card.id}`, "Lanzar run", "▶", false, () => this.openLaunch(card), true))
1618
1860
  )
1619
- .when(Boolean(card.canDeliver), (el) =>
1861
+ .when(Boolean(card.canDeliver) && shown !== "deliver", (el) =>
1620
1862
  el.child(item(`menu-deliver-${card.id}`, "Entregar…", "↑", false, () => this.openDeliver(card), true))
1621
1863
  )
1622
- .when(Boolean(card.canNudge), (el) =>
1864
+ .when(Boolean(card.canNudge) && shown !== "nudge", (el) =>
1623
1865
  el.child(item(`menu-nudge-${card.id}`, "Desbloquear…", "💬", false, () => this.openNudge(card), true))
1624
1866
  )
1625
1867
  .when(Boolean(card.canFinish), (el) =>
1626
1868
  el.child(item(`menu-finish-${card.id}`, "Terminado…", "✓", false, () => this.openFinish(card), true))
1627
1869
  )
1628
- .when(Boolean(card.canApprove), (el) =>
1870
+ .when(Boolean(card.canApprove) && shown !== "approve", (el) =>
1629
1871
  el.child(item(`menu-approve-${card.id}`, "Aprobar arreglos…", "✓", false, () => this.openApprove(card), true))
1630
1872
  )
1631
1873
  .when(Boolean(card.prUrl) && (card.deliveries || []).length === 0, (el) =>