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
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
// apps.preinstalled/calendar/calendar.ts — Calendar app
|
|
2
|
+
// v0.2 spec: 日历 — 日程管理、提醒、查询
|
|
3
|
+
// "记录、查看、会有提醒日程等"
|
|
4
|
+
// v0.3: 集成节假日日历 (根据 Settings 地区自动加载)
|
|
5
|
+
|
|
6
|
+
import * as fs from "fs";
|
|
7
|
+
import * as path from "path";
|
|
8
|
+
import { getRegion, getHolidaysForDate, getHolidaysForRange, solarToLunar, type Holiday } from "./holiday-calendar.ts";
|
|
9
|
+
|
|
10
|
+
// ── Event types ─────────────────────────────────────────────────
|
|
11
|
+
interface CalendarEvent {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
messageDescription?: string;
|
|
15
|
+
start: string; // ISO timestamp
|
|
16
|
+
end?: string; // ISO timestamp (null = point-in-time)
|
|
17
|
+
allDay: boolean;
|
|
18
|
+
location?: string;
|
|
19
|
+
recurring?: { // simple recurrence
|
|
20
|
+
rule: "daily" | "weekly" | "monthly" | "yearly";
|
|
21
|
+
interval: number; // every N days/weeks/months/years
|
|
22
|
+
until?: string; // ISO end date
|
|
23
|
+
};
|
|
24
|
+
reminders: number[]; // minutes before event to remind
|
|
25
|
+
tags: string[];
|
|
26
|
+
created: string;
|
|
27
|
+
updated: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// ── Storage ─────────────────────────────────────────────────────
|
|
31
|
+
function eventsPath(personDir: string) {
|
|
32
|
+
return path.join(personDir, "calendar.json");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function loadEvents(personDir: string): CalendarEvent[] {
|
|
36
|
+
try {
|
|
37
|
+
return JSON.parse(fs.readFileSync(eventsPath(personDir), "utf8"));
|
|
38
|
+
} catch {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function saveEvents(personDir: string, events: CalendarEvent[]) {
|
|
44
|
+
fs.writeFileSync(eventsPath(personDir), JSON.stringify(events, null, 2));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function genId(): string {
|
|
48
|
+
return `ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ── Time helpers ────────────────────────────────────────────────
|
|
52
|
+
function today(): string {
|
|
53
|
+
return new Date().toISOString().slice(0, 10);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function dayStart(date: string): Date {
|
|
57
|
+
return new Date(date + "T00:00:00");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function dayEnd(date: string): Date {
|
|
61
|
+
return new Date(date + "T23:59:59");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function eventsOnDay(events: CalendarEvent[], date: string): CalendarEvent[] {
|
|
65
|
+
const start = dayStart(date);
|
|
66
|
+
const end = dayEnd(date);
|
|
67
|
+
return events.filter(e => {
|
|
68
|
+
const eStart = new Date(e.start);
|
|
69
|
+
const eEnd = e.end ? new Date(e.end) : eStart;
|
|
70
|
+
return eStart <= end && eEnd >= start;
|
|
71
|
+
}).sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function upcomingEvents(events: CalendarEvent[], days = 7): CalendarEvent[] {
|
|
75
|
+
const now = new Date();
|
|
76
|
+
const cutoff = new Date(now.getTime() + days * 24 * 60 * 60 * 1000);
|
|
77
|
+
return events.filter(e => {
|
|
78
|
+
const eStart = new Date(e.start);
|
|
79
|
+
return eStart >= now && eStart <= cutoff;
|
|
80
|
+
}).sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime());
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ── Render ──────────────────────────────────────────────────────
|
|
84
|
+
function formatTime(iso: string): string {
|
|
85
|
+
const d = new Date(iso);
|
|
86
|
+
return d.toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function formatDate(iso: string): string {
|
|
90
|
+
const d = new Date(iso);
|
|
91
|
+
return d.toLocaleDateString("zh-CN", { month: "short", day: "numeric", weekday: "short" });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function formatDateShort(iso: string): string {
|
|
95
|
+
const d = new Date(iso);
|
|
96
|
+
return d.toLocaleDateString("zh-CN", { month: "short", day: "numeric" });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function formatLunarDate(date: string): string {
|
|
100
|
+
const lunar = solarToLunar(date);
|
|
101
|
+
return lunar ? `农历${lunar.monthName}月${lunar.dayName}` : "";
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function renderHoliday(h: Holiday): string {
|
|
105
|
+
const lunarStr = h.lunar ? ` (${h.lunar})` : "";
|
|
106
|
+
return ` ${h.emoji} **${h.name}**${lunarStr} — 节假日`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function renderEvent(e: CalendarEvent, showDate = true): string {
|
|
110
|
+
const timeStr = e.allDay
|
|
111
|
+
? "全天"
|
|
112
|
+
: e.end
|
|
113
|
+
? `${formatTime(e.start)}–${formatTime(e.end)}`
|
|
114
|
+
: formatTime(e.start);
|
|
115
|
+
const dateStr = showDate ? `${formatDate(e.start)} ` : "";
|
|
116
|
+
const descStr = e.messageDescription ? `\n ${e.messageDescription.slice(0, 100)}` : "";
|
|
117
|
+
const locStr = e.location ? ` · ${e.location}` : "";
|
|
118
|
+
const recurStr = e.recurring ? ` · ${e.recurring.rule}` : "";
|
|
119
|
+
const remindStr = (e.reminders && e.reminders.length > 0) ? ` · ${e.reminders.join(",")}min` : "";
|
|
120
|
+
const tagsStr = (e.tags && e.tags.length > 0) ? ` · ${e.tags.join(",")}` : "";
|
|
121
|
+
|
|
122
|
+
return `${dateStr}**${e.title}**\n ${timeStr}${locStr}${recurStr}${remindStr}${tagsStr}${descStr}`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function groupByMonth(holidays: Holiday[], region: Region): string {
|
|
126
|
+
const grouped: Record<string, Holiday[]> = {};
|
|
127
|
+
for (const h of holidays) {
|
|
128
|
+
const m = h.date.slice(0, 7);
|
|
129
|
+
(grouped[m] ??= []).push(h);
|
|
130
|
+
}
|
|
131
|
+
const lines: string[] = [];
|
|
132
|
+
const regionLabel = region === "US" ? "美国" : "中国";
|
|
133
|
+
lines.push(`**节假日日历 · ${regionLabel}**`);
|
|
134
|
+
for (const [month, items] of Object.entries(grouped).sort()) {
|
|
135
|
+
const d = new Date(month + "-01");
|
|
136
|
+
const label = d.toLocaleDateString("zh-CN", { year: "numeric", month: "long" });
|
|
137
|
+
lines.push(`\n**${label}**`);
|
|
138
|
+
for (const h of items) {
|
|
139
|
+
const day = parseInt(h.date.slice(8, 10));
|
|
140
|
+
const wd = new Date(h.date + "T00:00:00").toLocaleDateString("zh-CN", { weekday: "short" });
|
|
141
|
+
const lunarStr = h.lunar ? ` (${h.lunar})` : "";
|
|
142
|
+
lines.push(` ${h.emoji} ${day}日 ${wd} · **${h.name}**${lunarStr}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return lines.join("\n");
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// ── Main handler ───────────────────────────────────────────────
|
|
149
|
+
export async function calendarCmd(args: any, _ctx: any, personDir: string): Promise<any> {
|
|
150
|
+
const events = loadEvents(personDir);
|
|
151
|
+
const region = getRegion(personDir);
|
|
152
|
+
|
|
153
|
+
// --add: create event
|
|
154
|
+
if (args.add) {
|
|
155
|
+
const title = typeof args.add === "string" ? args.add : args._?.[1];
|
|
156
|
+
if (!title) return { content: [{ type: "text", text: "Usage: calendar --add <title> [--start <ISO>] [--end <ISO>] [--all-day] [--desc <text>] [--location <text>] [--remind <minutes>]" }] };
|
|
157
|
+
|
|
158
|
+
const event: CalendarEvent = {
|
|
159
|
+
id: genId(),
|
|
160
|
+
title,
|
|
161
|
+
messageDescription: args.desc as string | undefined,
|
|
162
|
+
start: (args.start as string) || new Date().toISOString(),
|
|
163
|
+
end: args.end as string | undefined,
|
|
164
|
+
allDay: !!args["all-day"] || !!args.allDay,
|
|
165
|
+
location: args.location as string | undefined,
|
|
166
|
+
reminders: args.remind ? [parseInt(args.remind as string) || 15] : [15],
|
|
167
|
+
tags: [],
|
|
168
|
+
created: new Date().toISOString(),
|
|
169
|
+
updated: new Date().toISOString(),
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
events.push(event);
|
|
173
|
+
saveEvents(personDir, events);
|
|
174
|
+
return { content: [{ type: "text", text: `Event created:\n${renderEvent(event)}` }] };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// --today: today's events + holidays
|
|
178
|
+
if (args.today) {
|
|
179
|
+
const td = today();
|
|
180
|
+
const todaysEvents = eventsOnDay(events, td);
|
|
181
|
+
const todaysHolidays = getHolidaysForDate(region, td);
|
|
182
|
+
const lunarToday = formatLunarDate(td);
|
|
183
|
+
const lines = [`**Today — ${formatDate(td)}**${lunarToday ? ` · ${lunarToday}` : ""}`];
|
|
184
|
+
if (todaysHolidays.length > 0) {
|
|
185
|
+
todaysHolidays.forEach(h => lines.push(renderHoliday(h)));
|
|
186
|
+
}
|
|
187
|
+
if (todaysEvents.length === 0 && todaysHolidays.length === 0) {
|
|
188
|
+
lines.push(" No events today.");
|
|
189
|
+
} else if (todaysEvents.length > 0) {
|
|
190
|
+
lines.push(todaysHolidays.length > 0 ? "" : "");
|
|
191
|
+
todaysEvents.forEach(e => lines.push(renderEvent(e, false)));
|
|
192
|
+
}
|
|
193
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// --upcoming: next N days + holidays
|
|
197
|
+
if (args.upcoming) {
|
|
198
|
+
const days = parseInt(args.upcoming as string) || 7;
|
|
199
|
+
const upcoming = upcomingEvents(events, days);
|
|
200
|
+
const now = new Date();
|
|
201
|
+
const cutoff = new Date(now.getTime() + days * 24 * 60 * 60 * 1000);
|
|
202
|
+
const upcomingHolidays = getHolidaysForRange(region, now.toISOString().slice(0, 10), cutoff.toISOString().slice(0, 10));
|
|
203
|
+
const lines = [`**Upcoming (${days} days)**`];
|
|
204
|
+
if (upcomingHolidays.length > 0) {
|
|
205
|
+
upcomingHolidays.forEach(h => lines.push(` ${h.emoji} ${formatDateShort(h.date)} · **${h.name}**${h.lunar ? ` (${h.lunar})` : ""}`));
|
|
206
|
+
if (upcoming.length > 0) lines.push("");
|
|
207
|
+
}
|
|
208
|
+
if (upcoming.length === 0 && upcomingHolidays.length === 0) {
|
|
209
|
+
lines.push(" No upcoming events.");
|
|
210
|
+
} else {
|
|
211
|
+
upcoming.forEach(e => lines.push(renderEvent(e)));
|
|
212
|
+
}
|
|
213
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// --date <YYYY-MM-DD>: specific date + holidays
|
|
217
|
+
if (args.date) {
|
|
218
|
+
const date = args.date as string;
|
|
219
|
+
const dayEvents = eventsOnDay(events, date);
|
|
220
|
+
const dayHolidays = getHolidaysForDate(region, date);
|
|
221
|
+
const lunarDate = formatLunarDate(date);
|
|
222
|
+
const lines = [`**${formatDate(date + "T00:00:00")}**${lunarDate ? ` · ${lunarDate}` : ""}`];
|
|
223
|
+
if (dayHolidays.length > 0) {
|
|
224
|
+
dayHolidays.forEach(h => lines.push(renderHoliday(h)));
|
|
225
|
+
if (dayEvents.length > 0) lines.push("");
|
|
226
|
+
}
|
|
227
|
+
if (dayEvents.length === 0 && dayHolidays.length === 0) {
|
|
228
|
+
lines.push(" No events.");
|
|
229
|
+
} else {
|
|
230
|
+
dayEvents.forEach(e => lines.push(renderEvent(e, false)));
|
|
231
|
+
}
|
|
232
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// --show <id>: detail
|
|
236
|
+
if (args.show) {
|
|
237
|
+
const id = args.show as string;
|
|
238
|
+
const e = events.find(x => x.id === id);
|
|
239
|
+
if (!e) return { content: [{ type: "text", text: `Event not found: ${id}` }] };
|
|
240
|
+
return { content: [{ type: "text", text: renderEvent(e) + `\n ID: \`${e.id}\`\n Created: ${e.created.slice(0, 16)}` }] };
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// --delete <id>
|
|
244
|
+
if (args.delete) {
|
|
245
|
+
const id = args.delete as string;
|
|
246
|
+
const idx = events.findIndex(x => x.id === id);
|
|
247
|
+
if (idx === -1) return { content: [{ type: "text", text: `Event not found: ${id}` }] };
|
|
248
|
+
|
|
249
|
+
const title = events[idx].title;
|
|
250
|
+
events.splice(idx, 1);
|
|
251
|
+
saveEvents(personDir, events);
|
|
252
|
+
return { content: [{ type: "text", text: `Deleted: **${title}**` }] };
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// --search <q>: search events + holidays
|
|
256
|
+
if (args.search) {
|
|
257
|
+
const q = (args.search as string).toLowerCase();
|
|
258
|
+
const results = events.filter(e =>
|
|
259
|
+
e.title.toLowerCase().includes(q) ||
|
|
260
|
+
(e.messageDescription && e.messageDescription.toLowerCase().includes(q)) ||
|
|
261
|
+
(e.location && e.location.toLowerCase().includes(q)) ||
|
|
262
|
+
(e.tags && e.tags.some((t: string) => t.toLowerCase().includes(q)))
|
|
263
|
+
).sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime());
|
|
264
|
+
|
|
265
|
+
// Also search holidays
|
|
266
|
+
const year = parseInt(today().slice(0, 4));
|
|
267
|
+
const allHolidays = getHolidaysForRange(region, `${year}-01-01`, `${year + 1}-12-31`);
|
|
268
|
+
const holidayResults = allHolidays.filter(h => h.name.toLowerCase().includes(q));
|
|
269
|
+
|
|
270
|
+
if (results.length === 0 && holidayResults.length === 0) return { content: [{ type: "text", text: `No events matching "${args.search}".` }] };
|
|
271
|
+
const total = results.length + holidayResults.length;
|
|
272
|
+
const lines = [`**Search: "${args.search}" (${total})**`];
|
|
273
|
+
if (holidayResults.length > 0) {
|
|
274
|
+
holidayResults.forEach(h => lines.push(` ${h.emoji} ${formatDateShort(h.date)} · **${h.name}**${h.lunar ? ` (${h.lunar})` : ""}`));
|
|
275
|
+
}
|
|
276
|
+
results.forEach(e => lines.push(renderEvent(e)));
|
|
277
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// --holidays: show all holidays for current region
|
|
281
|
+
if (args.holidays) {
|
|
282
|
+
const year = parseInt(args.holidays as string) || parseInt(today().slice(0, 4));
|
|
283
|
+
const all = getHolidaysForRange(region, `${year}-01-01`, `${year}-12-31`);
|
|
284
|
+
return { content: [{ type: "text", text: groupByMonth(all, region) }] };
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// default: overview — today + upcoming + holidays
|
|
288
|
+
const td = today();
|
|
289
|
+
const todaysEvents = eventsOnDay(events, td);
|
|
290
|
+
const todaysHolidays = getHolidaysForDate(region, td);
|
|
291
|
+
const upcoming = upcomingEvents(events, 7);
|
|
292
|
+
const regionLabel = region === "US" ? "美国" : "中国";
|
|
293
|
+
|
|
294
|
+
const lines = [`**Calendar** — ${formatDate(td + "T00:00:00")} · ${regionLabel}`];
|
|
295
|
+
|
|
296
|
+
// Today's holidays
|
|
297
|
+
if (todaysHolidays.length > 0) {
|
|
298
|
+
lines.push(`\n**今日节日:**`);
|
|
299
|
+
todaysHolidays.forEach(h => lines.push(renderHoliday(h)));
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Today's events
|
|
303
|
+
if (todaysEvents.length > 0) {
|
|
304
|
+
lines.push(`\n**今日日程 (${todaysEvents.length}):**`);
|
|
305
|
+
todaysEvents.forEach(e => lines.push(renderEvent(e, false)));
|
|
306
|
+
} else if (todaysHolidays.length === 0) {
|
|
307
|
+
lines.push("\n今日无日程");
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Upcoming holidays (next 7 days)
|
|
311
|
+
const now = new Date();
|
|
312
|
+
const cutoff = new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000);
|
|
313
|
+
const upcomingHolidays = getHolidaysForRange(region, now.toISOString().slice(0, 10), cutoff.toISOString().slice(0, 10))
|
|
314
|
+
.filter(h => h.date !== td);
|
|
315
|
+
if (upcomingHolidays.length > 0) {
|
|
316
|
+
lines.push(`\n**近期节日:**`);
|
|
317
|
+
upcomingHolidays.forEach(h => lines.push(` ${h.emoji} ${formatDateShort(h.date)} · **${h.name}**${h.lunar ? ` (${h.lunar})` : ""}`));
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// Upcoming events
|
|
321
|
+
if (upcoming.length > 0) {
|
|
322
|
+
lines.push(`\n**未来7天日程:**`);
|
|
323
|
+
upcoming.forEach(e => lines.push(renderEvent(e)));
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
lines.push(`\n操作: 今天 | 未来 | 日期 YYYY-MM-DD | 节日 | 搜索 <词> | 添加 <标题> | 详情 <id> | 删除 <id>`);
|
|
327
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export { type CalendarEvent, loadEvents, eventsOnDay, upcomingEvents };
|
|
331
|
+
|
|
332
|
+
// ── PhoneApp wrapper ──────────────────────────────────────────
|
|
333
|
+
import type { PhoneApp } from "../../system.kernel/kernel.ts";
|
|
334
|
+
|
|
335
|
+
export const app: PhoneApp = {
|
|
336
|
+
name: "日历",
|
|
337
|
+
icon: "日历",
|
|
338
|
+
messageDescription: "日程管理、查询、提醒",
|
|
339
|
+
|
|
340
|
+
onOpen(state, personDir) {
|
|
341
|
+
const events = loadEvents(personDir);
|
|
342
|
+
const region = getRegion(personDir);
|
|
343
|
+
const regionLabel = region === "US" ? "美国" : "中国";
|
|
344
|
+
const td = today();
|
|
345
|
+
const todaysEvents = eventsOnDay(events, td);
|
|
346
|
+
const todaysHolidays = getHolidaysForDate(region, td);
|
|
347
|
+
const upcoming = upcomingEvents(events, 7);
|
|
348
|
+
|
|
349
|
+
const lunarTodayStr = formatLunarDate(td);
|
|
350
|
+
const lines = [
|
|
351
|
+
"═══ 日历 ═══",
|
|
352
|
+
"",
|
|
353
|
+
` 今天: ${formatDate(td + "T00:00:00")}${lunarTodayStr ? ` · ${lunarTodayStr}` : ""}`,
|
|
354
|
+
` 地区: ${regionLabel} (去设置切换)`,
|
|
355
|
+
` 今日日程: ${todaysEvents.length} 件`,
|
|
356
|
+
todaysHolidays.length > 0 ? ` 今日节日: ${todaysHolidays.map(h => h.name).join(", ")}` : "",
|
|
357
|
+
` 未来7天: ${upcoming.length} 件`,
|
|
358
|
+
"",
|
|
359
|
+
" 操作:",
|
|
360
|
+
" · 今天 — 查看今日日程+节日",
|
|
361
|
+
" · 未来 — 查看未来7天",
|
|
362
|
+
" · 日期 YYYY-MM-DD — 查看指定日期",
|
|
363
|
+
" · 节日 [年] — 查看全年节假日",
|
|
364
|
+
" · 添加 <标题> — 创建日程",
|
|
365
|
+
" · 搜索 <关键词> — 搜索日程和节日",
|
|
366
|
+
" · 详情 <id> — 查看日程详情",
|
|
367
|
+
" · 删除 <id> — 删除日程",
|
|
368
|
+
"",
|
|
369
|
+
" 返回 — 回主屏幕",
|
|
370
|
+
].filter(l => l !== "");
|
|
371
|
+
return { screen: lines.join("\n"), state: state ?? {} };
|
|
372
|
+
},
|
|
373
|
+
|
|
374
|
+
async onAction(input, state, personDir) {
|
|
375
|
+
const trimmed = input.trim();
|
|
376
|
+
let args: any = {};
|
|
377
|
+
|
|
378
|
+
if (/^(今天|today)$/i.test(trimmed)) {
|
|
379
|
+
args = { today: true };
|
|
380
|
+
} else if (/^(未来|upcoming)(\s+(\d+))?$/i.test(trimmed)) {
|
|
381
|
+
const m = trimmed.match(/(\d+)/);
|
|
382
|
+
args = { upcoming: m ? m[1] : "7" };
|
|
383
|
+
} else if (/^日期\s+(\d{4}-\d{2}-\d{2})$/.test(trimmed)) {
|
|
384
|
+
args = { date: trimmed.match(/(\d{4}-\d{2}-\d{2})/)![1] };
|
|
385
|
+
} else if (/^节日(\s+(\d{4}))?$/.test(trimmed)) {
|
|
386
|
+
const m = trimmed.match(/(\d{4})/);
|
|
387
|
+
args = { holidays: m ? m[1] : String(new Date().getFullYear()) };
|
|
388
|
+
} else if (/^(添加|add)\s+(.+)$/i.test(trimmed)) {
|
|
389
|
+
const m = trimmed.match(/^(?:添加|add)\s+(.+)$/i)!;
|
|
390
|
+
args = { add: m[1] };
|
|
391
|
+
} else if (/^(搜索|search)\s+(.+)$/i.test(trimmed)) {
|
|
392
|
+
const m = trimmed.match(/^(?:搜索|search)\s+(.+)$/i)!;
|
|
393
|
+
args = { search: m[1] };
|
|
394
|
+
} else if (/^(详情|show)\s+(.+)$/i.test(trimmed)) {
|
|
395
|
+
const m = trimmed.match(/^(?:详情|show)\s+(.+)$/i)!;
|
|
396
|
+
args = { show: m[1] };
|
|
397
|
+
} else if (/^(删除|delete)\s+(.+)$/i.test(trimmed)) {
|
|
398
|
+
const m = trimmed.match(/^(?:删除|delete)\s+(.+)$/i)!;
|
|
399
|
+
args = { delete: m[1] };
|
|
400
|
+
}
|
|
401
|
+
// default: show overview
|
|
402
|
+
|
|
403
|
+
const result = await calendarCmd(args, {}, personDir);
|
|
404
|
+
return { screen: result.content[0].text, state: state ?? {} };
|
|
405
|
+
},
|
|
406
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
source: calendar.ts @ 1c043154
|
|
2
|
+
|
|
3
|
+
# Calendar -- 日历日程管理
|
|
4
|
+
|
|
5
|
+
## 功能
|
|
6
|
+
创建、查询、搜索、删除日程事件。支持全天事件、地点、简单循环规则、提醒分钟数、标签。
|
|
7
|
+
|
|
8
|
+
## 操作
|
|
9
|
+
- `--add <title>` -- 创建事件(可选 `--start`/`--end` ISO, `--all-day`, `--desc`, `--location`, `--remind <min>`)
|
|
10
|
+
- `--today` -- 今日日程
|
|
11
|
+
- `--upcoming [N]` -- 未来 N 天(默认 7)
|
|
12
|
+
- `--date <YYYY-MM-DD>` -- 指定日期日程
|
|
13
|
+
- `--show <id>` -- 事件详情
|
|
14
|
+
- `--delete <id>` -- 删除事件
|
|
15
|
+
- `--search <q>` -- 按标题/描述/地点/标签搜索
|
|
16
|
+
- 无参数 -- 显示今日 + 未来 7 天概览
|
|
17
|
+
|
|
18
|
+
## 数据
|
|
19
|
+
`{personDir}/calendar.json` -- CalendarEvent[] JSON 数组。
|
|
20
|
+
|
|
21
|
+
## 备注
|
|
22
|
+
导出 `CalendarEvent` 类型及 `loadEvents`/`eventsOnDay`/`upcomingEvents` 供其他模块使用(如提醒检查)。
|