@jmanuelcorral/bond-app 0.1.5 → 0.2.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/README.md +280 -23
- package/app/brand/TOKENS.md +5 -5
- package/app/layouts/bond.json +10 -14
- package/app/mods/bond-agents/api.js +35 -0
- package/app/mods/bond-agents/branch.svg +1 -0
- package/app/mods/bond-agents/brand.js +53 -2
- package/app/mods/bond-agents/config.js +4 -0
- package/app/mods/bond-agents/eye-off.svg +1 -0
- package/app/mods/bond-agents/eye.svg +1 -0
- package/app/mods/bond-agents/main.js +308 -327
- package/app/mods/bond-agents/model.js +376 -5
- package/app/mods/bond-board/api.js +35 -0
- package/app/mods/bond-board/branch.svg +1 -0
- package/app/mods/bond-board/brand.js +53 -2
- package/app/mods/bond-board/config.js +4 -0
- package/app/mods/bond-board/main.js +1000 -449
- package/app/mods/bond-board/model.js +170 -28
- package/app/mods/bond-pane/close.svg +1 -0
- package/app/mods/bond-pane/hide.svg +1 -0
- package/app/mods/bond-pane/main.js +103 -0
- package/app/mods/bond-pane/mod.json +1 -0
- package/app/mods/bond-pane/model.js +18 -0
- package/app/mods/bond-pane/split-down.svg +1 -0
- package/app/mods/bond-pane/split-right.svg +1 -0
- package/app/mods/bond-pane/unzoom.svg +1 -0
- package/app/mods/bond-pane/zoom.svg +1 -0
- package/app/mods/bond-settings/api.js +35 -0
- package/app/mods/bond-settings/brand.js +53 -2
- package/app/mods/bond-settings/config.js +4 -0
- package/app/mods/bond-settings/main.js +1216 -272
- package/app/mods/bond-settings/mod.json +1 -1
- package/app/mods/bond-status/api.js +35 -0
- package/app/mods/bond-status/brand.js +53 -2
- package/app/mods/bond-status/config.js +4 -0
- package/app/mods/bond-status/main.js +37 -15
- package/app/mods/bond-status/model.js +19 -1
- package/app/mods/bond-tabs/brand.js +53 -2
- package/app/mods/bond-tabs/main.js +45 -3
- package/app/mods/bond-titlebar/brand.js +53 -2
- package/app/mods/bond-titlebar/main.js +85 -29
- package/app/mods/bond-titlebar/version.js +3 -0
- package/app/themes/bond-dark.json +5 -5
- package/app/themes/bond-light.json +5 -5
- package/package.json +1 -1
- package/runner/Dockerfile +16 -2
- package/runner/SPIKE-BOND.md +6 -2
- package/runner/entrypoint.sh +16 -0
- package/runner/setup.sh +439 -8
- package/runner/versions.env +32 -1
- package/scripts/app-install.ts +322 -27
- package/src/cli.ts +562 -21
- package/src/config.ts +15 -3
- package/src/core/agy-login.ts +683 -0
- package/src/core/delivery.ts +125 -6
- package/src/core/doctor.ts +748 -0
- package/src/core/hub-session.ts +108 -91
- package/src/core/hub.ts +40 -8
- package/src/core/orchestrator.ts +1481 -187
- package/src/core/paths.ts +107 -0
- package/src/core/permissions.ts +143 -0
- package/src/core/pr-source.ts +147 -0
- package/src/core/repo-host.ts +60 -0
- package/src/core/service-windows.ts +180 -0
- package/src/core/service.ts +861 -0
- package/src/core/setup-install.ts +1380 -0
- package/src/core/setup.ts +62 -1
- package/src/core/watchdog.ts +6 -6
- package/src/db/database.ts +54 -7
- package/src/db/settings-repo.ts +332 -7
- package/src/db/ticket-repo.ts +73 -25
- package/src/index.ts +4 -4
- package/src/runner/azure-devops-client.ts +273 -0
- package/src/runner/docker-client.ts +93 -9
- package/src/runner/github-client.ts +148 -3
- package/src/runner/hc-client.ts +33 -5
- package/src/runner/image-builder.ts +123 -5
- package/src/runner/jira-client.ts +368 -0
- package/src/runner/tool-catalog.ts +84 -0
- package/src/server/app.ts +467 -8
- package/src/types.ts +140 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "place": "none", "title": "bond · ajustes" }
|
|
1
|
+
{ "place": "none", "title": "bond · ajustes", "overlay": { "kind": "dialog", "width": 820, "height": 0.82 } }
|
|
@@ -64,6 +64,41 @@ export async function health() {
|
|
|
64
64
|
return true;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/** Forget the cached token, so the next call reads its file again (Ajustes «Reconectar»). */
|
|
68
|
+
export function resetToken() {
|
|
69
|
+
token = null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Why the mods can or cannot talk to the orchestrator, for Ajustes: { state, detail }.
|
|
74
|
+
* state: "ok", "down" (no /health), "no-token" (no token file), "bad-token" (the file's
|
|
75
|
+
* token is not this orchestrator's: usually another --data-dir) or "error".
|
|
76
|
+
*/
|
|
77
|
+
export async function diagnose() {
|
|
78
|
+
try {
|
|
79
|
+
await health();
|
|
80
|
+
} catch {
|
|
81
|
+
return { state: "down", detail: `${CONFIG.api} no responde` };
|
|
82
|
+
}
|
|
83
|
+
token = null;
|
|
84
|
+
try {
|
|
85
|
+
await api("/setup");
|
|
86
|
+
return { state: "ok", detail: CONFIG.api };
|
|
87
|
+
} catch (e) {
|
|
88
|
+
const msg = String(e?.message ?? e);
|
|
89
|
+
if (msg.startsWith("no hay token")) return { state: "no-token", detail: msg };
|
|
90
|
+
if (/unauthorized|HTTP 401/i.test(msg)) {
|
|
91
|
+
return { state: "bad-token", detail: `el token de ${tokenPath()} no es el de este orquestador (¿arrancado con otro --data-dir?)` };
|
|
92
|
+
}
|
|
93
|
+
return { state: "error", detail: msg };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The command that starts this orchestrator (written by app:install), or a default. */
|
|
98
|
+
export function startCommand() {
|
|
99
|
+
return Array.isArray(CONFIG.start) && CONFIG.start.length ? CONFIG.start : ["bond-app", "start"];
|
|
100
|
+
}
|
|
101
|
+
|
|
67
102
|
/** The API's base URL, for messages. */
|
|
68
103
|
export function apiUrl() {
|
|
69
104
|
return CONFIG.api;
|
|
@@ -18,6 +18,7 @@ export const UI = {
|
|
|
18
18
|
button: 26,
|
|
19
19
|
folded: 34, // width of a folded (empty) board column
|
|
20
20
|
columnWidth: 270, // fixed column width
|
|
21
|
+
columnMax: 560, // an open board column is never wider than this
|
|
21
22
|
fontFamily: "JetBrains Mono",
|
|
22
23
|
fontSans: "Geist",
|
|
23
24
|
};
|
|
@@ -26,7 +27,7 @@ export const UI = {
|
|
|
26
27
|
const STATE_FALLBACK = {
|
|
27
28
|
ready: "idle",
|
|
28
29
|
running: "working",
|
|
29
|
-
waiting: "
|
|
30
|
+
waiting: "working",
|
|
30
31
|
finished: "done",
|
|
31
32
|
error: "blocked",
|
|
32
33
|
verifying: "accent",
|
|
@@ -41,9 +42,24 @@ const STATE_THEME_KEY = {
|
|
|
41
42
|
error: "bond_error",
|
|
42
43
|
};
|
|
43
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Running is green and waiting yellow (2026-11-23: less red on the board). A theme without
|
|
47
|
+
* bond_* colors falls back to herdr's palette, which has neither (its `working` is yellow,
|
|
48
|
+
* `blocked` red): these get fixed hues, [light, dark], AA-safe as fills on either.
|
|
49
|
+
*/
|
|
50
|
+
const STATE_HEX = {
|
|
51
|
+
running: ["#047857", "#34d399"],
|
|
52
|
+
waiting: ["#a16207", "#facc15"],
|
|
53
|
+
blocked: ["#a16207", "#facc15"],
|
|
54
|
+
};
|
|
55
|
+
|
|
44
56
|
/** The color of a board column or state (`ready`, `running`, ...) in theme `t`. */
|
|
45
57
|
export function stateColor(t, id) {
|
|
46
|
-
|
|
58
|
+
const own = t[`bond_${id}`] ?? t[STATE_THEME_KEY[id]];
|
|
59
|
+
if (own) return own;
|
|
60
|
+
const hex = STATE_HEX[id];
|
|
61
|
+
if (hex) return hex[isDark(t) ? 1 : 0];
|
|
62
|
+
return t[STATE_FALLBACK[id]] ?? t.accent;
|
|
47
63
|
}
|
|
48
64
|
|
|
49
65
|
/** Relative luminance of `#rrggbb[aa]` (WCAG), 0..1. */
|
|
@@ -71,3 +87,38 @@ export function logo(t) {
|
|
|
71
87
|
wordmarkRatio: 398 / 108,
|
|
72
88
|
};
|
|
73
89
|
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Ajustes as a modal dialog (plan bond-app-ajustes-imagen P1): what every bond-* mod passes
|
|
93
|
+
* to herdr's openOverlay to open it. `section` picks the section (orchestrator, agents,
|
|
94
|
+
* github, image, advanced); `{ view: "wizard", step }` opens the first-launch walk.
|
|
95
|
+
*/
|
|
96
|
+
export function settingsOverlay(props = {}) {
|
|
97
|
+
return { mod: "bond-settings", kind: "dialog", modal: true, width: 820, height: 0.7, props: { view: "settings", ...props } };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* «Nuevo ticket» (Qué · Dónde · Quién): every button that opens it passes this, so the
|
|
102
|
+
* dialog always has its height (its body scrolls; without a height it collapses).
|
|
103
|
+
*/
|
|
104
|
+
export function createOverlay() {
|
|
105
|
+
return { mod: "bond-board", kind: "dialog", modal: true, width: 820, height: 0.92, props: { view: "create" } };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Fixed hues bond uses outside the state palette (host badges, the favorite star, the
|
|
110
|
+
* theme button), [light, dark]: readable on either theme, never a hex that only suits one.
|
|
111
|
+
*/
|
|
112
|
+
const MARK_HEX = {
|
|
113
|
+
github: ["#6d28d9", "#a78bfa"],
|
|
114
|
+
azure: ["#0067b8", "#3b9cff"],
|
|
115
|
+
jira: ["#0055cc", "#579dff"],
|
|
116
|
+
star: ["#b45309", "#f5b301"],
|
|
117
|
+
sun: ["#b45309", "#f59e0b"],
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/** The color of mark `key` (github, azure, jira, star, sun) in theme `t`. */
|
|
121
|
+
export function markColor(t, key) {
|
|
122
|
+
const hex = MARK_HEX[key];
|
|
123
|
+
return hex ? hex[isDark(t) ? 1 : 0] : t.accent;
|
|
124
|
+
}
|
|
@@ -9,4 +9,8 @@ export const CONFIG = {
|
|
|
9
9
|
// registrando cost_usd, pero la UI no lo muestra hasta que una configuración
|
|
10
10
|
// en Ajustes lo active. Entonces esto será el valor de esa configuración.
|
|
11
11
|
costs: false,
|
|
12
|
+
// How to start the orchestrator (Ajustes «Arrancar orquestador»): app:install writes the
|
|
13
|
+
// node and bin/bond-app.js it was installed from, with the port and data dir. null:
|
|
14
|
+
// `bond-app start`.
|
|
15
|
+
start: null,
|
|
12
16
|
};
|
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
// bond-status: the bond layout's status bar (P6 criterion 4). At a glance: whether the
|
|
2
|
-
// orchestrator's API answers, the GitHub credential (D20),
|
|
3
|
-
// against the minimums bond-app is tested
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
2
|
+
// orchestrator's API answers, the GitHub credential (D20), Azure DevOps and Jira when they
|
|
3
|
+
// are configured, herdr-app's and hc's versions against the minimums bond-app is tested
|
|
4
|
+
// with (and a newer herdr-app waiting for a restart), and how many runs are active.
|
|
5
|
+
// Clicking the API, GitHub, Azure or Jira item opens its section of Ajustes.
|
|
6
|
+
// It only reads: GET /health (no token), /settings/{github,azure-devops,jira} and /runs,
|
|
7
|
+
// every 5 s. A token problem (no token file, a rotated token: 401) is told apart from the
|
|
8
|
+
// API being down.
|
|
7
9
|
import { View, div } from "gpui-kit";
|
|
8
10
|
import { h_flex } from "gpui-base";
|
|
9
|
-
import { theme, updates, run } from "herdr";
|
|
11
|
+
import { theme, updates, openOverlay, run, exec, checking } from "herdr";
|
|
10
12
|
import { api, health } from "./api.js";
|
|
11
|
-
import { UI } from "./brand.js";
|
|
13
|
+
import { UI, settingsOverlay, stateColor } from "./brand.js";
|
|
12
14
|
import { statusSummary, compareVersions, MIN_HERDR_APP, MIN_HC, POLL_MS } from "./model.js";
|
|
13
15
|
|
|
14
16
|
export default class BondStatus extends View {
|
|
15
17
|
init(_props, cx) {
|
|
16
18
|
this.state = { api: null, github: null, runs: null }; // null: not known yet
|
|
19
|
+
this.appInstalled = null; // herdr-app on disk, when newer than the running window
|
|
20
|
+
if (!checking()) {
|
|
21
|
+
cx.spawn(async (cx) => {
|
|
22
|
+
try {
|
|
23
|
+
const r = await exec("herdr-app", ["--version"], { on: null, timeout: 5000 });
|
|
24
|
+
this.appInstalled = /(\d+\.\d+\.\d+)/.exec(String(r?.stdout ?? ""))?.[1] ?? null;
|
|
25
|
+
cx.notify();
|
|
26
|
+
} catch {}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
17
29
|
this.refresh(cx);
|
|
18
30
|
cx.timer.every(POLL_MS, (cx) => this.refresh(cx));
|
|
19
31
|
}
|
|
@@ -27,9 +39,14 @@ export default class BondStatus extends View {
|
|
|
27
39
|
await health();
|
|
28
40
|
next.api = { ok: true };
|
|
29
41
|
try {
|
|
30
|
-
const [github, runs] = await Promise.all([
|
|
42
|
+
const [github, runs, azure, jira] = await Promise.all([
|
|
43
|
+
api("/settings/github"), api("/runs"),
|
|
44
|
+
api("/settings/azure-devops").catch(() => null), api("/settings/jira").catch(() => null),
|
|
45
|
+
]);
|
|
31
46
|
next.github = github ?? { configured: false };
|
|
32
47
|
next.runs = runs ?? [];
|
|
48
|
+
next.azure = azure;
|
|
49
|
+
next.jira = jira;
|
|
33
50
|
} catch (e) {
|
|
34
51
|
next.error = String(e?.message ?? e);
|
|
35
52
|
}
|
|
@@ -43,8 +60,8 @@ export default class BondStatus extends View {
|
|
|
43
60
|
});
|
|
44
61
|
}
|
|
45
62
|
|
|
46
|
-
openSettings() {
|
|
47
|
-
|
|
63
|
+
openSettings(section) {
|
|
64
|
+
openOverlay(settingsOverlay(section ? { section } : {}));
|
|
48
65
|
}
|
|
49
66
|
|
|
50
67
|
item(id, dot, text, color, onClick) {
|
|
@@ -59,18 +76,23 @@ export default class BondStatus extends View {
|
|
|
59
76
|
render() {
|
|
60
77
|
const t = theme();
|
|
61
78
|
const u = updates();
|
|
62
|
-
const s = statusSummary(this.state, { app: u?.app?.version ?? null, core: u?.core?.version ?? null });
|
|
63
|
-
const tone = { ok: t
|
|
79
|
+
const s = statusSummary(this.state, { app: u?.app?.version ?? null, core: u?.core?.version ?? null, appReady: u?.app?.ready ?? null, appInstalled: this.appInstalled });
|
|
80
|
+
const tone = { ok: stateColor(t, "running"), warn: t.bond_blocked ?? t.blocked, bad: t.blocked, unknown: t.dim };
|
|
64
81
|
const version = (name, have, min) => {
|
|
65
82
|
const ok = have && compareVersions(have, min) >= 0;
|
|
66
83
|
return this.item(`st-${name}`, null, `${name} ${have ?? "?"}${ok ? "" : ` (mín. ${min})`}`, ok ? t.dim : t.blocked);
|
|
67
84
|
};
|
|
68
85
|
return h_flex().id("bond-status").size_full().px(8).gap(4).items_center().bg(t.chrome)
|
|
69
86
|
.border_t(1).border_color(t.border).text_size(UI.text.small).font_family("JetBrains Mono").text_color(t.muted)
|
|
70
|
-
.child(this.item("st-api", tone[s.api.tone], s.api.text, null, () => this.openSettings()))
|
|
71
|
-
.child(this.item("st-github", tone[s.github.tone], s.github.text, null, () => this.openSettings()))
|
|
72
|
-
.child(this.item("st-
|
|
87
|
+
.child(this.item("st-api", tone[s.api.tone], s.api.text, null, () => this.openSettings("orchestrator")))
|
|
88
|
+
.child(this.item("st-github", tone[s.github.tone], s.github.text, null, () => this.openSettings("github")))
|
|
89
|
+
.when(Boolean(s.azure), (el) => el.child(this.item("st-azure", tone[s.azure.tone], s.azure.text, null, () => this.openSettings("azure"))))
|
|
90
|
+
.when(Boolean(s.jira), (el) => el.child(this.item("st-jira", tone[s.jira.tone], s.jira.text, null, () => this.openSettings("jira"))))
|
|
91
|
+
.child(this.item("st-runs", s.runs.active > 0 ? stateColor(t, "running") : t.dim, s.runs.text, null, null))
|
|
73
92
|
.child(div().flex_1())
|
|
93
|
+
.when(Boolean(s.versions.appNewer), (el) => el.child(this.item("st-app-update", t.accent,
|
|
94
|
+
s.versions.appRestart ? `herdr-app ${s.versions.appNewer}: reiniciar` : `herdr-app ${s.versions.appNewer} instalado: reinicia la app`,
|
|
95
|
+
t.accent, s.versions.appRestart ? () => run("app.update") : null)))
|
|
74
96
|
.child(version("herdr-app", s.versions.app, MIN_HERDR_APP))
|
|
75
97
|
.child(version("hc", s.versions.core, MIN_HC));
|
|
76
98
|
}
|
|
@@ -66,10 +66,28 @@ export function statusSummary(state, versions) {
|
|
|
66
66
|
const runsItem = runs === null
|
|
67
67
|
? { active: 0, text: "runs: ?" }
|
|
68
68
|
: { active, text: active === 1 ? "1 run activo" : `${active} runs activos` };
|
|
69
|
+
// Azure DevOps and Jira are optional: an item only when configured (else nothing to say).
|
|
70
|
+
const azure = api?.ok && state?.azure?.configured
|
|
71
|
+
? { tone: "ok", text: `Azure: ${String(state.azure.org_url ?? "").split("/").filter(Boolean).pop() || "conectado"}` }
|
|
72
|
+
: null;
|
|
73
|
+
const jira = api?.ok && state?.jira?.configured
|
|
74
|
+
? { tone: "ok", text: `Jira: ${String(state.jira.site ?? "").replace(/^https:\/\//, "").replace(/\.atlassian\.net\/?$/, "") || "conectado"}` }
|
|
75
|
+
: null;
|
|
76
|
+
// A newer herdr-app waiting: downloaded by the app (`ready`, a click restarts into it) or
|
|
77
|
+
// installed on disk while this window still runs the old one (restart it by hand).
|
|
78
|
+
const appNewer = [versions?.appReady, versions?.appInstalled]
|
|
79
|
+
.filter((v) => v && versions?.app && compareVersions(v, versions.app) > 0)[0] ?? null;
|
|
69
80
|
return {
|
|
70
81
|
api: apiItem,
|
|
71
82
|
github: githubItem,
|
|
83
|
+
azure,
|
|
84
|
+
jira,
|
|
72
85
|
runs: runsItem,
|
|
73
|
-
versions: {
|
|
86
|
+
versions: {
|
|
87
|
+
app: versions?.app ?? null,
|
|
88
|
+
core: versions?.core ?? null,
|
|
89
|
+
appNewer,
|
|
90
|
+
appRestart: Boolean(appNewer && appNewer === versions?.appReady),
|
|
91
|
+
},
|
|
74
92
|
};
|
|
75
93
|
}
|
|
@@ -18,6 +18,7 @@ export const UI = {
|
|
|
18
18
|
button: 26,
|
|
19
19
|
folded: 34, // width of a folded (empty) board column
|
|
20
20
|
columnWidth: 270, // fixed column width
|
|
21
|
+
columnMax: 560, // an open board column is never wider than this
|
|
21
22
|
fontFamily: "JetBrains Mono",
|
|
22
23
|
fontSans: "Geist",
|
|
23
24
|
};
|
|
@@ -26,7 +27,7 @@ export const UI = {
|
|
|
26
27
|
const STATE_FALLBACK = {
|
|
27
28
|
ready: "idle",
|
|
28
29
|
running: "working",
|
|
29
|
-
waiting: "
|
|
30
|
+
waiting: "working",
|
|
30
31
|
finished: "done",
|
|
31
32
|
error: "blocked",
|
|
32
33
|
verifying: "accent",
|
|
@@ -41,9 +42,24 @@ const STATE_THEME_KEY = {
|
|
|
41
42
|
error: "bond_error",
|
|
42
43
|
};
|
|
43
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Running is green and waiting yellow (2026-11-23: less red on the board). A theme without
|
|
47
|
+
* bond_* colors falls back to herdr's palette, which has neither (its `working` is yellow,
|
|
48
|
+
* `blocked` red): these get fixed hues, [light, dark], AA-safe as fills on either.
|
|
49
|
+
*/
|
|
50
|
+
const STATE_HEX = {
|
|
51
|
+
running: ["#047857", "#34d399"],
|
|
52
|
+
waiting: ["#a16207", "#facc15"],
|
|
53
|
+
blocked: ["#a16207", "#facc15"],
|
|
54
|
+
};
|
|
55
|
+
|
|
44
56
|
/** The color of a board column or state (`ready`, `running`, ...) in theme `t`. */
|
|
45
57
|
export function stateColor(t, id) {
|
|
46
|
-
|
|
58
|
+
const own = t[`bond_${id}`] ?? t[STATE_THEME_KEY[id]];
|
|
59
|
+
if (own) return own;
|
|
60
|
+
const hex = STATE_HEX[id];
|
|
61
|
+
if (hex) return hex[isDark(t) ? 1 : 0];
|
|
62
|
+
return t[STATE_FALLBACK[id]] ?? t.accent;
|
|
47
63
|
}
|
|
48
64
|
|
|
49
65
|
/** Relative luminance of `#rrggbb[aa]` (WCAG), 0..1. */
|
|
@@ -71,3 +87,38 @@ export function logo(t) {
|
|
|
71
87
|
wordmarkRatio: 398 / 108,
|
|
72
88
|
};
|
|
73
89
|
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Ajustes as a modal dialog (plan bond-app-ajustes-imagen P1): what every bond-* mod passes
|
|
93
|
+
* to herdr's openOverlay to open it. `section` picks the section (orchestrator, agents,
|
|
94
|
+
* github, image, advanced); `{ view: "wizard", step }` opens the first-launch walk.
|
|
95
|
+
*/
|
|
96
|
+
export function settingsOverlay(props = {}) {
|
|
97
|
+
return { mod: "bond-settings", kind: "dialog", modal: true, width: 820, height: 0.7, props: { view: "settings", ...props } };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* «Nuevo ticket» (Qué · Dónde · Quién): every button that opens it passes this, so the
|
|
102
|
+
* dialog always has its height (its body scrolls; without a height it collapses).
|
|
103
|
+
*/
|
|
104
|
+
export function createOverlay() {
|
|
105
|
+
return { mod: "bond-board", kind: "dialog", modal: true, width: 820, height: 0.92, props: { view: "create" } };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Fixed hues bond uses outside the state palette (host badges, the favorite star, the
|
|
110
|
+
* theme button), [light, dark]: readable on either theme, never a hex that only suits one.
|
|
111
|
+
*/
|
|
112
|
+
const MARK_HEX = {
|
|
113
|
+
github: ["#6d28d9", "#a78bfa"],
|
|
114
|
+
azure: ["#0067b8", "#3b9cff"],
|
|
115
|
+
jira: ["#0055cc", "#579dff"],
|
|
116
|
+
star: ["#b45309", "#f5b301"],
|
|
117
|
+
sun: ["#b45309", "#f59e0b"],
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/** The color of mark `key` (github, azure, jira, star, sun) in theme `t`. */
|
|
121
|
+
export function markColor(t, key) {
|
|
122
|
+
const hex = MARK_HEX[key];
|
|
123
|
+
return hex ? hex[isDark(t) ? 1 : 0] : t.accent;
|
|
124
|
+
}
|
|
@@ -4,17 +4,37 @@
|
|
|
4
4
|
// Key differences from herdr's stock tabs:
|
|
5
5
|
// 1. Never draws window buttons (minimize, maximize, close): window buttons belong
|
|
6
6
|
// only to bond-titlebar.
|
|
7
|
-
// 2. Does not allow closing run terminal tabs (
|
|
7
|
+
// 2. Does not allow closing run terminal tabs (tab.close ends their terminals: it would kill
|
|
8
|
+
// the agent). In a run's space the × hides instead: terminal.park, the agent keeps running,
|
|
9
|
+
// and the Agents panel brings it back with «Sincronizar Terminal» (plan
|
|
10
|
+
// bond-app-pestanas-paneles, E4).
|
|
8
11
|
// 3. Right-hand button toggles/collapses the console view ('main' block) using
|
|
9
12
|
// layout.hide / layout.show, without ever killing the run terminal or pane.
|
|
10
13
|
// 4. Clicking a tab while the console is collapsed restores it automatically.
|
|
11
14
|
|
|
12
15
|
import { View, div, svg, image } from "gpui-kit";
|
|
13
16
|
import { h_flex, ScrollHandle } from "gpui-base";
|
|
14
|
-
import { spaces, panes, run, openOverlay, theme, layout } from "herdr";
|
|
17
|
+
import { spaces, panes, terminals, run, openOverlay, theme, layout, shared, setShared } from "herdr";
|
|
15
18
|
import { UI } from "./brand.js";
|
|
16
19
|
|
|
17
20
|
const ICONS = "mods/bond-tabs";
|
|
21
|
+
// Shared with bond-agents (model.js HIDDEN_KEY): addresses hidden until «Sincronizar».
|
|
22
|
+
const HIDDEN_KEY = "bond.agents.hidden";
|
|
23
|
+
|
|
24
|
+
/** Hide a run tab's terminals: park them (they keep running) and remember them as hidden. */
|
|
25
|
+
function hideTab(tabId) {
|
|
26
|
+
const addrs = (panes() ?? []).filter((p) => p.tab === tabId && p.terminal && p.terminal.includes("/")).map((p) => p.terminal);
|
|
27
|
+
if (!addrs.length) return;
|
|
28
|
+
const cur = shared(HIDDEN_KEY);
|
|
29
|
+
const set = new Set(Array.isArray(cur) ? cur : []);
|
|
30
|
+
for (const a of addrs) set.add(a);
|
|
31
|
+
setShared(HIDDEN_KEY, [...set].sort());
|
|
32
|
+
for (const a of addrs) {
|
|
33
|
+
try {
|
|
34
|
+
run("terminal.park", { terminal: a });
|
|
35
|
+
} catch {}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
18
38
|
|
|
19
39
|
function findNode(node, id) {
|
|
20
40
|
if (!node || typeof node !== "object") return null;
|
|
@@ -86,7 +106,15 @@ export default class BondTabs extends View {
|
|
|
86
106
|
const program =
|
|
87
107
|
allPanes.find((p) => p.tab === c.id && p.program?.agent)?.program ??
|
|
88
108
|
allPanes.find((p) => p.tab === c.id)?.program;
|
|
89
|
-
|
|
109
|
+
// Unnamed (herdr shows its position, «1»): the agent and its terminal, as the pane
|
|
110
|
+
// header says it («gru · pi»), else the program.
|
|
111
|
+
const unnamed = c.named === false || /^tb\d+$/.test(c.name) || /^\d+$/.test(c.name);
|
|
112
|
+
const term = allPanes.find((p) => p.tab === c.id && p.program?.agent)?.terminal ?? allPanes.find((p) => p.tab === c.id)?.terminal ?? "";
|
|
113
|
+
const termName = String((terminals() ?? []).find((x) => x.address === term)?.name ?? "").trim();
|
|
114
|
+
const progName = program?.name ?? "Terminal";
|
|
115
|
+
const name = !unnamed ? c.name
|
|
116
|
+
: termName && termName !== progName && !/^t\d+$/.test(termName) && termName !== "agent"
|
|
117
|
+
? `${termName} · ${progName}` : progName;
|
|
90
118
|
|
|
91
119
|
return h_flex()
|
|
92
120
|
.id(`tab-${c.id}`)
|
|
@@ -169,6 +197,20 @@ export default class BondTabs extends View {
|
|
|
169
197
|
.when(c.status === "blocked" || c.status === "done", (el) =>
|
|
170
198
|
el.child(div().size(6).rounded(3).bg(t[c.status]))
|
|
171
199
|
)
|
|
200
|
+
.when(c.active && isRun, (el) =>
|
|
201
|
+
el.child(
|
|
202
|
+
div()
|
|
203
|
+
.id(`hide-${c.id}`)
|
|
204
|
+
.text_color(t.dim)
|
|
205
|
+
.hover((s) => s.text_color(t.foreground))
|
|
206
|
+
.on_mouse_down("left", stop)
|
|
207
|
+
.on_click((_e, cx) => {
|
|
208
|
+
cx.stop_propagation();
|
|
209
|
+
hideTab(c.id);
|
|
210
|
+
})
|
|
211
|
+
.child(svg(`${ICONS}/close.svg`).size(12))
|
|
212
|
+
)
|
|
213
|
+
)
|
|
172
214
|
.when(c.active && !isRun, (el) =>
|
|
173
215
|
el.child(
|
|
174
216
|
div()
|
|
@@ -18,6 +18,7 @@ export const UI = {
|
|
|
18
18
|
button: 26,
|
|
19
19
|
folded: 34, // width of a folded (empty) board column
|
|
20
20
|
columnWidth: 270, // fixed column width
|
|
21
|
+
columnMax: 560, // an open board column is never wider than this
|
|
21
22
|
fontFamily: "JetBrains Mono",
|
|
22
23
|
fontSans: "Geist",
|
|
23
24
|
};
|
|
@@ -26,7 +27,7 @@ export const UI = {
|
|
|
26
27
|
const STATE_FALLBACK = {
|
|
27
28
|
ready: "idle",
|
|
28
29
|
running: "working",
|
|
29
|
-
waiting: "
|
|
30
|
+
waiting: "working",
|
|
30
31
|
finished: "done",
|
|
31
32
|
error: "blocked",
|
|
32
33
|
verifying: "accent",
|
|
@@ -41,9 +42,24 @@ const STATE_THEME_KEY = {
|
|
|
41
42
|
error: "bond_error",
|
|
42
43
|
};
|
|
43
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Running is green and waiting yellow (2026-11-23: less red on the board). A theme without
|
|
47
|
+
* bond_* colors falls back to herdr's palette, which has neither (its `working` is yellow,
|
|
48
|
+
* `blocked` red): these get fixed hues, [light, dark], AA-safe as fills on either.
|
|
49
|
+
*/
|
|
50
|
+
const STATE_HEX = {
|
|
51
|
+
running: ["#047857", "#34d399"],
|
|
52
|
+
waiting: ["#a16207", "#facc15"],
|
|
53
|
+
blocked: ["#a16207", "#facc15"],
|
|
54
|
+
};
|
|
55
|
+
|
|
44
56
|
/** The color of a board column or state (`ready`, `running`, ...) in theme `t`. */
|
|
45
57
|
export function stateColor(t, id) {
|
|
46
|
-
|
|
58
|
+
const own = t[`bond_${id}`] ?? t[STATE_THEME_KEY[id]];
|
|
59
|
+
if (own) return own;
|
|
60
|
+
const hex = STATE_HEX[id];
|
|
61
|
+
if (hex) return hex[isDark(t) ? 1 : 0];
|
|
62
|
+
return t[STATE_FALLBACK[id]] ?? t.accent;
|
|
47
63
|
}
|
|
48
64
|
|
|
49
65
|
/** Relative luminance of `#rrggbb[aa]` (WCAG), 0..1. */
|
|
@@ -71,3 +87,38 @@ export function logo(t) {
|
|
|
71
87
|
wordmarkRatio: 398 / 108,
|
|
72
88
|
};
|
|
73
89
|
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Ajustes as a modal dialog (plan bond-app-ajustes-imagen P1): what every bond-* mod passes
|
|
93
|
+
* to herdr's openOverlay to open it. `section` picks the section (orchestrator, agents,
|
|
94
|
+
* github, image, advanced); `{ view: "wizard", step }` opens the first-launch walk.
|
|
95
|
+
*/
|
|
96
|
+
export function settingsOverlay(props = {}) {
|
|
97
|
+
return { mod: "bond-settings", kind: "dialog", modal: true, width: 820, height: 0.7, props: { view: "settings", ...props } };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* «Nuevo ticket» (Qué · Dónde · Quién): every button that opens it passes this, so the
|
|
102
|
+
* dialog always has its height (its body scrolls; without a height it collapses).
|
|
103
|
+
*/
|
|
104
|
+
export function createOverlay() {
|
|
105
|
+
return { mod: "bond-board", kind: "dialog", modal: true, width: 820, height: 0.92, props: { view: "create" } };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Fixed hues bond uses outside the state palette (host badges, the favorite star, the
|
|
110
|
+
* theme button), [light, dark]: readable on either theme, never a hex that only suits one.
|
|
111
|
+
*/
|
|
112
|
+
const MARK_HEX = {
|
|
113
|
+
github: ["#6d28d9", "#a78bfa"],
|
|
114
|
+
azure: ["#0067b8", "#3b9cff"],
|
|
115
|
+
jira: ["#0055cc", "#579dff"],
|
|
116
|
+
star: ["#b45309", "#f5b301"],
|
|
117
|
+
sun: ["#b45309", "#f59e0b"],
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/** The color of mark `key` (github, azure, jira, star, sun) in theme `t`. */
|
|
121
|
+
export function markColor(t, key) {
|
|
122
|
+
const hex = MARK_HEX[key];
|
|
123
|
+
return hex ? hex[isDark(t) ? 1 : 0] : t.accent;
|
|
124
|
+
}
|