wezard 2.9.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +34 -15
- package/README.md +36 -49
- package/cli/wezard.sh +3 -0
- package/config.example.jsonc +2 -8
- package/dist/cli/init.js +35 -0
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/skills.js +113 -0
- package/dist/cli/skills.js.map +1 -0
- package/dist/cli/sync.js.map +1 -1
- package/dist/daemon/apprentice.js +75 -0
- package/dist/daemon/apprentice.js.map +1 -0
- package/dist/daemon/approval.js +26 -7
- package/dist/daemon/approval.js.map +1 -1
- package/dist/daemon/channel-context.js +7 -0
- package/dist/daemon/channel-context.js.map +1 -1
- package/dist/daemon/channel-posts.js +53 -0
- package/dist/daemon/channel-posts.js.map +1 -0
- package/dist/daemon/channel.js +124 -12
- package/dist/daemon/channel.js.map +1 -1
- package/dist/daemon/chat-name.js +24 -161
- package/dist/daemon/chat-name.js.map +1 -1
- package/dist/daemon/classes.js +418 -0
- package/dist/daemon/classes.js.map +1 -0
- package/dist/daemon/config-api.js +1 -1
- package/dist/daemon/detail.js +14 -8
- package/dist/daemon/detail.js.map +1 -1
- package/dist/daemon/handoff.js +51 -50
- package/dist/daemon/handoff.js.map +1 -1
- package/dist/daemon/http.js +25 -18
- package/dist/daemon/http.js.map +1 -1
- package/dist/daemon/idle-reap.js +30 -0
- package/dist/daemon/idle-reap.js.map +1 -0
- package/dist/daemon/inbound.js +360 -142
- package/dist/daemon/inbound.js.map +1 -1
- package/dist/daemon/index.js +2172 -2676
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/last-response.js +44 -9
- package/dist/daemon/last-response.js.map +1 -1
- package/dist/daemon/memory-steward.js +1 -1
- package/dist/daemon/memory-steward.js.map +1 -1
- package/dist/daemon/message-format.js +10 -2
- package/dist/daemon/message-format.js.map +1 -1
- package/dist/daemon/mirror-bridge.js +511 -467
- package/dist/daemon/mirror-bridge.js.map +1 -1
- package/dist/daemon/mirror-store.js +24 -0
- package/dist/daemon/mirror-store.js.map +1 -1
- package/dist/daemon/notices.js +2 -2
- package/dist/daemon/notices.js.map +1 -1
- package/dist/daemon/onboarding.js +384 -0
- package/dist/daemon/onboarding.js.map +1 -0
- package/dist/daemon/outbound.js +21 -11
- package/dist/daemon/outbound.js.map +1 -1
- package/dist/daemon/peers.js +38 -230
- package/dist/daemon/peers.js.map +1 -1
- package/dist/daemon/plans.js.map +1 -1
- package/dist/daemon/room-auto-adhoc.js +18 -0
- package/dist/daemon/room-auto-adhoc.js.map +1 -0
- package/dist/daemon/room-facts.js +35 -0
- package/dist/daemon/room-facts.js.map +1 -0
- package/dist/daemon/room-hub.js +430 -0
- package/dist/daemon/room-hub.js.map +1 -0
- package/dist/daemon/room-overdue.js +98 -0
- package/dist/daemon/room-overdue.js.map +1 -0
- package/dist/daemon/room-prune.js +74 -0
- package/dist/daemon/room-prune.js.map +1 -0
- package/dist/daemon/room-spawn.js +20 -0
- package/dist/daemon/room-spawn.js.map +1 -0
- package/dist/daemon/room-watchdog.js +153 -0
- package/dist/daemon/room-watchdog.js.map +1 -0
- package/dist/daemon/rooms.js +107 -0
- package/dist/daemon/rooms.js.map +1 -0
- package/dist/daemon/route.js +7 -18
- package/dist/daemon/route.js.map +1 -1
- package/dist/daemon/spawn-tmux.js +48 -36
- package/dist/daemon/spawn-tmux.js.map +1 -1
- package/dist/daemon/steward-guard.js +2 -2
- package/dist/daemon/steward.js +132 -0
- package/dist/daemon/steward.js.map +1 -0
- package/dist/daemon/tasks.js +4 -14
- package/dist/daemon/tasks.js.map +1 -1
- package/dist/daemon/turn-opening.js +25 -0
- package/dist/daemon/turn-opening.js.map +1 -0
- package/dist/daemon/wake-tail.js +55 -0
- package/dist/daemon/wake-tail.js.map +1 -0
- package/dist/daemon/weixin-cmd.js +10 -14
- package/dist/daemon/weixin-cmd.js.map +1 -1
- package/dist/daemon/wezard-session.js +6 -2
- package/dist/daemon/wezard-session.js.map +1 -1
- package/dist/daemon/wizard-names.js +0 -22
- package/dist/daemon/wizard-names.js.map +1 -1
- package/dist/daemon/wizard.js +589 -145
- package/dist/daemon/wizard.js.map +1 -1
- package/dist/mcp/output.js +6 -5
- package/dist/mcp/output.js.map +1 -1
- package/dist/mcp/tools.js +247 -242
- package/dist/mcp/tools.js.map +1 -1
- package/dist/shared/allow-rules.js +1 -7
- package/dist/shared/allow-rules.js.map +1 -1
- package/dist/shared/charter-rearm.js +179 -0
- package/dist/shared/charter-rearm.js.map +1 -0
- package/dist/shared/chat-http.js +374 -459
- package/dist/shared/chat-http.js.map +1 -1
- package/dist/shared/chat-record.js +55 -0
- package/dist/shared/chat-record.js.map +1 -0
- package/dist/shared/chat-render.js +7 -4
- package/dist/shared/chat-render.js.map +1 -1
- package/dist/shared/chat-view.js +2 -41
- package/dist/shared/chat-view.js.map +1 -1
- package/dist/shared/cli-backends.js +13 -5
- package/dist/shared/cli-backends.js.map +1 -1
- package/dist/shared/config.js +48 -24
- package/dist/shared/config.js.map +1 -1
- package/dist/shared/detail-render.js +98 -21
- package/dist/shared/detail-render.js.map +1 -1
- package/dist/shared/detail-store.js.map +1 -1
- package/dist/shared/group-members.js +35 -0
- package/dist/shared/group-members.js.map +1 -0
- package/dist/shared/inject-view.js +105 -0
- package/dist/shared/inject-view.js.map +1 -0
- package/dist/shared/legacy-routes.js +199 -0
- package/dist/shared/legacy-routes.js.map +1 -0
- package/dist/shared/mem-guard.js +32 -0
- package/dist/shared/mem-guard.js.map +1 -0
- package/dist/shared/message-footer.js +4 -3
- package/dist/shared/message-footer.js.map +1 -1
- package/dist/shared/pricing.js +5 -0
- package/dist/shared/pricing.js.map +1 -1
- package/dist/shared/reminder.js +30 -38
- package/dist/shared/reminder.js.map +1 -1
- package/dist/shared/role-render.js +209 -210
- package/dist/shared/role-render.js.map +1 -1
- package/dist/shared/role-view.js +61 -299
- package/dist/shared/role-view.js.map +1 -1
- package/dist/shared/room-label.js +13 -0
- package/dist/shared/room-label.js.map +1 -0
- package/dist/shared/room-migrate.js +404 -0
- package/dist/shared/room-migrate.js.map +1 -0
- package/dist/shared/room-overdue.js +81 -0
- package/dist/shared/room-overdue.js.map +1 -0
- package/dist/shared/room-search.js +102 -0
- package/dist/shared/room-search.js.map +1 -0
- package/dist/shared/room-view.js +261 -0
- package/dist/shared/room-view.js.map +1 -0
- package/dist/shared/room.js +610 -0
- package/dist/shared/room.js.map +1 -0
- package/dist/shared/session-hooks.js +20 -8
- package/dist/shared/session-hooks.js.map +1 -1
- package/dist/shared/session-label.js +80 -60
- package/dist/shared/session-label.js.map +1 -1
- package/dist/shared/session-mcp.js +21 -3
- package/dist/shared/session-mcp.js.map +1 -1
- package/dist/shared/session-skills.js +8 -0
- package/dist/shared/session-skills.js.map +1 -1
- package/dist/shared/skill-sync.js +229 -0
- package/dist/shared/skill-sync.js.map +1 -0
- package/dist/shared/smarts.js +39 -0
- package/dist/shared/smarts.js.map +1 -0
- package/dist/shared/stream-page.js +22 -0
- package/dist/shared/stream-page.js.map +1 -0
- package/dist/shared/task-file.js +0 -5
- package/dist/shared/task-file.js.map +1 -1
- package/dist/shared/task-template.js +1 -1
- package/dist/shared/task-template.js.map +1 -1
- package/dist/shared/tool-hints.js +20 -11
- package/dist/shared/tool-hints.js.map +1 -1
- package/dist/shared/workspace-trust.js +8 -0
- package/dist/shared/workspace-trust.js.map +1 -1
- package/dist/shared/world.js +101 -166
- package/dist/shared/world.js.map +1 -1
- package/dist/svr/facts-store.js +26 -0
- package/dist/svr/facts-store.js.map +1 -0
- package/dist/svr/index.js +62 -6
- package/dist/svr/index.js.map +1 -1
- package/hooks/stop.sh +26 -0
- package/package.json +7 -2
- package/scripts/install.sh +11 -0
- package/skills/LICENSE.wecom-unified.txt +21 -0
- package/skills/wecom-unified/SKILL.md +151 -0
- package/skills/wecom-unified/assets/templates/broadside/DESIGN.preset.md +172 -0
- package/skills/wecom-unified/assets/templates/broadside/shell/content.jsx +31 -0
- package/skills/wecom-unified/assets/templates/broadside/slides/01_cover.slide +48 -0
- package/skills/wecom-unified/assets/templates/broadside/slides/02_section.slide +58 -0
- package/skills/wecom-unified/assets/templates/broadside/slides/03_cards.slide +53 -0
- package/skills/wecom-unified/assets/templates/broadside/slides/04_image.slide +64 -0
- package/skills/wecom-unified/assets/templates/cartesian/DESIGN.preset.md +139 -0
- package/skills/wecom-unified/assets/templates/cartesian/shell/content.jsx +28 -0
- package/skills/wecom-unified/assets/templates/cartesian/slides/01_cover.slide +44 -0
- package/skills/wecom-unified/assets/templates/cartesian/slides/02_compare.slide +79 -0
- package/skills/wecom-unified/assets/templates/cartesian/slides/03_table.slide +79 -0
- package/skills/wecom-unified/assets/templates/cobalt-grid/DESIGN.preset.md +118 -0
- package/skills/wecom-unified/assets/templates/cobalt-grid/shell/content.jsx +24 -0
- package/skills/wecom-unified/assets/templates/cobalt-grid/slides/01_cover.slide +61 -0
- package/skills/wecom-unified/assets/templates/cobalt-grid/slides/02_structure.slide +85 -0
- package/skills/wecom-unified/assets/templates/cobalt-grid/slides/03_data.slide +60 -0
- package/skills/wecom-unified/assets/templates/editorial-forest/DESIGN.preset.md +135 -0
- package/skills/wecom-unified/assets/templates/editorial-forest/shell/content.jsx +19 -0
- package/skills/wecom-unified/assets/templates/editorial-forest/slides/01_cover.slide +29 -0
- package/skills/wecom-unified/assets/templates/editorial-forest/slides/02_cards.slide +60 -0
- package/skills/wecom-unified/assets/templates/editorial-forest/slides/03_data.slide +49 -0
- package/skills/wecom-unified/assets/templates/editorial-forest/slides/04_image.slide +46 -0
- package/skills/wecom-unified/assets/templates/emerald-editorial/DESIGN.preset.md +119 -0
- package/skills/wecom-unified/assets/templates/emerald-editorial/shell/content.jsx +18 -0
- package/skills/wecom-unified/assets/templates/emerald-editorial/slides/01_cover.slide +36 -0
- package/skills/wecom-unified/assets/templates/emerald-editorial/slides/02_section.slide +39 -0
- package/skills/wecom-unified/assets/templates/emerald-editorial/slides/03_data.slide +79 -0
- package/skills/wecom-unified/assets/templates/emerald-editorial/slides/04_steps.slide +53 -0
- package/skills/wecom-unified/assets/templates/grove/DESIGN.preset.md +159 -0
- package/skills/wecom-unified/assets/templates/grove/shell/content.jsx +18 -0
- package/skills/wecom-unified/assets/templates/grove/shell/content_light.jsx +18 -0
- package/skills/wecom-unified/assets/templates/grove/slides/01_cover.slide +26 -0
- package/skills/wecom-unified/assets/templates/grove/slides/02_compare.slide +92 -0
- package/skills/wecom-unified/assets/templates/grove/slides/03_table.slide +68 -0
- package/skills/wecom-unified/assets/templates/index.json +280 -0
- package/skills/wecom-unified/assets/templates/long-table/DESIGN.preset.md +135 -0
- package/skills/wecom-unified/assets/templates/long-table/shell/content.jsx +36 -0
- package/skills/wecom-unified/assets/templates/long-table/slides/01_cover.slide +71 -0
- package/skills/wecom-unified/assets/templates/long-table/slides/02_cards.slide +72 -0
- package/skills/wecom-unified/assets/templates/long-table/slides/03_timeline.slide +81 -0
- package/skills/wecom-unified/assets/templates/long-table/slides/04_image.slide +60 -0
- package/skills/wecom-unified/assets/templates/sakura-chroma/DESIGN.preset.md +121 -0
- package/skills/wecom-unified/assets/templates/sakura-chroma/shell/content.jsx +13 -0
- package/skills/wecom-unified/assets/templates/sakura-chroma/slides/01_cover.slide +54 -0
- package/skills/wecom-unified/assets/templates/sakura-chroma/slides/02_products.slide +134 -0
- package/skills/wecom-unified/assets/templates/sakura-chroma/slides/03_section.slide +30 -0
- package/skills/wecom-unified/assets/templates/sakura-chroma/slides/04_schedule.slide +65 -0
- package/skills/wecom-unified/assets/templates/signal/DESIGN.preset.md +121 -0
- package/skills/wecom-unified/assets/templates/signal/shell/content.jsx +18 -0
- package/skills/wecom-unified/assets/templates/signal/shell/content_dark.jsx +23 -0
- package/skills/wecom-unified/assets/templates/signal/slides/01_cover.slide +48 -0
- package/skills/wecom-unified/assets/templates/signal/slides/02_cards.slide +67 -0
- package/skills/wecom-unified/assets/templates/signal/slides/03_data.slide +68 -0
- package/skills/wecom-unified/references/wecomcli-calendar-agenda.md +227 -0
- package/skills/wecom-unified/references/wecomcli-calendar-cancel.md +108 -0
- package/skills/wecom-unified/references/wecomcli-calendar-create.md +238 -0
- package/skills/wecom-unified/references/wecomcli-calendar-freebusy.md +207 -0
- package/skills/wecom-unified/references/wecomcli-calendar-meeting-room.md +170 -0
- package/skills/wecom-unified/references/wecomcli-calendar-search.md +209 -0
- package/skills/wecom-unified/references/wecomcli-calendar-update.md +272 -0
- package/skills/wecom-unified/references/wecomcli-calendar.md +296 -0
- package/skills/wecom-unified/references/wecomcli-contact.md +48 -0
- package/skills/wecom-unified/references/wecomcli-disk.md +380 -0
- package/skills/wecom-unified/references/wecomcli-doc-contents-append.md +20 -0
- package/skills/wecom-unified/references/wecomcli-doc-contents-overwrite.md +27 -0
- package/skills/wecom-unified/references/wecomcli-doc-create.md +162 -0
- package/skills/wecom-unified/references/wecomcli-doc-manage-doc-members-update.md +24 -0
- package/skills/wecom-unified/references/wecomcli-doc-manage-doc-names-update.md +20 -0
- package/skills/wecom-unified/references/wecomcli-doc-manage-doc-rules-update.md +22 -0
- package/skills/wecom-unified/references/wecomcli-doc-manage.md +127 -0
- package/skills/wecom-unified/references/wecomcli-doc.md +135 -0
- package/skills/wecom-unified/references/wecomcli-email-forward-mail.md +131 -0
- package/skills/wecom-unified/references/wecomcli-email-get-mail.md +187 -0
- package/skills/wecom-unified/references/wecomcli-email-reply-mail.md +138 -0
- package/skills/wecom-unified/references/wecomcli-email-search-mail.md +114 -0
- package/skills/wecom-unified/references/wecomcli-email-security.md +52 -0
- package/skills/wecom-unified/references/wecomcli-email-send-mail.md +186 -0
- package/skills/wecom-unified/references/wecomcli-email-send-schedule.md +83 -0
- package/skills/wecom-unified/references/wecomcli-email.md +206 -0
- package/skills/wecom-unified/references/wecomcli-media.md +89 -0
- package/skills/wecom-unified/references/wecomcli-meeting-cancel.md +113 -0
- package/skills/wecom-unified/references/wecomcli-meeting-create.md +167 -0
- package/skills/wecom-unified/references/wecomcli-meeting-list.md +228 -0
- package/skills/wecom-unified/references/wecomcli-meeting-original-get.md +101 -0
- package/skills/wecom-unified/references/wecomcli-meeting-search.md +176 -0
- package/skills/wecom-unified/references/wecomcli-meeting-update.md +217 -0
- package/skills/wecom-unified/references/wecomcli-meeting.md +366 -0
- package/skills/wecom-unified/references/wecomcli-message.md +190 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-animation.md +62 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-box.md +102 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-chart.md +261 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-codeblock.md +70 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-diagram.md +54 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-faicon.md +71 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-hyperlink.md +55 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-image.md +107 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-math.md +65 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-qrcode.md +22 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-slide.md +74 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-svg.md +95 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-table.md +72 -0
- package/skills/wecom-unified/references/wecomcli-pptx-component-text.md +96 -0
- package/skills/wecom-unified/references/wecomcli-pptx-content-contract.md +73 -0
- package/skills/wecom-unified/references/wecomcli-pptx-create-from-material.md +67 -0
- package/skills/wecom-unified/references/wecomcli-pptx-create-from-scratch.md +178 -0
- package/skills/wecom-unified/references/wecomcli-pptx-create-from-template.md +123 -0
- package/skills/wecom-unified/references/wecomcli-pptx-design-principle.md +65 -0
- package/skills/wecom-unified/references/wecomcli-pptx-government-contract.md +40 -0
- package/skills/wecom-unified/references/wecomcli-pptx-human-alignment.md +140 -0
- package/skills/wecom-unified/references/wecomcli-pptx-pptx-api.md +161 -0
- package/skills/wecom-unified/references/wecomcli-pptx-pptx-edit.md +37 -0
- package/skills/wecom-unified/references/wecomcli-pptx-story-principle.md +184 -0
- package/skills/wecom-unified/references/wecomcli-pptx-templates-README.md +165 -0
- package/skills/wecom-unified/references/wecomcli-pptx-templates-anti-ai-slop.md +52 -0
- package/skills/wecom-unified/references/wecomcli-pptx.md +158 -0
- package/skills/wecom-unified/references/wecomcli-sheet-conditional-formatting.md +203 -0
- package/skills/wecom-unified/references/wecomcli-sheet-filter.md +179 -0
- package/skills/wecom-unified/references/wecomcli-sheet-float-image.md +235 -0
- package/skills/wecom-unified/references/wecomcli-sheet-formulas.md +71 -0
- package/skills/wecom-unified/references/wecomcli-sheet-history.md +118 -0
- package/skills/wecom-unified/references/wecomcli-sheet-protection.md +170 -0
- package/skills/wecom-unified/references/wecomcli-sheet-range-operations.md +306 -0
- package/skills/wecom-unified/references/wecomcli-sheet-read-data.md +151 -0
- package/skills/wecom-unified/references/wecomcli-sheet-search-replace.md +121 -0
- package/skills/wecom-unified/references/wecomcli-sheet-structure-operations.md +394 -0
- package/skills/wecom-unified/references/wecomcli-sheet-style.md +246 -0
- package/skills/wecom-unified/references/wecomcli-sheet-table-style.md +199 -0
- package/skills/wecom-unified/references/wecomcli-sheet-validation.md +217 -0
- package/skills/wecom-unified/references/wecomcli-sheet-visual-standards.md +166 -0
- package/skills/wecom-unified/references/wecomcli-sheet-workbook.md +264 -0
- package/skills/wecom-unified/references/wecomcli-sheet-write-cells.md +320 -0
- package/skills/wecom-unified/references/wecomcli-sheet-xlsx-process.md +324 -0
- package/skills/wecom-unified/references/wecomcli-sheet.md +96 -0
- package/skills/wecom-unified/references/wecomcli-smartpage-data-driven-pages.md +50 -0
- package/skills/wecom-unified/references/wecomcli-smartpage-edit.md +526 -0
- package/skills/wecom-unified/references/wecomcli-smartpage-formula-arraylist.md +369 -0
- package/skills/wecom-unified/references/wecomcli-smartpage-formula-datetime.md +283 -0
- package/skills/wecom-unified/references/wecomcli-smartpage-formula-logic.md +247 -0
- package/skills/wecom-unified/references/wecomcli-smartpage-formula-math.md +362 -0
- package/skills/wecom-unified/references/wecomcli-smartpage-formula-operators.md +246 -0
- package/skills/wecom-unified/references/wecomcli-smartpage-formula-pageblock.md +76 -0
- package/skills/wecom-unified/references/wecomcli-smartpage-formula-reference.md +192 -0
- package/skills/wecom-unified/references/wecomcli-smartpage-formula-templates.md +410 -0
- package/skills/wecom-unified/references/wecomcli-smartpage-formula-text.md +377 -0
- package/skills/wecom-unified/references/wecomcli-smartpage-formula-user.md +22 -0
- package/skills/wecom-unified/references/wecomcli-smartpage-mdx-syntax.md +739 -0
- package/skills/wecom-unified/references/wecomcli-smartpage.md +179 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-chart-types.md +95 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-common.md +160 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-edit.md +609 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-field-types.md +438 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-formula.md +845 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-read.md +411 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-record-values.md +218 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-ai_efficiency.md +709 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-connect_to_app.md +380 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-financial_accounting.md +369 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-hr_and_administration.md +475 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-ledger_records.md +156 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-manufacturing.md +395 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-marketing.md +186 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-office_essentials.md +299 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-personal_efficiency.md +70 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-procurement_logistics.md +325 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-project_management.md +564 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-rd_process_customer.md +222 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-rd_process_ops.md +105 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-rd_process_project.md +109 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-rd_process_research.md +92 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-sales_and_operations.md +446 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-store_management.md +431 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-team_tasks.md +274 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-wechat_customer.md +384 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-template-work_report.md +100 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-templates.md +53 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-view-types.md +373 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-webhook-examples.md +176 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet-webhook.md +186 -0
- package/skills/wecom-unified/references/wecomcli-smartsheet.md +147 -0
- package/skills/wecom-unified/references/wecomcli-todo-create.md +137 -0
- package/skills/wecom-unified/references/wecomcli-todo-delete.md +63 -0
- package/skills/wecom-unified/references/wecomcli-todo-finish.md +72 -0
- package/skills/wecom-unified/references/wecomcli-todo-get.md +69 -0
- package/skills/wecom-unified/references/wecomcli-todo-list.md +136 -0
- package/skills/wecom-unified/references/wecomcli-todo-update.md +112 -0
- package/skills/wecom-unified/references/wecomcli-todo.md +68 -0
- package/skills/wecom-unified/scripts/build_docx.py +1274 -0
- package/skills/wecom-unified/scripts/build_page.py +2449 -0
- package/skills/wecom-unified/scripts/collect.py +868 -0
- package/skills/wecom-unified/scripts/doc_image_extractor.py +498 -0
- package/skills/wecom-unified/scripts/pptx2image.py +268 -0
- package/skills/wecom-unified/scripts/recalc.py +403 -0
- package/systemd/wezard.service.template +6 -0
- package/web/chat.css +70 -273
- package/web/chat.js +2228 -2190
- package/dist/daemon/chat-log.js +0 -130
- package/dist/daemon/chat-log.js.map +0 -1
- package/dist/daemon/dispatch.js +0 -6
- package/dist/daemon/dispatch.js.map +0 -1
- package/dist/daemon/idle-nudge.js +0 -90
- package/dist/daemon/idle-nudge.js.map +0 -1
- package/dist/daemon/message-events.js +0 -1155
- package/dist/daemon/message-events.js.map +0 -1
- package/dist/daemon/pending-items.js +0 -160
- package/dist/daemon/pending-items.js.map +0 -1
- package/dist/daemon/router.js +0 -742
- package/dist/daemon/router.js.map +0 -1
- package/dist/daemon/tips.js +0 -25
- package/dist/daemon/tips.js.map +0 -1
- package/dist/daemon/wedoc.js +0 -210
- package/dist/daemon/wedoc.js.map +0 -1
- package/dist/shared/role-search.js +0 -100
- package/dist/shared/role-search.js.map +0 -1
- package/dist/shared/startup-notice.js +0 -21
- package/dist/shared/startup-notice.js.map +0 -1
- package/dist/shared/turn-state.js +0 -27
- package/dist/shared/turn-state.js.map +0 -1
package/dist/daemon/peers.js
CHANGED
|
@@ -17,7 +17,7 @@ import { existsSync, openSync, readSync, closeSync, statSync } from "node:fs";
|
|
|
17
17
|
import { backendForPath, TURN_METRICS } from "../shared/cli-backends.js";
|
|
18
18
|
import { clipLine, truncate, truncateWithCount } from "../shared/std.js";
|
|
19
19
|
import { tildePath } from "./notices.js";
|
|
20
|
-
import {
|
|
20
|
+
import { parseEnvelope, renderReminder } from "../shared/reminder.js";
|
|
21
21
|
/** Strip ANSI SGR/CSI + OSC so captured pane text is safe to embed / match on. */
|
|
22
22
|
export const stripAnsi = (s) => s.replace(/\x1B\[[0-9;?]*[a-zA-Z]/g, "").replace(/\x1B\][^\x07]*\x07/g, "");
|
|
23
23
|
// ── Transcript tail ───────────────────────────────────────────────────
|
|
@@ -149,9 +149,6 @@ const blockText = (content) => {
|
|
|
149
149
|
.map((b) => b.text ?? "")
|
|
150
150
|
.join(" ");
|
|
151
151
|
};
|
|
152
|
-
/** Last `n` user/assistant turns of a transcript, oldest first. Backend-agnostic:
|
|
153
|
-
* the line shape is normalized through the owning CLI's dialect adapter. */
|
|
154
|
-
export const tailTurns = (jsonlPath, n = 3, keepLines = false) => readTailUntil(jsonlPath, (raw) => parseTurns(jsonlPath, raw, keepLines), (ts) => ts.length >= n).slice(-n);
|
|
155
152
|
/** 最后一句进到模型的话 (带信封), 往回读到有为止 —— 中间隔着多少轮工具都不怕。 */
|
|
156
153
|
export const lastUserTurn = (jsonlPath, endOffset) => readTailUntil(jsonlPath, (raw) => parseTurns(jsonlPath, raw, true), (ts) => ts.some((t) => t.role === "user"), TAIL_BYTES_MAX, endOffset)
|
|
157
154
|
.filter((t) => t.role === "user").at(-1);
|
|
@@ -161,7 +158,7 @@ export const talkTurns = (jsonlPath, n, keepLines = false, marks = false) => rea
|
|
|
161
158
|
* 限制**。按条数读尾巴的 talkTurns 管不了一轮很长的情形: 一轮里的大段工具输出 (读文件、
|
|
162
159
|
* 跑命令) 能把开这一轮的那句推到 2MB 之外 —— 回执就再也定位不到问话, 对方答完了也只能
|
|
163
160
|
* 报 silent。问话一定晚于发话时刻, 所以读到发话时刻之前就够了, 再大的文件也只读这一段。 */
|
|
164
|
-
|
|
161
|
+
const turnsSince = (jsonlPath, sinceMs) => readTailUntil(jsonlPath, (raw) => parseTurns(jsonlPath, raw, true, true), (ts) => ts.some((t) => !!t.ms && t.ms < sinceMs), Infinity);
|
|
165
162
|
/** 一个会话的来回, 每个来回 = 一句问话 + 它之后的全部回答 (途中的话在前, 终句在
|
|
166
163
|
* 最后), 旧的在前。读多深由时间窗定, 调用方再按时刻与条数裁:
|
|
167
164
|
* 给了 `since` → 一直读到比它更早的那一句 (窗口内的一句不漏);
|
|
@@ -417,17 +414,19 @@ export const renderDialog = (turns, per = 800, lastPer = per) => turns
|
|
|
417
414
|
* peek 从前靠刮终端回答「它卡在哪」; transcript 答得更准: 一个不在转圈、却悬着
|
|
418
415
|
* 工具调用的会话, 就是停在审批卡 / 本地弹窗上等人点。一句新的人话会让没收到结果
|
|
419
416
|
* 的调用作废 (被打断的那些), 所以遇到带正文的 user 行就清空。 */
|
|
420
|
-
export const openToolUses = (jsonlPath) => readTailUntil(jsonlPath, (raw) => parseOpenTools(jsonlPath, raw), (r) => r.rows > 0).names;
|
|
421
|
-
const parseOpenTools = (jsonlPath, raw) => {
|
|
417
|
+
export const openToolUses = (jsonlPath, sinceMs = 0) => readTailUntil(jsonlPath, (raw) => parseOpenTools(jsonlPath, raw, sinceMs), (r) => r.rows > 0).names;
|
|
418
|
+
const parseOpenTools = (jsonlPath, raw, sinceMs = 0) => {
|
|
422
419
|
const normalize = backendForPath(jsonlPath).normalizeTranscriptLine;
|
|
423
420
|
const open = new Map();
|
|
424
421
|
let rows = 0;
|
|
425
422
|
for (const line of raw.split("\n")) {
|
|
426
423
|
if (!line.trim())
|
|
427
424
|
continue;
|
|
428
|
-
let row;
|
|
425
|
+
let row, at = 0;
|
|
429
426
|
try {
|
|
430
|
-
|
|
427
|
+
const parsed = JSON.parse(line);
|
|
428
|
+
at = stampMs(parsed.timestamp);
|
|
429
|
+
row = normalize(parsed);
|
|
431
430
|
}
|
|
432
431
|
catch {
|
|
433
432
|
continue;
|
|
@@ -442,96 +441,21 @@ const parseOpenTools = (jsonlPath, raw) => {
|
|
|
442
441
|
continue;
|
|
443
442
|
for (const b of content) {
|
|
444
443
|
if (b.type === "tool_use" && b.id)
|
|
445
|
-
open.set(b.id, b.name ?? "?");
|
|
444
|
+
open.set(b.id, { name: b.name ?? "?", at });
|
|
446
445
|
if (b.type === "tool_result" && b.tool_use_id)
|
|
447
446
|
open.delete(b.tool_use_id);
|
|
448
447
|
}
|
|
449
448
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
*
|
|
454
|
-
* fan-out 之后 join 的载荷是「最后一条 assistant 文本」, 而一个分身的最后一句可能
|
|
455
|
-
* 是"好的我开始了", 也可能是八百字散文 —— 两种都没法直接汇总。只在派活提示里
|
|
456
|
-
* 要求收口成一行
|
|
457
|
-
* `RESULT: …`, 这里把它捞出来。取**最后一个**匹配 —— 中间复述过这个格式的那些
|
|
458
|
-
* 不算数。捞不到返回 "", 调用方退回整段 lastText, 所以不遵守约定也只是退化。 */
|
|
459
|
-
export const extractResult = (text, max = 800) => {
|
|
460
|
-
const c = parseClosing(text, max);
|
|
461
|
-
return c.kind === "result" ? c.text : "";
|
|
462
|
-
};
|
|
463
|
-
// NEED / PROGRESS 只认全大写: "what I need: …" / 「需要: …」在普通答话里太常见, 误认一次就是
|
|
464
|
-
// 一份不计数的回执。
|
|
465
|
-
const CLOSING_RE = /^[ \t]*(RESULT|Result|result|结论|NEED|PROGRESS)[ \t]*[::][ \t]*/gm;
|
|
466
|
-
const ARTIFACT_RE = /^[ \t>*|-]*ARTIFACT[ \t]*[::][ \t]*(\S+)(?:[ \t]+(?:—|--|-|:)[ \t]*(.*))?$/gm;
|
|
467
|
-
/** Keep offsets stable while hiding fenced code, block quotes and inline code. */
|
|
468
|
-
export const topLevelText = (text) => {
|
|
469
|
-
let fence = "";
|
|
470
|
-
return text.split(/(?<=\n)/).map((line) => {
|
|
471
|
-
const opener = line.match(/^[ \t]{0,3}(`{3,}|~{3,})/);
|
|
472
|
-
if (fence) {
|
|
473
|
-
if (opener && opener[1][0] === fence[0] && opener[1].length >= fence.length
|
|
474
|
-
&& !line.slice(opener[0].length).trim())
|
|
475
|
-
fence = "";
|
|
476
|
-
return line.replace(/[^\n]/g, " ");
|
|
477
|
-
}
|
|
478
|
-
if (opener) {
|
|
479
|
-
fence = opener[1];
|
|
480
|
-
return line.replace(/[^\n]/g, " ");
|
|
481
|
-
}
|
|
482
|
-
if (/^[ \t]{0,3}>/.test(line) || /^(?: {0,3}\t| {4})/.test(line))
|
|
483
|
-
return line.replace(/[^\n]/g, " ");
|
|
484
|
-
return line.replace(/(`+)[^`]*?\1/g, (s) => s.replace(/./g, " "));
|
|
485
|
-
}).join("");
|
|
486
|
-
};
|
|
487
|
-
export const addressedResults = (text) => {
|
|
488
|
-
const marks = [...topLevelText(text).matchAll(/@\.([A-Za-z0-9_-]+)[ \t]+RESULT[ \t]*[::][ \t]*/gm)];
|
|
489
|
-
return marks.map((m, i) => {
|
|
490
|
-
const next = marks[i + 1]?.index;
|
|
491
|
-
const start = m.index ?? 0;
|
|
492
|
-
const line = next === undefined ? -1 : text.lastIndexOf("\n", next - 1) + 1;
|
|
493
|
-
const currentLine = text.lastIndexOf("\n", start) + 1;
|
|
494
|
-
const end = line > currentLine ? line : next;
|
|
495
|
-
return { name: m[1], body: text.slice(start + m[0].length, end).trim() };
|
|
496
|
-
});
|
|
497
|
-
};
|
|
498
|
-
export const parseClosing = (text, max = 800) => {
|
|
499
|
-
const visible = topLevelText(text);
|
|
500
|
-
const visibleLines = visible.split(/\r?\n/);
|
|
501
|
-
const artifacts = text.split(/\r?\n/).flatMap((line, i) => {
|
|
502
|
-
if (!/^[ \t>*|-]*ARTIFACT[ \t]*[::]/.test(visibleLines[i] ?? ""))
|
|
503
|
-
return [];
|
|
504
|
-
return [...line.matchAll(ARTIFACT_RE)];
|
|
505
|
-
}).map((m) => ({ path: m[1].replace(/^`|`$/g, ""), note: (m[2] ?? "").trim() }))
|
|
506
|
-
.filter((a) => !/^<.*>$/.test(a.path)); // 复述格式时的 `<路径>` 占位
|
|
507
|
-
// 标记之后的**全部**内容, 而不是"那一行" —— 结论常常不止一行 (路径一行、说明
|
|
508
|
-
// 一行)。约定是收口在最后, 所以标记之后剩下的就是结论。取最后一个匹配: 模型常
|
|
509
|
-
// 先复述一遍格式要求再给答案。ARTIFACT 行不算结论正文。
|
|
510
|
-
const marks = [...visible.matchAll(CLOSING_RE)];
|
|
511
|
-
// 最后一个有效标记决定收口;忽略 NEED: 无,但不能让较早的 RESULT 吞掉后续求助。
|
|
512
|
-
const closing = marks.map((m, i) => {
|
|
513
|
-
const start = (m.index ?? 0) + m[0].length, end = marks[i + 1]?.index;
|
|
514
|
-
const shown = visible.slice(start, end).split(/\r?\n/);
|
|
515
|
-
const body = text.slice(start, end).split(/\r?\n/)
|
|
516
|
-
.filter((_line, n) => !/^[ \t>*|-]*ARTIFACT[ \t]*[::]/.test(shown[n] ?? "")).join("\n").trim();
|
|
517
|
-
return { kind: m[1] === "NEED" ? "need" : m[1] === "PROGRESS" ? "progress" : "result", text: body };
|
|
518
|
-
}).filter((c) => c.kind === "result" || (c.text && !/^(?:无|没有|none|n\/a|-+)[。.]?$/i.test(c.text))).at(-1);
|
|
519
|
-
return closing ? { ...closing, text: clipMiddle(closing.text, max), artifacts } : { kind: "none", text: "", artifacts };
|
|
449
|
+
// 比 `sinceMs` 还早的悬空调用是上一个 CLI 进程留下的 (被杀 / 被打断): 现在这个进程
|
|
450
|
+
// 不可能正等着它的审批, 不能算「停在审批卡上」。时间戳认不出 (0) 的照旧算悬着。
|
|
451
|
+
return { names: [...open.values()].filter((t) => !(t.at > 0 && t.at < sinceMs)).map((t) => t.name), rows };
|
|
520
452
|
};
|
|
521
|
-
// 行首收口标记只起定位/判定作用: 剥只发生在投递出口 (群气泡 / wizard 收件箱),
|
|
522
|
-
// 判定 (parseClosing / finalKind / finalReleased) 一律读原文。NEED 的语义由路由行
|
|
523
|
-
// 状态与信封 status 携带, 正文里再带一个 `NEED:` 前缀只会让人疑惑。
|
|
524
|
-
const LEADING_MARK_RE = /^[ \t]*(?:RESULT|Result|result|结论|NEED|PROGRESS)[ \t]*[::][ \t]*/;
|
|
525
|
-
/** 剥掉正文行首的 `RESULT:` / `NEED:` / `PROGRESS:` 收口标记 (含全角冒号)。 */
|
|
526
|
-
export const stripClosingMark = (text) => text.replace(LEADING_MARK_RE, "");
|
|
527
|
-
/** 群气泡版: 再剥掉 ARTIFACT 交付行 —— 本机路径对群里的读者没有用途 (要文件走 send_file)。 */
|
|
528
|
-
export const stripForChat = (text) => stripClosingMark(text).replace(new RegExp(ARTIFACT_RE.source, "gm"), "").replace(/\n{3,}/g, "\n\n").trim();
|
|
529
453
|
/** The peer's most recent assistant message — the handoff payload when one
|
|
530
454
|
* agent drives another ("take #fix's conclusion and review it"). */
|
|
531
455
|
export const lastAssistantText = (jsonlPath, max = 4000) => clipMiddle(talkTurns(jsonlPath, 40).filter((t) => t.role === "assistant").at(-1)?.text ?? "", max);
|
|
532
456
|
/** 掐中间: 来龙去脉在头、结论在尾, 超长时丢的该是中段。(从尾巴截会把收口那一行
|
|
533
457
|
* 截掉 —— 而那恰恰是对方最想读的。) */
|
|
534
|
-
|
|
458
|
+
const clipMiddle = (s, max = 4000, head = Math.floor(max / 4)) => {
|
|
535
459
|
if (s.length <= max)
|
|
536
460
|
return s;
|
|
537
461
|
const cut = s.length - (max - head);
|
|
@@ -542,7 +466,7 @@ export const clipMiddle = (s, max = 4000, head = Math.floor(max / 4)) => {
|
|
|
542
466
|
};
|
|
543
467
|
/** 读到 `s` 末尾时是否还在一个 ``` / ~~~ 代码块里。 */
|
|
544
468
|
const inFence = (s) => (s.match(/^[ \t]*(?:```|~~~)/gm)?.length ?? 0) % 2 === 1;
|
|
545
|
-
/** `sinceMs` 之后这个会话最新的一条回复, 全文、保留换行 ——
|
|
469
|
+
/** `sinceMs` 之后这个会话最新的一条回复, 全文、保留换行 —— room 里交代的载荷。
|
|
546
470
|
*
|
|
547
471
|
* 「最后一条 assistant 文本」本身不带归属: 那句话没被接住、或者它停在一个等人点
|
|
548
472
|
* 的弹窗上时, 最后一条是**上一件事**的答案, 原样交回去就是拿旧结论冒充新结论。
|
|
@@ -570,23 +494,11 @@ export const replyToPeer = (jsonlPath, _fromName, sinceMs = 0, turn) => {
|
|
|
570
494
|
const r = answerOf(askWindow(jsonlPath, sinceMs), sinceMs, turn);
|
|
571
495
|
return r && { text: r.text, ...(r.error ? { error: true } : {}) };
|
|
572
496
|
};
|
|
573
|
-
/** 交接那一刻, `from` 那一句在旧会话里**收口**了没有 —— 比 replyToPeer 再严一档。
|
|
574
|
-
*
|
|
575
|
-
* 自我交接是在某一轮**中途**调的: 那一轮最后一条 assistant 是"已交接"之类的收尾,
|
|
576
|
-
* 不是答案。所以只认在 `untilMs` 之前就被下一句 user 行关上的那一轮: 问话那一轮
|
|
577
|
-
* 还开着 (就是交接这一轮) → "", 这份回执的义务跟着简报转进新会话。三态同 replyToPeer。 */
|
|
578
|
-
export const replyClosedBefore = (jsonlPath, _fromName, sinceMs, untilMs, turn) => {
|
|
579
|
-
const r = answerOf(askWindow(jsonlPath, sinceMs), sinceMs, turn);
|
|
580
|
-
return r && (r.closedAt !== undefined && r.closedAt < untilMs && !r.error ? r.text : "");
|
|
581
|
-
};
|
|
582
497
|
/** 这一行是在续上一轮 (报错之后没有信封的 `continue` / 「继续」), 不起新的一轮。 */
|
|
583
498
|
const resumesAt = (ts, i) => !!ts[i - 1]?.apiError && !ts[i].env && !ts[i].notice && RESUME_RE.test(ts[i].text.trim());
|
|
584
499
|
/** 开最近这一轮的那句 user 行 (`marks` 读出来的 turns): 排队吃进的、后台通知、报错后的
|
|
585
500
|
* 续跑都不算 —— 它们不起新的一轮, 这一轮是谁发起的要看再往前那一句。 */
|
|
586
501
|
export const openingOf = (ts) => ts.filter((t, i) => t.role === "user" && !t.queued && !t.notice && !resumesAt(ts, i)).at(-1);
|
|
587
|
-
/** 开最近这一轮的那句 user 行, 往回读到有为止 (不受 TAIL_BYTES_MAX 限制) —— 一轮再长,
|
|
588
|
-
* 「这一轮是谁发起的」也要认得出 (父 k、链头、打断会不会误伤别人的活都靠它)。 */
|
|
589
|
-
export const openingTurn = (jsonlPath) => openingOf(readTailUntil(jsonlPath, (raw) => parseTurns(jsonlPath, raw, false, true), (ts) => !!openingOf(ts), Infinity));
|
|
590
502
|
const answerOf = (ts, sinceMs, turn) => {
|
|
591
503
|
const lastAsk = (hit) => ts.reduce((at, t, i) => (t.role === "user" && t.env && hit(t.env) && (!t.ms || t.ms >= sinceMs - ASK_SLACK_MS) ? i : at), -1);
|
|
592
504
|
const byTurn = turn ? lastAsk((e) => !e.receipt && !e.quiet && e.event === turn) : -1;
|
|
@@ -601,103 +513,24 @@ const answerOf = (ts, sinceMs, turn) => {
|
|
|
601
513
|
// ── wizard → wizard 的信封 ────────────────────────────────────────────
|
|
602
514
|
// 同伴的话是原样落进输入框的, 而落进输入框的东西在模型眼里都是「用户说的」。没有
|
|
603
515
|
// 信封, 收件方分不清这一轮是人说的还是 wizard 说的、回复给谁看、该不该回话 ——
|
|
604
|
-
// 于是对着 wizard 寒暄、把过程 notify
|
|
605
|
-
//
|
|
516
|
+
// 于是对着 wizard 寒暄、把过程 notify 进群、或者又回一句 (发话方那头会再多一轮)。
|
|
517
|
+
// chat_ask 的等待上, 这一回会给它多排一轮, 两边就此乒乓)。信封把这三件事写在每一轮
|
|
606
518
|
// 自己身上: 宪章是出生时的快照, 正在跑的老 wizard 读不到新规矩, 这一段读得到。
|
|
607
519
|
// 与 mention hint / 名册增量同一个 `<system-reminder>` 壳 —— mirror 的 meta 剥离器
|
|
608
|
-
// 和
|
|
520
|
+
// 和 talkTurns 都会丢掉它, 不进气泡、不进 rolepage、不进 peek。
|
|
609
521
|
//
|
|
610
522
|
// 信封同时是 transcript 里**唯一**记着「这句话是谁、在哪个频道说的」的地方: 会话的
|
|
611
|
-
// jsonl 只知道输入框里进过什么。
|
|
523
|
+
// jsonl 只知道输入框里进过什么。room_read 就靠把它读回来 (parseEnvelope) 在各个
|
|
612
524
|
// 会话的 jsonl 之间拼出一个群 / 一段私聊的记录。事实写在开标签的属性上 (见
|
|
613
525
|
// shared/reminder.ts), 正文只是给模型的规矩 —— 改措辞不影响解析; 老措辞在那边认。
|
|
614
526
|
// 所以正文不再复述属性 (谁说的、在哪个群、件号): 模型读得到开标签, 正文只写
|
|
615
527
|
// 属性推不出的表达语义与工具使用约定; 自动终句去向由 daemon 执行。
|
|
616
528
|
export { parseEnvelope };
|
|
617
|
-
/** 身份来自入站 userid, 包括本聊天私信; home 不能代替真实发话人。 */
|
|
618
|
-
export const renderHumanEnvelope = (user, chat, chatKey) => renderReminder(envelopeAttrs.human(user, chat, chatKey), []);
|
|
619
529
|
/** 人对管家说的那一轮挂一行「自己答还是派出去」: 宪章里的检查项离这句话太远, sonnet 档的管家一接到活
|
|
620
530
|
* 就忘。只挂人的话 —— 回执、同伴、定时那几轮不是新来的活; 一行就够, 细则在宪章。 */
|
|
621
531
|
export const renderStewardHint = () => renderReminder({ wezard: "hint" }, [
|
|
622
532
|
"管家自查: 进度 / 闲聊 / 你已知道的 → 自己答; 要看代码才答得了的 (机制、原理、「现在还会不会…」、方案、排查、改动), 哪怕看一眼就像能答 → 先 `delegate` 派出去; 多处改动或要 coder + reviewer 的带 `lead:true` 开需求单。",
|
|
623
533
|
]);
|
|
624
|
-
/** 定时任务放的那一轮: 不标的话, 记录里它就成了「人说的」。 */
|
|
625
|
-
export const renderTaskEnvelope = (taskId, channel, quiet) => renderReminder(envelopeAttrs.task(taskId, channel, quiet?.event), quiet
|
|
626
|
-
? ["定时任务到点放进来的, 不是人此刻说的, 而且**有事才说**: 这一轮私下跑, 没人在看。",
|
|
627
|
-
"照常执行。看完**没有值得人知道的**, 最后一条消息就只写一行 `QUIET`, 什么也不会发出去; 有, 就把最后一条消息写给人看 —— 守护进程原样转进群。",
|
|
628
|
-
"要派活给别的 wizard, 就在这一轮里用 `wait_peer` 把结果拿回来再收口 —— 回执要等这一轮结束才到, 那时已经没人替你转发。"]
|
|
629
|
-
: ["定时任务到点放进来的, 不是人此刻说的 —— 照常执行, 回复照常发进群。"]);
|
|
630
|
-
/** `from` = 发话方的称呼 (`.name`); `chat` 给了 = 公开轮 (那个群的名字, 可以是 ""),
|
|
631
|
-
* 不给 = 私聊; `chatKey` = 那个群的稳定 key (read_chat 按 key 归档, 名字只做显示)。 */
|
|
632
|
-
export const renderPeerEnvelope = (from, chat, chatKey, t) => renderReminder(envelopeAttrs.peer(from, chat, t?.asker, chatKey), [
|
|
633
|
-
...(chat === undefined
|
|
634
|
-
? [
|
|
635
|
-
"这是 wizard 私聊, 不是人说的。",
|
|
636
|
-
...(t?.quiet || t?.act === "fyi"
|
|
637
|
-
? ["发话方不收回执; 不要为确认收到而 tell_peer 或 notify。"]
|
|
638
|
-
: [
|
|
639
|
-
"终句面向派活方; 自动回执无需另调工具, 不要重复 tell_peer 或为这轮私聊 notify。",
|
|
640
|
-
"对 wizard 直说: 不寒暄、不加对人的称呼、不复述它的话; 交差时必须标明接收者 (`@.name RESULT: …`), 一条消息可分段回复多个接收者 (交付物写进文件就回传路径); 需要对方补信息或继续协作时, 用 tell_peer({kind:\"ask\"}) 发起反问/子任务; 交付了文件, 每个加一行 `ARTIFACT: <路径> — 一句话`。",
|
|
641
|
-
]),
|
|
642
|
-
]
|
|
643
|
-
: [
|
|
644
|
-
`面向群里的人表达${t?.quiet || t?.act === "fyi" ? "。发话方不收回执" : "; 自动回执无需另调工具"}, 不要重复 tell_peer 同一段结论。`,
|
|
645
|
-
]),
|
|
646
|
-
...(t?.re ? ["这是**续问**: 接着那件活说, 不是一件新活。"] : []),
|
|
647
|
-
// 这句话要怎么接 —— 只有发话方知道, 不写出来对方一律当成一件活去干。
|
|
648
|
-
...(t?.act === "ask" ? [`这是一个**提问**: 只答这一问, 几句话${t.quiet ? "" : "并明确收件人 (`@.name RESULT:`)"}; 需要反问或派生子任务时用 tell_peer({kind:"ask"|"task"})。`] : []),
|
|
649
|
-
...(t?.act === "fyi" ? ["这是一条**知会**: 不用回复、不用收口, 也别为它开新活 —— 与手头的活相关就顺手吸收, 无关就略过; 一句话收住这一轮即可。"] : []),
|
|
650
|
-
// 来回多了就收口: 不在守护进程里拒绝 —— 拒了模型会换条通路接着乒乓。
|
|
651
|
-
...((t?.legs ?? 0) > 3 ? [`这件活已经来回 ${t.legs - 1} 次: 这一次请直接给结论, 拿不准的写清你的假设。`] : []),
|
|
652
|
-
]);
|
|
653
|
-
/** 回执的信封 —— 这一轮是对方干完活、守护进程自动送回来的结论, 不是新派的活。
|
|
654
|
-
*
|
|
655
|
-
* 为什么必须有它: 回执是原样 paste 进输入框的, 而落进输入框的东西在模型眼里都是
|
|
656
|
-
* 「有人在对我说话」。没有这一段, 它会把一份结论当成一件新活去做, 或者客气地回它
|
|
657
|
-
* 一句 —— 而回那一句又会被对方当成新的一轮。所以这里写明这是回执、正文承载回执内容、
|
|
658
|
-
* 读完接着干你自己的, 别只为确认收到而回话;只写 QUIET 会吞掉已有人等着的结论。 */
|
|
659
|
-
export const renderReceiptEnvelope = (from, chat, status = "done", turn, route, chatKey) => {
|
|
660
|
-
// 这份结论有没有人等着听: 回给上游 wizard (up) / 落回那个群 (chat) / 迟到但有追述去处。
|
|
661
|
-
const speaks = chat !== undefined || route?.up === true || (route?.late === true && !!route.retellTo);
|
|
662
|
-
const bodyRule = status === "done"
|
|
663
|
-
? `这是回执,不是人说的话或新派的活;正文是对方这一轮的回复。${route?.late ? "" : "普通完成回执的正文默认就是结论;终句用自己的话交代做成了什么、没做成什么,无需 RESULT:。"}据此继续手头工作,不要仅为确认收到而回话。`
|
|
664
|
-
: status === "need" ? "这是反问回执,正文写明所需信息;答复后会再送回执。"
|
|
665
|
-
: status === "progress" ? "这是进展回执,正文是对方报的一行进展;任务还没落定,终句回执会在之后送到。"
|
|
666
|
-
: status === "error" ? "这是 CLI 错误回执,正文是报错信息,不是结论;若续跑后答出结论,会再送回执。"
|
|
667
|
-
: status === "canceled" ? "这是已取消的失败回执,正文是守护进程说明和它最后说的一句;原任务已取消。"
|
|
668
|
-
: `这是失败回执 (${FAILED[status]}),本次按失败落定;后续仍可续问或补交。正文是守护进程说明和它最后说的一句。`;
|
|
669
|
-
return renderReminder(envelopeAttrs.receipt(from, chat, status, turn, route, chatKey), [
|
|
670
|
-
bodyRule,
|
|
671
|
-
speaks
|
|
672
|
-
? "有人等这份结论,不要只写 QUIET。"
|
|
673
|
-
: "无人等这份结论;只有没有新结果、风险或待答 NEED 时,终句才精确写 QUIET。",
|
|
674
|
-
"需要对方补信息或协作时用 tell_peer({kind:\"ask\"});还在等依赖用 WAIT: <在等什么>。回执轮用 notify 正式报告须显式写 RESULT:;未标记的 notify 只是进度。",
|
|
675
|
-
...(route?.via ? [`这是**沿链升级**的回执: ${route.via} 已不在,原由它收口的任务交由你处理。`] : []),
|
|
676
|
-
...(route?.retold ? ["这是它对这件活的**追述**: 之前已经交过一份 (定论或失败回执), 这一份是之后补的, 以这一份为准。"] : []),
|
|
677
|
-
// 去向由路由行的 receiver 边算好 (§9.5): up = 终句落到上游那一笔上; chat 给了 = 落回那个群;
|
|
678
|
-
// late = 它服务的那一笔已收口 (孤儿) —— 压过前两种: 只有带 `RESULT:` 的终句作为追述沿原路再投。
|
|
679
|
-
...(route?.late
|
|
680
|
-
? [route.retellTo
|
|
681
|
-
? chat !== undefined
|
|
682
|
-
? `这一笔的上一环已经收口, 结论**迟到了**: 终句带 \`RESULT:\` 才作为追述进群 ${route.retellTo} (用你自己的话交代); 不带就只进 rolepage。`
|
|
683
|
-
: `这一笔的上一环已经收口, 结论**迟到了**: 终句带 \`RESULT:\` 才作为追述沿原路投给 ${route.retellTo}; 不带就只进 rolepage。`
|
|
684
|
-
: "这一笔的上一环已经收口 (被收掉或已回收), 结论**迟到了**: 你这一轮的终句只进 rolepage, 要人知道就明说。"]
|
|
685
|
-
: route?.up
|
|
686
|
-
? ["交给上游 wizard。"]
|
|
687
|
-
: chat !== undefined
|
|
688
|
-
? [`投给群里的${route?.audience ? " `audience`" : "人"}。`]
|
|
689
|
-
: route?.pending
|
|
690
|
-
? [`还有 ${route.pending} 份没回: 先记下这一份, 等最后一份到了再汇总。`]
|
|
691
|
-
: ["人看不见这段私聊。"]),
|
|
692
|
-
...(turn && status !== "canceled" ? [`若需追问或补充,用 tell_peer({name: '${from}', re: true}) 续同一笔。`] : []),
|
|
693
|
-
]);
|
|
694
|
-
};
|
|
695
|
-
const FAILED = {
|
|
696
|
-
timeout: "等到期限它还没答完",
|
|
697
|
-
silent: "它停下了几次, 都没有答这一句",
|
|
698
|
-
dead: "它的 pane 没了 (被收掉或崩了)",
|
|
699
|
-
canceled: "它这件活被人收掉 / 打断了",
|
|
700
|
-
};
|
|
701
534
|
/** Prompt-token size of the session's most recent turn: input + both cache
|
|
702
535
|
* tiers = how full the context window is, i.e. exactly what a cold cache would
|
|
703
536
|
* have to re-write at 1.25x. Read from the last assistant usage snapshot in
|
|
@@ -788,6 +621,21 @@ const pickCacheTouch = (jsonlPath, raw) => {
|
|
|
788
621
|
return sent ? { ...acc, touch: acc.sentAt || ms } : acc;
|
|
789
622
|
}, { sentAt: 0, touch: 0 }).touch;
|
|
790
623
|
};
|
|
624
|
+
/** 这个会话最后一次真的有动静的时刻: transcript 里最新一条带 `timestamp` 的记录。
|
|
625
|
+
* 不用文件 mtime —— 同机别的会话的 CLI / 工具会把闲置会话的 jsonl 反复碰新 (实测一个
|
|
626
|
+
* 11 小时没说话的会话 mtime 只有 28 分钟前, 空闲回收因此永远等不到 1 小时), 而
|
|
627
|
+
* `mode` / `permission-mode` / `last-prompt` 之类元数据行本就不带 timestamp。
|
|
628
|
+
* 0 = 没有带时间戳的记录 (刚起、还没说过话) —— 调用方回落 mtime。 */
|
|
629
|
+
export const lastRecordMs = (jsonlPath) => readTailUntil(jsonlPath, (raw) => raw.split("\n").reduce((acc, line) => {
|
|
630
|
+
if (!line.includes('"timestamp"'))
|
|
631
|
+
return acc;
|
|
632
|
+
try {
|
|
633
|
+
return Math.max(acc, stampMs(JSON.parse(line).timestamp));
|
|
634
|
+
}
|
|
635
|
+
catch {
|
|
636
|
+
return acc;
|
|
637
|
+
}
|
|
638
|
+
}, 0), (ms) => ms > 0);
|
|
791
639
|
/** A row's `timestamp` as epoch ms (Claude: ISO string, CodeBuddy: number); 0 if absent / unparsable. */
|
|
792
640
|
const stampMs = (ts) => {
|
|
793
641
|
const ms = typeof ts === "number" ? ts : Date.parse(String(ts ?? ""));
|
|
@@ -1040,48 +888,7 @@ export const contextMaterials = (jsonlPath) => {
|
|
|
1040
888
|
return filtered.filter((m, i) => !filtered.slice(i + 1).some((n) => n.path === m.path && n.kind === m.kind))
|
|
1041
889
|
.map((m) => ({ ...m, ...(reply ? { reply } : {}) }));
|
|
1042
890
|
};
|
|
1043
|
-
/** 这段上下文里读过 / 改过的文件 (旧的在前、去重, 同一文件按最后一次碰它的位置排)。
|
|
1044
|
-
*
|
|
1045
|
-
* 「它的上下文里装着什么」是可以算出来的事实: 从文件尾往回, 撞上 compact 边界就停
|
|
1046
|
-
* (边界之前的已被压成摘要, 不再原样在窗口里); `/clear` 换了新 jsonl, 天然隔开。
|
|
1047
|
-
* 只抽工具参数里的路径, 不看结果 —— 读没读过是事实, 读出了什么另说。窗口给到
|
|
1048
|
-
* 1MB: 再往前的东西大概率已不在一个 200k 的上下文里。 */
|
|
1049
|
-
export const contextFiles = (jsonlPath) => {
|
|
1050
|
-
const normalize = backendForPath(jsonlPath).normalizeTranscriptLine;
|
|
1051
|
-
const lines = readTailBytes(jsonlPath, CONTEXT_FILES_BYTES).split("\n");
|
|
1052
|
-
const cut = lines.reduce((at, l, i) => (l.includes('"compact_boundary"') ? i : at), -1);
|
|
1053
|
-
const paths = lines.slice(cut + 1).flatMap((line) => {
|
|
1054
|
-
if (!line.includes("tool_use"))
|
|
1055
|
-
return []; // cheap prefilter
|
|
1056
|
-
let row;
|
|
1057
|
-
try {
|
|
1058
|
-
row = normalize(JSON.parse(line));
|
|
1059
|
-
}
|
|
1060
|
-
catch {
|
|
1061
|
-
return [];
|
|
1062
|
-
}
|
|
1063
|
-
const content = row?.message?.content;
|
|
1064
|
-
if (!row || row.isSidechain || !Array.isArray(content))
|
|
1065
|
-
return [];
|
|
1066
|
-
return content.flatMap((b) => (b.type === "tool_use" ? toolPaths(b.input) : []));
|
|
1067
|
-
});
|
|
1068
|
-
// 去重保留最后一次出现的位置。
|
|
1069
|
-
return paths.filter((p, i) => paths.lastIndexOf(p) === i);
|
|
1070
|
-
};
|
|
1071
891
|
const CONTEXT_FILES_BYTES = 1024 * 1024;
|
|
1072
|
-
// shell 里读文件 (cat / sed -n / grep) 和 Read 工具一样把内容拉进了上下文, 只是路径
|
|
1073
|
-
// 藏在命令里: 带扩展名的那些词就是文件。
|
|
1074
|
-
const SHELL_FILE_RE = /(?:~|\.{0,2}\/)?[\w.\-/]*\w\.[a-z][a-z0-9]{0,4}\b/gi;
|
|
1075
|
-
const toolPaths = (input) => {
|
|
1076
|
-
if (!input || typeof input !== "object")
|
|
1077
|
-
return [];
|
|
1078
|
-
const o = input;
|
|
1079
|
-
const named = ["file_path", "notebook_path", "path"]
|
|
1080
|
-
.map((k) => o[k])
|
|
1081
|
-
.filter((v) => typeof v === "string" && v.length > 1);
|
|
1082
|
-
const shell = typeof o.command === "string" ? o.command.match(SHELL_FILE_RE) ?? [] : [];
|
|
1083
|
-
return [...named, ...shell.filter((w) => !/^\d/.test(w)).filter((w) => w.includes("/") || /\.(?:ts|tsx|js|mjs|json|jsonc|md|css|html|py|go|rs|sh)$/.test(w))];
|
|
1084
|
-
};
|
|
1085
892
|
// ── Pane liveness ─────────────────────────────────────────────────────
|
|
1086
893
|
// "Is this agent still working?" answered from outside the process. The pane is
|
|
1087
894
|
// the only honest source: transcript mtime goes quiet during long tool calls,
|
|
@@ -1111,7 +918,7 @@ export const paneIsBusy = (paneText) => stripAnsi(paneText)
|
|
|
1111
918
|
.slice(-FOOTER_ROWS)
|
|
1112
919
|
.some((l) => BUSY_MARKERS.some((re) => re.test(l)));
|
|
1113
920
|
/** Machinery, not conversation: the `<system-reminder>` wrapper is the same
|
|
1114
|
-
* marker the mirror's meta-stripper and `
|
|
921
|
+
* marker the mirror's meta-stripper and `talkTurns` already drop, so the hint
|
|
1115
922
|
* reaches the agent's context without leaking into WeCom bubbles or peer
|
|
1116
923
|
* summaries. A wizard already introduced within the recent injections (`seen`)
|
|
1117
924
|
* only gets its name re-listed — the full row is still in context; the usage
|
|
@@ -1123,14 +930,15 @@ export const peerMentionPart = (mentions, cwd = "") => (seen) => {
|
|
|
1123
930
|
const fresh = mentions.filter((m) => !seen(`m:.${m.tag}`));
|
|
1124
931
|
const known = mentions.filter((m) => seen(`m:.${m.tag}`));
|
|
1125
932
|
const rule = !seen("rule:mention");
|
|
1126
|
-
|
|
933
|
+
// 提醒是给模型读的系统面 (§1.5): 名字行一律裸名 —— 人消息里的 `.x` / `🧙♂️ x` 写法都在这里剥成 x。
|
|
934
|
+
const row = (m) => `- ${m.tag}${m.job ? ` job="${clipLine(m.job, 80).replace(/"/g, "'")}"` : ""}${m.foreign ? ` chat=${m.chat || "(other)"}` : ""}${m.cwd && m.cwd !== cwd ? ` cwd=${tildePath(m.cwd)}` : ""}`;
|
|
1127
935
|
return {
|
|
1128
936
|
text: renderReminder({ wezard: "mention" }, [
|
|
1129
937
|
...(rule
|
|
1130
|
-
? ["
|
|
938
|
+
? ["名字 tokens above are live wizards, not literal text. To involve / check / relay to one: chat_ask (it answers by chat_reply) · peek_peer — never answer for it; wizard_roster for all. A passing mention needs no tool."]
|
|
1131
939
|
: []),
|
|
1132
940
|
...fresh.map(row),
|
|
1133
|
-
...(known.length ? [`${known.map((m) =>
|
|
941
|
+
...(known.length ? [`${known.map((m) => m.tag).join(" ")}: wizards (described earlier)`] : []),
|
|
1134
942
|
]),
|
|
1135
943
|
keys: [...(rule ? ["rule:mention"] : []), ...fresh.map((m) => `m:.${m.tag}`)],
|
|
1136
944
|
};
|