Skip to content

feat: 远程群控#243

Merged
claude-code-best merged 8 commits intomainfrom
feat/pr-package-adapt
Apr 11, 2026
Merged

feat: 远程群控#243
claude-code-best merged 8 commits intomainfrom
feat/pr-package-adapt

Conversation

@claude-code-best
Copy link
Copy Markdown
Owner

@claude-code-best claude-code-best commented Apr 11, 2026

Summary by CodeRabbit

  • New Features

    • Local Pipe IPC for multi-instance collaboration (main/master/sub orchestration) and LAN Pipes for zero‑config discovery + cross‑machine messaging.
    • New slash/local commands for managing pipes and peers (attach/detach/send/pipes/peers/history/pipe-status/claim-main) and background monitor/coordinator modes.
    • Terminal mouse support and several new tools (Monitor, Sleep, Snip, Review Artifact, SendFile, WebBrowser, REPL wrapper, etc.).
  • Bug Fixes

    • Replaced many placeholder stubs with working implementations across commands, tools, and runtime hooks.
  • Documentation

    • Extensive docs added/updated covering Pipes, LAN Pipes, UDS inbox, feature flags, and usage guidance.

unraid and others added 7 commits April 6, 2026 17:16
Core IPC system (UDS_INBOX):
- PipeServer/PipeClient with UDS + TCP dual transport, NDJSON protocol
- PipeRegistry: machineId-based role assignment, file locking
- Master/slave attach, prompt relay, permission forwarding
- Heartbeat lifecycle with parallel isPipeAlive probes
- Commands: /pipes, /attach, /detach, /send, /claim-main, /pipe-status

LAN Pipes (LAN_PIPES):
- UDP multicast beacon (224.0.71.67:7101) for zero-config LAN discovery
- PipeServer TCP listener, PipeClient TCP connect mode
- Heartbeat auto-attaches LAN peers via TCP
- Cross-machine attach allowed regardless of role
- /pipes shows [LAN] peers with role + hostname/IP
- SendMessageTool supports tcp: scheme with user consent

Architecture — extracted hooks from REPL.tsx (~830 lines → ~20 lines):
- usePipeIpc: lifecycle (bootstrap, handlers, heartbeat, cleanup)
- usePipeRelay: slave→master message relay via module singleton
- usePipePermissionForward: permission request/cancel forwarding
- usePipeRouter: selected pipe input routing with role+IP labels
- Shared ndjsonFramer.ts replaces 3 duplicate NDJSON parsers

Key fixes applied during development:
- Multicast binds to correct LAN interface (not WSL/Docker)
- Beacon ref stored as module singleton (not Zustand state mutation)
- Heartbeat preserves LAN peers in discoveredPipes and selectedPipes
- Disconnect handler calls removeSlaveClient (fixes listener leak)
- cleanupStaleEntries probes without lock, writes briefly under lock
- getMachineId uses async execFile (not blocking execSync)
- globalThis.__pipeSendToMaster replaced with setPipeRelay singleton
- M key only toggles route mode when selector panel is expanded
- User prompt displayed in message list on pipe broadcast
- Broadcast notifications show [role] + hostname/IP for LAN peers

Other restored features:
- Monitor tool: /monitor command, MonitorTool, MonitorMcpTask lifecycle
- Daemon supervisor and remoteControlServer command
- Tools: SnipTool, SleepTool, ListPeersTool, SendUserFileTool,
  WebBrowserTool, WorkflowTool, and 10+ stub→implementation rewrites
- Feature flags: UDS_INBOX, LAN_PIPES, MONITOR_TOOL, FORK_SUBAGENT,
  KAIROS, COORDINATOR_MODE, WORKFLOW_SCRIPTS, HISTORY_SNIP

Tests: 2190 pass / 0 fail (15 new: lanBeacon 7, peerAddress 8)
…erge

