pi-web-ui 0.2.7 → 0.2.9
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.
|
@@ -1309,24 +1309,29 @@ export class ClientSession {
|
|
|
1309
1309
|
const empty = () => this.emit({ type: "path_completions", completions: [] });
|
|
1310
1310
|
try {
|
|
1311
1311
|
const fs = await import("node:fs/promises");
|
|
1312
|
-
const { resolve, sep } = await import("node:path");
|
|
1312
|
+
const { resolve, sep, isAbsolute } = await import("node:path");
|
|
1313
1313
|
const { homedir } = await import("node:os");
|
|
1314
1314
|
const home = homedir();
|
|
1315
|
-
// Expand ~ and relative inputs to an absolute path.
|
|
1315
|
+
// Expand ~ and relative inputs to an absolute path. Windows users type
|
|
1316
|
+
// backslashes (P:\agent) and ~\ — handle both separator styles.
|
|
1316
1317
|
let expanded = input.trim();
|
|
1317
1318
|
if (expanded === "") {
|
|
1318
1319
|
empty();
|
|
1319
1320
|
return;
|
|
1320
1321
|
}
|
|
1321
|
-
if (expanded === "~")
|
|
1322
|
-
expanded =
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1322
|
+
if (expanded === "~" || expanded === "~\\") {
|
|
1323
|
+
expanded = home;
|
|
1324
|
+
}
|
|
1325
|
+
else if (expanded.startsWith("~/") || expanded.startsWith("~\\")) {
|
|
1326
|
+
expanded = home + sep + expanded.slice(2);
|
|
1327
|
+
}
|
|
1328
|
+
else if (!isAbsolute(expanded)) {
|
|
1326
1329
|
expanded = resolve(this.cwd, expanded);
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
+
}
|
|
1331
|
+
// Split into parent dir + prefix on the LAST separator of either style
|
|
1332
|
+
// (Windows accepts both / and \, so P:\agent/de must work too).
|
|
1333
|
+
const lastSlash = Math.max(expanded.lastIndexOf("/"), expanded.lastIndexOf("\\"));
|
|
1334
|
+
const dirPart = lastSlash >= 0 ? expanded.slice(0, lastSlash + 1) : "";
|
|
1330
1335
|
const prefix = lastSlash >= 0 ? expanded.slice(lastSlash + 1) : expanded;
|
|
1331
1336
|
const dirents = await fs
|
|
1332
1337
|
.readdir(dirPart, { withFileTypes: true })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-web-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Web chat interface for the pi coding agent, powered by the pi SDK (@earendil-works/pi-coding-agent) — one-command run, Docker/systemd/launchd deployable",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|