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.
- package/README.md +50 -0
- package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py +80 -0
- package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py.CHANGELOG +1 -0
- package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py.SPEC +3 -0
- package/core/god.agent.capability/hands.dev.writeissue/issue.ts +209 -0
- package/core/god.agent.capability/hands.dev.writeissue/issue.ts.SPEC +26 -0
- package/core/god.agent.capability/hands.files.changewatcher/watcher.ts +44 -0
- package/core/god.agent.capability/hands.files.changewatcher/watcher.ts.SPEC +25 -0
- package/core/god.pi.mod/cli/pi-completion.zsh +21 -0
- package/core/god.pi.mod/cli/pi-completion.zsh.CHANGELOG +1 -0
- package/core/god.pi.mod/cli/pi-people.sh +264 -0
- package/core/god.pi.mod/cli/pi-people.sh.LESSON +10 -0
- package/core/god.pi.mod/cli/pi-people.sh.SPEC +31 -0
- package/core/god.pi.mod/paths.ts +47 -0
- package/core/god.pi.mod/tui.mods.blockrender/blockrender.js +90 -0
- package/core/god.pi.mod/tui.mods.blockrender/blockrender.js.SPEC +29 -0
- package/core/god.pi.mod/tui.mods.footer.budget/budget_guard.ts +154 -0
- package/core/god.pi.mod/tui.mods.footer.budget/budget_guard.ts.CHANGELOG +10 -0
- package/core/god.pi.mod/tui.mods.footer.budget/budget_guard.ts.LESSON +12 -0
- package/core/god.pi.mod/tui.mods.footer.budget/budget_guard.ts.SPEC +26 -0
- package/core/god.pi.mod/tui.mods.footer.budget/footer-cny.CHANGELOG +39 -0
- package/core/god.pi.mod/tui.mods.viewmode/view_mode-thinking.patch +55 -0
- package/core/god.pi.mod/tui.mods.viewmode/view_mode-tools.patch +19 -0
- package/core/god.pi.mod/tui.mods.viewmode/view_mode-tools.patch.CHANGELOG +1 -0
- package/core/god.pi.mod/tui.mods.viewmode/view_mode.ts +50 -0
- package/core/god.pi.mod/tui.mods.viewmode/view_mode.ts.SPEC +12 -0
- package/core/god.pi.mod/tui.variants.userterminal/user_terminal.CHANGELOG +10 -0
- package/core/god.pi.mod/tui.variants.userterminal/user_terminal.ts +66 -0
- package/core/god.pi.mod/tui.variants.userterminal/user_terminal.ts.SPEC +31 -0
- package/core/index.ts +3 -0
- package/core/individual.bio.gene/dna.coded/coded.dna +257 -0
- package/core/individual.bio.gene/dna.coded/coded.dna.CHANGELOG +12 -0
- package/core/individual.bio.gene/dna.coded/coded.dna.SPEC +11 -0
- package/core/individual.bio.gene/dna.coded/core.dna +110 -0
- package/core/individual.bio.gene/dna.promotor/promotor.dna +117 -0
- package/core/individual.bio.gene/dna.promotor/promotor.dna.CHANGELOG +4 -0
- package/core/individual.bio.gene/dna.promotor/promotor.dna.SPEC +7 -0
- package/core/individual.bio.gene/dna.transpiler/transpiler.ts +395 -0
- package/core/individual.bio.gene/dna.transpiler/transpiler.ts.CHANGELOG +7 -0
- package/core/individual.bio.gene/dna.transpiler/transpiler.ts.SPEC +28 -0
- package/core/individual.bio.gene/gene.README +19 -0
- package/core/individual.bio.gene/rna/rna.json +536 -0
- package/core/individual.bio.gene/rna/rna.json.CHANGELOG +2 -0
- package/core/individual.bio.gene/rna/rna.json.SPEC +8 -0
- package/core/individual.bio.organs/blood.runtime/messages.ts +236 -0
- package/core/individual.bio.organs/blood.runtime/runtime.ts +173 -0
- package/core/individual.bio.organs/blood.runtime/runtime.ts.CHANGELOG +5 -0
- package/core/individual.bio.organs/blood.runtime/runtime.ts.SPEC +32 -0
- package/core/individual.bio.organs/brain.amygdala/amygdala.ts +25 -0
- package/core/individual.bio.organs/brain.amygdala/amygdala.ts.COMMENT +3 -0
- package/core/individual.bio.organs/brain.amygdala/amygdala.ts.SPEC +9 -0
- package/core/individual.bio.organs/brain.hippocampus/hippocampus-launcher.sh.template +108 -0
- package/core/individual.bio.organs/brain.hippocampus/hippocampus.ts +166 -0
- package/core/individual.bio.organs/brain.hippocampus/hippocampus.ts.CHANGELOG +12 -0
- package/core/individual.bio.organs/brain.hippocampus/hippocampus.ts.LESSON +22 -0
- package/core/individual.bio.organs/brain.hippocampus/hippocampus.ts.SPEC +16 -0
- package/core/individual.bio.organs/brain.hippocampus/memory.ts +879 -0
- package/core/individual.bio.organs/brain.hippocampus/memory.ts.CHANGELOG +66 -0
- package/core/individual.bio.organs/brain.hippocampus/memory.ts.LESSON +25 -0
- package/core/individual.bio.organs/brain.hippocampus/memory.ts.SPEC +46 -0
- package/core/individual.bio.organs/brain.hippocampus/sleep.ts +139 -0
- package/core/individual.bio.organs/brain.hippocampus/sleep.ts.CHANGELOG +11 -0
- package/core/individual.bio.organs/brain.hippocampus/sleep.ts.SPEC +16 -0
- package/core/individual.bio.organs/brain.prefrontal.drafting/drafting.SPEC +44 -0
- package/core/individual.bio.organs/brain.prefrontal.drafting/drafting.ts +73 -0
- package/core/individual.bio.organs/brain.prefrontal.drafting/drafting.ts.CHANGELOG +3 -0
- package/core/individual.bio.organs/brain.prefrontal.drafting/drafting.ts.SPEC +24 -0
- package/core/individual.bio.organs/brain.prefrontal.drafting/index.ts.CHANGELOG +3 -0
- package/core/individual.bio.organs/brain.prefrontal.drafting/main.ts +13 -0
- package/core/individual.bio.organs/brain.prefrontal.drafting/main.ts.SPEC +17 -0
- package/core/individual.bio.organs/brain.senses.bioclock/bioclock.ts +94 -0
- package/core/individual.bio.organs/brain.senses.bioclock/bioclock.ts.LESSON +13 -0
- package/core/individual.bio.organs/brain.senses.bioclock/bioclock.ts.SPEC +20 -0
- package/core/individual.bio.organs/brain.senses.subconscious/feed-format.SPEC +56 -0
- package/core/individual.bio.organs/brain.senses.subconscious/index.ts.CHANGELOG +13 -0
- package/core/individual.bio.organs/brain.senses.subconscious/spawner.ts +130 -0
- package/core/individual.bio.organs/brain.senses.subconscious/spawner.ts.SPEC +13 -0
- package/core/individual.bio.organs/brain.senses.subconscious/subconscious.ts +280 -0
- package/core/individual.bio.organs/brain.senses.subconscious/subconscious.ts.CHANGELOG +7 -0
- package/core/individual.bio.organs/brain.senses.subconscious/tools.ts +180 -0
- package/core/individual.bio.organs/brain.senses.subconscious/tools.ts.SPEC +3 -0
- package/core/individual.bio.organs/ears.listen/config.json +9 -0
- package/core/individual.bio.organs/ears.listen/config.json.CHANGELOG +1 -0
- package/core/individual.bio.organs/ears.listen/config.json.SPEC +3 -0
- package/core/individual.bio.organs/ears.listen/ears.ts.CHANGELOG +48 -0
- package/core/individual.bio.organs/ears.listen/ears_recorder.py.CHANGELOG +6 -0
- package/core/individual.bio.organs/ears.listen/index.ts +1 -0
- package/core/individual.bio.organs/ears.listen/index.ts.SPEC +16 -0
- package/core/individual.bio.organs/ears.listen/listen.ts +208 -0
- package/core/individual.bio.organs/ears.listen/listen.ts.SPEC +3 -0
- package/core/individual.bio.organs/ears.listen/listen_recorder.py +445 -0
- package/core/individual.bio.organs/ears.listen/listen_recorder.py.SPEC +7 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/__init__.py +0 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/common/__init__.py +0 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/common/events_pb2.py +38 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/common/events_pb2_grpc.py +24 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/common/rpcmeta_pb2.py +42 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/common/rpcmeta_pb2_grpc.py +24 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/products/__init__.py +0 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/__init__.py +0 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/ast/__init__.py +0 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/ast/ast_service_pb2.py +45 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/ast/ast_service_pb2_grpc.py +97 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/base/__init__.py +0 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/base/au_base_pb2.py +80 -0
- package/core/individual.bio.organs/ears.listen/python_protogen/products/understanding/base/au_base_pb2_grpc.py +24 -0
- package/core/individual.bio.organs/hands.fileactions/authorize.TRUST +1 -0
- package/core/individual.bio.organs/hands.fileactions/authorize.ts +70 -0
- package/core/individual.bio.organs/hands.fileactions/authorize.ts.CHANGELOG +1 -0
- package/core/individual.bio.organs/hands.fileactions/authorize.ts.SPEC +3 -0
- package/core/individual.bio.organs/hands.fileactions/dir.README +13 -0
- package/core/individual.bio.organs/hands.fileactions/file_rules.json +23 -0
- package/core/individual.bio.organs/hands.fileactions/fileactions.README +12 -0
- package/core/individual.bio.organs/hands.fileactions/fileactions.ts +540 -0
- package/core/individual.bio.organs/hands.fileactions/fileactions.ts.CHANGELOG +25 -0
- package/core/individual.bio.organs/hands.fileactions/fileactions.ts.SPEC +30 -0
- package/core/individual.bio.organs/hands.fileactions/filewatch.ts +66 -0
- package/core/individual.bio.organs/hands.fileactions/filewatch.ts.SPEC +3 -0
- package/core/individual.bio.organs/hands.main/main.ts +18 -0
- package/core/individual.bio.organs/hands.main/main.ts.SPEC +20 -0
- package/core/individual.bio.organs/hands.sensitive/sensitive.ts +24 -0
- package/core/individual.bio.organs/hands.sensitive/sensitive.ts.CHANGELOG +2 -0
- package/core/individual.bio.organs/hands.sensitive/sensitive.ts.SPEC +3 -0
- package/core/individual.bio.organs/heart.interrupt/agent_start-loader-flicker.patch +13 -0
- package/core/individual.bio.organs/heart.interrupt/interactive-mode-loader.patch +11 -0
- package/core/individual.bio.organs/heart.interrupt/runner_esc.patch +10 -0
- package/core/individual.bio.organs/heart.interrupt/runner_esc.patch.SPEC +9 -0
- package/core/individual.bio.organs/heart.kernel/kernel.ts +253 -0
- package/core/individual.bio.organs/heart.kernel/kernel.ts.CHANGELOG +13 -0
- package/core/individual.bio.organs/heart.kernel/kernel.ts.SPEC +23 -0
- package/core/individual.bio.organs/heart.main/heart.main.CHANGELOG +43 -0
- package/core/individual.bio.organs/heart.main/heartbeat.ts +494 -0
- package/core/individual.bio.organs/heart.main/heartbeat.ts.LESSON +43 -0
- package/core/individual.bio.organs/heart.main/main.ts +8 -0
- package/core/individual.bio.organs/heart.main/main.ts.SPEC +19 -0
- package/core/individual.bio.organs/heart.main/process.ts +122 -0
- package/core/individual.bio.organs/heart.main/process.ts.CHANGELOG +2 -0
- package/core/individual.bio.organs/heart.main/process.ts.SPEC +24 -0
- package/core/individual.bio.organs/heart.main/remove_timeout.patch +110 -0
- package/core/individual.bio.organs/heart.main/stop.ts.CHANGELOG +3 -0
- package/core/individual.bio.organs/heart.main/stop.ts.SPEC +28 -0
- package/core/individual.bio.organs/mouth.speak/index.ts +1 -0
- package/core/individual.bio.organs/mouth.speak/index.ts.CHANGELOG +1 -0
- package/core/individual.bio.organs/mouth.speak/index.ts.SPEC +6 -0
- package/core/individual.bio.organs/mouth.speak/mouth.ts.CHANGELOG +15 -0
- package/core/individual.bio.organs/mouth.speak/mouth_recorder.py.CHANGELOG +1 -0
- package/core/individual.bio.organs/mouth.speak/speak.ts +180 -0
- package/core/individual.bio.organs/mouth.speak/speak.ts.SPEC +3 -0
- package/core/individual.bio.organs/mouth.speak/speak_recorder.py +35 -0
- package/core/individual.bio.organs/mouth.speak/speak_recorder.py.SPEC +3 -0
- package/core/individual.bio.organs/organs.README +110 -0
- package/core/package-lock.json +18 -0
- package/core/package.json +35 -0
- package/core/prompts/prompts.json +77 -0
- package/core/prompts/prompts.ts +44 -0
- package/core/prompts/prompts.ts.SPEC +9 -0
- package/core/society.world/.gitkeep +0 -0
- package/core/society.world/accessibility.claudecode/message-service.cjs +217 -0
- package/core/society.world/accessibility.claudecode/message-service.cjs.SPEC +7 -0
- package/core/society.world/accessibility.claudecode/send.ts +34 -0
- package/core/society.world/dollar.distribution.ubi/ubi.ts +55 -0
- package/core/society.world/dollar.main/dollar-service.cjs +185 -0
- package/core/society.world/dollar.main/main.ts +116 -0
- package/core/society.world/dollar.transaction/transaction.ts +71 -0
- package/core/society.world/space/space.ts +206 -0
- package/core/society.world/space/space.ts.SPEC +30 -0
- package/core/technology.laptop/#agent.macos.BLUEPRINT +278 -0
- package/core/technology.phone/apps.preinstalled/albums.FUTURE/albums.ts +69 -0
- package/core/technology.phone/apps.preinstalled/albums.FUTURE/albums.ts.SPEC +15 -0
- package/core/technology.phone/apps.preinstalled/calendar/calendar.ts +406 -0
- package/core/technology.phone/apps.preinstalled/calendar/calendar.ts.SPEC +22 -0
- package/core/technology.phone/apps.preinstalled/calendar/holiday-calendar.ts +529 -0
- package/core/technology.phone/apps.preinstalled/clock/clock.ts +132 -0
- package/core/technology.phone/apps.preinstalled/clock/clock.ts.SPEC +11 -0
- package/core/technology.phone/apps.preinstalled/contacts.FUTURE/contacts.ts +300 -0
- package/core/technology.phone/apps.preinstalled/contacts.FUTURE/contacts.ts.SPEC +22 -0
- package/core/technology.phone/apps.preinstalled/developer.FUTURE/developer.ts +22 -0
- package/core/technology.phone/apps.preinstalled/developer.FUTURE/developer.ts.SPEC +15 -0
- package/core/technology.phone/apps.preinstalled/notes/notes.ts +239 -0
- package/core/technology.phone/apps.preinstalled/notes/notes.ts.SPEC +21 -0
- package/core/technology.phone/apps.preinstalled/polymarket/polymarket.ts +261 -0
- package/core/technology.phone/apps.preinstalled/polymarket/polymarket.ts.SPEC +7 -0
- package/core/technology.phone/apps.preinstalled/reminder/reminder.ts +404 -0
- package/core/technology.phone/apps.preinstalled/reminder/reminder.ts.SPEC +25 -0
- package/core/technology.phone/apps.preinstalled/siri.FUTURE/siri.ts +22 -0
- package/core/technology.phone/apps.preinstalled/siri.FUTURE/siri.ts.SPEC +15 -0
- package/core/technology.phone/apps.preinstalled/spotlight/spotlight.ts +29 -0
- package/core/technology.phone/apps.preinstalled/spotlight/spotlight.ts.SPEC +7 -0
- package/core/technology.phone/apps.preinstalled/steam/chess.ts +230 -0
- package/core/technology.phone/apps.preinstalled/steam/snake.ts +100 -0
- package/core/technology.phone/apps.preinstalled/steam/snake.ts.SPEC +7 -0
- package/core/technology.phone/apps.preinstalled/steam/spy-cmd.ts +4 -0
- package/core/technology.phone/apps.preinstalled/steam/spy-tool.ts +56 -0
- package/core/technology.phone/apps.preinstalled/steam/spy.ts +302 -0
- package/core/technology.phone/apps.preinstalled/steam/steam.ts +299 -0
- package/core/technology.phone/apps.preinstalled/weather/weather.ts +50 -0
- package/core/technology.phone/apps.preinstalled/weather/weather.ts.SPEC +9 -0
- package/core/technology.phone/apps.preinstalled/wechat/imessage.ts +423 -0
- package/core/technology.phone/apps.preinstalled/wechat/imessage.ts.SPEC +24 -0
- package/core/technology.phone/apps.system/appstore/appstore.ts +22 -0
- package/core/technology.phone/apps.system/appstore/appstore.ts.SPEC +15 -0
- package/core/technology.phone/apps.system/finder.FUTURE/finder.ts +64 -0
- package/core/technology.phone/apps.system/finder.FUTURE/finder.ts.SPEC +8 -0
- package/core/technology.phone/apps.system/safari/safari-app.ts +146 -0
- package/core/technology.phone/apps.system/safari/safari.ts.SPEC +24 -0
- package/core/technology.phone/apps.system/settings/settings.ts +126 -0
- package/core/technology.phone/apps.system/settings/settings.ts.SPEC +17 -0
- package/core/technology.phone/apps.system/tips/tips.ts +22 -0
- package/core/technology.phone/apps.system/tips/tips.ts.SPEC +15 -0
- package/core/technology.phone/apps.thirdparty/alipay/alipay.ts +148 -0
- package/core/technology.phone/apps.thirdparty/alipay/alipay.ts.SPEC +7 -0
- package/core/technology.phone/apps.thirdparty/bilibili/bilibili-app.ts +33 -0
- package/core/technology.phone/apps.thirdparty/bilibili/bilibili.ts +142 -0
- package/core/technology.phone/apps.thirdparty/bilibili/bilibili.ts.SPEC +22 -0
- package/core/technology.phone/apps.thirdparty/wechatread/wechatread.ts +80 -0
- package/core/technology.phone/apps.thirdparty/wechatread/wechatread.ts.SPEC +15 -0
- package/core/technology.phone/index.ts +1 -0
- package/core/technology.phone/package.json +2 -0
- package/core/technology.phone/system.homepage/homepage.ts +247 -0
- package/core/technology.phone/system.homepage/homepage.ts.SPEC +22 -0
- package/core/technology.phone/system.kernel/kernel.ts +264 -0
- package/core/technology.phone/system.kernel/kernel.ts.SPEC +7 -0
- package/core/technology.phone/system.notifications/notifications.ts +87 -0
- package/core/technology.phone/system.notifications/notifications.ts.SPEC +7 -0
- package/core/technology.phone/system.share/share.ts +46 -0
- package/core/technology.phone/system.share/share.ts.SPEC +7 -0
- package/core/technology.server/browser-service.cjs +152 -0
- package/core/technology.server/data/cookies/arxiv.json +30 -0
- package/core/technology.server/data/cookies/bili.json +184 -0
- package/core/technology.server/data/cookies/default.json +30 -0
- package/core/technology.server/data/cookies/news.json +113 -0
- package/core/technology.server/data/cookies/s1.json +45 -0
- package/core/technology.server/data/cookies/safari.json +184 -0
- package/core/technology.server/data/cookies/safari2.json +1 -0
- package/core/technology.server/data/cookies/safaridbg.json +1 -0
- package/core/technology.server/data/cookies/search.json +45 -0
- package/core/technology.server/data/cookies/sw.json +30 -0
- package/core/technology.server/data/cookies/t1.json +1 -0
- package/core/technology.server/data/cookies/testread.json +1 -0
- package/core/technology.server/data/cookies/video1.json +113 -0
- package/core/technology.server/data/cookies/yt.json +170 -0
- package/core/technology.server/data/cookies/yt2.json +113 -0
- package/core/technology.server/pikipedia/#pikipedia.BLUEPRINT +106 -0
- package/core/technology.server/playleft.cjs +247 -0
- package/core/technology.server/search-proxy.py +76 -0
- package/core/technology.server/server.README +59 -0
- package/deploy/dist-overrides/cli/cli.js +18 -0
- package/deploy/dist-overrides/core/extensions/loader.js +518 -0
- package/deploy/dist-overrides/core/package-manager.js +2081 -0
- package/deploy/dist-overrides/core/system-prompt.js +109 -0
- package/deploy/dist-overrides/core/system-prompt.js.LESSON +17 -0
- package/deploy/dist-overrides/core/tools/bash.js +353 -0
- package/deploy/dist-overrides/core/tools/bash.js.CHANGELOG +2 -0
- package/deploy/dist-overrides/core/tools/edit-diff.js +345 -0
- package/deploy/dist-overrides/core/tools/edit.js +315 -0
- package/deploy/dist-overrides/core/tools/edit.js.CHANGELOG +1 -0
- package/deploy/dist-overrides/core/tools/file-mutation-queue.js +52 -0
- package/deploy/dist-overrides/core/tools/find.js +298 -0
- package/deploy/dist-overrides/core/tools/find.js.CHANGELOG +1 -0
- package/deploy/dist-overrides/core/tools/grep.js +305 -0
- package/deploy/dist-overrides/core/tools/grep.js.CHANGELOG +1 -0
- package/deploy/dist-overrides/core/tools/index.js +112 -0
- package/deploy/dist-overrides/core/tools/ls-guard.js +4 -0
- package/deploy/dist-overrides/core/tools/ls.js +170 -0
- package/deploy/dist-overrides/core/tools/ls.js.CHANGELOG +1 -0
- package/deploy/dist-overrides/core/tools/output-accumulator.js +184 -0
- package/deploy/dist-overrides/core/tools/path-utils.js +99 -0
- package/deploy/dist-overrides/core/tools/prompts-reader.js +53 -0
- package/deploy/dist-overrides/core/tools/read.js +392 -0
- package/deploy/dist-overrides/core/tools/read.js.CHANGELOG +1 -0
- package/deploy/dist-overrides/core/tools/render-utils.js +65 -0
- package/deploy/dist-overrides/core/tools/tool-definition-wrapper.js +34 -0
- package/deploy/dist-overrides/core/tools/truncate.js +215 -0
- package/deploy/dist-overrides/core/tools/write.js +203 -0
- package/deploy/dist-overrides/core/tools/write.js.CHANGELOG +1 -0
- package/deploy/dist-overrides/dist-overrides.README +18 -0
- package/deploy/dist-overrides/main.js +665 -0
- package/deploy/dist-overrides/modes/interactive/components/assistant-message.js +139 -0
- package/deploy/dist-overrides/modes/interactive/components/footer.js +326 -0
- package/deploy/dist-overrides/modes/interactive/components/model-selector.js +285 -0
- package/deploy/dist-overrides/modes/interactive/components/tool-execution.js +383 -0
- package/deploy/dist-overrides/modes/interactive/components/tool-execution.js.CHANGELOG +3 -0
- package/deploy/dist-overrides/modes/interactive/interactive-mode.js +4781 -0
- package/deploy/dist-overrides/pi-ai/providers/anthropic.js +931 -0
- package/deploy/dist-overrides/pi-ai/providers/openai-completions.js +1007 -0
- package/deploy/dist-overrides/pi-ai/providers/openai-completions.js.LESSON +15 -0
- package/deploy/dist-overrides/pi-tui/components/loader.js +69 -0
- package/deploy/dist-overrides/pi-tui/components/markdown.js +646 -0
- package/deploy/dist-overrides/pi-tui/components/text.js +92 -0
- package/deploy/dist-overrides/pi-tui/custom-message.js +75 -0
- package/deploy/dist-overrides/pi-tui/tui.js +1266 -0
- package/deploy/dist-overrides/pi-tui/utils.js +1060 -0
- package/deploy/dist-overrides/vendor.REMOVED/jiti/lib/jiti.mjs +3 -0
- package/deploy/install.sh +186 -0
- package/deploy/install.sh.CHANGELOG +6 -0
- package/deploy/lint/lint-naming.ts +202 -0
- package/deploy/scripts/apply.js +18 -0
- package/deploy/scripts/build-github.sh +219 -0
- package/deploy/scripts/build-phone.sh +24 -0
- package/deploy/scripts/check-deploy.sh +42 -0
- package/deploy/scripts/migrate-context.sh +72 -0
- package/deploy/scripts/patch-pi-dist.js +39 -0
- package/deploy/scripts/uninstall.sh +34 -0
- package/package.json +18 -0
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# pi-coding-master
|
|
2
|
+
|
|
3
|
+
Living AI agent extension for [pi-coding-agent](https://github.com/nicepkg/pi-coding-agent).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. Install pi (pinned version)
|
|
9
|
+
npm i -g @earendil-works/pi-coding-agent@0.79.10
|
|
10
|
+
|
|
11
|
+
# 2. Install pi-coding-master
|
|
12
|
+
npm i -g pi-coding-master
|
|
13
|
+
|
|
14
|
+
# Done. Run: pi <person-name>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Update
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm i -g pi-coding-master@latest
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Manual Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Download release, then:
|
|
27
|
+
bash deploy/install.sh
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Requirements
|
|
31
|
+
|
|
32
|
+
- Node.js >= 18
|
|
33
|
+
- macOS or Linux
|
|
34
|
+
- tmux (for subconscious/hippocampus)
|
|
35
|
+
- bun (for TypeScript extension loading)
|
|
36
|
+
|
|
37
|
+
## What it does
|
|
38
|
+
|
|
39
|
+
pi-coding-master turns pi into a persistent, living agent with:
|
|
40
|
+
|
|
41
|
+
- **Heartbeat** - continuous mode with next()/wait/hibernate state machine
|
|
42
|
+
- **Memory** - 5-layer memory system (DNA/Context/WorkMemory/Cortex/DeepCortex)
|
|
43
|
+
- **Subconscious** - parallel observer process that reflects on main consciousness
|
|
44
|
+
- **Hippocampus** - memory encoding subprocess
|
|
45
|
+
- **Sleep** - memory consolidation (work_memory -> cortex)
|
|
46
|
+
- **Senses** - ears (speech-to-text), mouth (TTS), phone (browser/apps)
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
MIT
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
GPU Idle Monitor — pi-alive habit.
|
|
4
|
+
Alerts when remote/local GPU goes idle so models can be deployed.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
python3 gpu_monitor.py --remote --daemon
|
|
8
|
+
python3 gpu_monitor.py --remote --alert-method notification --alert-prompt "快跑SLA!"
|
|
9
|
+
"""
|
|
10
|
+
import subprocess, time, os, sys, argparse, json
|
|
11
|
+
|
|
12
|
+
CONFIG = os.path.expanduser("~/.pi/gpu_monitor.json")
|
|
13
|
+
DEFAULT_HOST = "connect.westc.seetacloud.com"
|
|
14
|
+
DEFAULT_PORT = 12580
|
|
15
|
+
DEFAULT_PASS = "kgJpl066jEtZ"
|
|
16
|
+
|
|
17
|
+
def get_gpu(host, port, pw):
|
|
18
|
+
cmd = f"sshpass -p '{pw}' ssh -o StrictHostKeyChecking=no -p {port} root@{host} 'nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader' 2>/dev/null"
|
|
19
|
+
try:
|
|
20
|
+
out = subprocess.check_output(cmd, shell=True, timeout=10)
|
|
21
|
+
return max(int(l.replace("%","").strip()) for l in out.decode().strip().split("\n") if l.strip())
|
|
22
|
+
except: return None
|
|
23
|
+
|
|
24
|
+
def alert(msg, method, prompt):
|
|
25
|
+
full = f"{msg} | {prompt}"
|
|
26
|
+
if method == "print": print(f"[GPU] {full}", flush=True)
|
|
27
|
+
elif method == "notification":
|
|
28
|
+
subprocess.run(["osascript","-e",f'display notification "{full}" with title "GPU Alert"'],capture_output=True)
|
|
29
|
+
elif method == "file":
|
|
30
|
+
with open(os.path.expanduser("~/.pi/gpu_alerts.log"),"a") as f:
|
|
31
|
+
f.write(f"{time.strftime('%m-%d %H:%M')} {full}\n")
|
|
32
|
+
|
|
33
|
+
def main():
|
|
34
|
+
p = argparse.ArgumentParser()
|
|
35
|
+
p.add_argument("--threshold",type=int,default=10)
|
|
36
|
+
p.add_argument("--check",type=int,default=15)
|
|
37
|
+
p.add_argument("--idle-sec",type=int,default=30)
|
|
38
|
+
p.add_argument("--host",default=DEFAULT_HOST)
|
|
39
|
+
p.add_argument("--port",type=int,default=DEFAULT_PORT)
|
|
40
|
+
p.add_argument("--passwd",default=DEFAULT_PASS)
|
|
41
|
+
p.add_argument("--alert",default="print",help="print|notification|file")
|
|
42
|
+
p.add_argument("--prompt",default="GPU空闲!立刻训练SLA模型!")
|
|
43
|
+
p.add_argument("--remote",action="store_true")
|
|
44
|
+
p.add_argument("--daemon",action="store_true")
|
|
45
|
+
args = p.parse_args()
|
|
46
|
+
|
|
47
|
+
if args.daemon:
|
|
48
|
+
pid = os.fork()
|
|
49
|
+
if pid: print(f"Daemon PID={pid}"); return
|
|
50
|
+
|
|
51
|
+
h = args.host if args.remote else None
|
|
52
|
+
print(f"GPU Monitor | remote={args.remote} | thresh={args.threshold}% | check={args.check}s")
|
|
53
|
+
idle_start = None
|
|
54
|
+
|
|
55
|
+
while True:
|
|
56
|
+
if args.remote: utils = get_gpu(h, args.port, args.passwd)
|
|
57
|
+
else:
|
|
58
|
+
try:
|
|
59
|
+
out = subprocess.check_output("nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader",shell=True,timeout=5)
|
|
60
|
+
utils = max(int(l.replace("%","").strip()) for l in out.decode().strip().split("\n") if l.strip())
|
|
61
|
+
except: utils = -1
|
|
62
|
+
|
|
63
|
+
if utils is None or utils < 0:
|
|
64
|
+
time.sleep(args.check); continue
|
|
65
|
+
|
|
66
|
+
if utils <= args.threshold:
|
|
67
|
+
if idle_start is None: idle_start = time.time()
|
|
68
|
+
sec = time.time() - idle_start
|
|
69
|
+
if sec >= args.idle_sec:
|
|
70
|
+
alert(f"GPU idle {int(sec)}s (util={utils}%)", args.alert, args.prompt)
|
|
71
|
+
time.sleep(args.idle_sec)
|
|
72
|
+
else:
|
|
73
|
+
if idle_start and time.time()-idle_start > 10:
|
|
74
|
+
alert(f"GPU active (util={utils}%)", args.alert, "继续监控")
|
|
75
|
+
idle_start = None
|
|
76
|
+
|
|
77
|
+
time.sleep(args.check)
|
|
78
|
+
|
|
79
|
+
if __name__ == "__main__":
|
|
80
|
+
main()
|
package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py.CHANGELOG
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[2026-06-15 21:05:24] created
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// god.agent.capability/hands.dev.writedoc — 通用开发文档写入
|
|
2
|
+
// 支持 ISSUE / LESSON / NORM 等所有 .{TYPE}.md 文档类型。
|
|
3
|
+
// 规律:目录 Docs.Dev.{Type}s/ · 文件 NNN-slug.{TYPE}.md · 索引 {Type}s.INDEX.md
|
|
4
|
+
|
|
5
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
6
|
+
import { readFileSync, writeFileSync, readdirSync, mkdirSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { DIRS } from "#paths";
|
|
9
|
+
|
|
10
|
+
type DocType = "ISSUE" | "LESSON" | "NORM";
|
|
11
|
+
|
|
12
|
+
const DOC_CONFIG: Record<DocType, { plural: string; dir: string; hasStatus: boolean }> = {
|
|
13
|
+
ISSUE: { plural: "Issues", dir: DIRS.devIssues, hasStatus: true },
|
|
14
|
+
LESSON: { plural: "Lessons", dir: DIRS.devLessons, hasStatus: false },
|
|
15
|
+
NORM: { plural: "Norms", dir: DIRS.devNorms, hasStatus: false },
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function docDir(type: DocType): string {
|
|
19
|
+
return DOC_CONFIG[type].dir;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ensureDir(type: DocType): void { try { mkdirSync(docDir(type), { recursive: true }); } catch {} }
|
|
23
|
+
function pad(n: number): string { return String(n).padStart(3, "0"); }
|
|
24
|
+
function today(): string { return new Date().toISOString().slice(0, 10); }
|
|
25
|
+
|
|
26
|
+
function slugify(title: string): string {
|
|
27
|
+
return title.trim().toLowerCase()
|
|
28
|
+
.replace(/[\s/\\]+/g, "-")
|
|
29
|
+
.replace(/[^\p{L}\p{N}\-_]/gu, "")
|
|
30
|
+
.slice(0, 40) || "entry";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface DocMeta { num: number; file: string; status: string; title: string; created: string; }
|
|
34
|
+
|
|
35
|
+
function filePattern(type: DocType): RegExp {
|
|
36
|
+
return new RegExp(`^\\d{3}-.*\\.${type}$`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function listFiles(type: DocType): string[] {
|
|
40
|
+
ensureDir(type);
|
|
41
|
+
try { return readdirSync(docDir(type)).filter((f) => filePattern(type).test(f)).sort(); } catch { return []; }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function parseDoc(type: DocType, file: string): DocMeta | null {
|
|
45
|
+
try {
|
|
46
|
+
const content = readFileSync(join(docDir(type), file), "utf8");
|
|
47
|
+
const num = parseInt(file.slice(0, 3), 10);
|
|
48
|
+
const status = content.match(/^status:\s*(.+)$/m)?.[1]?.trim() ?? "open";
|
|
49
|
+
const title = content.match(/^#\s*\[\d+\]\s*(.+)$/m)?.[1]?.trim() ?? file.replace(/\.md$/, "");
|
|
50
|
+
const created = content.match(/^created:\s*(.+)$/m)?.[1]?.trim() ?? "";
|
|
51
|
+
return { num, file, status, title, created };
|
|
52
|
+
} catch { return null; }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function nextNum(type: DocType): number {
|
|
56
|
+
let max = 0;
|
|
57
|
+
for (const f of listFiles(type)) { const n = parseInt(f.slice(0, 3), 10); if (n > max) max = n; }
|
|
58
|
+
return max + 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function regenIndex(type: DocType): void {
|
|
62
|
+
ensureDir(type);
|
|
63
|
+
const cfg = DOC_CONFIG[type];
|
|
64
|
+
const docs = listFiles(type).map((f) => parseDoc(type, f)).filter(Boolean) as DocMeta[];
|
|
65
|
+
|
|
66
|
+
const L: string[] = [
|
|
67
|
+
`# pi-coding-master ${cfg.plural} — 索引`,
|
|
68
|
+
"",
|
|
69
|
+
`_自动生成,别手改。_`,
|
|
70
|
+
"",
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
if (cfg.hasStatus) {
|
|
74
|
+
const open = docs.filter((d) => d.status === "open");
|
|
75
|
+
const done = docs.filter((d) => d.status !== "open");
|
|
76
|
+
L.push(`**打开 ${open.length} · 已解决 ${done.length} · 共 ${docs.length}**`, "");
|
|
77
|
+
L.push("## 打开");
|
|
78
|
+
if (open.length) for (const d of open) L.push(`- [${pad(d.num)}](${d.file}) — ${d.title}${d.created ? ` _(${d.created})_` : ""}`);
|
|
79
|
+
else L.push("_(无)_");
|
|
80
|
+
L.push("", "## 已解决");
|
|
81
|
+
if (done.length) for (const d of done) L.push(`- [${pad(d.num)}](${d.file}) — ${d.title} — ${d.status}`);
|
|
82
|
+
else L.push("_(无)_");
|
|
83
|
+
} else {
|
|
84
|
+
L.push(`**共 ${docs.length} 条**`, "");
|
|
85
|
+
for (const d of docs) L.push(`- [${pad(d.num)}](${d.file}) — ${d.title}${d.created ? ` _(${d.created})_` : ""}`);
|
|
86
|
+
if (!docs.length) L.push("_(无)_");
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
writeFileSync(join(docDir(type), `${cfg.plural}.INDEX`), L.join("\n") + "\n");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function addDoc(type: DocType, title: string, detail: string): number {
|
|
93
|
+
ensureDir(type);
|
|
94
|
+
const num = nextNum(type);
|
|
95
|
+
const file = `${pad(num)}-${slugify(title)}.${type}`;
|
|
96
|
+
const lines = [`# [${pad(num)}] ${title}`];
|
|
97
|
+
if (DOC_CONFIG[type].hasStatus) lines.push("status: open");
|
|
98
|
+
lines.push(`created: ${today()}`, "", detail || "(暂无详情)", "");
|
|
99
|
+
writeFileSync(join(docDir(type), file), lines.join("\n"));
|
|
100
|
+
regenIndex(type);
|
|
101
|
+
return num;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function setStatus(type: DocType, num: number, status: string): boolean {
|
|
105
|
+
if (!DOC_CONFIG[type].hasStatus) return false;
|
|
106
|
+
const file = listFiles(type).find((f) => parseInt(f.slice(0, 3), 10) === num);
|
|
107
|
+
if (!file) return false;
|
|
108
|
+
const p = join(docDir(type), file);
|
|
109
|
+
let content = readFileSync(p, "utf8");
|
|
110
|
+
content = /^status:\s*.+$/m.test(content)
|
|
111
|
+
? content.replace(/^status:\s*.+$/m, `status: ${status}`)
|
|
112
|
+
: content.replace(/\n/, `\nstatus: ${status}\n`);
|
|
113
|
+
writeFileSync(p, content);
|
|
114
|
+
regenIndex(type);
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function listOpen(type: DocType): DocMeta[] {
|
|
119
|
+
const docs = listFiles(type).map((f) => parseDoc(type, f)).filter(Boolean) as DocMeta[];
|
|
120
|
+
return DOC_CONFIG[type].hasStatus ? docs.filter((d) => d.status === "open") : docs;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function readDoc(type: DocType, num: number): string | null {
|
|
124
|
+
const file = listFiles(type).find((f) => parseInt(f.slice(0, 3), 10) === num);
|
|
125
|
+
return file ? readFileSync(join(docDir(type), file), "utf8") : null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// ── 注册命令和工具 ──
|
|
129
|
+
|
|
130
|
+
function handleDocCommand(type: DocType, rawArgs: string, ctx: any): void {
|
|
131
|
+
const cfg = DOC_CONFIG[type];
|
|
132
|
+
const label = cfg.plural.toLowerCase();
|
|
133
|
+
const a = rawArgs.trim();
|
|
134
|
+
|
|
135
|
+
if (!a || a === "list" || a === "ls") {
|
|
136
|
+
const docs = listOpen(type);
|
|
137
|
+
if (!docs.length) { ctx.ui.notify(`没有${label}。`, "info"); return; }
|
|
138
|
+
ctx.ui.notify(`${label}:\n` + docs.map((d: DocMeta) => ` #${pad(d.num)} ${d.title}`).join("\n"), "info");
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (cfg.hasStatus) {
|
|
143
|
+
const close = a.match(/^(?:close|fix|fixed|resolve|done|解决|关)\s+#?(\d+)$/i);
|
|
144
|
+
if (close) {
|
|
145
|
+
const n = parseInt(close[1], 10);
|
|
146
|
+
ctx.ui.notify(setStatus(type, n, "fixed") ? `#${pad(n)} 标记已解决。` : `没找到 #${close[1]}。`, "info");
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const show = a.match(/^#?(\d+)$/);
|
|
152
|
+
if (show) {
|
|
153
|
+
const txt = readDoc(type, parseInt(show[1], 10));
|
|
154
|
+
ctx.ui.notify(txt ?? `没找到 #${show[1]}。`, txt ? "info" : "warning");
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const num = addDoc(type, a, "");
|
|
159
|
+
ctx.ui.notify(`已记 ${type.toLowerCase()} #${pad(num)}:${a}`, "info");
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function installDocTracker(pi: ExtensionAPI): any[] {
|
|
163
|
+
const _cmds: any[] = [{
|
|
164
|
+
name: "docs",
|
|
165
|
+
desc: "/docs <issue|lesson|norm> [描述|list|编号|close 编号]",
|
|
166
|
+
handler: async (args: any, ctx: any) => {
|
|
167
|
+
const raw = (typeof args === "string" ? args : "").trim();
|
|
168
|
+
const spaceIdx = raw.indexOf(" ");
|
|
169
|
+
const sub = (spaceIdx === -1 ? raw : raw.slice(0, spaceIdx)).toUpperCase() as DocType;
|
|
170
|
+
const rest = spaceIdx === -1 ? "" : raw.slice(spaceIdx + 1);
|
|
171
|
+
if (!DOC_CONFIG[sub]) {
|
|
172
|
+
ctx.ui.notify("/docs issue|lesson|norm [描述|list|编号|close 编号]", "info");
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
handleDocCommand(sub, rest, ctx);
|
|
176
|
+
},
|
|
177
|
+
}];
|
|
178
|
+
|
|
179
|
+
if (process.env.PI_DEV) {
|
|
180
|
+
pi.registerTool({
|
|
181
|
+
name: "devdoc",
|
|
182
|
+
label: "DevDoc",
|
|
183
|
+
messageDescription: "记录开发文档(ISSUE/LESSON/NORM)到 Docs/Dev/ 目录。自动编号 + 自动索引。",
|
|
184
|
+
promptSnippet: "Log a dev document (issue/lesson/norm) — auto-numbered, auto-indexed",
|
|
185
|
+
parameters: {
|
|
186
|
+
type: "object" as any,
|
|
187
|
+
properties: {
|
|
188
|
+
doctype: { type: "string", messageDescription: "文档类型: ISSUE | LESSON | NORM" },
|
|
189
|
+
title: { type: "string", messageDescription: "一句话标题" },
|
|
190
|
+
detail: { type: "string", messageDescription: "详情内容" },
|
|
191
|
+
},
|
|
192
|
+
required: ["doctype", "title"],
|
|
193
|
+
},
|
|
194
|
+
async execute(_id: string, params: any) {
|
|
195
|
+
const raw = String(params?.doctype ?? "").toUpperCase().trim();
|
|
196
|
+
if (!(raw in DOC_CONFIG)) {
|
|
197
|
+
return { content: [{ type: "text", text: `未知类型 "${raw}"。可选: ${Object.keys(DOC_CONFIG).join(", ")}` }], details: {} };
|
|
198
|
+
}
|
|
199
|
+
const type = raw as DocType;
|
|
200
|
+
const num = addDoc(type, String(params?.title ?? "").trim() || "(无标题)", String(params?.detail ?? ""));
|
|
201
|
+
return {
|
|
202
|
+
content: [{ type: "text", text: `已记 ${type} #${pad(num)} → Docs/Dev/${DOC_CONFIG[type].plural}/` }],
|
|
203
|
+
details: { num, type },
|
|
204
|
+
};
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
return _cmds;
|
|
209
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
source: issue.ts @ c6ec459d
|
|
2
|
+
|
|
3
|
+
# issue.ts — Generalized dev document writer (ISSUE/LESSON/NORM)
|
|
4
|
+
|
|
5
|
+
## 职责
|
|
6
|
+
管理 pi-coding-master 项目的开发文档:ISSUE(有状态,可 open/fixed)、LESSON、NORM(无状态)。
|
|
7
|
+
自动编号(三位 NNN)、自动生成索引文件,提供 CLI 命令和 agent 工具两种入口。
|
|
8
|
+
|
|
9
|
+
## 接口
|
|
10
|
+
- `addDoc(type: DocType, title: string, detail: string): number` — 创建文档,返回编号
|
|
11
|
+
- `setStatus(type: DocType, num: number, status: string): boolean` — 仅 ISSUE 可设状态
|
|
12
|
+
- `listOpen(type: DocType): DocMeta[]` — 列出打开的(LESSON/NORM 返回全部)
|
|
13
|
+
- `readDoc(type: DocType, num: number): string | null` — 读取文档内容
|
|
14
|
+
- `installDocTracker(pi: ExtensionAPI): void` — 注册 /issue /lesson /norm 命令 + devdoc 工具
|
|
15
|
+
|
|
16
|
+
## 依赖
|
|
17
|
+
- `@mariozechner/pi-coding-agent` (ExtensionAPI)
|
|
18
|
+
- `node:fs`, `node:path`
|
|
19
|
+
- 写入目录: `PROJECT_ROOT/Docs.Dev.{Issues|Lessons|Norms}/`
|
|
20
|
+
|
|
21
|
+
## 行为要点
|
|
22
|
+
- 文件命名: `NNN-slug.{TYPE}.md`,slug 由 `slugify()` 生成(40 字符上限)
|
|
23
|
+
- 每次 addDoc / setStatus 后自动 `regenIndex()` 重建 `{Plural}.INDEX` 索引
|
|
24
|
+
- ISSUE 索引按 open/已解决 两栏分列;LESSON/NORM 索引只有一栏
|
|
25
|
+
- devdoc 工具仅在 `PI_DEV=1` 时注册(开发模式)
|
|
26
|
+
- DocType 是字面联合类型 `"ISSUE" | "LESSON" | "NORM"`
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// watcher.ts — 文件变动监控 + 自动部署 + 推送给 agent
|
|
2
|
+
// 启动时对源码目录 recursive watch,有 .ts 文件变动 → auto build → deploy → 推消息
|
|
3
|
+
import { watch } from "node:fs";
|
|
4
|
+
import { exec } from "node:child_process";
|
|
5
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
6
|
+
|
|
7
|
+
export function installWatcher(pi: ExtensionAPI, devRoot: string) {
|
|
8
|
+
const { existsSync } = require("node:fs");
|
|
9
|
+
if (!existsSync(devRoot)) return;
|
|
10
|
+
|
|
11
|
+
// 自动发现 device-manifest.ts 所在目录
|
|
12
|
+
const { execSync: es } = require("node:child_process");
|
|
13
|
+
let srcDir = "";
|
|
14
|
+
try {
|
|
15
|
+
srcDir = es(`find "${devRoot}" -name 'technology-manifest.ts' -not -path '*/node_modules/*' -not -path '*/individual.bio.*/*' 2>/dev/null | head -1`, { encoding: "utf8" }).trim();
|
|
16
|
+
} catch { return; }
|
|
17
|
+
if (!srcDir) return;
|
|
18
|
+
srcDir = require("node:path").dirname(srcDir);
|
|
19
|
+
|
|
20
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
21
|
+
const deploy = () => {
|
|
22
|
+
const cmd = `find "${devRoot}" -name 'technology-manifest.ts' -not -path '*/node_modules/*' -not -path '*/individual.bio.*/*' | head -1 | xargs dirname | xargs -I{} rsync -a {}/ ~/.pi/agent/extensions/device/`;
|
|
23
|
+
exec(cmd, (err, stdout, stderr) => {
|
|
24
|
+
const out = stdout + stderr;
|
|
25
|
+
if (!err) return; // silent on success
|
|
26
|
+
try {
|
|
27
|
+
pi.sendMessage({
|
|
28
|
+
messageType: "watcher-deploy",
|
|
29
|
+
content: `WARN: auto-deploy failed:\n${stderr}`,
|
|
30
|
+
isDisplayedInTUI: true,
|
|
31
|
+
}, { deliverAs: "nextTurn" });
|
|
32
|
+
} catch {}
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const w = watch(srcDir, { recursive: true }, (_event, filename) => {
|
|
38
|
+
if (!filename || !filename.endsWith(".ts")) return;
|
|
39
|
+
if (timer) clearTimeout(timer);
|
|
40
|
+
timer = setTimeout(deploy, 2000);
|
|
41
|
+
});
|
|
42
|
+
(globalThis as any).__piWatcher = w;
|
|
43
|
+
} catch {}
|
|
44
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
source: watcher.ts @ d2f81091
|
|
2
|
+
|
|
3
|
+
# watcher.ts — File change auto-deploy
|
|
4
|
+
|
|
5
|
+
## 职责
|
|
6
|
+
对开发源码目录做 recursive watch,检测 `.ts` 文件变动后自动 rsync 部署到
|
|
7
|
+
`~/.pi/agent/extensions/device/`,实现"改源码即生效"的开发体验。
|
|
8
|
+
|
|
9
|
+
## 接口
|
|
10
|
+
- `installWatcher(pi: ExtensionAPI, devRoot: string): void` — 启动监控
|
|
11
|
+
|
|
12
|
+
## 依赖
|
|
13
|
+
- `node:fs` (watch, existsSync)
|
|
14
|
+
- `node:child_process` (exec, execSync)
|
|
15
|
+
- `node:path`
|
|
16
|
+
- `@mariozechner/pi-coding-agent` (ExtensionAPI — 用 sendMessage 报错)
|
|
17
|
+
|
|
18
|
+
## 行为要点
|
|
19
|
+
- 通过 `find` 定位 `technology-manifest.ts` 所在目录作为监控根
|
|
20
|
+
- 排除 `node_modules/` 和 `individual.bio.*/` 路径
|
|
21
|
+
- 2 秒防抖: 连续变动只触发一次部署(clearTimeout + setTimeout 2000ms)
|
|
22
|
+
- 部署方式: rsync -a 到 `~/.pi/agent/extensions/device/`
|
|
23
|
+
- 成功时静默,失败时通过 `pi.sendMessage` 推送 watcher-deploy 告警
|
|
24
|
+
- watcher 实例存在 `globalThis.__piWatcher` 上(便于外部引用/清理)
|
|
25
|
+
- devRoot 不存在或找不到 manifest 时直接 return,不报错
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# pi 命令 zsh 补全。安装位置:~/.pi/agent/pi-completion.zsh(由 install.sh 部署)。
|
|
2
|
+
# 在 ~/.zshrc 里: source "$HOME/.pi/agent/pi-completion.zsh"
|
|
3
|
+
# 需要 compinit 已初始化(zsh 默认 autoload -Uz compinit; compinit)。
|
|
4
|
+
_pi_comp() {
|
|
5
|
+
local plist="$HOME/.pi/memory/plist.json"
|
|
6
|
+
[[ ! -f "$plist" ]] && return
|
|
7
|
+
local IFS=$'\n'
|
|
8
|
+
local -a active archived flags
|
|
9
|
+
# 在列表里的人(pi <名字> 进入)= 非归档;已归档的人(--unarchive 恢复用)
|
|
10
|
+
active=($(node -e "try{JSON.parse(require('fs').readFileSync('$plist','utf8')).filter(p=>!p.archived).forEach(p=>console.log(p.name))}catch(e){}" 2>/dev/null))
|
|
11
|
+
archived=($(node -e "try{JSON.parse(require('fs').readFileSync('$plist','utf8')).filter(p=>p.archived).forEach(p=>console.log(p.name))}catch(e){}" 2>/dev/null))
|
|
12
|
+
flags=(--sc --archive --unarchive --archived)
|
|
13
|
+
# 按上一个词决定补什么:--unarchive 补已归档;--archive/--sc 补在列表里的人;否则补 人 + flags。
|
|
14
|
+
case "${words[CURRENT-1]}" in
|
|
15
|
+
--unarchive) compadd -a archived ;;
|
|
16
|
+
--archive|--sc) compadd -a active ;;
|
|
17
|
+
--archived) ;; # 它不带参数
|
|
18
|
+
*) compadd -a active; compadd -a flags ;;
|
|
19
|
+
esac
|
|
20
|
+
}
|
|
21
|
+
compdef _pi_comp pi
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[2026-06-12 16:15:23] edited (auto-logged, no messageDescription)
|