@jmanuelcorral/bond-app 0.2.2 → 0.3.0
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/app/mods/bond-agents/main.js +446 -28
- package/app/mods/bond-agents/model.js +236 -0
- package/app/mods/bond-board/main.js +170 -16
- package/app/mods/bond-board/model.js +63 -2
- package/app/mods/bond-settings/main.js +128 -2
- package/package.json +1 -1
- package/runner/versions.env +1 -1
- package/src/config.ts +3 -0
- package/src/core/agent-flags.ts +38 -0
- package/src/core/agent-waiting.ts +38 -0
- package/src/core/agy-login.ts +56 -4
- package/src/core/doctor.ts +58 -12
- package/src/core/handoff.ts +161 -0
- package/src/core/hub-session.ts +14 -2
- package/src/core/hub.ts +3 -3
- package/src/core/loop.ts +241 -0
- package/src/core/orchestrator.ts +961 -181
- package/src/core/pi-compaction.ts +98 -0
- package/src/core/stuck.ts +192 -0
- package/src/db/database.ts +31 -1
- package/src/db/run-repo.ts +38 -3
- package/src/db/settings-repo.ts +138 -0
- package/src/db/ticket-repo.ts +74 -5
- package/src/runner/hc-client.ts +27 -4
- package/src/server/app.ts +175 -3
- package/src/types.ts +74 -0
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Shows per run what the live table showed: agents, repo, state, commits, files,
|
|
3
3
|
// fetched from GET /api/v1/runs/:id/team-status within the container.
|
|
4
4
|
import { View, div, svg, image } from "gpui-kit";
|
|
5
|
-
import { v_flex, h_flex } from "gpui-base";
|
|
6
|
-
import { theme, run, shared, setShared, panes, spaces, terminals } from "herdr";
|
|
5
|
+
import { v_flex, h_flex, TextareaState, Textarea, InputState, Input } from "gpui-base";
|
|
6
|
+
import { theme, run, shared, setShared, panes, spaces, terminals, props, openOverlay, closeOverlay, notify } from "herdr";
|
|
7
7
|
import { api } from "./api.js";
|
|
8
8
|
import { UI, stateColor } from "./brand.js";
|
|
9
|
-
import { POLL_MS, SELECTED_RUN_KEY, SELECTED_TICKET_KEY, REFRESH_KEY, LIVE_STATES, buildAgentsSections, isAgentTerminal, runAgentAddrs, HIDDEN_KEY, INIT_TAB, agentIcon, isLeaderRow, rowName, rowRole, rowStats, attentionOf, machineOf, runMachine, readHidden, pruneHidden, planTabs, planPanels, panelBuildSteps, initTabToClose } from "./model.js";
|
|
9
|
+
import { RELAUNCH_REASONS, relaunchPath, relaunchBody, relaunchNameOf, closedNotShown, stuckAgentOf, resumePath, loopStripOf, LOOP_ACTIONS, loopActionPath, loopStartBody, loopMessageBody, LOOP_TEXT_MAX, analysisWarnings, preparingNotice, POLL_MS, SELECTED_RUN_KEY, SELECTED_TICKET_KEY, REFRESH_KEY, LIVE_STATES, buildAgentsSections, isAgentTerminal, runAgentAddrs, HIDDEN_KEY, INIT_TAB, INIT_ARGV, agentIcon, isLeaderRow, rowName, rowRole, rowStats, attentionOf, machineOf, runMachine, readHidden, pruneHidden, planTabs, planPanels, panelBuildSteps, initTabToClose, runSpaceOf, strayInitSpaces } from "./model.js";
|
|
10
10
|
|
|
11
11
|
// Per-run view mode, shared: { runId: true } for PANELES (E2: one tab of the run's space
|
|
12
12
|
// split in up to MAX_PANELS agents); absent is PESTAÑAS (one tab per agent). The layout
|
|
@@ -21,6 +21,21 @@ const RUN_STATE_ES = {
|
|
|
21
21
|
|
|
22
22
|
export default class BondAgents extends View {
|
|
23
23
|
init(_props, cx) {
|
|
24
|
+
// Issue #3: this mod also opens as the agent's right-click menu and the
|
|
25
|
+
// «Relanzar con resumen» dialog (props.view); the panel is the default.
|
|
26
|
+
const p = props() ?? {};
|
|
27
|
+
this.view = p.view ?? "panel";
|
|
28
|
+
this.handle = cx.focus_handle();
|
|
29
|
+
if (this.view === "agent-menu" || this.view === "analysis") return;
|
|
30
|
+
if (this.view === "relaunch") {
|
|
31
|
+
this.initRelaunch(p, cx);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (this.view === "loop-start" || this.view === "loop-message") {
|
|
35
|
+
this.initLoopDialog(p, cx);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.closedByRun = {};
|
|
24
39
|
this.runs = [];
|
|
25
40
|
this.tickets = [];
|
|
26
41
|
this.teamStatusByRun = {};
|
|
@@ -67,16 +82,21 @@ export default class BondAgents extends View {
|
|
|
67
82
|
// Fetch team status and terminals only for the selected run
|
|
68
83
|
const statusMap = {};
|
|
69
84
|
const terminalsMap = {};
|
|
85
|
+
const closedMap = {};
|
|
70
86
|
const targetRun = this.selectedRunId
|
|
71
87
|
? this.runs.find((r) => r.id === this.selectedRunId)
|
|
72
88
|
: (this.selectedTicketId ? this.runs.find((r) => r.ticket_id === this.selectedTicketId) : null);
|
|
73
89
|
|
|
74
90
|
if (targetRun) {
|
|
75
91
|
try {
|
|
76
|
-
const [statusRes, termRes] = await Promise.allSettled([
|
|
92
|
+
const [statusRes, termRes, closedRes] = await Promise.allSettled([
|
|
77
93
|
api(`/runs/${targetRun.id}/team-status`),
|
|
78
94
|
api(`/runs/${targetRun.id}/terminals`),
|
|
95
|
+
api(`/runs/${targetRun.id}/closed-agents`),
|
|
79
96
|
]);
|
|
97
|
+
if (closedRes.status === "fulfilled" && Array.isArray(closedRes.value)) {
|
|
98
|
+
closedMap[targetRun.id] = closedRes.value;
|
|
99
|
+
}
|
|
80
100
|
if (statusRes.status === "fulfilled" && Array.isArray(statusRes.value)) {
|
|
81
101
|
statusMap[targetRun.id] = statusRes.value;
|
|
82
102
|
}
|
|
@@ -90,6 +110,7 @@ export default class BondAgents extends View {
|
|
|
90
110
|
|
|
91
111
|
this.teamStatusByRun = statusMap;
|
|
92
112
|
this.terminalsByRun = terminalsMap;
|
|
113
|
+
this.closedByRun = closedMap;
|
|
93
114
|
|
|
94
115
|
// C1: Reconcile view mode idempotently on EVERY refresh
|
|
95
116
|
await this.reconcileView();
|
|
@@ -137,11 +158,11 @@ export default class BondAgents extends View {
|
|
|
137
158
|
* shell in an INIT_TAB tab that the reconciler closes once the orchestrator has its own. */
|
|
138
159
|
showRunSpace(machine, title) {
|
|
139
160
|
if (!machine) return;
|
|
140
|
-
const sp = (spaces() ?? []
|
|
161
|
+
const sp = runSpaceOf(spaces() ?? [], panes() ?? [], machine);
|
|
141
162
|
if (sp) {
|
|
142
163
|
if (!sp.active) run("space.select", { id: sp.id });
|
|
143
164
|
} else {
|
|
144
|
-
run("space.new", { machine, name: title, tab: INIT_TAB });
|
|
165
|
+
run("space.new", { machine, name: title, tab: INIT_TAB, argv: INIT_ARGV });
|
|
145
166
|
}
|
|
146
167
|
}
|
|
147
168
|
|
|
@@ -166,13 +187,24 @@ export default class BondAgents extends View {
|
|
|
166
187
|
// C7: only coding agents are shown as tabs or blocks; dev servers/shells are not.
|
|
167
188
|
const agentAddrs = runAgentAddrs(liveTerms);
|
|
168
189
|
const machine = runMachine(targetRun);
|
|
169
|
-
const
|
|
190
|
+
const paneList = (panes() ?? []).filter((p) => p?.terminal && machineOf(p.terminal) === machine);
|
|
191
|
+
const allSpaces = spaces() ?? [];
|
|
192
|
+
const space = runSpaceOf(allSpaces, paneList, machine, agentAddrs);
|
|
170
193
|
if (!space) {
|
|
171
194
|
// The run is selected but its space is gone (closed, or emptied): make it again.
|
|
172
195
|
this.showRunSpace(machine, this.runTitle(targetRun));
|
|
173
196
|
return;
|
|
174
197
|
}
|
|
175
|
-
|
|
198
|
+
// Opened early, the run got a bond-init space and bond put gru in another: show gru's
|
|
199
|
+
// space and close the leftover one (its only terminal is the bond-init shell).
|
|
200
|
+
const stray = strayInitSpaces(allSpaces, paneList, machine, space, agentAddrs);
|
|
201
|
+
if (stray.length > 0) {
|
|
202
|
+
try {
|
|
203
|
+
if (!space.active) run("space.select", { id: space.id });
|
|
204
|
+
for (const id of stray) run("space.close", { id, confirmed: true });
|
|
205
|
+
} catch {}
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
176
208
|
const hidden = this.syncHidden(machine, liveTerms.map((t) => t.address));
|
|
177
209
|
|
|
178
210
|
const canKeep = Boolean(space?.active);
|
|
@@ -264,7 +296,7 @@ export default class BondAgents extends View {
|
|
|
264
296
|
/** One agent as a list row (lista compacta, 2026-11-23): its icon, name, state with a fixed
|
|
265
297
|
* width (never past the edge), «program · role», stats only when there are some. Click:
|
|
266
298
|
* its terminal; the eye button hides it (or shows it again when hidden). */
|
|
267
|
-
agentRow(row, t, hidden = false) {
|
|
299
|
+
agentRow(row, t, hidden = false, runId = null) {
|
|
268
300
|
const name = rowName(row);
|
|
269
301
|
const leader = isLeaderRow(row);
|
|
270
302
|
const slug = String(row.pane ?? name).replace(/[^a-zA-Z0-9]/g, "_");
|
|
@@ -291,6 +323,10 @@ export default class BondAgents extends View {
|
|
|
291
323
|
.rounded(UI.radius).cursor_pointer().hover((st) => st.bg(t.hover))
|
|
292
324
|
.when(hidden, (el) => el.opacity(0.6))
|
|
293
325
|
.on_click(() => this.focusAgent(row))
|
|
326
|
+
.on_mouse_down("right", (_e, cx) => {
|
|
327
|
+
cx.stop_propagation();
|
|
328
|
+
this.openAgentMenu(row, runId);
|
|
329
|
+
})
|
|
294
330
|
.child(avatar)
|
|
295
331
|
.child(v_flex().flex_1().min_w(0).gap(1)
|
|
296
332
|
.child(h_flex().w_full().min_w(0).items_center().gap(6)
|
|
@@ -324,7 +360,13 @@ export default class BondAgents extends View {
|
|
|
324
360
|
const isHidden = (r) => String(r.pane ?? "").includes("/") && hiddenSet.has(String(r.pane));
|
|
325
361
|
const shown = s.rows.filter((r) => !isHidden(r));
|
|
326
362
|
const hiddenRows = s.rows.filter(isHidden);
|
|
363
|
+
// Closed agents not already shown as a row (a dead gru still shows as its run's agent).
|
|
364
|
+
const closed = closedNotShown(this.closedByRun?.[s.run?.id], s.rows);
|
|
327
365
|
const att = attentionOf(shown, s.state === "waiting" ? s.run?.failure_reason : null);
|
|
366
|
+
const stuck = s.state === "waiting" && s.run ? stuckAgentOf(s.run.failure_reason) : null;
|
|
367
|
+
const loop = loopStripOf(s.run, s.ticket);
|
|
368
|
+
const warn = analysisWarnings(s.run, s.ticket);
|
|
369
|
+
const preparing = preparingNotice(s.run);
|
|
328
370
|
const panels = Boolean(s.run && this.isPanels(s.run.id));
|
|
329
371
|
const mono = (el) => el.font_family("JetBrains Mono");
|
|
330
372
|
const divider = () => div().w_full().h(1).bg(t.border);
|
|
@@ -351,42 +393,418 @@ export default class BondAgents extends View {
|
|
|
351
393
|
.when(Boolean(s.run), (el) => el.child(h_flex().w_full().p(2).gap(2).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border)
|
|
352
394
|
.child(seg("agents-mode-tabs", "Pestañas", !panels))
|
|
353
395
|
.child(seg("agents-mode-panels", "Paneles", panels)))))
|
|
396
|
+
// LOOP P3: the loop's state and the person's actions on it.
|
|
397
|
+
.when(Boolean(loop), (el) => el.child(h_flex().id("agents-loop").w_full().min_w(0).items_center().gap(8).px(8).py(6)
|
|
398
|
+
.rounded(UI.radius).bg(t.popover).border_1().border_color(t.border)
|
|
399
|
+
.child(div().size(6).flex_none().rounded(3).bg(loop.tone === "dim" ? t.dim : stateColor(t, loop.tone)))
|
|
400
|
+
.child(mono(div().flex_1().min_w(0).truncate().text_size(UI.text.tiny).font_semibold().text_color(t.foreground)).child(loop.label))
|
|
401
|
+
.children(loop.actions.map((a) => mono(div().id(`agents-loop-${a}`).flex_none().text_size(UI.text.tiny).font_semibold()
|
|
402
|
+
.text_color(a === "stop" ? t.blocked : t.accent).cursor_pointer().hover((st) => st.text_color(t.foreground))
|
|
403
|
+
.on_click((_e, cx) => this.loopAction(s.run.id, a, cx, { max: loop.max, title }))).child(LOOP_ACTIONS[a])))))
|
|
354
404
|
// One attention notice
|
|
355
405
|
.when(Boolean(att), (el) => el.child(v_flex().w_full().p(8).gap(4).rounded(UI.radius).bg(t.popover).border_1().border_color(waitColor)
|
|
356
406
|
.child(h_flex().items_center().gap(6)
|
|
357
407
|
.child(div().size(7).rounded(4).flex_none().bg(waitColor))
|
|
358
408
|
.child(div().flex_1().min_w(0).truncate().text_size(UI.text.small).font_semibold().font_family(UI.fontSans).text_color(waitColor).child(`${att.name} te necesita`)))
|
|
359
409
|
.when(Boolean(att.text), (sub) => sub.child(div().text_size(UI.text.small).font_family(UI.fontSans).text_color(t.foreground).child(`«${att.text}»`)))
|
|
360
|
-
.when(Boolean(att.row?.pane), (sub) => sub.child(h_flex().justify_end()
|
|
361
|
-
|
|
362
|
-
|
|
410
|
+
.when(Boolean(att.row?.pane) || Boolean(stuck), (sub) => sub.child(h_flex().justify_end().gap(12)
|
|
411
|
+
// Issue #3 P3: a stuck agent (full context, exhausted budget) is relaunched, not answered.
|
|
412
|
+
// P4: a budget stop with a known reset time can wait for it, with the same agent.
|
|
413
|
+
.when(Boolean(stuck?.resets) && !stuck?.scheduled, (row) => row.child(mono(div().id("agents-resume").text_size(UI.text.tiny).font_semibold().text_color(t.accent).cursor_pointer()
|
|
414
|
+
.hover((st) => st.text_color(t.foreground)).on_click((_e, cx) => this.scheduleResume(s.run.id, stuck.name, cx))).child(`Reanudar al restablecerse (${stuck.resets}) →`)))
|
|
415
|
+
.when(Boolean(stuck), (row) => row.child(mono(div().id("agents-relaunch").text_size(UI.text.tiny).font_semibold().text_color(t.accent).cursor_pointer()
|
|
416
|
+
.hover((st) => st.text_color(t.foreground)).on_click(() => this.openRelaunch(s.run.id, stuck.name, stuck.reason))).child("Relanzar con resumen →")))
|
|
417
|
+
.when(Boolean(att.row?.pane), (row) => row.child(mono(div().id("agents-answer").text_size(UI.text.tiny).font_semibold().text_color(t.accent).cursor_pointer()
|
|
418
|
+
.hover((st) => st.text_color(t.foreground)).on_click(() => this.focusAgent(att.row))).child("Responder →")))))))
|
|
363
419
|
// Why it failed, when nobody is waiting (a waiting run says it in the notice)
|
|
364
420
|
.when(!att && Boolean(s.run?.failure_reason), (el) => el.child(h_flex().w_full().min_w(0).gap(4).items_center()
|
|
365
421
|
.child(mono(div().flex_none().text_size(UI.text.tiny).font_semibold().text_color(color)).child("motivo:"))
|
|
366
422
|
.child(mono(div().flex_1().min_w(0).truncate().text_size(UI.text.tiny).text_color(t.foreground)).child(String(s.run.failure_reason)))))
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
.child(div().font_semibold().text_color(t.dim).child("bond hub check:"))
|
|
375
|
-
.child(div().font_semibold().text_color(isReady ? t.working : t.blocked)
|
|
376
|
-
.child(isReady ? "análisis: listo" : `${gaps.length} ${gaps.length === 1 ? "hueco" : "huecos"} (${fixable} con arreglo)`)))
|
|
377
|
-
.children(gaps.map((g) => div().text_color(t.dim).child(String(`· ${g?.message || g?.id || "hueco detectado"}${g?.fix || g?.fixable ? " (se arregla solo)" : ""}`))))
|
|
378
|
-
.when(Boolean(a?.summary), (sub) => sub.child(div().text_color(t.dim).child(String(`agente de hub: ${a.summary}`)))));
|
|
379
|
-
})
|
|
423
|
+
// The hub analysis as one warnings line; «Ver» opens the detail in a dialog.
|
|
424
|
+
.when(Boolean(warn), (el) => el.child(h_flex().id("agents-analysis").w_full().min_w(0).items_center().gap(8).px(8).py(6)
|
|
425
|
+
.rounded(UI.radius).bg(t.popover).border_1().border_color(warn.blocking ? t.blocked : t.border)
|
|
426
|
+
.cursor_pointer().hover((st) => st.bg(t.hover)).on_click(() => this.openAnalysis(warn, title))
|
|
427
|
+
.child(mono(div().flex_none().text_size(UI.text.tiny).text_color(warn.blocking ? t.blocked : stateColor(t, "waiting"))).child("⚠"))
|
|
428
|
+
.child(mono(div().flex_1().min_w(0).truncate().text_size(UI.text.tiny).font_semibold().text_color(warn.blocking ? t.blocked : t.foreground)).child(warn.label))
|
|
429
|
+
.child(mono(div().flex_none().text_size(UI.text.tiny).font_semibold().text_color(t.accent)).child("Ver"))))
|
|
380
430
|
.child(divider())
|
|
381
|
-
|
|
382
|
-
.when(
|
|
431
|
+
// Before the agents start (container, hub analysis): say what is going on and for how long.
|
|
432
|
+
.when(s.rows.length === 0 && Boolean(preparing), (el) => el.child(v_flex().id("agents-preparing").w_full().p(8).gap(4)
|
|
433
|
+
.rounded(UI.radius).bg(t.popover).border_1().border_color(stateColor(t, "working"))
|
|
434
|
+
.child(h_flex().items_center().gap(6)
|
|
435
|
+
.child(div().size(6).rounded(3).bg(stateColor(t, "working")))
|
|
436
|
+
.child(mono(div().text_size(UI.text.tiny).font_semibold().text_color(t.foreground)).child(preparing.title)))
|
|
437
|
+
.child(div().text_size(UI.text.tiny).font_family(UI.fontSans).text_color(t.dim).child(preparing.detail))))
|
|
438
|
+
.when(s.rows.length === 0 && !preparing, (el) => el.child(mono(div().p(6).text_size(UI.text.small).text_color(t.dim)).child("Sin equipo de agentes activo")))
|
|
439
|
+
.when(shown.length > 0, (el) => el.child(v_flex().w_full().gap(2).children(shown.map((r) => this.agentRow(r, t, false, s.run?.id)))))
|
|
383
440
|
.when(hiddenRows.length > 0, (el) => el
|
|
384
441
|
.child(divider())
|
|
385
442
|
.child(mono(div().px(6).text_size(UI.text.tiny).font_semibold().text_color(t.dim)).child(`Ocultos (${hiddenRows.length})`))
|
|
386
|
-
.child(v_flex().w_full().gap(2).children(hiddenRows.map((r) => this.agentRow(r, t, true)))))
|
|
443
|
+
.child(v_flex().w_full().gap(2).children(hiddenRows.map((r) => this.agentRow(r, t, true, s.run?.id)))))
|
|
444
|
+
// Issue #3: agents that ended and were not replaced (NAV-4588's gru): relaunch them.
|
|
445
|
+
.when(closed.length > 0, (el) => el
|
|
446
|
+
.child(divider())
|
|
447
|
+
.child(mono(div().px(6).text_size(UI.text.tiny).font_semibold().text_color(t.dim)).child(`Cerrados (${closed.length})`))
|
|
448
|
+
.child(v_flex().w_full().gap(2).children(closed.map((c) => this.closedRow(c, s.run.id, t)))));
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/** A closed agent: its name and «cerrado»; a click or right-click relaunches it. */
|
|
452
|
+
closedRow(c, runId, t) {
|
|
453
|
+
const mono = (el) => el.font_family("JetBrains Mono");
|
|
454
|
+
const open = (cx) => {
|
|
455
|
+
cx?.stop_propagation?.();
|
|
456
|
+
this.openRelaunch(runId, c.name);
|
|
457
|
+
};
|
|
458
|
+
return h_flex().id(`agent-closed-${c.name}`).w_full().min_w(0).items_center().gap(8).px(6).py(5)
|
|
459
|
+
.rounded(UI.radius).cursor_pointer().opacity(0.7).hover((st) => st.bg(t.hover).opacity(1))
|
|
460
|
+
.tooltip("Relanzar con resumen…")
|
|
461
|
+
.on_click((_e, cx) => open(cx))
|
|
462
|
+
.on_mouse_down("right", (_e, cx) => open(cx))
|
|
463
|
+
.child(mono(div().flex_1().min_w(0).truncate().text_size(UI.text.body).font_semibold().text_color(t.muted)).child(c.name))
|
|
464
|
+
.child(mono(div().flex_none().text_size(UI.text.tiny).text_color(t.dim)).child("cerrado · relanzar →"));
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// ---- issue #3: «Relanzar con resumen» ----
|
|
468
|
+
|
|
469
|
+
/** The terminal name of a row (what the API relaunches): from the run's terminals. */
|
|
470
|
+
terminalNameOf(row, runId) {
|
|
471
|
+
return relaunchNameOf(row, this.terminalsByRun?.[runId], this.closedByRun?.[runId], this.runs?.find((r) => r.id === runId));
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
openAgentMenu(row, runId) {
|
|
475
|
+
const name = this.terminalNameOf(row, runId);
|
|
476
|
+
if (!runId || !name) {
|
|
477
|
+
notify({ title: "Sin acciones", body: "Este agente no es de un run que se pueda relanzar.", level: "info" });
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
openOverlay({ mod: "bond-agents", kind: "popup", width: 250, props: { view: "agent-menu", runId, name } });
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/** LOOP P3: start, pause, resume or stop the run's loop. Start and «Mensaje a gru» open a dialog. */
|
|
484
|
+
loopAction(runId, action, cx, ctx = {}) {
|
|
485
|
+
if (action === "start" || action === "message") {
|
|
486
|
+
openOverlay({ mod: "bond-agents", kind: "dialog", modal: true, width: 680,
|
|
487
|
+
props: { view: action === "start" ? "loop-start" : "loop-message", runId, max: ctx.max ?? null, title: ctx.title ?? "" } });
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
cx.spawn(async (cx) => {
|
|
491
|
+
try {
|
|
492
|
+
await api(loopActionPath(runId, action), { method: "POST", body: {} });
|
|
493
|
+
if (action === "start") notify({ title: "Loop iniciado", body: "gru ejecuta el plan con el equipo (skill loop-lead).", level: "success" });
|
|
494
|
+
setShared(REFRESH_KEY, Date.now());
|
|
495
|
+
} catch (e) {
|
|
496
|
+
notify({ title: `No se pudo ${LOOP_ACTIONS[action].toLowerCase()}`, body: String(e?.message ?? e), level: "error" });
|
|
497
|
+
}
|
|
498
|
+
cx.notify();
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/** P4: «Reanudar al restablecerse»: the same agent goes on when its budget is back. */
|
|
503
|
+
scheduleResume(runId, name, cx) {
|
|
504
|
+
cx.spawn(async (cx) => {
|
|
505
|
+
try {
|
|
506
|
+
await api(resumePath(runId, name), { method: "POST", body: {} });
|
|
507
|
+
notify({ title: `${name} se reanudará solo`, body: "Cuando se restablezca su presupuesto, seguirá donde lo dejó.", level: "success" });
|
|
508
|
+
setShared(REFRESH_KEY, Date.now());
|
|
509
|
+
} catch (e) {
|
|
510
|
+
notify({ title: "No se pudo programar la reanudación", body: String(e?.message ?? e), level: "error" });
|
|
511
|
+
}
|
|
512
|
+
cx.notify();
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
openAnalysis(warn, title) {
|
|
517
|
+
openOverlay({ mod: "bond-agents", kind: "dialog", modal: true, width: 680, props: { view: "analysis", warn, title } });
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
renderAnalysis() {
|
|
521
|
+
const t = theme();
|
|
522
|
+
const p = props() ?? {};
|
|
523
|
+
const w = p.warn ?? { gaps: [], warnings: [] };
|
|
524
|
+
const mono = (el) => el.font_family("JetBrains Mono");
|
|
525
|
+
const head = (text) => div().pt(4).text_size(UI.text.small).font_semibold().text_color(t.muted).child(text);
|
|
526
|
+
const item = (text, color) => div().text_size(12).text_color(color).child(String(text));
|
|
527
|
+
return v_flex().id("bond-analysis").track_focus(this.handle).on_key_down((e, cx) => this.key(e, cx))
|
|
528
|
+
.w_full().p(18).gap(8).bg(t.popover).rounded(UI.radiusLg).border_1().border_color(t.border).text_color(t.foreground).font_family("JetBrains Mono")
|
|
529
|
+
.max_h(640).overflow_y_scrollbar()
|
|
530
|
+
.child(h_flex().items_center()
|
|
531
|
+
.child(div().flex_1().text_size(UI.text.title + 2).font_semibold().child("Análisis del hub"))
|
|
532
|
+
.child(div().text_size(UI.text.small).text_color(t.dim).child("Esc")))
|
|
533
|
+
.when(Boolean(p.title), (el) => el.child(div().text_size(UI.text.small).text_color(t.dim).truncate().child(String(p.title))))
|
|
534
|
+
.child(div().text_size(UI.text.small).text_color(t.dim).child(w.blocking
|
|
535
|
+
? "Bloquean el run: arréglalos («Aprobar arreglos…» o «Desbloquear…» en la tarjeta) o sigue sin ellos («Seguir sin ellos…»)."
|
|
536
|
+
: "No bloquean: el run sigue. Quedan aquí por si alguno importa."))
|
|
537
|
+
.when((w.gaps ?? []).length > 0, (el) => el
|
|
538
|
+
.child(head(w.blocking ? "Huecos" : "Huecos (seguido sin ellos)"))
|
|
539
|
+
.children(w.gaps.map((g) => item(`· ${g.message}${g.fixable ? " (se arregla solo)" : ""}`, w.blocking ? t.blocked : t.foreground))))
|
|
540
|
+
.when((w.warnings ?? []).length > 0, (el) => el
|
|
541
|
+
.child(head("Avisos"))
|
|
542
|
+
.children(w.warnings.map((x) => item(`· ${x}`, t.foreground))))
|
|
543
|
+
.when(Boolean(w.summary), (el) => el.child(head("Resumen del agente de hub")).child(item(w.summary, t.dim)))
|
|
544
|
+
.when(Boolean(w.checkedAt), (el) => el.child(mono(div().pt(4).text_size(UI.text.tiny).text_color(t.dim)).child(`Analizado: ${w.checkedAt}`)))
|
|
545
|
+
.child(h_flex().pt(6).justify_end()
|
|
546
|
+
.child(h_flex().id("an-close").h(28).px(14).items_center().rounded(UI.radius).text_size(12.5).font_semibold()
|
|
547
|
+
.border_1().border_color(t.border).bg(t.surface).cursor_pointer().on_click(() => closeOverlay(p.overlay)).child("Cerrar")));
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
openRelaunch(runId, name, reason = null) {
|
|
551
|
+
openOverlay({ mod: "bond-agents", kind: "dialog", modal: true, width: 760, props: { view: "relaunch", runId, name, reason } });
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
key(e, cx) {
|
|
555
|
+
if (e.key === "escape") {
|
|
556
|
+
closeOverlay(props().overlay);
|
|
557
|
+
cx.stop_propagation();
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
renderAgentMenu(p) {
|
|
562
|
+
const t = theme();
|
|
563
|
+
return v_flex().id("bond-agent-menu").track_focus(this.handle).on_key_down((e, cx) => this.key(e, cx))
|
|
564
|
+
.w_full().p(4).gap(2).bg(t.popover).text_color(t.foreground).font_family("JetBrains Mono")
|
|
565
|
+
.child(div().px(10).py(4).text_size(UI.text.tiny).text_color(t.dim).child(String(p.name ?? "")))
|
|
566
|
+
.child(h_flex().id("agent-menu-relaunch").h(28).px(10).gap(8).items_center().rounded(UI.radius)
|
|
567
|
+
.text_size(UI.text.small).cursor_pointer().hover((st) => st.bg(t.hover))
|
|
568
|
+
.on_click((_e, cx) => {
|
|
569
|
+
cx.stop_propagation();
|
|
570
|
+
closeOverlay(p.overlay);
|
|
571
|
+
this.openRelaunch(p.runId, p.name);
|
|
572
|
+
})
|
|
573
|
+
.child(div().w(16).text_center().child("↻"))
|
|
574
|
+
.child(div().truncate().child("Relanzar con resumen…")));
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
initRelaunch(p, cx) {
|
|
578
|
+
const reason = RELAUNCH_REASONS.some((r) => r.id === p.reason) ? p.reason : RELAUNCH_REASONS[0].id;
|
|
579
|
+
this.rl = { runId: p.runId, name: p.name, options: null, agent: null, reason, loading: true, busy: false, error: null, generated: "" };
|
|
580
|
+
this.model = InputState.new({ placeholder: "modelo de pi (vacío: el del ticket o el de Ajustes)" });
|
|
581
|
+
this.handoff = TextareaState.new({ placeholder: "el traspaso que leerá el nuevo agente" });
|
|
582
|
+
this.handoff.set_rows(18);
|
|
583
|
+
this.loadHandoff(cx);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/** Fetches the options and a fresh handoff for the chosen agent and reason. */
|
|
587
|
+
loadHandoff(cx) {
|
|
588
|
+
const rl = this.rl;
|
|
589
|
+
rl.loading = true;
|
|
590
|
+
rl.error = null;
|
|
591
|
+
cx.notify();
|
|
592
|
+
cx.spawn(async (cx) => {
|
|
593
|
+
try {
|
|
594
|
+
const res = await api(relaunchPath(rl.runId, rl.name, rl.agent, rl.reason));
|
|
595
|
+
rl.options = res;
|
|
596
|
+
if (!rl.agent) {
|
|
597
|
+
const from = (res.agents ?? []).find((a) => a.agent === res.from && a.available);
|
|
598
|
+
rl.agent = from ? from.agent : ((res.agents ?? []).find((a) => a.available)?.agent ?? null);
|
|
599
|
+
}
|
|
600
|
+
rl.generated = String(res.handoff ?? "");
|
|
601
|
+
this.handoff.set_value(rl.generated);
|
|
602
|
+
} catch (e) {
|
|
603
|
+
rl.error = String(e?.message ?? e);
|
|
604
|
+
}
|
|
605
|
+
rl.loading = false;
|
|
606
|
+
cx.notify();
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/** A change of agent or reason regenerates the handoff, unless the person edited it. */
|
|
611
|
+
pick(field, value, cx) {
|
|
612
|
+
const rl = this.rl;
|
|
613
|
+
if (rl[field] === value) return;
|
|
614
|
+
rl[field] = value;
|
|
615
|
+
const edited = String(this.handoff.value() ?? "") !== rl.generated;
|
|
616
|
+
if (!edited) this.loadHandoff(cx);
|
|
617
|
+
else cx.notify();
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
submitRelaunch(cx) {
|
|
621
|
+
const rl = this.rl;
|
|
622
|
+
if (rl.busy || rl.loading || !rl.agent) return;
|
|
623
|
+
rl.busy = true;
|
|
624
|
+
rl.error = null;
|
|
625
|
+
cx.notify();
|
|
626
|
+
cx.spawn(async (cx) => {
|
|
627
|
+
try {
|
|
628
|
+
const body = relaunchBody({ agent: rl.agent, model: this.model.value(), reason: rl.reason, handoff: this.handoff.value() });
|
|
629
|
+
await api(relaunchPath(rl.runId, rl.name), { method: "POST", body });
|
|
630
|
+
notify({ title: `${rl.name} relanzado con ${rl.agent}`, body: "Arranca leyendo el traspaso.", level: "success" });
|
|
631
|
+
setShared(REFRESH_KEY, Date.now());
|
|
632
|
+
closeOverlay(props().overlay);
|
|
633
|
+
} catch (e) {
|
|
634
|
+
rl.error = String(e?.message ?? e);
|
|
635
|
+
rl.busy = false;
|
|
636
|
+
cx.notify();
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
renderRelaunch() {
|
|
642
|
+
const t = theme();
|
|
643
|
+
const rl = this.rl;
|
|
644
|
+
const mono = (el) => el.font_family("JetBrains Mono");
|
|
645
|
+
const opts = rl.options;
|
|
646
|
+
const edited = !rl.loading && String(this.handoff.value() ?? "") !== rl.generated;
|
|
647
|
+
const choice = (id, label, on, enabled, tip, action) => h_flex().id(id).flex_none().h(24).px(9).items_center().rounded(UI.radius).border_1()
|
|
648
|
+
.border_color(on ? t.accent : t.input).bg(on ? t.selected : t.surface)
|
|
649
|
+
.text_size(12).text_color(enabled ? (on ? t.foreground : t.muted) : t.dim)
|
|
650
|
+
.when(!enabled, (el) => el.opacity(0.5))
|
|
651
|
+
.when(Boolean(tip), (el) => el.tooltip(tip))
|
|
652
|
+
.when(enabled, (el) => el.cursor_pointer().hover((st) => st.bg(t.hover)).on_click((_e, cx) => action(cx)))
|
|
653
|
+
.child(label);
|
|
654
|
+
const label = (text) => div().text_size(UI.text.small).font_medium().text_color(t.muted).child(text);
|
|
655
|
+
const sameBudget = rl.reason === "presupuesto" && opts && rl.agent === opts.from;
|
|
656
|
+
const button = (id, text, primary, enabled, action) => h_flex().id(id).h(28).px(14).items_center().rounded(UI.radius)
|
|
657
|
+
.text_size(12.5).font_semibold().border_1()
|
|
658
|
+
.border_color(primary ? t.accent : t.border).bg(primary ? t.accent : t.surface).text_color(primary ? t.background : t.foreground)
|
|
659
|
+
.when(!enabled, (el) => el.opacity(0.5))
|
|
660
|
+
.when(enabled, (el) => el.cursor_pointer().on_click((_e, cx) => action(cx)))
|
|
661
|
+
.child(text);
|
|
662
|
+
|
|
663
|
+
return v_flex().id("bond-relaunch").track_focus(this.handle).on_key_down((e, cx) => this.key(e, cx))
|
|
664
|
+
.w_full().p(18).gap(10).bg(t.popover).rounded(UI.radiusLg).border_1().border_color(t.border).text_color(t.foreground).font_family("JetBrains Mono")
|
|
665
|
+
.child(h_flex().items_center()
|
|
666
|
+
.child(div().flex_1().text_size(UI.text.title + 2).font_semibold().child(`Relanzar ${rl.name} con resumen`))
|
|
667
|
+
.child(div().text_size(UI.text.small).text_color(t.dim).child("Esc")))
|
|
668
|
+
.child(div().text_size(UI.text.small).text_color(t.dim).child(opts
|
|
669
|
+
? `Ahora: ${opts.from} en ${opts.cwd}. Se cierra desde fuera y el nuevo arranca con el mismo nombre leyendo este traspaso (sin secretos).`
|
|
670
|
+
: "Leyendo la sesión, git y las decisiones del agente…"))
|
|
671
|
+
.child(v_flex().gap(4).child(label("Agente"))
|
|
672
|
+
.child(h_flex().gap(6).flex_wrap().children((opts?.agents ?? []).map((a) =>
|
|
673
|
+
choice(`rl-agent-${a.agent}`, a.agent, rl.agent === a.agent, a.available, a.available ? null : a.reason, (cx) => this.pick("agent", a.agent, cx))))))
|
|
674
|
+
.when(rl.agent === "pi", (el) => el.child(v_flex().gap(4).child(label("Modelo"))
|
|
675
|
+
.child(Input.new(this.model).h(28).px(9).rounded(UI.radius).border_1().border_color(t.input).bg(t.background).text_size(12))))
|
|
676
|
+
.child(v_flex().gap(4).child(label("Motivo"))
|
|
677
|
+
.child(h_flex().gap(6).flex_wrap().children(RELAUNCH_REASONS.map((r) =>
|
|
678
|
+
choice(`rl-reason-${r.id}`, r.label, rl.reason === r.id, true, null, (cx) => this.pick("reason", r.id, cx))))))
|
|
679
|
+
.when(sameBudget, (el) => el.child(div().text_size(UI.text.small).text_color(t.waiting ?? t.blocked)
|
|
680
|
+
.child("Con el mismo agente el presupuesto seguirá agotado: elige otro.")))
|
|
681
|
+
.child(v_flex().gap(4)
|
|
682
|
+
.child(h_flex().items_center().gap(8)
|
|
683
|
+
.child(div().flex_1().child(label(edited ? "Traspaso (editado: no se regenera)" : "Traspaso")))
|
|
684
|
+
.when(edited, (el) => el.child(mono(div().id("rl-regenerate").text_size(UI.text.tiny).text_color(t.accent).cursor_pointer()
|
|
685
|
+
.on_click((_e, cx) => this.loadHandoff(cx))).child("Regenerar"))))
|
|
686
|
+
.child(Textarea.new(this.handoff).h(300).p(8).rounded(UI.radius).border_1().border_color(t.input).bg(t.background).text_size(11.5)))
|
|
687
|
+
.when(Boolean(rl.error), (el) => el.child(div().text_size(UI.text.small).text_color(t.blocked).child(rl.error)))
|
|
688
|
+
.child(h_flex().pt(6).gap(8).justify_end()
|
|
689
|
+
.child(button("rl-cancel", "Cancelar", false, !rl.busy, () => closeOverlay(props().overlay)))
|
|
690
|
+
.child(button("rl-go", rl.busy ? "Relanzando…" : "Relanzar", true, !rl.busy && !rl.loading && Boolean(rl.agent), (cx) => this.submitRelaunch(cx))));
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
/** «Iniciar loop» (plan, instructions, iterations) and «Mensaje a gru». */
|
|
694
|
+
initLoopDialog(p, cx) {
|
|
695
|
+
const start = p.view === "loop-start";
|
|
696
|
+
// plan "": the ticket's story (the default: the hub's newest plan may be another ticket's).
|
|
697
|
+
this.ld = { runId: p.runId, start, plans: [], plan: "", loading: start, busy: false, error: null,
|
|
698
|
+
unlimited: start && (p.max === null || p.max === undefined) };
|
|
699
|
+
this.ldText = TextareaState.new({ placeholder: start
|
|
700
|
+
? "Opcional. Qué esperas de este loop: fases a hacer o no, prioridades, límites («no grabes el caso BDD», «solo P0–P2»…)"
|
|
701
|
+
: "La instrucción para gru: se añade al registro del loop y le llega ahora" });
|
|
702
|
+
this.ldText.set_rows(start ? 8 : 6);
|
|
703
|
+
this.ldMax = InputState.new({ placeholder: "1–1000" });
|
|
704
|
+
if (start && p.max !== null && p.max !== undefined) this.ldMax.set_value(String(p.max));
|
|
705
|
+
if (!start) return;
|
|
706
|
+
cx.spawn(async (cx) => {
|
|
707
|
+
try {
|
|
708
|
+
const res = await api(`/runs/${encodeURIComponent(p.runId)}/loop/plans`);
|
|
709
|
+
this.ld.plans = Array.isArray(res?.plans) ? res.plans : [];
|
|
710
|
+
} catch (e) {
|
|
711
|
+
this.ld.error = String(e?.message ?? e);
|
|
712
|
+
}
|
|
713
|
+
this.ld.loading = false;
|
|
714
|
+
cx.notify();
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
submitLoopDialog(cx) {
|
|
719
|
+
const ld = this.ld;
|
|
720
|
+
if (ld.busy) return;
|
|
721
|
+
const built = ld.start
|
|
722
|
+
? loopStartBody({ plan: ld.plan, instructions: this.ldText.value(), maxText: this.ldMax.value(), unlimited: ld.unlimited })
|
|
723
|
+
: loopMessageBody(this.ldText.value());
|
|
724
|
+
if (built.error) {
|
|
725
|
+
ld.error = built.error;
|
|
726
|
+
cx.notify();
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
ld.busy = true;
|
|
730
|
+
ld.error = null;
|
|
731
|
+
cx.notify();
|
|
732
|
+
cx.spawn(async (cx) => {
|
|
733
|
+
try {
|
|
734
|
+
await api(loopActionPath(ld.runId, ld.start ? "start" : "message"), { method: "POST", body: built.body });
|
|
735
|
+
notify(ld.start
|
|
736
|
+
? { title: "Loop iniciado", body: `gru ejecuta ${ld.plan ? ld.plan.replace(/^docs\/plans\//, "") : "el plan de la historia"} con el equipo.`, level: "success" }
|
|
737
|
+
: { title: "Instrucción enviada a gru", body: "Queda también en el registro del loop.", level: "success" });
|
|
738
|
+
setShared(REFRESH_KEY, Date.now());
|
|
739
|
+
closeOverlay(props().overlay);
|
|
740
|
+
} catch (e) {
|
|
741
|
+
ld.error = String(e?.message ?? e);
|
|
742
|
+
ld.busy = false;
|
|
743
|
+
cx.notify();
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
renderLoopDialog() {
|
|
749
|
+
const t = theme();
|
|
750
|
+
const ld = this.ld;
|
|
751
|
+
const mono = (el) => el.font_family("JetBrains Mono");
|
|
752
|
+
const label = (text) => div().text_size(UI.text.small).font_medium().text_color(t.muted).child(text);
|
|
753
|
+
const choice = (id, text, on, action) => h_flex().id(id).flex_none().h(24).px(9).items_center().rounded(UI.radius).border_1()
|
|
754
|
+
.border_color(on ? t.accent : t.input).bg(on ? t.selected : t.surface)
|
|
755
|
+
.text_size(12).text_color(on ? t.foreground : t.muted)
|
|
756
|
+
.cursor_pointer().hover((st) => st.bg(t.hover)).on_click((_e, cx) => action(cx))
|
|
757
|
+
.child(text);
|
|
758
|
+
const button = (id, text, primary, enabled, action) => h_flex().id(id).h(28).px(14).items_center().rounded(UI.radius)
|
|
759
|
+
.text_size(12.5).font_semibold().border_1()
|
|
760
|
+
.border_color(primary ? t.accent : t.border).bg(primary ? t.accent : t.surface).text_color(primary ? t.background : t.foreground)
|
|
761
|
+
.when(!enabled, (el) => el.opacity(0.5))
|
|
762
|
+
.when(enabled, (el) => el.cursor_pointer().on_click((_e, cx) => action(cx)))
|
|
763
|
+
.child(text);
|
|
764
|
+
const length = String(this.ldText.value() ?? "").trim().length;
|
|
765
|
+
const ready = !ld.busy && !ld.loading;
|
|
766
|
+
const title = props()?.title;
|
|
767
|
+
|
|
768
|
+
return v_flex().id("bond-loop-dialog").track_focus(this.handle).on_key_down((e, cx) => this.key(e, cx))
|
|
769
|
+
.w_full().p(18).gap(10).bg(t.popover).rounded(UI.radiusLg).border_1().border_color(t.border).text_color(t.foreground).font_family("JetBrains Mono")
|
|
770
|
+
.child(h_flex().items_center()
|
|
771
|
+
.child(div().flex_1().text_size(UI.text.title + 2).font_semibold().child(ld.start ? "Iniciar loop" : "Mensaje a gru"))
|
|
772
|
+
.child(div().text_size(UI.text.small).text_color(t.dim).child("Esc")))
|
|
773
|
+
.when(Boolean(title), (el) => el.child(div().text_size(UI.text.small).text_color(t.dim).truncate().child(String(title))))
|
|
774
|
+
.child(div().text_size(UI.text.small).text_color(t.dim).child(ld.start
|
|
775
|
+
? "gru dirige al equipo solo con la skill loop-lead. Lo que elijas aquí queda al principio del registro del loop (docs/loops/) y gru lo relee en cada vuelta."
|
|
776
|
+
: "La instrucción se añade al registro del loop y le llega a gru ahora; la tiene en cuenta en esta vuelta y en las siguientes."))
|
|
777
|
+
.when(ld.start, (el) => el
|
|
778
|
+
.child(v_flex().gap(4).child(label("Plan"))
|
|
779
|
+
.child(ld.loading
|
|
780
|
+
? div().text_size(UI.text.small).text_color(t.dim).child("Buscando planes en docs/plans/ del hub…")
|
|
781
|
+
: h_flex().flex_wrap().gap(6)
|
|
782
|
+
.child(choice("ld-plan-story", "Historia del ticket", ld.plan === "", (cx) => { ld.plan = ""; cx.notify(); }))
|
|
783
|
+
.children(ld.plans.map((pl, i) =>
|
|
784
|
+
choice(`ld-plan-${i}`, pl.replace(/^docs\/plans\//, ""), ld.plan === pl, (cx) => { ld.plan = pl; cx.notify(); }))))
|
|
785
|
+
.child(div().text_size(UI.text.tiny).text_color(t.dim).child(ld.plan === ""
|
|
786
|
+
? "Sin fichero: gru sigue el plan que trae la historia y, si no está en docs/plans/, lo escribe ahí primero."
|
|
787
|
+
: `gru ejecuta ${ld.plan}.`)))
|
|
788
|
+
.child(v_flex().gap(4).child(label("Iteraciones"))
|
|
789
|
+
.child(h_flex().gap(8).items_center()
|
|
790
|
+
.when(!ld.unlimited, (row) => row.child(div().w(90).child(Input.new(this.ldMax))))
|
|
791
|
+
.child(choice("ld-unlimited", "sin límite", ld.unlimited, (cx) => { ld.unlimited = !ld.unlimited; cx.notify(); })))))
|
|
792
|
+
.child(v_flex().gap(4)
|
|
793
|
+
.child(h_flex().items_center()
|
|
794
|
+
.child(div().flex_1().child(label(ld.start ? "Instrucciones para gru" : "Instrucción")))
|
|
795
|
+
.child(mono(div().text_size(UI.text.tiny).text_color(length > LOOP_TEXT_MAX ? t.blocked : t.dim)).child(`${length}/${LOOP_TEXT_MAX}`)))
|
|
796
|
+
.child(Textarea.new(this.ldText).p(8).rounded(UI.radius).border_1().border_color(t.input).bg(t.background).text_size(12)))
|
|
797
|
+
.when(Boolean(ld.error), (el) => el.child(div().text_size(UI.text.small).text_color(t.blocked).child(String(ld.error))))
|
|
798
|
+
.child(h_flex().pt(6).gap(8).justify_end()
|
|
799
|
+
.child(button("ld-cancel", "Cancelar", false, !ld.busy, () => closeOverlay(props().overlay)))
|
|
800
|
+
.child(button("ld-go", ld.busy ? (ld.start ? "Iniciando…" : "Enviando…") : (ld.start ? "Iniciar loop" : "Enviar"), true, ready, (cx) => this.submitLoopDialog(cx))));
|
|
387
801
|
}
|
|
388
802
|
|
|
389
803
|
render() {
|
|
804
|
+
if (this.view === "agent-menu") return this.renderAgentMenu(props() ?? {});
|
|
805
|
+
if (this.view === "relaunch") return this.renderRelaunch();
|
|
806
|
+
if (this.view === "loop-start" || this.view === "loop-message") return this.renderLoopDialog();
|
|
807
|
+
if (this.view === "analysis") return this.renderAnalysis();
|
|
390
808
|
const t = theme();
|
|
391
809
|
const hasSelected = Boolean(this.selectedRunId || this.selectedTicketId);
|
|
392
810
|
const sections = buildAgentsSections(
|