pi-coding-master 0.2.7

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 (304) hide show
  1. package/README.md +50 -0
  2. package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py +80 -0
  3. package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py.CHANGELOG +1 -0
  4. package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py.SPEC +3 -0
  5. package/core/god.agent.capability/hands.dev.writeissue/issue.ts +209 -0
  6. package/core/god.agent.capability/hands.dev.writeissue/issue.ts.SPEC +26 -0
  7. package/core/god.agent.capability/hands.files.changewatcher/watcher.ts +44 -0
  8. package/core/god.agent.capability/hands.files.changewatcher/watcher.ts.SPEC +25 -0
  9. package/core/god.pi.mod/cli/pi-completion.zsh +21 -0
  10. package/core/god.pi.mod/cli/pi-completion.zsh.CHANGELOG +1 -0
  11. package/core/god.pi.mod/cli/pi-people.sh +264 -0
  12. package/core/god.pi.mod/cli/pi-people.sh.LESSON +10 -0
  13. package/core/god.pi.mod/cli/pi-people.sh.SPEC +31 -0
  14. package/core/god.pi.mod/paths.ts +47 -0
  15. package/core/god.pi.mod/tui.mods.blockrender/blockrender.js +90 -0
  16. package/core/god.pi.mod/tui.mods.blockrender/blockrender.js.SPEC +29 -0
  17. package/core/god.pi.mod/tui.mods.footer.budget/budget_guard.ts +154 -0
  18. package/core/god.pi.mod/tui.mods.footer.budget/budget_guard.ts.CHANGELOG +10 -0
  19. package/core/god.pi.mod/tui.mods.footer.budget/budget_guard.ts.LESSON +12 -0
  20. package/core/god.pi.mod/tui.mods.footer.budget/budget_guard.ts.SPEC +26 -0
  21. package/core/god.pi.mod/tui.mods.footer.budget/footer-cny.CHANGELOG +39 -0
  22. package/core/god.pi.mod/tui.mods.viewmode/view_mode-thinking.patch +55 -0
  23. package/core/god.pi.mod/tui.mods.viewmode/view_mode-tools.patch +19 -0
  24. package/core/god.pi.mod/tui.mods.viewmode/view_mode-tools.patch.CHANGELOG +1 -0
  25. package/core/god.pi.mod/tui.mods.viewmode/view_mode.ts +50 -0
  26. package/core/god.pi.mod/tui.mods.viewmode/view_mode.ts.SPEC +12 -0
  27. package/core/god.pi.mod/tui.variants.userterminal/user_terminal.CHANGELOG +10 -0
  28. package/core/god.pi.mod/tui.variants.userterminal/user_terminal.ts +66 -0
  29. package/core/god.pi.mod/tui.variants.userterminal/user_terminal.ts.SPEC +31 -0
  30. package/core/index.ts +3 -0
  31. package/core/individual.bio.gene/dna.coded/coded.dna +257 -0
  32. package/core/individual.bio.gene/dna.coded/coded.dna.CHANGELOG +12 -0
  33. package/core/individual.bio.gene/dna.coded/coded.dna.SPEC +11 -0
  34. package/core/individual.bio.gene/dna.coded/core.dna +110 -0
  35. package/core/individual.bio.gene/dna.promotor/promotor.dna +117 -0
  36. package/core/individual.bio.gene/dna.promotor/promotor.dna.CHANGELOG +4 -0
  37. package/core/individual.bio.gene/dna.promotor/promotor.dna.SPEC +7 -0
  38. package/core/individual.bio.gene/dna.transpiler/transpiler.ts +395 -0
  39. package/core/individual.bio.gene/dna.transpiler/transpiler.ts.CHANGELOG +7 -0
  40. package/core/individual.bio.gene/dna.transpiler/transpiler.ts.SPEC +28 -0
  41. package/core/individual.bio.gene/gene.README +19 -0
  42. package/core/individual.bio.gene/rna/rna.json +536 -0
  43. package/core/individual.bio.gene/rna/rna.json.CHANGELOG +2 -0
  44. package/core/individual.bio.gene/rna/rna.json.SPEC +8 -0
  45. package/core/individual.bio.organs/blood.runtime/messages.ts +236 -0
  46. package/core/individual.bio.organs/blood.runtime/runtime.ts +173 -0
  47. package/core/individual.bio.organs/blood.runtime/runtime.ts.CHANGELOG +5 -0
  48. package/core/individual.bio.organs/blood.runtime/runtime.ts.SPEC +32 -0
  49. package/core/individual.bio.organs/brain.amygdala/amygdala.ts +25 -0
  50. package/core/individual.bio.organs/brain.amygdala/amygdala.ts.COMMENT +3 -0
  51. package/core/individual.bio.organs/brain.amygdala/amygdala.ts.SPEC +9 -0
  52. package/core/individual.bio.organs/brain.hippocampus/hippocampus-launcher.sh.template +108 -0
  53. package/core/individual.bio.organs/brain.hippocampus/hippocampus.ts +166 -0
  54. package/core/individual.bio.organs/brain.hippocampus/hippocampus.ts.CHANGELOG +12 -0
  55. package/core/individual.bio.organs/brain.hippocampus/hippocampus.ts.LESSON +22 -0
  56. package/core/individual.bio.organs/brain.hippocampus/hippocampus.ts.SPEC +16 -0
  57. package/core/individual.bio.organs/brain.hippocampus/memory.ts +879 -0
  58. package/core/individual.bio.organs/brain.hippocampus/memory.ts.CHANGELOG +66 -0
  59. package/core/individual.bio.organs/brain.hippocampus/memory.ts.LESSON +25 -0
  60. package/core/individual.bio.organs/brain.hippocampus/memory.ts.SPEC +46 -0
  61. package/core/individual.bio.organs/brain.hippocampus/sleep.ts +139 -0
  62. package/core/individual.bio.organs/brain.hippocampus/sleep.ts.CHANGELOG +11 -0
  63. package/core/individual.bio.organs/brain.hippocampus/sleep.ts.SPEC +16 -0
  64. package/core/individual.bio.organs/brain.prefrontal.drafting/drafting.SPEC +44 -0
  65. package/core/individual.bio.organs/brain.prefrontal.drafting/drafting.ts +73 -0
  66. package/core/individual.bio.organs/brain.prefrontal.drafting/drafting.ts.CHANGELOG +3 -0
  67. package/core/individual.bio.organs/brain.prefrontal.drafting/drafting.ts.SPEC +24 -0
  68. package/core/individual.bio.organs/brain.prefrontal.drafting/index.ts.CHANGELOG +3 -0
  69. package/core/individual.bio.organs/brain.prefrontal.drafting/main.ts +13 -0
  70. package/core/individual.bio.organs/brain.prefrontal.drafting/main.ts.SPEC +17 -0
  71. package/core/individual.bio.organs/brain.senses.bioclock/bioclock.ts +94 -0
  72. package/core/individual.bio.organs/brain.senses.bioclock/bioclock.ts.LESSON +13 -0
  73. package/core/individual.bio.organs/brain.senses.bioclock/bioclock.ts.SPEC +20 -0
  74. package/core/individual.bio.organs/brain.senses.subconscious/feed-format.SPEC +56 -0
  75. package/core/individual.bio.organs/brain.senses.subconscious/index.ts.CHANGELOG +13 -0
  76. package/core/individual.bio.organs/brain.senses.subconscious/spawner.ts +130 -0
  77. package/core/individual.bio.organs/brain.senses.subconscious/spawner.ts.SPEC +13 -0
  78. package/core/individual.bio.organs/brain.senses.subconscious/subconscious.ts +280 -0
  79. package/core/individual.bio.organs/brain.senses.subconscious/subconscious.ts.CHANGELOG +7 -0
  80. package/core/individual.bio.organs/brain.senses.subconscious/tools.ts +180 -0
  81. package/core/individual.bio.organs/brain.senses.subconscious/tools.ts.SPEC +3 -0
  82. package/core/individual.bio.organs/ears.listen/config.json +9 -0
  83. package/core/individual.bio.organs/ears.listen/config.json.CHANGELOG +1 -0
  84. package/core/individual.bio.organs/ears.listen/config.json.SPEC +3 -0
  85. package/core/individual.bio.organs/ears.listen/ears.ts.CHANGELOG +48 -0
  86. package/core/individual.bio.organs/ears.listen/ears_recorder.py.CHANGELOG +6 -0
  87. package/core/individual.bio.organs/ears.listen/index.ts +1 -0
  88. package/core/individual.bio.organs/ears.listen/index.ts.SPEC +16 -0
  89. package/core/individual.bio.organs/ears.listen/listen.ts +208 -0
  90. package/core/individual.bio.organs/ears.listen/listen.ts.SPEC +3 -0
  91. package/core/individual.bio.organs/ears.listen/listen_recorder.py +445 -0
  92. package/core/individual.bio.organs/ears.listen/listen_recorder.py.SPEC +7 -0
  93. package/core/individual.bio.organs/ears.listen/python_protogen/__init__.py +0 -0
  94. package/core/individual.bio.organs/ears.listen/python_protogen/common/__init__.py +0 -0
  95. package/core/individual.bio.organs/ears.listen/python_protogen/common/events_pb2.py +38 -0
  96. package/core/individual.bio.organs/ears.listen/python_protogen/common/events_pb2_grpc.py +24 -0
  97. package/core/individual.bio.organs/ears.listen/python_protogen/common/rpcmeta_pb2.py +42 -0
  98. package/core/individual.bio.organs/ears.listen/python_protogen/common/rpcmeta_pb2_grpc.py +24 -0
  99. package/core/individual.bio.organs/ears.listen/python_protogen/products/__init__.py +0 -0
  100. package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/__init__.py +0 -0
  101. package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/ast/__init__.py +0 -0
  102. package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/ast/ast_service_pb2.py +45 -0
  103. package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/ast/ast_service_pb2_grpc.py +97 -0
  104. package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/base/__init__.py +0 -0
  105. package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/base/au_base_pb2.py +80 -0
  106. package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/base/au_base_pb2_grpc.py +24 -0
  107. package/core/individual.bio.organs/hands.fileactions/authorize.TRUST +1 -0
  108. package/core/individual.bio.organs/hands.fileactions/authorize.ts +70 -0
  109. package/core/individual.bio.organs/hands.fileactions/authorize.ts.CHANGELOG +1 -0
  110. package/core/individual.bio.organs/hands.fileactions/authorize.ts.SPEC +3 -0
  111. package/core/individual.bio.organs/hands.fileactions/dir.README +13 -0
  112. package/core/individual.bio.organs/hands.fileactions/file_rules.json +23 -0
  113. package/core/individual.bio.organs/hands.fileactions/fileactions.README +12 -0
  114. package/core/individual.bio.organs/hands.fileactions/fileactions.ts +540 -0
  115. package/core/individual.bio.organs/hands.fileactions/fileactions.ts.CHANGELOG +25 -0
  116. package/core/individual.bio.organs/hands.fileactions/fileactions.ts.SPEC +30 -0
  117. package/core/individual.bio.organs/hands.fileactions/filewatch.ts +66 -0
  118. package/core/individual.bio.organs/hands.fileactions/filewatch.ts.SPEC +3 -0
  119. package/core/individual.bio.organs/hands.main/main.ts +18 -0
  120. package/core/individual.bio.organs/hands.main/main.ts.SPEC +20 -0
  121. package/core/individual.bio.organs/hands.sensitive/sensitive.ts +24 -0
  122. package/core/individual.bio.organs/hands.sensitive/sensitive.ts.CHANGELOG +2 -0
  123. package/core/individual.bio.organs/hands.sensitive/sensitive.ts.SPEC +3 -0
  124. package/core/individual.bio.organs/heart.interrupt/agent_start-loader-flicker.patch +13 -0
  125. package/core/individual.bio.organs/heart.interrupt/interactive-mode-loader.patch +11 -0
  126. package/core/individual.bio.organs/heart.interrupt/runner_esc.patch +10 -0
  127. package/core/individual.bio.organs/heart.interrupt/runner_esc.patch.SPEC +9 -0
  128. package/core/individual.bio.organs/heart.kernel/kernel.ts +253 -0
  129. package/core/individual.bio.organs/heart.kernel/kernel.ts.CHANGELOG +13 -0
  130. package/core/individual.bio.organs/heart.kernel/kernel.ts.SPEC +23 -0
  131. package/core/individual.bio.organs/heart.main/heart.main.CHANGELOG +43 -0
  132. package/core/individual.bio.organs/heart.main/heartbeat.ts +494 -0
  133. package/core/individual.bio.organs/heart.main/heartbeat.ts.LESSON +43 -0
  134. package/core/individual.bio.organs/heart.main/main.ts +8 -0
  135. package/core/individual.bio.organs/heart.main/main.ts.SPEC +19 -0
  136. package/core/individual.bio.organs/heart.main/process.ts +122 -0
  137. package/core/individual.bio.organs/heart.main/process.ts.CHANGELOG +2 -0
  138. package/core/individual.bio.organs/heart.main/process.ts.SPEC +24 -0
  139. package/core/individual.bio.organs/heart.main/remove_timeout.patch +110 -0
  140. package/core/individual.bio.organs/heart.main/stop.ts.CHANGELOG +3 -0
  141. package/core/individual.bio.organs/heart.main/stop.ts.SPEC +28 -0
  142. package/core/individual.bio.organs/mouth.speak/index.ts +1 -0
  143. package/core/individual.bio.organs/mouth.speak/index.ts.CHANGELOG +1 -0
  144. package/core/individual.bio.organs/mouth.speak/index.ts.SPEC +6 -0
  145. package/core/individual.bio.organs/mouth.speak/mouth.ts.CHANGELOG +15 -0
  146. package/core/individual.bio.organs/mouth.speak/mouth_recorder.py.CHANGELOG +1 -0
  147. package/core/individual.bio.organs/mouth.speak/speak.ts +180 -0
  148. package/core/individual.bio.organs/mouth.speak/speak.ts.SPEC +3 -0
  149. package/core/individual.bio.organs/mouth.speak/speak_recorder.py +35 -0
  150. package/core/individual.bio.organs/mouth.speak/speak_recorder.py.SPEC +3 -0
  151. package/core/individual.bio.organs/organs.README +110 -0
  152. package/core/package-lock.json +18 -0
  153. package/core/package.json +35 -0
  154. package/core/prompts/prompts.json +77 -0
  155. package/core/prompts/prompts.ts +44 -0
  156. package/core/prompts/prompts.ts.SPEC +9 -0
  157. package/core/society.world/.gitkeep +0 -0
  158. package/core/society.world/accessibility.claudecode/message-service.cjs +217 -0
  159. package/core/society.world/accessibility.claudecode/message-service.cjs.SPEC +7 -0
  160. package/core/society.world/accessibility.claudecode/send.ts +34 -0
  161. package/core/society.world/dollar.distribution.ubi/ubi.ts +55 -0
  162. package/core/society.world/dollar.main/dollar-service.cjs +185 -0
  163. package/core/society.world/dollar.main/main.ts +116 -0
  164. package/core/society.world/dollar.transaction/transaction.ts +71 -0
  165. package/core/society.world/space/space.ts +206 -0
  166. package/core/society.world/space/space.ts.SPEC +30 -0
  167. package/core/technology.laptop/#agent.macos.BLUEPRINT +278 -0
  168. package/core/technology.phone/apps.preinstalled/albums.FUTURE/albums.ts +69 -0
  169. package/core/technology.phone/apps.preinstalled/albums.FUTURE/albums.ts.SPEC +15 -0
  170. package/core/technology.phone/apps.preinstalled/calendar/calendar.ts +406 -0
  171. package/core/technology.phone/apps.preinstalled/calendar/calendar.ts.SPEC +22 -0
  172. package/core/technology.phone/apps.preinstalled/calendar/holiday-calendar.ts +529 -0
  173. package/core/technology.phone/apps.preinstalled/clock/clock.ts +132 -0
  174. package/core/technology.phone/apps.preinstalled/clock/clock.ts.SPEC +11 -0
  175. package/core/technology.phone/apps.preinstalled/contacts.FUTURE/contacts.ts +300 -0
  176. package/core/technology.phone/apps.preinstalled/contacts.FUTURE/contacts.ts.SPEC +22 -0
  177. package/core/technology.phone/apps.preinstalled/developer.FUTURE/developer.ts +22 -0
  178. package/core/technology.phone/apps.preinstalled/developer.FUTURE/developer.ts.SPEC +15 -0
  179. package/core/technology.phone/apps.preinstalled/notes/notes.ts +239 -0
  180. package/core/technology.phone/apps.preinstalled/notes/notes.ts.SPEC +21 -0
  181. package/core/technology.phone/apps.preinstalled/polymarket/polymarket.ts +261 -0
  182. package/core/technology.phone/apps.preinstalled/polymarket/polymarket.ts.SPEC +7 -0
  183. package/core/technology.phone/apps.preinstalled/reminder/reminder.ts +404 -0
  184. package/core/technology.phone/apps.preinstalled/reminder/reminder.ts.SPEC +25 -0
  185. package/core/technology.phone/apps.preinstalled/siri.FUTURE/siri.ts +22 -0
  186. package/core/technology.phone/apps.preinstalled/siri.FUTURE/siri.ts.SPEC +15 -0
  187. package/core/technology.phone/apps.preinstalled/spotlight/spotlight.ts +29 -0
  188. package/core/technology.phone/apps.preinstalled/spotlight/spotlight.ts.SPEC +7 -0
  189. package/core/technology.phone/apps.preinstalled/steam/chess.ts +230 -0
  190. package/core/technology.phone/apps.preinstalled/steam/snake.ts +100 -0
  191. package/core/technology.phone/apps.preinstalled/steam/snake.ts.SPEC +7 -0
  192. package/core/technology.phone/apps.preinstalled/steam/spy-cmd.ts +4 -0
  193. package/core/technology.phone/apps.preinstalled/steam/spy-tool.ts +56 -0
  194. package/core/technology.phone/apps.preinstalled/steam/spy.ts +302 -0
  195. package/core/technology.phone/apps.preinstalled/steam/steam.ts +299 -0
  196. package/core/technology.phone/apps.preinstalled/weather/weather.ts +50 -0
  197. package/core/technology.phone/apps.preinstalled/weather/weather.ts.SPEC +9 -0
  198. package/core/technology.phone/apps.preinstalled/wechat/imessage.ts +423 -0
  199. package/core/technology.phone/apps.preinstalled/wechat/imessage.ts.SPEC +24 -0
  200. package/core/technology.phone/apps.system/appstore/appstore.ts +22 -0
  201. package/core/technology.phone/apps.system/appstore/appstore.ts.SPEC +15 -0
  202. package/core/technology.phone/apps.system/finder.FUTURE/finder.ts +64 -0
  203. package/core/technology.phone/apps.system/finder.FUTURE/finder.ts.SPEC +8 -0
  204. package/core/technology.phone/apps.system/safari/safari-app.ts +146 -0
  205. package/core/technology.phone/apps.system/safari/safari.ts.SPEC +24 -0
  206. package/core/technology.phone/apps.system/settings/settings.ts +126 -0
  207. package/core/technology.phone/apps.system/settings/settings.ts.SPEC +17 -0
  208. package/core/technology.phone/apps.system/tips/tips.ts +22 -0
  209. package/core/technology.phone/apps.system/tips/tips.ts.SPEC +15 -0
  210. package/core/technology.phone/apps.thirdparty/alipay/alipay.ts +148 -0
  211. package/core/technology.phone/apps.thirdparty/alipay/alipay.ts.SPEC +7 -0
  212. package/core/technology.phone/apps.thirdparty/bilibili/bilibili-app.ts +33 -0
  213. package/core/technology.phone/apps.thirdparty/bilibili/bilibili.ts +142 -0
  214. package/core/technology.phone/apps.thirdparty/bilibili/bilibili.ts.SPEC +22 -0
  215. package/core/technology.phone/apps.thirdparty/wechatread/wechatread.ts +80 -0
  216. package/core/technology.phone/apps.thirdparty/wechatread/wechatread.ts.SPEC +15 -0
  217. package/core/technology.phone/index.ts +1 -0
  218. package/core/technology.phone/package.json +2 -0
  219. package/core/technology.phone/system.homepage/homepage.ts +247 -0
  220. package/core/technology.phone/system.homepage/homepage.ts.SPEC +22 -0
  221. package/core/technology.phone/system.kernel/kernel.ts +264 -0
  222. package/core/technology.phone/system.kernel/kernel.ts.SPEC +7 -0
  223. package/core/technology.phone/system.notifications/notifications.ts +87 -0
  224. package/core/technology.phone/system.notifications/notifications.ts.SPEC +7 -0
  225. package/core/technology.phone/system.share/share.ts +46 -0
  226. package/core/technology.phone/system.share/share.ts.SPEC +7 -0
  227. package/core/technology.server/browser-service.cjs +152 -0
  228. package/core/technology.server/data/cookies/arxiv.json +30 -0
  229. package/core/technology.server/data/cookies/bili.json +184 -0
  230. package/core/technology.server/data/cookies/default.json +30 -0
  231. package/core/technology.server/data/cookies/news.json +113 -0
  232. package/core/technology.server/data/cookies/s1.json +45 -0
  233. package/core/technology.server/data/cookies/safari.json +184 -0
  234. package/core/technology.server/data/cookies/safari2.json +1 -0
  235. package/core/technology.server/data/cookies/safaridbg.json +1 -0
  236. package/core/technology.server/data/cookies/search.json +45 -0
  237. package/core/technology.server/data/cookies/sw.json +30 -0
  238. package/core/technology.server/data/cookies/t1.json +1 -0
  239. package/core/technology.server/data/cookies/testread.json +1 -0
  240. package/core/technology.server/data/cookies/video1.json +113 -0
  241. package/core/technology.server/data/cookies/yt.json +170 -0
  242. package/core/technology.server/data/cookies/yt2.json +113 -0
  243. package/core/technology.server/pikipedia/#pikipedia.BLUEPRINT +106 -0
  244. package/core/technology.server/playleft.cjs +247 -0
  245. package/core/technology.server/search-proxy.py +76 -0
  246. package/core/technology.server/server.README +59 -0
  247. package/deploy/dist-overrides/cli/cli.js +18 -0
  248. package/deploy/dist-overrides/core/extensions/loader.js +518 -0
  249. package/deploy/dist-overrides/core/package-manager.js +2081 -0
  250. package/deploy/dist-overrides/core/system-prompt.js +109 -0
  251. package/deploy/dist-overrides/core/system-prompt.js.LESSON +17 -0
  252. package/deploy/dist-overrides/core/tools/bash.js +353 -0
  253. package/deploy/dist-overrides/core/tools/bash.js.CHANGELOG +2 -0
  254. package/deploy/dist-overrides/core/tools/edit-diff.js +345 -0
  255. package/deploy/dist-overrides/core/tools/edit.js +315 -0
  256. package/deploy/dist-overrides/core/tools/edit.js.CHANGELOG +1 -0
  257. package/deploy/dist-overrides/core/tools/file-mutation-queue.js +52 -0
  258. package/deploy/dist-overrides/core/tools/find.js +298 -0
  259. package/deploy/dist-overrides/core/tools/find.js.CHANGELOG +1 -0
  260. package/deploy/dist-overrides/core/tools/grep.js +305 -0
  261. package/deploy/dist-overrides/core/tools/grep.js.CHANGELOG +1 -0
  262. package/deploy/dist-overrides/core/tools/index.js +112 -0
  263. package/deploy/dist-overrides/core/tools/ls-guard.js +4 -0
  264. package/deploy/dist-overrides/core/tools/ls.js +170 -0
  265. package/deploy/dist-overrides/core/tools/ls.js.CHANGELOG +1 -0
  266. package/deploy/dist-overrides/core/tools/output-accumulator.js +184 -0
  267. package/deploy/dist-overrides/core/tools/path-utils.js +99 -0
  268. package/deploy/dist-overrides/core/tools/prompts-reader.js +53 -0
  269. package/deploy/dist-overrides/core/tools/read.js +392 -0
  270. package/deploy/dist-overrides/core/tools/read.js.CHANGELOG +1 -0
  271. package/deploy/dist-overrides/core/tools/render-utils.js +65 -0
  272. package/deploy/dist-overrides/core/tools/tool-definition-wrapper.js +34 -0
  273. package/deploy/dist-overrides/core/tools/truncate.js +215 -0
  274. package/deploy/dist-overrides/core/tools/write.js +203 -0
  275. package/deploy/dist-overrides/core/tools/write.js.CHANGELOG +1 -0
  276. package/deploy/dist-overrides/dist-overrides.README +18 -0
  277. package/deploy/dist-overrides/main.js +665 -0
  278. package/deploy/dist-overrides/modes/interactive/components/assistant-message.js +139 -0
  279. package/deploy/dist-overrides/modes/interactive/components/footer.js +326 -0
  280. package/deploy/dist-overrides/modes/interactive/components/model-selector.js +285 -0
  281. package/deploy/dist-overrides/modes/interactive/components/tool-execution.js +383 -0
  282. package/deploy/dist-overrides/modes/interactive/components/tool-execution.js.CHANGELOG +3 -0
  283. package/deploy/dist-overrides/modes/interactive/interactive-mode.js +4781 -0
  284. package/deploy/dist-overrides/pi-ai/providers/anthropic.js +931 -0
  285. package/deploy/dist-overrides/pi-ai/providers/openai-completions.js +1007 -0
  286. package/deploy/dist-overrides/pi-ai/providers/openai-completions.js.LESSON +15 -0
  287. package/deploy/dist-overrides/pi-tui/components/loader.js +69 -0
  288. package/deploy/dist-overrides/pi-tui/components/markdown.js +646 -0
  289. package/deploy/dist-overrides/pi-tui/components/text.js +92 -0
  290. package/deploy/dist-overrides/pi-tui/custom-message.js +75 -0
  291. package/deploy/dist-overrides/pi-tui/tui.js +1266 -0
  292. package/deploy/dist-overrides/pi-tui/utils.js +1060 -0
  293. package/deploy/dist-overrides/vendor.REMOVED/jiti/lib/jiti.mjs +3 -0
  294. package/deploy/install.sh +186 -0
  295. package/deploy/install.sh.CHANGELOG +6 -0
  296. package/deploy/lint/lint-naming.ts +202 -0
  297. package/deploy/scripts/apply.js +18 -0
  298. package/deploy/scripts/build-github.sh +219 -0
  299. package/deploy/scripts/build-phone.sh +24 -0
  300. package/deploy/scripts/check-deploy.sh +42 -0
  301. package/deploy/scripts/migrate-context.sh +72 -0
  302. package/deploy/scripts/patch-pi-dist.js +39 -0
  303. package/deploy/scripts/uninstall.sh +34 -0
  304. package/package.json +18 -0
