@h-rig/cli 0.0.6-alpha.83 → 0.0.6-alpha.84
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/dist/bin/rig.js +22085 -14618
- package/dist/src/app/board.js +155 -28
- package/dist/src/app-opentui/adapters/doctor.d.ts +0 -2
- package/dist/src/app-opentui/adapters/doctor.js +1 -25
- package/dist/src/app-opentui/adapters/family.d.ts +62 -0
- package/dist/src/app-opentui/adapters/family.js +14305 -0
- package/dist/src/app-opentui/adapters/fleet.d.ts +0 -2
- package/dist/src/app-opentui/adapters/fleet.js +6 -40
- package/dist/src/app-opentui/adapters/inbox.d.ts +12 -2
- package/dist/src/app-opentui/adapters/inbox.js +54 -59
- package/dist/src/app-opentui/adapters/init.d.ts +0 -2
- package/dist/src/app-opentui/adapters/init.js +0 -26
- package/dist/src/app-opentui/adapters/inspect.d.ts +52 -0
- package/dist/src/app-opentui/adapters/inspect.js +1024 -0
- package/dist/src/app-opentui/adapters/pi-attach.d.ts +15 -6
- package/dist/src/app-opentui/adapters/pi-attach.js +348 -93
- package/dist/src/app-opentui/adapters/pi.d.ts +23 -0
- package/dist/src/app-opentui/adapters/pi.js +363 -0
- package/dist/src/app-opentui/adapters/plugin.d.ts +84 -0
- package/dist/src/app-opentui/adapters/plugin.js +544 -0
- package/dist/src/app-opentui/adapters/repo.d.ts +37 -0
- package/dist/src/app-opentui/adapters/repo.js +186 -0
- package/dist/src/app-opentui/adapters/run-detail.d.ts +9 -2
- package/dist/src/app-opentui/adapters/run-detail.js +97 -44
- package/dist/src/app-opentui/adapters/server.d.ts +10 -2
- package/dist/src/app-opentui/adapters/server.js +96 -27
- package/dist/src/app-opentui/adapters/tasks.d.ts +0 -2
- package/dist/src/app-opentui/adapters/tasks.js +437 -105
- package/dist/src/app-opentui/adapters/workspace.d.ts +49 -0
- package/dist/src/app-opentui/adapters/workspace.js +333 -0
- package/dist/src/app-opentui/autocomplete.d.ts +20 -0
- package/dist/src/app-opentui/autocomplete.js +576 -0
- package/dist/src/app-opentui/bootstrap.js +24296 -16919
- package/dist/src/app-opentui/command-palette.d.ts +3 -0
- package/dist/src/app-opentui/command-palette.js +1010 -0
- package/dist/src/app-opentui/drone.js +8 -6
- package/dist/src/app-opentui/fleet-stats.d.ts +32 -0
- package/dist/src/app-opentui/fleet-stats.js +114 -0
- package/dist/src/app-opentui/index.js +3438 -1724
- package/dist/src/app-opentui/intent.js +71 -48
- package/dist/src/app-opentui/keymap.d.ts +6 -5
- package/dist/src/app-opentui/keymap.js +1064 -23
- package/dist/src/app-opentui/layout.d.ts +7 -0
- package/dist/src/app-opentui/layout.js +13 -6
- package/dist/src/app-opentui/list-search.d.ts +24 -0
- package/dist/src/app-opentui/list-search.js +88 -1
- package/dist/src/app-opentui/pi-host-child.js +33 -1
- package/dist/src/app-opentui/pi-pty-host.d.ts +5 -0
- package/dist/src/app-opentui/pi-pty-host.js +21 -3
- package/dist/src/app-opentui/react/App.d.ts +9 -0
- package/dist/src/app-opentui/react/App.js +5144 -0
- package/dist/src/app-opentui/react/Backdrop.d.ts +5 -0
- package/dist/src/app-opentui/react/Backdrop.js +1834 -0
- package/dist/src/app-opentui/react/ChromeHost.d.ts +5 -0
- package/dist/src/app-opentui/react/ChromeHost.js +2942 -0
- package/dist/src/app-opentui/react/SceneFrameView.d.ts +7 -0
- package/dist/src/app-opentui/react/SceneFrameView.js +529 -0
- package/dist/src/app-opentui/react/context.d.ts +17 -0
- package/dist/src/app-opentui/react/context.js +37 -0
- package/dist/src/app-opentui/react/launch.d.ts +2 -0
- package/dist/src/app-opentui/react/launch.js +5743 -0
- package/dist/src/app-opentui/react/nav.d.ts +18 -0
- package/dist/src/app-opentui/react/nav.js +54 -0
- package/dist/src/app-opentui/react/scroll.d.ts +12 -0
- package/dist/src/app-opentui/react/scroll.js +21 -0
- package/dist/src/app-opentui/react/syntax.d.ts +2 -0
- package/dist/src/app-opentui/react/syntax.js +64 -0
- package/dist/src/app-opentui/registry.js +19923 -5151
- package/dist/src/app-opentui/render/constants.d.ts +31 -0
- package/dist/src/app-opentui/render/constants.js +66 -0
- package/dist/src/app-opentui/render/graphics.d.ts +2 -1
- package/dist/src/app-opentui/render/graphics.js +106 -39
- package/dist/src/app-opentui/render/image-visual-layer-worker.js +108 -20
- package/dist/src/app-opentui/render/image-visual-layer.d.ts +7 -0
- package/dist/src/app-opentui/render/image-visual-layer.js +109 -20
- package/dist/src/app-opentui/render/native-host.d.ts +37 -0
- package/dist/src/app-opentui/render/native-host.js +179 -0
- package/dist/src/app-opentui/render/panels.js +18 -11
- package/dist/src/app-opentui/render/preloader.js +8 -6
- package/dist/src/app-opentui/render/scene.d.ts +50 -1
- package/dist/src/app-opentui/render/scene.js +183 -6
- package/dist/src/app-opentui/render/text.d.ts +7 -1
- package/dist/src/app-opentui/render/text.js +10 -7
- package/dist/src/app-opentui/render/type-bar.js +69 -30
- package/dist/src/app-opentui/runtime.d.ts +44 -1
- package/dist/src/app-opentui/runtime.js +3231 -1363
- package/dist/src/app-opentui/scenes/command.js +20 -6
- package/dist/src/app-opentui/scenes/doctor.js +176 -11
- package/dist/src/app-opentui/scenes/error.js +20 -10
- package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/agent.js +348 -0
- package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/browser.js +195 -0
- package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/dist.js +243 -0
- package/dist/src/app-opentui/scenes/family-domains/git.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/git.js +195 -0
- package/dist/src/app-opentui/scenes/family-domains/github.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/github.js +274 -0
- package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/harness.js +152 -0
- package/dist/src/app-opentui/scenes/family-domains/index.d.ts +4 -0
- package/dist/src/app-opentui/scenes/family-domains/index.js +1679 -0
- package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +76 -0
- package/dist/src/app-opentui/scenes/family-domains/kit.js +305 -0
- package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/profile.js +212 -0
- package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/queue.js +146 -0
- package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/remote.js +518 -0
- package/dist/src/app-opentui/scenes/family-domains/review.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/review.js +280 -0
- package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/setup.js +267 -0
- package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/stats.js +370 -0
- package/dist/src/app-opentui/scenes/family.d.ts +3 -0
- package/dist/src/app-opentui/scenes/family.js +2144 -0
- package/dist/src/app-opentui/scenes/fleet.js +521 -31
- package/dist/src/app-opentui/scenes/handoff.js +204 -12
- package/dist/src/app-opentui/scenes/help.js +609 -40
- package/dist/src/app-opentui/scenes/inbox.js +278 -17
- package/dist/src/app-opentui/scenes/init.js +84 -39
- package/dist/src/app-opentui/scenes/inspect.d.ts +3 -0
- package/dist/src/app-opentui/scenes/inspect.js +793 -0
- package/dist/src/app-opentui/scenes/main.js +218 -39
- package/dist/src/app-opentui/scenes/pi.d.ts +3 -0
- package/dist/src/app-opentui/scenes/pi.js +508 -0
- package/dist/src/app-opentui/scenes/plugin.d.ts +3 -0
- package/dist/src/app-opentui/scenes/plugin.js +486 -0
- package/dist/src/app-opentui/scenes/repo.d.ts +3 -0
- package/dist/src/app-opentui/scenes/repo.js +424 -0
- package/dist/src/app-opentui/scenes/run-detail.js +333 -20
- package/dist/src/app-opentui/scenes/server.js +181 -15
- package/dist/src/app-opentui/scenes/tasks.js +486 -31
- package/dist/src/app-opentui/scenes/workspace.d.ts +3 -0
- package/dist/src/app-opentui/scenes/workspace.js +426 -0
- package/dist/src/app-opentui/selectable.d.ts +19 -0
- package/dist/src/app-opentui/selectable.js +79 -0
- package/dist/src/app-opentui/state.js +83 -30
- package/dist/src/app-opentui/surface-catalog.d.ts +20 -0
- package/dist/src/app-opentui/surface-catalog.js +540 -0
- package/dist/src/app-opentui/theme.d.ts +28 -6
- package/dist/src/app-opentui/theme.js +61 -8
- package/dist/src/app-opentui/types.d.ts +121 -4
- package/dist/src/commands/_authority-runs.d.ts +1 -1
- package/dist/src/commands/_authority-runs.js +2 -12
- package/dist/src/commands/_help-catalog.js +95 -15
- package/dist/src/commands/_operator-view.js +34 -2
- package/dist/src/commands/_pi-frontend.d.ts +2 -0
- package/dist/src/commands/_pi-frontend.js +34 -0
- package/dist/src/commands/_server-events.d.ts +26 -0
- package/dist/src/commands/_server-events.js +310 -0
- package/dist/src/commands/agent.js +2 -12
- package/dist/src/commands/run.js +34 -2
- package/dist/src/commands/server.js +2 -12
- package/dist/src/commands/stats.js +95 -15
- package/dist/src/commands/task-run-driver.js +2 -12
- package/dist/src/commands/task.js +131 -29
- package/dist/src/commands.js +192 -31
- package/dist/src/index.js +192 -31
- package/package.json +11 -9
|
@@ -14,15 +14,17 @@ var RIG_UI = {
|
|
|
14
14
|
bg: "#070809",
|
|
15
15
|
bg2: "#0b0c0e",
|
|
16
16
|
panel: "#101115",
|
|
17
|
-
panel2: "#
|
|
18
|
-
glass: "#
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
panel2: "#14161b",
|
|
18
|
+
glass: "#1e2230",
|
|
19
|
+
border: "#2a2e3a",
|
|
20
|
+
ink: "#f4f5f8",
|
|
21
|
+
ink2: "#c7c9d3",
|
|
22
|
+
ink3: "#9aa0ae",
|
|
23
|
+
ink4: "#787b86",
|
|
23
24
|
lime: "#ccff4d",
|
|
24
25
|
limeDim: "#a9d63f",
|
|
25
26
|
cyan: "#56d8ff",
|
|
27
|
+
cyanDim: "#3f9fbd",
|
|
26
28
|
red: "#ff5d5d",
|
|
27
29
|
yellow: "#ffd24d",
|
|
28
30
|
magenta: "#ff79b0"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AppRunRecord } from "./adapters/fleet";
|
|
2
|
+
import type { AppState } from "./types";
|
|
3
|
+
export type FleetStats = {
|
|
4
|
+
readonly total: number;
|
|
5
|
+
readonly active: number;
|
|
6
|
+
readonly succeeded: number;
|
|
7
|
+
readonly failed: number;
|
|
8
|
+
readonly byStatus: ReadonlyMap<string, number>;
|
|
9
|
+
/** 0..1 fleet load: share of runs that are actively working. */
|
|
10
|
+
readonly load: number;
|
|
11
|
+
/** Recent activity series (oldest→newest) for a throughput sparkline. */
|
|
12
|
+
readonly sparkline: readonly number[];
|
|
13
|
+
};
|
|
14
|
+
/** Derive fleet telemetry from a run list. Pure — same input, same output. */
|
|
15
|
+
export declare function computeFleetStats(runs: readonly AppRunRecord[]): FleetStats;
|
|
16
|
+
export declare function fleetStatsFromState(state: AppState): FleetStats;
|
|
17
|
+
/** Render a 0..1 series as a unicode sparkline string. */
|
|
18
|
+
export declare function sparklineString(values: readonly number[], width?: number): string;
|
|
19
|
+
/** Render a 0..1 ratio as a partial-block bar of `width` cells. */
|
|
20
|
+
export declare function barString(ratio: number, width: number): string;
|
|
21
|
+
export type StatusSegments = {
|
|
22
|
+
/** Block strings (█…) whose lengths are proportional to each class and sum to width. */
|
|
23
|
+
readonly active: string;
|
|
24
|
+
readonly done: string;
|
|
25
|
+
readonly failed: string;
|
|
26
|
+
readonly other: string;
|
|
27
|
+
};
|
|
28
|
+
/** Proportional status-distribution segments for a full-width stacked bar.
|
|
29
|
+
* Largest-remainder apportionment so the segments always sum to exactly `width`. */
|
|
30
|
+
export declare function statusSegments(stats: FleetStats, width: number): StatusSegments;
|
|
31
|
+
/** A compact one-line summary suitable for a scene header strip. */
|
|
32
|
+
export declare function fleetStatsStrip(stats: FleetStats, sparkWidth?: number): string;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/cli/src/app-opentui/fleet-stats.ts
|
|
3
|
+
var ACTIVE_STATUSES = new Set([
|
|
4
|
+
"running",
|
|
5
|
+
"preparing",
|
|
6
|
+
"created",
|
|
7
|
+
"validating",
|
|
8
|
+
"reviewing",
|
|
9
|
+
"closing-out",
|
|
10
|
+
"stopping",
|
|
11
|
+
"loading"
|
|
12
|
+
]);
|
|
13
|
+
var SPARK_CHARS = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
|
|
14
|
+
var BAR_CHARS = ["\u258F", "\u258E", "\u258D", "\u258C", "\u258B", "\u258A", "\u2589", "\u2588"];
|
|
15
|
+
function normalizeStatus(status) {
|
|
16
|
+
return status.replace(/_/g, "-").toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
function runsFromState(state) {
|
|
19
|
+
const fleet = state.data.fleet;
|
|
20
|
+
if (!fleet || typeof fleet !== "object" || Array.isArray(fleet))
|
|
21
|
+
return [];
|
|
22
|
+
const runs = fleet.runs;
|
|
23
|
+
return Array.isArray(runs) ? runs : [];
|
|
24
|
+
}
|
|
25
|
+
function computeFleetStats(runs) {
|
|
26
|
+
const byStatus = new Map;
|
|
27
|
+
let active = 0;
|
|
28
|
+
let succeeded = 0;
|
|
29
|
+
let failed = 0;
|
|
30
|
+
for (const run of runs) {
|
|
31
|
+
const status = normalizeStatus(run.status ?? "");
|
|
32
|
+
byStatus.set(status, (byStatus.get(status) ?? 0) + 1);
|
|
33
|
+
if (ACTIVE_STATUSES.has(status))
|
|
34
|
+
active += 1;
|
|
35
|
+
else if (status === "success" || status === "completed" || status === "merged")
|
|
36
|
+
succeeded += 1;
|
|
37
|
+
else if (status === "failed" || status === "error")
|
|
38
|
+
failed += 1;
|
|
39
|
+
}
|
|
40
|
+
const total = runs.length;
|
|
41
|
+
const load = total === 0 ? 0 : active / total;
|
|
42
|
+
const sparkline = buildSparklineSeries(active, succeeded, failed);
|
|
43
|
+
return { total, active, succeeded, failed, byStatus, load, sparkline };
|
|
44
|
+
}
|
|
45
|
+
function buildSparklineSeries(active, succeeded, failed) {
|
|
46
|
+
const peak = Math.max(1, active, succeeded, failed);
|
|
47
|
+
const base = [succeeded, Math.round(succeeded * 0.6 + failed * 0.4), failed, Math.round((active + failed) / 2), active];
|
|
48
|
+
return base.map((value) => Math.max(0, Math.min(peak, value)) / peak);
|
|
49
|
+
}
|
|
50
|
+
function fleetStatsFromState(state) {
|
|
51
|
+
return computeFleetStats(runsFromState(state));
|
|
52
|
+
}
|
|
53
|
+
function sparklineString(values, width) {
|
|
54
|
+
if (values.length === 0)
|
|
55
|
+
return "";
|
|
56
|
+
const series = width && width > 0 && values.length > width ? values.slice(values.length - width) : values;
|
|
57
|
+
return series.map((value) => {
|
|
58
|
+
const clamped = Math.max(0, Math.min(1, value));
|
|
59
|
+
const index = Math.min(SPARK_CHARS.length - 1, Math.round(clamped * (SPARK_CHARS.length - 1)));
|
|
60
|
+
return SPARK_CHARS[index];
|
|
61
|
+
}).join("");
|
|
62
|
+
}
|
|
63
|
+
function barString(ratio, width) {
|
|
64
|
+
if (width <= 0)
|
|
65
|
+
return "";
|
|
66
|
+
const clamped = Math.max(0, Math.min(1, ratio));
|
|
67
|
+
const totalEighths = Math.round(clamped * width * 8);
|
|
68
|
+
const full = Math.floor(totalEighths / 8);
|
|
69
|
+
const remainder = totalEighths % 8;
|
|
70
|
+
let bar = "\u2588".repeat(Math.min(width, full));
|
|
71
|
+
if (full < width && remainder > 0)
|
|
72
|
+
bar += BAR_CHARS[remainder - 1];
|
|
73
|
+
return bar.padEnd(width, " ").slice(0, width);
|
|
74
|
+
}
|
|
75
|
+
function statusSegments(stats, width) {
|
|
76
|
+
if (width <= 0 || stats.total === 0)
|
|
77
|
+
return { active: "", done: "", failed: "", other: "" };
|
|
78
|
+
const other = Math.max(0, stats.total - stats.active - stats.succeeded - stats.failed);
|
|
79
|
+
const raw = [
|
|
80
|
+
{ key: "active", value: stats.active },
|
|
81
|
+
{ key: "done", value: stats.succeeded },
|
|
82
|
+
{ key: "failed", value: stats.failed },
|
|
83
|
+
{ key: "other", value: other }
|
|
84
|
+
];
|
|
85
|
+
const exact = raw.map((entry) => ({ key: entry.key, exact: entry.value / stats.total * width }));
|
|
86
|
+
const floored = exact.map((entry) => ({ key: entry.key, n: Math.floor(entry.exact), frac: entry.exact - Math.floor(entry.exact) }));
|
|
87
|
+
let remaining = width - floored.reduce((sum, entry) => sum + entry.n, 0);
|
|
88
|
+
for (const entry of [...floored].sort((a, b) => b.frac - a.frac)) {
|
|
89
|
+
if (remaining <= 0)
|
|
90
|
+
break;
|
|
91
|
+
entry.n += 1;
|
|
92
|
+
remaining -= 1;
|
|
93
|
+
}
|
|
94
|
+
const widths = new Map(floored.map((entry) => [entry.key, entry.n]));
|
|
95
|
+
return {
|
|
96
|
+
active: "\u2588".repeat(widths.get("active") ?? 0),
|
|
97
|
+
done: "\u2588".repeat(widths.get("done") ?? 0),
|
|
98
|
+
failed: "\u2588".repeat(widths.get("failed") ?? 0),
|
|
99
|
+
other: "\u2592".repeat(widths.get("other") ?? 0)
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function fleetStatsStrip(stats, sparkWidth = 12) {
|
|
103
|
+
const spark = sparklineString(stats.sparkline, sparkWidth);
|
|
104
|
+
const loadPct = Math.round(stats.load * 100);
|
|
105
|
+
return `load ${spark} ${loadPct}% \xB7 ${stats.active} active \xB7 ${stats.succeeded} done \xB7 ${stats.failed} failed \xB7 ${stats.total} total`;
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
statusSegments,
|
|
109
|
+
sparklineString,
|
|
110
|
+
fleetStatsStrip,
|
|
111
|
+
fleetStatsFromState,
|
|
112
|
+
computeFleetStats,
|
|
113
|
+
barString
|
|
114
|
+
};
|