@seqyuan/pidex 0.7.1

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 (277) hide show
  1. package/.next/BUILD_ID +1 -0
  2. package/.next/app-path-routes-manifest.json +32 -0
  3. package/.next/build-manifest.json +20 -0
  4. package/.next/diagnostics/build-diagnostics.json +6 -0
  5. package/.next/diagnostics/framework.json +1 -0
  6. package/.next/export-marker.json +6 -0
  7. package/.next/images-manifest.json +68 -0
  8. package/.next/next-minimal-server.js.nft.json +1 -0
  9. package/.next/next-server.js.nft.json +1 -0
  10. package/.next/package.json +1 -0
  11. package/.next/prerender-manifest.json +138 -0
  12. package/.next/react-loadable-manifest.json +2001 -0
  13. package/.next/required-server-files.js +344 -0
  14. package/.next/required-server-files.json +344 -0
  15. package/.next/routes-manifest.json +242 -0
  16. package/.next/server/app/_global-error/page.js +32 -0
  17. package/.next/server/app/_global-error/page.js.nft.json +1 -0
  18. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -0
  19. package/.next/server/app/_global-error.html +1 -0
  20. package/.next/server/app/_global-error.meta +16 -0
  21. package/.next/server/app/_global-error.rsc +14 -0
  22. package/.next/server/app/_global-error.segments/_full.segment.rsc +14 -0
  23. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +5 -0
  24. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +5 -0
  25. package/.next/server/app/_global-error.segments/_head.segment.rsc +5 -0
  26. package/.next/server/app/_global-error.segments/_index.segment.rsc +5 -0
  27. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
  28. package/.next/server/app/_not-found/page.js +2 -0
  29. package/.next/server/app/_not-found/page.js.nft.json +1 -0
  30. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
  31. package/.next/server/app/_not-found.html +1 -0
  32. package/.next/server/app/_not-found.meta +16 -0
  33. package/.next/server/app/_not-found.rsc +18 -0
  34. package/.next/server/app/_not-found.segments/_full.segment.rsc +18 -0
  35. package/.next/server/app/_not-found.segments/_head.segment.rsc +6 -0
  36. package/.next/server/app/_not-found.segments/_index.segment.rsc +5 -0
  37. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
  38. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +5 -0
  39. package/.next/server/app/_not-found.segments/_tree.segment.rsc +4 -0
  40. package/.next/server/app/api/agent/[id]/events/route.js +3 -0
  41. package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -0
  42. package/.next/server/app/api/agent/[id]/events/route_client-reference-manifest.js +1 -0
  43. package/.next/server/app/api/agent/[id]/route.js +1 -0
  44. package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -0
  45. package/.next/server/app/api/agent/[id]/route_client-reference-manifest.js +1 -0
  46. package/.next/server/app/api/agent/new/route.js +1 -0
  47. package/.next/server/app/api/agent/new/route.js.nft.json +1 -0
  48. package/.next/server/app/api/agent/new/route_client-reference-manifest.js +1 -0
  49. package/.next/server/app/api/auth/all-providers/route.js +1 -0
  50. package/.next/server/app/api/auth/all-providers/route.js.nft.json +1 -0
  51. package/.next/server/app/api/auth/all-providers/route_client-reference-manifest.js +1 -0
  52. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -0
  53. package/.next/server/app/api/auth/api-key/[provider]/route.js.nft.json +1 -0
  54. package/.next/server/app/api/auth/api-key/[provider]/route_client-reference-manifest.js +1 -0
  55. package/.next/server/app/api/auth/login/[provider]/route.js +3 -0
  56. package/.next/server/app/api/auth/login/[provider]/route.js.nft.json +1 -0
  57. package/.next/server/app/api/auth/login/[provider]/route_client-reference-manifest.js +1 -0
  58. package/.next/server/app/api/auth/login/route.js +1 -0
  59. package/.next/server/app/api/auth/login/route.js.nft.json +1 -0
  60. package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -0
  61. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -0
  62. package/.next/server/app/api/auth/logout/[provider]/route.js.nft.json +1 -0
  63. package/.next/server/app/api/auth/logout/[provider]/route_client-reference-manifest.js +1 -0
  64. package/.next/server/app/api/auth/providers/route.js +1 -0
  65. package/.next/server/app/api/auth/providers/route.js.nft.json +1 -0
  66. package/.next/server/app/api/auth/providers/route_client-reference-manifest.js +1 -0
  67. package/.next/server/app/api/auth/status/route.js +1 -0
  68. package/.next/server/app/api/auth/status/route.js.nft.json +1 -0
  69. package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -0
  70. package/.next/server/app/api/default-cwd/route.js +1 -0
  71. package/.next/server/app/api/default-cwd/route.js.nft.json +1 -0
  72. package/.next/server/app/api/default-cwd/route_client-reference-manifest.js +1 -0
  73. package/.next/server/app/api/files/[...path]/route.js +6 -0
  74. package/.next/server/app/api/files/[...path]/route.js.nft.json +1 -0
  75. package/.next/server/app/api/files/[...path]/route_client-reference-manifest.js +1 -0
  76. package/.next/server/app/api/harness/route.js +1 -0
  77. package/.next/server/app/api/harness/route.js.nft.json +1 -0
  78. package/.next/server/app/api/harness/route_client-reference-manifest.js +1 -0
  79. package/.next/server/app/api/home/route.js +1 -0
  80. package/.next/server/app/api/home/route.js.nft.json +1 -0
  81. package/.next/server/app/api/home/route_client-reference-manifest.js +1 -0
  82. package/.next/server/app/api/models/route.js +1 -0
  83. package/.next/server/app/api/models/route.js.nft.json +1 -0
  84. package/.next/server/app/api/models/route_client-reference-manifest.js +1 -0
  85. package/.next/server/app/api/models-config/route.js +1 -0
  86. package/.next/server/app/api/models-config/route.js.nft.json +1 -0
  87. package/.next/server/app/api/models-config/route_client-reference-manifest.js +1 -0
  88. package/.next/server/app/api/models-config/test/route.js +1 -0
  89. package/.next/server/app/api/models-config/test/route.js.nft.json +1 -0
  90. package/.next/server/app/api/models-config/test/route_client-reference-manifest.js +1 -0
  91. package/.next/server/app/api/sessions/[id]/context/route.js +3 -0
  92. package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -0
  93. package/.next/server/app/api/sessions/[id]/context/route_client-reference-manifest.js +1 -0
  94. package/.next/server/app/api/sessions/[id]/route.js +1 -0
  95. package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -0
  96. package/.next/server/app/api/sessions/[id]/route_client-reference-manifest.js +1 -0
  97. package/.next/server/app/api/sessions/new/route.js +1 -0
  98. package/.next/server/app/api/sessions/new/route.js.nft.json +1 -0
  99. package/.next/server/app/api/sessions/new/route_client-reference-manifest.js +1 -0
  100. package/.next/server/app/api/sessions/route.js +3 -0
  101. package/.next/server/app/api/sessions/route.js.nft.json +1 -0
  102. package/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -0
  103. package/.next/server/app/api/skills/install/route.js +1 -0
  104. package/.next/server/app/api/skills/install/route.js.nft.json +1 -0
  105. package/.next/server/app/api/skills/install/route_client-reference-manifest.js +1 -0
  106. package/.next/server/app/api/skills/route.js +6 -0
  107. package/.next/server/app/api/skills/route.js.nft.json +1 -0
  108. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -0
  109. package/.next/server/app/api/skills/search/route.js +1 -0
  110. package/.next/server/app/api/skills/search/route.js.nft.json +1 -0
  111. package/.next/server/app/api/skills/search/route_client-reference-manifest.js +1 -0
  112. package/.next/server/app/api/soul/route.js +1 -0
  113. package/.next/server/app/api/soul/route.js.nft.json +1 -0
  114. package/.next/server/app/api/soul/route_client-reference-manifest.js +1 -0
  115. package/.next/server/app/favicon.ico/route.js +1 -0
  116. package/.next/server/app/favicon.ico/route.js.nft.json +1 -0
  117. package/.next/server/app/favicon.ico.body +0 -0
  118. package/.next/server/app/favicon.ico.meta +1 -0
  119. package/.next/server/app/index.html +1 -0
  120. package/.next/server/app/index.meta +14 -0
  121. package/.next/server/app/index.rsc +17 -0
  122. package/.next/server/app/index.segments/__PAGE__.segment.rsc +6 -0
  123. package/.next/server/app/index.segments/_full.segment.rsc +17 -0
  124. package/.next/server/app/index.segments/_head.segment.rsc +6 -0
  125. package/.next/server/app/index.segments/_index.segment.rsc +5 -0
  126. package/.next/server/app/index.segments/_tree.segment.rsc +4 -0
  127. package/.next/server/app/login/page.js +2 -0
  128. package/.next/server/app/login/page.js.nft.json +1 -0
  129. package/.next/server/app/login/page_client-reference-manifest.js +1 -0
  130. package/.next/server/app/login.html +1 -0
  131. package/.next/server/app/login.meta +15 -0
  132. package/.next/server/app/login.rsc +22 -0
  133. package/.next/server/app/login.segments/_full.segment.rsc +22 -0
  134. package/.next/server/app/login.segments/_head.segment.rsc +6 -0
  135. package/.next/server/app/login.segments/_index.segment.rsc +5 -0
  136. package/.next/server/app/login.segments/_tree.segment.rsc +4 -0
  137. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +9 -0
  138. package/.next/server/app/login.segments/login.segment.rsc +5 -0
  139. package/.next/server/app/page.js +78 -0
  140. package/.next/server/app/page.js.nft.json +1 -0
  141. package/.next/server/app/page_client-reference-manifest.js +1 -0
  142. package/.next/server/app-paths-manifest.json +32 -0
  143. package/.next/server/chunks/13.js +1 -0
  144. package/.next/server/chunks/270.js +45 -0
  145. package/.next/server/chunks/451.js +1 -0
  146. package/.next/server/chunks/601.js +11 -0
  147. package/.next/server/chunks/63.js +45 -0
  148. package/.next/server/chunks/65.js +1 -0
  149. package/.next/server/chunks/741.js +18 -0
  150. package/.next/server/chunks/765.js +1 -0
  151. package/.next/server/chunks/813.js +1 -0
  152. package/.next/server/chunks/818.js +21 -0
  153. package/.next/server/chunks/890.js +1 -0
  154. package/.next/server/chunks/static/media/pdf.worker.min.9df6854a.mjs +6 -0
  155. package/.next/server/edge-runtime-webpack.js +2 -0
  156. package/.next/server/functions-config-manifest.json +4 -0
  157. package/.next/server/interception-route-rewrite-manifest.js +1 -0
  158. package/.next/server/middleware-build-manifest.js +1 -0
  159. package/.next/server/middleware-manifest.json +33 -0
  160. package/.next/server/middleware-react-loadable-manifest.js +1 -0
  161. package/.next/server/middleware.js +10 -0
  162. package/.next/server/next-font-manifest.js +1 -0
  163. package/.next/server/next-font-manifest.json +1 -0
  164. package/.next/server/pages/404.html +1 -0
  165. package/.next/server/pages/500.html +1 -0
  166. package/.next/server/pages-manifest.json +4 -0
  167. package/.next/server/prefetch-hints.json +1 -0
  168. package/.next/server/server-reference-manifest.js +1 -0
  169. package/.next/server/server-reference-manifest.json +1 -0
  170. package/.next/server/webpack-runtime.js +1 -0
  171. package/.next/static/4cEheIqbxWUBO97Ps5M5F/_buildManifest.js +1 -0
  172. package/.next/static/4cEheIqbxWUBO97Ps5M5F/_ssgManifest.js +1 -0
  173. package/.next/static/chunks/2170a4aa.64c6f60c1b2bb8c7.js +1 -0
  174. package/.next/static/chunks/2274.b2d0575b08ee6897.js +21 -0
  175. package/.next/static/chunks/2619.fd64e7a5bd9005d5.js +1 -0
  176. package/.next/static/chunks/363642f4-ce25f2d3ed04b5b0.js +1 -0
  177. package/.next/static/chunks/3794-cd826fc25a17dd0e.js +32 -0
  178. package/.next/static/chunks/4453.8c2a8927cc54fba0.js +1 -0
  179. package/.next/static/chunks/4bd1b696-c2f6e0877b6c10aa.js +1 -0
  180. package/.next/static/chunks/8436.5162d571d476a371.js +1 -0
  181. package/.next/static/chunks/8451.8d75dc2736e37486.js +1 -0
  182. package/.next/static/chunks/9442-cb11613d8f427dd9.js +1 -0
  183. package/.next/static/chunks/9b0008ae.39aee0e01e9a5060.js +45 -0
  184. package/.next/static/chunks/app/_global-error/page-0a1ca827cede6958.js +1 -0
  185. package/.next/static/chunks/app/_not-found/page-874d2953bed86885.js +1 -0
  186. package/.next/static/chunks/app/api/agent/[id]/events/route-0a1ca827cede6958.js +1 -0
  187. package/.next/static/chunks/app/api/agent/[id]/route-0a1ca827cede6958.js +1 -0
  188. package/.next/static/chunks/app/api/agent/new/route-0a1ca827cede6958.js +1 -0
  189. package/.next/static/chunks/app/api/auth/all-providers/route-0a1ca827cede6958.js +1 -0
  190. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-0a1ca827cede6958.js +1 -0
  191. package/.next/static/chunks/app/api/auth/login/[provider]/route-0a1ca827cede6958.js +1 -0
  192. package/.next/static/chunks/app/api/auth/login/route-0a1ca827cede6958.js +1 -0
  193. package/.next/static/chunks/app/api/auth/logout/[provider]/route-0a1ca827cede6958.js +1 -0
  194. package/.next/static/chunks/app/api/auth/providers/route-0a1ca827cede6958.js +1 -0
  195. package/.next/static/chunks/app/api/auth/status/route-0a1ca827cede6958.js +1 -0
  196. package/.next/static/chunks/app/api/default-cwd/route-0a1ca827cede6958.js +1 -0
  197. package/.next/static/chunks/app/api/files/[...path]/route-0a1ca827cede6958.js +1 -0
  198. package/.next/static/chunks/app/api/harness/route-0a1ca827cede6958.js +1 -0
  199. package/.next/static/chunks/app/api/home/route-0a1ca827cede6958.js +1 -0
  200. package/.next/static/chunks/app/api/models/route-0a1ca827cede6958.js +1 -0
  201. package/.next/static/chunks/app/api/models-config/route-0a1ca827cede6958.js +1 -0
  202. package/.next/static/chunks/app/api/models-config/test/route-0a1ca827cede6958.js +1 -0
  203. package/.next/static/chunks/app/api/sessions/[id]/context/route-0a1ca827cede6958.js +1 -0
  204. package/.next/static/chunks/app/api/sessions/[id]/route-0a1ca827cede6958.js +1 -0
  205. package/.next/static/chunks/app/api/sessions/new/route-0a1ca827cede6958.js +1 -0
  206. package/.next/static/chunks/app/api/sessions/route-0a1ca827cede6958.js +1 -0
  207. package/.next/static/chunks/app/api/skills/install/route-0a1ca827cede6958.js +1 -0
  208. package/.next/static/chunks/app/api/skills/route-0a1ca827cede6958.js +1 -0
  209. package/.next/static/chunks/app/api/skills/search/route-0a1ca827cede6958.js +1 -0
  210. package/.next/static/chunks/app/api/soul/route-0a1ca827cede6958.js +1 -0
  211. package/.next/static/chunks/app/layout-d0e5bbbeced158b4.js +1 -0
  212. package/.next/static/chunks/app/login/page-95f1159e5e7ab17d.js +1 -0
  213. package/.next/static/chunks/app/page-84bb14e99a73d680.js +83 -0
  214. package/.next/static/chunks/framework-d1de002210ddaaef.js +1 -0
  215. package/.next/static/chunks/main-073257806f4a040d.js +5 -0
  216. package/.next/static/chunks/main-app-c8e4c59add6378e1.js +1 -0
  217. package/.next/static/chunks/next/dist/client/components/builtin/app-error-0a1ca827cede6958.js +1 -0
  218. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-0a1ca827cede6958.js +1 -0
  219. package/.next/static/chunks/next/dist/client/components/builtin/global-error-2b15d5ed8bc66ea8.js +1 -0
  220. package/.next/static/chunks/next/dist/client/components/builtin/not-found-0a1ca827cede6958.js +1 -0
  221. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-0a1ca827cede6958.js +1 -0
  222. package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  223. package/.next/static/chunks/webpack-3fb0701c42a802b4.js +1 -0
  224. package/.next/static/css/34155409b87f5f75.css +3 -0
  225. package/.next/static/media/15605e25b523335c-s.woff2 +0 -0
  226. package/.next/static/media/1a3dce5cfb5f7760-s.woff2 +0 -0
  227. package/.next/static/media/1cdd02902f937a18-s.woff2 +0 -0
  228. package/.next/static/media/4c4b3b30b6bcb2be-s.woff2 +0 -0
  229. package/.next/static/media/641a7b8a5800ee0e-s.woff2 +0 -0
  230. package/.next/static/media/7deddc85b7ffd1dc-s.p.woff2 +0 -0
  231. package/.next/static/media/ec14413c594b3356-s.p.woff2 +0 -0
  232. package/.next/static/media/pdf.worker.min.5f98222a.mjs +6 -0
  233. package/.next/trace +37 -0
  234. package/.next/trace-build +1 -0
  235. package/.next/types/app/api/agent/[id]/events/route.ts +351 -0
  236. package/.next/types/app/api/agent/[id]/route.ts +351 -0
  237. package/.next/types/app/api/agent/new/route.ts +351 -0
  238. package/.next/types/app/api/auth/all-providers/route.ts +351 -0
  239. package/.next/types/app/api/auth/api-key/[provider]/route.ts +351 -0
  240. package/.next/types/app/api/auth/login/[provider]/route.ts +351 -0
  241. package/.next/types/app/api/auth/login/route.ts +351 -0
  242. package/.next/types/app/api/auth/logout/[provider]/route.ts +351 -0
  243. package/.next/types/app/api/auth/providers/route.ts +351 -0
  244. package/.next/types/app/api/auth/status/route.ts +351 -0
  245. package/.next/types/app/api/default-cwd/route.ts +351 -0
  246. package/.next/types/app/api/files/[...path]/route.ts +351 -0
  247. package/.next/types/app/api/harness/route.ts +351 -0
  248. package/.next/types/app/api/home/route.ts +351 -0
  249. package/.next/types/app/api/models/route.ts +351 -0
  250. package/.next/types/app/api/models-config/route.ts +351 -0
  251. package/.next/types/app/api/models-config/test/route.ts +351 -0
  252. package/.next/types/app/api/sessions/[id]/context/route.ts +351 -0
  253. package/.next/types/app/api/sessions/[id]/route.ts +351 -0
  254. package/.next/types/app/api/sessions/new/route.ts +351 -0
  255. package/.next/types/app/api/sessions/route.ts +351 -0
  256. package/.next/types/app/api/skills/install/route.ts +351 -0
  257. package/.next/types/app/api/skills/route.ts +351 -0
  258. package/.next/types/app/api/skills/search/route.ts +351 -0
  259. package/.next/types/app/api/soul/route.ts +351 -0
  260. package/.next/types/app/layout.ts +87 -0
  261. package/.next/types/app/login/page.ts +87 -0
  262. package/.next/types/app/page.ts +87 -0
  263. package/.next/types/package.json +1 -0
  264. package/.next/types/routes.d.ts +98 -0
  265. package/.next/types/validator.ts +304 -0
  266. package/LICENSE +21 -0
  267. package/README.md +67 -0
  268. package/bin/pi-web.js +160 -0
  269. package/lib/default-soul.md +42 -0
  270. package/lib/visualization-harness.md +92 -0
  271. package/next.config.ts +21 -0
  272. package/package.json +75 -0
  273. package/public/file.svg +1 -0
  274. package/public/globe.svg +1 -0
  275. package/public/next.svg +1 -0
  276. package/public/vercel.svg +1 -0
  277. package/public/window.svg +1 -0