- Export ToolResultBlockParam from Tool.ts (14 tool files fixed)
- Migrate ink imports from ../../ink.js to @anthropic/ink (7 files)
- Fix toolUseID → toolUseId typo in monitor.ts and MonitorTool.tsx
- Add fallback values for string|undefined type errors (8 locations)
- Fix AppState type in assistant.ts, add NewInstallWizard stubs
- Fix ParsedRepository.repo → .name in subscribe-pr.ts
- Fix AgentId/string type mismatch in BackgroundTasksDialog.tsx
- Fix PipeRelayFn return type in pipePermissionRelay.ts
- Use PipeMessage type in usePipeRelay.ts
- Fix lanBeacon.test.ts mock type assertions
- Create missing MouseActionEvent class for ink package
- Use ansi: color format instead of bare "green"/"red"
- Resolve theme.permission access via getTheme()

Result: 0 tsc errors, 2496 tests pass, 0 fail

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Core IPC system (UDS_INBOX):
- PipeServer/PipeClient with UDS + TCP dual transport, NDJSON protocol
- PipeRegistry: machineId-based role assignment, file locking
- Master/slave attach, prompt relay, permission forwarding
- Heartbeat lifecycle with parallel isPipeAlive probes
- Commands: /pipes, /attach, /detach, /send, /claim-main, /pipe-status

LAN Pipes (LAN_PIPES):
- UDP multicast beacon (224.0.71.67:7101) for zero-config LAN discovery
- PipeServer TCP listener, PipeClient TCP connect mode
- Heartbeat auto-attaches LAN peers via TCP
- Cross-machine attach allowed regardless of role
- /pipes shows [LAN] peers with role + hostname/IP
- SendMessageTool supports tcp: scheme with user consent

Architecture — extracted hooks from REPL.tsx (~830 lines → ~20 lines):
- usePipeIpc: lifecycle (bootstrap, handlers, heartbeat, cleanup)
- usePipeRelay: slave→master message relay via module singleton
- usePipePermissionForward: permission request/cancel forwarding
- usePipeRouter: selected pipe input routing with role+IP labels
- Shared ndjsonFramer.ts replaces 3 duplicate NDJSON parsers

Key fixes applied during development:
- Multicast binds to correct LAN interface (not WSL/Docker)
- Beacon ref stored as module singleton (not Zustand state mutation)
- Heartbeat preserves LAN peers in discoveredPipes and selectedPipes
- Disconnect handler calls removeSlaveClient (fixes listener leak)
- cleanupStaleEntries probes without lock, writes briefly under lock
- getMachineId uses async execFile (not blocking execSync)
- globalThis.__pipeSendToMaster replaced with setPipeRelay singleton
- M key only toggles route mode when selector panel is expanded
- User prompt displayed in message list on pipe broadcast
- Broadcast notifications show [role] + hostname/IP for LAN peers

Other restored features:
- Monitor tool: /monitor command, MonitorTool, MonitorMcpTask lifecycle
- Daemon supervisor and remoteControlServer command
- Tools: SnipTool, SleepTool, ListPeersTool, SendUserFileTool,
  WebBrowserTool, WorkflowTool, and 10+ stub→implementation rewrites
- Feature flags: UDS_INBOX, LAN_PIPES, MONITOR_TOOL, FORK_SUBAGENT,
  KAIROS, COORDINATOR_MODE, WORKFLOW_SCRIPTS, HISTORY_SNIP

Tests: 2190 pass / 0 fail (15 new: lanBeacon 7, peerAddress 8)
@mintlify
Copy link
Copy Markdown

mintlify Bot commented Apr 11, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ccb-863780bf 🟢 Ready View Preview Apr 11, 2026, 3:16 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 11, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 93885099-2afd-4da6-9df2-69bf35a16709

📥 Commits

Reviewing files that changed from the base of the PR and between dc19177 and 99e0758.

📒 Files selected for processing (3)
  • DEV-LOG.md
  • build.ts
  • scripts/dev.ts

