pi-one-ui 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/README.en.md +256 -0
- package/README.md +195 -72
- package/extensions/app/config/renderer.ts +5 -17
- package/extensions/app/config/shell.ts +118 -422
- package/extensions/app/config/store.ts +23 -92
- package/extensions/app/presets.ts +1 -2
- package/extensions/layouts/context/renderer/tool/grouping.ts +267 -89
- package/extensions/layouts/context/renderer/tool/result.ts +76 -0
- package/package.json +10 -1
|
@@ -270,6 +270,7 @@ export class ExpandedToolIoView {
|
|
|
270
270
|
private maxInputLines: number;
|
|
271
271
|
private cachedWidth: number | undefined;
|
|
272
272
|
private cachedLines: string[] | undefined;
|
|
273
|
+
private renderRevision = 0;
|
|
273
274
|
private hoveredSection: ToolIoSection | null = null;
|
|
274
275
|
/** Which sections currently show the show-more affordance (after last render). */
|
|
275
276
|
private truncated: { input: boolean; output: boolean } = {
|
|
@@ -344,6 +345,14 @@ export class ExpandedToolIoView {
|
|
|
344
345
|
return this.outputBody.trim() ? this.outputBody : "Done";
|
|
345
346
|
}
|
|
346
347
|
|
|
348
|
+
getHoveredSection(): ToolIoSection | null {
|
|
349
|
+
return this.hoveredSection;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
getRenderRevision(): number {
|
|
353
|
+
return this.renderRevision;
|
|
354
|
+
}
|
|
355
|
+
|
|
347
356
|
setHoveredSection(section: ToolIoSection | null): void {
|
|
348
357
|
if (this.hoveredSection === section) return;
|
|
349
358
|
this.hoveredSection = section;
|
|
@@ -534,6 +543,7 @@ export class ExpandedToolIoView {
|
|
|
534
543
|
}
|
|
535
544
|
|
|
536
545
|
invalidate(): void {
|
|
546
|
+
this.renderRevision++;
|
|
537
547
|
this.cachedWidth = undefined;
|
|
538
548
|
this.cachedLines = undefined;
|
|
539
549
|
}
|
|
@@ -817,6 +827,72 @@ function withIoViewMarkers(
|
|
|
817
827
|
}
|
|
818
828
|
return marked;
|
|
819
829
|
}
|
|
830
|
+
|
|
831
|
+
const TOOL_VIEW_MARKER_RE = /\x1b_cc:v(\d+):([io])\x07/g;
|
|
832
|
+
|
|
833
|
+
export type CapturedIoViewMarker = {
|
|
834
|
+
line: number;
|
|
835
|
+
view: ExpandedToolIoView;
|
|
836
|
+
section: ToolIoSection;
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Removes frame-local IO markers before rendered lines enter a cross-frame cache.
|
|
841
|
+
* The captured view identities let a later frame register fresh marker ids.
|
|
842
|
+
*/
|
|
843
|
+
export function captureIoViewMarkers(lines: string[]): {
|
|
844
|
+
lines: string[];
|
|
845
|
+
markers: CapturedIoViewMarker[];
|
|
846
|
+
} {
|
|
847
|
+
const frame = activeIoViewFrame;
|
|
848
|
+
if (!frame) {
|
|
849
|
+
return { lines, markers: [] };
|
|
850
|
+
}
|
|
851
|
+
const markers: CapturedIoViewMarker[] = [];
|
|
852
|
+
let changed = false;
|
|
853
|
+
const clean = lines.map((line, lineIndex) =>
|
|
854
|
+
line.replace(TOOL_VIEW_MARKER_RE, (marker, rawId, rawSection) => {
|
|
855
|
+
const view = frame.idToView.get(Number(rawId));
|
|
856
|
+
if (!view) {
|
|
857
|
+
return marker;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
changed = true;
|
|
861
|
+
markers.push({
|
|
862
|
+
line: lineIndex,
|
|
863
|
+
view,
|
|
864
|
+
section: rawSection === "i" ? "input" : "output",
|
|
865
|
+
});
|
|
866
|
+
|
|
867
|
+
return "";
|
|
868
|
+
}),
|
|
869
|
+
);
|
|
870
|
+
return { lines: changed ? clean : lines, markers };
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/** Re-registers cached IO views in the active frame and attaches fresh marker ids. */
|
|
874
|
+
export function replayIoViewMarkers(
|
|
875
|
+
lines: string[],
|
|
876
|
+
markers: readonly CapturedIoViewMarker[],
|
|
877
|
+
): string[] {
|
|
878
|
+
if (!activeIoViewFrame || markers.length === 0) {
|
|
879
|
+
return lines;
|
|
880
|
+
}
|
|
881
|
+
const replayed = lines.slice();
|
|
882
|
+
for (const marker of markers) {
|
|
883
|
+
if (marker.line < 0 || marker.line >= replayed.length) {
|
|
884
|
+
continue;
|
|
885
|
+
}
|
|
886
|
+
const id = frameViewId(marker.view);
|
|
887
|
+
if (id === null) {
|
|
888
|
+
continue;
|
|
889
|
+
}
|
|
890
|
+
replayed[marker.line] =
|
|
891
|
+
`${replayed[marker.line]}${toolViewMarker(id, marker.section)}`;
|
|
892
|
+
}
|
|
893
|
+
return replayed;
|
|
894
|
+
}
|
|
895
|
+
|
|
820
896
|
const ioViewInvalidators = new WeakMap<ExpandedToolIoView, () => void>();
|
|
821
897
|
function rememberIoView(context: any, view: ExpandedToolIoView): void {
|
|
822
898
|
if (!context || typeof context !== "object") return;
|
package/package.json
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-one-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A single, customizable Pi UI package with layout-oriented Context and Shell rendering for Pi.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"pi-package",
|
|
9
|
+
"pi-extension",
|
|
10
|
+
"pi",
|
|
11
|
+
"pi-coding-agent",
|
|
12
|
+
"tui"
|
|
13
|
+
],
|
|
7
14
|
"repository": {
|
|
8
15
|
"type": "git",
|
|
9
16
|
"url": "https://github.com/kerolt/pi-one-ui"
|
|
@@ -16,6 +23,8 @@
|
|
|
16
23
|
"extensions",
|
|
17
24
|
"themes",
|
|
18
25
|
"README.md",
|
|
26
|
+
"README.en.md",
|
|
27
|
+
"CHANGELOG.md",
|
|
19
28
|
"LICENSE"
|
|
20
29
|
],
|
|
21
30
|
"scripts": {
|