wezard 2.9.0 → 3.0.2
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 +43 -21
- package/README.md +37 -50
- package/cli/wezard.sh +59 -20
- package/config.example.jsonc +5 -8
- package/dist/cli/audit.js +11 -13
- package/dist/cli/audit.js.map +1 -1
- package/dist/cli/codex-hook.js +20 -17
- package/dist/cli/codex-hook.js.map +1 -1
- package/dist/cli/ext.js +271 -0
- package/dist/cli/ext.js.map +1 -0
- package/dist/cli/init.js +44 -13
- 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 +3 -2
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/wx.js +7 -6
- package/dist/cli/wx.js.map +1 -1
- package/dist/daemon/aibot-media.js +28 -20
- package/dist/daemon/aibot-media.js.map +1 -1
- package/dist/daemon/apprentice.js +75 -0
- package/dist/daemon/apprentice.js.map +1 -0
- package/dist/daemon/approval.js +75 -33
- 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-onboarding.js +61 -0
- package/dist/daemon/channel-onboarding.js.map +1 -0
- package/dist/daemon/channel-posts.js +93 -0
- package/dist/daemon/channel-posts.js.map +1 -0
- package/dist/daemon/channel-rebind.js +100 -0
- package/dist/daemon/channel-rebind.js.map +1 -0
- package/dist/daemon/channel-store.js.map +1 -1
- package/dist/daemon/channel.js +273 -409
- 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/claim.js +1 -45
- package/dist/daemon/claim.js.map +1 -1
- package/dist/daemon/classes.js +416 -0
- package/dist/daemon/classes.js.map +1 -0
- package/dist/daemon/config-api.js +6 -30
- package/dist/daemon/config-api.js.map +1 -1
- package/dist/daemon/control-socket.js +93 -0
- package/dist/daemon/control-socket.js.map +1 -0
- package/dist/daemon/danger-scrub.js +315 -0
- package/dist/daemon/danger-scrub.js.map +1 -0
- package/dist/daemon/danger.js +146 -16
- package/dist/daemon/danger.js.map +1 -1
- package/dist/daemon/detail.js +50 -22
- package/dist/daemon/detail.js.map +1 -1
- package/dist/daemon/exec-surface.js +108 -0
- package/dist/daemon/exec-surface.js.map +1 -0
- package/dist/daemon/external.js +595 -0
- package/dist/daemon/external.js.map +1 -0
- package/dist/daemon/handoff.js +51 -50
- package/dist/daemon/handoff.js.map +1 -1
- package/dist/daemon/http.js +119 -31
- 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 +436 -207
- package/dist/daemon/inbound.js.map +1 -1
- package/dist/daemon/index.js +3353 -2760
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/last-response.js +51 -25
- package/dist/daemon/last-response.js.map +1 -1
- package/dist/daemon/legacy-panes.js +67 -0
- package/dist/daemon/legacy-panes.js.map +1 -0
- package/dist/daemon/mcp-http.js.map +1 -1
- package/dist/daemon/me-room.js +137 -0
- package/dist/daemon/me-room.js.map +1 -0
- package/dist/daemon/media.js +14 -0
- package/dist/daemon/media.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 +15 -2
- package/dist/daemon/message-format.js.map +1 -1
- package/dist/daemon/mirror-bridge.js +583 -488
- 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 +5 -6
- package/dist/daemon/notices.js.map +1 -1
- package/dist/daemon/onboarding.js +459 -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 +39 -231
- package/dist/daemon/peers.js.map +1 -1
- package/dist/daemon/plan-http.js +2 -3
- package/dist/daemon/plan-http.js.map +1 -1
- package/dist/daemon/plans.js.map +1 -1
- package/dist/daemon/reach.js +1 -5
- package/dist/daemon/reach.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-bind.js +297 -0
- package/dist/daemon/room-bind.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 +569 -0
- package/dist/daemon/room-hub.js.map +1 -0
- package/dist/daemon/room-overdue.js +160 -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 +175 -0
- package/dist/daemon/room-watchdog.js.map +1 -0
- package/dist/daemon/rooms.js +204 -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/session-scan.js +1 -1
- package/dist/daemon/session-scan.js.map +1 -1
- package/dist/daemon/short-id-log.js +43 -0
- package/dist/daemon/short-id-log.js.map +1 -0
- package/dist/daemon/spawn-tmux.js +60 -45
- package/dist/daemon/spawn-tmux.js.map +1 -1
- package/dist/daemon/steward-guard.js +3 -3
- package/dist/daemon/steward-guard.js.map +1 -1
- package/dist/daemon/steward-model.js +17 -3
- package/dist/daemon/steward-model.js.map +1 -1
- package/dist/daemon/steward-repair.js +171 -0
- package/dist/daemon/steward-repair.js.map +1 -0
- package/dist/daemon/steward.js +171 -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/tool-face.js +31 -0
- package/dist/daemon/tool-face.js.map +1 -0
- package/dist/daemon/turn-opening.js +30 -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-memory.js +4 -10
- package/dist/daemon/wizard-memory.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 +683 -159
- package/dist/daemon/wizard.js.map +1 -1
- package/dist/daemon/ws.js +1 -1
- package/dist/daemon/ws.js.map +1 -1
- package/dist/mcp/output.js +30 -7
- package/dist/mcp/output.js.map +1 -1
- package/dist/mcp/relay.js +152 -0
- package/dist/mcp/relay.js.map +1 -0
- package/dist/mcp/tools.js +318 -265
- 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 +412 -480
- 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/cli-local-status.js +28 -0
- package/dist/shared/cli-local-status.js.map +1 -0
- package/dist/shared/cli-socket.js +14 -0
- package/dist/shared/cli-socket.js.map +1 -0
- package/dist/shared/codex-hooks.js +5 -2
- package/dist/shared/codex-hooks.js.map +1 -1
- package/dist/shared/config.js +90 -66
- package/dist/shared/config.js.map +1 -1
- package/dist/shared/daemon-addr.js +23 -0
- package/dist/shared/daemon-addr.js.map +1 -0
- package/dist/shared/daemon-client.js +41 -0
- package/dist/shared/daemon-client.js.map +1 -0
- package/dist/shared/daemon-token.js +2 -2
- package/dist/shared/daemon-token.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/external.js +402 -0
- package/dist/shared/external.js.map +1 -0
- package/dist/shared/group-members.js +35 -0
- package/dist/shared/group-members.js.map +1 -0
- package/dist/shared/inject-view.js +143 -0
- package/dist/shared/inject-view.js.map +1 -0
- package/dist/shared/instance-id.js +21 -0
- package/dist/shared/instance-id.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 +11 -3
- package/dist/shared/message-footer.js.map +1 -1
- package/dist/shared/model-tiers.js +39 -1
- package/dist/shared/model-tiers.js.map +1 -1
- package/dist/shared/ports.js +56 -0
- package/dist/shared/ports.js.map +1 -0
- package/dist/shared/reminder.js +30 -38
- package/dist/shared/reminder.js.map +1 -1
- package/dist/shared/role-render.js +210 -210
- package/dist/shared/role-render.js.map +1 -1
- package/dist/shared/role-view.js +65 -300
- 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 +153 -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 +275 -0
- package/dist/shared/room-view.js.map +1 -0
- package/dist/shared/room.js +827 -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 +82 -84
- package/dist/shared/session-label.js.map +1 -1
- package/dist/shared/session-mcp.js +36 -40
- 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 +24 -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 +114 -16
- package/dist/svr/index.js.map +1 -1
- package/hooks/pre-tool-use.sh +14 -10
- package/hooks/stop.sh +28 -0
- package/launchd/com.wezard.svr.plist.template +2 -0
- package/package.json +9 -2
- package/scripts/install.sh +23 -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-svr.service.template +2 -0
- package/systemd/wezard.service.template +6 -0
- package/web/chat.css +70 -273
- package/web/chat.js +2269 -2190
- package/dist/daemon/bot-mux.js +0 -161
- package/dist/daemon/bot-mux.js.map +0 -1
- package/dist/daemon/chat-log.js +0 -130
- package/dist/daemon/chat-log.js.map +0 -1
- package/dist/daemon/dispatch.js +0 -6
- package/dist/daemon/dispatch.js.map +0 -1
- package/dist/daemon/idle-nudge.js +0 -90
- package/dist/daemon/idle-nudge.js.map +0 -1
- package/dist/daemon/message-events.js +0 -1155
- package/dist/daemon/message-events.js.map +0 -1
- package/dist/daemon/pending-items.js +0 -160
- package/dist/daemon/pending-items.js.map +0 -1
- package/dist/daemon/router.js +0 -742
- package/dist/daemon/router.js.map +0 -1
- package/dist/daemon/tips.js +0 -25
- package/dist/daemon/tips.js.map +0 -1
- package/dist/daemon/wedoc.js +0 -210
- package/dist/daemon/wedoc.js.map +0 -1
- package/dist/shared/role-search.js +0 -100
- package/dist/shared/role-search.js.map +0 -1
- package/dist/shared/startup-notice.js +0 -21
- package/dist/shared/startup-notice.js.map +0 -1
- package/dist/shared/turn-state.js +0 -27
- package/dist/shared/turn-state.js.map +0 -1
package/dist/mcp/tools.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
// MCP server `wezard`: the tool surface, as a factory.
|
|
2
2
|
//
|
|
3
3
|
// `createWezardServer()` builds one McpServer with every tool registered; each tool
|
|
4
|
-
// just POSTs to the resident daemon over
|
|
5
|
-
// Two
|
|
6
|
-
// - stdio — mcp/server.ts, the per-pane child
|
|
7
|
-
//
|
|
4
|
+
// just POSTs to the resident daemon over its unix socket — nothing here holds WeCom state.
|
|
5
|
+
// Two hosts mount the same surface:
|
|
6
|
+
// - stdio — mcp/server.ts, the full per-pane child (`daemon.mcpTransport:"stdio"`; dist path
|
|
7
|
+
// is load-bearing);
|
|
8
|
+
// - daemon/mcp-http.ts — the daemon's own stateless StreamableHTTP endpoint on the socket,
|
|
9
|
+
// which mcp/relay.ts (the default, node-builtins-only per-pane child) forwards to.
|
|
8
10
|
// The caller's identity arrives differently on each (env for stdio, a request header for
|
|
9
|
-
//
|
|
11
|
+
// the daemon endpoint), so it lives in `mcpIdentity` and `selfRef()` reads it there.
|
|
10
12
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
11
13
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
12
14
|
import { z } from "zod";
|
|
15
|
+
import { daemonRequest } from "../shared/daemon-client.js";
|
|
13
16
|
import { DAEMON_TOKEN_HEADER, readDaemonToken } from "../shared/daemon-token.js";
|
|
14
17
|
import { EFFORTS } from "../shared/effort.js";
|
|
15
18
|
import { TIERS } from "../shared/config.js";
|
|
16
19
|
import { PlanInputSchema, PlanUpdateSchema } from "../shared/plan.js";
|
|
17
20
|
import { present, recovery } from "./output.js";
|
|
18
|
-
// daemon
|
|
19
|
-
|
|
21
|
+
// daemon 内回打自己与 pane 里的 stdio 走同一条路径: resolveSelf 复用, 不改。
|
|
22
|
+
// 地址是 unix socket (env WEZARD_DAEMON_SOCK, daemon 启动时自己设), 每次调用现读。
|
|
20
23
|
const ok = (data) => ({
|
|
21
24
|
content: [{ type: "text", text: JSON.stringify(data) }],
|
|
22
25
|
});
|
|
@@ -24,6 +27,14 @@ const fail = (msg) => ({
|
|
|
24
27
|
isError: true,
|
|
25
28
|
content: [{ type: "text", text: msg }],
|
|
26
29
|
});
|
|
30
|
+
// 回包形状的常驻提醒。MCP 的 text 结果在 CodeBuddy 的 REPL/PTC 里是一段**字符串**,
|
|
31
|
+
// 而模型常把它当对象读 (d.name / d.id) —— 读到的是 undefined, 于是写出
|
|
32
|
+
// 「已经交给 .undefined」「after:["undefined"]」。失败回包 (isError) 反而是 {error},
|
|
33
|
+
// 更让人以为成功也是一个对象; 所以每个会被转述名字的派活工具都要写明这一句。
|
|
34
|
+
const RESULT_IS_JSON_TEXT = "回包是一段 JSON **文本** (不是对象): 在 REPL / PTC 里先 JSON.parse 再读字段; 直接对回包读 .name / .id 得到的是 undefined。";
|
|
35
|
+
// 派活回包自带一句可直接复述的人话 (`said`, 见 mcp/output.ts): 模型取字段失败时也别自己拼名字 ——
|
|
36
|
+
// 原样抄这句话, 群里就不会出现「已经交给 .undefined」。
|
|
37
|
+
const DISPATCH_SAID_DOC = "回包的 `said` 是可直接复述的一句人话 (如「已交给 .TessDavis」; 名字还没落定时是「已交给一个刚起的执行者 (名字稍后出现在名册里)」) —— 对人转述派活结果就**原样复制 `said`**, 别自己拼 `.` + 名字。";
|
|
27
38
|
const currentAddressSchema = (shape) => z.object(shape).strict();
|
|
28
39
|
// Accept user-friendly prefixes from the LLM: vid:<id> → user:<id>, chatid:<id> → chat:<id>.
|
|
29
40
|
// Pass anything else (already user:/chat:/group:, or empty) through unchanged.
|
|
@@ -59,21 +70,18 @@ const selfRef = () => {
|
|
|
59
70
|
const tmuxPane = process.env.TMUX_PANE?.trim();
|
|
60
71
|
return { ...(sessionId ? { sessionId } : {}), ...(tmuxPane ? { tmuxPane } : {}) };
|
|
61
72
|
};
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
};
|
|
71
|
-
const daemonGet = async (path) =>
|
|
72
|
-
const resp = await fetch(`${DAEMON_BASE}${path}`);
|
|
73
|
-
return { j: (await resp.json().catch(() => ({}))), status: resp.status };
|
|
74
|
-
};
|
|
73
|
+
const asReply = (r) => ({
|
|
74
|
+
j: (r.json && typeof r.json === "object" ? r.json : {}),
|
|
75
|
+
status: r.status,
|
|
76
|
+
});
|
|
77
|
+
const daemonPost = async (path, body) => asReply(await daemonRequest("POST", path, {
|
|
78
|
+
// 口令每次现读: daemon 可能在本进程起来之后才生成它。
|
|
79
|
+
headers: { [DAEMON_TOKEN_HEADER]: readDaemonToken() },
|
|
80
|
+
body: { ...selfRef(), ...body },
|
|
81
|
+
}));
|
|
82
|
+
const daemonGet = async (path) => asReply(await daemonRequest("GET", path));
|
|
75
83
|
// Routes answer with either `reason` or `error`; `pick` narrows a payload that
|
|
76
|
-
// is nested rather than spread at the top level
|
|
84
|
+
// is nested rather than spread at the top level.
|
|
77
85
|
const unwrap = (name, { j, status }, pick, input) => j.ok ? ok(present(name, pick ? pick(j) : j, input)) : fail(`${name} failed: ${(j.reason ?? j.error ?? `http ${status}`)}${Object.keys(recovery(j)).length ? `\n${JSON.stringify(recovery(j))}` : ""}`);
|
|
78
86
|
// 读侧工具 (名册 / 对话 / 聊天记录) 的回执是守护进程排好的**文本**, 原样交出去:
|
|
79
87
|
// 这些东西是给模型读的, 包一层 json 只是让它为字段名和转义的换行多付 token。
|
|
@@ -83,92 +91,49 @@ const unwrapCandidates = (r) => r.j.ok && typeof r.j.text === "string"
|
|
|
83
91
|
: unwrap("route_candidates", r);
|
|
84
92
|
// 地址语法只有一套, 每个吃地址的工具都把它原样重述一遍: 模型单看一个 schema
|
|
85
93
|
// 时没有别的地方能学到它, 而猜出来的地址会安静地指向另一个 wizard 的终端。
|
|
86
|
-
const ADDRESS_DOC = "wizard 的名字 —— 全机唯一, 它就是地址: `'fix'`
|
|
94
|
+
const ADDRESS_DOC = "wizard 的名字 —— 全机唯一, 它就是地址: 写裸名 `'fix'` 即可 (人面前的气泡头显示 `🧙 fix`; wizard 之间与 rolepage 都显示裸名; 带 `'.fix'` / `'🧙 fix'` 前缀也认), 不分它住在哪个群。`''` = 你这个聊天的默认 wizard。永远别自己拼 key: wizard_roster / spawn_wizard / clone_wizard 返回的名字 (或 409 里的 `address`) 原样传回来。";
|
|
87
95
|
// 生 wizard 的三个工具共用: 模型名是口语, 落地的是 `/model` 列表里最接近的那一项。
|
|
88
96
|
const MODEL_DOC = "跑在哪个模型上, 最好写确切的 id ('claude-opus-5.5' / 'deepseek-v4.1-flash')。原样带 `--model` 启动; CLI 不认 (口语名 'opus' / '最新的 opus' 也算) 就不带它重起一次, 再从它 `/model` 列表里挑最接近的一项 —— 多花一次启动, 不丢 wizard。落地的见返回的 `model`, 走了兜底或对不上时带 `modelWarning` (仍在跑, 对不上则停在默认模型)。省略 = 该 CLI 默认。之后换用 set_model。";
|
|
89
97
|
const EFFORT_DOC = "推理档位, 启动时就带上 (`--effort`), 之后它每次重启都沿用。判断密集的活给 high 以上, 跑腿的给 low。省略 = 该 CLI 默认 (克隆则跟被克隆者同档)。之后换用 set_model 的 `effort`。";
|
|
90
|
-
// ──
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
.describe("对方**正忙**时怎么投 (它闲着三者一样, 立刻投)。`normal` (默认) 等它这一轮结束再投 —— 派新活用它, 否则你和别人的两段话会挤进同一个输入框被当成一轮读掉; 等的是你这次调用 (最多 `waitSec`)。`urgent` 先打断它这一轮 (同 stop_wizard 的 interrupt) 再投 —— 只给真紧急的改道, 它手上那一轮作废; 那一轮若是别的 wizard 派的活, 不打断, 降成 normal (回包 `urgentDowngraded`)。`now` 不等不打断, 落进它的输入框并进当前这一轮 —— 插话、补一句、答它的问。带 `re` 续问时默认 `now`。返回里 `wasBusy` / `interrupted` / `waitedMs` 说明实际怎么投的。"),
|
|
106
|
-
waitSec: z.number().optional().describe("`normal` 等它闲下来最多等多少秒 (10-3600, 默认 600)。等不到就返回失败, 不会强行投。"),
|
|
107
|
-
planId: z.string().optional().describe("这次派活归属的 plan id。仅关联 event 供 owner 的闲时提醒判断,不会自动推进 plan。补充同一 event 时沿用原关联。"),
|
|
108
|
-
public: z
|
|
109
|
-
.boolean()
|
|
110
|
-
.optional()
|
|
111
|
-
.describe("true = 在公开频道 (你这一轮所在的群) 里说: 群里出 `.你: .它` 气泡, 它的回复也进群 (同时照样回执给你)。默认 false = 私聊, 只记在 rolepage。需要人知道 / 该当着人讨论才用 true。"),
|
|
112
|
-
return: z.enum(["self", "transfer", "detach", "none"]).optional().describe(RETURN_DOC),
|
|
113
|
-
for: z.string().optional().describe(FOR_DOC),
|
|
114
|
-
kind: z
|
|
115
|
-
.enum(["task", "ask", "fyi"])
|
|
116
|
-
.optional()
|
|
117
|
-
.describe("对方该怎么接这句话 (与 `priority` 的何时投、`return` 的要不要回执正交): `task` (默认) 一件活, 同一发送者与接收者的未完成任务会合并补充; `ask` 提一个问题, 可用于正常反问/追问; `fyi` 知会, 不用回。"),
|
|
118
|
-
re: z.union([z.boolean(), z.string()]).optional().describe("续问参数。重复派活会自动补充同一接收者的未完成任务, 不需要 `re`。`true` 可把内容追加到明确指定的原件; 有多个相关路由时以 event id 指明。"),
|
|
119
|
-
force: z
|
|
120
|
-
.boolean()
|
|
121
|
-
.optional()
|
|
122
|
-
.describe("派新活给一个缓存已冷、ctx ≥100k 的 wizard 时, 守护进程先退回一行代价说明不投递 (唤醒 ≈ 白板 spawn 的几倍)。确认这件活真依赖它那段上下文, 才带 `force:true` 重发; 否则白板 spawn。续问 (`re`)、`now`、`ask` / `fyi` 不受此限。"),
|
|
123
|
-
after: z
|
|
124
|
-
.array(z.string())
|
|
125
|
-
.optional()
|
|
126
|
-
.describe("receiver 欠账依赖: wizard 名字数组 (= 你派给它的那一笔: 在飞的优先, 否则最近落定的; 并发两笔才需写 event id), 都得是你自己派出去的件 (查不到 → 400)。全部回执为 done 就立即投; 有失败前置 → 409; 还有未落定前置就持久停放, 前置都 done 后由 daemon 投递并把前置结论附在信封上。只用于新 task、不带 re;独立于 plans DAG。"),
|
|
127
|
-
};
|
|
128
|
-
const TELL_DESC = "跟另一个 wizard 说话 —— 文本原样落进它的输入框, 它当成新的一轮接手 (派活、答它的问题、叫它继续都走这里)。目标不存在就先 spawn_wizard / clone_wizard。独立新活先按目标与难度 delegate; re / now 仅用于当前任务的补充证据、纠正或答问, 不把无关小活追加给正在处理复杂任务的 lead, 也不要用 ask 包装需要另行检查的新任务。\n" +
|
|
129
|
-
"返回实际队列状态、事件标识及异常信息,不重复固定回执提示。对方用 `@.你的名字 RESULT:` 提交结果后, 结果持久化为回执;同批结果收齐再合并送到你这里, 你正忙时排队。等待回执不阻止你接收其他消息。对方长任务每阶段可用 `PROGRESS:` 报一行进展 (任务不因此落定)。\n" +
|
|
130
|
-
"默认私聊, 只记在双方 rolepage; 守护进程给 `text` 挂信封 (发话人、私聊/公开、终句收口约定)。拒绝对自己发送。\n" +
|
|
131
|
-
"**协作方向**: wizard 的直属 parent 代表管理归属;横向沟通不改变家谱。反问用 `kind:\"ask\"`,知会用 `kind:\"fyi\"`,派新工作用默认 `task`。`fyi` 永远放行。";
|
|
132
|
-
const tellBody = (a) => ({
|
|
133
|
-
name: a.name,
|
|
134
|
-
...(a.text !== undefined ? { text: a.text } : {}),
|
|
135
|
-
...(a.taskFile !== undefined ? { taskFile: a.taskFile } : {}),
|
|
136
|
-
...(a.params !== undefined ? { params: a.params } : {}),
|
|
137
|
-
...(a.return ? { return: a.return } : {}),
|
|
138
|
-
...(a.for ? { for: a.for } : {}),
|
|
139
|
-
...(a.kind ? { kind: a.kind } : {}),
|
|
140
|
-
...(a.priority ? { priority: a.priority } : {}),
|
|
141
|
-
...(a.waitSec ? { waitSec: a.waitSec } : {}),
|
|
142
|
-
...(a.planId ? { planId: a.planId } : {}),
|
|
143
|
-
...(a.public ? { public: true } : {}),
|
|
144
|
-
...(a.re !== undefined ? { re: a.re } : {}),
|
|
145
|
-
...(a.after?.length ? { after: a.after } : {}),
|
|
146
|
-
// 显式传布尔值, 让 daemon 只在调用方明确请求时越过冷缓存门控。
|
|
147
|
-
force: a.force === true,
|
|
148
|
-
});
|
|
98
|
+
// ── room: 唯一的沟通对象 ────────────────────────────────────────────────────
|
|
99
|
+
// 一个 room 一份账本 (shared/room.ts), 人和 wizard 走同一个 append 口子。这些工具只负责
|
|
100
|
+
// 把参数变成一次 HTTP 调用 —— 发言权、status 写入权、覆盖检查、唤醒预算都在 daemon 侧。
|
|
101
|
+
// 三条不会变的事实: 完成只认 chat_reply 的 status; 终句没有任何路由语义 (只进 turn store
|
|
102
|
+
// 与 rolepage); 被唤醒的 duty 只能用 chat_reply 交代。
|
|
103
|
+
const HISTORY_DOC = '被拉者入座后第一次被唤醒时能读到的旧话范围: "none" 只看之后的 | 正整数 N 最近 N 条 | "from:<msgId>" 从那条起 | "all" 全部 (缺省)。仍受 ~6000 字未读预算截断; 更早的随时 room_read。';
|
|
104
|
+
const historyArg = () => z.union([z.literal("none"), z.literal("all"), z.number().int().min(1), z.string().regex(/^from:.+/)]).optional().describe(HISTORY_DOC);
|
|
105
|
+
const ROOM_DOC = "room: 绑定了企微传输的群 / 单聊 / topic 帖写 base principal 原样 (`chat:…` / `user:…`) 或聊天名; " +
|
|
106
|
+
"`dm:…` 是你和某个 wizard 的两人 room, `adhoc:…` 是 room_open 开的临时 room。缺省 = 唤醒你这一轮的那条消息所在的 room; " +
|
|
107
|
+
"本轮由多个 room 一起唤醒时必须显式给 (否则 400)。绑定 room 里每条消息都真的进企微, dm / adhoc 只在 rolepage。";
|
|
108
|
+
const TO_DOC = "点名的 wizard (裸名, 带 `.` 也认); chat_ask 还可点名本 room 的人 (`human:<userid>`, room_members 里能看到)。只认本 room 的成员 —— chat_say 的 `to` 只是指出对谁说, 不唤醒、不开 duty; chat_ask 的每个 `to` 各开一条 duty (人名下的那条由人的下一句话关账, 并唤醒你)。";
|
|
109
|
+
const INTERRUPT_DOC = "true = 先 Esc 打断对方当前这一轮再投本条 (不拆 pane)。限权: 只有对方的直属 parent、本 room 的 host、或人能用, 其余 403; 计入本 room 的回合预算 (10 分钟 20 次), 超了 409。被打断那一轮的 duty 不关 —— 它下次被唤醒时按游标重投, 只是那一轮白付。";
|
|
110
|
+
const FOR_DOC = "你在为哪条**你持有的** duty 派这件活: 写那条 duty 的消息 id (不是你自己问出去的件, 不是线程回指)。只作血缘记录, 不参与关账 (完成只认 status); 它让子件的动静算作这条 duty 的活动、并让提醒先落在子件上。缺省 = 本轮唤醒你的那一条 (子件 reply 唤醒你时是它所属的那一条), 通常不用给; 写了不是你持有的开着的 duty 会被忽略并在回包 forNote 里说明。";
|
|
111
|
+
const STATUS_DOC = "done = 做完了 · passed = 无需答复 · canceled = 不做了 (这三者关账) · need = 反问, 等提问方补信息 (提问方是人时, 在人名下开一条 duty, 人回话会叫醒你) · progress = 中间进展 (后两者不关账)。";
|
|
112
|
+
const ASK_KIND_DOC = "`ask` (默认) 一个问题, `task` 一件活 —— 两者都开 duty, 区别只写在行上给读的人看。";
|
|
149
113
|
// 交接只有一个动词: 不点名 = 交接你自己 (你写简报), 点名 = 替别人交接 (守护进程让它写)。
|
|
150
114
|
const handoffSelf = (tool, brief) => daemonPost("/wizard/handoff-self", { brief }).then((r) => unwrap(tool, r));
|
|
151
|
-
const DELEGATE_DESC = "派活一步到位: 给 task 或 taskFile+params
|
|
115
|
+
const DELEGATE_DESC = "派活一步到位: 给 task 或 taskFile+params。产出是一条 chat_ask —— 选中的 wizard 收到一条 duty, 只能用 chat_reply 交代, 没有别的回执通道; 返回实际决定、目标、room 与档位, dryRun 只返回决定与简短理由。lead 只在复杂任务使用。planId 只记录 event 与 plan 的关联,daemon 不会代替 owner 推进 DAG。\n" +
|
|
152
116
|
"先按验收目标分清独立新活和原任务续篇。独立新活另派不等于强制新生, 允许复用近期实际材料相关、空闲且无职责占用的非 lead; 按本次难度派, 不因同项目、公共 AGENTS.md/CLAUDE.md 或词面重叠塞给已有 lead。自动复用要求实质上下文证据、无 lead/任务占用、成本合适; 其余白板 spawn。难度看所需判断而非句长: 指明函数、接口、文件、按钮等具体对象且范围清楚的低风险 coding 默认 light; 其他常规任务默认 standard; 只有复杂方案判断、疑难升级或安全/并发/架构等高风险审查才显式 hard。\n" +
|
|
153
|
-
"
|
|
117
|
+
"task 不复述提问者所在 room 里人已经说过的话: 接活者就在那个 room、人的原话它看得到时, 只写人话里没有的补充 (目标 / 验收标准 / 指哪条消息 id); 只有它看不到那条话 (dm / adhoc, 或新生不在那个 room) 才带原话。\n" +
|
|
118
|
+
"你不同意就**显式推翻**: `to` 用于人明确指定或已确认必需的上下文连续性, `spawn:true` 硬要新的, `force:true` 只越过缓存成本门控, 不放宽自动复用的相关性。复杂任务用 `lead:true`: lead 建 plan,按阶段创建执行者并验收;简单任务直接派活、不建 plan。回包里的 `name` 是落定的执行者名字。\n" +
|
|
119
|
+
DISPATCH_SAID_DOC + RESULT_IS_JSON_TEXT;
|
|
154
120
|
const DELEGATE_SCHEMA = {
|
|
155
121
|
// task 与 taskFile 二选一 (§8): 不存在「task 作摘要」的用法 —— 旧 daemon 会把
|
|
156
122
|
// task 当正文投出去, 摘要进 pane 就等于静默丢卡。选人/选档/description 由
|
|
157
123
|
// daemon 用展开文本或 params.header 派生 (阶段 2)。
|
|
158
|
-
task: z.string().optional().describe("这件活的正文, 与 `taskFile` 二选一。给了 `taskFile` 就别再给 task —— 守护进程用展开后的全文派生选人与默认 description。写清目标与交付, 带文件名 /
|
|
124
|
+
task: z.string().optional().describe("这件活的正文, 与 `taskFile` 二选一。给了 `taskFile` 就别再给 task —— 守护进程用展开后的全文派生选人与默认 description。写清目标与交付, 带文件名 / 模块名帮助找上下文。接活者就在提问者所在的 room、人的原话它看得到时, 别复述原话 —— 只写补充与验收标准, 要指就写那条消息 id。公共规则文件或同目录不构成复用理由; 不要把独立核查改写成原 lead 的附加交付。"),
|
|
159
125
|
taskFile: z.string().optional().describe("模板文件路径, **相对你的工作区**的相对路径 (绝对路径与 `~` 开头一律 400)。给了它, 投递正文由 daemon 用模板 + `params` 展开; 与 `task` 至少给一个。"),
|
|
160
126
|
params: z.record(z.string()).optional().describe("`taskFile` 模板里 `{{name}}` 占位符的参数值 (全为字符串)。缺参数 / 多余参数都会被 400 拒绝。"),
|
|
161
|
-
return: z.enum(["self", "transfer", "detach", "none"]).optional().describe(RETURN_DOC + " delegate 不能配 lead:true 用 transfer。"),
|
|
162
127
|
for: z.string().optional().describe(FOR_DOC),
|
|
163
128
|
name: z.string().optional().describe("可选的新 wizard 短名, 不是已有执行者的地址 (指定已有执行者用 to)。推荐省略或空白,新建时由 daemon 分配全机唯一中性英文名,职责另存; 复用时忽略。"),
|
|
164
129
|
description: z.string().optional().describe("可选的新 wizard 职责, 一句话。省略或空白 = 取 task 摘要; 复用时忽略。"),
|
|
165
130
|
tier: z.enum(TIERS).optional().describe("本次任务难度及 spawn 档位 (mini / light / standard / hard / ultra)。明确代码对象且范围清楚的低风险 coding 默认 light; 其他常规任务默认 standard; lead 默认 hard。只有复杂方案判断、疑难升级或安全/并发/架构等高风险审查才 hard / ultra。显式 tier 覆盖默认, 按所需判断而非句长选。复用已有 wizard 不会切换它的模型。"),
|
|
166
|
-
to: z.string().optional().describe("显式选定已有 wizard (名字), 绕过自动选人。仅在人明确指定执行者或必需上下文已确认时使用; 不能仅因同项目或已有 lead 在场。原任务续篇用
|
|
131
|
+
to: z.string().optional().describe("显式选定已有 wizard (名字), 绕过自动选人。仅在人明确指定执行者或必需上下文已确认时使用; 不能仅因同项目或已有 lead 在场。原任务续篇用 chat_ask 指回原活。"),
|
|
167
132
|
spawn: z.boolean().optional().describe("推翻默认: 不看候选, 一定白板 spawn。"),
|
|
168
133
|
force: z.boolean().optional().describe("越过冷门控: 缓存冷且 ctx ≥100k 的候选默认不转; 确认这件活真依赖它那段上下文才给 true。"),
|
|
169
|
-
lead: z.boolean().optional().describe("复杂任务由 lead 统筹并逐阶段维护 plan;简单任务不要建 plan
|
|
134
|
+
lead: z.boolean().optional().describe("复杂任务由 lead 统筹并逐阶段维护 plan;简单任务不要建 plan。产出是一条 chat_ask —— 结果由你在它交代后自己收口。"),
|
|
170
135
|
planId: z.string().optional().describe("这次派活归属的 plan id。仅关联event供owner的闲时提醒判断,不会自动推进plan;补充同一event时沿用关联。"),
|
|
171
|
-
|
|
136
|
+
room: z.string().optional().describe(ROOM_DOC + " 给了就把这条 chat_ask 落在这个 room (选中的子 wizard 以 spawn 免审入群; 你须是该 room 成员)。"),
|
|
172
137
|
dryRun: z.boolean().optional().describe("只要默认决定与理由, 不执行。"),
|
|
173
138
|
};
|
|
174
139
|
const runDelegate = async (tool, a) => {
|
|
@@ -182,7 +147,7 @@ const runDelegate = async (tool, a) => {
|
|
|
182
147
|
const offspringShape = {
|
|
183
148
|
description: z.string().describe("它负责什么, 一句话。它会写进它的系统提示, 也会出现在名册里让别人看到。"),
|
|
184
149
|
name: z.string().optional().describe("它的名字 (如 'docs'、'fix', 带不带 '.' 都行)。全机唯一。推荐省略,由 daemon 分配中性英文名,职责另存。"),
|
|
185
|
-
task: z.string().optional().describe("
|
|
150
|
+
task: z.string().optional().describe("就位后立刻开一条 duty 派下去 (等同一次 chat_ask)。省略则它就位待命。"),
|
|
186
151
|
// 出生投递 (bearAs 内直接 acceptPeerDispatch) 不经 tell 的模板展开入口 —— 第一期
|
|
187
152
|
// 不接 taskFile。声明出来是为了显式报错: 没声明的字段会被 zod 静默剥掉, 调用方
|
|
188
153
|
// 会以为模板生效了而实际投出去的是空/残正文。
|
|
@@ -193,8 +158,8 @@ const offspringShape = {
|
|
|
193
158
|
model: z.string().optional().describe(MODEL_DOC),
|
|
194
159
|
effort: z.enum(EFFORTS).optional().describe(EFFORT_DOC),
|
|
195
160
|
planId: z.string().optional().describe("若task属于现有plan,指定plan id以关联派活event;plan仍由owner显式更新。"),
|
|
196
|
-
|
|
197
|
-
|
|
161
|
+
for: z.string().optional().describe(FOR_DOC),
|
|
162
|
+
room: z.string().optional().describe(ROOM_DOC + " 给了就让它在那个 room 里入座 (via spawn, 免审) 并把这件活落在那儿 (你须是该 room 成员; 认不出 / 不是成员在生之前就拒, 派活失败回包 dispatched:false + dispatchError); 省略 = 你的 room。"),
|
|
198
163
|
};
|
|
199
164
|
const bear = (tool, inherit) => async (a) => {
|
|
200
165
|
// 见 offspringShape 的 taskFile 注释: 出生投递没有模板展开这一站。
|
|
@@ -209,15 +174,15 @@ const bear = (tool, inherit) => async (a) => {
|
|
|
209
174
|
...(a.planId ? { planId: a.planId } : {}),
|
|
210
175
|
...(a.cwd ? { cwd: a.cwd } : {}),
|
|
211
176
|
...(a.chat ? { chat: a.chat } : {}),
|
|
177
|
+
...(a.room ? { room: a.room } : {}),
|
|
212
178
|
...(a.model ? { model: a.model } : {}),
|
|
213
179
|
...(a.effort ? { effort: a.effort } : {}),
|
|
214
180
|
...(a.tier ? { tier: a.tier } : {}),
|
|
215
|
-
...(a.return ? { return: a.return } : {}),
|
|
216
181
|
...(a.for ? { for: a.for } : {}),
|
|
217
182
|
...(a.lead ? { lead: true } : {}),
|
|
218
183
|
}));
|
|
219
184
|
};
|
|
220
|
-
const OFFSPRING_TAIL = "名字全局唯一: 撞上的 wizard 静默超过一天就直接顶掉它、名字归新的; 撞上一个还在的 wizard 返回 409, 附 `alive` / `busy` / `idleForMs` —— 据此分辨它是真在干活 (换个名字) 还是冷绑定 (先 stop_wizard 再同名重生); 返回里的 `name` 是落定的名字。 它自己也能再生分身, 层级不限; 名下同时活着的有上限。";
|
|
185
|
+
const OFFSPRING_TAIL = "名字全局唯一: 撞上的 wizard 静默超过一天就直接顶掉它、名字归新的; 撞上一个还在的 wizard 返回 409, 附 `alive` / `busy` / `idleForMs` —— 据此分辨它是真在干活 (换个名字) 还是冷绑定 (先 stop_wizard 再同名重生); 返回里的 `name` 是落定的名字。 它自己也能再生分身, 层级不限; 名下同时活着的有上限。" + " " + DISPATCH_SAID_DOC + RESULT_IS_JSON_TEXT;
|
|
221
186
|
// Every call builds a fresh server: the SDK binds one server to one transport (and
|
|
222
187
|
// JSON-RPC ids are per-connection), so a daemon-side http endpoint that serves many
|
|
223
188
|
// clients must not share a registry across them.
|
|
@@ -225,32 +190,25 @@ export const createWezardServer = () => {
|
|
|
225
190
|
const server = new McpServer({ name: "wezard", version: "0.0.1" }, { capabilities: { tools: {} } });
|
|
226
191
|
// 人侧 / 罕用的工具 (30 天零调用: 本机会话清单与改接、聊天目录) 不进默认
|
|
227
192
|
// 工具面 —— 每个注册的工具都占模型的上下文, 而这些要么人在 IM 里有对应命令 (`/sessions`
|
|
228
|
-
// `/chats`), 要么由
|
|
193
|
+
// `/chats`), 要么由 chat_ask / room_read 覆盖。路由都还在; `WEZARD_MCP_EXTRA=1` 把它们挂回来。
|
|
229
194
|
const registerRare = process.env.WEZARD_MCP_EXTRA === "1" ? server.registerTool.bind(server) : (() => undefined);
|
|
230
|
-
//
|
|
195
|
+
// v3 §2: 工作区是身份属性 —— set_workspace 只记录 (pendingCwd), 此后新开的会话/化身
|
|
196
|
+
// 在该目录启动; 不再驱动 handoff, 也不再有 keep 问句那一支。
|
|
231
197
|
server.registerTool("set_workspace", {
|
|
232
|
-
title: "
|
|
233
|
-
description: "设置这个 wizard
|
|
234
|
-
+ "**`keep:true` 是另一支**: 人回答「不用换, 就用现在这个目录」时调它 —— 不重开会话, 只把「这个工作区是人认过的」记下来, 此后新会话的开局不再问这件事。一个新聊天的第一个 wizard 落在默认兜底目录里, 开局会被要求先问一句要去哪个项目; 人给路径就走 `cwd`, 人说不用换就走 `keep`。",
|
|
198
|
+
title: "Set workspace directory for this identity",
|
|
199
|
+
description: "设置这个 wizard 身份的工作区 (绝对路径或 ~ 开头), **此后新开的会话/化身都在这个目录启动** (由人决定何时重开; 没有活 pane 时立即在新目录起一个)。活 CLI 进程不原地切 cwd, 当前会话不受影响、不需要 handoff; 要换目录就等下一次 /new 或 respawn。",
|
|
235
200
|
inputSchema: {
|
|
236
|
-
cwd: z.string().
|
|
237
|
-
keep: z
|
|
238
|
-
.boolean()
|
|
239
|
-
.optional()
|
|
240
|
-
.describe("人回答了「不用换, 就用现在这个目录」时传 `true` (不要传 cwd)。只记一笔确认 —— 不重开会话、不动上下文, 此后再没人问这件事。"),
|
|
201
|
+
cwd: z.string().describe("Absolute project path, e.g. /Users/foo/projects/bar. ~ is expanded."),
|
|
241
202
|
target: z
|
|
242
203
|
.string()
|
|
243
204
|
.optional()
|
|
244
205
|
.describe('Optional target override. "vid:<userid>" / "chatid:<chatid>" / raw "user:<id>"/"chat:<id>". Empty → derive from the calling session.'),
|
|
245
206
|
},
|
|
246
|
-
}, async ({ cwd,
|
|
247
|
-
if (!cwd && !keep)
|
|
248
|
-
return fail("set_workspace 要么给 cwd (换到那个目录), 要么给 keep:true (确认沿用当前目录)");
|
|
207
|
+
}, async ({ cwd, target }) => {
|
|
249
208
|
const { sessionId, tmuxPane } = selfRef();
|
|
250
209
|
const normalizedTarget = normalizeTarget(target);
|
|
251
210
|
const { j } = await daemonPost("/mirror/workspace", {
|
|
252
|
-
|
|
253
|
-
...(keep ? { keep: true } : {}),
|
|
211
|
+
cwd,
|
|
254
212
|
...(normalizedTarget ? { target: normalizedTarget } : {}),
|
|
255
213
|
...(sessionId ? { sessionId } : {}),
|
|
256
214
|
...(tmuxPane ? { tmuxPane } : {}),
|
|
@@ -260,68 +218,15 @@ export const createWezardServer = () => {
|
|
|
260
218
|
ok: false,
|
|
261
219
|
tool: "set_workspace",
|
|
262
220
|
reason: j.reason ?? "unknown",
|
|
263
|
-
...(j.pendingCwd ? {
|
|
264
|
-
pendingCwd: j.pendingCwd,
|
|
265
|
-
workspaceStatus: "queued_not_applied",
|
|
266
|
-
nextStep: "新 CLI 未能启动,工作区尚未应用;pendingCwd 仍保留。确认启动条件恢复后重试 set_workspace,之后在活会话中收尾当前任务并调用自身 handoff({brief})。",
|
|
267
|
-
} : {}),
|
|
221
|
+
...(j.pendingCwd ? { pendingCwd: j.pendingCwd } : {}),
|
|
268
222
|
}));
|
|
269
223
|
return ok({
|
|
270
224
|
ok: true,
|
|
271
225
|
target: j.target,
|
|
272
226
|
sessionId: j.sessionId,
|
|
273
227
|
cwd: j.cwd,
|
|
274
|
-
...(j.pendingCwd ? { pendingCwd: j.pendingCwd } : {}),
|
|
275
|
-
...(j.handoffRequired ? {
|
|
276
|
-
handoffRequired: true,
|
|
277
|
-
workspaceStatus: "queued_not_applied",
|
|
278
|
-
nextStep: "当前任务完成后,整理剩余工作的简报并调用 handoff({brief}) 自己交接。daemon 会在新 CLI 进程中应用待切换目录并继续简报;当前进程尚未切目录,不要让用户手动发 /new。",
|
|
279
|
-
} : {}),
|
|
280
|
-
...(j.scheduled ? { scheduled: true } : {}),
|
|
281
|
-
...(j.confirmed ? { confirmed: true } : {}),
|
|
282
|
-
});
|
|
283
|
-
});
|
|
284
|
-
// 企业微信 doc / smartsheet / contact MCP 桥接。把 daemon 远端的 MCP 转发
|
|
285
|
-
// 给本地 Claude: list_tools 列工具, call_tool 调用 (创建文档 / 写表格 / 读
|
|
286
|
-
// 内容)。category 当前可选: "doc" | "smartsheet" | "contact"。
|
|
287
|
-
// 大模型先调 list_tools 看可用方法和入参 schema, 再 call_tool。
|
|
288
|
-
server.registerTool("wecom_doc_list_tools", {
|
|
289
|
-
title: "List WeCom doc/smartsheet tools",
|
|
290
|
-
description: "List available WeCom MCP tools for a given category. Categories: 'doc' (online documents), 'smartsheet' (smart sheets), 'contact'. Returns tool names + JSON Schema. Call this BEFORE wecom_doc_call to discover method names and required arguments.",
|
|
291
|
-
inputSchema: {
|
|
292
|
-
category: z.string().describe("MCP category: 'doc' | 'smartsheet' | 'contact'."),
|
|
293
|
-
requesterUserId: z
|
|
294
|
-
.string()
|
|
295
|
-
.optional()
|
|
296
|
-
.describe("WeCom userid that owns the resulting docs. Optional — daemon falls back to config.wedoc.requesterUserId or defaultChat. 'user:xxx' prefix accepted."),
|
|
297
|
-
},
|
|
298
|
-
}, async ({ category, requesterUserId }) => {
|
|
299
|
-
const r = await daemonPost("/wedoc/list", { category, ...(requesterUserId ? { requesterUserId } : {}) });
|
|
300
|
-
return unwrap("wecom_doc_list_tools", r, (j) => j.result);
|
|
301
|
-
});
|
|
302
|
-
server.registerTool("wecom_doc_call", {
|
|
303
|
-
title: "Call WeCom doc/smartsheet tool",
|
|
304
|
-
description: "Invoke a specific WeCom MCP tool (after discovering it via wecom_doc_list_tools). Typical flow: list tools for 'doc' → pick a method like 'doc_create' → call it with args matching its inputSchema. Daily quota: 20 docs per requesterUserId.",
|
|
305
|
-
inputSchema: {
|
|
306
|
-
category: z.string().describe("MCP category: 'doc' | 'smartsheet' | 'contact'."),
|
|
307
|
-
method: z.string().describe("Tool name from wecom_doc_list_tools (e.g. 'doc_create', 'smartsheet_add_records')."),
|
|
308
|
-
args: z
|
|
309
|
-
.record(z.string(), z.unknown())
|
|
310
|
-
.optional()
|
|
311
|
-
.describe("JSON object matching the tool's inputSchema. Empty object if the tool takes no params."),
|
|
312
|
-
requesterUserId: z
|
|
313
|
-
.string()
|
|
314
|
-
.optional()
|
|
315
|
-
.describe("WeCom userid acting as document owner. Optional — daemon falls back to config / defaultChat. 'user:xxx' prefix accepted."),
|
|
316
|
-
},
|
|
317
|
-
}, async ({ category, method, args, requesterUserId }) => {
|
|
318
|
-
const r = await daemonPost("/wedoc/call", {
|
|
319
|
-
category,
|
|
320
|
-
method,
|
|
321
|
-
args: args ?? {},
|
|
322
|
-
...(requesterUserId ? { requesterUserId } : {}),
|
|
228
|
+
...(j.pendingCwd ? { pendingCwd: j.pendingCwd, appliedTo: "future-sessions" } : {}),
|
|
323
229
|
});
|
|
324
|
-
return unwrap("wecom_doc_call", r, (j) => j.result);
|
|
325
230
|
});
|
|
326
231
|
// ── Session discovery / switching (conversational) ─────────────────────────
|
|
327
232
|
// These let the WeCom-side Claude answer "列出所有 claude session" / "切到 xxx
|
|
@@ -363,26 +268,210 @@ export const createWezardServer = () => {
|
|
|
363
268
|
description: "以 revision 做 CAS 更新。tasks 是整份 DAG 替换;owner 显式推进、暂停、恢复、完成或取消计划。取消不等于完成。task.executor 可选,写执行者 wizard 的全局名字 (.name,带不带点都行) —— 不指派就不写,daemon 不自动填、不给旧记录补值;rolepage 上缺执行者的节点按 plan owner 展示。",
|
|
364
269
|
inputSchema: { planId: z.string().trim().min(1), ...PlanUpdateSchema.innerType().shape },
|
|
365
270
|
}, async (a) => unwrap("plan_update", await daemonPost("/plans/update", a)));
|
|
366
|
-
// ──
|
|
367
|
-
//
|
|
368
|
-
//
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
description: "给**这个聊天**起个短名字: notify 的收件人、spawn_wizard / clone_wizard 的 `chat` 从此能指到这里。没起过名字的聊天不会一直没名字 —— 第一次有人用到时守护进程按它的工作区自动补一个 (`~/develop/foo` → `foo`, 撞名加序号), 所以这个工具的用途是**起一个更好的名字**。这里的默认 wizard 出生时取聊天名; 它若还叫旧聊天名, 会跟着改 (wizard 的名字全局唯一, 撞名加后缀, 返回里的 `wizardRenamed` 就是它的新名字)。wizard 自己的名字用 wizard_identity 改, 与这里无关。用户说「给这个群起名叫 daily」「这个群叫什么」(不传 `name` 就是读) 「取消命名」(传 '-') 时调它。名字全机唯一、大小写不敏感。",
|
|
271
|
+
// ── chat_* / room_*: room 是唯一的沟通对象 ────────────────────────────────
|
|
272
|
+
// 这组 chat_* / room_* 工具就是全部出站与全部可见性管理 —— 没有「回执」通道, 也没有终句兜底:
|
|
273
|
+
// 要谁收到什么, 就写成一行; 要关一笔账, 就给 chat_reply 的 status。
|
|
274
|
+
server.registerTool("chat_say", {
|
|
275
|
+
title: "Say something in a room",
|
|
276
|
+
description: "在一个 room 里说一句 (不开 duty、不关账)。绑定 room 里这一行就真的进企微; dm / adhoc 只在 rolepage。派活 ack / 中间进展 / 只是想让别人看见一句话, 都用它。`to` 只指出对谁说, 不唤醒、不开 duty —— 要对方交代就用 chat_ask。**频道 room 里这一句 = 发一条新帖**; 要回到某条评论 (原帖) 下面用 chat_reply, 帖子 room 里出站一律评论回根帖。",
|
|
373
277
|
inputSchema: currentAddressSchema({
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
278
|
+
room: z.string().optional().describe(ROOM_DOC),
|
|
279
|
+
text: z.string().describe("要说的话 (markdown)"),
|
|
280
|
+
to: z.array(z.string()).optional().describe(TO_DOC),
|
|
281
|
+
interrupt: z.boolean().optional().describe(INTERRUPT_DOC),
|
|
282
|
+
}),
|
|
283
|
+
}, async ({ room, text, to, interrupt }) => unwrap("chat_say", await daemonPost("/room/say", {
|
|
284
|
+
...(room ? { room } : {}),
|
|
285
|
+
text,
|
|
286
|
+
...(to?.length ? { to } : {}),
|
|
287
|
+
...(interrupt ? { interrupt: true } : {}),
|
|
288
|
+
})));
|
|
289
|
+
server.registerTool("chat_ask", {
|
|
290
|
+
title: "Ask a wizard in a room (opens a duty)",
|
|
291
|
+
description: "向 room 里的一个或多个 wizard 开一条 duty —— 派活、提问、催一件没交代的事都走它; 也可点名本 room 的人 (`human:<userid>`) 向人提问 —— 人名下的 duty 不用 chat_reply, 人在本 room 的下一句话就关账 (带企微引用只关被引用的那条) 并唤醒你, 不需要了就对那条 id chat_reply canceled / passed。对方 wizard 只能用 chat_reply 交代 (done / passed / canceled 才关账)。缺省 room 的落点: `to` 全是本 room 成员 → 本 room; 单个 `to` 不是成员 → 自动落你和它的 dm room; 多个 `to` 里有非成员 wizard → 按成员集合 {你 + 它们} 复用或新开一个 adhoc (你是 host, 不会把它们拉进缺省群; 这条分支里 `interrupt` 只给被点名者的直属 parent); `to` 里含人且不全在缺省 room → 400, 要先在同一个 room。回包的 `id` 就是这一行的消息 id, 之后可以用 room_read 查、用 chat_reply 答; 回包还带落定的收件人名 (`name` / `names`)。" + DISPATCH_SAID_DOC + RESULT_IS_JSON_TEXT,
|
|
292
|
+
inputSchema: currentAddressSchema({
|
|
293
|
+
room: z.string().optional().describe(ROOM_DOC),
|
|
294
|
+
to: z.union([z.string(), z.array(z.string())]).describe(TO_DOC),
|
|
295
|
+
text: z.string().describe("这件活 / 这一问的正文。写清目标、交付与验收; 对方看不到你这一轮的上下文 —— 但它和你在同一个 room 时人说过的原话它看得到, 别复述 (要指就写那条消息 id); 只有它看不到那条话 (dm / adhoc / 不在那个 room) 才带原话。"),
|
|
296
|
+
kind: z.enum(["ask", "task"]).optional().describe(ASK_KIND_DOC),
|
|
297
|
+
after: z.array(z.string()).describe("前置: 这些消息 id 的 duty 全部 done 之前不唤醒它 (跨 room 也行)。省略 = 无前置。").optional(),
|
|
298
|
+
for: z.string().optional().describe(FOR_DOC),
|
|
299
|
+
planId: z.string().optional().describe("这件活归属的 plan id, 只做关联记录 —— daemon 不替你推进 DAG。"),
|
|
300
|
+
interrupt: z.boolean().optional().describe(INTERRUPT_DOC),
|
|
301
|
+
}),
|
|
302
|
+
}, async ({ room, to, text, kind, after, for: lineage, planId, interrupt }) => unwrap("chat_ask", await daemonPost("/room/ask", {
|
|
303
|
+
...(room ? { room } : {}),
|
|
304
|
+
to: Array.isArray(to) ? to : [to],
|
|
305
|
+
text,
|
|
306
|
+
...(kind ? { kind } : {}),
|
|
307
|
+
...(after?.length ? { after } : {}),
|
|
308
|
+
...(lineage ? { for: lineage } : {}),
|
|
309
|
+
...(planId ? { planId } : {}),
|
|
310
|
+
...(interrupt ? { interrupt: true } : {}),
|
|
311
|
+
})));
|
|
312
|
+
server.registerTool("chat_reply", {
|
|
313
|
+
title: "Close (or field) a duty — the only completion signal",
|
|
314
|
+
description: "答一条或多条 duty。room 由 `re` 定 —— 消息 id 全机唯一, 自带 room, 不用给。status: " + STATUS_DOC +
|
|
315
|
+
" 只有该 duty 的处理人 (或人) 能写 status, `re` 数组里任一条不归你 → 整行 403。不带 status 且你是处理人 = 有正文记 done、没正文记 passed; 不是处理人 = 普通线程回复 (不关账)。追问 / 等人用 need; progress 只在有新事实 (commit / 产物 / 结论) 时用, 没新事实别报。绑定 room 里同伴说的话人已经看见 —— 关账只补人还不知道的 (commit / 取舍 / 下一步), 别把同伴说过的结论再复述一遍; dm / adhoc 里人看不见, 结论要带回主 room。**频道 room 里 re 到一条评论 = 评论回原帖下面** (要新开一帖用 chat_say); 帖子 room 里一律评论回根帖。",
|
|
316
|
+
inputSchema: currentAddressSchema({
|
|
317
|
+
re: z.union([z.string(), z.array(z.string())]).describe("要答的那些消息 id (信封 / 注入的未读行头部的 `[<id>]`)。"),
|
|
318
|
+
text: z.string().optional().describe("答复正文; 不给 (且你是处理人) = passed。"),
|
|
319
|
+
status: z.enum(["done", "need", "progress", "passed", "canceled"]).optional().describe(STATUS_DOC),
|
|
320
|
+
}),
|
|
321
|
+
}, async ({ re, text, status }) => unwrap("chat_reply", await daemonPost("/room/reply", {
|
|
322
|
+
re: Array.isArray(re) ? re : [re],
|
|
323
|
+
...(text !== undefined ? { text } : {}),
|
|
324
|
+
...(status ? { status } : {}),
|
|
325
|
+
})));
|
|
326
|
+
server.registerTool("onboard_bind", {
|
|
327
|
+
title: "Bind a steward for a brand-new chat (onboarding only)",
|
|
328
|
+
description: "**只有新群引导会话能调** (引导期由 daemon 起在 <chat>#guide 的那个), 其余调用 403 —— 已绑过 / 绑定完成就不要再调。"
|
|
329
|
+
+ "把本群管家定下来: 给 workspace (目录; 要新建就 create:true —— 只建最后一级, 父目录必须已存在, 且必须在 $HOME 下) 或给 name (已有管家)。"
|
|
330
|
+
+ "人一句话里的三件事可以一次办完: workspace + create (目录) + name (给**新**管家起的名字, 与 workspace 同给; 实例会叫 <name>-1) + roomName (本群显示名)。"
|
|
331
|
+
+ "成功 = 绑定完成、引导结束: 管家进 room 接手, 人的原话连 duty 一起转给它; 你这一轮到此为止, 不要再说话、不要再调工具。"
|
|
332
|
+
+ "失败 = 4xx 带原因 (目录不存在 / 父目录不在 / 名字没认出 / 管家名被占用或非法), 引导继续, 用 chat_reply 向人追问或如实回报。"
|
|
333
|
+
+ "绑定之外的任何要求都不要自己做 —— 绑定后连原话一起交给管家。",
|
|
334
|
+
inputSchema: currentAddressSchema({
|
|
335
|
+
workspace: z.string().optional().describe("管家的工作目录 (绝对路径或 ~ 开头)。要建目录就同时给 create:true。"),
|
|
336
|
+
create: z.boolean().optional().describe("workspace 不存在时建它 (只建最后一级; 父目录必须已存在; 必须在 $HOME 下)。"),
|
|
337
|
+
name: z.string().optional().describe("给新管家起的名字 (与 workspace 同给; 类名, 实例为 <name>-1, 全机唯一); 只给 name 不给 workspace = 绑一个已有管家。"),
|
|
338
|
+
roomName: z.string().optional().describe("顺手把本群起个显示名 (rolepage 用)。"),
|
|
339
|
+
}),
|
|
340
|
+
}, async ({ workspace, create, name, roomName }) => unwrap("onboard_bind", await daemonPost("/onboarding/bind", {
|
|
341
|
+
...(workspace ? { workspace } : {}),
|
|
342
|
+
...(create ? { create: true } : {}),
|
|
343
|
+
...(name ? { name } : {}),
|
|
344
|
+
...(roomName ? { roomName } : {}),
|
|
345
|
+
})));
|
|
346
|
+
// ── room 管理面 ──────────────────────────────────────────────────────────
|
|
347
|
+
server.registerTool("room_open", {
|
|
348
|
+
title: "Open an adhoc room",
|
|
349
|
+
description: "开一个 `adhoc:…` 临时 room 并把 `with` 里的人拉进来 (你按 ord=1 入座, 是这个 room 的 host)。多步的活默认开一个跟进 room 把事情关在里面 —— 只有需要人和执行者直接对话时, 才把人拉进主 room。room 没有绑定传输, 消息只在 rolepage 可见。**开 room 请起个名字** (`title`): 写这个 room 在干什么, rolepage 的关系图 / 列表上就显示它; 不给则只显示成员名 (`A·B·C`), 看不出是哪件事; 事后可用 room_name 补。",
|
|
350
|
+
inputSchema: currentAddressSchema({
|
|
351
|
+
with: z.array(z.string()).describe("拉进来的 wizard 名 (裸名)。"),
|
|
352
|
+
title: z.string().optional().describe("room 的名字: 这个 room 在干什么, 一句话 (如「账单迁移 review」)。强烈建议给; 不给 rolepage 上只显示成员名。"),
|
|
353
|
+
}),
|
|
354
|
+
}, async ({ with: members, title }) => unwrap("room_open", await daemonPost("/room/open", { with: members, ...(title ? { title } : {}) })));
|
|
355
|
+
server.registerTool("room_name", {
|
|
356
|
+
title: "Name a room / set its notice (host only)",
|
|
357
|
+
description: "给 room 起显示名 (`name`) 和 / 或设群公告 (`notice`), 两个至少给一个; 只有本 room 的 host 能改。名字只是别名: room 的地址永远是 id (chat:… / user:… / dm:… / adhoc:…), 名字不参与寻址, 同名也不冲突; 它只出现在 rolepage、注入头与 room_read 的标签里。公告是每个 room 一条的一句话 (本周重点 / 某条规矩), 让 room 里所有 wizard 一直知道: 改动时绑定 room 里会发一条「📌 群公告」系统行 (进企微), 在跑的成员下一次注入时随 system-reminder 收到, 新 wizard 的宪章里带着, room_read 头部也有; `notice: \"\"` 清除; 与现有相同则无变化。host 换人后由新 host 改; 人用 `/notice`。",
|
|
358
|
+
inputSchema: currentAddressSchema({
|
|
359
|
+
room: z.string().describe(ROOM_DOC),
|
|
360
|
+
name: z.string().optional().describe("新的显示名, 一句话, 最多 60 字。"),
|
|
361
|
+
notice: z.string().optional().describe("群公告正文, 最多 500 字 (空白会折成单个空格); 空串 = 清除。"),
|
|
362
|
+
}),
|
|
363
|
+
}, async ({ room, name, notice }) => unwrap("room_name", await daemonPost("/room/name", { room, ...(name !== undefined ? { name } : {}), ...(notice !== undefined ? { notice } : {}) })));
|
|
364
|
+
server.registerTool("room_invite", {
|
|
365
|
+
title: "Invite someone into a room",
|
|
366
|
+
description: "把 `who` 拉进 room: host / 人 / 拉自己直属的子 wizard 时立即入群 (via invite / spawn); 其余成员的邀请转成一条 join-req, 等 host 批 (此时 history 不生效, 由 host 在 room_approve 时选)。",
|
|
367
|
+
inputSchema: currentAddressSchema({
|
|
368
|
+
room: z.string().describe(ROOM_DOC),
|
|
369
|
+
who: z.string().describe("要拉进来的 wizard 名 (裸名)。"),
|
|
370
|
+
history: historyArg(),
|
|
371
|
+
}),
|
|
372
|
+
}, async ({ room, who, history }) => unwrap("room_invite", await daemonPost("/room/invite", { room, who, ...(history !== undefined ? { history } : {}) })));
|
|
373
|
+
server.registerTool("room_join", {
|
|
374
|
+
title: "Ask to join a room",
|
|
375
|
+
description: "申请加入一个你还不是成员的 room: 写一条 join-req 并唤醒 host。批准之前你在那个 room 里的话落不成行。`reason` 是给 host 看的理由, 一句话。",
|
|
376
|
+
inputSchema: currentAddressSchema({
|
|
377
|
+
room: z.string().describe(ROOM_DOC),
|
|
378
|
+
reason: z.string().describe("为什么需要进来, 一句话。"),
|
|
378
379
|
}),
|
|
379
|
-
}, async ({
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
380
|
+
}, async ({ room, reason }) => unwrap("room_join", await daemonPost("/room/join", { room, reason })));
|
|
381
|
+
server.registerTool("room_approve", {
|
|
382
|
+
title: "Approve or reject a join request",
|
|
383
|
+
description: "host / 人批一条 join-req: `accept:false` 拒绝。`re` 是那条 join-req 的消息 id。",
|
|
384
|
+
inputSchema: currentAddressSchema({
|
|
385
|
+
re: z.string().describe("join-req 的消息 id。"),
|
|
386
|
+
accept: z.boolean().describe("true = 放进来, false = 拒绝。"),
|
|
387
|
+
history: historyArg(),
|
|
388
|
+
}),
|
|
389
|
+
}, async ({ re, accept, history }) => unwrap("room_approve", await daemonPost("/room/approve", { re, accept, ...(history !== undefined ? { history } : {}) })));
|
|
390
|
+
server.registerTool("room_leave", {
|
|
391
|
+
title: "Leave a room (or remove someone)",
|
|
392
|
+
description: "退出 room, 缺省是自己; host / 人可以用 `who` 移出别人。你手上这个 room 未结的 duty 由守护进程写成 canceled 并唤醒提问者 —— 走之前能交代的先 chat_reply 交代。",
|
|
393
|
+
inputSchema: currentAddressSchema({
|
|
394
|
+
room: z.string().describe(ROOM_DOC),
|
|
395
|
+
who: z.string().optional().describe("移出谁 (wizard 名)。省略 = 自己退出。"),
|
|
396
|
+
}),
|
|
397
|
+
}, async ({ room, who }) => unwrap("room_leave", await daemonPost("/room/leave", { room, ...(who ? { who } : {}) })));
|
|
398
|
+
server.registerTool("room_members", {
|
|
399
|
+
title: "Who is in this room",
|
|
400
|
+
description: "列本 room 的成员 (加入序、host、各自未结 duty 数) 与已读游标。纯文本。缺省 = 唤醒你这一轮的 room。",
|
|
401
|
+
inputSchema: currentAddressSchema({ room: z.string().optional().describe(ROOM_DOC) }),
|
|
402
|
+
}, async ({ room }) => unwrapText("room_members", await daemonPost("/room/members", { ...(room ? { room } : {}) })));
|
|
403
|
+
server.registerTool("room_activate", {
|
|
404
|
+
title: "Perceive who should answer the last human message (perceptron only)",
|
|
405
|
+
description: "perceptron 的感知判决: 把本 room 最后一条人话在 `to` 名单里**每个成员**名下开成 duty 并唤醒。**判决不写消息行** —— 被激活者只看到人的原话; 名单与理由落在判决记录 (perceive op), rolepage 可见。不给 `to` (或空) = 判不回应: 不开 duty、不投递、不落任何记录。同一条人话只能判一次。只有本 room 的 perceptron 能调, 别的 wizard 一律 403。",
|
|
406
|
+
inputSchema: currentAddressSchema({
|
|
407
|
+
re: z.string().describe("最后一条人话的消息 id (账本行首方括号里的 id)。"),
|
|
408
|
+
to: z.union([z.string(), z.array(z.string())]).optional().describe("应回应的成员名单 (wizard 名, 可多个); 省略 / 空 = 不回应。"),
|
|
409
|
+
reason: z.string().optional().describe("一句话理由 (为什么是它们): 记在判决记录里, rolepage 可见。"),
|
|
410
|
+
}),
|
|
411
|
+
}, async ({ re, to, reason }) => {
|
|
412
|
+
const list = Array.isArray(to) ? to : to ? [to] : [];
|
|
413
|
+
return unwrap("room_activate", await daemonPost("/room/activate", {
|
|
414
|
+
re,
|
|
415
|
+
...(list.length ? { to: list } : {}),
|
|
416
|
+
...(reason ? { reason } : {}),
|
|
417
|
+
}));
|
|
418
|
+
});
|
|
419
|
+
server.registerTool("room_read", {
|
|
420
|
+
title: "Read a room's ledger",
|
|
421
|
+
description: "读 room 账本, 纯文本, 一行一条 (行首 `[<id>]` 就是可以拿去 chat_reply 的 id)。默认只给游标之后你还没读过的那些; `all:true` 给全量。按时间 / 条数翻: `from` 从某条 id 之后, `since` / `until` 按时刻, `limit` 条数, `per` 单条字数上限。想读某个 wizard 会话里的原始对话用 peek_peer; 频道 (topic) 的历史用 read_channel。",
|
|
422
|
+
inputSchema: currentAddressSchema({
|
|
423
|
+
room: z.string().optional().describe(ROOM_DOC),
|
|
424
|
+
from: z.string().optional().describe("从这条消息 id 之后开始 (不含它)。"),
|
|
425
|
+
since: z.string().optional().describe("从什么时候起: `2h` / `30m` / `3d`、`14:30`、`09-30 14:30` 或 ISO 时间。"),
|
|
426
|
+
until: z.string().optional().describe("到什么时候为止 (不含), 写法同 `since`。往回翻页就把回执里给的时刻传进来。"),
|
|
427
|
+
limit: z.number().optional().describe("最多回多少条 (1-200)。"),
|
|
428
|
+
all: z.boolean().optional().describe("true = 不看游标, 给全量 (受 limit / 时间窗约束)。"),
|
|
429
|
+
per: z.number().optional().describe("单条正文最多多少字 (40-4000, 默认 500); 超出的标成 `…(+N)`。"),
|
|
430
|
+
}),
|
|
431
|
+
}, async ({ room, from, since, until, limit, all, per }) => unwrapText("room_read", await daemonPost("/room/read", {
|
|
432
|
+
...(room ? { room } : {}),
|
|
433
|
+
...(from ? { from } : {}),
|
|
434
|
+
...(since ? { since } : {}),
|
|
435
|
+
...(until ? { until } : {}),
|
|
436
|
+
...(limit ? { limit } : {}),
|
|
437
|
+
...(all ? { all } : {}),
|
|
438
|
+
...(per ? { per } : {}),
|
|
439
|
+
})));
|
|
440
|
+
server.registerTool("room_watch", {
|
|
441
|
+
title: "Subscribe to a room",
|
|
442
|
+
description: "订阅一个 room: 之后人新说一句、或有 duty 被关账时也唤醒你 (默认关)。每次唤醒都真的花你一轮, 所以不需要实时跟就看一眼 room_read —— 别顺手订阅。",
|
|
443
|
+
inputSchema: currentAddressSchema({
|
|
444
|
+
room: z.string().describe(ROOM_DOC),
|
|
445
|
+
on: z.boolean().describe("true = 订阅, false = 退订。"),
|
|
446
|
+
}),
|
|
447
|
+
}, async ({ room, on }) => unwrap("room_watch", await daemonPost("/room/watch", { room, on })));
|
|
448
|
+
server.registerTool("room_bind", {
|
|
449
|
+
title: "Bind an info source into this room (host / human only)",
|
|
450
|
+
description: "把一个企业微信信息源绑进本 room (多对一): 之后那个源的消息落这本账, 这里的回复按源回去 (帖子源 = 评论回原帖, 群源 = 群消息)。源 = base principal: 频道帖子 chat:<opk…> 或群 chat:<群id>; 频道本身就是一个 room, 不绑。**谁可以绑**: 目标 room 的 host 或人; 判定者不是目标 host 时先 chat_ask 那个 host, 让它自己调本工具。硬门: 同机器人 / 一源只能绑一个 room (想换先 room_unbind) / 目标 room 必须有 host / 源必须是群或帖子 / 源不能就是目标 room 的主源。source 省略 = 本 room 最近一条带源的人话 (频道里 @ 你的那条首触) —— 频道 host 判定「这条是我的」时直接 room_bind() 即可, 帖子 room 不诞生、不开新实例。三种出口: ① 自己处理 = 绑进本 room; ② 强相关旧 room = chat_ask 那个 room 的 host, 由它绑; ③ 另起 = 不绑 (daemon 在 rooms.binding.decideTimeoutMin 后自动为这个首触开帖子 room + 领号新实例, 并把新 host 拉进频道 room)。why 写一句判定理由 (审计落在 bind 行上)。",
|
|
451
|
+
inputSchema: currentAddressSchema({
|
|
452
|
+
source: z.string().optional().describe("要绑的源 base principal: chat:<opk…> (频道帖子) 或 chat:<群id> (群)。省略 = 本 room 最近一条带 src 的人话的源。"),
|
|
453
|
+
room: z.string().optional().describe("绑进哪个 room: 缺省 = 唤醒你这一轮的 room; 显式给别的 room 时只有它的 host / 人能成功。"),
|
|
454
|
+
why: z.string().optional().describe("一句判定理由 (落进 bind 行的 why, 审计用)。"),
|
|
455
|
+
dryRun: z.boolean().optional().describe("true = 只评估不写账本: 返回候选 room + 证据行 (同 asker / 近期接待 / 正文相关 (trigram >= rooms.binding.simMin) / 职责匹配)与 veto (跨机器人 / 没有 host / 死 room / 源已绑别处), 证据强的在前;相关度是语义判断, 由你决定绑哪个 —— daemon 不替你选。"),
|
|
456
|
+
}),
|
|
457
|
+
}, async ({ source, room, why, dryRun }) => unwrap("room_bind", await daemonPost("/room/bind", { ...(source ? { source } : {}), ...(room ? { room } : {}), ...(why ? { why } : {}), ...(dryRun ? { dryRun: true } : {}) })));
|
|
458
|
+
server.registerTool("room_fork", {
|
|
459
|
+
title: "Fork a channel post source into its own room now (channel host only)",
|
|
460
|
+
description: "对首触落在频道 room 的帖子源**立即**走出口 3 (另起): 建帖子 room + 领号新实例, 并把新 host 作为普通成员拉进频道 room (频道 host 身份不变)。host 判定「这该是一个新 room」时用它, 不必等 rooms.binding.decideTimeoutMin 的超时兜底。只有该频道 room 的 host 能调。幂等: 源已绑 / 帖子 room 已诞生 / 频道还在引导期都不会动 (回 409), 也不会重复开房。",
|
|
461
|
+
inputSchema: currentAddressSchema({
|
|
462
|
+
source: z.string().optional().describe("帖子源 base principal (chat:<opk…>)。省略 = 本 room 最近一条带 src 的人话的源。"),
|
|
463
|
+
room: z.string().optional().describe("从哪个 room 看 (缺省 = 唤醒你这一轮的 room; 必须是该帖所属频道 room 才能过权限)。"),
|
|
464
|
+
}),
|
|
465
|
+
}, async ({ source, room }) => unwrap("room_fork", await daemonPost("/room/fork", { ...(source ? { source } : {}), ...(room ? { room } : {}) })));
|
|
466
|
+
server.registerTool("room_unbind", {
|
|
467
|
+
title: "Unbind an info source from this room (host / human only)",
|
|
468
|
+
description: "解除本 room 对一个信息源的绑定 (只有目标 room 的 host 或人能解)。解绑后源**回落恒等**: 帖子源的消息回到频道接待处, 下一条消息时才按需诞生它自己的帖子 room (lazy, 不立即补开);群源回到自己的 1:1 room (原 room 与管家实例原样保留)。之后再想合并对话就重新 room_bind。",
|
|
469
|
+
inputSchema: currentAddressSchema({
|
|
470
|
+
source: z.string().describe("要解绑的源 base principal (与 room_bind 时给的一样)。"),
|
|
471
|
+
room: z.string().optional().describe("从哪个 room 解: 缺省 = 唤醒你这一轮的 room。"),
|
|
472
|
+
why: z.string().optional().describe("一句理由 (落进 unbind 行)。"),
|
|
473
|
+
}),
|
|
474
|
+
}, async ({ source, room, why }) => unwrap("room_unbind", await daemonPost("/room/unbind", { source, ...(room ? { room } : {}), ...(why ? { why } : {}) })));
|
|
386
475
|
registerRare("list_chats", {
|
|
387
476
|
title: "List every chat and its sessions",
|
|
388
477
|
description: "(罕用 · 同 IM `/chats`) 每个聊天的名字与住在那里的 wizard。只在要给 notify / spawn 的 `chat` 找聊天名时用; 找 wizard 用 wizard_roster。",
|
|
@@ -390,39 +479,15 @@ export const createWezardServer = () => {
|
|
|
390
479
|
}, async () => unwrap("list_chats", await daemonPost("/chats/list", {})));
|
|
391
480
|
server.registerTool("peek_peer", {
|
|
392
481
|
title: "Read what another wizard has been saying",
|
|
393
|
-
description: "**不打扰**地读另一个 wizard 的会话: 首行是它此刻的状态 (正在生成 / 空闲 / 停在哪个工具调用上等人点), 下面是它最近 N 个来回的正文 —— `▸` 是别人对它说的, `◂` 是它对这句最新说的一句 (跑完的是终句, 还在跑的是途中最近那句), 最后一条给得最全; 截掉的地方都标了 `…(+N)` / `…(略 N 字)…`。全部从它的 transcript 读: 只有说出来的话, 没有工具调用的过程, 回答「.fix 进展如何」「它卡在哪」, 或者判断要不要推它一把, 都读这里。这是**一个会话**的视角 (它从各处听到的都在里面);
|
|
482
|
+
description: "**不打扰**地读另一个 wizard 的会话: 首行是它此刻的状态 (正在生成 / 空闲 / 停在哪个工具调用上等人点), 下面是它最近 N 个来回的正文 —— `▸` 是别人对它说的, `◂` 是它对这句最新说的一句 (跑完的是终句, 还在跑的是途中最近那句), 最后一条给得最全; 截掉的地方都标了 `…(+N)` / `…(略 N 字)…`。全部从它的 transcript 读: 只有说出来的话, 没有工具调用的过程, 回答「.fix 进展如何」「它卡在哪」, 或者判断要不要推它一把, 都读这里。这是**一个会话**的视角 (它从各处听到的都在里面); 要看**一个 room** 里谁对谁说了什么, 用 room_read。只读, 随便轮询。",
|
|
394
483
|
inputSchema: currentAddressSchema({
|
|
395
484
|
name: z.string().describe(ADDRESS_DOC),
|
|
396
485
|
turns: z.number().optional().describe("回最近多少个来回 (1-40, 默认 6); 一个来回 = 一句问话 + 它的回答。"),
|
|
397
486
|
}),
|
|
398
487
|
}, async ({ name, turns }) => unwrapText("peek_peer", await daemonPost("/peers/peek", { name, ...(turns ? { turns } : {}) })));
|
|
399
|
-
server.registerTool("read_chat", {
|
|
400
|
-
title: "Read chat history like a person would",
|
|
401
|
-
description: "像人翻聊天记录那样读往来, 一行一句: `[时刻] .谁: .谁 说了什么` (wizard 名字前带 `.`, 人只写名字)。三级收窄, 每一级都可以不给: `role` (谁的视角 —— 只留它说的或听的) → `chat` (哪个群 —— 只留那个群里公开说的) → `target` (和谁 —— 只留与它的往来)。什么都不给 = 你这一轮所在的群: 人说的、各个 wizard 答的、wizard 之间公开说的都在里面。只给 `target` = 你和它的全部往来 (含 tell_peer 默认走的私聊, 群里看不见的那部分); `role` + `target` = 那两方之间; 只给 `role` = 它在所有群与私聊里的往来; 再加 `chat` 就限定在那个群里。没给 `chat` 时每行会标出这句是在哪个聊天 / 私聊里说的。一条消息一行起头, 正文的续行缩进; 还没等到回答的问话行尾标 `(还没有回复)`。\n" +
|
|
402
|
-
"按时间和条数读: 默认回最新的 `limit` 条; `until` = 只看那之前的 (往回翻页), `since` = 从那时起 (只给 `since` 就从它往后数 `limit` 条)。回执末尾给出翻页用的时刻, 原样传回即可; 往回已经没有了会明说到头。\n" +
|
|
403
|
-
"只有正文: 每个来回取问话和终句, 工具调用的过程不在里面, 记录是从各个 wizard 当前会话的 transcript 现拼的: 一个 wizard `/clear` 或交接之前说的不在里面, 除点名的 role / target 外只并最近一周动过的会话。用户说「群里刚才聊了什么」「.fix 之前怎么答的」「我上次让 .docs 干了什么」, 或者你被叫进一个已经聊了一阵的群、需要来龙去脉时调它。要读**某一个 wizard** 会话里的原始对话用 peek_peer。",
|
|
404
|
-
inputSchema: {
|
|
405
|
-
role: z.string().optional().describe("谁的视角: wizard 的名字 ('fix' / '.fix') 或人的 userid。省略 = 不限 (给了 `target` 时默认是你自己)。"),
|
|
406
|
-
chat: z.string().optional().describe("哪个群: 聊天名 (wizard_roster 里的 home 聊天名) 或裸 principal。省略 = 不限群 (公开与私聊都算); 三个都省略 = 你这一轮所在的群。"),
|
|
407
|
-
target: z.string().optional().describe("和谁的往来: wizard 的名字或人的 userid。"),
|
|
408
|
-
since: z.string().optional().describe("从什么时候起: `2h` / `30m` / `3d` (多久以前)、`14:30` (今天)、`09-30 14:30`、或 ISO 时间。"),
|
|
409
|
-
until: z.string().optional().describe("到什么时候为止 (不含), 写法同 `since`。往回翻页就把回执里的「更早的」时刻传进来。"),
|
|
410
|
-
limit: z.number().optional().describe("最多回多少条 (1-200, 默认 30)。"),
|
|
411
|
-
per: z.number().optional().describe("单条正文最多多少字 (40-4000, 默认 500); 超出的部分标成 `…(+N)`。"),
|
|
412
|
-
},
|
|
413
|
-
}, async ({ role, chat, target, since, until, limit, per }) => unwrapText("read_chat", await daemonPost("/chats/read", {
|
|
414
|
-
...(role ? { role } : {}),
|
|
415
|
-
...(chat ? { chat } : {}),
|
|
416
|
-
// `target` 在守护进程的请求体里是「调用方是谁」的覆盖 (resolveSelf), 不能占用。
|
|
417
|
-
...(target ? { with: target } : {}),
|
|
418
|
-
...(since ? { since } : {}),
|
|
419
|
-
...(until ? { until } : {}),
|
|
420
|
-
...(limit ? { limit } : {}),
|
|
421
|
-
...(per ? { per } : {}),
|
|
422
|
-
})));
|
|
423
488
|
server.registerTool("read_channel", {
|
|
424
489
|
title: "Read a WeCom channel's history",
|
|
425
|
-
description: "翻一个**频道**(企微 topic,不是群聊)的聊天历史,或者按关键词搜。频道里派给你的活,消息头上有 `topic=<id>` —— 注入的上下文(当前线程 + 最近若干条 + 搜索命中)不够时用它自己往前翻。先读本地缓存(daemon 为每个频道存了一份,含 reload / 断线期回填的消息);给了 `query` 且本地不够时才走官方搜索(`aibot_topic_search` 两步:先出 jobid 再取摘要,正文再按 post_id 取回)。返回一行一条:`[HH:MM] 作者: 正文`,作者是 userid 或 `bot:<aibotid 前十位>`。这是**频道**视角;群聊 /
|
|
490
|
+
description: "翻一个**频道**(企微 topic,不是群聊)的聊天历史,或者按关键词搜。频道里派给你的活,消息头上有 `topic=<id>` —— 注入的上下文(当前线程 + 最近若干条 + 搜索命中)不够时用它自己往前翻。先读本地缓存(daemon 为每个频道存了一份,含 reload / 断线期回填的消息);给了 `query` 且本地不够时才走官方搜索(`aibot_topic_search` 两步:先出 jobid 再取摘要,正文再按 post_id 取回)。返回一行一条:`[HH:MM] 作者: 正文`,作者是 userid 或 `bot:<aibotid 前十位>`。这是**频道**视角;群聊 / 私聊 / dm 的账本用 room_read,单个 wizard 的会话用 peek_peer。只读,随便查。",
|
|
426
491
|
inputSchema: {
|
|
427
492
|
topic: z.string().describe("频道 id:`chat:<topic_id>` 或裸 topic_id —— 频道消息上下文头的 `topic=` 就是它。"),
|
|
428
493
|
query: z.string().optional().describe("按关键词搜历史(先本地 grep,不够再走官方搜索)。不给 = 按时间翻最新若干条。"),
|
|
@@ -437,64 +502,48 @@ export const createWezardServer = () => {
|
|
|
437
502
|
...(since ? { since } : {}),
|
|
438
503
|
...(until ? { until } : {}),
|
|
439
504
|
})));
|
|
440
|
-
server.registerTool("tell_peer", { title: "Say something to another wizard (reply comes back by itself)", description: TELL_DESC, inputSchema: currentAddressSchema(TELL_SCHEMA) }, async (a) => {
|
|
441
|
-
if (a.text === undefined && a.taskFile === undefined)
|
|
442
|
-
return fail("tell_peer: `text` 与 `taskFile` 至少给一个 (后者是相对你工作区的模板路径, 由 daemon 展开)");
|
|
443
|
-
return unwrap("tell_peer", await daemonPost("/peers/tell", tellBody(a)));
|
|
444
|
-
});
|
|
445
505
|
server.registerTool("notify", {
|
|
446
|
-
title: "Post a message into a
|
|
447
|
-
description: "把一段 markdown
|
|
448
|
-
"
|
|
449
|
-
"什么时候用: 长活跑完了要通知另一个群的人; 一批分身收工后把汇总播给发起那个群; 定时任务 (schedule_task) 到点跑完把结论送到该看的人那里。",
|
|
506
|
+
title: "Post a message into a room for people to read",
|
|
507
|
+
description: "把一段 markdown 发进一个或多个 room **给人看**: 不唤醒任何 wizard、不点名、不开 duty。绑定 room 里它作为一条消息进企微 (气泡头自动署你的名字), dm / adhoc 只在 rolepage。和 chat_say 的区别只在落点: notify 发去别的 room, chat_say 说在你此刻所在的 room。长活跑完通知另一个群、批量分身收工后把汇总播给发起方、定时任务把结论送到该看的人那里, 都用它。\n" +
|
|
508
|
+
"给谁看是 room 的事 —— 说话的对象是 room, 不再是某个收件人。",
|
|
450
509
|
inputSchema: currentAddressSchema({
|
|
451
|
-
|
|
452
|
-
.array(z.string())
|
|
510
|
+
room: z
|
|
511
|
+
.union([z.string(), z.array(z.string())])
|
|
453
512
|
.optional()
|
|
454
|
-
.describe(
|
|
513
|
+
.describe(ROOM_DOC + " 可以给一组; 认不出的整条拒绝并列出来, 不会部分送达。省略 = 唤醒你这一轮的 room。"),
|
|
455
514
|
markdown: z.string().describe("正文, markdown。头 (是谁发的) 由守护进程自动加, 别自己写。"),
|
|
456
515
|
}),
|
|
457
|
-
}, async ({
|
|
516
|
+
}, async ({ room, markdown }) => unwrap("notify", await daemonPost("/room/notify", {
|
|
517
|
+
...(room === undefined ? {} : { room: Array.isArray(room) ? room : [room] }),
|
|
518
|
+
markdown,
|
|
519
|
+
})));
|
|
458
520
|
server.registerTool("send_file", {
|
|
459
|
-
title: "Send a local file / image into a
|
|
460
|
-
description: "把本机一个文件作为**图片 / 文件 / 语音 /
|
|
461
|
-
"`kind` 省略按扩展名定: png/jpg/jpeg/gif → image, mp4 → video, amr → voice, 其余 → file。企微上限: 图片 ≤10MB、视频 mp4 ≤10MB、语音只收 amr ≤2MB、文件 ≤20MB; 超了直接报错并告诉你怎么改 (
|
|
462
|
-
|
|
521
|
+
title: "Send a local file / image into a room",
|
|
522
|
+
description: "把本机一个文件作为**图片 / 文件 / 语音 / 视频消息**发进 room —— notify 的媒体版, 同样不唤醒谁、不开 duty。截图、图表、导出报表、日志包要给人时用它, 别只在回复里写一个本地路径 (人那边打不开)。\n" +
|
|
523
|
+
"`kind` 省略按扩展名定: png/jpg/jpeg/gif → image, mp4 → video, amr → voice, 其余 → file。企微上限: 图片 ≤10MB、视频 mp4 ≤10MB、语音只收 amr ≤2MB、文件 ≤20MB; 超了直接报错并告诉你怎么改 (大图改 `kind:\"file\"`)。\n" +
|
|
524
|
+
"`re` 只把这行挂到那条消息的线程上 —— 它不关任何 duty, 要交代就另调 chat_reply。",
|
|
525
|
+
inputSchema: currentAddressSchema({
|
|
526
|
+
room: z.string().optional().describe(ROOM_DOC),
|
|
463
527
|
path: z.string().describe("本机绝对路径 (`~` 可用)"),
|
|
464
528
|
kind: z.enum(["image", "file", "voice", "video"]).optional().describe("省略 = 按扩展名推断"),
|
|
465
|
-
to: z.string().optional().describe("收件聊天名或裸 principal; 省略 = 你这一轮所在的群 (私聊轮则是你的 home 群)"),
|
|
466
529
|
caption: z.string().optional().describe("附一句说明: 先以一条带你名字的 markdown 气泡发出, 再发文件"),
|
|
467
530
|
title: z.string().optional().describe("仅视频: 标题"),
|
|
468
531
|
description: z.string().optional().describe("仅视频: 描述"),
|
|
469
|
-
|
|
470
|
-
}, async (a) => unwrap("send_file", await daemonPost("/send_file", a)));
|
|
471
|
-
server.registerTool("wait_peer", {
|
|
472
|
-
title: "Wait until another wizard stops working",
|
|
473
|
-
description: "`tell_peer` 的结论通常会自动作为新的一轮送到你这里 (回执), 不必守着等。只有下一步硬依赖当前结果、拆成两轮会丢上下文, 或需要 `need:1` 谁先完成先处理时, 才用它阻塞等。代价是你这个 pane 在等待期间不能处理其他工作。\n" +
|
|
474
|
-
"被它取走的那一份**不会再作为回执注入**一遍 (返回里 `delivered: true` = 回执已经抢先进过你的会话, 别重复处理)。\n" +
|
|
475
|
-
"挂起, 直到点名的 wizard 停下来 (它的终端不再显示中断提示), 然后返回它最新的回复。超时先到则返回 `idle: false` 与原因: 它只是还在干, 你可以 peek 一眼再等。很便宜: 守护进程轮询的是 pane, 不烧 token。回的只算**你上次 tell_peer 之后**它说的: 它收口了 `RESULT: …` 就只回 `result` (`omitted` = 正文还有多少字没给, 要读用 peek_peer), 没收口才回 `lastText` (超长掐中间); `stale: true` = 它停下了却没有新回复 (卡在弹窗上, 或那句话没被接住) —— peek_peer 看一眼, 别把它当成答完了。\n" +
|
|
476
|
-
"**真要等一批就用 `names` 一次等一组**, 别一个一个等: 它们本来在同时干活, 串行等的墙钟是所有人之和, 并行等只等最慢的那一个。等一组时 `results` 按你给的顺序逐个回, 只等一个则直接摊平在顶层。`need` 决定满几个就返回 (默认全部; `need:1` = 谁先完事就先处理谁, 剩下的还在跑, 再调一次接着等)。",
|
|
477
|
-
inputSchema: currentAddressSchema({
|
|
478
|
-
name: z.string().optional().describe(`${ADDRESS_DOC} 等一组时改用 \`names\`。`),
|
|
479
|
-
names: z
|
|
480
|
-
.array(z.string())
|
|
481
|
-
.optional()
|
|
482
|
-
.describe("一次等多个 wizard 的名字 (最多 16 个), 每个的写法同 `name`。fan-out 之后的 join 用它 —— 五个分身并行等只花最慢那一个的时间。"),
|
|
483
|
-
need: z
|
|
484
|
-
.number()
|
|
485
|
-
.optional()
|
|
486
|
-
.describe("满几个就返回 (1 到地址个数, 默认全部)。`1` = 任意一个先完事就返回; 中间值 = 法定人数。满足后剩下的等待会被撤掉, 它们照常继续干活, 结果里 `idle:false`。"),
|
|
487
|
-
timeoutSec: z.number().optional().describe("Max seconds to wait (10-7200, default 900)."),
|
|
532
|
+
re: z.string().optional().describe("挂到哪条消息的线程上 (消息 id)。"),
|
|
488
533
|
}),
|
|
489
|
-
}, async ({
|
|
490
|
-
...(
|
|
491
|
-
|
|
492
|
-
...(
|
|
534
|
+
}, async ({ room, path, kind, caption, title, description, re }) => unwrap("send_file", await daemonPost("/room/file", {
|
|
535
|
+
...(room ? { room } : {}),
|
|
536
|
+
path,
|
|
537
|
+
...(kind ? { kind } : {}),
|
|
538
|
+
...(caption ? { caption } : {}),
|
|
539
|
+
...(title ? { title } : {}),
|
|
540
|
+
...(description ? { description } : {}),
|
|
541
|
+
...(re ? { re } : {}),
|
|
493
542
|
})));
|
|
494
543
|
server.registerTool("handoff", {
|
|
495
544
|
title: "Hand work over to a fresh context (yourself or another wizard)",
|
|
496
545
|
description: "把工作压成简报并在当前轮结束后交给新上下文。没有待切换工作区时,守护进程在原 pane 清空上下文并接回简报;存在 pendingCwd 时,会启动新的 CLI 进程,在待切换目录中接回简报。\n" +
|
|
497
|
-
"**不传 `name` = 交接你自己**: 简报由你写在 `brief` 里, 守护进程给这一轮一个短收尾窗口, 到点即打断并交接 (欠着的回执会在新会话里逐笔续答, 不会丢)
|
|
546
|
+
"**不传 `name` = 交接你自己**: 简报由你写在 `brief` 里, 守护进程给这一轮一个短收尾窗口, 到点即打断并交接 (欠着的回执会在新会话里逐笔续答, 不会丢)。交接是纯上下文管理 —— 想同时换目录就先 `set_workspace({cwd})` 记下 (此后新会话生效), handoff 会顺手在新目录接回简报。简报要写到零上下文的自己仅凭它就能接着干: 总目标 / 已完成与关键决策 / 当前状态 / 有序的下一步 / 关键文件与非显然的坑。\n" +
|
|
498
547
|
"**传 `name` = 替那个 wizard 交接**: 守护进程让它自己写简报 (`focus` 指定要特别交代的点), 抓到后在原 pane 清空并贴回; 返回被带过去的那份简报。",
|
|
499
548
|
inputSchema: currentAddressSchema({
|
|
500
549
|
name: z.string().optional().describe("替谁交接 —— wizard 的名字 ('fix' / '.fix')。省略 = 你自己。"),
|
|
@@ -588,38 +637,42 @@ export const createWezardServer = () => {
|
|
|
588
637
|
}, async () => unwrap("wizard_whoami", await daemonPost("/wizard/whoami", {})));
|
|
589
638
|
server.registerTool("wizard_identity", {
|
|
590
639
|
title: "Name yourself / declare your job",
|
|
591
|
-
description: "
|
|
640
|
+
description: "修改 name、description 或 expertise。不给 to = 改自己; 给 to (实例名, 带不带点都认) = 改那个 wizard —— 只有它的直属 parent 或管家实例能改。目标是类实例时 name 是**新类名** (该类的全部实例同步成 新类名-N, 序号不变; 形如 X-3 的名字直接拒)。返回落定名; 类改名附类名与实例清单。",
|
|
592
641
|
inputSchema: currentAddressSchema({
|
|
593
|
-
|
|
642
|
+
to: z.string().optional().describe("要改谁: wizard 的地址 (实例名 / 类名, 例如 `wezard-2` 或 `.wezard-2`)。不传 = 改自己。"),
|
|
643
|
+
name: z.string().optional().describe("新名字, 1-32 位字母/数字/`_`/`-`, 全机唯一。类实例 = 新类名 (不以 -数字 结尾)。不改就别传。"),
|
|
594
644
|
description: z.string().optional().describe("一句话职责, 例如 '盯 wezard 主仓的重构与发版'。不改就别传。"),
|
|
595
645
|
expertise: z.string().optional().describe("一句话专长: 熟哪块代码 / 领域, 例如 'rolepage 前端 (web/chat.js · role-view)'。名册与 delegate 候选行都显示它, 任务与它重叠时可据此选择。传 '-' 清掉。"),
|
|
596
646
|
}),
|
|
597
|
-
}, async ({ name, description, expertise }) => unwrap("wizard_identity", await daemonPost("/wizard/identity", {
|
|
647
|
+
}, async ({ to, name, description, expertise }) => unwrap("wizard_identity", await daemonPost("/wizard/identity", {
|
|
648
|
+
...(to !== undefined ? { to } : {}),
|
|
598
649
|
...(name !== undefined ? { name } : {}),
|
|
599
650
|
...(description !== undefined ? { description } : {}),
|
|
600
651
|
...(expertise !== undefined ? { expertise } : {}),
|
|
601
652
|
}), undefined, { name, description, expertise }));
|
|
602
653
|
server.registerTool("wizard_roster", {
|
|
603
|
-
title: "
|
|
604
|
-
description: "
|
|
605
|
-
"
|
|
654
|
+
title: "Roster pyramid: 在场 → 本群 → 全机",
|
|
655
|
+
description: "名册是金字塔, 默认只给 **L0 在场** (≤12 行): 你 + 本群管家 + 本聊天 48h 内动过的化身, 各一行, 尾行全机普查 (N 身份 · M 群 · 忙/闲/冷)。\n" +
|
|
656
|
+
"**升级靠显式参数**: `chat` (聊天名) = **L1 本群** 该聊天全部化身含冷的, 带职责/最近/家谱 (≤40 行); `scope:\"all\"` = **L2 组团** 每个聊天一行名字概览 (≤60 行); 单个 wizard 的详情用 `peek_peer`。\n" +
|
|
657
|
+
"**自动降级**: 你的 ctx 到交接线时只回 L0 并注明 —— 那时候也别拉大表。\n" +
|
|
658
|
+
"`query` 匹配名字/职责/地址, `cwd` 反查工作区, `alive:true` 只看活着的; 这些过滤器对每一层都生效。问了一个名字、它不在本群在场名单里时, L0 尾行会提示升级参数。这是你感知同伴的唯一入口 —— 拿到名字再 chat_ask / peek_peer。",
|
|
606
659
|
inputSchema: {
|
|
607
660
|
query: z.string().optional().describe("在名字 / 职责 / target 里做子串匹配 (不分大小写)。「让懂 X 的那个来看看」就把 X 写在这里。"),
|
|
608
|
-
chat: z.string().optional().describe("
|
|
661
|
+
chat: z.string().optional().describe("升级到 L1: 只看某个聊天的全部化身 (含冷)。聊天名, 或聊天 principal 的一段。「同群有谁」就写你自己的群名。"),
|
|
609
662
|
cwd: z.string().optional().describe("只看工作区路径包含这一段的 wizard —— 「谁在 /path 下干活」的反查。"),
|
|
610
663
|
alive: z.boolean().optional().describe("true = 只看 pane 还活着的。默认全给 (冷会话发消息就会被唤醒)。"),
|
|
611
|
-
|
|
664
|
+
scope: z.enum(["all"]).optional().describe("升级到 L2: 全机分群概览, 每个聊天一行 (名字串, ≤60 行)。"),
|
|
612
665
|
},
|
|
613
|
-
}, async ({ query, chat, cwd, alive,
|
|
666
|
+
}, async ({ query, chat, cwd, alive, scope }) => unwrapText("wizard_roster", await daemonPost("/wizard/roster", {
|
|
614
667
|
...(query ? { query } : {}),
|
|
615
668
|
...(chat ? { chat } : {}),
|
|
616
669
|
...(cwd ? { cwd } : {}),
|
|
617
670
|
...(alive ? { alive } : {}),
|
|
618
|
-
...(
|
|
671
|
+
...(scope ? { scope } : {}),
|
|
619
672
|
})));
|
|
620
673
|
server.registerTool("route_candidates", {
|
|
621
674
|
title: "Who could take this task",
|
|
622
|
-
description: "一件活要不要转给已有 wizard 时调它。只返回按 limit 截断的候选文本,不包含完整诊断或未展示候选。候选排序不等于推荐追加任务;独立新活按本次难度 delegate
|
|
675
|
+
description: "一件活要不要转给已有 wizard 时调它。只返回按 limit 截断的候选文本,不包含完整诊断或未展示候选。候选排序不等于推荐追加任务;独立新活按本次难度 delegate,同一验收目标的续篇直接 chat_ask 原来接活的那个。",
|
|
623
676
|
inputSchema: {
|
|
624
677
|
task: z.string().describe("这件活及验收目标, 原话或一句概括都行。文件名 / 模块名 / 函数名帮助找线索; 公共规则文件、同工作区和关键词重叠不证明是同一任务。"),
|
|
625
678
|
cwd: z.string().optional().describe("这件活落在哪个工作区。省略 = 你自己的工作区。"),
|
|
@@ -646,8 +699,8 @@ export const createWezardServer = () => {
|
|
|
646
699
|
}, async ({ model, effort, name, scope }) => unwrap("set_model", await daemonPost("/wizard/model", { ...(model ? { model } : {}), ...(effort ? { effort } : {}), ...(name ? { name } : {}), ...(scope ? { scope } : {}) })));
|
|
647
700
|
server.registerTool("spawn_wizard", {
|
|
648
701
|
title: "Spawn a blank child wizard",
|
|
649
|
-
description: "**从白板生**一个子 wizard —— 新的 tmux pane、自己的全局名字 (
|
|
650
|
-
"带上 `task`
|
|
702
|
+
description: "**从白板生**一个子 wizard —— 新的 tmux pane、自己的全局名字 (裸名)、自己的职责, 归你管 (家谱里挂在你名下)。它**不继承你的任何上下文**, 只拿到身份。适合干一件与你手头无关的事, 或者要去别的目录 (`cwd`) / 别的聊天里干活。要一个开局就带着你读过的材料的, 用 clone_wizard。\n" +
|
|
703
|
+
"带上 `task` 就是在它就位的同时开一条 duty (等同一次 chat_ask), 省一次往返; 不带它就位待命, 之后用 chat_ask 找它。返回 name、cwd、继承状态、实际模型/档位与警告。" +
|
|
651
704
|
OFFSPRING_TAIL,
|
|
652
705
|
inputSchema: currentAddressSchema({
|
|
653
706
|
...offspringShape,
|
|
@@ -658,8 +711,8 @@ export const createWezardServer = () => {
|
|
|
658
711
|
server.registerTool("clone_wizard", {
|
|
659
712
|
title: "Clone a wizard, context and all",
|
|
660
713
|
description: "**克隆**一个 wizard 出分身 —— fork 它此刻的上下文: 分身开局就拥有它已经读过的一切 (规范、目录结构、刚啃完的那份文档), 不必重读; 被克隆的那个毫发无损。默认克隆你自己; `from` 点名就克隆别的 wizard (比如一个已经把某个模块啃透的同伴) —— 分身仍归你管 (占你的名额), 只是上下文来自它。分身留在被克隆者的工作区。\n" +
|
|
661
|
-
"要白纸一张、或要去别的目录, 用 spawn_wizard。被克隆者正在干活时, 分身拿到的是它此刻为止的上下文 —— 想要它读完再分:
|
|
662
|
-
"带上 `task`
|
|
714
|
+
"要白纸一张、或要去别的目录, 用 spawn_wizard。被克隆者正在干活时, 分身拿到的是它此刻为止的上下文 —— 想要它读完再分: 等它那条 chat_reply, 或看 wizard_roster 的忙闲。\n" +
|
|
715
|
+
"带上 `task` 就是在它就位的同时开一条 duty (分叉本来就由第一句话触发, 省一次往返)。返回 name、cwd、继承状态、实际模型/档位与警告。" +
|
|
663
716
|
OFFSPRING_TAIL,
|
|
664
717
|
inputSchema: currentAddressSchema({
|
|
665
718
|
...offspringShape,
|
|
@@ -668,7 +721,7 @@ export const createWezardServer = () => {
|
|
|
668
721
|
}, bear("clone_wizard", true));
|
|
669
722
|
server.registerTool("pending_items", {
|
|
670
723
|
title: "What I dispatched and is still open",
|
|
671
|
-
description: "挂起事项全表: 你派出去 (
|
|
724
|
+
description: "挂起事项全表: 你派出去 (chat_ask / delegate / 带 task 的 spawn) 还没了结的每一件 —— 件号、对象、一句话题、为谁派的; 关账只认对方那条 chat_reply 的 status。已交代的、同一对改派了的自动消掉; 没结论的留着, 直到你改派、chat_ask 追问, 或用 `drop` 显式消掉。\n" +
|
|
672
725
|
"管家平时只会在注入尾巴上收到必要的一行增量, 快忘的时候 (交接 / 压缩后、隔了很多轮) 收到一次全表; 其余时候想看就调它。",
|
|
673
726
|
inputSchema: currentAddressSchema({
|
|
674
727
|
drop: z.array(z.string()).optional().describe("要消掉的那几项: 写对方的名字 (= 你派给它、还开着的那项), 或表里每行开头的 event id: 不再需要、或已经另行处理了。"),
|