📝 Walkthrough

Walkthrough

Introduces a comprehensive Pipe IPC system (UDS + optional TCP LAN), multicast LAN discovery, pipe registry coordination, permission relay, new commands/tools/hooks/components for pipe management and monitoring, and numerous related tooling, tests, and docs. Many stub modules replaced with real implementations.

Changes

Cohort / File(s) Summary
Config & Dev Metadata
\.gitignore, DEV-LOG.md, README.md, build.ts, scripts/dev.ts
Added .claude/ ignore; expanded DEV-LOG; README feature checklist update; restored/changed default feature flags (duplicated entries present in some lists).
Feature Docs
docs/... (multiple files, new & edited)
Added extensive docs: UDS_INBOX, LAN_PIPES, pipes-and-lan, implementation plans, audits, removal from tier3, and exploration notes.
Core IPC Transport
src/utils/pipeTransport.ts, src/utils/ndjsonFramer.ts
New NDJSON UDS transport with optional TCP, PipeServer/PipeClient, helpers (connect/list/alive), framing logic.
Registry & LAN Discovery
src/utils/pipeRegistry.ts, src/utils/lanBeacon.ts
Registry backed by registry.json + locking, machine-id/mac helpers, role determination; UDP multicast LanBeacon for zero‑config peer announce/discovery.
Permission Relay
src/utils/pipePermissionRelay.ts, src/hooks/toolPermission/handlers/interactiveHandler.ts
Singleton pipe permission relay with requestId lifecycle, cancellation, resolution; interactive handler integrated to relay and clear pipe requests.
UDS Messaging & Client
src/utils/udsMessaging.ts, src/utils/udsClient.ts, src/utils/peerAddress.ts
UDS inbox server, send/receive, inbox draining; peer discovery/listing; isPeerAlive probe; address parsing including tcp: scheme and parseTcpTarget.
Master/Slave Hooks & Router
src/hooks/usePipeIpc.ts, src/hooks/useMasterMonitor.ts, src/hooks/usePipeRouter.ts, src/hooks/usePipeRelay.ts, src/hooks/usePipePermissionForward.ts, src/hooks/useSlaveNotifications.ts
Hook set for pipe lifecycle, heartbeat, attach/attach_request handling, master monitoring, routing to selected pipes, permission forwarding, and slave notifications.
Commands: pipe lifecycle & ops
src/commands/{attach,detach,send,pipes,pipe-status,claim-main}, src/commands/peers/*
New local commands for attach/detach/send/pipes inspection/claim-main and peers listing; feature-gated registration.
Commands: admin & misc
src/commands/{monitor,coordinator,proactive,assistant,force-snip,subscribe-pr,workflows,...}
Added monitor/coordinator/proactive/assistant/workflows and utility commands; many lazy-load local-jsx handlers.
Tools: new & implemented
src/tools/** (many files)
Multiple tools added or implemented (Monitor, ReviewArtifact, SendUserFile, ListPeers, Sleep, Snip, TerminalCapture, WebBrowser, SubscribePR, VerifyPlanExecution, REPLTool, WorkflowTool, etc.) with schemas, UI mapping, and runtime stubs where runtime missing.
REPL & UI Integration
src/screens/REPL.tsx, src/components/PromptInput/PromptInputFooter.tsx, src/components/permissions/*, src/components/tasks/*
REPL wired to pipe routing/hooking/relay; added PipeStatusInline selector UI and permission dialogs for Monitor/ReviewArtifact; task detail dialogs implemented.
Event System (Ink)
packages/@ant/ink/src/core/{events,hit-test}.ts
Added MouseActionEvent, dispatchMouseAction, new handler props and mapping for mouse down/up/drag.
Proactive & Coordinator
src/proactive/*, src/coordinator/workerAgent.ts
Full proactive state manager and hook; coordinator worker agent implementation with tool allowlist.
Tasks & Workflow runtime
src/tasks/{LocalWorkflowTask,MonitorMcpTask}/*
Implemented task lifecycle, registration, kill/complete/fail/skip/retry helpers and Task entries.
Utilities & Path handling
src/utils/{path,file,claudemd,xdg,ndjsonFramer,peerAddress,...}
Path normalization improvements (portable posix handling), normalizePathForComparison uses forward slashes, portable XDG join, ndjson framer, tcp parsing.
Tests
src/utils/__tests__/*, src/hooks/__tests__/*
Added/updated tests: lanBeacon, peerAddress, pipePermissionRelay, pipeTransport role helpers, useMasterMonitor, path/truncate mocks, and others.
Minor exports & formatting
src/Tool.ts, src/assistant/*, many previously-stubbed files
Re-exports types, replaced many stub modules with real implementations, minor formatting/semicolons and non-functional changes.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant REPL
participant PipeRegistry
participant LanBeacon
participant PipeServer
participant PipeClient
participant UDSMessaging
REPL->>PipeRegistry: query discovered pipes / determine role
REPL->>LanBeacon: read LAN peers (if enabled)
REPL->>PipeServer: start / register server (on mount)
REPL->>PipeClient: connectToPipe(target) (UDS or tcp)
PipeClient->>PipeServer: handshake (attach_request / attach_accept)
PipeServer->>PipeRegistry: update registry (registerAsSub/registerAsMain)
UDSMessaging->>REPL: inbox events / permission_request forwarded

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Suggested labels

v6

Suggested reviewers

  • KonghaYao

"🐇 With beacons bright and pipes now grown,
I hopped from socket to socket, shown.
I patched the registry, sang a ping—pong song,
Now CLIs chatter the whole night long.
Hooray! — your rabbit, code-bunny, strong."

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pr-package-adapt
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch feat/pr-package-adapt

@claude-code-best claude-code-best merged commit 09fc515 into main Apr 11, 2026
5 checks passed
@claude-code-best claude-code-best deleted the feat/pr-package-adapt branch April 11, 2026 15:24
y574444354 added a commit to y574444354/csc that referenced this pull request Apr 14, 2026
同步上游主仓库最新代码,整合以下新功能:
- feat: 工具层及 mcp 大重构 (claude-code-best#252)
- feat: 远程群控 (claude-code-best#243)
- feat: 添加对 langfuse 监控的支持 (claude-code-best#242)
- feat: 完成第一个 mcp-chrome 接入版本
- feat: 添加模型 1M 上下文切换
- feat: langfuse 工具调用显示为嵌套结构
- feat: 加上 userId 的传递
- feat: Add Ultraplan Feature for Advanced Multi-Agent Planning (claude-code-best#232)
- feat: Add brave as alternative WebSearchTool
- fix: 修复 Bun.hash 不存在问题
- fix: 修复缓存
- fix: 修复 interrupt 日志不上传
- fix: 修复 chrome 链接版本
- fix: 使用简化版本的 chrome 桥接器
- fix: 修复 node 环境没有 bun 的问题
- fix: 修复穷鬼模式的写入问题
- fix: 修复对穷鬼模式的 auto dream 和 session memory 越过
- fix: 修复初次登陆的校验问题
- fix(openai): fix stop_reason null, zero usage fields and max_tokens forwarding
- chore: 1.3.3 版本
- docs: 添加浏览器说明支持

冲突解决策略:
- 保留 CoStrict 品牌、4.0.x 版本号、csc bin 命令
- 保留 CoStrict 企业认证体系和 Agent 编排
- 采用上游的 1M context、langfuse、chrome mcp、远程群控等新功能
- 采用上游的 getDialogConfig/promptIdentifier 模式
- 采用上游的 FORCE_INTERACTIVE TTY 修复
- 合并两者:保留 CoStrict 品牌名 + 上游新代码模式
dfsfdfse pushed a commit to dfsfdfse/claude-code that referenced this pull request Apr 25, 2026
* feat: restore pipe IPC, LAN pipes, monitor tool, and PR-package features

Core IPC system (UDS_INBOX):
- PipeServer/PipeClient with UDS + TCP dual transport, NDJSON protocol
- PipeRegistry: machineId-based role assignment, file locking
- Master/slave attach, prompt relay, permission forwarding
- Heartbeat lifecycle with parallel isPipeAlive probes
- Commands: /pipes, /attach, /detach, /send, /claim-main, /pipe-status

LAN Pipes (LAN_PIPES):
- UDP multicast beacon (224.0.71.67:7101) for zero-config LAN discovery
- PipeServer TCP listener, PipeClient TCP connect mode
- Heartbeat auto-attaches LAN peers via TCP
- Cross-machine attach allowed regardless of role
- /pipes shows [LAN] peers with role + hostname/IP
- SendMessageTool supports tcp: scheme with user consent

Architecture — extracted hooks from REPL.tsx (~830 lines → ~20 lines):
- usePipeIpc: lifecycle (bootstrap, handlers, heartbeat, cleanup)
- usePipeRelay: slave→master message relay via module singleton
- usePipePermissionForward: permission request/cancel forwarding
- usePipeRouter: selected pipe input routing with role+IP labels
- Shared ndjsonFramer.ts replaces 3 duplicate NDJSON parsers

Key fixes applied during development:
- Multicast binds to correct LAN interface (not WSL/Docker)
- Beacon ref stored as module singleton (not Zustand state mutation)
- Heartbeat preserves LAN peers in discoveredPipes and selectedPipes
- Disconnect handler calls removeSlaveClient (fixes listener leak)
- cleanupStaleEntries probes without lock, writes briefly under lock
- getMachineId uses async execFile (not blocking execSync)
- globalThis.__pipeSendToMaster replaced with setPipeRelay singleton
- M key only toggles route mode when selector panel is expanded
- User prompt displayed in message list on pipe broadcast
- Broadcast notifications show [role] + hostname/IP for LAN peers

Other restored features:
- Monitor tool: /monitor command, MonitorTool, MonitorMcpTask lifecycle
- Daemon supervisor and remoteControlServer command
- Tools: SnipTool, SleepTool, ListPeersTool, SendUserFileTool,
  WebBrowserTool, WorkflowTool, and 10+ stub→implementation rewrites
- Feature flags: UDS_INBOX, LAN_PIPES, MONITOR_TOOL, FORK_SUBAGENT,
  KAIROS, COORDINATOR_MODE, WORKFLOW_SCRIPTS, HISTORY_SNIP

Tests: 2190 pass / 0 fail (15 new: lanBeacon 7, peerAddress 8)

* fix: resolve merge conflicts and fix all tsc/test errors after main merge

- Export ToolResultBlockParam from Tool.ts (14 tool files fixed)
- Migrate ink imports from ../../ink.js to @anthropic/ink (7 files)
- Fix toolUseID → toolUseId typo in monitor.ts and MonitorTool.tsx
- Add fallback values for string|undefined type errors (8 locations)
- Fix AppState type in assistant.ts, add NewInstallWizard stubs
- Fix ParsedRepository.repo → .name in subscribe-pr.ts
- Fix AgentId/string type mismatch in BackgroundTasksDialog.tsx
- Fix PipeRelayFn return type in pipePermissionRelay.ts
- Use PipeMessage type in usePipeRelay.ts
- Fix lanBeacon.test.ts mock type assertions
- Create missing MouseActionEvent class for ink package
- Use ansi: color format instead of bare "green"/"red"
- Resolve theme.permission access via getTheme()

Result: 0 tsc errors, 2496 tests pass, 0 fail

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: 恢复 /poor 的说明

---------

Co-authored-by: unraid <local@unraid.local>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant