wezard 2.8.5 → 2.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +17 -16
- package/README.md +43 -50
- package/cli/wezard.sh +10 -10
- package/config.example.jsonc +15 -17
- package/dist/cli/codex-hook.js +6 -1
- package/dist/cli/codex-hook.js.map +1 -1
- package/dist/cli/init.js +0 -2
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/sync.js +42 -25
- package/dist/cli/sync.js.map +1 -1
- package/dist/daemon/approval.js +83 -69
- package/dist/daemon/approval.js.map +1 -1
- package/dist/daemon/chat-log.js +3 -4
- package/dist/daemon/chat-log.js.map +1 -1
- package/dist/daemon/chat-name.js +11 -33
- package/dist/daemon/chat-name.js.map +1 -1
- package/dist/daemon/config-api.js +9 -51
- package/dist/daemon/config-api.js.map +1 -1
- package/dist/daemon/danger.js +20 -3
- package/dist/daemon/danger.js.map +1 -1
- package/dist/daemon/detail.js +2 -2
- package/dist/daemon/detail.js.map +1 -1
- package/dist/daemon/dispatch.js.map +1 -1
- package/dist/daemon/handoff.js +7 -7
- package/dist/daemon/handoff.js.map +1 -1
- package/dist/daemon/http.js +5 -1
- package/dist/daemon/http.js.map +1 -1
- package/dist/daemon/idle-nudge.js +23 -9
- package/dist/daemon/idle-nudge.js.map +1 -1
- package/dist/daemon/inbound.js +69 -80
- package/dist/daemon/inbound.js.map +1 -1
- package/dist/daemon/index.js +1248 -1573
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/last-response.js +3 -3
- package/dist/daemon/last-response.js.map +1 -1
- package/dist/daemon/mcp-http.js +77 -0
- package/dist/daemon/mcp-http.js.map +1 -0
- package/dist/daemon/memory-steward.js +1 -13
- package/dist/daemon/memory-steward.js.map +1 -1
- package/dist/daemon/message-events.js +280 -52
- package/dist/daemon/message-events.js.map +1 -1
- package/dist/daemon/message-format.js +3 -4
- package/dist/daemon/message-format.js.map +1 -1
- package/dist/daemon/mirror-bridge.js +137 -117
- package/dist/daemon/mirror-bridge.js.map +1 -1
- package/dist/daemon/notices.js +2 -2
- package/dist/daemon/peers.js +84 -70
- package/dist/daemon/peers.js.map +1 -1
- package/dist/daemon/pending-items.js +6 -24
- package/dist/daemon/pending-items.js.map +1 -1
- package/dist/daemon/pending.js.map +1 -1
- package/dist/daemon/picker-policy.js +16 -6
- package/dist/daemon/picker-policy.js.map +1 -1
- package/dist/daemon/plan-http.js +122 -0
- package/dist/daemon/plan-http.js.map +1 -0
- package/dist/daemon/plan-reminders.js +47 -0
- package/dist/daemon/plan-reminders.js.map +1 -0
- package/dist/daemon/plans.js +238 -0
- package/dist/daemon/plans.js.map +1 -0
- package/dist/daemon/quota.js +3 -2
- package/dist/daemon/quota.js.map +1 -1
- package/dist/daemon/repl-script.js +22 -0
- package/dist/daemon/repl-script.js.map +1 -0
- package/dist/daemon/route.js +1 -10
- package/dist/daemon/route.js.map +1 -1
- package/dist/daemon/router.js +156 -127
- package/dist/daemon/router.js.map +1 -1
- package/dist/daemon/session-cache.js +6 -4
- package/dist/daemon/session-cache.js.map +1 -1
- package/dist/daemon/spawn-tmux.js +21 -14
- package/dist/daemon/spawn-tmux.js.map +1 -1
- package/dist/daemon/steward-guard.js +8 -19
- package/dist/daemon/steward-guard.js.map +1 -1
- package/dist/daemon/tasks.js +1 -38
- package/dist/daemon/tasks.js.map +1 -1
- package/dist/daemon/tips.js +2 -2
- package/dist/daemon/tips.js.map +1 -1
- package/dist/daemon/wait-idle.js +29 -0
- package/dist/daemon/wait-idle.js.map +1 -0
- package/dist/daemon/weixin.js +0 -19
- package/dist/daemon/weixin.js.map +1 -1
- package/dist/daemon/wezard-session.js +1 -1
- package/dist/daemon/wezard-session.js.map +1 -1
- package/dist/daemon/wizard-memory.js.map +1 -1
- package/dist/daemon/wizard-names.js +3 -5
- package/dist/daemon/wizard-names.js.map +1 -1
- package/dist/daemon/wizard.js +36 -39
- package/dist/daemon/wizard.js.map +1 -1
- package/dist/mcp/output.js +114 -0
- package/dist/mcp/output.js.map +1 -0
- package/dist/mcp/server.js +5 -819
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.js +688 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/shared/chat-http.js +33 -40
- package/dist/shared/chat-http.js.map +1 -1
- package/dist/shared/chat-view.js +2 -36
- package/dist/shared/chat-view.js.map +1 -1
- package/dist/shared/cli-backends.js +4 -45
- package/dist/shared/cli-backends.js.map +1 -1
- package/dist/shared/config.js +37 -112
- package/dist/shared/config.js.map +1 -1
- package/dist/shared/detail-render.js +14 -42
- package/dist/shared/detail-render.js.map +1 -1
- package/dist/shared/detail-store.js +1 -1
- package/dist/shared/detail-store.js.map +1 -1
- package/dist/shared/hook-mode.js +31 -0
- package/dist/shared/hook-mode.js.map +1 -0
- package/dist/shared/json-map-store.js +3 -4
- package/dist/shared/json-map-store.js.map +1 -1
- package/dist/shared/message-footer.js +3 -3
- package/dist/shared/message-footer.js.map +1 -1
- package/dist/shared/modal-pane.js +35 -37
- package/dist/shared/modal-pane.js.map +1 -1
- package/dist/shared/model-tiers.js +5 -16
- package/dist/shared/model-tiers.js.map +1 -1
- package/dist/shared/plan.js +105 -0
- package/dist/shared/plan.js.map +1 -0
- package/dist/shared/reminder.js +21 -41
- package/dist/shared/reminder.js.map +1 -1
- package/dist/shared/role-render.js +4 -51
- package/dist/shared/role-render.js.map +1 -1
- package/dist/shared/role-view.js +6 -36
- package/dist/shared/role-view.js.map +1 -1
- package/dist/shared/session-label.js +25 -53
- package/dist/shared/session-label.js.map +1 -1
- package/dist/shared/tool-hints.js +21 -15
- package/dist/shared/tool-hints.js.map +1 -1
- package/dist/shared/trigger.js +0 -11
- package/dist/shared/trigger.js.map +1 -1
- package/dist/shared/turn-state.js +4 -1
- package/dist/shared/turn-state.js.map +1 -1
- package/dist/shared/world.js +15 -25
- package/dist/shared/world.js.map +1 -1
- package/dist/svr/index.js +3 -3
- package/dist/svr/index.js.map +1 -1
- package/hooks/pre-tool-use.sh +48 -5
- package/package.json +2 -5
- package/web/chat.css +112 -102
- package/web/chat.js +312 -239
- package/dist/cli/migrate.js +0 -213
- package/dist/cli/migrate.js.map +0 -1
- package/dist/daemon/direction.js +0 -54
- package/dist/daemon/direction.js.map +0 -1
- package/dist/daemon/graph.js +0 -210
- package/dist/daemon/graph.js.map +0 -1
- package/dist/daemon/jobs.js +0 -255
- package/dist/daemon/jobs.js.map +0 -1
- package/dist/daemon/workflow-nodes.js +0 -236
- package/dist/daemon/workflow-nodes.js.map +0 -1
- package/dist/daemon/workflow-plan-http.js +0 -83
- package/dist/daemon/workflow-plan-http.js.map +0 -1
- package/dist/daemon/workflow-plans.js +0 -277
- package/dist/daemon/workflow-plans.js.map +0 -1
- package/dist/shared/model-tier-migration.js +0 -43
- package/dist/shared/model-tier-migration.js.map +0 -1
- package/dist/shared/workflow-plan.js +0 -36
- package/dist/shared/workflow-plan.js.map +0 -1
package/CLAUDE.md
CHANGED
|
@@ -7,18 +7,18 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|
|
7
7
|
`wezard` (CLI `wezard`) bridges agent CLIs (Claude Code / claude-internal / CodeBuddy) and WeCom (企业微信) smart bots:
|
|
8
8
|
- **PreToolUse approval forwarding**: every tool call is gated by a button card pushed to WeCom; clicking ✅/❌/⏱ resolves the long-poll the hook is parked on.
|
|
9
9
|
- **Remote control**: messages sent to the bot drive a local agent CLI — the daemon spawns an interactive session in tmux and mirrors it to the chat. Sessions are opened from the chat side only (first inbound, `/new`, `.name`, `switch_claude_session`).
|
|
10
|
-
- **MCP server** (`wezard`): the wizard's whole tool surface — talk to / watch / spawn / clone / stop other wizards (`tell_peer`, `peek_peer`, `read_chat`, `spawn_wizard`, `clone_wizard`, …),
|
|
10
|
+
- **MCP server** (`wezard`): the wizard's whole tool surface — talk to / watch / spawn / clone / stop other wizards (`tell_peer`, `peek_peer`, `read_chat`, `spawn_wizard`, `clone_wizard`, …), owner-managed plans, schedules, memory, workspace/model switching, `notify` — each a thin POST to the resident daemon over loopback HTTP. Human-facing outbound cards (approval / AskUserQuestion) are pushed by the daemon itself, not through MCP.
|
|
11
11
|
|
|
12
12
|
## Build / run
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npm run build # tsc → dist/, then chmod +x on the
|
|
15
|
+
npm run build # tsc → dist/, then chmod +x on the bin entry scripts
|
|
16
16
|
npm run typecheck # tsc --noEmit
|
|
17
17
|
npm run dev:daemon # tsx daemon/index.ts (no install / hot iteration)
|
|
18
|
-
npm run dev:cli # tsx cli/
|
|
18
|
+
npm run dev:cli # tsx cli/init.ts
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Tests are individual assertion scripts under `tests/`; there is no `npm test` script. Run relevant TypeScript scripts with `npx tsx tests/<name>.test.ts` after checking prerequisites. Typechecking excludes tests. Documentation changes require link and command review.
|
|
22
22
|
|
|
23
23
|
Local dev loop:
|
|
24
24
|
```bash
|
|
@@ -27,7 +27,7 @@ npm run build && ./cli/wezard.sh reload # rebuild, then bounce the resident d
|
|
|
27
27
|
./cli/wezard.sh status # HTTP /status — wsConnected, pending count, sourcePath
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
When the user says **"reload"** in this repo, it means exactly: `npm run build && ./cli/wezard.sh reload`. The global `wezard` binary may not be on `$PATH` in dev shells — always invoke `./cli/wezard.sh` from the repo root.
|
|
30
|
+
When the user says **"reload"** in this repo, it means exactly: `npm run build && ./cli/wezard.sh reload`. The global `wezard` binary may not be on `$PATH` in dev shells — always invoke `./cli/wezard.sh` from the repo root. After a development unit, build once, reload the daemon, then restart the existing svr service with `launchctl kickstart -k "gui/$(id -u)/com.wezard.svr"` on macOS or `systemctl --user restart wezard-svr.service` on Linux. Operational-only requests keep their requested scope; daemon reload does not restart svr.
|
|
31
31
|
|
|
32
32
|
## Release / changelog
|
|
33
33
|
|
|
@@ -55,22 +55,23 @@ Three processes, all coordinating via 127.0.0.1:17890 and `~/.wezard/`:
|
|
|
55
55
|
- `inbound.ts` routes `message.text` / `message.image` / `message.mixed` → `mirror-bridge.ts`. Gates on `allowFrom`; one-shot exception is the bootstrap claim (see below).
|
|
56
56
|
- `mirror-bridge.ts` tails `<projectsDir>/<encoded(cwd)>/<sid>.jsonl` and pushes new `assistant` content to a chat — but only for turns the chat itself started: a turn opened by a human's CLI keystroke is recorded to the turn store (rolepage) and kept out of the chat (`wrc.mirror.chatOriginOnly`, brief mode only); approval/askq cards and `[mirror]` notices bypass that gate. Inbound injection is either `claude --resume <sid> -p` (writes a turn into the same jsonl) or `tmux paste-buffer` against a live TTY (only path that makes WeCom messages visible in the user's CLI window). `recentInjects` ring buffer suppresses the WeCom→CLI echo when tailing (which is why an injected line's text is stamped as the turn's `userQuery` at inject time — the tail never sees it). **Every turn has a channel** (`TurnDetailRecord.channel`): the base of the public chat it was spoken in and where its reply goes — a human can `.name` a wizard homed in another chat and the reply (text and cards) returns to the chat that asked, not the wizard's home; `""` = a private wizard↔wizard turn whose reply is pushed nowhere and lives only on the rolepage.
|
|
57
57
|
- `claim.ts` is a single-shot bootstrap: an exact-match magic phrase from any sender bypasses `allowFrom`, writes that principal as `defaultChat`, and appends to `allowFrom`. This is the **only** legitimate ingress for first-time setup.
|
|
58
|
-
- `peers.ts` is the read side of multi-agent awareness — "who else is working in this chat, and are they busy". A wizard's HOME chat is its target key's base principal (`baseOfKey`): the untagged default plus every slot `chat:xxx#slot`. Pure parsing only — bounded transcript-tail reads (`tailTurns` / `lastAssistantText` / `summarizeTail`, shared with `session-scan.ts`) and pane classification (`paneIsBusy`). **What a wizard reads about another comes from the transcript, never from a pane capture**: text turns only (`talkTurns`), and "where is it stuck" is `openToolUses` (a tool call left hanging on an idle session = parked on an approval card). The pane is consulted for exactly one thing, `busy`. Read-side tools (`wizard_roster` / `peek_peer` / `read_chat`) answer in plain text rendered daemon-side, not json; `read_chat` (`chat-log.ts`) is computed from session transcripts alone, not the turn store: a log = every recently-active session's ask + final answer per round, merged by timestamp, then narrowed on the rolepage's axis `role` → `chat` → `target` and cut by `since` / `until` / `limit`. Which channel a line belongs to and who said it is read back from the envelope riding on that user line (`parseEnvelope`, `shared/reminder.ts`): every wezard `<system-reminder>` carries its facts as opening-tag attributes (`wezard=envelope|hint|lead|after|mention|roster|pending`, `kind` / `from` / `chat` / `scope`, the injection event id as `msg`) and its prose only for the model; which attrs each kind may write is the `REMINDER_KINDS` registry (each attr is either read back by code or an id the model copies into `re`/`for`/`drop`), and `renderTail` lays one injection's tail out in a fixed order, envelope first — rewording the prose never breaks parsing;
|
|
59
|
-
- `wizard.ts` is the identity layer over those sessions: a target key plus a **globally unique name** — the wizard's only address, written `.name` everywhere a human or model sees it (a chat's default session takes the chat's name, a slot takes its slot id; collisions get `-N` via `pickName`; `settleName` claims lazily, `settleAll`
|
|
58
|
+
- `peers.ts` is the read side of multi-agent awareness — "who else is working in this chat, and are they busy". A wizard's HOME chat is its target key's base principal (`baseOfKey`): the untagged default plus every slot `chat:xxx#slot`. Pure parsing only — bounded transcript-tail reads (`tailTurns` / `lastAssistantText` / `summarizeTail`, shared with `session-scan.ts`) and pane classification (`paneIsBusy`). **What a wizard reads about another comes from the transcript, never from a pane capture**: text turns only (`talkTurns`), and "where is it stuck" is `openToolUses` (a tool call left hanging on an idle session = parked on an approval card). The pane is consulted for exactly one thing, `busy`. Read-side tools (`wizard_roster` / `peek_peer` / `read_chat`) answer in plain text rendered daemon-side, not json; `read_chat` (`chat-log.ts`) is computed from session transcripts alone, not the turn store: a log = every recently-active session's ask + final answer per round, merged by timestamp, then narrowed on the rolepage's axis `role` → `chat` → `target` and cut by `since` / `until` / `limit`. Which channel a line belongs to and who said it is read back from the envelope riding on that user line (`parseEnvelope`, `shared/reminder.ts`): every wezard `<system-reminder>` carries its facts as opening-tag attributes (`wezard=envelope|hint|lead|after|mention|roster|pending`, `kind` / `from` / `chat` / `scope`, the injection event id as `msg`) and its prose only for the model; which attrs each kind may write is the `REMINDER_KINDS` registry (each attr is either read back by code or an id the model copies into `re`/`for`/`drop`), and `renderTail` lays one injection's tail out in a fixed order, envelope first — rewording the prose never breaks parsing; only the current attribute envelope is parsed, without inferring facts from older prose. The rolepage collapses each reminder into a tag named by its kind (`<envelope · .x>`, `<回执 · .x · need>`, `<roster>` …) that expands to raw on click; no envelope = a human speaking in the session's home chat. A clone's transcript starts with its parent's forked history, so its rounds older than `bornAt` are dropped. Identity (name / responsibility / memory / lineage) lives in `wizard.ts`, not here. **Busy detection matches the TUI spinner footer** (`… (12m 31s · …)` on current versions, `esc to interrupt` on older ones) in the last 8 non-blank rows — transcript mtime is useless here, it goes quiet during long tool calls.
|
|
59
|
+
- `wizard.ts` is the identity layer over those sessions: a target key plus a **globally unique name** — the wizard's only address, written `.name` everywhere a human or model sees it (a chat's default session takes the chat's name, a slot takes its slot id; collisions get `-N` via `pickName`; `settleName` claims lazily, `settleAll` initializes unnamed current identities at boot, default sessions first). The slot id inside the key is NOT the name: a rename never rekeys a session. Plus a one-line responsibility, a long-term `memory` list, and a `parent` link for management ownership. Every collaborative spawn/clone belongs to its caller, including cross-cwd/chat creation and cloning context from another wizard; `forkOf` records a different context source. Horizontal communication does not change parent ownership. Ending an identity is limited to itself or its direct parent; active/paused plans prevent logical retirement, and children must be handled before their parent can be forgotten. Completed work retains wizard identities by default; pane resource eviction keeps identity and binding. The registry is a write-through json (`~/.wezard/wizards.json`, `wrc.mirror.wizardsFile`) bound process-wide via `bindWizardStore` so the IM side can read it too; everything else in the module is a pure renderer. **Identity travels as the first message's preamble, not the system prompt**: `renderCharter` builds the wizard's charter (who it is, its workspace, its clones, its memory, the chat's and the workspace's shared memory (`wizard-memory.ts`: `~/.wezard/memory/{chats,workspaces}/*.md`, human-editable, appended by `wizard_remember({scope})`), the tool roster, the orchestration playbook, the public-vs-private etiquette). `spawn-tmux` only parks it at `charters/<sid>.md` (claude/codebuddy no longer get `--append-system-prompt` — it cost ~1.4s per cold start); the attachment's `charterPending` prepends it as `<system-reminder wezard="charter">` to the pane's first non-slash injection and clears it once that injection is confirmed. It is re-armed on every moment a session has not read it: `/new`, a spare-pool claim, a dead-pane respawn, `/clear` and compaction (`onContextCut` → `armCharter`); a clone's opening line carries the child's charter, superseding the parent's inherited one. Read sides (`stripMeta`, `cleanUserText`, rolepage) strip/collapse the `charter` reminder, so it never becomes a chat ask or a bubble. Codex keeps it in `developer_instructions`. Every spawn path (`/new`, a dead-pane respawn, a clone) pulls it from `MirrorBridge.setCharterProvider`, installed in `index.ts`. Since a running wizard never sees a new charter, `config_set` renders every chartered wizard's charter before and after the change and tells the affected ones (and the caller) to `handoff` — generic over whatever config the charter reads. Backends with no such flag spawn without a charter rather than with a rejected flag.
|
|
60
60
|
- **Cloning is a context fork**: `MirrorBridge.cloneSession` spawns `--resume <parent sid> --fork-session`, so the child starts holding everything the parent had read while the parent is untouched — that is what makes "load the shared material once, then fan out" work. Two invariants: `--fork-session` is mandatory (without it a second pane appends to the parent's jsonl and two chats cross-wire), and the attach waits for the forked transcript (codebuddy 2.167 writes it at process start — a byte copy of the parent plus a `session-meta` row, no API call; older CLIs only on the first message); if it never appears the pane is killed rather than bound to the parent's sid.
|
|
61
|
-
- **Chats are public channels, wizard↔wizard is private by default.** `
|
|
61
|
+
- **Chats are public channels, wizard↔wizard is private by default.** `tell_peer` injects with `channel:""` and posts no bubble; `public:true` (the model decides) posts `emoji .a → .b` into the sender's current channel and the reply follows there. Spawn and collaboration lifecycle events post no extra bubbles; the initiator closes the work along the receiver chain that asked it. A chat with `chatPolicy.<chat>.topOnly` (top-level-only mode) on — **the default since 2026-10-15: only an explicit `false` turns it off** — goes further (daemon-enforced in `tellPeerAs` / `/notify`): every wizard↔wizard line there is private regardless of `public`, and a wizard whose turn is working for a peer (a private peer task, or a receipt whose row serves a peer task) may not `notify` it (the steward is exempt in its own chat) — the charter tells top-level wizards to explain the result in their own words. The same switch also arms the steward hand-brake (`approval.ts` / `steward-guard.ts`) on that chat's default session: the untagged session may not edit files or open subagents, and caps its own look-commands per turn at `stewardBudget` (reading code — Read/Grep/Glob and read-only shell commands — passes free).
|
|
62
62
|
- **`tell_peer` delivery policy** (`priority`) only matters when the target is busy: `normal` (default) waits for its turn to end before pasting — two senders pasting into one busy box get read as one turn; `urgent` presses Esc first (the same interrupt as `stop_wizard`, without the teardown that would drop others' queued lines); `now` pastes into the running turn (interject, answer its question; the default for `re`).
|
|
63
|
-
- `daemon/router.ts`
|
|
64
|
-
- `shared/turn-state.ts` is the one vocabulary for an in-flight task: `Terminal` (the receipt statuses that settle it) plus `working` / `blocked` (parked on an approval) / `needs-input` / `errored` / `deferred`, computed on read from the route row and one pane probe — roster, peek and
|
|
65
|
-
- `
|
|
63
|
+
- `daemon/router.ts` is the durable route ledger: one event records its owner, receiver and state in `~/.wezard/routes.jsonl`; `move` changes ownership, while `open` merges duplicate unfinished work for the same owner/receiver and retains event aliases for replay. A single owner has at most one unfinished task per wizard receiver. Message `kind` describes intent; `return` selects route behavior (`self` by default, `none` creates no route, `self` / `detach` open or supplement a receiver task, and `transfer` moves ownership along an existing route). The MCP `fyi` description promises no receipt, but `fyi` does not automatically set `return:"none"`; pass `return:"none"` when no route is intended. A final may address multiple receivers with `@.name RESULT:`; `message-events.ts` binds each section to a task and the consumed input ids recorded in `inputIds`, so a result cannot settle a task while a same-turn supplement remains unread. `need` and `error` remain intermediate route states; explicit results and final outcomes are committed before durable inbox or chat delivery. Message events persist `execution` separately from `exposure`; confirmed non-delivery can retry, while an uncertain transport ACK remains uncertain until evidence or explicit reconciliation, preventing blind duplicate delivery. Boot and the event pump reconcile durable events with transcript, pane, route and outbox evidence. There is no deadline sweeper that fabricates `timeout`, `silent` or `dead` route outcomes. `NO_DEADLINE` is a finite sentinel and must not be interpreted as a timestamp. Route history is compacted with retained batches and aliases so delayed inputs still resolve to their task. `stop_wizard` cancels eligible unexposed work; exposed or uncertain events stay subject to evidence-based reconciliation.
|
|
64
|
+
- `shared/turn-state.ts` is the one vocabulary for an in-flight task: `Terminal` (the receipt statuses that settle it) plus `working` / `blocked` (parked on an approval) / `needs-input` / `errored` / `deferred`, computed on read from the route row and one pane probe — roster, peek and receiver duty views print the same words (`在等` / `欠着`).
|
|
65
|
+
- **Teams plans** (`shared/plan.ts`, `daemon/plans.ts`, `daemon/plan-http.ts`, `daemon/plan-reminders.ts`): each wizard may own multiple mutable DAG plans. `plan_create/get/list/update` expose explicit owner-managed state; only the owner writes, and `revision` is a compare-and-swap guard. Replacing `tasks` replaces the whole DAG. The store validates dependencies, task/plan states and terminal plans, uses owner-scoped `requestId` creation idempotency, and fsyncs an append-only `wrc.mirror.plansFile` journal (`~/.wezard/plans.jsonl` by default) before publishing changes in memory. Corrupt history or failed IO makes plan operations and retirement checks fail closed with 503 while receiver messaging remains available. The daemon never assigns executors, dispatches ready nodes, accepts plan task completion or advances plan state automatically; the owner thinks, delegates, reviews and updates explicitly. Clear, low-risk coding goes to light; independent reviewers start blank and use a tier appropriate to the review risk.
|
|
66
|
+
- **Plan association and reminders**: the first related dispatch carries explicit `planId`; continuations may inherit the original inputs' unique association. Each input keeps its own plan metadata and `inputIds`; different planIds never change receiver merging or routing. Ordinary messages remain allowed when several plans share a debt. Only the owner's associated outgoing unresolved work suppresses its plan reminder. `origin` preserves reply context rather than establishing plan association. Active plans are reminded only while the owner is idle and not handing off; paused plans stop reminders while messaging continues. A stable plan/revision/token event is revalidated before delivery. Proven-unexposed, retryable reminder failures keep the same queued event with backoff capped at 60 seconds; possible exposure or uncertain submission never triggers blind reinjection. The persisted reminder marker does not increment the plan revision.
|
|
66
67
|
- `notices.ts` is the other half of awareness. A charter's roster is a spawn-time snapshot and only gets staler; a variation (a birth, a `stop_wizard`, a changed job description, a chat getting named) posts one line into each affected wizard's in-memory box, and the next text injected into that pane — from a human, a peer or a scheduled task — carries it along as a `<system-reminder>`. No extra turn, no bubble, no transcript. Delivery clears the box: a notice is a hint, the truth is always `wizard_roster`.
|
|
67
68
|
- `chat-name.ts` turns a chat's unreadable `chat:wr…` id into a readable name (which its default wizard inherits), and auto-fills one from the workspace basename when nobody named it. The fill happens wherever a name is about to be handed to a model — including `renderCharter`, since a system prompt outlives the process that read it. Fill-only; a human-chosen name is never overwritten.
|
|
68
69
|
- `tasks.ts` fires a scheduled prompt into a target wizard's session — exactly equivalent to someone saying it in the chat at that moment. Lives in the daemon, not in a session, so a CLI restart / `/clear` / session end can't carry it away. It runs one fixed skeleton per shot — `trigger → gate → render → dispatch` — and nothing else: the *specifics* of each stage live in the task's own file, because a schedule is "run this logic at this time" and logic does not fit in json.
|
|
69
70
|
- A task is `~/.wezard/tasks/<id>.task.mjs`, an ES module exporting `when` / `gate` / `prompt` / `target`+`fresh` / `owner` (the wizard that scheduled it — its rolepage shows the task under 日程) — **the config is source the wizard edits directly** (hot-reloaded by mtime; a file that fails to load keeps its previous version running and surfaces the reason in `list_tasks`). Source stays source: `lastFired` and the gate's cross-round memo live in `~/.wezard/task-state.json`, so the daemon never writes back over a file a wizard just edited.
|
|
70
71
|
- `shared/trigger.ts` is the trigger AST (Specification + Interpreter). **Clock vs Guard is the whole point**: `every`/`daily`/`at` produce instants and answer "when next", `between`/`onDays`/`not` only veto. `and(clock, …guards)` is their intersection — that's what makes "白天每小时" expressible, and why `nextFire` enumerates clock candidates and picks the first one every guard passes. An AST, not a closure, because it must be renderable (`每 1 小时 · 08:00-21:00`), storable and drawable. `shared/schedule-spec.ts` under it is pure lexer (weekday / time-of-day / interval / window) — it grows with how people speak, the AST grows with how things are computed.
|
|
71
72
|
- `gate` (`task-gate.ts`) runs **in a child process with a timeout**: it is user/wizard-written code that shells out, and a wedged gate must not stall every other schedule — timeout, throw and crash are all the same verdict, *hold fire this round*. Returning `false` costs nothing and says nothing; that is how "only if there's work" stops spending a pane per empty round. A gate **error** posts one bubble (only on the good→bad transition) — a broken gate's silence is indistinguishable from "nothing to do today".
|
|
72
|
-
- **rolepage** (`shared/role-view.ts` pure view model, `shared/role-render.ts`, served by `shared/chat-http.ts` as `/role?id=…&role
|
|
73
|
-
-
|
|
73
|
+
- **rolepage** (`shared/role-view.ts` pure view model, `shared/role-render.ts`, served by `shared/chat-http.ts` as `/role?id=…&role=…`; frontend `web/chat.js`): one role's IM — every group chat and single chat (human or wizard DM) it took part in. Each turn folds into two messages (in: speaker/peer/task → wizard; out: wizard → them); own messages right, others left, clicking an avatar/name changes the page role, while clicking the blank opposite a bubble changes only the detail `viewpoint`. Role facts and plans are filtered to the ticket's bot. The standalone svr receives `WorldFacts.plans`; active/paused plan owners and their registered management ancestors remain visible. The plan/schedule view reads plan status, tasks, dependency titles and pause reasons; it provides no plan editing controls. The sidebar and relationship cards share the same conversation/window/unread implementation.
|
|
74
|
+
- **Retired orchestration**: jobs, workflow runners and the graph executor, their MCP/HTTP entry points and `jobsFile`/`receiptsFile` configuration are removed. Peer requests reject retired orchestration fields such as `job`, `node`, `role`, `workflow`, `graph` and `detached`. No legacy runner or migration fallback is provided. The relationship graph remains part of rolepage; generic idle waiting lives in `daemon/wait-idle.ts`.
|
|
74
75
|
|
|
75
76
|
**Configuration** (`shared/config.ts`):
|
|
76
77
|
- Loaded by every binary via `loadConfig()`. Resolution order: explicit arg → `$WEZARD_CONFIG` → `~/.wezard/config.jsonc` → `~/.wezard/config.json`.
|
|
@@ -79,16 +80,16 @@ Three processes, all coordinating via 127.0.0.1:17890 and `~/.wezard/`:
|
|
|
79
80
|
- `shared/config-writer.ts` is the only sanctioned way to mutate the on-disk jsonc — it preserves comments via `jsonc-parser` edits. `cli/init.ts`, `daemon/claim.ts` and `daemon/chat-name.ts` use it.
|
|
80
81
|
|
|
81
82
|
**Shared primitives** — reach for these before writing a local copy:
|
|
82
|
-
- `shared/json-map-store.ts` (`loadJsonMap`) is the write-through keyed-JSON file behind `mirror-store.ts
|
|
83
|
+
- `shared/json-map-store.ts` (`loadJsonMap`) is the write-through keyed-JSON file behind recovery state such as `mirror-store.ts` and `wizard.ts`. Its tolerant reads/writes must not be reused for durable plan state: `daemon/plans.ts` owns the stricter fsync journal and health checks.
|
|
83
84
|
- `shared/exec-path.ts` (`augmentedPath`) — PATH widening for every daemon-side spawn.
|
|
84
85
|
- `shared/std.ts` — `sleep`, `truncate`, `truncateWithCount` (`…(+N)`), `clipLine` (collapse whitespace, then cut).
|
|
85
86
|
- `shared/paths.ts` (`expandHome`, `sanitizeId`), `shared/session-label.ts` (`tagOfKey` / `baseOfKey` / `withTagHeader` / `nameTokenRe` / `displayName` — use these names, don't re-alias them locally; names reach it through the injected `TagLinker`, since `shared/` can't import the daemon registry).
|
|
86
87
|
|
|
87
88
|
**Hook + sync**:
|
|
88
89
|
- `hooks/hooks.json` is registered automatically by Claude Code when the plugin is installed (uses `${CLAUDE_PLUGIN_ROOT:-${CODEBUDDY_PLUGIN_ROOT}}` so the same file works under CodeBuddy's plugin loader if ever published there).
|
|
89
|
-
- For non-plugin installs (`claude-internal` wrapper), `cli/sync.ts` writes the MCP server entry + `WEZARD_DAEMON_BASE` env into target `settings.json`s listed in `config.sync.targets`. **It deliberately
|
|
90
|
+
- For non-plugin installs (`claude-internal` wrapper), `cli/sync.ts` writes the MCP server entry + `WEZARD_DAEMON_BASE` env into target `settings.json`s listed in `config.sync.targets`. **It deliberately removes its own direct hook entries** for `kind:"claude"` targets — registering both the plugin's `hooks.json` AND a settings.json hook fires the hook twice per tool call (= duplicate cards). For `kind:"codebuddy"` targets, since the wezard plugin is not published to CodeBuddy's marketplace, sync **writes the hook directly into `~/.codebuddy/settings.json`** with an absolute path to `hooks/pre-tool-use.sh` — this is the only registration path for CodeBuddy. `~/.wezard/sync.lock.json` tracks what was written so `--remove` is reversible. `~/.wezard/state/approval-mode` is the runtime override on top of that registration (`wezard use cli|wecom`): the file holds `cli` (absent = `wecom`), the hook reads it with a bare `cat` **before** it touches jq or the daemon and then exits 0 with no output — the CLI's own permission flow answers — while `daemon/approval.ts`, the picker sentinel and `cli/codex-hook.ts` treat the same file as "no cards, no auto-press". **A hook that cannot reach the daemon answers nothing, never `allow`**: silent auto-allow would hand a pane every permission while the human still believes approval is on. It waits only when the service is still registered (`launchctl print` / systemd `LoadState`), so `wezard stop` degrades to local CLI immediately instead of burning the 60s resume budget.
|
|
90
91
|
|
|
91
|
-
**MCP server** (`mcp/server.ts`): stdio transport, completely stateless w.r.t. WeCom. Every tool just `POST`s to the daemon. Add a tool here AND a route handler in `daemon/`. The collaboration tools (`wizard_whoami` / `wizard_identity` / `wizard_roster` / `spawn_wizard` / `clone_wizard` / `stop_wizard` / `wizard_remember` / `
|
|
92
|
+
**MCP server** (`mcp/server.ts`): stdio transport, completely stateless w.r.t. WeCom. Every tool just `POST`s to the daemon. Add a tool here AND a route handler in `daemon/`. The collaboration tools (`wizard_whoami` / `wizard_identity` / `wizard_roster` / `spawn_wizard` / `clone_wizard` / `stop_wizard` / `wizard_remember` / `handoff` / `set_model`, `read_chat`, plus the older `peek_peer` / `tell_peer` / `wait_peer`, plus `plan_create/get/list/update`) all send `selfRef()` = `{sessionId, tmuxPane}` so the daemon can resolve *which* session is asking — env sessionId goes stale after a `/clear`, pane id doesn't. Discovery is layered: the charter (`renderCharter`) carries one "when to use" line per tool and is the only part guaranteed in context — Claude Code defers MCP tool schemas behind ToolSearch — while each tool description carries the mechanism and parameters. Keep the two from restating each other. Address parameters are `name` / `names` (`fix` / `.fix`); retired `tag` / `tags` parameters and the `send_peer`, `dispatch`, and `wizard_handoff_self` tool aliases are removed. Internal target keys and route merge aliases remain current identities, not compatibility addresses.
|
|
92
93
|
|
|
93
94
|
## Important patterns / pitfalls
|
|
94
95
|
|
package/README.md
CHANGED
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
1. 🪞 **远程控制本机 Agent CLI** — 企业微信里发的消息原样落进 CLI 输入框;Agent 的回复、工具调用、思考过程实时同步回聊天。回到电脑前 `tmux attach -t wezard` 接着干,对话一字不少。支持 `claude` / `claude-internal` / `codebuddy` / `codex`。
|
|
26
26
|
2. 🛎 **远程审批** — Agent 要跑 `Bash` / `Edit` 时审批卡直推 IM:`✅` 放行一次、`⏱` 一段时间内自动放行、`✅总是` 记成规则、`❌` 拒绝。危险操作(`rm` / 强推 / `DROP` / 敏感路径)每次都要单独确认;做完计划推计划卡(`✅同意` / `✏️继续改`),Agent 提的选择题变成投票卡。
|
|
27
27
|
3. 🧙 **多 wizard** — 每个会话是一个有名字的 wizard,写作 `.name`,全局唯一,在任何群里都叫得到;有职责、有记忆,看得见彼此在干什么。克隆一个分身让它继承当前上下文,或者从白板新起一个;按活的难度挑档位(`mini` → `ultra`,从 haiku 到 opus·max)。
|
|
28
|
-
4. 🎩 **管家分派** — 没点名的话落到聊天的默认 wizard:一两句能答完的它自己答,其余一步 `
|
|
28
|
+
4. 🎩 **管家分派** — 没点名的话落到聊天的默认 wizard:一两句能答完的它自己答,其余一步 `delegate` 给对口的那个或新起一个;要 coder + reviewer 来回几轮的复杂活交给一个 lead 带队。管家有手闸,想自己埋头改代码会被拦下改去分派。
|
|
29
29
|
5. 📮 **派完就放手** — wizard 之间派活不必守着等:对方那一轮一结束,守护进程把它的结论作为新的一轮自动送回发话方;对方反问(`NEED:`)就接着答,闲着不交差会被追问一句,没了结的事由守护进程替管家记着。
|
|
30
30
|
6. 🔝 **顶层模式** — 开了之后群里只有管家和你点名的那个说话,wizard 之间的往来全在私下,结论由顶层用自己的话讲给你。
|
|
31
31
|
7. 🧠 **三层记忆** — 自己的、本群共享的、本工作区共享的。「这个仓库 reload 要先 build」这类约定写一次,之后每个新 wizard 开局就知道;共享的两层由守护进程定时起一个整理者去重合并。
|
|
32
|
-
8. 🪪 **rolepage** — 每个 wizard 视角下的 IM:`⌘K` 搜遍 role / 会话 /
|
|
32
|
+
8. 🪪 **rolepage** — 每个 wizard 视角下的 IM:`⌘K` 搜遍 role / 会话 / 消息,关系图看清谁和谁对过话,计划视图查看 DAG、依赖与进度,用量条一眼看出模型、档位、上下文、token 与估算费用。
|
|
33
33
|
9. ⏰ **定时任务** — 「每个工作日晚上 9:30 跑一遍回归」,到点自动起一个 wizard 去干,结果发回群里;可以设成「有事才说」。任务本身是一个可以直接编辑的 `.mjs` 文件,存盘即生效。
|
|
34
34
|
10. 🔍 **详情页与主动汇报** — 每次工具调用、审批请求都有详情页,IM 里点链接看完整 input / result / git diff;Agent 也能主动把一段话贴进任意一个群。
|
|
35
35
|
11. 🎛 **说人话改配置** — 「把这个群改成顶层模式」「hard 档换成 opus·max」,它查清这一项的说明与默认值再改;放权类的改动(审批、白名单)推一张确认卡等你点。
|
|
@@ -135,11 +135,11 @@ wezard init
|
|
|
135
135
|
|
|
136
136
|
**管家**
|
|
137
137
|
|
|
138
|
-
每个聊天的默认 wizard
|
|
138
|
+
每个聊天的默认 wizard 是这个群的**管家**,档位由 `models.router` 指定(缺省 `standard`),模型与 effort 从当前后端的 `models.backends.<backend>.tiers` 取值。没点名的话都落到它这儿——一两句能答完的(问进度、谁在干什么、闲聊)自己答;要读很多代码、改文件、跑很久的活,哪怕它自己做得了也**派出去**:它一忙,这个群里没点名的话就都排在它后面。
|
|
139
139
|
|
|
140
|
-
派活是一步 `
|
|
140
|
+
派活是一步 `delegate`:守护进程先列候选——谁的职责、最近的话、读过的文件和这件活有交集,在不在同一个工作区,忙不忙,上下文多重、缓存冷没冷——再给一个默认决定:证据够强、不忙、接着用那段上下文划算的头一个候选就交给它,否则从白板新起一个,档位按活定(一句话小活 `light`、常规 `standard`、带队 `hard`)。管家照办,或显式推翻(点名、硬要新的、换档)。
|
|
141
141
|
|
|
142
|
-
**复杂的活交给 lead
|
|
142
|
+
**复杂的活交给 lead**:要拆成多阶段、需要 coder 与 reviewer 配合的任务,管家交给一个 lead。lead 维护自己的 plan,按当前阶段创建所需 wizard,验收回复后显式更新计划并继续推进。范围清楚、低风险的编码交给 `light`;独立 reviewer 从白板起步,按审查难度选档。计划暂停、恢复、完成或取消都由 owner 明确决定。
|
|
143
143
|
|
|
144
144
|
```mermaid
|
|
145
145
|
flowchart LR
|
|
@@ -147,12 +147,12 @@ flowchart LR
|
|
|
147
147
|
msg -- "没点名" --> butler(["管家"])
|
|
148
148
|
butler -- "一两句的事" --> self["自己答"]
|
|
149
149
|
butler -- "要组队的复杂活" --> lead["hard 档 lead"]
|
|
150
|
-
butler -- "其余 ·
|
|
150
|
+
butler -- "其余 · delegate" --> pick{"有对口、不忙、<br/>划算的 ?"}
|
|
151
151
|
pick -- "有" --> exist["交给它"]
|
|
152
152
|
pick -- "没有" --> fresh["白板新起一个"]
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
-
**手闸**:管家常常说着分派、实际埋头自己干。守护进程在审批链最前面拦它——改文件、开子代理一律拒;读、搜、跑命令每轮最多 4 次(`chatPolicy.<群>.stewardBudget`),超了就拒并叫它 `
|
|
155
|
+
**手闸**:管家常常说着分派、实际埋头自己干。守护进程在审批链最前面拦它——改文件、开子代理一律拒;读、搜、跑命令每轮最多 4 次(`chatPolicy.<群>.stewardBudget`),超了就拒并叫它 `delegate`。放行窗口、`✅总是`、跳过所有审批都压不过这道闸。
|
|
156
156
|
|
|
157
157
|
**转交默认是公开的,但顶层模式默认开着**:把某个群显式写成 `chatPolicy.<群>.topOnly = false` 之后,群里才会出现一条 `.管家 → .它` 的气泡、它的回复也直接发进这个群(管家只回一句「已转给 `.它`」);默认(不写)顶层模式是开的,wizard 之间的往来一律私聊,群里只看到管家自己的结论。
|
|
158
158
|
|
|
@@ -178,50 +178,53 @@ flowchart LR
|
|
|
178
178
|
| 记到这个群 / 这个仓库的记忆里 | 提交到群或工作区的共享记忆,之后来的 wizard 开局就知道 |
|
|
179
179
|
| 还有谁在跑 / 谁在弄那个项目 | 列出全部 wizard:名字、职责、忙闲、谁是谁的分身 |
|
|
180
180
|
| 让 .fix 看一眼这个报错 | 它把活交给 `.fix` 就放手去干别的,`.fix` 的结论自动送回来,它再答你 |
|
|
181
|
-
| 分个身去把这三个目录都扫一遍 |
|
|
182
|
-
| 还有哪些事没了结 |
|
|
181
|
+
| 分个身去把这三个目录都扫一遍 | 分出三个带着当前上下文的分身并行干,完成后默认保留 |
|
|
182
|
+
| 还有哪些事没了结 | 管家列出派出去仍未完成的、等你拍板的 |
|
|
183
183
|
| 这个群关掉顶层模式(默认是开的) | 关顶层模式,wizard 之间的往来回到群里可见 |
|
|
184
184
|
| 切到 /path/to/proj | 换工作区,重开会话 |
|
|
185
185
|
|
|
186
186
|
- **记忆分三层**:自己的、本群共享的、本工作区共享的。「这个群习惯先出方案再动手」「这个仓库 reload 要先 build」不必每来一个新 wizard 再教一遍。共享的那两层是**提议**——守护进程每 30 分钟看一眼,有提议才起一个整理者去重、改写、合并(已经写在仓库 `CLAUDE.md` 里的不再收),所以不会立刻生效,也不会被几十个 wizard 越写越长;合并后在场读这份记忆的 wizard 下一条消息会收到一行「记忆已更新」。
|
|
187
187
|
- **分身继承上下文**:分身开局就带着原 wizard 读过的全部材料,原 wizard 不受影响;也可以生一个白板的子 wizard,顺便换个工作区。分身还能再分身。
|
|
188
|
-
- **模型按档挑**:生分身时给一个档位,由轻到重 `mini` / `light` / `standard` / `hard` / `ultra
|
|
189
|
-
- **派完就放手**:wizard
|
|
190
|
-
- **群里只留结论**:wizard
|
|
188
|
+
- **模型按档挑**:生分身时给一个档位,由轻到重 `mini` / `light` / `standard` / `hard` / `ultra`,在 `models.backends.<backend>.tiers` 配置;也可以直接点模型与 effort。新 pane 的 CLI 统一由 `wrc.defaultCli` 决定,档位记进绑定,死 pane 重生、交接重开按当前后端解析。
|
|
189
|
+
- **派完就放手**:wizard 之间说一句就走,不守着等;结论按持久 route event 送给 receiver(发起者)。owner 是当前欠答的执行者;receiver 收到 `NEED:` 后用显式 `re` 继续同一件。对方持续闲置时守护进程可代问进展。路由不会因 deadline 到期或 pane 消失自动生成失败结论;注入与回执是否送达由持久事件和 transcript/session/ACK 证据恢复。对方正忙时默认等它这一轮结束再投,急事可以打断它或直接插话。
|
|
190
|
+
- **群里只留结论**:wizard 之间派活、来回默认是私聊,不刷群;生分身、更新计划、交接这类过程也不进群。群里只出现回给你的那条回复、通知、定时任务的 ⏰,以及它们主动公开的讨论。过程想看去 [rolepage](#rolepage)。
|
|
191
191
|
- **上下文过了 200k 自己交接**:手上这摊告一段落,它就把工作压成一份简报、原地换一个全新会话接着干,名字和职责都不变——交接不是压缩,大上下文每一轮都在付钱。交接那几秒里进来的话(人说的、同伴派的、回执、定时任务)一律等它重开完再送进去,一句不丢。
|
|
192
192
|
|
|
193
193
|
---
|
|
194
194
|
|
|
195
195
|
## 任务编排
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
当前工具与地址只使用现行名称:`delegate`、`tell_peer`、`handoff`,地址参数为 `name` / `names`。旧工具别名、`tag` / `tags` 参数、旧配置和定时格式自动迁移已移除。route 的 merge alias 和有限 `NO_DEADLINE` 仍是当前持久化语义,依据见[receiver 路由方案](docs/evolve/receipt-router.md#版本兼容与当前语义边界)。
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
**Wezard Teams** 用 plan 保存复杂任务的 DAG、进度与结论。每个 wizard 可以同时维护多个 plan,每个 plan 只有一个 owner;owner 可以逐步添加任务、调整依赖、安排并行工作,并在验收后显式推进状态。
|
|
198
201
|
|
|
199
202
|
```mermaid
|
|
200
203
|
sequenceDiagram
|
|
201
|
-
autonumber
|
|
202
204
|
participant U as 群里的人
|
|
203
|
-
participant W as
|
|
204
|
-
participant
|
|
205
|
-
|
|
206
|
-
U->>W:
|
|
207
|
-
|
|
208
|
-
W->>K:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
W->>U:
|
|
213
|
-
Note over W,K: 收工, 为这单活生出来的分身整批回收
|
|
205
|
+
participant W as plan owner
|
|
206
|
+
participant D as daemon
|
|
207
|
+
participant K as 当前阶段的 wizard
|
|
208
|
+
U->>W: 一件复杂任务
|
|
209
|
+
W->>D: 创建或更新 plan
|
|
210
|
+
W->>K: 派发当前阶段的工作
|
|
211
|
+
K-->>W: 结论自动回执
|
|
212
|
+
Note over W: 思考并验收,显式更新 DAG 与状态
|
|
213
|
+
W->>D: 推进、暂停、恢复、完成或取消 plan
|
|
214
|
+
W->>U: 用自己的话交代结果
|
|
214
215
|
```
|
|
215
216
|
|
|
216
|
-
-
|
|
217
|
-
-
|
|
218
|
-
-
|
|
219
|
-
-
|
|
220
|
-
-
|
|
221
|
-
-
|
|
222
|
-
-
|
|
217
|
+
- **计划由 owner 推进**:daemon 持久保存 DAG、校验依赖并提醒进度;任务不会因为依赖完成就自动派发,回执也不会自动更新 plan。并行节点由 owner 自己安排与验收。
|
|
218
|
+
- **工具入口**:`plan_create` 创建自己的计划;`plan_get` 读取完整 DAG;`plan_list` 列出自己的计划,也可按 wizard 名字只读查询;`plan_update` 用 revision 更新计划,提交的 tasks 替换整份 DAG。
|
|
219
|
+
- **状态**:任务有 `pending`、`in_progress`、`completed`、`canceled`;计划有 `active`、`paused`、`completed`、`canceled`。依赖完成后才能将后继任务推进为进行中或完成。完成计划前,所有任务必须完成或取消;取消与完成分别记录。
|
|
220
|
+
- **消息关联**:第一次为某个计划派活时显式带 `planId`。续问可继承原输入唯一的关联;同一欠账涉及多个计划时,未指定 `planId` 的普通消息照常投递,不猜关联。`planId` 逐输入保存,不拆分 receiver task,也不阻止不同计划的输入合并。
|
|
221
|
+
- **提醒**:active plan 的关联欠账仍未结束、owner 正忙或正在交接时暂不提醒。暂停只停计划提醒,消息与回执继续流转;修改计划或关联输入变化后,按新的提醒标记重新判断。
|
|
222
|
+
- **管理树**:创建的 wizard 始终归调用者管理;跨工作区、跨聊天创建,或从其他 wizard 克隆上下文,都不改变这个 parent。wizard 可直接横向协作,再回到自己的主流程交付。
|
|
223
|
+
- **保留与退役**:工作完成后默认保留 wizard;pane 资源回收保留身份与绑定。逻辑退役前必须先完成或取消其 active/paused plans,直属子 wizard 也须处理完毕后才能忘记 parent。
|
|
223
224
|
|
|
224
|
-
|
|
225
|
+
回执按持久路由记录关联到任务和接收者:owner 是当前执行并欠答的一方,receiver 是结论与追问的上游接收者。一个 owner 对同一 wizard receiver 同时只有一件未完成 task。`kind` 表示消息意图;route 是否创建及其 receiver 由 `return` 决定:缺省 `self`,`none` 不建 route,`self` / `detach` 新建或补充 receiver task,`transfer` 沿已有 route 转移 owner。要确保不建 route,显式传 `return:"none"`,包括只作知会的 `fyi`。wizard task 的结果从行首用 `@.name RESULT:` 指明接收者;若需要称呼,将称呼单独放一行。daemon 按已消费的输入证据绑定结果,避免旧轮或未读补充误结案。ACK 不确定时保留待核对状态,不盲目重发,也不因等待时间或 pane 消失合成失败结论。
|
|
226
|
+
|
|
227
|
+
旧工单、workflow runner 与 graph 执行器已移除;`open_job`、`close_job`、`list_jobs` 和旧 workflow/graph 工具不再提供。循环与迭代任务也由 owner 更新 plan 并逐轮安排。
|
|
225
228
|
|
|
226
229
|
---
|
|
227
230
|
|
|
@@ -235,7 +238,7 @@ sequenceDiagram
|
|
|
235
238
|
- **未读**:会话项右边的红点只数点开这一项看得到的;名字旁的数字是切到那个 role 之后它能看到的全部未读。已读全局只记一份,在任何一处读过,各处一起消掉。
|
|
236
239
|
- **`⌘K` 搜索**:按 role 名字、会话名、消息正文搜,键盘选中回车直接跳到那个会话的那一句;空查询时是最近会话的快速切换器。
|
|
237
240
|
- **关系图**:一棵树把家谱(谁是谁的分身)和对话(谁和谁说过话、几次)画在一起,人也是节点。卡片就是会话项——排序、最近一句、时刻、未读、忙闲都和会话列表同一份实现;点卡片打开它与图上相连者之间的往来。
|
|
238
|
-
-
|
|
241
|
+
- **计划视图**:在「计划 / 日程」入口只读查看当前 wizard 的 plans,包括状态、任务进度、依赖与暂停原因;依赖显示对应任务标题。暂停中的计划及其 owner 保持可见。修改计划由 owner 通过 plan 工具完成。
|
|
239
242
|
- **忙闲**:空闲 / 执行中 / 等人点(停在审批卡或提问卡上,紫色)/ 已关闭。
|
|
240
243
|
- **用量条**:页脚两条,一条是当前视角,一条是窗口对端那个 wizard——模型与 effort 档位、估算费用(按 LiteLLM 价格表逐轮计)、轮次、工具调用、API 请求、上下文,以及 cache read / input / cache write / output 的分布。
|
|
241
244
|
- **名片**:名字、职责、工作区、模型与忙闲;点名字复制 `.name`;历史会话切换(默认看全部);日程列出它名下的定时任务。
|
|
@@ -335,15 +338,7 @@ sequenceDiagram
|
|
|
335
338
|
|
|
336
339
|
## 多 CLI 后端
|
|
337
340
|
|
|
338
|
-
`claude` / `claude-internal` / `codebuddy`
|
|
339
|
-
|
|
340
|
-
```
|
|
341
|
-
/new 沿用当前会话的 CLI 新开
|
|
342
|
-
/new codebuddy 换到 codebuddy 新开
|
|
343
|
-
.docs /new codebuddy 用 codebuddy 叫出一个叫 docs 的 wizard
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
会话一直留在它所属的 CLI 上,`/clear`、重启自愈都不会换。默认后端由配置项 `wrc.defaultCli` 决定(缺省 `claude`)。
|
|
341
|
+
支持 `claude` / `claude-internal` / `codebuddy` / `codex`。daemon 可同时读取不同后端的现有会话;新 pane 的 CLI 统一由 `wrc.defaultCli` 决定(缺省 `claude`)。`/new [model] [第一句]` 可选择模型并开始新会话,不再接受单次 CLI 选择参数;原生 clone 仍按父会话实际后端处理 fork。
|
|
347
342
|
|
|
348
343
|
---
|
|
349
344
|
|
|
@@ -354,13 +349,14 @@ IM 里发 `/help` 可随时拉出完整命令表;每次 `/new`、`/clear` 之
|
|
|
354
349
|
```
|
|
355
350
|
/new · /clear · /stop · /n · /kill 会话控制(/kill 连 pane 一起收掉)
|
|
356
351
|
/sessions [emoji|id] 列出 / 切换 live 会话
|
|
357
|
-
[.name] /new
|
|
352
|
+
[.name] /new [model] [第一句] 按配置后端重开 / 挑模型 / 叫出新 wizard
|
|
358
353
|
/reveal 把终端的 tmux 窗口切到本会话
|
|
359
354
|
/peers · /wizards 本聊天的 wizard:名字、职责、忙闲、家谱
|
|
360
355
|
/name [名字|-] · /chats 给本聊天起名 / 跨聊天目录
|
|
361
356
|
/wx · /wx bind|code|unbind 微信 ClawBot:状态 / 扫码绑定 / 解绑(审批人)
|
|
362
357
|
/id · /pwd · /usage · /cost · /audit 信息查询(免授权)
|
|
363
358
|
/cfgsync [apply] 预演 / 执行跨 CLI 项目配置同步
|
|
359
|
+
/use [cli|wecom] 审批交给本地 CLI 弹框 / 交回企微卡片(无参 = 看当前)
|
|
364
360
|
/help 全部命令
|
|
365
361
|
```
|
|
366
362
|
|
|
@@ -373,15 +369,13 @@ wezard send <chat> <text> # 主动推消息
|
|
|
373
369
|
wezard sync # 重写 hook/MCP/env 进各 settings.json
|
|
374
370
|
wezard wx [bind|list|unbind] # 微信 ClawBot:终端扫码绑定 / 查看 / 解绑
|
|
375
371
|
wezard reload # 重启 daemon(改了配置后用)
|
|
376
|
-
wezard
|
|
372
|
+
wezard use [cli|wecom] # 审批交给本地 CLI 弹框 / 交回企微卡片(无参 = 看当前)
|
|
377
373
|
wezard unsync # 卸载 hook/MCP(保留 daemon)
|
|
378
374
|
wezard uninstall # 完整卸载(先于 npm uninstall)
|
|
379
375
|
```
|
|
380
376
|
|
|
381
377
|
> ⬆️ **升级**:`npm i -g wezard@latest` 装新版二进制,再 `wezard sync && wezard reload` 刷新 hook/MCP 注入并重启 daemon(幂等,`~/.wezard/` 的 config/secrets 原样保留)。
|
|
382
378
|
>
|
|
383
|
-
> `wezard migrate` 只用于从**旧包名 `weclaude`** 迁移(搬 `~/.weclaude` → `~/.wezard`、重装 daemon/插件),普通版本升级用不到。
|
|
384
|
-
>
|
|
385
379
|
> ⚠️ **卸载顺序**:先 `wezard uninstall` 再 `npm uninstall -g wezard`。否则 launchd/systemd 会一直尝试拉起已删除的二进制。`~/.wezard/` 下的 config/secrets 不会被清,二次安装可无缝复用。
|
|
386
380
|
|
|
387
381
|
---
|
|
@@ -428,7 +422,7 @@ npm run dev:daemon # tsx 直跑 daemon,热迭代不用装
|
|
|
428
422
|
./cli/wezard.sh logs -f
|
|
429
423
|
```
|
|
430
424
|
|
|
431
|
-
架构与模块职责见 [CLAUDE.md](CLAUDE.md)
|
|
425
|
+
架构与模块职责见 [CLAUDE.md](CLAUDE.md)。运行时改动需跑 `npm run typecheck` 与适用的 `tests/*.test.ts`;测试脚本逐个用 `npx tsx` 执行,没有 `npm test` 入口。
|
|
432
426
|
|
|
433
427
|
## License
|
|
434
428
|
|
|
@@ -443,14 +437,13 @@ npm run dev:daemon # tsx 直跑 daemon,热迭代不用装
|
|
|
443
437
|
{
|
|
444
438
|
"wrc": {
|
|
445
439
|
"defaultCli": "codex",
|
|
446
|
-
"cliBackends": { "codex": { "bin": "codex" } },
|
|
447
440
|
"extraArgs": [],
|
|
448
441
|
"mirror": { "projectsDir": "" }
|
|
449
442
|
}
|
|
450
443
|
}
|
|
451
444
|
```
|
|
452
445
|
|
|
453
|
-
执行 `wezard reload` 后,企业微信 `/new`
|
|
446
|
+
执行 `wezard reload` 后,企业微信 `/new` 使用 `wrc.defaultCli` 配置的 Codex 后端,不接受单次 CLI 覆盖参数。各后端读取自己的 `models.backends.<backend>.tiers`,不再读取旧顶层模型档;CLI 使用规范命令名,由 daemon 的启动 PATH 查找,不再提供 `bin` 路径覆盖。
|
|
454
447
|
|
|
455
448
|
Codex 会话从 `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl` 发现(支持 `CODEX_HOME`),按 `session_meta.cwd` 匹配工作目录。镜像支持用户消息、助手回复、工具调用与结果、公开的思考摘要;加密思考不展示。新会话的 UUID 由 Codex 分配,daemon 通过 Codex CLI 自带的临时 `app-server` 创建、恢复或克隆会话,并调用 `thread/name/set` 持久化日志,随后立即创建 tmux pane,运行 `codex resume <id>` 并绑定会话。无需初始化消息,不产生模型请求,也不需要额外 SDK 或常驻服务。已验证 Codex CLI 0.162.1,启动采用 `--no-daemon` 独立进程。模型使用 `--model`,推理强度和 wizard 身份使用 `-c` 配置覆盖。wezard 启动的 Codex 会话自动配置 wezard MCP server,无需写入全局 TOML。
|
|
456
449
|
|
package/cli/wezard.sh
CHANGED
|
@@ -26,8 +26,6 @@ usage() {
|
|
|
26
26
|
cat <<'EOF'
|
|
27
27
|
wezard <subcommand>
|
|
28
28
|
init interactive onboarding (write config, install daemon, claim default chat, run demo)
|
|
29
|
-
migrate upgrade an existing weclaude install (state + daemon + plugin + settings.json)
|
|
30
|
-
flags: --dry-run --force --purge -y
|
|
31
29
|
status daemon health + connection state
|
|
32
30
|
reconnect reconnect WeCom without restarting sessions or pending approvals
|
|
33
31
|
start load resident daemon (launchd/systemd)
|
|
@@ -40,6 +38,7 @@ wezard <subcommand>
|
|
|
40
38
|
svr [args...] run standalone detail relay (deploy on a host chat + cli both reach)
|
|
41
39
|
logs [-f] tail daemon log
|
|
42
40
|
config-path show resolved config path
|
|
41
|
+
use [cli|wecom] approval hook: 交给本地 CLI 自己弹框 / 交回企微审批卡 (无参 = 看当前)
|
|
43
42
|
sync write hooks/MCP/env into sync.targets settings.json
|
|
44
43
|
unsync remove our entries from sync.targets settings.json
|
|
45
44
|
wx [bind|list|unbind] WeChat ClawBot: scan-to-bind a WeChat user as a chat (terminal QR)
|
|
@@ -169,7 +168,6 @@ svc_unregister() {
|
|
|
169
168
|
|
|
170
169
|
case "$cmd" in
|
|
171
170
|
init) exec_node dist/cli/init.js "$@" ;;
|
|
172
|
-
migrate) exec_node dist/cli/migrate.js "$@" ;;
|
|
173
171
|
wx) exec_node dist/cli/wx.js "$@" ;;
|
|
174
172
|
status)
|
|
175
173
|
if out=$(http_get /status 2>/dev/null); then
|
|
@@ -262,13 +260,9 @@ case "$cmd" in
|
|
|
262
260
|
|| { echo "[wezard] $NPM_WEZARD/cli/wezard.sh missing after install" >&2; exit 1; }
|
|
263
261
|
# postinstall (run by npm above) refreshed the Claude plugin marketplace
|
|
264
262
|
# copy — hook/MCP/commands in ~/.claude/plugins are already on the new tag.
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
# Fresh copy predates `update` (< 1.3.6) — drive its own sync + reload.
|
|
269
|
-
echo "[wezard] installed copy has no __update-finish — falling back to sync + reload"
|
|
270
|
-
bash "$NPM_WEZARD/cli/wezard.sh" sync || echo "[wezard] sync failed — run 'wezard sync' manually" >&2
|
|
271
|
-
exec bash "$NPM_WEZARD/cli/wezard.sh" reload
|
|
263
|
+
grep -qE '^[[:space:]]*__update-finish\)' "$NPM_WEZARD/cli/wezard.sh" \
|
|
264
|
+
|| { echo "[wezard] installed copy missing __update-finish" >&2; exit 1; }
|
|
265
|
+
exec bash "$NPM_WEZARD/cli/wezard.sh" __update-finish "$GLOBAL_VER"
|
|
272
266
|
;;
|
|
273
267
|
__update-finish)
|
|
274
268
|
# Internal tail of `update` — always runs from the freshly installed npm
|
|
@@ -355,6 +349,12 @@ case "$cmd" in
|
|
|
355
349
|
mirror-status)
|
|
356
350
|
http_get /mirror/status | jq . 2>/dev/null || http_get /mirror/status
|
|
357
351
|
;;
|
|
352
|
+
use)
|
|
353
|
+
NODE_BIN="$(command -v node)"
|
|
354
|
+
SCRIPT="$REPO_ROOT/dist/cli/hook-mode.js"
|
|
355
|
+
[[ -f "$SCRIPT" ]] || { echo "build first: npm run build"; exit 1; }
|
|
356
|
+
exec "$NODE_BIN" "$SCRIPT" "$@"
|
|
357
|
+
;;
|
|
358
358
|
sync)
|
|
359
359
|
NODE_BIN="$(command -v node)"
|
|
360
360
|
SCRIPT="$REPO_ROOT/dist/cli/sync.js"
|
package/config.example.jsonc
CHANGED
|
@@ -29,17 +29,11 @@
|
|
|
29
29
|
// Allow which WeCom users / chats to drive CC. Empty = deny all.
|
|
30
30
|
// "all" = allow everyone (use with care).
|
|
31
31
|
"allowFrom": [], // ["user:zhangsan", "chat:wcXXXX", "all"]
|
|
32
|
-
"claudeBin": "claude",
|
|
33
32
|
// CLI backend selection. Four built-ins: "claude" / "claude-internal" /
|
|
34
|
-
// "codebuddy" / "codex".
|
|
33
|
+
// "codebuddy" / "codex". Omitted → "claude".
|
|
35
34
|
"defaultCli": "claude",
|
|
36
35
|
// Codex uses ~/.codex/sessions (or $CODEX_HOME/sessions), with native resume/fork.
|
|
37
36
|
// For Codex set extraArgs: []; PreToolUse approval cards are not supported.
|
|
38
|
-
// Per-backend binary overrides (when the executable isn't on $PATH under
|
|
39
|
-
// its canonical name). Missing entry → built-in default.
|
|
40
|
-
// "cliBackends": {
|
|
41
|
-
// "codebuddy": { "bin": "/usr/local/bin/codebuddy" }
|
|
42
|
-
// },
|
|
43
37
|
"cwd": "~", // default workdir for a new chat's first session
|
|
44
38
|
// Appended to the spawned CLI command line. Default drops tools wizards never use that cost
|
|
45
39
|
// ~18k tokens per session (Artifact 11.3k, Workflow/SendFeedback/ScheduleWakeup 5.6k, claude.ai Docs/Drive 1.0k);
|
|
@@ -102,7 +96,7 @@
|
|
|
102
96
|
// 「📄 展开完整命令」按需在群里发全文。发送失败会自动缩到 600 重试一次。
|
|
103
97
|
"cardQuoteMaxChars": 1200,
|
|
104
98
|
// 长命令是否在发卡前**无条件**先推一条完整命令的文本消息。0 = 关闭(默认,
|
|
105
|
-
// 靠上面两条按需路径)
|
|
99
|
+
// 靠上面两条按需路径)。设正数可启用, 值为前置消息总字数上限。
|
|
106
100
|
"fullCommandPreludeChars": 0,
|
|
107
101
|
"approvers": [], // ["user:zhangsan"] empty → defaultChat
|
|
108
102
|
"hookTimeoutSec": 43210, // hook curl --max-time (12h + 10s)
|
|
@@ -135,15 +129,20 @@
|
|
|
135
129
|
|
|
136
130
|
// ── 按难度分档的模型 ─────────────────────────────────────────────
|
|
137
131
|
// spawn_wizard / clone_wizard 按 wrc.defaultCli 选后端档位; 显式 model / effort 优先。
|
|
138
|
-
//
|
|
132
|
+
// 管家档位由 router 设置;各 CLI 的模型和 effort 在对应后端下配置。
|
|
139
133
|
"models": {
|
|
140
|
-
"
|
|
141
|
-
"light": { "model": "sonnet", "effort": "medium" },
|
|
142
|
-
"standard": { "model": "sonnet", "effort": "medium" },
|
|
143
|
-
"hard": { "model": "opus", "effort": "high" }
|
|
144
|
-
},
|
|
134
|
+
"router": "standard",
|
|
145
135
|
"backends": {
|
|
146
|
-
//
|
|
136
|
+
// 各后端独立配置五档模型与 effort。
|
|
137
|
+
"claude": {
|
|
138
|
+
"tiers": {
|
|
139
|
+
"mini": { "model": "haiku", "effort": "low" },
|
|
140
|
+
"light": { "model": "sonnet", "effort": "medium" },
|
|
141
|
+
"standard": { "model": "sonnet", "effort": "medium" },
|
|
142
|
+
"hard": { "model": "opus", "effort": "high" },
|
|
143
|
+
"ultra": { "model": "opus", "effort": "max" }
|
|
144
|
+
}
|
|
145
|
+
},
|
|
147
146
|
// Codex 模型留空使用 CLI 默认, 也可逐档填写模型 ID。
|
|
148
147
|
"codex": {
|
|
149
148
|
"tiers": {
|
|
@@ -154,8 +153,7 @@
|
|
|
154
153
|
"ultra": { "model": "", "effort": "xhigh" }
|
|
155
154
|
}
|
|
156
155
|
}
|
|
157
|
-
}
|
|
158
|
-
"steward": "light"
|
|
156
|
+
}
|
|
159
157
|
},
|
|
160
158
|
|
|
161
159
|
// ── CLI hook / MCP sync ──────────────────────────────────────────
|
package/dist/cli/codex-hook.js
CHANGED
|
@@ -4,10 +4,14 @@ import { loadConfig } from "../shared/config.js";
|
|
|
4
4
|
import { codexApprovalRequest, codexHookOutput, codexSelfCallBypass } from "../shared/codex-approval.js";
|
|
5
5
|
import { sleep } from "../shared/std.js";
|
|
6
6
|
import { recordCodexPaneSession } from "../shared/codex.js";
|
|
7
|
+
import { readHookMode } from "../shared/hook-mode.js";
|
|
7
8
|
const requestApproval = async (input) => {
|
|
8
9
|
const { config: cfg } = loadConfig();
|
|
9
10
|
if (!cfg.approval.enabled)
|
|
10
11
|
return { decision: "ask", reason: "approval_disabled" };
|
|
12
|
+
// `wezard use cli`: 审批权在本地 CLI, 回 ask 让 codex 弹它自己的原生框。
|
|
13
|
+
if (readHookMode(cfg.daemon.stateDir) === "cli")
|
|
14
|
+
return { decision: "ask", reason: "hook_mode_cli" };
|
|
11
15
|
const base = process.env.WEZARD_DAEMON_BASE ?? `http://127.0.0.1:${cfg.daemon.port}`;
|
|
12
16
|
// Loopback fetch does not use HTTP_PROXY; do not send hook inputs off-machine.
|
|
13
17
|
const url = new URL("/approve", base);
|
|
@@ -85,7 +89,8 @@ const main = async () => {
|
|
|
85
89
|
const { config: cfg } = loadConfig();
|
|
86
90
|
const reply = await requestApproval(input);
|
|
87
91
|
// Disabled hooks should not block ordinary tools, nor approve escalations.
|
|
88
|
-
|
|
92
|
+
const passthrough = !cfg.approval.enabled || readHookMode(cfg.daemon.stateDir) === "cli";
|
|
93
|
+
console.log(JSON.stringify(passthrough ? {} : codexHookOutput(event, reply)));
|
|
89
94
|
}
|
|
90
95
|
catch (e) {
|
|
91
96
|
console.log(JSON.stringify(sessionStart ? { systemMessage: `wezard session registration failed: ${e.message}` } : codexHookOutput(event, { decision: "ask", reason: e.message })));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-hook.js","sourceRoot":"","sources":["../../cli/codex-hook.ts"],"names":[],"mappings":";AACA,qEAAqE;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,mBAAmB,EAAoE,MAAM,6BAA6B,CAAC;AAC3K,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"codex-hook.js","sourceRoot":"","sources":["../../cli/codex-hook.ts"],"names":[],"mappings":";AACA,qEAAqE;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,mBAAmB,EAAoE,MAAM,6BAA6B,CAAC;AAC3K,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,MAAM,eAAe,GAAG,KAAK,EAAE,KAAyB,EAA0B,EAAE;IAClF,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,UAAU,EAAE,CAAC;IACrC,IAAI,CAAC,GAAG,CAAC,QAAQ,C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AAC,EAAE,aAAa,EAAE,uCAAwC,CAAW,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAG,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3M,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,IAAI,EAAE,CAAC"}
|
package/dist/cli/init.js
CHANGED
|
@@ -302,7 +302,6 @@ const main = async () => {
|
|
|
302
302
|
log(c.red(" ✗ 未选择任何 agent"));
|
|
303
303
|
process.exit(1);
|
|
304
304
|
}
|
|
305
|
-
const claudeBin = claudeBinFor(primary);
|
|
306
305
|
// ── Step 1b: write configs ─────────────────────────────────────
|
|
307
306
|
// svr 的 base/token 必须在 daemon 起来之前落盘 —— daemon 只在 boot 时读一次
|
|
308
307
|
// detailRemoteBase/Token, 晚写等于第一轮链接全指向回环。
|
|
@@ -316,7 +315,6 @@ const main = async () => {
|
|
|
316
315
|
patchJsonc(CONFIG, [
|
|
317
316
|
{ path: ["bot", "websocketUrl"], value: "wss://openws.work.weixin.qq.com" },
|
|
318
317
|
{ path: ["defaultChat"], value: "" },
|
|
319
|
-
{ path: ["wrc", "claudeBin"], value: claudeBin },
|
|
320
318
|
{ path: ["wrc", "defaultCli"], value: backendNameFor(primary) },
|
|
321
319
|
{ path: ["wrc", "cwd"], value: "~/.wezard/workspace" },
|
|
322
320
|
{ path: ["wrc", "allowFrom"], value: [] },
|