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
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Create 6-grid or 9-grid visual contact sheets from a PPTX.
|
|
3
|
+
|
|
4
|
+
Pipeline:
|
|
5
|
+
1. LibreOffice converts PPTX to PDF.
|
|
6
|
+
2. `pypdfium2` (pip 包) renders PDF pages to PNG.
|
|
7
|
+
3. Pillow composes every 6 or 9 slides into one contact-sheet PNG.
|
|
8
|
+
|
|
9
|
+
依赖:LibreOffice(系统二进制,pptx→pdf)+ pypdfium2 / Pillow(pip 包)。
|
|
10
|
+
|
|
11
|
+
Safety: this script never performs wildcard deletion. It writes into a new
|
|
12
|
+
run-specific output directory and overwrites only explicit files inside it.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import argparse
|
|
18
|
+
import datetime as _dt
|
|
19
|
+
import os
|
|
20
|
+
import re
|
|
21
|
+
import shutil
|
|
22
|
+
import subprocess
|
|
23
|
+
import sys
|
|
24
|
+
from pathlib import Path
|
|
25
|
+
from typing import Iterable, List, Sequence, Tuple
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _die(message: str, code: int = 1) -> None:
|
|
29
|
+
print(f"[pptx-style] ERROR: {message}", file=sys.stderr)
|
|
30
|
+
raise SystemExit(code)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _run(cmd: Sequence[str], cwd: Path | None = None) -> None:
|
|
34
|
+
printable = " ".join(str(x) for x in cmd)
|
|
35
|
+
print(f"[pptx-style] RUN: {printable}")
|
|
36
|
+
proc = subprocess.run(
|
|
37
|
+
list(cmd),
|
|
38
|
+
cwd=str(cwd) if cwd else None,
|
|
39
|
+
text=True,
|
|
40
|
+
stdout=subprocess.PIPE,
|
|
41
|
+
stderr=subprocess.PIPE,
|
|
42
|
+
)
|
|
43
|
+
if proc.stdout.strip():
|
|
44
|
+
print(proc.stdout.strip())
|
|
45
|
+
if proc.stderr.strip():
|
|
46
|
+
print(proc.stderr.strip(), file=sys.stderr)
|
|
47
|
+
if proc.returncode != 0:
|
|
48
|
+
_die(f"command failed with exit code {proc.returncode}: {printable}")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _find_executable(name_or_path: str | None, candidates: Iterable[str]) -> str | None:
|
|
52
|
+
if name_or_path:
|
|
53
|
+
p = Path(name_or_path).expanduser()
|
|
54
|
+
if p.exists():
|
|
55
|
+
return str(p)
|
|
56
|
+
found = shutil.which(name_or_path)
|
|
57
|
+
if found:
|
|
58
|
+
return found
|
|
59
|
+
for item in candidates:
|
|
60
|
+
p = Path(item).expanduser()
|
|
61
|
+
if p.exists():
|
|
62
|
+
return str(p)
|
|
63
|
+
found = shutil.which(item)
|
|
64
|
+
if found:
|
|
65
|
+
return found
|
|
66
|
+
return None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _natural_key(path: Path) -> Tuple[int, str]:
|
|
70
|
+
match = re.search(r"(\d+)(?=\.png$)", path.name)
|
|
71
|
+
return (int(match.group(1)) if match else 10**9, path.name)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _import_pillow():
|
|
75
|
+
try:
|
|
76
|
+
from PIL import Image, ImageDraw, ImageFont
|
|
77
|
+
except Exception as exc: # pragma: no cover - dependency message path
|
|
78
|
+
_die(
|
|
79
|
+
"Pillow is required for contact-sheet composition. "
|
|
80
|
+
"若缺失则拼图不可用,请直接查看逐页 PNG 或走 xml 兜底。\n"
|
|
81
|
+
f"Original import error: {exc}"
|
|
82
|
+
)
|
|
83
|
+
return Image, ImageDraw, ImageFont
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def convert_pptx_to_pdf(pptx: Path, pdf_dir: Path, soffice: str) -> Path:
|
|
87
|
+
pdf_dir.mkdir(parents=True, exist_ok=True)
|
|
88
|
+
before = {p.resolve() for p in pdf_dir.glob("*.pdf")}
|
|
89
|
+
_run([soffice, "--headless", "--convert-to", "pdf", "--outdir", str(pdf_dir), str(pptx)])
|
|
90
|
+
after = sorted(pdf_dir.glob("*.pdf"), key=lambda p: p.stat().st_mtime, reverse=True)
|
|
91
|
+
new_files = [p for p in after if p.resolve() not in before]
|
|
92
|
+
if new_files:
|
|
93
|
+
return new_files[0]
|
|
94
|
+
if after:
|
|
95
|
+
return after[0]
|
|
96
|
+
_die("LibreOffice did not produce a PDF file")
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _import_pdfium():
|
|
100
|
+
try:
|
|
101
|
+
import pypdfium2 as pdfium
|
|
102
|
+
except Exception as exc: # pragma: no cover - dependency message path
|
|
103
|
+
_die(
|
|
104
|
+
"pypdfium2 is required to render PDF pages to PNG. "
|
|
105
|
+
"若缺失则 PDF 渲染不可用,请走 xml 解析兜底。\n"
|
|
106
|
+
f"Original import error: {exc}"
|
|
107
|
+
)
|
|
108
|
+
return pdfium
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def render_pdf_to_pngs(pdf: Path, slides_dir: Path, dpi: int) -> List[Path]:
|
|
112
|
+
"""用 pypdfium2 把 PDF 各页渲染为 slide-NN.png。"""
|
|
113
|
+
pdfium = _import_pdfium()
|
|
114
|
+
slides_dir.mkdir(parents=True, exist_ok=True)
|
|
115
|
+
scale = dpi / 72.0
|
|
116
|
+
doc = pdfium.PdfDocument(str(pdf))
|
|
117
|
+
try:
|
|
118
|
+
for i in range(len(doc)):
|
|
119
|
+
page = doc[i]
|
|
120
|
+
bitmap = page.render(scale=scale)
|
|
121
|
+
pil_image = bitmap.to_pil() # 直接产 PIL Image,无需中间文件
|
|
122
|
+
pil_image.save(slides_dir / f"slide-{i + 1:02d}.png")
|
|
123
|
+
page.close()
|
|
124
|
+
finally:
|
|
125
|
+
doc.close()
|
|
126
|
+
slide_pngs = sorted(slides_dir.glob("slide-*.png"), key=_natural_key)
|
|
127
|
+
if not slide_pngs:
|
|
128
|
+
_die("pypdfium2 did not produce slide PNG files")
|
|
129
|
+
return slide_pngs
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def make_contact_sheets(slide_pngs: Sequence[Path], sheets_dir: Path, grid: int) -> List[Path]:
|
|
133
|
+
Image, ImageDraw, ImageFont = _import_pillow()
|
|
134
|
+
sheets_dir.mkdir(parents=True, exist_ok=True)
|
|
135
|
+
|
|
136
|
+
if grid == 6:
|
|
137
|
+
cols, rows = 3, 2
|
|
138
|
+
elif grid == 9:
|
|
139
|
+
cols, rows = 3, 3
|
|
140
|
+
else:
|
|
141
|
+
_die("grid must be 6 or 9")
|
|
142
|
+
|
|
143
|
+
thumb_w, thumb_h = 360, 203 # 16:9 thumbnail box
|
|
144
|
+
label_h = 26
|
|
145
|
+
gap = 18
|
|
146
|
+
margin = 28
|
|
147
|
+
cell_w = thumb_w
|
|
148
|
+
cell_h = thumb_h + label_h
|
|
149
|
+
canvas_w = margin * 2 + cols * cell_w + (cols - 1) * gap
|
|
150
|
+
canvas_h = margin * 2 + rows * cell_h + (rows - 1) * gap
|
|
151
|
+
|
|
152
|
+
try:
|
|
153
|
+
font = ImageFont.truetype("Arial.ttf", 15)
|
|
154
|
+
except Exception:
|
|
155
|
+
font = ImageFont.load_default()
|
|
156
|
+
|
|
157
|
+
outputs: List[Path] = []
|
|
158
|
+
for sheet_idx, start in enumerate(range(0, len(slide_pngs), grid), start=1):
|
|
159
|
+
group = slide_pngs[start : start + grid]
|
|
160
|
+
first_page = start + 1
|
|
161
|
+
last_page = start + len(group)
|
|
162
|
+
canvas = Image.new("RGB", (canvas_w, canvas_h), "#F4F4F2")
|
|
163
|
+
draw = ImageDraw.Draw(canvas)
|
|
164
|
+
|
|
165
|
+
for i, slide_path in enumerate(group):
|
|
166
|
+
row = i // cols
|
|
167
|
+
col = i % cols
|
|
168
|
+
x = margin + col * (cell_w + gap)
|
|
169
|
+
y = margin + row * (cell_h + gap)
|
|
170
|
+
with Image.open(slide_path) as img:
|
|
171
|
+
img = img.convert("RGB")
|
|
172
|
+
img.thumbnail((thumb_w, thumb_h), Image.Resampling.LANCZOS)
|
|
173
|
+
frame = Image.new("RGB", (thumb_w, thumb_h), "#FFFFFF")
|
|
174
|
+
px = (thumb_w - img.width) // 2
|
|
175
|
+
py = (thumb_h - img.height) // 2
|
|
176
|
+
frame.paste(img, (px, py))
|
|
177
|
+
canvas.paste(frame, (x, y))
|
|
178
|
+
draw.rectangle([x, y, x + thumb_w, y + thumb_h], outline="#D0D0D0", width=1)
|
|
179
|
+
draw.text((x + 8, y + thumb_h + 6), f"Slide {start + i + 1}", fill="#333333", font=font)
|
|
180
|
+
|
|
181
|
+
out = sheets_dir / f"style_sheet_{sheet_idx:02d}_pages_{first_page:03d}-{last_page:03d}.png"
|
|
182
|
+
canvas.save(out, quality=95)
|
|
183
|
+
outputs.append(out)
|
|
184
|
+
return outputs
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def write_manifest(run_dir: Path, pptx: Path, pdf: Path, slide_pngs: Sequence[Path], sheets: Sequence[Path], grid: int, dpi: int) -> Path:
|
|
188
|
+
manifest = run_dir / "STYLE_PREVIEW.md"
|
|
189
|
+
sheet_list = "\n".join(f"- `{p.relative_to(run_dir)}`" for p in sheets)
|
|
190
|
+
slide_list = "\n".join(f"- `{p.relative_to(run_dir)}`" for p in slide_pngs)
|
|
191
|
+
manifest.write_text(
|
|
192
|
+
"# PPTX Style Preview\n\n"
|
|
193
|
+
f"- Source PPTX: `{pptx}`\n"
|
|
194
|
+
f"- Render DPI: `{dpi}`\n"
|
|
195
|
+
f"- Grid: `{grid}` slides per contact sheet\n"
|
|
196
|
+
f"- PDF: `{pdf.relative_to(run_dir)}`\n\n"
|
|
197
|
+
"## Contact sheets for style reading\n\n"
|
|
198
|
+
f"{sheet_list}\n\n"
|
|
199
|
+
"## Individual slide PNGs\n\n"
|
|
200
|
+
f"{slide_list}\n\n"
|
|
201
|
+
"## How to use\n\n"
|
|
202
|
+
"Read the contact-sheet PNGs first to infer the global visual language: "
|
|
203
|
+
"canvas rhythm, background, color palette, typography hierarchy, recurring motifs, "
|
|
204
|
+
"page-type patterns, chart/table style, image treatment, and whitespace density. "
|
|
205
|
+
"Only read individual slide PNGs when a contact sheet is too small for local details. "
|
|
206
|
+
"Then write the project DESIGN.md from these observations.\n",
|
|
207
|
+
encoding="utf-8",
|
|
208
|
+
)
|
|
209
|
+
return manifest
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def parse_args(argv: Sequence[str]) -> argparse.Namespace:
|
|
213
|
+
parser = argparse.ArgumentParser(description="Convert a PPTX into 6/9-grid style contact-sheet PNGs.")
|
|
214
|
+
parser.add_argument("pptx", help="Path to the source .pptx file")
|
|
215
|
+
parser.add_argument("--outdir", default="style_preview", help="Output root directory; a run-specific subdirectory is created inside it")
|
|
216
|
+
parser.add_argument("--grid", type=int, choices=(6, 9), default=9, help="Slides per contact sheet: 6 or 9")
|
|
217
|
+
parser.add_argument("--dpi", type=int, default=120, help="PDF render DPI for individual slide PNGs")
|
|
218
|
+
parser.add_argument("--soffice", default=os.environ.get("SOFFICE"), help="Path to LibreOffice soffice executable")
|
|
219
|
+
return parser.parse_args(argv)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def main(argv: Sequence[str] | None = None) -> int:
|
|
223
|
+
args = parse_args(argv or sys.argv[1:])
|
|
224
|
+
pptx = Path(args.pptx).expanduser().resolve()
|
|
225
|
+
if not pptx.exists():
|
|
226
|
+
_die(f"PPTX file not found: {pptx}")
|
|
227
|
+
if pptx.suffix.lower() != ".pptx":
|
|
228
|
+
_die(f"expected a .pptx file, got: {pptx.name}")
|
|
229
|
+
|
|
230
|
+
soffice = _find_executable(
|
|
231
|
+
args.soffice,
|
|
232
|
+
[
|
|
233
|
+
"soffice",
|
|
234
|
+
"/Applications/LibreOffice.app/Contents/MacOS/soffice",
|
|
235
|
+
"/opt/libreoffice/program/soffice",
|
|
236
|
+
"/usr/bin/libreoffice",
|
|
237
|
+
],
|
|
238
|
+
)
|
|
239
|
+
if not soffice:
|
|
240
|
+
_die(
|
|
241
|
+
"LibreOffice soffice executable not found. Install LibreOffice and/or pass --soffice. "
|
|
242
|
+
"macOS path is usually /Applications/LibreOffice.app/Contents/MacOS/soffice"
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
out_root = Path(args.outdir).expanduser().resolve()
|
|
246
|
+
run_id = _dt.datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
247
|
+
safe_stem = re.sub(r"[^A-Za-z0-9._-]+", "_", pptx.stem).strip("_") or "pptx"
|
|
248
|
+
run_dir = out_root / f"{safe_stem}_style_preview_{run_id}"
|
|
249
|
+
pdf_dir = run_dir / "pdf"
|
|
250
|
+
slides_dir = run_dir / "slides"
|
|
251
|
+
sheets_dir = run_dir / "sheets"
|
|
252
|
+
run_dir.mkdir(parents=True, exist_ok=False)
|
|
253
|
+
|
|
254
|
+
pdf = convert_pptx_to_pdf(pptx, pdf_dir, soffice)
|
|
255
|
+
slide_pngs = render_pdf_to_pngs(pdf, slides_dir, args.dpi)
|
|
256
|
+
sheets = make_contact_sheets(slide_pngs, sheets_dir, args.grid)
|
|
257
|
+
manifest = write_manifest(run_dir, pptx, pdf, slide_pngs, sheets, args.grid, args.dpi)
|
|
258
|
+
|
|
259
|
+
print("[pptx-style] DONE")
|
|
260
|
+
print(f"[pptx-style] run_dir: {run_dir}")
|
|
261
|
+
print(f"[pptx-style] manifest: {manifest}")
|
|
262
|
+
for sheet in sheets:
|
|
263
|
+
print(f"[pptx-style] sheet: {sheet}")
|
|
264
|
+
return 0
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
if __name__ == "__main__":
|
|
268
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""recalc.py — Excel 公式重算器。
|
|
4
|
+
|
|
5
|
+
由 xlsx_recalc wheel(src/xlsx_recalc 的 _recalc.py + _soffice.py)还原而来,
|
|
6
|
+
两个模块内联为单文件脚本,恢复 CLI 入口,agent 直接以子进程方式调用:
|
|
7
|
+
|
|
8
|
+
python3 recalc.py <file.xlsx> [timeout_seconds] [--skip-external-link-check]
|
|
9
|
+
|
|
10
|
+
基于 LibreOffice 宏(RecalculateAndSave: calculateAll → store → close)显式重算
|
|
11
|
+
xlsx 全部公式并写入缓存值,**原地覆盖文件**;随后扫描全部单元格的 Excel 错误
|
|
12
|
+
(#REF!/#DIV/0!/#VALUE!/#NAME?/#NULL!/#NUM!/#N/A),按错误类型给出计数与位置。
|
|
13
|
+
|
|
14
|
+
内置沙箱适配层:AF_UNIX socket 被封禁时自动编译并挂 LD_PRELOAD C shim
|
|
15
|
+
(lo_socket_shim.so),让 LibreOffice UNO socket 在受限沙箱里跑通。需要 gcc
|
|
16
|
+
(仅首次编译 shim;正常环境 socket 没被封则不需要 gcc)。
|
|
17
|
+
|
|
18
|
+
前置条件:
|
|
19
|
+
- LibreOffice (soffice) 已安装且在 PATH。
|
|
20
|
+
- openpyxl 已安装(沙箱默认装)。
|
|
21
|
+
- 文件必须可写(宏 store() 原地覆盖)。agent 应先把 openpyxl 产出保存到
|
|
22
|
+
沙箱可写目录(output/ 或 temp/),再调本脚本。
|
|
23
|
+
- 默认开外链闸门:检测到 externalLinks 直接返回 error,防止 store()
|
|
24
|
+
静默剥缓存值致公式变 #NAME?。确认无外链或已拷值时传
|
|
25
|
+
--skip-external-link-check 跳过。
|
|
26
|
+
|
|
27
|
+
输出 JSON 到 stdout;含 "error" 键时退出码 1,否则 0。
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
import argparse
|
|
31
|
+
import json
|
|
32
|
+
import os
|
|
33
|
+
import platform
|
|
34
|
+
import socket
|
|
35
|
+
import subprocess
|
|
36
|
+
import sys
|
|
37
|
+
import tempfile
|
|
38
|
+
import zipfile
|
|
39
|
+
from pathlib import Path
|
|
40
|
+
|
|
41
|
+
from openpyxl import load_workbook
|
|
42
|
+
|
|
43
|
+
MACRO_DIR_MACOS = "~/Library/Application Support/LibreOffice/4/user/basic/Standard"
|
|
44
|
+
MACRO_DIR_LINUX = "~/.config/libreoffice/4/user/basic/Standard"
|
|
45
|
+
MACRO_FILENAME = "Module1.xba"
|
|
46
|
+
|
|
47
|
+
# LibreOffice 宏:强制重算全部公式 → 原地保存 → 关闭。
|
|
48
|
+
# 比 soffice --convert-to xlsx 的"加载时重算"更显式可靠。
|
|
49
|
+
RECALCULATE_MACRO = """<?xml version="1.0" encoding="UTF-8"?>
|
|
50
|
+
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
|
51
|
+
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">
|
|
52
|
+
Sub RecalculateAndSave()
|
|
53
|
+
ThisComponent.calculateAll()
|
|
54
|
+
ThisComponent.store()
|
|
55
|
+
ThisComponent.close(True)
|
|
56
|
+
End Sub
|
|
57
|
+
</script:module>"""
|
|
58
|
+
|
|
59
|
+
EXCEL_ERRORS = [
|
|
60
|
+
"#VALUE!", "#DIV/0!", "#REF!", "#NAME?", "#NULL!", "#NUM!", "#N/A",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# --------------------------------------------------------------------------- #
|
|
65
|
+
# soffice 沙箱适配层(原 _soffice.py)
|
|
66
|
+
# --------------------------------------------------------------------------- #
|
|
67
|
+
|
|
68
|
+
_SHIM_SO = Path(tempfile.gettempdir()) / "lo_socket_shim.so"
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def get_soffice_env() -> dict:
|
|
72
|
+
"""返回跑 soffice 所需的 env dict。
|
|
73
|
+
|
|
74
|
+
- 固定设 SAL_USE_VCLPLUGIN=svp(无头渲染)。
|
|
75
|
+
- 若 AF_UNIX socket 被封禁(沙箱),编译并挂 lo_socket_shim.so 到 LD_PRELOAD。
|
|
76
|
+
"""
|
|
77
|
+
env = os.environ.copy()
|
|
78
|
+
env["SAL_USE_VCLPLUGIN"] = "svp"
|
|
79
|
+
|
|
80
|
+
if _needs_shim():
|
|
81
|
+
shim = _ensure_shim()
|
|
82
|
+
env["LD_PRELOAD"] = str(shim)
|
|
83
|
+
|
|
84
|
+
return env
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _needs_shim() -> bool:
|
|
88
|
+
"""AF_UNIX socket 能创建就不需要 shim。"""
|
|
89
|
+
try:
|
|
90
|
+
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
91
|
+
s.close()
|
|
92
|
+
return False
|
|
93
|
+
except OSError:
|
|
94
|
+
return True
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _ensure_shim() -> Path:
|
|
98
|
+
"""编译(仅首次)并返回 shim .so 路径。需要 gcc。"""
|
|
99
|
+
if _SHIM_SO.exists():
|
|
100
|
+
return _SHIM_SO
|
|
101
|
+
|
|
102
|
+
src = Path(tempfile.gettempdir()) / "lo_socket_shim.c"
|
|
103
|
+
src.write_text(_SHIM_SOURCE)
|
|
104
|
+
subprocess.run(
|
|
105
|
+
["gcc", "-shared", "-fPIC", "-o", str(_SHIM_SO), str(src), "-ldl"],
|
|
106
|
+
check=True,
|
|
107
|
+
capture_output=True,
|
|
108
|
+
)
|
|
109
|
+
src.unlink()
|
|
110
|
+
return _SHIM_SO
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# LD_PRELOAD 挂的这个 C shim 把 LibreOffice 内部的 socket(AF_UNIX) 调用
|
|
114
|
+
# 重定向到 socketpair+pipe,绕开沙箱对 AF_UNIX 的封禁。仅 FD<1024 生效。
|
|
115
|
+
# 源自 xlsx 插件 office/soffice.py,逻辑未改动。
|
|
116
|
+
_SHIM_SOURCE = r"""
|
|
117
|
+
#define _GNU_SOURCE
|
|
118
|
+
#include <dlfcn.h>
|
|
119
|
+
#include <errno.h>
|
|
120
|
+
#include <signal.h>
|
|
121
|
+
#include <stdio.h>
|
|
122
|
+
#include <stdlib.h>
|
|
123
|
+
#include <sys/socket.h>
|
|
124
|
+
#include <unistd.h>
|
|
125
|
+
|
|
126
|
+
static int (*real_socket)(int, int, int);
|
|
127
|
+
static int (*real_socketpair)(int, int, int, int[2]);
|
|
128
|
+
static int (*real_listen)(int, int);
|
|
129
|
+
static int (*real_accept)(int, struct sockaddr *, socklen_t *);
|
|
130
|
+
static int (*real_close)(int);
|
|
131
|
+
static int (*real_read)(int, void *, size_t);
|
|
132
|
+
|
|
133
|
+
/* Per-FD bookkeeping (FDs >= 1024 are passed through unshimmed). */
|
|
134
|
+
static int is_shimmed[1024];
|
|
135
|
+
static int peer_of[1024];
|
|
136
|
+
static int wake_r[1024]; /* accept() blocks reading this */
|
|
137
|
+
static int wake_w[1024]; /* close() writes to this */
|
|
138
|
+
static int listener_fd = -1; /* FD that received listen() */
|
|
139
|
+
|
|
140
|
+
__attribute__((constructor))
|
|
141
|
+
static void init(void) {
|
|
142
|
+
real_socket = dlsym(RTLD_NEXT, "socket");
|
|
143
|
+
real_socketpair = dlsym(RTLD_NEXT, "socketpair");
|
|
144
|
+
real_listen = dlsym(RTLD_NEXT, "listen");
|
|
145
|
+
real_accept = dlsym(RTLD_NEXT, "accept");
|
|
146
|
+
real_close = dlsym(RTLD_NEXT, "close");
|
|
147
|
+
real_read = dlsym(RTLD_NEXT, "read");
|
|
148
|
+
for (int i = 0; i < 1024; i++) {
|
|
149
|
+
peer_of[i] = -1;
|
|
150
|
+
wake_r[i] = -1;
|
|
151
|
+
wake_w[i] = -1;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* ---- socket ---------------------------------------------------------- */
|
|
156
|
+
int socket(int domain, int type, int protocol) {
|
|
157
|
+
if (domain == AF_UNIX) {
|
|
158
|
+
int fd = real_socket(domain, type, protocol);
|
|
159
|
+
if (fd >= 0) return fd;
|
|
160
|
+
/* socket(AF_UNIX) blocked - fall back to socketpair(). */
|
|
161
|
+
int sv[2];
|
|
162
|
+
if (real_socketpair(domain, type, protocol, sv) == 0) {
|
|
163
|
+
if (sv[0] >= 0 && sv[0] < 1024) {
|
|
164
|
+
is_shimmed[sv[0]] = 1;
|
|
165
|
+
peer_of[sv[0]] = sv[1];
|
|
166
|
+
int wp[2];
|
|
167
|
+
if (pipe(wp) == 0) {
|
|
168
|
+
wake_r[sv[0]] = wp[0];
|
|
169
|
+
wake_w[sv[0]] = wp[1];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return sv[0];
|
|
173
|
+
}
|
|
174
|
+
errno = EPERM;
|
|
175
|
+
return -1;
|
|
176
|
+
}
|
|
177
|
+
return real_socket(domain, type, protocol);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* ---- listen ---------------------------------------------------------- */
|
|
181
|
+
int listen(int sockfd, int backlog) {
|
|
182
|
+
if (sockfd >= 0 && sockfd < 1024 && is_shimmed[sockfd]) {
|
|
183
|
+
listener_fd = sockfd;
|
|
184
|
+
return 0;
|
|
185
|
+
}
|
|
186
|
+
return real_listen(sockfd, backlog);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* ---- accept ---------------------------------------------------------- */
|
|
190
|
+
int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
|
|
191
|
+
if (sockfd >= 0 && sockfd < 1024 && is_shimmed[sockfd]) {
|
|
192
|
+
/* Block until close() writes to the wake pipe. */
|
|
193
|
+
if (wake_r[sockfd] >= 0) {
|
|
194
|
+
char buf;
|
|
195
|
+
real_read(wake_r[sockfd], &buf, 1);
|
|
196
|
+
}
|
|
197
|
+
errno = ECONNABORTED;
|
|
198
|
+
return -1;
|
|
199
|
+
}
|
|
200
|
+
return real_accept(sockfd, addr, addrlen);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* ---- close ----------------------------------------------------------- */
|
|
204
|
+
int close(int fd) {
|
|
205
|
+
if (fd >= 0 && fd < 1024 && is_shimmed[fd]) {
|
|
206
|
+
int was_listener = (fd == listener_fd);
|
|
207
|
+
is_shimmed[fd] = 0;
|
|
208
|
+
|
|
209
|
+
if (wake_w[fd] >= 0) { /* unblock accept() */
|
|
210
|
+
char c = 0;
|
|
211
|
+
write(wake_w[fd], &c, 1);
|
|
212
|
+
real_close(wake_w[fd]);
|
|
213
|
+
wake_w[fd] = -1;
|
|
214
|
+
}
|
|
215
|
+
if (wake_r[fd] >= 0) { real_close(wake_r[fd]); wake_r[fd] = -1; }
|
|
216
|
+
if (peer_of[fd] >= 0) { real_close(peer_of[fd]); peer_of[fd] = -1; }
|
|
217
|
+
|
|
218
|
+
if (was_listener)
|
|
219
|
+
_exit(0); /* conversion done - exit */
|
|
220
|
+
}
|
|
221
|
+
return real_close(fd);
|
|
222
|
+
}
|
|
223
|
+
"""
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
# --------------------------------------------------------------------------- #
|
|
227
|
+
# 重算核心(原 _recalc.py)
|
|
228
|
+
# --------------------------------------------------------------------------- #
|
|
229
|
+
|
|
230
|
+
def has_gtimeout() -> bool:
|
|
231
|
+
try:
|
|
232
|
+
subprocess.run(
|
|
233
|
+
["gtimeout", "--version"], capture_output=True, timeout=1, check=False
|
|
234
|
+
)
|
|
235
|
+
return True
|
|
236
|
+
except (FileNotFoundError, subprocess.TimeoutExpired):
|
|
237
|
+
return False
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def setup_libreoffice_macro() -> bool:
|
|
241
|
+
"""确保 LibreOffice 用户配置里有 RecalculateAndSave 宏。"""
|
|
242
|
+
macro_dir = os.path.expanduser(
|
|
243
|
+
MACRO_DIR_MACOS if platform.system() == "Darwin" else MACRO_DIR_LINUX
|
|
244
|
+
)
|
|
245
|
+
macro_file = os.path.join(macro_dir, MACRO_FILENAME)
|
|
246
|
+
|
|
247
|
+
if os.path.exists(macro_file) and "RecalculateAndSave" in Path(macro_file).read_text():
|
|
248
|
+
return True
|
|
249
|
+
|
|
250
|
+
if not os.path.exists(macro_dir):
|
|
251
|
+
# 首次跑 soffice 让它生成用户配置目录树
|
|
252
|
+
subprocess.run(
|
|
253
|
+
["soffice", "--headless", "--terminate_after_init"],
|
|
254
|
+
capture_output=True, timeout=10, check=False, env=get_soffice_env(),
|
|
255
|
+
)
|
|
256
|
+
os.makedirs(macro_dir, exist_ok=True)
|
|
257
|
+
|
|
258
|
+
try:
|
|
259
|
+
Path(macro_file).write_text(RECALCULATE_MACRO)
|
|
260
|
+
return True
|
|
261
|
+
except Exception:
|
|
262
|
+
return False
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
def _has_external_links(path: str) -> bool:
|
|
266
|
+
"""检测 xlsx 内部是否存在外链(externalLinks)部件。"""
|
|
267
|
+
try:
|
|
268
|
+
with zipfile.ZipFile(path) as z:
|
|
269
|
+
return any("externallink" in n.lower() for n in z.namelist())
|
|
270
|
+
except Exception:
|
|
271
|
+
return False
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def recalc(filename, timeout=30, check_external_links=True):
|
|
275
|
+
"""用 LibreOffice 宏重算 xlsx 全部公式,原地保存并扫描错误。
|
|
276
|
+
|
|
277
|
+
参数:
|
|
278
|
+
filename (str): xlsx 文件路径(必须可写——宏会 store() 原地覆盖)。
|
|
279
|
+
timeout (int): soffice 超时秒数,默认 30。
|
|
280
|
+
check_external_links (bool): 默认 True。检测到外链直接返回 error,
|
|
281
|
+
防止 LibreOffice store() 静默剥掉外链缓存值致公式变 #NAME?。
|
|
282
|
+
确认无外链依赖或已手动拷出值时可传 False 跳过。
|
|
283
|
+
|
|
284
|
+
返回 dict:
|
|
285
|
+
成功无错: {"status":"success","total_errors":0,"total_formulas":N}
|
|
286
|
+
成功有错: {"status":"errors_found","total_errors":N,"total_formulas":N,
|
|
287
|
+
"error_summary":{"#REF!":{"count":2,"locations":[...]}, ...}}
|
|
288
|
+
失败: {"error":"..."} (文件不存在/soffice 缺失/宏配置失败/超时等)
|
|
289
|
+
"""
|
|
290
|
+
if not Path(filename).exists():
|
|
291
|
+
return {"error": f"File {filename} does not exist"}
|
|
292
|
+
|
|
293
|
+
abs_path = str(Path(filename).absolute())
|
|
294
|
+
|
|
295
|
+
# 外链前置闸门(默认开)。='[1]xxx'!$B$2 这类外链,store() 会剥缓存值。
|
|
296
|
+
if check_external_links and _has_external_links(abs_path):
|
|
297
|
+
return {"error": "检测到外链(externalLinks);先把外链单元格值拷出再重算"}
|
|
298
|
+
|
|
299
|
+
if not setup_libreoffice_macro():
|
|
300
|
+
return {"error": "Failed to setup LibreOffice macro"}
|
|
301
|
+
|
|
302
|
+
cmd = [
|
|
303
|
+
"soffice",
|
|
304
|
+
"--headless",
|
|
305
|
+
"--norestore",
|
|
306
|
+
"vnd.sun.star.script:Standard.Module1.RecalculateAndSave?language=Basic&location=application",
|
|
307
|
+
abs_path,
|
|
308
|
+
]
|
|
309
|
+
|
|
310
|
+
if platform.system() == "Linux":
|
|
311
|
+
cmd = ["timeout", str(timeout)] + cmd
|
|
312
|
+
elif platform.system() == "Darwin" and has_gtimeout():
|
|
313
|
+
cmd = ["gtimeout", str(timeout)] + cmd
|
|
314
|
+
|
|
315
|
+
try:
|
|
316
|
+
result = subprocess.run(cmd, capture_output=True, text=True, env=get_soffice_env())
|
|
317
|
+
except FileNotFoundError:
|
|
318
|
+
return {"error": "soffice 未安装或不在 PATH;请先安装 LibreOffice"}
|
|
319
|
+
|
|
320
|
+
# returncode 124 = timeout 超时退出码(Linux timeout / macOS gtimeout)
|
|
321
|
+
if result.returncode != 0 and result.returncode != 124:
|
|
322
|
+
error_msg = result.stderr or "Unknown error during recalculation"
|
|
323
|
+
if "Module1" in error_msg or "RecalculateAndSave" not in error_msg:
|
|
324
|
+
return {"error": "LibreOffice macro not configured properly"}
|
|
325
|
+
return {"error": error_msg}
|
|
326
|
+
|
|
327
|
+
try:
|
|
328
|
+
wb = load_workbook(filename, data_only=True)
|
|
329
|
+
|
|
330
|
+
error_details = {err: [] for err in EXCEL_ERRORS}
|
|
331
|
+
total_errors = 0
|
|
332
|
+
|
|
333
|
+
for sheet_name in wb.sheetnames:
|
|
334
|
+
ws = wb[sheet_name]
|
|
335
|
+
for row in ws.iter_rows():
|
|
336
|
+
for cell in row:
|
|
337
|
+
if cell.value is not None and isinstance(cell.value, str):
|
|
338
|
+
for err in EXCEL_ERRORS:
|
|
339
|
+
if err in cell.value:
|
|
340
|
+
error_details[err].append(
|
|
341
|
+
f"{sheet_name}!{cell.coordinate}"
|
|
342
|
+
)
|
|
343
|
+
total_errors += 1
|
|
344
|
+
break
|
|
345
|
+
|
|
346
|
+
wb.close()
|
|
347
|
+
|
|
348
|
+
out = {
|
|
349
|
+
"status": "success" if total_errors == 0 else "errors_found",
|
|
350
|
+
"total_errors": total_errors,
|
|
351
|
+
"error_summary": {},
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
for err_type, locations in error_details.items():
|
|
355
|
+
if locations:
|
|
356
|
+
out["error_summary"][err_type] = {
|
|
357
|
+
"count": len(locations),
|
|
358
|
+
"locations": locations[:20], # 每类最多 20 个位置
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
wb_formulas = load_workbook(filename, data_only=False)
|
|
362
|
+
formula_count = 0
|
|
363
|
+
for sheet_name in wb_formulas.sheetnames:
|
|
364
|
+
ws = wb_formulas[sheet_name]
|
|
365
|
+
for row in ws.iter_rows():
|
|
366
|
+
for cell in row:
|
|
367
|
+
if (cell.value and isinstance(cell.value, str)
|
|
368
|
+
and cell.value.startswith("=")):
|
|
369
|
+
formula_count += 1
|
|
370
|
+
wb_formulas.close()
|
|
371
|
+
|
|
372
|
+
out["total_formulas"] = formula_count
|
|
373
|
+
|
|
374
|
+
return out
|
|
375
|
+
|
|
376
|
+
except Exception as e:
|
|
377
|
+
return {"error": str(e)}
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
# --------------------------------------------------------------------------- #
|
|
381
|
+
# CLI
|
|
382
|
+
# --------------------------------------------------------------------------- #
|
|
383
|
+
|
|
384
|
+
def main():
|
|
385
|
+
parser = argparse.ArgumentParser(
|
|
386
|
+
description="用 LibreOffice 宏重算 xlsx 全部公式,原地保存并扫描 Excel 错误。"
|
|
387
|
+
"输出 JSON 到 stdout。")
|
|
388
|
+
parser.add_argument("file", help="xlsx 文件路径(必须可写,宏 store() 原地覆盖)")
|
|
389
|
+
parser.add_argument("timeout", nargs="?", type=int, default=30,
|
|
390
|
+
help="soffice 超时秒数(默认 30)")
|
|
391
|
+
parser.add_argument("--skip-external-link-check", action="store_true",
|
|
392
|
+
help="跳过外链(externalLinks)前置闸门。"
|
|
393
|
+
"仅在确认无外链依赖或已手动拷出值时使用")
|
|
394
|
+
args = parser.parse_args()
|
|
395
|
+
|
|
396
|
+
result = recalc(args.file, timeout=args.timeout,
|
|
397
|
+
check_external_links=not args.skip_external_link_check)
|
|
398
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
399
|
+
sys.exit(1 if "error" in result else 0)
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
if __name__ == "__main__":
|
|
403
|
+
main()
|
|
@@ -9,6 +9,12 @@ WorkingDirectory=__REPO__
|
|
|
9
9
|
ExecStart=__NODE__ __REPO__/dist/daemon/index.js
|
|
10
10
|
Restart=always
|
|
11
11
|
RestartSec=5
|
|
12
|
+
# The daemon is often the first to run `tmux new-session` after a boot, so the
|
|
13
|
+
# tmux server forks inside this unit's cgroup. The default KillMode=control-group
|
|
14
|
+
# then kills that server — every wizard pane, the `wezard` session, a human's
|
|
15
|
+
# own sessions on the same socket — on each reload / restart / crash. Stop only
|
|
16
|
+
# the node process; panes outlive it by design (the next daemon re-attaches).
|
|
17
|
+
KillMode=process
|
|
12
18
|
StandardOutput=append:__HOME__/.wezard/daemon.stdout.log
|
|
13
19
|
StandardError=append:__HOME__/.wezard/daemon.stderr.log
|
|
14
20
|
Environment=NODE_ENV=production
|