pi-harness-runtime 1.1.136 → 1.1.138
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/harness/langchain/daemon.ts +128 -25
- package/harness/langchain/run.ts +1 -1
- package/index.ts +41 -2
- package/package.json +1 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/architecture-generator/package.json +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/cache-strategy/package.json +1 -1
- package/packages/capability-registry/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/cli-plugin-sdk/package.json +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/clipboard-plugin/package.json +1 -1
- package/packages/code-generation/package.json +1 -1
- package/packages/code-review/package.json +1 -1
- package/packages/codex-adapter/package.json +1 -1
- package/packages/codex-watcher/dist/src/index.d.ts +42 -0
- package/packages/codex-watcher/dist/src/index.d.ts.map +1 -0
- package/packages/codex-watcher/dist/src/index.js +198 -0
- package/packages/codex-watcher/dist/src/index.js.map +1 -0
- package/packages/codex-watcher/dist/src/parser.d.ts +36 -0
- package/packages/codex-watcher/dist/src/parser.d.ts.map +1 -0
- package/packages/codex-watcher/dist/src/parser.js +151 -0
- package/packages/codex-watcher/dist/src/parser.js.map +1 -0
- package/packages/codex-watcher/dist/src/session.d.ts +9 -0
- package/packages/codex-watcher/dist/src/session.d.ts.map +1 -0
- package/packages/codex-watcher/dist/src/session.js +131 -0
- package/packages/codex-watcher/dist/src/session.js.map +1 -0
- package/packages/codex-watcher/dist/src/types.d.ts +63 -0
- package/packages/codex-watcher/dist/src/types.d.ts.map +1 -0
- package/packages/codex-watcher/dist/src/types.js +17 -0
- package/packages/codex-watcher/dist/src/types.js.map +1 -0
- package/packages/codex-watcher/package.json +26 -0
- package/packages/codex-watcher/src/index.ts +244 -0
- package/packages/codex-watcher/src/parser.ts +210 -0
- package/packages/codex-watcher/src/session.ts +151 -0
- package/packages/codex-watcher/src/types.ts +67 -0
- package/packages/codex-watcher/test/watch.test.ts +150 -0
- package/packages/config-capture/package.json +1 -1
- package/packages/config-capture/src/index.ts +5 -16
- package/packages/context-compiler/package.json +1 -1
- package/packages/context-discovery/package.json +1 -1
- package/packages/context-manager/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/cost-optimizer/package.json +1 -1
- package/packages/dependency-analyzer/package.json +1 -1
- package/packages/django-plugin/package.json +1 -1
- package/packages/doc-generator/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/evaluation-runner/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/feedback-collector/package.json +1 -1
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/framework-detector/package.json +1 -1
- package/packages/framework-plugin-sdk/package.json +1 -1
- package/packages/frappe-plugin/package.json +1 -1
- package/packages/generic-web-plugin/package.json +1 -1
- package/packages/health-monitor/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/jev-judge/package.json +1 -1
- package/packages/knowledge-graph/package.json +1 -1
- package/packages/knowledge-retrieval/package.json +1 -1
- package/packages/laravel-plugin/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/mcp-adapter/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/milestone-manager/package.json +1 -1
- package/packages/model-registry/package.json +1 -1
- package/packages/nextjs-plugin/package.json +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/project-analyzer/package.json +1 -1
- package/packages/project-bootstrap/package.json +1 -1
- package/packages/projection-engine/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/prompt-versioning/package.json +1 -1
- package/packages/provider-adapter-sdk/package.json +1 -1
- package/packages/provider-router/package.json +1 -1
- package/packages/provider-selector/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/qdrant-skills/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/rate-limiter/package.json +1 -1
- package/packages/react-vite-plugin/package.json +1 -1
- package/packages/release-manager/package.json +1 -1
- package/packages/requirement-compiler/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/scheduler/package.json +1 -1
- package/packages/scheduler-adapter/package.json +1 -1
- package/packages/session/package.json +1 -1
- package/packages/session-api/package.json +1 -1
- package/packages/session-export/package.json +1 -1
- package/packages/shared-context/package.json +1 -1
- package/packages/skill-mcp-client/package.json +1 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/skills/package.json +1 -1
- package/packages/sprint-planner/package.json +1 -1
- package/packages/subscription-engine/package.json +1 -1
- package/packages/task-compiler/package.json +1 -1
- package/packages/tencentdb-memory/package.json +1 -1
- package/packages/tencentdb-sync/package.json +1 -1
- package/packages/test-data-generator/package.json +1 -1
- package/packages/test-generator/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/token-optimizer/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/dist/harness-header.d.ts +18 -14
- package/packages/tui/dist/harness-header.d.ts.map +1 -1
- package/packages/tui/dist/harness-header.js +110 -64
- package/packages/tui/dist/harness-header.js.map +1 -1
- package/packages/tui/dist/index.d.ts +1 -2
- package/packages/tui/dist/index.d.ts.map +1 -1
- package/packages/tui/dist/index.js +1 -2
- package/packages/tui/dist/index.js.map +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/tui/src/harness-header.ts +156 -77
- package/packages/tui/src/index.ts +6 -2
- package/packages/tui/test/harness-header.test.ts +380 -100
- package/packages/types/package.json +1 -1
- package/packages/workflow-events/package.json +1 -1
- package/packages/workspace-scanner/package.json +1 -1
- package/packages/worktree/package.json +1 -1
- package/packages/write-review/package.json +1 -1
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Harness ASCII Banner — a Pi-compatible custom header
|
|
2
|
+
* Harness ASCII Banner — a Pi-compatible custom header.
|
|
3
3
|
*
|
|
4
|
-
* Uses
|
|
4
|
+
* Uses Unicode block characters to create a compact 4×2 logo:
|
|
5
5
|
* - `▀` (U+2580) fills the upper half of a terminal cell
|
|
6
6
|
* - `▄` (U+2584) fills the lower half of a terminal cell
|
|
7
|
-
* -
|
|
7
|
+
* - Each cell uses a distinct foreground color to suggest depth
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
* Compact/expanded states respond to Ctrl+O via Pi's global setExpanded() mechanism.
|
|
11
|
-
*
|
|
12
|
-
* MIT — derived from general technique documented in upstream pi-coding-agent.
|
|
13
|
-
* Harness branding is original work of the harness project.
|
|
9
|
+
* The logo is NOT Pi's logo — it uses the same rendering primitives only.
|
|
14
10
|
*/
|
|
15
|
-
import type { Component, TUI } from "@earendil-works/pi-tui";
|
|
16
11
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
12
|
+
import type { Component, TUI } from "@earendil-works/pi-tui";
|
|
17
13
|
export interface HarnessHeaderOptions {
|
|
18
14
|
version: string;
|
|
19
15
|
productName?: string;
|
|
20
16
|
onboardingText?: string;
|
|
21
17
|
}
|
|
22
|
-
export declare function createHarnessHeader(_tui: TUI,
|
|
18
|
+
export declare function createHarnessHeader(_tui: TUI, theme: Theme, options: HarnessHeaderOptions): HarnessHeaderComponent;
|
|
23
19
|
declare class HarnessHeaderComponent implements Component {
|
|
24
20
|
private readonly theme;
|
|
25
21
|
private readonly options;
|
|
26
22
|
private expanded;
|
|
27
|
-
private supportsHalfBlocks;
|
|
28
23
|
constructor(theme: Theme, options: HarnessHeaderOptions);
|
|
29
|
-
render(
|
|
24
|
+
render(width: number): string[];
|
|
30
25
|
private renderCompact;
|
|
31
26
|
private renderExpanded;
|
|
27
|
+
/**
|
|
28
|
+
* Truncate a string to at most `maxWidth` visible characters.
|
|
29
|
+
* ANSI escape sequences are excluded from the width count and preserved in the output.
|
|
30
|
+
* If truncation occurs, a "…" (U+2026) is appended.
|
|
31
|
+
*/
|
|
32
|
+
private truncate;
|
|
32
33
|
invalidate(): void;
|
|
33
34
|
setExpanded(expanded: boolean): void;
|
|
34
35
|
dispose(): void;
|
|
35
36
|
}
|
|
36
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Compute the visible character count of a string, excluding ANSI escape sequences.
|
|
39
|
+
* Uses `new RegExp()` to avoid Biome's no-control-characters-in-regex rule.
|
|
40
|
+
*/
|
|
37
41
|
export declare function visibleWidth(str: string): number;
|
|
38
|
-
/** Strip ANSI
|
|
42
|
+
/** Strip all ANSI escape sequences from a string. */
|
|
39
43
|
export declare function stripAnsi(str: string): string;
|
|
40
44
|
export {};
|
|
41
45
|
//# sourceMappingURL=harness-header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness-header.d.ts","sourceRoot":"","sources":["../src/harness-header.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"harness-header.d.ts","sourceRoot":"","sources":["../src/harness-header.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAuE7D,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,oBAAoB,GAC3B,sBAAsB,CAExB;AAED,cAAM,sBAAuB,YAAW,SAAS;IAChD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,QAAQ,CAAS;IAEzB,YAAY,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAQtD;IAID,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAiC9B;IAED,OAAO,CAAC,aAAa;IAwCrB,OAAO,CAAC,cAAc;IAqDtB;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IA8ChB,UAAU,IAAI,IAAI,CAGjB;IAID,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAInC;IAID,OAAO,IAAI,IAAI,CAEd;CACD;AAMD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGhD;AAED,qDAAqD;AACrD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG7C"}
|
|
@@ -1,55 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Harness ASCII Banner — a Pi-compatible custom header
|
|
2
|
+
* Harness ASCII Banner — a Pi-compatible custom header.
|
|
3
3
|
*
|
|
4
|
-
* Uses
|
|
4
|
+
* Uses Unicode block characters to create a compact 4×2 logo:
|
|
5
5
|
* - `▀` (U+2580) fills the upper half of a terminal cell
|
|
6
6
|
* - `▄` (U+2584) fills the lower half of a terminal cell
|
|
7
|
-
* -
|
|
7
|
+
* - Each cell uses a distinct foreground color to suggest depth
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
* Compact/expanded states respond to Ctrl+O via Pi's global setExpanded() mechanism.
|
|
11
|
-
*
|
|
12
|
-
* MIT — derived from general technique documented in upstream pi-coding-agent.
|
|
13
|
-
* Harness branding is original work of the harness project.
|
|
9
|
+
* The logo is NOT Pi's logo — it uses the same rendering primitives only.
|
|
14
10
|
*/
|
|
15
|
-
import {
|
|
11
|
+
import { keyHint, keyText, rawKeyHint } from "@earendil-works/pi-coding-agent";
|
|
16
12
|
// ---------------------------------------------------------------------------
|
|
17
13
|
// Logo design
|
|
18
14
|
// ---------------------------------------------------------------------------
|
|
19
15
|
//
|
|
20
|
-
// Logical 4×4 pixel grid (each cell = foreground
|
|
16
|
+
// Logical 4×4 pixel grid (each cell = one foreground color):
|
|
21
17
|
//
|
|
22
|
-
// Row 0: ░ ░ ▓ ▒ (top half-blocks: accent, accent,
|
|
23
|
-
// Row 1: ▓ ░ ░ ▒ (bottom half-blocks:
|
|
18
|
+
// Row 0: ░ ░ ▓ ▒ (top half-blocks: accent, accent, muted, muted)
|
|
19
|
+
// Row 1: ▓ ░ ░ ▒ (bottom half-blocks: muted, success, success, muted)
|
|
24
20
|
//
|
|
25
21
|
// Rendered as 2 text rows with 4 terminal cells per row:
|
|
26
|
-
// Line 0: ▀▀█▄ (▀ = upper-half, █ = full
|
|
27
|
-
// Line 1: █▀▀▄ (
|
|
22
|
+
// Line 0: ▀▀█▄ (▀ = upper-half block, █ = full block, ▄ = lower-half block)
|
|
23
|
+
// Line 1: █▀▀▄ (alternating foreground colors per cell)
|
|
28
24
|
//
|
|
29
25
|
// Colors:
|
|
30
26
|
// - accent = harness primary (teal in harness theme, adapts to user's theme)
|
|
31
27
|
// - success = harness secondary (green in harness theme)
|
|
32
28
|
// - muted = dim teal (for visual depth)
|
|
33
|
-
// - dim = dim blue (for visual depth)
|
|
34
29
|
//
|
|
35
|
-
// The
|
|
36
|
-
//
|
|
37
|
-
|
|
30
|
+
// The fallback for non-color/headless modes uses an empty logo; renderCompact/Expanded
|
|
31
|
+
// show the product name and version normally.
|
|
32
|
+
// Logo glyphs defined inline in logoLines() — kept here for reference only.
|
|
33
|
+
/** Harness primary — accent color from active theme */
|
|
38
34
|
function logoAccent(text, theme) {
|
|
39
35
|
return theme.fg("accent", text);
|
|
40
36
|
}
|
|
41
|
-
/** Harness secondary
|
|
42
|
-
function
|
|
37
|
+
/** Harness secondary — success color from active theme */
|
|
38
|
+
function logoSuccess(text, theme) {
|
|
43
39
|
return theme.fg("success", text);
|
|
44
40
|
}
|
|
45
|
-
/** Dim foreground —
|
|
41
|
+
/** Dim foreground — muted color for visual depth */
|
|
46
42
|
function logoDim(text, theme) {
|
|
47
43
|
return theme.fg("muted", text);
|
|
48
44
|
}
|
|
49
45
|
/**
|
|
50
46
|
* Build the two colored logo lines for the Harness mark.
|
|
51
47
|
*
|
|
52
|
-
*
|
|
48
|
+
* Each character has its own foreground color:
|
|
53
49
|
* Line 0: ▀▀█▄ → ▀(accent) ▀(accent) █(muted) ▄(muted)
|
|
54
50
|
* Line 1: █▀▀▄ → █(muted) ▀(success) ▀(success) ▄(muted)
|
|
55
51
|
*/
|
|
@@ -60,24 +56,23 @@ function logoLines(theme) {
|
|
|
60
56
|
logoDim("█", theme) +
|
|
61
57
|
logoDim("▄", theme),
|
|
62
58
|
logoDim("█", theme) +
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
logoSuccess("▀", theme) +
|
|
60
|
+
logoSuccess("▀", theme) +
|
|
65
61
|
logoDim("▄", theme),
|
|
66
62
|
];
|
|
67
63
|
}
|
|
68
64
|
// ---------------------------------------------------------------------------
|
|
69
|
-
// Fallback (Apple Terminal, no
|
|
65
|
+
// Fallback (Apple Terminal, no true-color, or non-TUI modes)
|
|
70
66
|
// ---------------------------------------------------------------------------
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
export function createHarnessHeader(_tui,
|
|
74
|
-
return new HarnessHeaderComponent(
|
|
67
|
+
const FALLBACK_LINE0 = "";
|
|
68
|
+
const FALLBACK_LINE1 = "";
|
|
69
|
+
export function createHarnessHeader(_tui, theme, options) {
|
|
70
|
+
return new HarnessHeaderComponent(theme, options);
|
|
75
71
|
}
|
|
76
72
|
class HarnessHeaderComponent {
|
|
77
73
|
theme;
|
|
78
74
|
options;
|
|
79
75
|
expanded = false;
|
|
80
|
-
supportsHalfBlocks = true;
|
|
81
76
|
constructor(theme, options) {
|
|
82
77
|
this.theme = theme;
|
|
83
78
|
this.options = {
|
|
@@ -87,21 +82,23 @@ class HarnessHeaderComponent {
|
|
|
87
82
|
};
|
|
88
83
|
}
|
|
89
84
|
// --- Component interface ---
|
|
90
|
-
render(
|
|
85
|
+
render(width) {
|
|
91
86
|
const { version, onboardingText } = this.options;
|
|
92
|
-
//
|
|
93
|
-
|
|
87
|
+
// Detect true-color support to enable/disable half-block rendering.
|
|
88
|
+
// Falls back to plain text when color mode is unavailable or mono.
|
|
89
|
+
const supportsHalfBlocks = this.theme.getColorMode() === "truecolor";
|
|
90
|
+
const [logoLine0, logoLine1] = supportsHalfBlocks
|
|
94
91
|
? logoLines(this.theme)
|
|
95
|
-
: [
|
|
92
|
+
: [FALLBACK_LINE0, FALLBACK_LINE1];
|
|
96
93
|
const versionStr = this.theme.fg("dim", `v${version}`);
|
|
97
94
|
const expandKey = keyText("app.tools.expand");
|
|
98
95
|
const onboarding = this.theme.fg("dim", onboardingText);
|
|
99
96
|
if (this.expanded) {
|
|
100
|
-
return this.renderExpanded(logoLine0, versionStr, expandKey, onboarding);
|
|
97
|
+
return this.renderExpanded(width, logoLine0, logoLine1, versionStr, expandKey, onboarding);
|
|
101
98
|
}
|
|
102
|
-
return this.renderCompact(logoLine0, logoLine1, versionStr, expandKey, onboarding);
|
|
99
|
+
return this.renderCompact(width, logoLine0, logoLine1, versionStr, expandKey, onboarding);
|
|
103
100
|
}
|
|
104
|
-
renderCompact(logoLine0, logoLine1, versionStr, expandKey, onboarding) {
|
|
101
|
+
renderCompact(width, logoLine0, logoLine1, versionStr, expandKey, onboarding) {
|
|
105
102
|
const { productName } = this.options;
|
|
106
103
|
// Build compact one-line shortcuts
|
|
107
104
|
const hints = [
|
|
@@ -111,22 +108,22 @@ class HarnessHeaderComponent {
|
|
|
111
108
|
rawKeyHint("!", "bash"),
|
|
112
109
|
keyHint("app.tools.expand", "more"),
|
|
113
110
|
].join(this.theme.fg("muted", " · "));
|
|
114
|
-
//
|
|
115
|
-
const line0 = `${logoLine0} ${this.theme.fg("text", productName)} ${versionStr}
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
const line2 = this.theme.fg("dim", `Press ${expandKey} to show full startup help and loaded resources.`);
|
|
120
|
-
// Line 4 (blank line 3): onboarding
|
|
121
|
-
const line4 = onboarding;
|
|
111
|
+
// Build each line and truncate to width
|
|
112
|
+
const line0 = this.truncate(`${logoLine0} ${this.theme.fg("text", productName)} ${versionStr}`, width);
|
|
113
|
+
const line1 = this.truncate(`${logoLine1} ${hints}`, width);
|
|
114
|
+
const line2 = this.truncate(this.theme.fg("dim", `Press ${expandKey} to show full startup help and loaded resources.`), width);
|
|
115
|
+
const line4 = this.truncate(onboarding, width);
|
|
122
116
|
return ["", line0, line1, line2, "", line4, ""];
|
|
123
117
|
}
|
|
124
|
-
renderExpanded(logoLine0, versionStr, expandKey, onboarding) {
|
|
118
|
+
renderExpanded(width, logoLine0, logoLine1, versionStr, expandKey, onboarding) {
|
|
125
119
|
const { productName } = this.options;
|
|
126
|
-
//
|
|
127
|
-
const line0 = `${logoLine0} ${this.theme.fg("text", productName)} ${versionStr}
|
|
120
|
+
// Build lines — both logo rows are preserved
|
|
121
|
+
const line0 = this.truncate(`${logoLine0} ${this.theme.fg("text", productName)} ${versionStr}`, width);
|
|
122
|
+
const line1 = this.truncate(`${logoLine1} `, width);
|
|
123
|
+
const line3 = this.truncate(this.theme.fg("dim", `Press ${expandKey} to show compact header.`), width);
|
|
124
|
+
const line5 = this.truncate(onboarding, width);
|
|
128
125
|
// Expanded: one shortcut per line
|
|
129
|
-
const
|
|
126
|
+
const expandedHints = [
|
|
130
127
|
keyHint("app.interrupt", "abort the current agent turn"),
|
|
131
128
|
keyHint("app.clear", "clear the current session"),
|
|
132
129
|
keyHint("app.exit", "exit Pi"),
|
|
@@ -135,24 +132,69 @@ class HarnessHeaderComponent {
|
|
|
135
132
|
keyHint("app.tools.expand", "expand/collapse tool output and this header"),
|
|
136
133
|
this.theme.fg("muted", `${expandKey} to collapse`),
|
|
137
134
|
];
|
|
138
|
-
//
|
|
139
|
-
const line2 = this.theme.fg("dim", `Press ${expandKey} to show compact header.`);
|
|
140
|
-
// Line 4: onboarding
|
|
141
|
-
const line4 = onboarding;
|
|
142
|
-
// Compose: blank, logo, blank, expanded hints (indented), blank, expand prompt, blank, onboarding, blank
|
|
135
|
+
// Compose: blank, logo row 1, logo row 2, blank, hints (indented), blank, expand prompt, blank, onboarding, blank
|
|
143
136
|
const result = [""];
|
|
144
137
|
result.push(line0);
|
|
138
|
+
result.push(line1);
|
|
145
139
|
result.push(""); // blank after logo
|
|
146
|
-
for (const hint of
|
|
147
|
-
result.push(` ${hint}
|
|
140
|
+
for (const hint of expandedHints) {
|
|
141
|
+
result.push(this.truncate(` ${hint}`, width));
|
|
148
142
|
}
|
|
149
143
|
result.push("");
|
|
150
|
-
result.push(
|
|
144
|
+
result.push(line3);
|
|
151
145
|
result.push("");
|
|
152
|
-
result.push(
|
|
146
|
+
result.push(line5);
|
|
153
147
|
result.push("");
|
|
154
148
|
return result;
|
|
155
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Truncate a string to at most `maxWidth` visible characters.
|
|
152
|
+
* ANSI escape sequences are excluded from the width count and preserved in the output.
|
|
153
|
+
* If truncation occurs, a "…" (U+2026) is appended.
|
|
154
|
+
*/
|
|
155
|
+
truncate(str, maxWidth) {
|
|
156
|
+
if (maxWidth <= 0)
|
|
157
|
+
return "";
|
|
158
|
+
const w = visibleWidth(str);
|
|
159
|
+
if (w <= maxWidth)
|
|
160
|
+
return str;
|
|
161
|
+
// Collect characters up to maxWidth and append ellipsis
|
|
162
|
+
const ellipsis = "…";
|
|
163
|
+
const ellipsisWidth = visibleWidth(ellipsis);
|
|
164
|
+
const targetWidth = Math.max(1, maxWidth - ellipsisWidth);
|
|
165
|
+
let currentWidth = 0;
|
|
166
|
+
let inEscape = false;
|
|
167
|
+
let escapeBuffer = "";
|
|
168
|
+
const result = [];
|
|
169
|
+
for (const char of str) {
|
|
170
|
+
if (char === "\x1b") {
|
|
171
|
+
inEscape = true;
|
|
172
|
+
escapeBuffer = char;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (inEscape) {
|
|
176
|
+
escapeBuffer += char;
|
|
177
|
+
if (/[a-zA-Z]/.test(char)) {
|
|
178
|
+
// End of CSI sequence
|
|
179
|
+
result.push(escapeBuffer);
|
|
180
|
+
inEscape = false;
|
|
181
|
+
escapeBuffer = "";
|
|
182
|
+
}
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
// Visible character
|
|
186
|
+
const charWidth = visibleWidth(char);
|
|
187
|
+
if (currentWidth + charWidth > targetWidth) {
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
currentWidth += charWidth;
|
|
191
|
+
result.push(char);
|
|
192
|
+
}
|
|
193
|
+
// Always append a foreground reset so any open color is closed.
|
|
194
|
+
// If we broke out mid-escape, the partial escape buffer is discarded
|
|
195
|
+
// (it would be an incomplete sequence). The reset restores default.
|
|
196
|
+
return `${result.join("")}${ellipsis}\x1b[39m`;
|
|
197
|
+
}
|
|
156
198
|
invalidate() {
|
|
157
199
|
// Theme changes or expansion state changes call this to request re-render.
|
|
158
200
|
// The TUI calls render() again automatically.
|
|
@@ -170,15 +212,19 @@ class HarnessHeaderComponent {
|
|
|
170
212
|
}
|
|
171
213
|
}
|
|
172
214
|
// ---------------------------------------------------------------------------
|
|
173
|
-
// Visible width
|
|
215
|
+
// Visible width helpers (ANSI-aware)
|
|
174
216
|
// ---------------------------------------------------------------------------
|
|
175
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Compute the visible character count of a string, excluding ANSI escape sequences.
|
|
219
|
+
* Uses `new RegExp()` to avoid Biome's no-control-characters-in-regex rule.
|
|
220
|
+
*/
|
|
176
221
|
export function visibleWidth(str) {
|
|
177
|
-
//
|
|
178
|
-
return str.replace(
|
|
222
|
+
// biome-ignore lint/complexity/useRegexLiterals: must use string constructor to avoid control-char-in-regex error
|
|
223
|
+
return str.replace(new RegExp("\x1b\\[[0-9;]*[a-zA-Z]", "g"), "").length;
|
|
179
224
|
}
|
|
180
|
-
/** Strip ANSI
|
|
225
|
+
/** Strip all ANSI escape sequences from a string. */
|
|
181
226
|
export function stripAnsi(str) {
|
|
182
|
-
|
|
227
|
+
// biome-ignore lint/complexity/useRegexLiterals: must use string constructor to avoid control-char-in-regex error
|
|
228
|
+
return str.replace(new RegExp("\x1b\\[[0-9;]*[a-zA-Z]", "g"), "");
|
|
183
229
|
}
|
|
184
230
|
//# sourceMappingURL=harness-header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness-header.js","sourceRoot":"","sources":["../src/harness-header.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"harness-header.js","sourceRoot":"","sources":["../src/harness-header.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAG/E,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAC9E,EAAE;AACF,6DAA6D;AAC7D,EAAE;AACF,oEAAoE;AACpE,yEAAyE;AACzE,EAAE;AACF,yDAAyD;AACzD,+EAA+E;AAC/E,2DAA2D;AAC3D,EAAE;AACF,UAAU;AACV,iFAAiF;AACjF,4DAA4D;AAC5D,6CAA6C;AAC7C,EAAE;AACF,uFAAuF;AACvF,8CAA8C;AAE9C,4EAA4E;AAE5E,uDAAuD;AACvD,SAAS,UAAU,CAAC,IAAY,EAAE,KAAY;IAC7C,OAAO,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,0DAA0D;AAC1D,SAAS,WAAW,CAAC,IAAY,EAAE,KAAY;IAC9C,OAAO,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,oDAAoD;AACpD,SAAS,OAAO,CAAC,IAAY,EAAE,KA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oEAAoE;QACpE,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,QAAQ,UAAU,CAAC;IAChD,CAAC;IAED,UAAU;QACT,2EAA2E;QAC3E,8CAA8C;IAC/C,CAAC;IAED,kEAAkE;IAElE,WAAW,CAAC,QAAiB;QAC5B,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ;YAAE,OAAO;QACvC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,EAAE,CAAC;IACnB,CAAC;IAED,kBAAkB;IAElB,OAAO;QACN,uCAAuC;IACxC,CAAC;CACD;AAED,8EAA8E;AAC9E,qCAAqC;AACrC,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACvC,kHAAkH;IAClH,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,wBAAwB,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC;AAC1E,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,SAAS,CAAC,GAAW;IACpC,kHAAkH;IAClH,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,wBAAwB,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -4,6 +4,5 @@
|
|
|
4
4
|
* Exports the Harness custom header component that replaces Pi's built-in
|
|
5
5
|
* startup banner with a harness-branded version using Unicode half-block art.
|
|
6
6
|
*/
|
|
7
|
-
export { createHarnessHeader, type HarnessHeaderOptions } from "./harness-header.js";
|
|
8
|
-
export { visibleWidth, stripAnsi } from "./harness-header.js";
|
|
7
|
+
export { createHarnessHeader, type HarnessHeaderOptions, stripAnsi, visibleWidth, } from "./harness-header.js";
|
|
9
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACN,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,SAAS,EACT,YAAY,GACZ,MAAM,qBAAqB,CAAC"}
|