wezard 2.8.8 → 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-plugin/plugin.json +0 -6
- package/CLAUDE.md +36 -16
- package/README.md +41 -54
- package/cli/wezard.sh +3 -0
- package/config.example.jsonc +6 -8
- package/dist/cli/codex-hook.js +20 -4
- package/dist/cli/codex-hook.js.map +1 -1
- package/dist/cli/init.js +45 -8
- 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 +32 -112
- 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 +78 -20
- package/dist/daemon/approval.js.map +1 -1
- package/dist/daemon/channel-context.js +69 -0
- package/dist/daemon/channel-context.js.map +1 -0
- package/dist/daemon/channel-posts.js +53 -0
- package/dist/daemon/channel-posts.js.map +1 -0
- package/dist/daemon/channel-store.js +96 -0
- package/dist/daemon/channel-store.js.map +1 -0
- package/dist/daemon/channel.js +805 -0
- package/dist/daemon/channel.js.map +1 -0
- 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 +11 -3
- package/dist/daemon/config-api.js.map +1 -1
- package/dist/daemon/danger.js +24 -205
- package/dist/daemon/danger.js.map +1 -1
- package/dist/daemon/detail.js +14 -8
- package/dist/daemon/detail.js.map +1 -1
- package/dist/daemon/handoff.js +266 -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 +366 -143
- package/dist/daemon/inbound.js.map +1 -1
- package/dist/daemon/index.js +2232 -2616
- 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 +714 -485
- 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/pending.js +7 -5
- package/dist/daemon/pending.js.map +1 -1
- package/dist/daemon/picker-policy.js +27 -12
- package/dist/daemon/picker-policy.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 +171 -55
- 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 +7 -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 +258 -236
- package/dist/mcp/tools.js.map +1 -1
- package/dist/shared/allow-rules.js +32 -8
- 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 +27 -5
- package/dist/shared/cli-backends.js.map +1 -1
- package/dist/shared/config.js +122 -38
- package/dist/shared/config.js.map +1 -1
- package/dist/shared/detail-render.js +104 -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/json-map-store.js +23 -6
- package/dist/shared/json-map-store.js.map +1 -1
- 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/repl-script.js +114 -26
- package/dist/shared/repl-script.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 +58 -0
- package/dist/shared/session-hooks.js.map +1 -0
- package/dist/shared/session-label.js +80 -60
- package/dist/shared/session-label.js.map +1 -1
- package/dist/shared/session-mcp.js +77 -0
- package/dist/shared/session-mcp.js.map +1 -0
- package/dist/shared/session-skills.js +63 -0
- package/dist/shared/session-skills.js.map +1 -0
- 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 +76 -17
- 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/pre-tool-use.sh +18 -0
- package/hooks/stop.sh +26 -0
- package/package.json +7 -3
- 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 -69
- package/dist/daemon/idle-nudge.js.map +0 -1
- package/dist/daemon/message-events.js +0 -1083
- 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/hooks/hooks.json +0 -16
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { keyOf } from "../shared/session-label.js";
|
|
2
|
+
import { handoffAt } from "./wizard.js";
|
|
3
|
+
import { parseTrigger } from "../shared/trigger.js";
|
|
4
|
+
/** 学徒在名册里的唯一记录 (锚点优先: target === identity); 没有学徒 = undefined。 */
|
|
5
|
+
export const apprenticeOf = (store) => (store?.all() ?? [])
|
|
6
|
+
.filter((w) => w.kind === "apprentice")
|
|
7
|
+
.sort((a, b) => Number(a.target !== a.identity) - Number(b.target !== b.identity) || a.bornAt - b.bornAt)[0];
|
|
8
|
+
/** 这个 target 是不是学徒 —— stop/forget/evict/审批豁免/宪章/交接线的共用判定面。 */
|
|
9
|
+
export const isApprentice = (store, target) => store?.get(target)?.kind === "apprentice";
|
|
10
|
+
/** boot 落位 (§7): home (defaultChat) 是单聊时保证学徒记录存在, 幂等。
|
|
11
|
+
* home 不是 user: 形状 (还没认领 / 群为家) 不造幽灵 —— 认领后下一次 boot 自然接上,
|
|
12
|
+
* 与 markGlobalSteward 同一口径。学徒住在 home 单聊的一个 slot 里 (不占默认会话 ——
|
|
13
|
+
* 那是全局管家的锚点)。 */
|
|
14
|
+
export const ensureApprentice = (store, home, name, now = Date.now()) => {
|
|
15
|
+
const existing = apprenticeOf(store);
|
|
16
|
+
if (existing)
|
|
17
|
+
return { target: existing.target, created: false };
|
|
18
|
+
const h = home.trim();
|
|
19
|
+
const n = name.trim();
|
|
20
|
+
if (!h.startsWith("user:"))
|
|
21
|
+
return { target: "", created: false, skipped: "home is not a DM principal" };
|
|
22
|
+
if (!n)
|
|
23
|
+
return { target: "", created: false, skipped: "empty apprentice name" };
|
|
24
|
+
const target = keyOf(h, "apprentice");
|
|
25
|
+
store.upsert(target, { identity: target, name: n, kind: "apprentice", bornAt: now });
|
|
26
|
+
return { target, created: true };
|
|
27
|
+
};
|
|
28
|
+
/** 学徒的交接判断线: handoffAt(model) 打五折 —— 连续身份靠记忆不靠上下文, 小步交接,
|
|
29
|
+
* 别撑到自动压缩才动手。 */
|
|
30
|
+
export const handoffLineOf = (store, target, model) => isApprentice(store, target) ? Math.round(handoffAt(model) / 2) : handoffAt(model);
|
|
31
|
+
/** 巡检指令: 有界 (每轮 maxItems 条), 产物只进会话/rolepage, 不许无界自转。 */
|
|
32
|
+
export const patrolPrompt = (cfg) => {
|
|
33
|
+
const { maxItems, everyMin } = cfg.wrc.apprentice.patrol;
|
|
34
|
+
return [
|
|
35
|
+
"[学徒巡检] 自主整理一轮 (上限硬性):",
|
|
36
|
+
`1. 最多整理 ${maxItems} 条发现 (挂起事项、名册异常、记忆去重提议、可收的 plan) —— 超过就只挑最重要的 ${maxItems} 条, 其余下轮。`,
|
|
37
|
+
`2. 产物只写进本会话与 rolepage (计划/记忆/消项); 不主动发任何群 —— 要通知人必须显式 notify, 且仅在真需要人拍板时。`,
|
|
38
|
+
`3. 没有值得报的就以 QUIET 一行收尾; 巡检间隔 ${everyMin} 分钟, 这轮没做完的留给下轮, 不要拉长这一轮。`,
|
|
39
|
+
].join("\n");
|
|
40
|
+
};
|
|
41
|
+
export const PATROL_TASK_ID = "apprentice-patrol";
|
|
42
|
+
/** boot 装配巡检 (幂等, config 是权威): enabled → 确保 id 固定的 quiet 定时任务存在且
|
|
43
|
+
* 间隔/上限与 config 一致 (重建换内容, 状态清零 → 下一次到点是完整间隔后, 不会立刻放枪);
|
|
44
|
+
* disabled → 删掉。fresh 恒 false: 学徒是连续唯一会话, 定时永远注入它自己。 */
|
|
45
|
+
export const ensurePatrolTask = (registry, cfg, apprenticeTarget, now = new Date()) => {
|
|
46
|
+
const patrol = cfg.wrc.apprentice.patrol;
|
|
47
|
+
const existing = registry.list().find((t) => t.id === PATROL_TASK_ID);
|
|
48
|
+
if (!patrol.enabled || !apprenticeTarget) {
|
|
49
|
+
if (existing)
|
|
50
|
+
registry.remove(PATROL_TASK_ID);
|
|
51
|
+
return { active: false, recreated: false };
|
|
52
|
+
}
|
|
53
|
+
const trigger = parseTrigger(`every ${patrol.everyMin}m`, now);
|
|
54
|
+
if (!trigger)
|
|
55
|
+
return { active: false, recreated: false };
|
|
56
|
+
const prompt = patrolPrompt(cfg);
|
|
57
|
+
if (existing && existing.target === apprenticeTarget && existing.prompt === prompt
|
|
58
|
+
&& JSON.stringify(existing.trigger) === JSON.stringify(trigger) && existing.enabled) {
|
|
59
|
+
return { active: true, recreated: false };
|
|
60
|
+
}
|
|
61
|
+
if (existing)
|
|
62
|
+
registry.remove(PATROL_TASK_ID);
|
|
63
|
+
registry.create({
|
|
64
|
+
id: PATROL_TASK_ID,
|
|
65
|
+
trigger,
|
|
66
|
+
prompt,
|
|
67
|
+
target: apprenticeTarget,
|
|
68
|
+
fresh: false,
|
|
69
|
+
quiet: true,
|
|
70
|
+
note: "学徒自主巡检 (v3 §7; config wrc.apprentice.patrol 是权威, 手改这条会被 boot 覆盖)",
|
|
71
|
+
createdBy: apprenticeTarget,
|
|
72
|
+
});
|
|
73
|
+
return { active: true, recreated: true };
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=apprentice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apprentice.js","sourceRoot":"","sources":["../../daemon/apprentice.ts"],"names":[],"mappings":"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"}
|
package/dist/daemon/approval.js
CHANGED
|
@@ -10,10 +10,17 @@ import { dangerOf, dangerEarlyExit, selfConfigWriteOf } from "./danger.js";
|
|
|
10
10
|
import { appendUnique } from "../shared/config-writer.js";
|
|
11
11
|
import { claudeConfigWrite } from "../shared/claude-config-path.js";
|
|
12
12
|
import { recordApproval, recordApprovalDecision, buildDetailUrl, getDetail, openTurnsOf, targetOfSession } from "./detail.js";
|
|
13
|
+
import { isApprentice } from "./apprentice.js";
|
|
14
|
+
/** 学徒 (v3 §7) 的会话级豁免一律不生效 (⏱ 窗口 / skipAll): 卡永远到人。按「这个会话
|
|
15
|
+
* 最近一轮记在哪个 target 名下」(targetOfSession) 判定 —— 与 bot 归属判定同源。 */
|
|
16
|
+
const apprenticeSession = (sessionId) => isApprentice(wizardStore(), targetOfSession(sessionId) ?? "");
|
|
13
17
|
import { json, readBody } from "./http.js";
|
|
14
|
-
import { botOfKey, displayName, tagBadge,
|
|
18
|
+
import { botOfKey, displayName, tagBadge, withTagHeader, withBot } from "../shared/session-label.js";
|
|
15
19
|
import { chatPolicyOf } from "./chat-name.js";
|
|
20
|
+
import { isStewardTarget } from "./steward.js";
|
|
21
|
+
import { wizardStore } from "./wizard.js";
|
|
16
22
|
import { makeStewardGuard } from "./steward-guard.js";
|
|
23
|
+
import { guideRefusal } from "./onboarding.js";
|
|
17
24
|
import { sessionNameFor } from "./session-name.js";
|
|
18
25
|
import { reachable } from "./reach.js";
|
|
19
26
|
// ── Routing helpers ────────────────────────────────────────────────────
|
|
@@ -893,6 +900,19 @@ const freshSlot = (sessionId) => {
|
|
|
893
900
|
return s;
|
|
894
901
|
};
|
|
895
902
|
export const hasMirrorAskq = (sessionId) => freshSlot(sessionId) !== undefined;
|
|
903
|
+
/** 提问的结果落盘 = 面板已经不在屏上 (本地作答 / 我们自己驱动完) → 作废挂着的卡。
|
|
904
|
+
* 只认提问那次调用的 callId: PTC 脚本里在提问之前落地的别的工具结果不是它。
|
|
905
|
+
* 原生路径没有这个信号 (hook 迟到时自己清槽), callId 为 undefined 时按任意 result 处理。 */
|
|
906
|
+
export const mootMirrorAskq = (sessionId, callId) => {
|
|
907
|
+
const s = freshSlot(sessionId);
|
|
908
|
+
if (!s)
|
|
909
|
+
return;
|
|
910
|
+
if (callId && s.callId && callId !== s.callId)
|
|
911
|
+
return;
|
|
912
|
+
if (s.reqId)
|
|
913
|
+
resolvePending(s.reqId, "moot");
|
|
914
|
+
mirrorAskqSlots.delete(sessionId);
|
|
915
|
+
};
|
|
896
916
|
export const buildAskqDriveActions = (questions, picks) => {
|
|
897
917
|
const maxOpts = questions.reduce((m, q) => Math.max(m, q.options.length), 0);
|
|
898
918
|
const acts = [{ kind: "keys", keys: Array(maxOpts + 3).fill("Up") }];
|
|
@@ -929,7 +949,7 @@ export const buildAskqChatDriveActions = (q) => [
|
|
|
929
949
|
{ kind: "text", text: "聊聊这个" },
|
|
930
950
|
{ kind: "confirm_submit" },
|
|
931
951
|
];
|
|
932
|
-
export const runMirrorAskqFlow = async ({ cfg, log, client, sessionId, chatKey, toolInput, voteTimeoutMs, drive }) => {
|
|
952
|
+
export const runMirrorAskqFlow = async ({ cfg, log, client, sessionId, chatKey, toolInput, voteTimeoutMs, callId, drive }) => {
|
|
933
953
|
const questions = parseAskqInput(toolInput);
|
|
934
954
|
if (!questions || questions.length === 0)
|
|
935
955
|
return;
|
|
@@ -971,7 +991,7 @@ export const runMirrorAskqFlow = async ({ cfg, log, client, sessionId, chatKey,
|
|
|
971
991
|
},
|
|
972
992
|
timeoutMs: remainMs,
|
|
973
993
|
});
|
|
974
|
-
mirrorAskqSlots.set(sessionId, { reqId, at: Date.now() });
|
|
994
|
+
mirrorAskqSlots.set(sessionId, { reqId, at: Date.now(), callId });
|
|
975
995
|
const prefix = total > 1 ? `(${i + 1}/${total}) ` : "";
|
|
976
996
|
try {
|
|
977
997
|
try {
|
|
@@ -1282,7 +1302,7 @@ export const runMirrorPickerFlow = async ({ log, client, cfg, sessionId, chatKey
|
|
|
1282
1302
|
await note(`⚠️ 已记录拒绝,但代按失败(${r.reason ?? "未知"}),请回 CLI 处理。`);
|
|
1283
1303
|
return true;
|
|
1284
1304
|
}
|
|
1285
|
-
if (d === "allow_window" && cfg.approval.windowMinutes > 0) {
|
|
1305
|
+
if (d === "allow_window" && cfg.approval.windowMinutes > 0 && !apprenticeSession(sessionId)) {
|
|
1286
1306
|
setAutoWindow(chatKey, cfg.approval.windowMinutes * 60_000, {
|
|
1287
1307
|
toolName, toolInput, cwd, transcriptTail: tail, danger, singleNote, sessionName,
|
|
1288
1308
|
});
|
|
@@ -1730,8 +1750,20 @@ export const makeApproveHandler = ({ cfg, log, client, sourcePath, getMirrorTarg
|
|
|
1730
1750
|
}
|
|
1731
1751
|
// 群管家的手闸 (见 steward-guard.ts): 排在所有审批之前 —— 拦的不是危险, 是越位,
|
|
1732
1752
|
// 放行窗口 / allowRules / skipAll 都不该替它开门。
|
|
1753
|
+
// v3 §3: 判定从「untagged 默认会话」升为「该聊天绑定的管家化身」(config chatPolicy.steward
|
|
1754
|
+
// 指定优先, 没绑 = 现存默认会话) —— 指定的化身即使是 tagged 也 arm, 换绑后旧默认会话不再 arm。
|
|
1733
1755
|
const owner = getMirrorTarget?.(sessionId);
|
|
1734
|
-
|
|
1756
|
+
// 新群引导化身没有工具面 (onboarding.ts guideRefusal): 内置工具与 wezard MCP 一律在这里拒,
|
|
1757
|
+
// 排在手闸与一切放行之前 —— 它只把 daemon 的指令转成人话, handoff / set_workspace 自己
|
|
1758
|
+
// 正是 2026-11-17 teststrict 的事故形态。
|
|
1759
|
+
const guideDeny = owner ? guideRefusal(wizardStore()?.get(owner), toolName) : "";
|
|
1760
|
+
if (guideDeny) {
|
|
1761
|
+
log.info({ toolName, sessionId, owner }, "onboarding guide tool reject");
|
|
1762
|
+
json(res, 200, { decision: "deny", reason: guideDeny });
|
|
1763
|
+
return;
|
|
1764
|
+
}
|
|
1765
|
+
// 管家手闸只看 role (wiring B: 出站门已废, 契约 §7 改由 role 触发)。
|
|
1766
|
+
if (owner && isStewardTarget(cfg, wizardStore(), owner)) {
|
|
1735
1767
|
const reason = stewardGuard({
|
|
1736
1768
|
sessionId,
|
|
1737
1769
|
turn: openTurnsOf(owner, sessionId)[0]?.id ?? "",
|
|
@@ -1809,7 +1841,7 @@ export const makeApproveHandler = ({ cfg, log, client, sourcePath, getMirrorTarg
|
|
|
1809
1841
|
const singleNote = askHit ? `命中 askRules「${askHit}」` : undefined;
|
|
1810
1842
|
// allowRules: matcher 拦下的工具里再挖细粒度豁免 (Bash 可按命令前缀区分)。
|
|
1811
1843
|
// 交互卡工具 (AskUserQuestion 等) 在引擎内部硬保护, 规则写了也不放行。
|
|
1812
|
-
//
|
|
1844
|
+
// evaluateAllow 给完整裁决: 未命中时要把"因为哪一段"带到卡上,
|
|
1813
1845
|
// 光知道"没放行"帮不了用户判断。判定本身零额外开销 (原本就要跑这一次)。
|
|
1814
1846
|
const verdict = evaluateAllow(cfg.approval.allowRules, toolName, toolInput);
|
|
1815
1847
|
if (!mustCard && verdict.allowed) {
|
|
@@ -1891,13 +1923,13 @@ export const makeApproveHandler = ({ cfg, log, client, sourcePath, getMirrorTarg
|
|
|
1891
1923
|
settleGuard();
|
|
1892
1924
|
return;
|
|
1893
1925
|
}
|
|
1894
|
-
//
|
|
1895
|
-
// 名单 / askRules / ⏱窗口 / 会话缓存 (
|
|
1896
|
-
//
|
|
1897
|
-
//
|
|
1898
|
-
if (!nativePermission && cfg.approval.
|
|
1899
|
-
log.info({ toolName, sessionId }, "
|
|
1900
|
-
json(res, 200, { decision: "allow", reason: "
|
|
1926
|
+
// mode=skip_all: 跳过所有审批 —— 命中 matcher 的调用一律静默放行, 压过危险
|
|
1927
|
+
// 名单 / askRules / ⏱窗口 / 会话缓存 (原 danger.skipAll, 2026-10-28 并入 mode)。
|
|
1928
|
+
// denyRules / EnterPlanMode 拦截在前面已生效 (拒绝不是审批);
|
|
1929
|
+
// AskUserQuestion / ExitPlanMode 交互卡在上方分支已返回, 不受影响。
|
|
1930
|
+
if (!nativePermission && cfg.approval.mode === "skip_all" && !apprenticeSession(sessionId)) {
|
|
1931
|
+
log.info({ toolName, sessionId }, "skip_all auto allow");
|
|
1932
|
+
json(res, 200, { decision: "allow", reason: "skip_all" });
|
|
1901
1933
|
settleGuard();
|
|
1902
1934
|
return;
|
|
1903
1935
|
}
|
|
@@ -1915,6 +1947,27 @@ export const makeApproveHandler = ({ cfg, log, client, sourcePath, getMirrorTarg
|
|
|
1915
1947
|
// 早退照样能给 (settleGuard), 拿它挡早退等于把 danger 的开关废掉。
|
|
1916
1948
|
const earlyExit = dangerEarlyExit(cfg, danger, nativePermission || Boolean(askHit) || Boolean(selfWrite));
|
|
1917
1949
|
if (earlyExit) {
|
|
1950
|
+
// danger-only 模式 (mode=danger, 默认) 的自动放行按 ⏱ 窗口记账/续期 (人
|
|
1951
|
+
// 2026-10-28: 普通卡不再发, 非 danger 一律放行, 但要能看出是 10h 窗口放的,
|
|
1952
|
+
// 不是永久无痕)。窗口只做记账不参与门控 —— danger_mode_skip 本身不看窗口状态。
|
|
1953
|
+
if (earlyExit === "danger_mode_skip" && approver && cfg.approval.windowMinutes > 0) {
|
|
1954
|
+
setAutoWindow(approver, cfg.approval.windowMinutes * 60_000, {
|
|
1955
|
+
toolName,
|
|
1956
|
+
toolInput,
|
|
1957
|
+
cwd,
|
|
1958
|
+
transcriptTail,
|
|
1959
|
+
danger: danger?.rule,
|
|
1960
|
+
singleNote,
|
|
1961
|
+
});
|
|
1962
|
+
const remainSec = Math.ceil(autoWindowRemainingMs(approver) / 1000);
|
|
1963
|
+
log.info({ toolName, sessionId, chatKey: approver, remainSec }, "danger-only auto-window allow");
|
|
1964
|
+
json(res, 200, {
|
|
1965
|
+
decision: "allow",
|
|
1966
|
+
reason: `auto_window:${remainSec}s (danger-only)`,
|
|
1967
|
+
});
|
|
1968
|
+
settleGuard();
|
|
1969
|
+
return;
|
|
1970
|
+
}
|
|
1918
1971
|
log.info({ toolName, sessionId, reason: earlyExit }, "danger switch early exit");
|
|
1919
1972
|
json(res, 200, { decision: "allow", reason: earlyExit });
|
|
1920
1973
|
settleGuard();
|
|
@@ -1922,7 +1975,7 @@ export const makeApproveHandler = ({ cfg, log, client, sourcePath, getMirrorTarg
|
|
|
1922
1975
|
}
|
|
1923
1976
|
// Auto-approve window: while active for THIS chat, requests short-circuit to allow.
|
|
1924
1977
|
// mustCard (危险名单 / askRules) 的请求不吃窗口 — 即使开着 ⏱ 也逐条确认。
|
|
1925
|
-
if (!mustCard && approver && isAutoWindowActive(approver)) {
|
|
1978
|
+
if (!mustCard && approver && !apprenticeSession(sessionId) && isAutoWindowActive(approver)) {
|
|
1926
1979
|
const remainSec = Math.ceil(autoWindowRemainingMs(approver) / 1000);
|
|
1927
1980
|
log.info({ toolName, sessionId, chatKey: approver, remainSec }, "auto-window allow");
|
|
1928
1981
|
json(res, 200, {
|
|
@@ -2008,6 +2061,9 @@ export const makeApproveHandler = ({ cfg, log, client, sourcePath, getMirrorTarg
|
|
|
2008
2061
|
toolInput: display,
|
|
2009
2062
|
cwd,
|
|
2010
2063
|
sessionId,
|
|
2064
|
+
// 卡片身份随 detail 记录留 24h: 「展开完整命令」在 pending / 快照都过期后
|
|
2065
|
+
// 仍凭它回到卡片所在的 chat, 而不是 defaultChat。
|
|
2066
|
+
chatKey: approver,
|
|
2011
2067
|
transcriptTail,
|
|
2012
2068
|
});
|
|
2013
2069
|
// Batch coalesce: 同 session 同 tool 的并发请求合流为一张卡。窗口内首位
|
|
@@ -2129,7 +2185,7 @@ export const makeApproveHandler = ({ cfg, log, client, sourcePath, getMirrorTarg
|
|
|
2129
2185
|
await notify(approver, `📌 ${why},本次已一次性放行(未保存规则)。`);
|
|
2130
2186
|
}
|
|
2131
2187
|
}
|
|
2132
|
-
if (!mustCard && decision === "allow_window" && cfg.approval.windowMinutes > 0) {
|
|
2188
|
+
if (!mustCard && decision === "allow_window" && cfg.approval.windowMinutes > 0 && !apprenticeSession(sessionId)) {
|
|
2133
2189
|
setAutoWindow(approver, cfg.approval.windowMinutes * 60_000, {
|
|
2134
2190
|
toolName,
|
|
2135
2191
|
toolInput: display,
|
|
@@ -2197,13 +2253,15 @@ export const installApprovalEventListener = (client, log, cfg, onApproved) => {
|
|
|
2197
2253
|
if (key.startsWith(FULLCMD_PREFIX)) {
|
|
2198
2254
|
const reqId = key.slice(FULLCMD_PREFIX.length);
|
|
2199
2255
|
const rec = getDetail(reqId);
|
|
2200
|
-
//
|
|
2201
|
-
//
|
|
2202
|
-
//
|
|
2203
|
-
//
|
|
2204
|
-
//
|
|
2256
|
+
// 回复目标 = 卡片自己的会话身份, 逐级回收: 待决时在 pending 里; 已决时
|
|
2257
|
+
// pending 已删, 回落到 resolvePending 留下的 5min resolved 暂存; 再往后
|
|
2258
|
+
// (含 daemon 重启) 由 24h 的 detail 记录兜着 —— recordApproval 落卡时就
|
|
2259
|
+
// 把 chatKey 一起存了。全部 miss (记录过期的真鬼卡) 才按点击帧是哪个
|
|
2260
|
+
// 机器人收的兑到它自己的默认聊天 (副机器人没配 = 不回), 不回落主机器人
|
|
2261
|
+
// 的全局 defaultChat; 单机器人时 botTagOf 恒 "", 就是 cfg.defaultChat。
|
|
2205
2262
|
const target = getPending(reqId)?.chatKey
|
|
2206
2263
|
?? getResolvedSnapshot(reqId)?.meta.chatKey
|
|
2264
|
+
?? (rec?.kind === "approval" ? rec.chatKey : undefined)
|
|
2207
2265
|
?? defaultChatOfBot(cfg, botTagOf(frame));
|
|
2208
2266
|
if (!target) {
|
|
2209
2267
|
log.info({ reqId, bot: botTagOf(frame) }, "full command: 记录已过期且该机器人没有默认聊天, 不回");
|