@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.
Files changed (59) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +2 -2
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/required-server-files.js +3 -2
  6. package/.next/required-server-files.json +3 -2
  7. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/_not-found.html +1 -1
  18. package/.next/server/app/_not-found.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  23. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  24. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  25. package/.next/server/app/index.html +1 -1
  26. package/.next/server/app/index.rsc +2 -2
  27. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  28. package/.next/server/app/index.segments/_full.segment.rsc +2 -2
  29. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  30. package/.next/server/app/index.segments/_index.segment.rsc +1 -1
  31. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  32. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  33. package/.next/server/app/login.html +1 -1
  34. package/.next/server/app/login.rsc +1 -1
  35. package/.next/server/app/login.segments/_full.segment.rsc +1 -1
  36. package/.next/server/app/login.segments/_head.segment.rsc +1 -1
  37. package/.next/server/app/login.segments/_index.segment.rsc +1 -1
  38. package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  39. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  40. package/.next/server/app/login.segments/login.segment.rsc +1 -1
  41. package/.next/server/app/page.js +2 -2
  42. package/.next/server/app/page_client-reference-manifest.js +1 -1
  43. package/.next/server/app-paths-manifest.json +2 -2
  44. package/.next/server/middleware-build-manifest.js +1 -1
  45. package/.next/server/middleware-manifest.json +5 -5
  46. package/.next/server/middleware.js +2 -2
  47. package/.next/server/next-font-manifest.js +1 -1
  48. package/.next/server/next-font-manifest.json +1 -1
  49. package/.next/server/pages/404.html +1 -1
  50. package/.next/server/pages/500.html +1 -1
  51. package/.next/server/server-reference-manifest.json +1 -1
  52. package/.next/static/chunks/app/{page-f3f1306513a99a15.js → page-a26778a6748f90f2.js} +2 -2
  53. package/.next/trace +32 -32
  54. package/.next/trace-build +1 -1
  55. package/bin/pi-web.js +130 -3
  56. package/next.config.ts +1 -0
  57. package/package.json +1 -1
  58. /package/.next/static/{kMKtm_i-G3uIvEO8yPr6r → hqrq_k20wyHBgpLiNcetX}/_buildManifest.js +0 -0
  59. /package/.next/static/{kMKtm_i-G3uIvEO8yPr6r → hqrq_k20wyHBgpLiNcetX}/_ssgManifest.js +0 -0
package/.next/trace-build CHANGED
@@ -1 +1 @@
1
- [{"name":"run-webpack","duration":19817475,"timestamp":365654480,"id":14,"parentId":1,"tags":{},"startTime":1780039515015,"traceId":"2a22dad1c0116865"},{"name":"run-typescript","duration":6749769,"timestamp":385477382,"id":3255,"parentId":1,"tags":{},"startTime":1780039534838,"traceId":"2a22dad1c0116865"},{"name":"static-check","duration":1837980,"timestamp":392244448,"id":3258,"parentId":1,"tags":{},"startTime":1780039541605,"traceId":"2a22dad1c0116865"},{"name":"static-generation","duration":3749661,"timestamp":394352556,"id":3324,"parentId":1,"tags":{},"startTime":1780039543713,"traceId":"2a22dad1c0116865"},{"name":"collect-build-traces","duration":42529597,"timestamp":394085920,"id":3321,"parentId":1,"tags":{},"startTime":1780039543446,"traceId":"2a22dad1c0116865"},{"name":"telemetry-flush","duration":62,"timestamp":436618247,"id":3333,"parentId":1,"tags":{},"startTime":1780039585979,"traceId":"2a22dad1c0116865"},{"name":"next-build","duration":71091292,"timestamp":365527031,"id":1,"tags":{"buildMode":"default","version":"16.2.1","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1780039514887,"traceId":"2a22dad1c0116865"}]
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 default soul.md ──
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
@@ -15,6 +15,7 @@ const nextConfig: NextConfig = {
15
15
  env: {
16
16
  NEXT_PUBLIC_APP_VERSION: version,
17
17
  NEXT_PUBLIC_PI_VERSION: piVersion,
18
+ PIDEX_AUTH_ENABLED: process.env.PIDEX_AUTH_ENABLED ?? "0",
18
19
  },
19
20
  };
20
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seqyuan/pidex",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "description": "Web UI for the pi coding agent",
5
5
  "license": "MIT",
6
6
  "bin": {