@a5c-ai/babysitter-sdk 0.0.187-staging.4d72b4fa → 0.0.187-staging.542cbbdb
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/cli/commandRegistry.d.ts.map +1 -1
- package/dist/cli/commandRegistry.js +1 -0
- package/dist/cli/commands/sessionHistory.d.ts +14 -0
- package/dist/cli/commands/sessionHistory.d.ts.map +1 -0
- package/dist/cli/commands/sessionHistory.js +82 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +11 -0
- package/dist/dashboard/ink/components/StatusBar.d.ts +3 -0
- package/dist/dashboard/ink/components/StatusBar.d.ts.map +1 -1
- package/dist/dashboard/ink/components/StatusBar.js +14 -5
- package/dist/dashboard/ink/components/StatusLine.d.ts +30 -0
- package/dist/dashboard/ink/components/StatusLine.d.ts.map +1 -0
- package/dist/dashboard/ink/components/StatusLine.js +122 -0
- package/dist/dashboard/ink/components/index.d.ts +3 -0
- package/dist/dashboard/ink/components/index.d.ts.map +1 -1
- package/dist/dashboard/ink/components/index.js +19 -1
- package/dist/dashboard/ink/components/primitives/BorderBox.d.ts +47 -0
- package/dist/dashboard/ink/components/primitives/BorderBox.d.ts.map +1 -0
- package/dist/dashboard/ink/components/primitives/BorderBox.js +107 -0
- package/dist/dashboard/ink/components/primitives/ProgressBar.d.ts +25 -0
- package/dist/dashboard/ink/components/primitives/ProgressBar.d.ts.map +1 -0
- package/dist/dashboard/ink/components/primitives/ProgressBar.js +55 -0
- package/dist/dashboard/ink/components/primitives/Tree.d.ts +27 -0
- package/dist/dashboard/ink/components/primitives/Tree.d.ts.map +1 -0
- package/dist/dashboard/ink/components/primitives/Tree.js +73 -0
- package/dist/dashboard/ink/components/primitives/index.d.ts +10 -0
- package/dist/dashboard/ink/components/primitives/index.d.ts.map +1 -0
- package/dist/dashboard/ink/components/primitives/index.js +16 -0
- package/dist/dashboard/ink/helpers.d.ts +16 -0
- package/dist/dashboard/ink/helpers.d.ts.map +1 -0
- package/dist/dashboard/ink/helpers.js +27 -0
- package/dist/dashboard/ink/index.d.ts +1 -1
- package/dist/dashboard/ink/index.d.ts.map +1 -1
- package/dist/dashboard/ink/types.d.ts +52 -0
- package/dist/dashboard/ink/types.d.ts.map +1 -1
- package/dist/session/history.d.ts +30 -0
- package/dist/session/history.d.ts.map +1 -0
- package/dist/session/history.js +143 -0
- package/dist/session/index.d.ts +2 -1
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +8 -1
- package/dist/session/types.d.ts +49 -0
- package/dist/session/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandRegistry.d.ts","sourceRoot":"","sources":["../../src/cli/commandRegistry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,eAAe,GACvB,KAAK,GACL,MAAM,GACN,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,MAAM,GACN,KAAK,CAAC;AAEV,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"commandRegistry.d.ts","sourceRoot":"","sources":["../../src/cli/commandRegistry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,eAAe,GACvB,KAAK,GACL,MAAM,GACN,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,MAAM,GACN,KAAK,CAAC;AAEV,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,EAAE,WAAW,EAqEzC,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,CAW3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,GAAG,WAAW,EAAE,CAuDlE"}
|
|
@@ -38,6 +38,7 @@ exports.COMMAND_REGISTRY = [
|
|
|
38
38
|
{ name: "harness:doctor", description: "Diagnose run health issues", category: "harness" },
|
|
39
39
|
{ name: "harness:retrospect", description: "Analyze past runs for insights", category: "harness" },
|
|
40
40
|
{ name: "harness:cleanup", description: "Clean up old runs and artifacts", category: "harness" },
|
|
41
|
+
{ name: "harness:session-history", description: "Browse session history (decisions, run summaries, context snapshots)", category: "harness", usage: "babysitter harness:session-history --session-id <id> --state-dir <dir> [--run-id <id>] [--json]" },
|
|
41
42
|
// Plugin commands
|
|
42
43
|
{ name: "plugin:install", description: "Install a plugin", category: "plugin" },
|
|
43
44
|
{ name: "plugin:uninstall", description: "Uninstall a plugin", category: "plugin" },
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* session:history command — Browse session history (GAP-SESSION-002).
|
|
3
|
+
*
|
|
4
|
+
* Displays accumulated decisions, run summaries, and context snapshots
|
|
5
|
+
* for a session. Supports --json and --run-id filtering.
|
|
6
|
+
*/
|
|
7
|
+
export interface SessionHistoryArgs {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
stateDir: string;
|
|
10
|
+
json?: boolean;
|
|
11
|
+
runId?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function handleSessionHistory(args: SessionHistoryArgs): Promise<number>;
|
|
14
|
+
//# sourceMappingURL=sessionHistory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionHistory.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/sessionHistory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CA0BpF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* session:history command — Browse session history (GAP-SESSION-002).
|
|
4
|
+
*
|
|
5
|
+
* Displays accumulated decisions, run summaries, and context snapshots
|
|
6
|
+
* for a session. Supports --json and --run-id filtering.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.handleSessionHistory = handleSessionHistory;
|
|
10
|
+
const history_1 = require("../../session/history");
|
|
11
|
+
async function handleSessionHistory(args) {
|
|
12
|
+
const { sessionId, stateDir } = args;
|
|
13
|
+
if (!sessionId) {
|
|
14
|
+
console.error("[session:history] --session-id is required");
|
|
15
|
+
return 1;
|
|
16
|
+
}
|
|
17
|
+
if (!stateDir) {
|
|
18
|
+
console.error("[session:history] --state-dir is required");
|
|
19
|
+
return 1;
|
|
20
|
+
}
|
|
21
|
+
const history = await (0, history_1.getSessionHistory)(stateDir, sessionId);
|
|
22
|
+
// Apply run-id filter if requested
|
|
23
|
+
const filtered = args.runId ? filterByRunId(history, args.runId) : history;
|
|
24
|
+
if (args.json) {
|
|
25
|
+
console.log(JSON.stringify(filtered, null, 2));
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
// Text mode
|
|
29
|
+
renderTextHistory(filtered);
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
function filterByRunId(history, runId) {
|
|
33
|
+
return {
|
|
34
|
+
notes: history.notes,
|
|
35
|
+
sharedKnowledge: history.sharedKnowledge,
|
|
36
|
+
decisions: history.decisions.filter((d) => d.runId === runId),
|
|
37
|
+
runSummaries: history.runSummaries.filter((r) => r.runId === runId),
|
|
38
|
+
contextSnapshots: history.contextSnapshots.filter((s) => s.runId === runId),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function renderTextHistory(history) {
|
|
42
|
+
console.log("=== Decisions ===");
|
|
43
|
+
if (history.decisions.length === 0) {
|
|
44
|
+
console.log("(none)");
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
for (const d of history.decisions) {
|
|
48
|
+
const runPart = d.runId ? ` [${d.runId}]` : "";
|
|
49
|
+
const ratPart = d.rationale ? ` — ${d.rationale}` : "";
|
|
50
|
+
console.log(` ${d.timestamp}${runPart}: ${d.description}${ratPart}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
console.log("");
|
|
54
|
+
console.log("=== Run Summaries ===");
|
|
55
|
+
if (history.runSummaries.length === 0) {
|
|
56
|
+
console.log("(none)");
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
for (const r of history.runSummaries) {
|
|
60
|
+
const parts = [`${r.runId} (${r.processId})`, r.status, `started ${r.startedAt}`];
|
|
61
|
+
if (r.completedAt)
|
|
62
|
+
parts.push(`completed ${r.completedAt}`);
|
|
63
|
+
if (r.outcome)
|
|
64
|
+
parts.push(r.outcome);
|
|
65
|
+
if (r.score !== undefined)
|
|
66
|
+
parts.push(`score: ${r.score}`);
|
|
67
|
+
console.log(` ${parts.join(" | ")}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
console.log("");
|
|
71
|
+
console.log("=== Context Snapshots ===");
|
|
72
|
+
if (history.contextSnapshots.length === 0) {
|
|
73
|
+
console.log("(none)");
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
for (const s of history.contextSnapshots) {
|
|
77
|
+
const keys = Object.keys(s.snapshot).length;
|
|
78
|
+
const runPart = s.runId ? ` [${s.runId}]` : "";
|
|
79
|
+
console.log(` ${s.timestamp}${runPart}: ${keys} key(s)`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
package/dist/cli/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,sBAAsB,IAAI,6BAA6B,EAAoB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,sBAAsB,IAAI,6BAA6B,EAAoB,MAAM,oBAAoB,CAAC;AA02B/G;;;;;;;;;GASG;AACH,iBAAS,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CA8BlE;AAOD,2EAA2E;AAC3E,QAAA,MAAM,sBAAsB,sCAAgC,CAAC;AA6zD7D,OAAO,EAAE,aAAa,IAAI,cAAc,EAAE,sBAAsB,IAAI,uBAAuB,EAAE,CAAC;AAE9F,wBAAgB,mBAAmB;eAEf,MAAM,EAAE,GAA2B,OAAO,CAAC,MAAM,CAAC;kBA+sBpD,MAAM;EAIvB"}
|
package/dist/cli/main.js
CHANGED
|
@@ -54,6 +54,7 @@ const runIterate_1 = require("./commands/runIterate");
|
|
|
54
54
|
const health_1 = require("./commands/health");
|
|
55
55
|
const configure_1 = require("./commands/configure");
|
|
56
56
|
const session_1 = require("./commands/session");
|
|
57
|
+
const sessionHistory_1 = require("./commands/sessionHistory");
|
|
57
58
|
const skill_1 = require("./commands/skill");
|
|
58
59
|
const mcpServe_1 = require("./commands/mcpServe");
|
|
59
60
|
const hookLog_1 = require("./commands/hookLog");
|
|
@@ -143,6 +144,7 @@ Other commands (agents should never call these directly unless explicitly instru
|
|
|
143
144
|
babysitter harness:doctor [--run-id <id>] [--runs-dir <dir>] [--json] [--verbose]
|
|
144
145
|
babysitter harness:contrib [--prompt <text>] [--harness <name>] [--workspace <dir>] [--model <model>] [--max-iterations <n>] [--runs-dir <dir>] [--json] [--verbose]
|
|
145
146
|
babysitter harness:anycli --service <name> [--scope <scopes>] [--mcp] [--auth-file <path>] [--transport <type>] [--prompt <text>] [--workspace <dir>] [--json] [--verbose]
|
|
147
|
+
babysitter harness:session-history --session-id <id> --state-dir <dir> [--run-id <id>] [--json]
|
|
146
148
|
babysitter harness:help [<topic>]
|
|
147
149
|
babysitter harness:observe [--workspace <dir>]
|
|
148
150
|
babysitter harness:user-install [--harness <name>] [--workspace <dir>] [--model <model>] [--runs-dir <dir>] [--json] [--verbose]
|
|
@@ -2164,6 +2166,7 @@ const VALID_COMMANDS = [
|
|
|
2164
2166
|
"harness:doctor",
|
|
2165
2167
|
"harness:contrib",
|
|
2166
2168
|
"harness:anycli",
|
|
2169
|
+
"harness:session-history",
|
|
2167
2170
|
"harness:help",
|
|
2168
2171
|
"harness:observe",
|
|
2169
2172
|
"harness:user-install",
|
|
@@ -3029,6 +3032,14 @@ function createBabysitterCli() {
|
|
|
3029
3032
|
interactive: parsed.interactive,
|
|
3030
3033
|
});
|
|
3031
3034
|
}
|
|
3035
|
+
if (parsed.command === "harness:session-history") {
|
|
3036
|
+
return await (0, sessionHistory_1.handleSessionHistory)({
|
|
3037
|
+
sessionId: parsed.sessionId ?? "",
|
|
3038
|
+
stateDir: parsed.stateDir ?? "",
|
|
3039
|
+
json: parsed.json,
|
|
3040
|
+
runId: parsed.runIdOverride,
|
|
3041
|
+
});
|
|
3042
|
+
}
|
|
3032
3043
|
if (parsed.command === "harness:help") {
|
|
3033
3044
|
return handleHarnessHelp(parsed);
|
|
3034
3045
|
}
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* Box/Text are obtained from InkContext via useInk() — no prop drilling.
|
|
10
10
|
*/
|
|
11
11
|
import React from "react";
|
|
12
|
+
import { formatCost } from "../helpers.js";
|
|
13
|
+
export { formatCost };
|
|
12
14
|
export interface StatusBarProps {
|
|
13
15
|
/** Human-readable harness name, e.g. "claude-code". */
|
|
14
16
|
harness?: string;
|
|
@@ -21,5 +23,6 @@ export interface StatusBarProps {
|
|
|
21
23
|
/** Total number of resolved effects this run. */
|
|
22
24
|
resolvedEffects?: number;
|
|
23
25
|
}
|
|
26
|
+
export declare function formatTokenCount(count: number): string;
|
|
24
27
|
export declare function StatusBar({ harness, model, iteration, pendingEffects, resolvedEffects, }: StatusBarProps): React.JSX.Element;
|
|
25
28
|
//# sourceMappingURL=StatusBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBar.d.ts","sourceRoot":"","sources":["../../../../src/dashboard/ink/components/StatusBar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"StatusBar.d.ts","sourceRoot":"","sources":["../../../../src/dashboard/ink/components/StatusBar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAiB,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,CAAC;AAMtB,MAAM,WAAW,cAAc;IAC7B,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAMD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQtD;AAuCD,wBAAgB,SAAS,CAAC,EACxB,OAAsB,EACtB,KAAK,EACL,SAAa,EACb,cAAkB,EAClB,eAAmB,GACpB,EAAE,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA4GpC"}
|
|
@@ -13,6 +13,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.formatCost = void 0;
|
|
17
|
+
exports.formatTokenCount = formatTokenCount;
|
|
16
18
|
exports.StatusBar = StatusBar;
|
|
17
19
|
const react_1 = __importDefault(require("react"));
|
|
18
20
|
const useSession_js_1 = require("../hooks/useSession.js");
|
|
@@ -20,13 +22,20 @@ const useTheme_js_1 = require("../hooks/useTheme.js");
|
|
|
20
22
|
const InkContext_js_1 = require("../contexts/InkContext.js");
|
|
21
23
|
const RunningIndicator_js_1 = require("./RunningIndicator.js");
|
|
22
24
|
const StatusLine_js_1 = require("../../components/StatusLine.js");
|
|
25
|
+
const helpers_js_1 = require("../helpers.js");
|
|
26
|
+
Object.defineProperty(exports, "formatCost", { enumerable: true, get: function () { return helpers_js_1.formatCost; } });
|
|
23
27
|
// ---------------------------------------------------------------------------
|
|
24
28
|
// Helpers
|
|
25
29
|
// ---------------------------------------------------------------------------
|
|
26
|
-
function
|
|
27
|
-
if (
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
+
function formatTokenCount(count) {
|
|
31
|
+
if (count < 1000)
|
|
32
|
+
return `${count}`;
|
|
33
|
+
if (count < 1_000_000) {
|
|
34
|
+
const k = count / 1000;
|
|
35
|
+
return `${k.toFixed(1)}k`;
|
|
36
|
+
}
|
|
37
|
+
const m = count / 1_000_000;
|
|
38
|
+
return `${m.toFixed(1)}M`;
|
|
30
39
|
}
|
|
31
40
|
function statusToIndicator(status) {
|
|
32
41
|
switch (status) {
|
|
@@ -77,7 +86,7 @@ function StatusBar({ harness = "babysitter", model, iteration = 0, pendingEffect
|
|
|
77
86
|
: null);
|
|
78
87
|
// Center section: status indicator + run ID + iteration
|
|
79
88
|
const centerSection = react_1.default.createElement(Box, { flexDirection: "row", gap: 1 }, react_1.default.createElement(Text, { color: indicatorColor }, indicatorSymbol), hasRun
|
|
80
|
-
? react_1.default.createElement(Text, { color: colors.secondary }, truncateRunId(runId))
|
|
89
|
+
? react_1.default.createElement(Text, { color: colors.secondary }, (0, helpers_js_1.truncateRunId)(runId))
|
|
81
90
|
: react_1.default.createElement(Text, { color: colors.muted }, "no run — start one or pass --run-id"), react_1.default.createElement(Text, { color: colors.muted }, `iter:${String(iteration)}`));
|
|
82
91
|
// Right section: effects counts + elapsed + spinner
|
|
83
92
|
const rightSection = react_1.default.createElement(Box, { flexDirection: "row", gap: 1 }, pendingEffects > 0
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StatusLine — orchestration status line component for the Babysitter TUI.
|
|
3
|
+
*
|
|
4
|
+
* Exports:
|
|
5
|
+
* - formatElapsed(ms) — pure helper
|
|
6
|
+
* - phaseToColorKey(phase) — pure helper
|
|
7
|
+
* - formatCostForStatus(cost) — pure helper
|
|
8
|
+
* - truncateRunId(id) — pure helper
|
|
9
|
+
* - formatStatusSegments(status, colors) — pure function
|
|
10
|
+
* - StatusLine — React component
|
|
11
|
+
*/
|
|
12
|
+
import React from "react";
|
|
13
|
+
import type { OrchestrationStatus, OrchestrationPhase, ThemeColors } from "../types.js";
|
|
14
|
+
import { truncateRunId, formatCost } from "../helpers.js";
|
|
15
|
+
export { truncateRunId };
|
|
16
|
+
export interface StatusSegment {
|
|
17
|
+
readonly text: string;
|
|
18
|
+
readonly colorKey: string;
|
|
19
|
+
readonly bold?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface StatusLineProps {
|
|
22
|
+
status: OrchestrationStatus;
|
|
23
|
+
}
|
|
24
|
+
export declare function formatElapsed(ms: number): string;
|
|
25
|
+
export declare function phaseToColorKey(phase: OrchestrationPhase): string;
|
|
26
|
+
/** @deprecated Use formatCost from helpers.ts instead. Re-exported for backward compatibility. */
|
|
27
|
+
export declare const formatCostForStatus: typeof formatCost;
|
|
28
|
+
export declare function formatStatusSegments(status: OrchestrationStatus, _colors: ThemeColors): StatusSegment[];
|
|
29
|
+
export declare function StatusLine({ status }: StatusLineProps): React.JSX.Element;
|
|
30
|
+
//# sourceMappingURL=StatusLine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusLine.d.ts","sourceRoot":"","sources":["../../../../src/dashboard/ink/components/StatusLine.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,CAAC;AAMzB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAMD,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAUhD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAajE;AAED,kGAAkG;AAClG,eAAO,MAAM,mBAAmB,mBAAa,CAAC;AAE9C,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,WAAW,GACnB,aAAa,EAAE,CAmDjB;AAaD,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAoBzE"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* StatusLine — orchestration status line component for the Babysitter TUI.
|
|
4
|
+
*
|
|
5
|
+
* Exports:
|
|
6
|
+
* - formatElapsed(ms) — pure helper
|
|
7
|
+
* - phaseToColorKey(phase) — pure helper
|
|
8
|
+
* - formatCostForStatus(cost) — pure helper
|
|
9
|
+
* - truncateRunId(id) — pure helper
|
|
10
|
+
* - formatStatusSegments(status, colors) — pure function
|
|
11
|
+
* - StatusLine — React component
|
|
12
|
+
*/
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.formatCostForStatus = exports.truncateRunId = void 0;
|
|
18
|
+
exports.formatElapsed = formatElapsed;
|
|
19
|
+
exports.phaseToColorKey = phaseToColorKey;
|
|
20
|
+
exports.formatStatusSegments = formatStatusSegments;
|
|
21
|
+
exports.StatusLine = StatusLine;
|
|
22
|
+
const react_1 = __importDefault(require("react"));
|
|
23
|
+
const InkContext_js_1 = require("../contexts/InkContext.js");
|
|
24
|
+
const useTheme_js_1 = require("../hooks/useTheme.js");
|
|
25
|
+
const helpers_js_1 = require("../helpers.js");
|
|
26
|
+
Object.defineProperty(exports, "truncateRunId", { enumerable: true, get: function () { return helpers_js_1.truncateRunId; } });
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
// Pure helpers
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
function formatElapsed(ms) {
|
|
31
|
+
if (ms < 1000)
|
|
32
|
+
return `${ms}ms`;
|
|
33
|
+
const seconds = Math.floor(ms / 1000);
|
|
34
|
+
if (seconds < 60)
|
|
35
|
+
return `${seconds}s`;
|
|
36
|
+
const minutes = Math.floor(seconds / 60);
|
|
37
|
+
const remainingSeconds = seconds % 60;
|
|
38
|
+
if (minutes < 60)
|
|
39
|
+
return `${minutes}m${remainingSeconds}s`;
|
|
40
|
+
const hours = Math.floor(minutes / 60);
|
|
41
|
+
const remainingMinutes = minutes % 60;
|
|
42
|
+
return `${hours}h${remainingMinutes}m`;
|
|
43
|
+
}
|
|
44
|
+
function phaseToColorKey(phase) {
|
|
45
|
+
switch (phase) {
|
|
46
|
+
case "complete":
|
|
47
|
+
return "success";
|
|
48
|
+
case "failed":
|
|
49
|
+
return "error";
|
|
50
|
+
case "waiting":
|
|
51
|
+
return "warning";
|
|
52
|
+
case "planning":
|
|
53
|
+
case "executing":
|
|
54
|
+
case "verifying":
|
|
55
|
+
return "primary";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** @deprecated Use formatCost from helpers.ts instead. Re-exported for backward compatibility. */
|
|
59
|
+
exports.formatCostForStatus = helpers_js_1.formatCost;
|
|
60
|
+
function formatStatusSegments(status, _colors) {
|
|
61
|
+
const segments = [];
|
|
62
|
+
// Phase segment (bold)
|
|
63
|
+
segments.push({
|
|
64
|
+
text: status.phase.toUpperCase(),
|
|
65
|
+
colorKey: phaseToColorKey(status.phase),
|
|
66
|
+
bold: true,
|
|
67
|
+
});
|
|
68
|
+
// Run ID segment
|
|
69
|
+
segments.push({
|
|
70
|
+
text: (0, helpers_js_1.truncateRunId)(status.runId),
|
|
71
|
+
colorKey: "muted",
|
|
72
|
+
});
|
|
73
|
+
// Iteration segment
|
|
74
|
+
segments.push({
|
|
75
|
+
text: `iter:${status.iteration}`,
|
|
76
|
+
colorKey: "foreground",
|
|
77
|
+
});
|
|
78
|
+
// Effects segment
|
|
79
|
+
segments.push({
|
|
80
|
+
text: `effects:${status.resolvedEffects}/${status.totalEffects}`,
|
|
81
|
+
colorKey: status.pendingEffects > 0 ? "warning" : "success",
|
|
82
|
+
});
|
|
83
|
+
// Elapsed segment
|
|
84
|
+
segments.push({
|
|
85
|
+
text: formatElapsed(status.elapsedMs),
|
|
86
|
+
colorKey: "muted",
|
|
87
|
+
});
|
|
88
|
+
// Optional: token usage
|
|
89
|
+
if (status.tokenUsage) {
|
|
90
|
+
segments.push({
|
|
91
|
+
text: `tokens:${status.tokenUsage.total}`,
|
|
92
|
+
colorKey: "muted",
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
// Optional: cost
|
|
96
|
+
if (status.cost !== undefined) {
|
|
97
|
+
segments.push({
|
|
98
|
+
text: (0, exports.formatCostForStatus)(status.cost),
|
|
99
|
+
colorKey: "muted",
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return segments;
|
|
103
|
+
}
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
// Component
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
function resolveColor(colors, key) {
|
|
108
|
+
if (key in colors) {
|
|
109
|
+
return colors[key];
|
|
110
|
+
}
|
|
111
|
+
return colors.foreground;
|
|
112
|
+
}
|
|
113
|
+
function StatusLine({ status }) {
|
|
114
|
+
const { Box, Text } = (0, InkContext_js_1.useInk)();
|
|
115
|
+
const { colors } = (0, useTheme_js_1.useTheme)();
|
|
116
|
+
const segments = formatStatusSegments(status, colors);
|
|
117
|
+
return react_1.default.createElement(Box, { flexDirection: "row", gap: 1 }, ...segments.map((seg, idx) => react_1.default.createElement(Text, {
|
|
118
|
+
key: idx,
|
|
119
|
+
color: resolveColor(colors, seg.colorKey),
|
|
120
|
+
bold: seg.bold ?? false,
|
|
121
|
+
}, seg.text)));
|
|
122
|
+
}
|
|
@@ -18,4 +18,7 @@ export { RunListTable } from "./RunListTable.js";
|
|
|
18
18
|
export type { RunListTableProps } from "./RunListTable.js";
|
|
19
19
|
export { ActionMenu } from "./ActionMenu.js";
|
|
20
20
|
export type { ActionMenuProps } from "./ActionMenu.js";
|
|
21
|
+
export { StatusLine } from "./StatusLine.js";
|
|
22
|
+
export type { StatusLineProps as InkStatusLineProps } from "./StatusLine.js";
|
|
23
|
+
export * from "./primitives/index.js";
|
|
21
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dashboard/ink/components/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dashboard/ink/components/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,eAAe,IAAI,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG7E,cAAc,uBAAuB,CAAC"}
|
|
@@ -5,8 +5,22 @@
|
|
|
5
5
|
* Import from this module rather than from individual component files to keep
|
|
6
6
|
* import paths stable as the component tree grows.
|
|
7
7
|
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
8
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.ActionMenu = exports.RunListTable = exports.RunningIndicator = exports.Message = exports.PromptBar = exports.MessagePane = exports.StatusBar = void 0;
|
|
23
|
+
exports.StatusLine = exports.ActionMenu = exports.RunListTable = exports.RunningIndicator = exports.Message = exports.PromptBar = exports.MessagePane = exports.StatusBar = void 0;
|
|
10
24
|
var StatusBar_js_1 = require("./StatusBar.js");
|
|
11
25
|
Object.defineProperty(exports, "StatusBar", { enumerable: true, get: function () { return StatusBar_js_1.StatusBar; } });
|
|
12
26
|
var MessagePane_js_1 = require("./MessagePane.js");
|
|
@@ -21,3 +35,7 @@ var RunListTable_js_1 = require("./RunListTable.js");
|
|
|
21
35
|
Object.defineProperty(exports, "RunListTable", { enumerable: true, get: function () { return RunListTable_js_1.RunListTable; } });
|
|
22
36
|
var ActionMenu_js_1 = require("./ActionMenu.js");
|
|
23
37
|
Object.defineProperty(exports, "ActionMenu", { enumerable: true, get: function () { return ActionMenu_js_1.ActionMenu; } });
|
|
38
|
+
var StatusLine_js_1 = require("./StatusLine.js");
|
|
39
|
+
Object.defineProperty(exports, "StatusLine", { enumerable: true, get: function () { return StatusLine_js_1.StatusLine; } });
|
|
40
|
+
// Primitives
|
|
41
|
+
__exportStar(require("./primitives/index.js"), exports);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BorderBox — bordered container primitive for the Babysitter TUI.
|
|
3
|
+
*
|
|
4
|
+
* Exports:
|
|
5
|
+
* - getBorderChars(style) — pure function returning unicode border characters
|
|
6
|
+
* - borderBoxReducer(state, action) — state machine for BorderBox
|
|
7
|
+
* - BorderBox — React component (uses InkContext + ThemeContext)
|
|
8
|
+
*/
|
|
9
|
+
import React from "react";
|
|
10
|
+
export type BorderStyle = "single" | "double" | "round" | "bold" | "none";
|
|
11
|
+
export interface BorderBoxState {
|
|
12
|
+
readonly style: BorderStyle;
|
|
13
|
+
readonly title: string | undefined;
|
|
14
|
+
readonly collapsed: boolean;
|
|
15
|
+
readonly padding: number;
|
|
16
|
+
}
|
|
17
|
+
export type BorderBoxAction = {
|
|
18
|
+
type: "SET_STYLE";
|
|
19
|
+
style: BorderStyle;
|
|
20
|
+
} | {
|
|
21
|
+
type: "SET_TITLE";
|
|
22
|
+
title: string | undefined;
|
|
23
|
+
} | {
|
|
24
|
+
type: "TOGGLE_COLLAPSE";
|
|
25
|
+
} | {
|
|
26
|
+
type: "SET_PADDING";
|
|
27
|
+
padding: number;
|
|
28
|
+
};
|
|
29
|
+
export interface BorderChars {
|
|
30
|
+
readonly topLeft: string;
|
|
31
|
+
readonly topRight: string;
|
|
32
|
+
readonly bottomLeft: string;
|
|
33
|
+
readonly bottomRight: string;
|
|
34
|
+
readonly horizontal: string;
|
|
35
|
+
readonly vertical: string;
|
|
36
|
+
}
|
|
37
|
+
export interface BorderBoxProps {
|
|
38
|
+
style?: BorderStyle;
|
|
39
|
+
title?: string;
|
|
40
|
+
collapsed?: boolean;
|
|
41
|
+
padding?: number;
|
|
42
|
+
children?: React.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
export declare function getBorderChars(style: BorderStyle): BorderChars;
|
|
45
|
+
export declare function borderBoxReducer(state: BorderBoxState, action: BorderBoxAction): BorderBoxState;
|
|
46
|
+
export declare function BorderBox({ style, title, collapsed, padding, children, }: BorderBoxProps): React.JSX.Element;
|
|
47
|
+
//# sourceMappingURL=BorderBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BorderBox.d.ts","sourceRoot":"","sources":["../../../../../src/dashboard/ink/components/primitives/BorderBox.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC3B;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAMD,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAgD9D;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,eAAe,GACtB,cAAc,CAahB;AAMD,wBAAgB,SAAS,CAAC,EACxB,KAAgB,EAChB,KAAK,EACL,SAAiB,EACjB,OAAW,EACX,QAAQ,GACT,EAAE,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAyCpC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* BorderBox — bordered container primitive for the Babysitter TUI.
|
|
4
|
+
*
|
|
5
|
+
* Exports:
|
|
6
|
+
* - getBorderChars(style) — pure function returning unicode border characters
|
|
7
|
+
* - borderBoxReducer(state, action) — state machine for BorderBox
|
|
8
|
+
* - BorderBox — React component (uses InkContext + ThemeContext)
|
|
9
|
+
*/
|
|
10
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.getBorderChars = getBorderChars;
|
|
15
|
+
exports.borderBoxReducer = borderBoxReducer;
|
|
16
|
+
exports.BorderBox = BorderBox;
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const InkContext_js_1 = require("../../contexts/InkContext.js");
|
|
19
|
+
const useTheme_js_1 = require("../../hooks/useTheme.js");
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Pure functions
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
function getBorderChars(style) {
|
|
24
|
+
switch (style) {
|
|
25
|
+
case "single":
|
|
26
|
+
return {
|
|
27
|
+
topLeft: "\u250c",
|
|
28
|
+
topRight: "\u2510",
|
|
29
|
+
bottomLeft: "\u2514",
|
|
30
|
+
bottomRight: "\u2518",
|
|
31
|
+
horizontal: "\u2500",
|
|
32
|
+
vertical: "\u2502",
|
|
33
|
+
};
|
|
34
|
+
case "double":
|
|
35
|
+
return {
|
|
36
|
+
topLeft: "\u2554",
|
|
37
|
+
topRight: "\u2557",
|
|
38
|
+
bottomLeft: "\u255a",
|
|
39
|
+
bottomRight: "\u255d",
|
|
40
|
+
horizontal: "\u2550",
|
|
41
|
+
vertical: "\u2551",
|
|
42
|
+
};
|
|
43
|
+
case "round":
|
|
44
|
+
return {
|
|
45
|
+
topLeft: "\u256d",
|
|
46
|
+
topRight: "\u256e",
|
|
47
|
+
bottomLeft: "\u2570",
|
|
48
|
+
bottomRight: "\u256f",
|
|
49
|
+
horizontal: "\u2500",
|
|
50
|
+
vertical: "\u2502",
|
|
51
|
+
};
|
|
52
|
+
case "bold":
|
|
53
|
+
return {
|
|
54
|
+
topLeft: "\u250f",
|
|
55
|
+
topRight: "\u2513",
|
|
56
|
+
bottomLeft: "\u2517",
|
|
57
|
+
bottomRight: "\u251b",
|
|
58
|
+
horizontal: "\u2501",
|
|
59
|
+
vertical: "\u2503",
|
|
60
|
+
};
|
|
61
|
+
case "none":
|
|
62
|
+
return {
|
|
63
|
+
topLeft: "",
|
|
64
|
+
topRight: "",
|
|
65
|
+
bottomLeft: "",
|
|
66
|
+
bottomRight: "",
|
|
67
|
+
horizontal: "",
|
|
68
|
+
vertical: "",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function borderBoxReducer(state, action) {
|
|
73
|
+
switch (action.type) {
|
|
74
|
+
case "SET_STYLE":
|
|
75
|
+
return { ...state, style: action.style };
|
|
76
|
+
case "SET_TITLE":
|
|
77
|
+
return { ...state, title: action.title };
|
|
78
|
+
case "TOGGLE_COLLAPSE":
|
|
79
|
+
return { ...state, collapsed: !state.collapsed };
|
|
80
|
+
case "SET_PADDING": {
|
|
81
|
+
const clamped = Math.max(0, Math.min(4, action.padding));
|
|
82
|
+
return { ...state, padding: clamped };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
// Component
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
function BorderBox({ style = "single", title, collapsed = false, padding = 0, children, }) {
|
|
90
|
+
const { Box, Text } = (0, InkContext_js_1.useInk)();
|
|
91
|
+
const { colors } = (0, useTheme_js_1.useTheme)();
|
|
92
|
+
const _chars = getBorderChars(style);
|
|
93
|
+
if (collapsed) {
|
|
94
|
+
return react_1.default.createElement(Box, { flexDirection: "row" }, title
|
|
95
|
+
? react_1.default.createElement(Text, { color: colors.border }, `${_chars.topLeft}${_chars.horizontal} ${title} ${_chars.horizontal}${_chars.topRight} (collapsed)`)
|
|
96
|
+
: react_1.default.createElement(Text, { color: colors.muted }, "(collapsed)"));
|
|
97
|
+
}
|
|
98
|
+
return react_1.default.createElement(Box, {
|
|
99
|
+
flexDirection: "column",
|
|
100
|
+
borderStyle: style === "none" ? undefined : style,
|
|
101
|
+
borderColor: colors.border,
|
|
102
|
+
paddingX: padding,
|
|
103
|
+
paddingY: padding > 0 ? 1 : 0,
|
|
104
|
+
}, title
|
|
105
|
+
? react_1.default.createElement(Text, { color: colors.primary, bold: true }, title)
|
|
106
|
+
: null, children);
|
|
107
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProgressBar — text-based progress bar primitive for the Babysitter TUI.
|
|
3
|
+
*
|
|
4
|
+
* Exports:
|
|
5
|
+
* - renderProgressBar(options) — pure function
|
|
6
|
+
* - ProgressBar — React component (uses InkContext + ThemeContext)
|
|
7
|
+
*/
|
|
8
|
+
import React from "react";
|
|
9
|
+
export interface ProgressBarInput {
|
|
10
|
+
readonly progress: number;
|
|
11
|
+
readonly width?: number;
|
|
12
|
+
readonly fillChar?: string;
|
|
13
|
+
readonly emptyChar?: string;
|
|
14
|
+
readonly showLabel?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface ProgressBarOutput {
|
|
17
|
+
readonly bar: string;
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly filledCount: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ProgressBarProps extends ProgressBarInput {
|
|
22
|
+
}
|
|
23
|
+
export declare function renderProgressBar(input: ProgressBarInput): ProgressBarOutput;
|
|
24
|
+
export declare function ProgressBar(props: ProgressBarProps): React.JSX.Element;
|
|
25
|
+
//# sourceMappingURL=ProgressBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../../../../src/dashboard/ink/components/primitives/ProgressBar.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;CAAG;AAc7D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,iBAAiB,CAiB5E;AAMD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAgCtE"}
|