@@ -0,0 +1,215 @@
1
+ /**
2
+ * Shared truncation utilities for tool outputs.
3
+ *
4
+ * Truncation is based on two independent limits - whichever is hit first wins:
5
+ * - Line limit (default: 2000 lines)
6
+ * - Byte limit (default: 50KB)
7
+ *
8
+ * Never returns partial lines (except bash tail truncation edge case).
9
+ */
10
+ export const DEFAULT_MAX_LINES = 2000;
11
+ export const DEFAULT_MAX_BYTES = 50 * 1024; // 50KB
12
+ export const GREP_MAX_LINE_LENGTH = 500; // Max chars per grep match line
13
+ function splitLinesForCounting(content) {
14
+ if (content.length === 0) {
15
+ return [];
16
+ }
17
+ const lines = content.split("\n");
18
+ if (content.endsWith("\n")) {
19
+ lines.pop();
20
+ }
21
+ return lines;
22
+ }
23
+ /**
24
+ * Format bytes as human-readable size.
25
+ */
26
+ export function formatSize(bytes) {
27
+ if (bytes < 1024) {
28
+ return `${bytes}B`;
29
+ }
30
+ else if (bytes < 1024 * 1024) {
31
+ return `${(bytes / 1024).toFixed(1)}KB`;
32
+ }
33
+ else {
34
+ return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
35
+ }
36
+ }
37
+ /**
38
+ * Truncate content from the head (keep first N lines/bytes).
39
+ * Suitable for file reads where you want to see the beginning.
40
+ *
41
+ * Never returns partial lines. If first line exceeds byte limit,
42
+ * returns empty content with firstLineExceedsLimit=true.
43
+ */
44
+ export function truncateHead(content, options = {}) {
45
+ const maxLines = options.maxLines ?? DEFAULT_MAX_LINES;
46
+ const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
47
+ const totalBytes = Buffer.byteLength(content, "utf-8");
48
+ const lines = splitLinesForCounting(content);
49
+ const totalLines = lines.length;
50
+ // Check if no truncation needed
51
+ if (totalLines <= maxLines && totalBytes <= maxBytes) {
52
+ return {
53
+ content,
54
+ truncated: false,
55
+ truncatedBy: null,
56
+ totalLines,
57
+ totalBytes,
58
+ outputLines: totalLines,
59
+ outputBytes: totalBytes,
60
+ lastLinePartial: false,
61
+ firstLineExceedsLimit: false,
62
+ maxLines,
63
+ maxBytes,
64
+ };
65
+ }
66
+ // Check if first line alone exceeds byte limit
67
+ const firstLineBytes = Buffer.byteLength(lines[0], "utf-8");
68
+ if (firstLineBytes > maxBytes) {
69
+ return {
70
+ content: "",
71
+ truncated: true,
72
+ truncatedBy: "bytes",
73
+ totalLines,
74
+ totalBytes,
75
+ outputLines: 0,
76
+ outputBytes: 0,
77
+ lastLinePartial: false,
78
+ firstLineExceedsLimit: true,
79
+ maxLines,
80
+ maxBytes,
81
+ };
82
+ }
83
+ // Collect complete lines that fit
84
+ const outputLinesArr = [];
85
+ let outputBytesCount = 0;
86
+ let truncatedBy = "lines";
87
+ for (let i = 0; i < lines.length && i < maxLines; i++) {
88
+ const line = lines[i];
89
+ const lineBytes = Buffer.byteLength(line, "utf-8") + (i > 0 ? 1 : 0); // +1 for newline
90
+ if (outputBytesCount + lineBytes > maxBytes) {
91
+ truncatedBy = "bytes";
92
+ break;
93
+ }
94
+ outputLinesArr.push(line);
95
+ outputBytesCount += lineBytes;
96
+ }
97
+ // If we exited due to line limit
98
+ if (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {
99
+ truncatedBy = "lines";
100
+ }
101
+ const outputContent = outputLinesArr.join("\n");
102
+ const finalOutputBytes = Buffer.byteLength(outputContent, "utf-8");
103
+ return {
104
+ content: outputContent,
105
+ truncated: true,
106
+ truncatedBy,
107
+ totalLines,
108
+ totalBytes,
109
+ outputLines: outputLinesArr.length,
110
+ outputBytes: finalOutputBytes,
111
+ lastLinePartial: false,
112
+ firstLineExceedsLimit: false,
113
+ maxLines,
114
+ maxBytes,
115
+ };
116
+ }
117
+ /**
118
+ * Truncate content from the tail (keep last N lines/bytes).
119
+ * Suitable for bash output where you want to see the end (errors, final results).
120
+ *
121
+ * May return partial first line if the last line of original content exceeds byte limit.
122
+ */
123
+ export function truncateTail(content, options = {}) {
124
+ const maxLines = options.maxLines ?? DEFAULT_MAX_LINES;
125
+ const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
126
+ const totalBytes = Buffer.byteLength(content, "utf-8");
127
+ const lines = splitLinesForCounting(content);
128
+ const totalLines = lines.length;
129
+ // Check if no truncation needed
130
+ if (totalLines <= maxLines && totalBytes <= maxBytes) {
131
+ return {
132
+ content,
133
+ truncated: false,
134
+ truncatedBy: null,
135
+ totalLines,
136
+ totalBytes,
137
+ outputLines: totalLines,
138
+ outputBytes: totalBytes,
139
+ lastLinePartial: false,
140
+ firstLineExceedsLimit: false,
141
+ maxLines,
142
+ maxBytes,
143
+ };
144
+ }
145
+ // Work backwards from the end
146
+ const outputLinesArr = [];
147
+ let outputBytesCount = 0;
148
+ let truncatedBy = "lines";
149
+ let lastLinePartial = false;
150
+ for (let i = lines.length - 1; i >= 0 && outputLinesArr.length < maxLines; i--) {
151
+ const line = lines[i];
152
+ const lineBytes = Buffer.byteLength(line, "utf-8") + (outputLinesArr.length > 0 ? 1 : 0); // +1 for newline
153
+ if (outputBytesCount + lineBytes > maxBytes) {
154
+ truncatedBy = "bytes";
155
+ // Edge case: if we haven't added ANY lines yet and this line exceeds maxBytes,
156
+ // take the end of the line (partial)
157
+ if (outputLinesArr.length === 0) {
158
+ const truncatedLine = truncateStringToBytesFromEnd(line, maxBytes);
159
+ outputLinesArr.unshift(truncatedLine);
160
+ outputBytesCount = Buffer.byteLength(truncatedLine, "utf-8");
161
+ lastLinePartial = true;
162
+ }
163
+ break;
164
+ }
165
+ outputLinesArr.unshift(line);
166
+ outputBytesCount += lineBytes;
167
+ }
168
+ // If we exited due to line limit
169
+ if (outputLinesArr.length >= maxLines && outputBytesCount <= maxBytes) {
170
+ truncatedBy = "lines";
171
+ }
172
+ const outputContent = outputLinesArr.join("\n");
173
+ const finalOutputBytes = Buffer.byteLength(outputContent, "utf-8");
174
+ return {
175
+ content: outputContent,
176
+ truncated: true,
177
+ truncatedBy,
178
+ totalLines,
179
+ totalBytes,
180
+ outputLines: outputLinesArr.length,
181
+ outputBytes: finalOutputBytes,
182
+ lastLinePartial,
183
+ firstLineExceedsLimit: false,
184
+ maxLines,
185
+ maxBytes,
186
+ };
187
+ }
188
+ /**
189
+ * Truncate a string to fit within a byte limit (from the end).
190
+ * Handles multi-byte UTF-8 characters correctly.
191
+ */
192
+ function truncateStringToBytesFromEnd(str, maxBytes) {
193
+ const buf = Buffer.from(str, "utf-8");
194
+ if (buf.length <= maxBytes) {
195
+ return str;
196
+ }
197
+ // Start from the end, skip maxBytes back
198
+ let start = buf.length - maxBytes;
199
+ // Find a valid UTF-8 boundary (start of a character)
200
+ while (start < buf.length && (buf[start] & 0xc0) === 0x80) {
201
+ start++;
202
+ }
203
+ return buf.slice(start).toString("utf-8");
204
+ }
205
+ /**
206
+ * Truncate a single line to max characters, adding [truncated] suffix.
207
+ * Used for grep match lines.
208
+ */
209
+ export function truncateLine(line, maxChars = GREP_MAX_LINE_LENGTH) {
210
+ if (line.length <= maxChars) {
211
+ return { text: line, wasTruncated: false };
212
+ }
213
+ return { text: `${line.slice(0, maxChars)}... [truncated]`, wasTruncated: true };
214
+ }
215
+ //# sourceMappingURL=truncate.js.map
@@ -0,0 +1,203 @@
1
+ import { Container, Text } from "@earendil-works/pi-tui";
2
+ import { mkdir as fsMkdir, writeFile as fsWriteFile } from "fs/promises";
3
+ import { existsSync } from "node:fs";
4
+ import { dirname } from "path";
5
+ import { Type } from "typebox";
6
+ import { getToolPrompt } from "./prompts-reader.js";
7
+ import { keyHint } from "../../modes/interactive/components/keybinding-hints.js";
8
+ import { getLanguageFromPath, highlightCode } from "../../modes/interactive/theme/theme.js";
9
+ import { withFileMutationQueue } from "./file-mutation-queue.js";
10
+ import { resolveToCwd } from "./path-utils.js";
11
+ import { isLsed, clearLs } from "./ls-guard.js";
12
+ import { normalizeDisplayText, renderToolPath, replaceTabs, str } from "./render-utils.js";
13
+ import { wrapToolDefinition } from "./tool-definition-wrapper.js";
14
+ const writeSchema = Type.Object({
15
+ path: Type.String({ messageDescription: "Path to the file to write (relative or absolute)" }),
16
+ content: Type.String({ messageDescription: "Content to write to the file" }),
17
+ });
18
+ const defaultWriteOperations = {
19
+ writeFile: (path, content) => fsWriteFile(path, content, "utf-8"),
20
+ mkdir: (dir) => fsMkdir(dir, { recursive: true }).then(() => { }),
21
+ };
22
+ class WriteCallRenderComponent extends Text {
23
+ cache;
24
+ constructor() {
25
+ super("", 0, 0);
26
+ }
27
+ }
28
+ const Write_PARTIAL_FULL_HIGHLIGHT_LINES = 50;
29
+ function highlightSingleLine(line, lang) {
30
+ const highlighted = highlightCode(line, lang);
31
+ return highlighted[0] ?? "";
32
+ }
33
+ function refreshWriteHighlightPrefix(cache) {
34
+ const prefixCount = Math.min(Write_PARTIAL_FULL_HIGHLIGHT_LINES, cache.normalizedLines.length);
35
+ if (prefixCount === 0)
36
+ return;
37
+ const prefixSource = cache.normalizedLines.slice(0, prefixCount).join("\n");
38
+ const prefixHighlighted = highlightCode(prefixSource, cache.lang);
39
+ for (let i = 0; i < prefixCount; i++) {
40
+ cache.highlightedLines[i] =
41
+ prefixHighlighted[i] ?? highlightSingleLine(cache.normalizedLines[i] ?? "", cache.lang);
42
+ }
43
+ }
44
+ function rebuildWriteHighlightCacheFull(rawPath, fileContent) {
45
+ const lang = rawPath ? getLanguageFromPath(rawPath) : undefined;
46
+ if (!lang)
47
+ return undefined;
48
+ const displayContent = normalizeDisplayText(fileContent);
49
+ const normalized = replaceTabs(displayContent);
50
+ return {
51
+ rawPath,
52
+ lang,
53
+ rawContent: fileContent,
54
+ normalizedLines: normalized.split("\n"),
55
+ highlightedLines: highlightCode(normalized, lang),
56
+ };
57
+ }
58
+ function updateWriteHighlightCacheIncremental(cache, rawPath, fileContent) {
59
+ const lang = rawPath ? getLanguageFromPath(rawPath) : undefined;
60
+ if (!lang)
61
+ return undefined;
62
+ if (!cache)
63
+ return rebuildWriteHighlightCacheFull(rawPath, fileContent);
64
+ if (cache.lang !== lang || cache.rawPath !== rawPath)
65
+ return rebuildWriteHighlightCacheFull(rawPath, fileContent);
66
+ if (!fileContent.startsWith(cache.rawContent))
67
+ return rebuildWriteHighlightCacheFull(rawPath, fileContent);
68
+ if (fileContent.length === cache.rawContent.length)
69
+ return cache;
70
+ const deltaRaw = fileContent.slice(cache.rawContent.length);
71
+ const deltaDisplay = normalizeDisplayText(deltaRaw);
72
+ const deltaNormalized = replaceTabs(deltaDisplay);
73
+ cache.rawContent = fileContent;
74
+ if (cache.normalizedLines.length === 0) {
75
+ cache.normalizedLines.push("");
76
+ cache.highlightedLines.push("");
77
+ }
78
+ const segments = deltaNormalized.split("\n");
79
+ const lastIndex = cache.normalizedLines.length - 1;
80
+ cache.normalizedLines[lastIndex] += segments[0];
81
+ cache.highlightedLines[lastIndex] = highlightSingleLine(cache.normalizedLines[lastIndex], cache.lang);
82
+ for (let i = 1; i < segments.length; i++) {
83
+ cache.normalizedLines.push(segments[i]);
84
+ cache.highlightedLines.push(highlightSingleLine(segments[i], cache.lang));
85
+ }
86
+ refreshWriteHighlightPrefix(cache);
87
+ return cache;
88
+ }
89
+ function trimTrailingEmptyLines(lines) {
90
+ let end = lines.length;
91
+ while (end > 0 && lines[end - 1] === "") {
92
+ end--;
93
+ }
94
+ return lines.slice(0, end);
95
+ }
96
+ function formatWriteCall(args, options, theme, cache, cwd) {
97
+ const rawPath = str(args?.file_path ?? args?.path);
98
+ const fileContent = str(args?.content);
99
+ const pathDisplay = renderToolPath(rawPath, theme, cwd);
100
+ let text = `${theme.fg("toolTitle", "● " + theme.bold("Write"))} ${pathDisplay}`;
101
+ if (fileContent === null) {
102
+ text += `\n\n${theme.fg("error", "[invalid content arg - expected string]")}`;
103
+ }
104
+ else if (fileContent) {
105
+ const lang = rawPath ? getLanguageFromPath(rawPath) : undefined;
106
+ const renderedLines = lang
107
+ ? (cache?.highlightedLines ?? highlightCode(replaceTabs(normalizeDisplayText(fileContent)), lang))
108
+ : normalizeDisplayText(fileContent).split("\n");
109
+ const lines = trimTrailingEmptyLines(renderedLines);
110
+ const totalLines = lines.length;
111
+ const maxLines = options.expanded ? lines.length : 10;
112
+ const displayLines = lines.slice(0, maxLines);
113
+ const remaining = lines.length - maxLines;
114
+ text += `\n\n${displayLines.map((line) => (lang ? line : theme.fg("toolOutput", replaceTabs(line)))).join("\n")}`;
115
+ if (remaining > 0) {
116
+ text += `${theme.fg("muted", `\n... (${remaining} more lines, ${totalLines} total,`)} ${keyHint("app.tools.expand", "to expand")}${theme.fg("muted", ")")}`;
117
+ }
118
+ }
119
+ return text;
120
+ }
121
+ function formatWriteResult(result, theme) {
122
+ if (!result.isError) {
123
+ return undefined;
124
+ }
125
+ const output = result.content
126
+ .filter((c) => c.type === "text")
127
+ .map((c) => c.text || "")
128
+ .join("\n");
129
+ if (!output) {
130
+ return undefined;
131
+ }
132
+ return `\n${theme.fg("error", output)}`;
133
+ }
134
+ export function createWriteToolDefinition(cwd, options) {
135
+ const ops = options?.operations ?? defaultWriteOperations;
136
+ return {
137
+ name: "write",
138
+ label: "write",
139
+ messageDescription: getToolPrompt('write', 'messageDescription') || '',
140
+ promptSnippet: getToolPrompt('write', 'snippet'),
141
+ promptGuidelines: getToolPrompt('write', 'guidelines'),
142
+ parameters: writeSchema,
143
+ async execute(_toolCallId, { path, content }, signal, _onUpdate, _ctx) {
144
+ const absolutePath = resolveToCwd(path, cwd);
145
+ if (/node_modules[\/]@earendil-works/.test(absolutePath)) throw new Error("Error: 禁止直接编辑 node_modules/@earendil-works!改动会被 npm 重装冲掉。正确做法:修改源码 → 放到 dist-overrides/ → install.sh 部署。");
146
+ // ls check disabled — too annoying for the model
147
+ if (existsSync(absolutePath)) throw new Error("Error: file already exists. Use edit to modify existing files.");
148
+ const dir = dirname(absolutePath);
149
+ return withFileMutationQueue(absolutePath, async () => {
150
+ // Do not reject from an abort event listener here: that would release the
151
+ // mutation queue while an in-flight filesystem operation may still finish.
152
+ // Checking signal.aborted after each await observes the same aborts while
153
+ // keeping the queue locked until the current operation has settled.
154
+ const throwIfAborted = () => {
155
+ if (signal?.aborted)
156
+ throw new Error("Operation aborted");
157
+ };
158
+ throwIfAborted();
159
+ // Create parent directories if needed.
160
+ await ops.mkdir(dir);
161
+ throwIfAborted();
162
+ // Write the file contents.
163
+ await ops.writeFile(absolutePath, content);
164
+ throwIfAborted();
165
+ return {
166
+ content: [{ type: "text", text: `Successfully wrote ${content.length} bytes to ${path}` }],
167
+ details: undefined,
168
+ };
169
+ });
170
+ },
171
+ renderCall(args, theme, context) {
172
+ const renderArgs = args;
173
+ const rawPath = str(renderArgs?.file_path ?? renderArgs?.path);
174
+ const fileContent = str(renderArgs?.content);
175
+ const component = context.lastComponent ?? new WriteCallRenderComponent();
176
+ if (fileContent !== null) {
177
+ component.cache = context.argsComplete
178
+ ? rebuildWriteHighlightCacheFull(rawPath, fileContent)
179
+ : updateWriteHighlightCacheIncremental(component.cache, rawPath, fileContent);
180
+ }
181
+ else {
182
+ component.cache = undefined;
183
+ }
184
+ component.setText(formatWriteCall(renderArgs, { expanded: context.expanded, isPartial: context.isPartial }, theme, component.cache, context.cwd));
185
+ return component;
186
+ },
187
+ renderResult(result, _options, theme, context) {
188
+ const output = formatWriteResult({ ...result, isError: context.isError }, theme);
189
+ if (!output) {
190
+ const component = context.lastComponent ?? new Container();
191
+ component.clear();
192
+ return component;
193
+ }
194
+ const text = context.lastComponent ?? new Text("", 2, 0);
195
+ text.setText(output);
196
+ return text;
197
+ },
198
+ };
199
+ }
200
+ export function createWriteTool(cwd, options) {
201
+ return wrapToolDefinition(createWriteToolDefinition(cwd, options));
202
+ }
203
+ //# sourceMappingURL=write.js.map
@@ -0,0 +1 @@
1
+ [2026-06-19] 工具名首字母大写
@@ -0,0 +1,18 @@
1
+ # dist-overrides — pi/pi-ai 的 node_modules 定制(golden 副本)
2
+
3
+ 这些是对 pi 自身 dist(不在 pi-coding-master 扩展里、也没有 TS 源)的改动。`npm i -g pi` 重装会覆盖它们,
4
+ 所以把【改好的整文件】存在这里当 golden,`install.sh` 在版本校验(pin 0.79.1)通过后整文件 `cp` 回去。
5
+
6
+ | golden 文件 | 覆盖到的 dist 路径 | 改了什么 |
7
+ |---|---|---|
8
+ | `footer.js` | `<pi-dist>/modes/interactive/components/footer.js` | $→¥、加真实余额 + ↓¥/min、分 session 花费(主/hc/sc/sl/计)、余额置顶不被截 |
9
+ | `openai-completions.js` | `<pi>/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js` | 打断即断流→通知云端停生成(省 abort 隐形烧钱),见 [openai-completions.js.LESSONS](openai-completions.js.LESSONS) |
10
+ | `tool-execution.js` | `<pi-dist>/modes/interactive/components/tool-execution.js` | 通用工具调用标题行显示 summary/title/query 参数,让 wait/contacts/safari 等自定义工具像 edit `~/path` 一样展示有意义的标题 |
11
+
12
+ ## 维护
13
+
14
+ - **改了行为** → 改 live 的 dist 文件、跑通后,重新 `cp` 回这里覆盖 golden(golden = 真相)。
15
+ - **pi 升级**(换 pin 版本)→ 这些整文件覆盖可能不兼容;install.sh 会跳过并提示手动核对,
16
+ 需在新版 dist 上重做改动、重新存 golden、更新 install.sh 里的 PIN。
17
+ - 为什么用整文件覆盖而不是 .patch:footer 是一连串手改、没有干净的 vanilla diff;整文件 golden 最稳、
18
+ 且与 5 个 git-apply patch 改的文件互不重叠(footer.js / openai-completions.js 都不在那 5 个 patch 范围内)。