feat(core,cli): M5.2 — plugin live wire-up (discover → spawn → register)#20
Merged
Conversation
Closes the "M5.1: 65% — needs live registry wireup" line item.
Core (@deepcode/core):
· packages/core/src/plugins/wireup.ts (NEW, ~140 lines)
- wirePlugins({ home, hooks, capabilities, disabled }) — orchestrates
discoverPlugins → spawnAllPlugins → mergeHooks(declared) for each
successfully started plugin.
- WireResult exposes plugins (with contributed hook events), hash
mismatches, spawn failures, and a shutdown() to kill subprocesses.
- hasInstalledPlugins() probe helper.
· packages/core/src/hooks/dispatcher.ts
- HookDispatcher.mergeHooks(extra: Hooks) — appends matchers under each
event so plugins can extend dispatch at runtime.
- `hooks` field changed from readonly to private mutable.
· packages/core/src/plugins/runtime/subprocess.ts
- Exposes `get plugin()` and `get isAlive()` accessors so wireup can map
subprocess back to its source InstalledPlugin without reaching into
private opts.
· packages/core/src/agent.ts
- ToolContext.sessionDir is now derived from
`${sessions.root}/${sessionId}` so TodoWrite persists to the
session-scoped dir and /todos can read it back.
CLI (deepcode-cli):
· apps/cli/src/repl.ts + headless.ts
- Both bootstraps now call wirePlugins() after HookDispatcher
construction, build a capability bridge from BashTool/ReadTool/WriteTool/
WebFetchTool, and shutdown() the wire on exit.
- SessionContext carries wiredPlugins + pluginWarnings so /plugins can
render them.
· apps/cli/src/commands.ts
- NEW /plugins slash command. Lists active plugins with their version
and contributed hook events; surfaces hash drift + spawn failure
warnings.
- /todos rewritten — now actually reads
`<sessionsRoot>/<sessionId>/todos.json` via readTodos() helper.
Tests: core 308 → 317 (+9 wireup tests); cli 43 → 47 (+4 /plugins+/todos);
total 360 → 364 passing. (`pnpm -r test`).
BEHAVIOR_PARITY: /todos and /plugins move from 🔄 to ✅.
Acknowledged gaps (M5.2-ext+):
· OS-level sandbox wrapping of plugin subprocess (M5.1-ext)
· gh:user/repo + npm install paths (M5.2-rest)
· Marketplace index + ed25519 signatures (M5.2-rest)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
oratis
added a commit
that referenced
this pull request
May 28, 2026
This session ("继续推进" from v2) added 5 PRs on top of #1-#16:
· #17 M3c-rest tools (TodoWrite + WebFetch + WebSearch)
· #18 M3.5 attack tests + security-model.md
· #19 M8 headless mode (-p / --print)
· #20 M5.2 plugin live wire-up
· #21 system-reminder injector
Test count: 313 → 387 (+74).
Scope completion estimate: 65-70% → 72-78%.
Major remaining items: M6 Mac Electron (still 0%), M7 file panel (depends
on M6), and the M3c-rest/M8/M5.2 leftovers itemized in the body.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the M5.1: 65% — needs live registry wireup gap. Plugins are now first-class: they discover, spawn, contribute hook handlers, and are visible via
/plugins.Core
packages/core/src/plugins/wireup.ts(NEW) —wirePlugins()orchestrates discover → spawn → merge contributed hooks. Returns plugins, hash mismatches, spawn failures, and ashutdown()so the host doesn't leak child processes.HookDispatcher.mergeHooks(extra)— runtime extension of matchers per event. Plugins use this to inject command/http/prompt hooks.PluginSubprocess.plugin/isAliveaccessors — wire-up can match running subprocesses back to their source manifest without poking private state.agent.ts—ToolContext.sessionDiris now${sessions.root}/${sessionId}, soTodoWritepersists per-session and/todoscan read it.CLI
/plugins— lists active plugins with their version + contributed hook events + drift/failure warnings./todosrewritten — actually reads<sessionDir>/todos.json.Test plan
pnpm -r test— 317 + 47 = 364 passing (was 308 + 43 = 351; +13 across wireup + commands)pnpm -F @deepcode/core build+pnpm -F deepcode-cli build— cleanBEHAVIOR_PARITY.md—/todosand/pluginsmove from 🔄 to ✅What's NOT in this PR (tracked separately)
gh:user/repoandnpminstall paths (M5.2-rest)index.json+ ed25519 signatures +revoked.json(M5.2-rest)🤖 Generated with Claude Code