@seqyuan/pidex 0.7.4 → 0.7.6
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +2 -2
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.js +3 -2
- package/.next/required-server-files.json +3 -2
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +2 -2
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +1 -1
- package/.next/server/app/login.segments/_full.segment.rsc +1 -1
- package/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/.next/server/app/login.segments/_index.segment.rsc +1 -1
- package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/.next/server/app/page.js +2 -2
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +2 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-manifest.json +5 -5
- package/.next/server/middleware.js +2 -2
- package/.next/server/next-font-manifest.js +1 -1
- package/.next/server/next-font-manifest.json +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/app/{page-f3f1306513a99a15.js → page-a26778a6748f90f2.js} +2 -2
- package/.next/trace +32 -32
- package/.next/trace-build +1 -1
- package/bin/pi-web.js +130 -3
- package/next.config.ts +1 -0
- package/package.json +1 -1
- /package/.next/static/{kMKtm_i-G3uIvEO8yPr6r → hqrq_k20wyHBgpLiNcetX}/_buildManifest.js +0 -0
- /package/.next/static/{kMKtm_i-G3uIvEO8yPr6r → hqrq_k20wyHBgpLiNcetX}/_ssgManifest.js +0 -0
package/.next/trace-build
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"name":"run-webpack","duration":
|
|
1
|
+
[{"name":"run-webpack","duration":19189922,"timestamp":63904387,"id":14,"parentId":1,"tags":{},"startTime":1780040164614,"traceId":"f5b0eb494d0328ee"},{"name":"run-typescript","duration":6560256,"timestamp":83100039,"id":3255,"parentId":1,"tags":{},"startTime":1780040183809,"traceId":"f5b0eb494d0328ee"},{"name":"static-check","duration":1808629,"timestamp":89677990,"id":3258,"parentId":1,"tags":{},"startTime":1780040190387,"traceId":"f5b0eb494d0328ee"},{"name":"static-generation","duration":3726622,"timestamp":91751031,"id":3324,"parentId":1,"tags":{},"startTime":1780040192460,"traceId":"f5b0eb494d0328ee"},{"name":"collect-build-traces","duration":41046532,"timestamp":91490958,"id":3321,"parentId":1,"tags":{},"startTime":1780040192200,"traceId":"f5b0eb494d0328ee"},{"name":"telemetry-flush","duration":85,"timestamp":132540985,"id":3333,"parentId":1,"tags":{},"startTime":1780040233250,"traceId":"f5b0eb494d0328ee"},{"name":"next-build","duration":68782592,"timestamp":63758490,"id":1,"tags":{"buildMode":"default","version":"16.2.1","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1780040164468,"traceId":"f5b0eb494d0328ee"}]
|
package/bin/pi-web.js
CHANGED
|
@@ -16,6 +16,9 @@ const { parseArgs } = require("util");
|
|
|
16
16
|
|
|
17
17
|
const pkgDir = path.join(__dirname, "..");
|
|
18
18
|
const nextDir = path.join(pkgDir, ".next");
|
|
19
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(pkgDir, "package.json"), "utf8"));
|
|
20
|
+
const VERSION = pkg.version;
|
|
21
|
+
const PKG_NAME = pkg.name;
|
|
19
22
|
|
|
20
23
|
// Resolve next's CLI entry
|
|
21
24
|
let nextBin;
|
|
@@ -30,14 +33,137 @@ try {
|
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
const { values: cliArgs } = parseArgs({
|
|
36
|
+
const { values: cliArgs, positionals } = parseArgs({
|
|
34
37
|
options: {
|
|
35
38
|
port: { type: "string", short: "p" },
|
|
36
39
|
hostname: { type: "string", short: "H" },
|
|
40
|
+
version: { type: "boolean", short: "v" },
|
|
41
|
+
help: { type: "boolean", short: "h" },
|
|
37
42
|
},
|
|
38
43
|
strict: false,
|
|
44
|
+
allowPositionals: true,
|
|
39
45
|
});
|
|
40
46
|
|
|
47
|
+
// ── CLI commands ──
|
|
48
|
+
|
|
49
|
+
if (cliArgs.version) {
|
|
50
|
+
console.log(VERSION);
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (cliArgs.help) {
|
|
55
|
+
console.log(`pidex v${VERSION} — Web UI for the pi coding agent
|
|
56
|
+
|
|
57
|
+
Usage:
|
|
58
|
+
pidex [options]
|
|
59
|
+
pidex passwd Change password (or set if none)
|
|
60
|
+
pidex passwd --reset Remove password (disable auth)
|
|
61
|
+
pidex update Update to the latest version
|
|
62
|
+
|
|
63
|
+
Options:
|
|
64
|
+
-p, --port <port> Port to listen on (default: 30141, env: PORT)
|
|
65
|
+
-H, --hostname <host> Hostname to bind to (default: localhost)
|
|
66
|
+
-v, --version Print version
|
|
67
|
+
-h, --help Show this help
|
|
68
|
+
|
|
69
|
+
Environment:
|
|
70
|
+
PORT Server port
|
|
71
|
+
PIDEX_PASSWORD Set password on first start
|
|
72
|
+
PI_CODING_AGENT_DIR Custom pi agent data directory
|
|
73
|
+
`);
|
|
74
|
+
process.exit(0);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const firstPos = positionals[0];
|
|
78
|
+
if (firstPos === "update") {
|
|
79
|
+
console.log(`\n Updating ${PKG_NAME} to latest version...\n`);
|
|
80
|
+
const child = spawn(process.execPath, [
|
|
81
|
+
require.resolve("npm/bin/npm-cli.js", { paths: [pkgDir] }) ||
|
|
82
|
+
path.join(path.dirname(process.execPath), "npm"),
|
|
83
|
+
"install", "-g", `${PKG_NAME}@latest`,
|
|
84
|
+
], { stdio: "inherit" });
|
|
85
|
+
child.on("exit", (code) => process.exit(code ?? 0));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (firstPos === "passwd") {
|
|
90
|
+
const bcrypt = require("bcryptjs");
|
|
91
|
+
const reset = positionals[1] === "--reset";
|
|
92
|
+
|
|
93
|
+
if (reset) {
|
|
94
|
+
if (fs.existsSync(authFile)) {
|
|
95
|
+
fs.unlinkSync(authFile);
|
|
96
|
+
console.log(" 🔓 Password removed. Auth disabled.\n");
|
|
97
|
+
} else {
|
|
98
|
+
console.log(" No password configured.\n");
|
|
99
|
+
}
|
|
100
|
+
process.exit(0);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
104
|
+
const ask = (prompt) => new Promise((res) => rl.question(prompt, res));
|
|
105
|
+
(async () => {
|
|
106
|
+
const exists = fs.existsSync(authFile);
|
|
107
|
+
if (exists) {
|
|
108
|
+
console.log("\n Changing password...\n");
|
|
109
|
+
const oldPw = await ask("Current password: ");
|
|
110
|
+
try {
|
|
111
|
+
const cfg = JSON.parse(fs.readFileSync(authFile, "utf8"));
|
|
112
|
+
if (!bcrypt.compareSync(oldPw, cfg.passwordHash)) {
|
|
113
|
+
console.log(" ❌ Incorrect password.\n");
|
|
114
|
+
rl.close();
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
} catch { console.log(" ❌ Could not read auth file.\n"); rl.close(); process.exit(1); }
|
|
118
|
+
}
|
|
119
|
+
const pw1 = await ask("New password (empty to disable): ");
|
|
120
|
+
if (!pw1.trim()) {
|
|
121
|
+
if (fs.existsSync(authFile)) fs.unlinkSync(authFile);
|
|
122
|
+
console.log(" 🔓 Auth disabled.\n");
|
|
123
|
+
rl.close();
|
|
124
|
+
process.exit(0);
|
|
125
|
+
}
|
|
126
|
+
const pw2 = await ask("Confirm new password: ");
|
|
127
|
+
if (pw1 !== pw2) {
|
|
128
|
+
console.log(" ❌ Passwords don't match.\n");
|
|
129
|
+
rl.close();
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
const hash = bcrypt.hashSync(pw1, 10);
|
|
133
|
+
const dir = path.dirname(authFile);
|
|
134
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
135
|
+
fs.writeFileSync(authFile, JSON.stringify({ passwordHash: hash, enabled: true }, null, 2));
|
|
136
|
+
console.log(exists ? " ✅ Password changed.\n" : " ✅ Password set.\n");
|
|
137
|
+
rl.close();
|
|
138
|
+
process.exit(0);
|
|
139
|
+
})();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// ── Version check (async, non-blocking) ──
|
|
144
|
+
|
|
145
|
+
function checkVersion() {
|
|
146
|
+
const https = require("https");
|
|
147
|
+
const req = https.get(`https://registry.npmjs.org/${encodeURIComponent(PKG_NAME)}/latest`, { timeout: 5000 }, (res) => {
|
|
148
|
+
let data = "";
|
|
149
|
+
res.on("data", (chunk) => data += chunk);
|
|
150
|
+
res.on("end", () => {
|
|
151
|
+
try {
|
|
152
|
+
const json = JSON.parse(data);
|
|
153
|
+
const latest = json.version;
|
|
154
|
+
if (latest && latest !== VERSION) {
|
|
155
|
+
console.log(`\n ⚡ Update available: ${VERSION} → ${latest}`);
|
|
156
|
+
console.log(` Run: pidex update\n`);
|
|
157
|
+
}
|
|
158
|
+
} catch { /* ignore */ }
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
req.on("error", () => {});
|
|
162
|
+
req.on("timeout", () => req.destroy());
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ── Normal startup ──
|
|
166
|
+
|
|
41
167
|
const port = cliArgs.port ?? process.env.PORT ?? "30141";
|
|
42
168
|
const hostname = cliArgs.hostname ?? process.env.HOSTNAME ?? null;
|
|
43
169
|
|
|
@@ -92,7 +218,7 @@ async function maybeSetupAuth() {
|
|
|
92
218
|
await promptPassword();
|
|
93
219
|
}
|
|
94
220
|
|
|
95
|
-
// ── Seed
|
|
221
|
+
// ── Seed defaults ──
|
|
96
222
|
const defaultSoulSrc = path.join(pkgDir, "lib", "default-soul.md");
|
|
97
223
|
const soulDest = path.join(os.homedir(), ".pi", "agent", "soul.md");
|
|
98
224
|
if (!fs.existsSync(soulDest) && fs.existsSync(defaultSoulSrc)) {
|
|
@@ -102,7 +228,6 @@ if (!fs.existsSync(soulDest) && fs.existsSync(defaultSoulSrc)) {
|
|
|
102
228
|
console.log(" 🖖 Default soul.md seeded to ~/.pi/agent/soul.md");
|
|
103
229
|
}
|
|
104
230
|
|
|
105
|
-
// ── Seed default harness.md ──
|
|
106
231
|
const defaultHarnessSrc = path.join(pkgDir, "lib", "visualization-harness.md");
|
|
107
232
|
const harnessDest = path.join(os.homedir(), ".pi", "agent", "harness.md");
|
|
108
233
|
if (!fs.existsSync(harnessDest) && fs.existsSync(defaultHarnessSrc)) {
|
|
@@ -119,6 +244,8 @@ if (!fs.existsSync(nextDir)) {
|
|
|
119
244
|
process.exit(1);
|
|
120
245
|
}
|
|
121
246
|
|
|
247
|
+
checkVersion();
|
|
248
|
+
|
|
122
249
|
const nextArgs = ["start", "-p", port];
|
|
123
250
|
if (hostname) nextArgs.push("-H", hostname);
|
|
124
251
|
|
package/next.config.ts
CHANGED
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|