@hyperdreamer/pi-webui 1.29.0 → 1.30.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
CHANGED
|
@@ -36,7 +36,7 @@ Requirements:
|
|
|
36
36
|
|
|
37
37
|
- Node.js 22.19.0 or newer
|
|
38
38
|
- npm
|
|
39
|
-
- Pi Coding Agent `>=1.
|
|
39
|
+
- Pi Coding Agent `>=1.5.0 <2`, configured for your user
|
|
40
40
|
- git and the development tools your agents need
|
|
41
41
|
|
|
42
42
|
Install PI WEBUI from npm or clone from GitHub:
|
|
@@ -13,6 +13,8 @@ const EXPORT_MAX_BUFFER_BYTES = 1024 * 1024;
|
|
|
13
13
|
*
|
|
14
14
|
* Pi's public package entry point exposes its package directory, while the
|
|
15
15
|
* export CLI is the version-stable interface for rendering a session file.
|
|
16
|
+
* Pi prepares the viewer's tree iteratively, so long linear sessions render
|
|
17
|
+
* without the document needing post-processing here.
|
|
16
18
|
*/
|
|
17
19
|
export async function exportSessionHistoryHtml(sessionFile) {
|
|
18
20
|
const outputDirectory = await mkdtemp(join(tmpdir(), "pi-webui-history-"));
|
|
@@ -28,84 +30,12 @@ export async function exportSessionHistoryHtml(sessionFile) {
|
|
|
28
30
|
},
|
|
29
31
|
maxBuffer: EXPORT_MAX_BUFFER_BYTES,
|
|
30
32
|
});
|
|
31
|
-
return
|
|
33
|
+
return await readFile(outputPath, "utf8");
|
|
32
34
|
}
|
|
33
35
|
finally {
|
|
34
36
|
await rm(outputDirectory, { recursive: true, force: true });
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Pi 0.80's generated viewer uses recursion for tree preparation. Replace
|
|
39
|
-
* those helpers in the generated document so a long linear session remains
|
|
40
|
-
* viewable instead of exhausting the browser call stack.
|
|
41
|
-
*/
|
|
42
|
-
export function patchSessionHistoryExportHtml(html) {
|
|
43
|
-
const normalizeLineEndings = (value) => value.replace(/\r\n/g, "\n");
|
|
44
|
-
const replaceRequired = (source, name, search, replacement) => {
|
|
45
|
-
const normalizedSearch = normalizeLineEndings(search);
|
|
46
|
-
const normalizedReplacement = normalizeLineEndings(replacement);
|
|
47
|
-
const matches = source.split(normalizedSearch).length - 1;
|
|
48
|
-
if (matches !== 1)
|
|
49
|
-
throw new Error(`Failed to patch exported HTML: ${name} expected 1 match, found ${String(matches)}`);
|
|
50
|
-
return source.replace(normalizedSearch, normalizedReplacement);
|
|
51
|
-
};
|
|
52
|
-
let patched = normalizeLineEndings(html);
|
|
53
|
-
patched = replaceRequired(patched, "sortChildren", ` function sortChildren(node) {
|
|
54
|
-
node.children.sort((a, b) =>
|
|
55
|
-
new Date(a.entry.timestamp).getTime() - new Date(b.entry.timestamp).getTime()
|
|
56
|
-
);
|
|
57
|
-
node.children.forEach(sortChildren);
|
|
58
|
-
}`, ` function sortChildren(root) {
|
|
59
|
-
const stack = [root];
|
|
60
|
-
while (stack.length) {
|
|
61
|
-
const node = stack.pop();
|
|
62
|
-
node.children.sort((a, b) =>
|
|
63
|
-
new Date(a.entry.timestamp).getTime() - new Date(b.entry.timestamp).getTime()
|
|
64
|
-
);
|
|
65
|
-
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
66
|
-
stack.push(node.children[i]);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}`);
|
|
70
|
-
patched = replaceRequired(patched, "mapNodes", ` function mapNodes(node) {
|
|
71
|
-
treeNodeMap.set(node.entry.id, node);
|
|
72
|
-
node.children.forEach(mapNodes);
|
|
73
|
-
}
|
|
74
|
-
tree.forEach(mapNodes);`, ` const stack = [...tree].reverse();
|
|
75
|
-
while (stack.length) {
|
|
76
|
-
const node = stack.pop();
|
|
77
|
-
treeNodeMap.set(node.entry.id, node);
|
|
78
|
-
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
79
|
-
stack.push(node.children[i]);
|
|
80
|
-
}
|
|
81
|
-
}`);
|
|
82
|
-
return replaceRequired(patched, "markActive", ` function markActive(node) {
|
|
83
|
-
let has = activePathIds.has(node.entry.id);
|
|
84
|
-
for (const child of node.children) {
|
|
85
|
-
if (markActive(child)) has = true;
|
|
86
|
-
}
|
|
87
|
-
containsActive.set(node, has);
|
|
88
|
-
return has;
|
|
89
|
-
}`, ` function markActive(root) {
|
|
90
|
-
const stack1 = [root];
|
|
91
|
-
const stack2 = [];
|
|
92
|
-
while (stack1.length) {
|
|
93
|
-
const node = stack1.pop();
|
|
94
|
-
stack2.push(node);
|
|
95
|
-
for (const child of node.children) {
|
|
96
|
-
stack1.push(child);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
while (stack2.length) {
|
|
100
|
-
const node = stack2.pop();
|
|
101
|
-
let has = activePathIds.has(node.entry.id);
|
|
102
|
-
for (const child of node.children) {
|
|
103
|
-
if (containsActive.get(child)) has = true;
|
|
104
|
-
}
|
|
105
|
-
containsActive.set(node, has);
|
|
106
|
-
}
|
|
107
|
-
}`);
|
|
108
|
-
}
|
|
109
39
|
function piCliPath() {
|
|
110
40
|
const path = join(getPackageDir(), "dist", "cli.js");
|
|
111
41
|
if (!existsSync(path))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionHistoryExport.js","sourceRoot":"","sources":["../../../src/server/sessions/sessionHistoryExport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,MAAM,QAAQ,GAA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G,OAAO,CAAC,GAAG;gBACd,UAAU,EAAE,GAAG;gBACf,qBAAqB,EAAE,GAAG;aAC3B;YACD,SAAS,EAAE,uBAAuB;SACnC,CAAC,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,eAAe,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAED,SAAS,SAAS;IAChB,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACrD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC1E,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperdreamer/pi-webui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"description": "Web UI for persistent Pi Coding Agent sessions in real workspaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Federico Jaramillo Martinez and HyperDreamer",
|
|
@@ -90,9 +90,9 @@
|
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@changesets/cli": "^2.31.0",
|
|
93
|
-
"@earendil-works/pi-agent-core": "^1.
|
|
94
|
-
"@earendil-works/pi-ai": "^1.
|
|
95
|
-
"@earendil-works/pi-coding-agent": "^1.
|
|
93
|
+
"@earendil-works/pi-agent-core": "^1.5.0",
|
|
94
|
+
"@earendil-works/pi-ai": "^1.5.0",
|
|
95
|
+
"@earendil-works/pi-coding-agent": "^1.5.0",
|
|
96
96
|
"@eslint/js": "^10.0.1",
|
|
97
97
|
"@types/node": "^24.13.3",
|
|
98
98
|
"@types/ws": "^8.18.1",
|
|
@@ -115,7 +115,11 @@
|
|
|
115
115
|
"node": ">=22.19.0"
|
|
116
116
|
},
|
|
117
117
|
"overrides": {
|
|
118
|
+
"@fastify/static": {
|
|
119
|
+
"glob": "^14.0.3"
|
|
120
|
+
},
|
|
118
121
|
"@xmldom/xmldom": "^0.9.12",
|
|
122
|
+
"minimatch": "^11.0.4",
|
|
119
123
|
"undici": "^8.12.3"
|
|
120
124
|
},
|
|
121
125
|
"repository": {
|
|
@@ -128,9 +132,9 @@
|
|
|
128
132
|
"homepage": "https://pi-webui.dev/",
|
|
129
133
|
"packageManager": "npm@11.11.0",
|
|
130
134
|
"peerDependencies": {
|
|
131
|
-
"@earendil-works/pi-agent-core": ">=1.
|
|
132
|
-
"@earendil-works/pi-ai": ">=1.
|
|
133
|
-
"@earendil-works/pi-coding-agent": ">=1.
|
|
135
|
+
"@earendil-works/pi-agent-core": ">=1.5.0 <2",
|
|
136
|
+
"@earendil-works/pi-ai": ">=1.5.0 <2",
|
|
137
|
+
"@earendil-works/pi-coding-agent": ">=1.5.0 <2"
|
|
134
138
|
},
|
|
135
139
|
"keywords": [
|
|
136
140
|
"pi-package",
|