@@ -0,0 +1,98 @@
1
+ // This file is generated automatically by Next.js
2
+ // Do not edit this file manually
3
+
4
+ type AppRoutes = "/" | "/login"
5
+ type AppRouteHandlerRoutes = "/api/agent/[id]" | "/api/agent/[id]/events" | "/api/agent/new" | "/api/auth/all-providers" | "/api/auth/api-key/[provider]" | "/api/auth/login" | "/api/auth/login/[provider]" | "/api/auth/logout/[provider]" | "/api/auth/providers" | "/api/auth/status" | "/api/default-cwd" | "/api/files/[...path]" | "/api/harness" | "/api/home" | "/api/models" | "/api/models-config" | "/api/models-config/test" | "/api/sessions" | "/api/sessions/[id]" | "/api/sessions/[id]/context" | "/api/sessions/new" | "/api/skills" | "/api/skills/install" | "/api/skills/search" | "/api/soul"
6
+ type PageRoutes = never
7
+ type LayoutRoutes = "/"
8
+ type RedirectRoutes = never
9
+ type RewriteRoutes = never
10
+ type Routes = AppRoutes | PageRoutes | LayoutRoutes | RedirectRoutes | RewriteRoutes | AppRouteHandlerRoutes
11
+
12
+
13
+ interface ParamMap {
14
+ "/": {}
15
+ "/api/agent/[id]": { "id": string; }
16
+ "/api/agent/[id]/events": { "id": string; }
17
+ "/api/agent/new": {}
18
+ "/api/auth/all-providers": {}
19
+ "/api/auth/api-key/[provider]": { "provider": string; }
20
+ "/api/auth/login": {}
21
+ "/api/auth/login/[provider]": { "provider": string; }
22
+ "/api/auth/logout/[provider]": { "provider": string; }
23
+ "/api/auth/providers": {}
24
+ "/api/auth/status": {}
25
+ "/api/default-cwd": {}
26
+ "/api/files/[...path]": { "path": string[]; }
27
+ "/api/harness": {}
28
+ "/api/home": {}
29
+ "/api/models": {}
30
+ "/api/models-config": {}
31
+ "/api/models-config/test": {}
32
+ "/api/sessions": {}
33
+ "/api/sessions/[id]": { "id": string; }
34
+ "/api/sessions/[id]/context": { "id": string; }
35
+ "/api/sessions/new": {}
36
+ "/api/skills": {}
37
+ "/api/skills/install": {}
38
+ "/api/skills/search": {}
39
+ "/api/soul": {}
40
+ "/login": {}
41
+ }
42
+
43
+
44
+ export type ParamsOf<Route extends Routes> = ParamMap[Route]
45
+
46
+ interface LayoutSlotMap {
47
+ "/": never
48
+ }
49
+
50
+
51
+ export type { AppRoutes, PageRoutes, LayoutRoutes, RedirectRoutes, RewriteRoutes, ParamMap, AppRouteHandlerRoutes }
52
+
53
+ declare global {
54
+ /**
55
+ * Props for Next.js App Router page components
56
+ * @example
57
+ * ```tsx
58
+ * export default function Page(props: PageProps<'/blog/[slug]'>) {
59
+ * const { slug } = await props.params
60
+ * return <div>Blog post: {slug}</div>
61
+ * }
62
+ * ```
63
+ */
64
+ interface PageProps<AppRoute extends AppRoutes> {
65
+ params: Promise<ParamMap[AppRoute]>
66
+ searchParams: Promise<Record<string, string | string[] | undefined>>
67
+ }
68
+
69
+ /**
70
+ * Props for Next.js App Router layout components
71
+ * @example
72
+ * ```tsx
73
+ * export default function Layout(props: LayoutProps<'/dashboard'>) {
74
+ * return <div>{props.children}</div>
75
+ * }
76
+ * ```
77
+ */
78
+ type LayoutProps<LayoutRoute extends LayoutRoutes> = {
79
+ params: Promise<ParamMap[LayoutRoute]>
80
+ children: React.ReactNode
81
+ } & {
82
+ [K in LayoutSlotMap[LayoutRoute]]: React.ReactNode
83
+ }
84
+
85
+ /**
86
+ * Context for Next.js App Router route handlers
87
+ * @example
88
+ * ```tsx
89
+ * export async function GET(request: NextRequest, context: RouteContext<'/api/users/[id]'>) {
90
+ * const { id } = await context.params
91
+ * return Response.json({ id })
92
+ * }
93
+ * ```
94
+ */
95
+ interface RouteContext<AppRouteHandlerRoute extends AppRouteHandlerRoutes> {
96
+ params: Promise<ParamMap[AppRouteHandlerRoute]>
97
+ }
98
+ }
@@ -0,0 +1,304 @@
1
+ // This file is generated automatically by Next.js
2
+ // Do not edit this file manually
3
+ // This file validates that all pages and layouts export the correct types
4
+
5
+ import type { AppRoutes, LayoutRoutes, ParamMap, AppRouteHandlerRoutes } from "./routes.js"
6
+ import type { ResolvingMetadata, ResolvingViewport } from "next/types.js"
7
+ import type { NextRequest } from 'next/server.js'
8
+
9
+ type AppPageConfig<Route extends AppRoutes = AppRoutes> = {
10
+ default: React.ComponentType<{ params: Promise<ParamMap[Route]> } & any> | ((props: { params: Promise<ParamMap[Route]> } & any) => React.ReactNode | Promise<React.ReactNode> | never | void | Promise<void>)
11
+ generateStaticParams?: (props: { params: ParamMap[Route] }) => Promise<any[]> | any[]
12
+ generateMetadata?: (
13
+ props: { params: Promise<ParamMap[Route]> } & any,
14
+ parent: ResolvingMetadata
15
+ ) => Promise<any> | any
16
+ generateViewport?: (
17
+ props: { params: Promise<ParamMap[Route]> } & any,
18
+ parent: ResolvingViewport
19
+ ) => Promise<any> | any
20
+ metadata?: any
21
+ viewport?: any
22
+ }
23
+
24
+ type LayoutConfig<Route extends LayoutRoutes = LayoutRoutes> = {
25
+ default: React.ComponentType<LayoutProps<Route>> | ((props: LayoutProps<Route>) => React.ReactNode | Promise<React.ReactNode> | never | void | Promise<void>)
26
+ generateStaticParams?: (props: { params: ParamMap[Route] }) => Promise<any[]> | any[]
27
+ generateMetadata?: (
28
+ props: { params: Promise<ParamMap[Route]> } & any,
29
+ parent: ResolvingMetadata
30
+ ) => Promise<any> | any
31
+ generateViewport?: (
32
+ props: { params: Promise<ParamMap[Route]> } & any,
33
+ parent: ResolvingViewport
34
+ ) => Promise<any> | any
35
+ metadata?: any
36
+ viewport?: any
37
+ }
38
+
39
+ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRoutes> = {
40
+ GET?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
41
+ POST?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
42
+ PUT?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
43
+ PATCH?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
44
+ DELETE?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
45
+ HEAD?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
46
+ OPTIONS?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
47
+ }
48
+
49
+
50
+ // Validate ../../app/login/page.tsx
51
+ {
52
+ type __IsExpected<Specific extends AppPageConfig<"/login">> = Specific
53
+ const handler = {} as typeof import("../../app/login/page.js")
54
+ type __Check = __IsExpected<typeof handler>
55
+ // @ts-ignore
56
+ type __Unused = __Check
57
+ }
58
+
59
+ // Validate ../../app/page.tsx
60
+ {
61
+ type __IsExpected<Specific extends AppPageConfig<"/">> = Specific
62
+ const handler = {} as typeof import("../../app/page.js")
63
+ type __Check = __IsExpected<typeof handler>
64
+ // @ts-ignore
65
+ type __Unused = __Check
66
+ }
67
+
68
+ // Validate ../../app/api/agent/[id]/events/route.ts
69
+ {
70
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/agent/[id]/events">> = Specific
71
+ const handler = {} as typeof import("../../app/api/agent/[id]/events/route.js")
72
+ type __Check = __IsExpected<typeof handler>
73
+ // @ts-ignore
74
+ type __Unused = __Check
75
+ }
76
+
77
+ // Validate ../../app/api/agent/[id]/route.ts
78
+ {
79
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/agent/[id]">> = Specific
80
+ const handler = {} as typeof import("../../app/api/agent/[id]/route.js")
81
+ type __Check = __IsExpected<typeof handler>
82
+ // @ts-ignore
83
+ type __Unused = __Check
84
+ }
85
+
86
+ // Validate ../../app/api/agent/new/route.ts
87
+ {
88
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/agent/new">> = Specific
89
+ const handler = {} as typeof import("../../app/api/agent/new/route.js")
90
+ type __Check = __IsExpected<typeof handler>
91
+ // @ts-ignore
92
+ type __Unused = __Check
93
+ }
94
+
95
+ // Validate ../../app/api/auth/all-providers/route.ts
96
+ {
97
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/auth/all-providers">> = Specific
98
+ const handler = {} as typeof import("../../app/api/auth/all-providers/route.js")
99
+ type __Check = __IsExpected<typeof handler>
100
+ // @ts-ignore
101
+ type __Unused = __Check
102
+ }
103
+
104
+ // Validate ../../app/api/auth/api-key/[provider]/route.ts
105
+ {
106
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/auth/api-key/[provider]">> = Specific
107
+ const handler = {} as typeof import("../../app/api/auth/api-key/[provider]/route.js")
108
+ type __Check = __IsExpected<typeof handler>
109
+ // @ts-ignore
110
+ type __Unused = __Check
111
+ }
112
+
113
+ // Validate ../../app/api/auth/login/[provider]/route.ts
114
+ {
115
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/auth/login/[provider]">> = Specific
116
+ const handler = {} as typeof import("../../app/api/auth/login/[provider]/route.js")
117
+ type __Check = __IsExpected<typeof handler>
118
+ // @ts-ignore
119
+ type __Unused = __Check
120
+ }
121
+
122
+ // Validate ../../app/api/auth/login/route.ts
123
+ {
124
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/auth/login">> = Specific
125
+ const handler = {} as typeof import("../../app/api/auth/login/route.js")
126
+ type __Check = __IsExpected<typeof handler>
127
+ // @ts-ignore
128
+ type __Unused = __Check
129
+ }
130
+
131
+ // Validate ../../app/api/auth/logout/[provider]/route.ts
132
+ {
133
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/auth/logout/[provider]">> = Specific
134
+ const handler = {} as typeof import("../../app/api/auth/logout/[provider]/route.js")
135
+ type __Check = __IsExpected<typeof handler>
136
+ // @ts-ignore
137
+ type __Unused = __Check
138
+ }
139
+
140
+ // Validate ../../app/api/auth/providers/route.ts
141
+ {
142
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/auth/providers">> = Specific
143
+ const handler = {} as typeof import("../../app/api/auth/providers/route.js")
144
+ type __Check = __IsExpected<typeof handler>
145
+ // @ts-ignore
146
+ type __Unused = __Check
147
+ }
148
+
149
+ // Validate ../../app/api/auth/status/route.ts
150
+ {
151
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/auth/status">> = Specific
152
+ const handler = {} as typeof import("../../app/api/auth/status/route.js")
153
+ type __Check = __IsExpected<typeof handler>
154
+ // @ts-ignore
155
+ type __Unused = __Check
156
+ }
157
+
158
+ // Validate ../../app/api/default-cwd/route.ts
159
+ {
160
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/default-cwd">> = Specific
161
+ const handler = {} as typeof import("../../app/api/default-cwd/route.js")
162
+ type __Check = __IsExpected<typeof handler>
163
+ // @ts-ignore
164
+ type __Unused = __Check
165
+ }
166
+
167
+ // Validate ../../app/api/files/[...path]/route.ts
168
+ {
169
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/files/[...path]">> = Specific
170
+ const handler = {} as typeof import("../../app/api/files/[...path]/route.js")
171
+ type __Check = __IsExpected<typeof handler>
172
+ // @ts-ignore
173
+ type __Unused = __Check
174
+ }
175
+
176
+ // Validate ../../app/api/harness/route.ts
177
+ {
178
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/harness">> = Specific
179
+ const handler = {} as typeof import("../../app/api/harness/route.js")
180
+ type __Check = __IsExpected<typeof handler>
181
+ // @ts-ignore
182
+ type __Unused = __Check
183
+ }
184
+
185
+ // Validate ../../app/api/home/route.ts
186
+ {
187
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/home">> = Specific
188
+ const handler = {} as typeof import("../../app/api/home/route.js")
189
+ type __Check = __IsExpected<typeof handler>
190
+ // @ts-ignore
191
+ type __Unused = __Check
192
+ }
193
+
194
+ // Validate ../../app/api/models-config/route.ts
195
+ {
196
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/models-config">> = Specific
197
+ const handler = {} as typeof import("../../app/api/models-config/route.js")
198
+ type __Check = __IsExpected<typeof handler>
199
+ // @ts-ignore
200
+ type __Unused = __Check
201
+ }
202
+
203
+ // Validate ../../app/api/models-config/test/route.ts
204
+ {
205
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/models-config/test">> = Specific
206
+ const handler = {} as typeof import("../../app/api/models-config/test/route.js")
207
+ type __Check = __IsExpected<typeof handler>
208
+ // @ts-ignore
209
+ type __Unused = __Check
210
+ }
211
+
212
+ // Validate ../../app/api/models/route.ts
213
+ {
214
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/models">> = Specific
215
+ const handler = {} as typeof import("../../app/api/models/route.js")
216
+ type __Check = __IsExpected<typeof handler>
217
+ // @ts-ignore
218
+ type __Unused = __Check
219
+ }
220
+
221
+ // Validate ../../app/api/sessions/[id]/context/route.ts
222
+ {
223
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/sessions/[id]/context">> = Specific
224
+ const handler = {} as typeof import("../../app/api/sessions/[id]/context/route.js")
225
+ type __Check = __IsExpected<typeof handler>
226
+ // @ts-ignore
227
+ type __Unused = __Check
228
+ }
229
+
230
+ // Validate ../../app/api/sessions/[id]/route.ts
231
+ {
232
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/sessions/[id]">> = Specific
233
+ const handler = {} as typeof import("../../app/api/sessions/[id]/route.js")
234
+ type __Check = __IsExpected<typeof handler>
235
+ // @ts-ignore
236
+ type __Unused = __Check
237
+ }
238
+
239
+ // Validate ../../app/api/sessions/new/route.ts
240
+ {
241
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/sessions/new">> = Specific
242
+ const handler = {} as typeof import("../../app/api/sessions/new/route.js")
243
+ type __Check = __IsExpected<typeof handler>
244
+ // @ts-ignore
245
+ type __Unused = __Check
246
+ }
247
+
248
+ // Validate ../../app/api/sessions/route.ts
249
+ {
250
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/sessions">> = Specific
251
+ const handler = {} as typeof import("../../app/api/sessions/route.js")
252
+ type __Check = __IsExpected<typeof handler>
253
+ // @ts-ignore
254
+ type __Unused = __Check
255
+ }
256
+
257
+ // Validate ../../app/api/skills/install/route.ts
258
+ {
259
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/skills/install">> = Specific
260
+ const handler = {} as typeof import("../../app/api/skills/install/route.js")
261
+ type __Check = __IsExpected<typeof handler>
262
+ // @ts-ignore
263
+ type __Unused = __Check
264
+ }
265
+
266
+ // Validate ../../app/api/skills/route.ts
267
+ {
268
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/skills">> = Specific
269
+ const handler = {} as typeof import("../../app/api/skills/route.js")
270
+ type __Check = __IsExpected<typeof handler>
271
+ // @ts-ignore
272
+ type __Unused = __Check
273
+ }
274
+
275
+ // Validate ../../app/api/skills/search/route.ts
276
+ {
277
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/skills/search">> = Specific
278
+ const handler = {} as typeof import("../../app/api/skills/search/route.js")
279
+ type __Check = __IsExpected<typeof handler>
280
+ // @ts-ignore
281
+ type __Unused = __Check
282
+ }
283
+
284
+ // Validate ../../app/api/soul/route.ts
285
+ {
286
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/soul">> = Specific
287
+ const handler = {} as typeof import("../../app/api/soul/route.js")
288
+ type __Check = __IsExpected<typeof handler>
289
+ // @ts-ignore
290
+ type __Unused = __Check
291
+ }
292
+
293
+
294
+
295
+
296
+
297
+ // Validate ../../app/layout.tsx
298
+ {
299
+ type __IsExpected<Specific extends LayoutConfig<"/">> = Specific
300
+ const handler = {} as typeof import("../../app/layout.js")
301
+ type __Check = __IsExpected<typeof handler>
302
+ // @ts-ignore
303
+ type __Unused = __Check
304
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 agegr
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # pidex
2
+
3
+ [pi ē¼–ēØ‹ę™ŗčƒ½ä½“](https://github.com/badlogic/pi-mono) ēš„ē½‘é”µē•Œé¢ć€‚åœØęµč§ˆå™Øäø­ęµč§ˆä¼ščÆć€äøŽę™ŗčƒ½ä½“åÆ¹čÆć€åˆ†å‰åÆ¹čÆć€åˆ‡ę¢ę¶ˆęÆåˆ†ę”Æć€‚
4
+
5
+ ## åæ«é€Ÿå¼€å§‹
6
+
7
+ ```bash
8
+ npm install -g @seqyuan/pidex
9
+ pidex
10
+ ```
11
+
12
+ åÆåŠØåŽę‰“å¼€ [http://localhost:30141](http://localhost:30141)怂
13
+
14
+ **åÆé€‰å‚ę•°ļ¼š**
15
+
16
+ ```bash
17
+ pidex --port 32321 # č‡Ŗå®šä¹‰ē«Æå£
18
+ pidex --hostname 127.0.0.1 # ä»…ęœ¬ęœŗč®æé—®
19
+ pidex -p 8080 -H 127.0.0.1 # ē»„åˆä½æē”Ø
20
+
21
+ PORT=8080 pidex # ä¹Ÿę”ÆęŒēŽÆå¢ƒå˜é‡
22
+ ```
23
+
24
+ ## åŠŸčƒ½ä»‹ē»
25
+
26
+ - **ä¼ščÆęµč§ˆå™Ø** — ęŒ‰å·„ä½œē›®å½•åˆ†ē»„å±•ē¤ŗę‰€ęœ‰ pi ä¼ščÆ
27
+ - **å®žę—¶åÆ¹čÆ** — é€ščæ‡ SSE ęµå¼č¾“å‡ŗäøŽę™ŗčƒ½ä½“å®žę—¶äŗ¤äŗ’
28
+ - **ä¼ščÆåˆ†å‰** — ä»Žä»»ę„ē”Øęˆ·ę¶ˆęÆåˆ›å»ŗē‹¬ē«‹ēš„ę–°ä¼ščÆåˆ†ę”Æ
29
+ - **ä¼ščÆå†…åˆ†ę”Æ** — å›žé€€åˆ°ä»»ę„čŠ‚ē‚¹ē»§ē»­åÆ¹čÆļ¼ŒåœØåŒäø€ę–‡ä»¶å†…åˆ›å»ŗåˆ†ę”Æ
30
+ - **åˆ†ę”ÆåÆ¼čˆŖå™Ø** — åÆč§†åŒ–åˆ‡ę¢åŒäø€ä¼ščÆå†…ēš„å„äøŖåˆ†ę”Æ
31
+ - **ęØ”åž‹åˆ‡ę¢** — åÆ¹čÆäø­é€”éšę—¶åˆ‡ę¢ęØ”åž‹
32
+ - **å·„å…·é¢ęæ** — ęŽ§åˆ¶ę™ŗčƒ½ä½“åÆä½æē”Øēš„å·„å…·
33
+ - **åŽ‹ē¼©ä¼ščÆ** — åÆ¹é•æä¼ščÆčæ›č”Œę‘˜č¦ļ¼ŒčŠ‚ēœäøŠäø‹ę–‡ēŖ—å£
34
+ - **引导 / 追加** — ę‰“ę–­ę­£åœØčæč”Œēš„ę™ŗčƒ½ä½“ļ¼Œęˆ–åœØå…¶å®ŒęˆåŽčæ½åŠ ę¶ˆęÆ
35
+
36
+ ## ę³Øę„äŗ‹é”¹
37
+
38
+ - **ę•°ę®ē›®å½•** — é»˜č®¤čÆ»å– `~/.pi/agent/sessions` äø‹ēš„ä¼ščÆę–‡ä»¶ć€‚åÆé€ščæ‡ēŽÆå¢ƒå˜é‡ `PI_CODING_AGENT_DIR` ęŒ‡å®šå…¶ä»–ē›®å½•ć€‚
39
+ - **ęØ”åž‹é…ē½®** — ä»Žę™ŗčƒ½ä½“ę•°ę®ē›®å½•äø‹ēš„ `models.json` čÆ»å–åÆē”ØęØ”åž‹ļ¼ŒåÆåœØä¾§č¾¹ę ēš„ć€ŒModelsć€é¢ęæäø­ē¼–č¾‘ć€‚
40
+ - **ę–‡ä»¶ęµč§ˆ** — ä¾§č¾¹ę å†…ē½®ę–‡ä»¶ęµč§ˆå™Øļ¼ŒåÆåœØę ‡ē­¾é”µäø­ęŸ„ēœ‹å½“å‰å·„ä½œē›®å½•äø‹ēš„ę–‡ä»¶ć€‚
41
+
42
+ ## 开发
43
+
44
+ ```bash
45
+ npm install
46
+ npm run dev # ē«Æå£ 30141
47
+ ```
48
+
49
+ ## é”¹ē›®ē»“ęž„
50
+
51
+ ```
52
+ app/
53
+ api/
54
+ sessions/ # čÆ»å†™ä¼ščÆę–‡ä»¶
55
+ agent/ # å‘é€å‘½ä»¤ć€SSE 事件流
56
+ files/ # ę–‡ä»¶å†…å®¹čÆ»å–
57
+ models/ # åÆē”ØęØ”åž‹åˆ—č”ØäøŽé»˜č®¤ęØ”åž‹
58
+ models-config/ # 读写 models.json
59
+ components/ # UI 组件
60
+ lib/
61
+ session-reader.ts # č§£ęž .jsonl ä¼ščÆę–‡ä»¶
62
+ rpc-manager.ts # 箔理 AgentSession ē”Ÿå‘½å‘ØęœŸ
63
+ normalize.ts # č§„čŒƒåŒ– toolCall å­—ę®µå
64
+ types.ts
65
+ ```
66
+
67
+ ä¼ščÆę–‡ä»¶å­˜å‚Øč·Æå¾„ļ¼š`~/.pi/agent/sessions/<ē¼–ē åŽēš„å·„ä½œē›®å½•>/<ę—¶é—“ęˆ³>_<uuid>.jsonl`
package/bin/pi-web.js ADDED
@@ -0,0 +1,160 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
5
+ const { spawn } = require("child_process");
6
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
7
+ const path = require("path");
8
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
9
+ const fs = require("fs");
10
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
11
+ const os = require("os");
12
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
13
+ const readline = require("readline");
14
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
15
+ const { parseArgs } = require("util");
16
+
17
+ const pkgDir = path.join(__dirname, "..");
18
+ const nextDir = path.join(pkgDir, ".next");
19
+
20
+ // Resolve next's CLI entry
21
+ let nextBin;
22
+ try {
23
+ nextBin = require.resolve("next/dist/bin/next", { paths: [pkgDir] });
24
+ } catch {
25
+ try {
26
+ const nextPkg = require.resolve("next/package.json", { paths: [pkgDir] });
27
+ nextBin = path.join(path.dirname(nextPkg), "dist", "bin", "next");
28
+ } catch {
29
+ nextBin = path.join(pkgDir, "node_modules", "next", "dist", "bin", "next");
30
+ }
31
+ }
32
+
33
+ const { values: cliArgs } = parseArgs({
34
+ options: {
35
+ port: { type: "string", short: "p" },
36
+ hostname: { type: "string", short: "H" },
37
+ },
38
+ strict: false,
39
+ });
40
+
41
+ const port = cliArgs.port ?? process.env.PORT ?? "30141";
42
+ const hostname = cliArgs.hostname ?? process.env.HOSTNAME ?? null;
43
+
44
+ // ── Password setup on first start ──
45
+ const authFile = path.join(os.homedir(), ".pi", "agent", "web-auth.json");
46
+
47
+ function promptPassword() {
48
+ return new Promise((resolve) => {
49
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
50
+ const ask = (prompt) => new Promise((res) => rl.question(prompt, res));
51
+ (async () => {
52
+ console.log("\nšŸ” No password set. You can protect pidex with a password.");
53
+ console.log(" Leave empty and press Enter to skip.\n");
54
+ const pw1 = await ask("Enter password: ");
55
+ if (!pw1.trim()) {
56
+ console.log(" Skipped — no password required.\n");
57
+ rl.close();
58
+ resolve(false);
59
+ return;
60
+ }
61
+ const pw2 = await ask("Confirm password: ");
62
+ if (pw1 !== pw2) {
63
+ console.log(" Passwords don't match. Skipping.\n");
64
+ rl.close();
65
+ resolve(false);
66
+ return;
67
+ }
68
+ const bcrypt = require("bcryptjs");
69
+ const hash = bcrypt.hashSync(pw1, 10);
70
+ const dir = path.dirname(authFile);
71
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
72
+ fs.writeFileSync(authFile, JSON.stringify({ passwordHash: hash, enabled: true }, null, 2));
73
+ console.log(" āœ… Password set. Restart won't prompt.\n");
74
+ rl.close();
75
+ resolve(true);
76
+ })();
77
+ });
78
+ }
79
+
80
+ async function maybeSetupAuth() {
81
+ if (fs.existsSync(authFile)) return;
82
+ if (process.env.PIDEX_PASSWORD) {
83
+ const bcrypt = require("bcryptjs");
84
+ const hash = bcrypt.hashSync(process.env.PIDEX_PASSWORD, 10);
85
+ const dir = path.dirname(authFile);
86
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
87
+ fs.writeFileSync(authFile, JSON.stringify({ passwordHash: hash, enabled: true }, null, 2));
88
+ console.log(" šŸ” Password set from PIDEX_PASSWORD env var.");
89
+ return;
90
+ }
91
+ if (!process.stdin.isTTY) return;
92
+ await promptPassword();
93
+ }
94
+
95
+ // ── Seed default soul.md ──
96
+ const defaultSoulSrc = path.join(pkgDir, "lib", "default-soul.md");
97
+ const soulDest = path.join(os.homedir(), ".pi", "agent", "soul.md");
98
+ if (!fs.existsSync(soulDest) && fs.existsSync(defaultSoulSrc)) {
99
+ const dir = path.dirname(soulDest);
100
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
101
+ fs.copyFileSync(defaultSoulSrc, soulDest);
102
+ console.log(" šŸ–– Default soul.md seeded to ~/.pi/agent/soul.md");
103
+ }
104
+
105
+ // ── Seed default harness.md ──
106
+ const defaultHarnessSrc = path.join(pkgDir, "lib", "visualization-harness.md");
107
+ const harnessDest = path.join(os.homedir(), ".pi", "agent", "harness.md");
108
+ if (!fs.existsSync(harnessDest) && fs.existsSync(defaultHarnessSrc)) {
109
+ const dir = path.dirname(harnessDest);
110
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
111
+ fs.copyFileSync(defaultHarnessSrc, harnessDest);
112
+ console.log(" šŸ“Š Default harness.md seeded to ~/.pi/agent/harness.md");
113
+ }
114
+
115
+ // ── Start server ──
116
+ maybeSetupAuth().then(() => {
117
+ if (!fs.existsSync(nextDir)) {
118
+ console.error("Build artifacts not found. Please report this issue.");
119
+ process.exit(1);
120
+ }
121
+
122
+ const nextArgs = ["start", "-p", port];
123
+ if (hostname) nextArgs.push("-H", hostname);
124
+
125
+ const child = spawn(process.execPath, [nextBin, ...nextArgs], {
126
+ cwd: pkgDir,
127
+ stdio: ["inherit", "pipe", "inherit"],
128
+ env: {
129
+ ...process.env,
130
+ PIDEX_AUTH_ENABLED: (() => {
131
+ try {
132
+ if (!fs.existsSync(authFile)) return "0";
133
+ const cfg = JSON.parse(fs.readFileSync(authFile, "utf-8"));
134
+ return cfg.enabled !== false && cfg.passwordHash ? "1" : "0";
135
+ } catch { return "0"; }
136
+ })(),
137
+ },
138
+ });
139
+
140
+ let browserOpened = false;
141
+ const url = `http://${hostname ?? "localhost"}:${port}`;
142
+
143
+ child.stdout.on("data", (chunk) => {
144
+ const text = chunk.toString();
145
+ process.stdout.write(text);
146
+ if (!browserOpened && text.includes("Ready")) {
147
+ browserOpened = true;
148
+ const isWindows = process.platform === "win32";
149
+ const isMac = process.platform === "darwin";
150
+ const openCmd = isWindows ? "start" : isMac ? "open" : "xdg-open";
151
+ const openChild = spawn(openCmd, [url], { shell: isWindows, stdio: "ignore", detached: true });
152
+ openChild.on("error", () => {
153
+ // Browser open failed (e.g., xdg-open not installed) — non-fatal
154
+ });
155
+ openChild.unref();
156
+ }
157
+ });
158
+
159
+ child.on("exit", (code) => process.exit(code ?? 0));
160
+ });