u-foo 3.1.7 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/OBSERVABILITY.md +65 -0
  2. package/README.md +238 -21
  3. package/README.zh-CN.md +165 -20
  4. package/SKILLS/ufoo/SKILL.md +40 -4
  5. package/SKILLS/ufoo-bus/SKILL.md +46 -3
  6. package/bin/uclaude.js +4 -0
  7. package/bin/ucodex.js +4 -0
  8. package/bin/ufoo.js +6 -4
  9. package/dist/tui/darwin-arm64/ufoo-tui +0 -0
  10. package/dist/tui/darwin-x64/ufoo-tui +0 -0
  11. package/dist/tui/linux-arm64/ufoo-tui +0 -0
  12. package/dist/tui/linux-x64/ufoo-tui +0 -0
  13. package/package.json +14 -7
  14. package/scripts/postinstall-skills.js +53 -0
  15. package/scripts/postinstall.js +11 -16
  16. package/scripts/smoke-native-messages.js +214 -0
  17. package/src/agents/activity/activityDetector.js +1 -1
  18. package/src/agents/activity/activityStateWriter.js +37 -38
  19. package/src/agents/capabilities/agentManagement/index.js +4 -0
  20. package/src/agents/capabilities/agentManagement/service.js +140 -0
  21. package/src/agents/capabilities/agentRouting/index.js +4 -0
  22. package/src/agents/capabilities/coding/index.js +32 -0
  23. package/src/agents/capabilities/coordination/index.js +37 -0
  24. package/src/agents/capabilities/globalRouting/index.js +5 -0
  25. package/src/agents/capabilities/groups/index.js +3 -0
  26. package/src/agents/capabilities/index.js +25 -0
  27. package/src/agents/capabilities/planning/index.js +123 -0
  28. package/src/agents/capabilities/planning/main.js +28 -0
  29. package/src/agents/capabilities/projectDiscovery/index.js +3 -0
  30. package/src/agents/capabilities/scheduling/index.js +3 -0
  31. package/src/agents/capabilities/sharedMemory/index.js +4 -0
  32. package/src/agents/capabilities/skills/index.js +12 -0
  33. package/src/agents/capabilities/taskExecution/index.js +3 -0
  34. package/src/agents/capabilities/taskReports/index.js +6 -0
  35. package/src/agents/controller/controllerToolExecutor.js +40 -22
  36. package/src/agents/controller/index.js +1 -6
  37. package/src/agents/internal/internalRunner.js +181 -76
  38. package/src/agents/launch/index.js +0 -1
  39. package/src/agents/launch/launcher.js +96 -14
  40. package/src/agents/launch/nativeCapabilities.js +40 -0
  41. package/src/agents/launch/nativeMessages.js +362 -0
  42. package/src/agents/launch/notifier.js +15 -20
  43. package/src/agents/launch/readyDetector.js +28 -14
  44. package/src/agents/profiles/coding.js +6 -0
  45. package/src/agents/profiles/globalRouter.js +2 -0
  46. package/src/agents/profiles/main.js +5 -0
  47. package/src/agents/prompts/cooperation.js +14 -0
  48. package/src/agents/prompts/defaultBootstrap.js +1 -1
  49. package/src/agents/prompts/groupBootstrap.js +32 -6
  50. package/src/agents/prompts/mainAgent.js +48 -0
  51. package/src/agents/prompts/native/system.js +4 -1
  52. package/src/agents/prompts/native/tasks.js +2 -2
  53. package/src/agents/prompts/native/ufoo.js +14 -3
  54. package/src/agents/prompts/promptProfiles.js +2 -0
  55. package/src/agents/prompts/reporting.js +16 -0
  56. package/src/agents/providers/claudeEventTranslator.js +9 -1
  57. package/src/agents/providers/claudeThreadProvider.js +47 -4
  58. package/src/agents/providers/clientIdentity.js +75 -0
  59. package/src/agents/providers/codexEventTranslator.js +68 -7
  60. package/src/agents/providers/codexThreadProvider.js +18 -8
  61. package/src/agents/providers/credentials/claude.js +10 -3
  62. package/src/agents/providers/credentials/index.js +2 -0
  63. package/src/agents/providers/directAuthStatus.js +1 -1
  64. package/src/agents/providers/index.js +1 -1
  65. package/src/agents/providers/modelSettings.js +34 -0
  66. package/src/agents/providers/modelsCatalog.js +379 -0
  67. package/src/agents/providers/nativeTransport.js +1146 -0
  68. package/src/agents/providers/runtimeConfig.js +188 -0
  69. package/src/agents/providers/thinkingLevels.js +106 -0
  70. package/src/agents/providers/transports/anthropicMessagesTransport.js +121 -0
  71. package/src/agents/providers/transports/index.js +10 -0
  72. package/src/agents/providers/transports/openaiChatTransport.js +117 -0
  73. package/src/agents/providers/transports/openaiResponsesTransport.js +120 -0
  74. package/src/agents/providers/transports/responsesProtocol.js +504 -0
  75. package/src/agents/providers/transports/systemBlocks.js +16 -0
  76. package/src/agents/providers/transports/transportContract.js +50 -0
  77. package/src/agents/providers/transports/visionBlocks.js +151 -0
  78. package/src/agents/providers/upstreamRuntime.js +135 -0
  79. package/src/agents/runtime/composeCapabilities.js +89 -0
  80. package/src/agents/runtime/context/checkpointStore.js +38 -0
  81. package/src/agents/runtime/context/commandStore.js +43 -0
  82. package/src/agents/runtime/context/compaction.js +151 -0
  83. package/src/agents/runtime/context/contextBudget.js +93 -0
  84. package/src/agents/runtime/context/contextWindow.js +119 -0
  85. package/src/agents/runtime/context/fileLock.js +36 -0
  86. package/src/agents/runtime/context/replayHistory.js +28 -0
  87. package/src/agents/runtime/context/runtimeStore.js +127 -0
  88. package/src/agents/runtime/context/sessionJournal.js +360 -0
  89. package/src/agents/runtime/context/sessionStore.js +57 -0
  90. package/src/agents/runtime/core/agentLoop.js +351 -0
  91. package/src/agents/runtime/core/executionBudget.js +36 -0
  92. package/src/agents/runtime/core/stableJson.js +29 -0
  93. package/src/agents/runtime/core/toolLoopGuard.js +55 -0
  94. package/src/agents/runtime/createAgentRuntime.js +259 -0
  95. package/src/agents/runtime/index.js +14 -0
  96. package/src/agents/runtime/prompts/responseLanguage.js +12 -0
  97. package/src/agents/runtime/protocol/faultHarness.js +90 -0
  98. package/src/agents/runtime/protocol/materialize.js +107 -0
  99. package/src/agents/runtime/protocol/runObservation.js +24 -0
  100. package/src/agents/runtime/protocol/toolCallLedger.js +221 -0
  101. package/src/agents/runtime/protocol/traceContext.js +9 -0
  102. package/src/agents/runtime/tasks/resourceLease.js +66 -0
  103. package/src/agents/runtime/tasks/scheduler.js +73 -0
  104. package/src/agents/runtime/tools/registry.js +57 -0
  105. package/src/app/chat/ChatController.js +29 -45
  106. package/src/app/chat/agentDirectory.js +9 -18
  107. package/src/app/chat/bootstrap.js +1 -2
  108. package/src/app/chat/commandExecutor.js +111 -313
  109. package/src/app/chat/commands.js +39 -45
  110. package/src/app/chat/daemonConnection.js +58 -5
  111. package/src/app/chat/daemonMessageRouter.js +61 -48
  112. package/src/app/chat/historyStore.js +12 -48
  113. package/src/app/chat/inputSubmitHandler.js +21 -35
  114. package/src/app/chat/internalAgentLogHistory.js +19 -60
  115. package/src/app/chat/launchRequestContext.js +42 -0
  116. package/src/app/chat/multiWindow/paneManager.js +91 -164
  117. package/src/app/chat/streamState.js +3 -7
  118. package/src/app/chat/transport.js +1 -1
  119. package/src/app/cli/busCoreCommands.js +9 -0
  120. package/src/app/cli/features/doctor.js +33 -0
  121. package/src/app/cli/features/init.js +5 -5
  122. package/src/app/cli/features/skills.js +16 -4
  123. package/src/app/cli/metricsCommands.js +68 -0
  124. package/src/app/cli/reportCoreCommands.js +37 -0
  125. package/src/app/cli/run.js +82 -42
  126. package/src/app/cli/traceCommands.js +36 -0
  127. package/src/code/agent.js +34 -17
  128. package/src/code/busConsumer.js +1 -3
  129. package/src/code/commands.js +1 -1
  130. package/src/code/context/artifacts.js +12 -11
  131. package/src/code/context/assembler.js +9 -9
  132. package/src/code/context/promptLayers.js +1 -13
  133. package/src/code/context/stableJson.js +2 -27
  134. package/src/code/context/stateCommit.js +2 -1
  135. package/src/code/contextWindow.js +2 -117
  136. package/src/code/conversation/sessionJournal.js +3 -349
  137. package/src/code/internalThread.js +107 -0
  138. package/src/code/launcher/ucode.js +1 -1
  139. package/src/code/launcher/ucodeBootstrap.js +1 -1
  140. package/src/code/modelCommand.js +11 -35
  141. package/src/code/nativeRunner.js +104 -2697
  142. package/src/code/protocol/faultHarness.js +2 -88
  143. package/src/code/protocol/materialize.js +2 -105
  144. package/src/code/protocol/toolCallLedger.js +5 -215
  145. package/src/code/providers/anthropicMessagesTransport.js +2 -118
  146. package/src/code/providers/modelsCatalog.js +1 -317
  147. package/src/code/providers/openaiChatTransport.js +2 -114
  148. package/src/code/providers/openaiResponsesTransport.js +2 -117
  149. package/src/code/providers/responsesProtocol.js +2 -497
  150. package/src/code/providers/transportContract.js +2 -48
  151. package/src/code/providers/visionBlocks.js +2 -149
  152. package/src/code/repl.js +2 -11
  153. package/src/code/sessionStore.js +27 -99
  154. package/src/code/taskDecomposer.js +18 -0
  155. package/src/code/thinkingLevels.js +1 -130
  156. package/src/code/toolBudget.js +1 -17
  157. package/src/code/toolLoopGuard.js +3 -49
  158. package/src/code/tools/artifactRead.js +1 -1
  159. package/src/code/tools/executor.js +373 -0
  160. package/src/code/tools/specs.js +312 -0
  161. package/src/config.js +95 -131
  162. package/src/coordination/bus/deliveryQueue.js +16 -2
  163. package/src/coordination/bus/index.js +14 -9
  164. package/src/coordination/bus/inject.js +15 -7
  165. package/src/coordination/bus/message.js +15 -1
  166. package/src/coordination/bus/nativeReceipts.js +100 -0
  167. package/src/coordination/bus/nickname.js +1 -1
  168. package/src/coordination/bus/queue.js +1 -3
  169. package/src/coordination/bus/subscriber.js +3 -2
  170. package/src/coordination/bus/utils.js +8 -4
  171. package/src/coordination/history/agentPerformance.js +279 -0
  172. package/src/coordination/history/agentSurface.js +142 -0
  173. package/src/coordination/history/agentTrace.js +249 -0
  174. package/src/coordination/memory/index.js +5 -21
  175. package/src/coordination/report/store.js +103 -83
  176. package/src/coordination/state/agentsStore.js +57 -3
  177. package/src/coordination/state/fileLock.js +2 -0
  178. package/src/coordination/state/workspaceAccess.js +36 -0
  179. package/src/orchestration/controller/index.js +1 -8
  180. package/src/orchestration/controller/launchRouting.js +1 -1
  181. package/src/orchestration/solo/commands.js +3 -1
  182. package/src/runtime/contracts/agentMode.js +26 -0
  183. package/src/runtime/contracts/eventContract.js +3 -0
  184. package/src/runtime/contracts/uiProtocol.js +20 -17
  185. package/src/runtime/daemon/agentHost.js +407 -0
  186. package/src/runtime/daemon/agentRecoveryGroups.js +70 -0
  187. package/src/runtime/daemon/busBridge.js +396 -0
  188. package/src/runtime/daemon/claudeChannel.js +159 -0
  189. package/src/runtime/daemon/controlPlaneService.js +28 -18
  190. package/src/runtime/daemon/cronOps.js +25 -17
  191. package/src/runtime/daemon/deliveryScheduler.js +32 -5
  192. package/src/runtime/daemon/globalDaemon.js +28 -1
  193. package/src/runtime/daemon/groupOrchestrator.js +21 -5
  194. package/src/runtime/daemon/groupStatus.js +20 -0
  195. package/src/runtime/daemon/index.js +120 -375
  196. package/src/runtime/daemon/ipcServer.js +32 -10
  197. package/src/runtime/daemon/mcpConfigure.js +113 -20
  198. package/src/runtime/daemon/mcpHttpServer.js +27 -5
  199. package/src/runtime/daemon/mcpServer.js +8 -5
  200. package/src/runtime/daemon/mcpStdioProxy.js +127 -10
  201. package/src/runtime/daemon/nicknameScope.js +1 -1
  202. package/src/runtime/daemon/ops.js +68 -40
  203. package/src/runtime/daemon/projectRuntimeGateway.js +2 -0
  204. package/src/runtime/daemon/promptRequest.js +92 -570
  205. package/src/runtime/daemon/providerSessions.js +67 -33
  206. package/src/runtime/daemon/reportControlBus.js +59 -25
  207. package/src/runtime/daemon/status.js +9 -6
  208. package/src/runtime/privacy/redactor.js +2 -2
  209. package/src/runtime/projects/identity.js +2 -1
  210. package/src/runtime/projects/registry.js +98 -38
  211. package/src/tools/controllerSchemas.js +28 -0
  212. package/src/tools/handlers/dispatchMessage.js +5 -2
  213. package/src/tools/handlers/listAgents.js +3 -1
  214. package/src/tools/handlers/readBusSummary.js +3 -1
  215. package/src/tools/handlers/readProjectRegistry.js +29 -2
  216. package/src/tools/handlers/routeAgent.js +35 -0
  217. package/src/tools/handlers/tier2.js +4 -2
  218. package/src/tools/index.js +1 -0
  219. package/src/tools/registry.js +6 -0
  220. package/src/tools/schemaFixtures.js +42 -5
  221. package/src/tools/tier0/readAgentMetrics.js +14 -0
  222. package/src/tools/tier0/readAgentTrace.js +12 -0
  223. package/src/tools/tier1/routeAgent.js +2 -2
  224. package/src/tools/tier2/runtimeCoordination.js +38 -0
  225. package/src/tools/types.js +2 -0
  226. package/src/ui/agentPresentation.js +109 -0
  227. package/src/ui/agentSettingsController.js +107 -0
  228. package/src/ui/agentSurface.js +270 -0
  229. package/src/ui/dashboardBridge.js +1 -1
  230. package/src/ui/format/banner.js +9 -15
  231. package/src/ui/format/index.js +14 -10
  232. package/src/ui/format/loopSummary.js +50 -0
  233. package/src/ui/format/markdownRenderer.js +3 -4
  234. package/src/ui/format/startupBanner.js +50 -0
  235. package/src/ui/multiPaneBusMirror.js +29 -3
  236. package/src/ui/rustChatHost.js +316 -599
  237. package/src/ui/rustMultiSession.js +288 -73
  238. package/src/ui/rustUcodeHost.js +21 -88
  239. package/src/ui/settingsBridge.js +34 -14
  240. package/src/ui/toolMergeBridge.js +0 -4
  241. package/src/ui/uiHostServer.js +5 -8
  242. package/src/agents/controller/loopObservability.js +0 -200
  243. package/src/agents/controller/loopRuntime.js +0 -472
  244. package/src/agents/controller/ufooAgent.js +0 -829
  245. package/src/agents/launch/ptyRunner.js +0 -1135
  246. package/src/agents/providers/upstreamTransport.js +0 -689
  247. package/src/app/chat/agentBar.js +0 -135
  248. package/src/app/chat/agentEnter.js +0 -70
  249. package/src/app/chat/agentSockets.js +0 -225
  250. package/src/app/chat/dashboardView.js +0 -405
  251. package/src/app/chat/multiWindow/index.js +0 -310
  252. package/src/app/chat/multiWindow/paneLayout.js +0 -84
  253. package/src/app/chat/multiWindow/renderer.js +0 -420
  254. package/src/app/chat/multiWindow/virtualTerminal.js +0 -327
  255. package/src/app/chat/multiWindow/vtFrame.js +0 -93
  256. package/src/app/chat/rawKeyMap.js +0 -42
  257. package/src/app/chat/settingsController.js +0 -111
  258. package/src/orchestration/controller/flags.js +0 -167
  259. package/src/orchestration/controller/gateRouter.js +0 -211
  260. package/src/orchestration/controller/routerFastPath.js +0 -22
  261. package/src/orchestration/controller/routerFinalize.js +0 -222
  262. package/src/orchestration/controller/shadowGuard.js +0 -280
  263. package/src/runtime/daemon/promptLoop.js +0 -136
  264. package/src/runtime/privacy/shadowDiff.js +0 -174
  265. package/src/ui/multiWindowHandoff.js +0 -232
  266. package/src/ui/ptyHandoff.js +0 -23
package/README.zh-CN.md CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
  [English](README.md)
4
4
 
5
- ufoo 是一个按项目隔离的多 Agent 工作区运行时。它把 Claude Code、
6
- OpenAI Codex、Antigravity 和 ufoo 原生 `ucode` Agent 接入同一个 chat
7
- 仪表盘、daemon、事件总线、memory、report、group 编排和终端启动层。
5
+ ufoo 是一个按项目隔离的多 Agent 工作区运行时,提供两种用法。
6
+ 你可以继续使用 Claude Code、OpenAI Codex 等原有 CLI,通过包装器和 MCP
7
+ 互联、收发消息并共享上下文;也可以打开 ufoo 面板,在当前终端与主 agent
8
+ 和 internal Codex、Claude、`ucode` 子 agent 协作。
9
+ 两种用法共享 daemon、事件总线、memory、report 和 group 编排。
8
10
 
9
11
  npm 包:[u-foo](https://www.npmjs.com/package/u-foo)
10
12
 
@@ -16,13 +18,15 @@ npm 包:[u-foo](https://www.npmjs.com/package/u-foo)
16
18
 
17
19
  ## 亮点
18
20
 
19
- - 一个 TUI 仪表盘,用来启动、观察、消息通知和恢复多个 Agent。
21
+ - 一个 TUI 面板,承载主 agent 和 internal 子 agent,提供共享输入框、
22
+ 实时输出、状态和三种布局。
20
23
  - 唯一的用户级 daemon 通过 `~/.ufoo/run/ufoo.sock` 托管隔离的项目
21
24
  runtime,管理启动/恢复、report、group、cron 和 controller 路由。
22
25
  - 项目内事件总线支持 Agent 间消息、唤醒、队列检查和终端激活。
23
26
  - 共享上下文能力:decision、durable memory、prompt history、report 和
24
27
  agent registry state。
25
- - 支持 internal、tmux、host、Terminal.app、iTerm2 等启动模式。
28
+ - 包装器和 MCP 连接外部 CLI 工作流;面板子 agent 使用 internal 模式,
29
+ 在当前终端内交互。
26
30
  - 内置 group 模板,用于启动和编排多 Agent 工作流。
27
31
  - 提供原生 ufoo coding-agent 运行时 `ucode`。
28
32
  - home 级 global controller daemon 内提供唯一的本机 Streamable HTTP MCP
@@ -30,7 +34,7 @@ npm 包:[u-foo](https://www.npmjs.com/package/u-foo)
30
34
 
31
35
  ## 环境要求
32
36
 
33
- - Node.js 18 或更新版本。
37
+ - Node.js 18.17 或更新版本。
34
38
  - macOS,用于 Terminal.app/iTerm2 集成。
35
39
  - 使用对应包装器时,需要安装 Claude Code、Codex CLI 或 Antigravity CLI:
36
40
  `uclaude`、`ucodex`、`uagy`。
@@ -49,6 +53,7 @@ npm install -g u-foo
49
53
  git clone https://github.com/Icyoung/ufoo.git
50
54
  cd ufoo
51
55
  npm install
56
+ npm run pack:tui
52
57
  npm link
53
58
  ```
54
59
 
@@ -63,6 +68,33 @@ npm link
63
68
  | `ukimi` | Kimi Code 包装器,注入 ufoo bootstrap 和 bus 身份。 |
64
69
  | `ucode` | 原生 ufoo coding-agent CLI/TUI。 |
65
70
 
71
+ 交互式 `ucodex` 和 `uclaude` 在 macOS/Linux 默认使用原生消息通道。
72
+ Codex 的 TUI 连接本次启动的私有 app-server,Claude 使用本次启动的 MCP
73
+ channel;不会修改宿主全局配置或认证信息。Claude 保留原有开发通道确认,
74
+ 账号及组织策略限制仍然适用。接收器确认就绪后才投递消息。
75
+
76
+ 启动器检查已验证的版本基线(Codex 0.160.1、Claude Code 2.1.204)及
77
+ Codex remote 支持;旧版本会提示并使用原有投递方式。
78
+ `--native-messages` 强制要求兼容,`--no-native-messages` 或
79
+ `UFOO_NATIVE_MESSAGES=0` 关闭原生通道。`ufoo doctor` 展示版本和接收器状态。
80
+
81
+ 投递回执仅表示通道接收,不表示任务完成。响应丢失会保留消息和不确定
82
+ 回执,不自动重发。可使用以下命令检查并明确处理:
83
+
84
+ ```bash
85
+ ufoo bus deliveries <subscriber>
86
+ ufoo bus deliveries <subscriber> <receipt-id> accepted
87
+ ufoo bus deliveries <subscriber> <receipt-id> retry
88
+ ```
89
+
90
+ 确认接收会话已收到任务后用 `accepted`;`retry` 允许再投递一次,如果
91
+ 第一次实际成功可能产生重复。正在投递且所属进程存活的回执不能解锁。
92
+
93
+ 任务报告的各个阶段应复用同一个 `--task <id>` / MCP `task_id`。省略 ID
94
+ 时,CLI 的 progress/done/error 只关联唯一活跃任务;并行任务必须显式指定。
95
+ 报告持久化成功后才确认消费,普通 bus 回复不会把任务标为完成。
96
+ `autoResume` 默认关闭,局部保存配置不会改变其默认值。
97
+
66
98
  ## 快速开始
67
99
 
68
100
  初始化项目并打开 chat 仪表盘:
@@ -172,6 +204,17 @@ ufoo -g
172
204
  `ufoo` 打开当前项目 chat。`ufoo -g` 打开全局 chat,用于在已注册项目之间
173
205
  切换。全局 daemon 只启动一次,各项目 runtime 按需激活。
174
206
 
207
+ 默认项目主 Agent 与 `ucode` 共用可组合的 runtime,可直接读取、修改代码并执行验证,
208
+ 也可委派 internal Agent 或创建独立任务。全局入口只负责选择项目;进入项目后才获得
209
+ 编码能力。长任务在后台运行,断开 chat 不会取消任务,重连会补发运行事件。
210
+
211
+ 主 agent 的所有会话统一使用共享 runtime。用 `/session new` 开始使用当前设置的
212
+ 新会话;已有会话的 provider/model 绑定不会随设置变更而切换。副作用执行期间进程崩溃后,任务会标为
213
+ interrupted,需检查实际结果后决定是否重新提交;不会自动重复文件修改、shell、
214
+ 启动或投递。相同目录的托管写操作共用锁,独立且经过验证的 git worktree 可并行。
215
+ 这些约束不构成 shell 的操作系统沙箱。实现与恢复契约见
216
+ [Agent Runtime 改造记录](AGENT_RUNTIME_REFACTOR.md)。
217
+
175
218
  ### Chat 内命令
176
219
 
177
220
  ```text
@@ -181,14 +224,58 @@ ufoo -g
181
224
  @reviewer inspect the current diff and list release risks
182
225
 
183
226
  /status
227
+ /task list
228
+ /task inspect <run-id>
229
+ /task cancel <run-id>
230
+ /answer <interaction-id> <reply>
231
+ /session show
232
+ /session new
184
233
  /settings
185
- /multi
186
- /resume list
234
+ /window main
235
+ /window side
236
+ /window multi
237
+ /resume
187
238
  /project list
188
239
  /project switch 2
189
240
  /open /path/to/project
190
241
  ```
191
242
 
243
+ 面板保留三种布局:`main`(仅主 agent)、`side`(主 agent 加一个选中的
244
+ internal 子 agent)、`multi`(主 agent 加全部 internal 子 agent)。包装器与 MCP agent 不进入面板;面板
245
+ 启动的子 agent 只使用 internal 模式,不会打开外部终端。当前文件夹没有
246
+ 聊天或输入历史时,欢迎页复用已有的紧凑 ufoo banner。
247
+ `Ctrl+W` 依次循环切换:`main → side → multi → main`。
248
+ `/window main`、`/window side` 和
249
+ `/window multi` 可直接选择对应布局。单子 agent 布局默认选最近激活的
250
+ 有效 internal 子 agent,没有激活记录则选第一个。没有子 agent 时仍保留模式,
251
+ 主窗格占满宽度,右侧不显示空框;子 agent 出现后自动按当前模式展示。
252
+ 两种分屏布局中,`Esc` 和 `Ctrl+C` 共用回退栈:优先退出底栏焦点,再从子 agent
253
+ 回到主 agent 输入栏,最后退出分屏。回退这些界面层级时,草稿和运行中的任务都会保留。
254
+ 两者也会关闭命令补全,并沿用主输入栏的任务取消、返回全局项目层级。
255
+ `Ctrl+Q` 或 `/window main` 可直接退出分屏。
256
+ 到达最外层后,`Esc` 不会退出应用,只有 `Ctrl+C` 才退出。
257
+ 在主 agent 或 internal 子 agent 窗格内拖选可见文字,松开鼠标即复制到剪贴板。
258
+ 选择范围限定在起始窗格内,不包含边框和相邻 agent。本地 macOS 使用系统剪贴板;
259
+ 其他终端通过 OSC 52 复制,需要终端支持剪贴板写入。
260
+ `/resume` 打开可恢复 internal 会话的二级菜单。独立启动的 agent 单独列出,
261
+ group 的成员聚合为 `group:<group-id>`;选择 group 会批量恢复有已保存会话的
262
+ 非活跃成员,跳过已活跃成员,并更新 group 中的成员 ID。
263
+ 原生编码 agent 的注册类型统一为 `ucode`,ID 使用 `ucode:<session>`;
264
+ 会话文件仍保存在 `.ufoo/agent/ucode/`。
265
+ `Tab` 在主 agent 和当前显示的子 agent 窗格之间循环切换输入焦点;单子 agent
266
+ 布局在这两个 agent 之间切换。所有 agent 共用底部一个输入框,随当前选中的 agent
267
+ 切换,每个 agent 的草稿独立保留。各 agent 的实时状态嵌在各自窗格底边,选中窗格
268
+ 的正文使用终端默认前景色。
269
+ 主 agent 的输入框标题使用 `main`;选择子 agent、切换焦点及子 agent 的工作状态
270
+ 不会覆盖主 agent 自己的状态。
271
+ 仅主 agent 时,`Tab` 先选中底部第一个 agent,之后依次选择下一个,末尾回到第一个;
272
+ `Esc` 返回主输入栏。仅主 agent 布局
273
+ 下,命令补全仍沿用 `Tab`;分屏中打开补全菜单时,`Tab` 也优先补全。布局命令在选中 internal 子 agent 的共享输入框中
274
+ 也可以使用;切换布局会保留未发送的子 agent 输入,不会停止运行中的任务。
275
+ 子 agent 激活时,在空输入框按 `↓` 或点击底栏可进入 Agents 选择;再按 `↓`
276
+ 进入 provider 设置和 cron 控制。`Esc` 返回原 agent 的输入框,选择 agent 后按
277
+ `Enter` 打开它。也可以直接点击底栏的 provider 名称进入设置。
278
+
192
279
  `uclaude`、`ucodex`、`uagy`、`ukimi`、`ucode` 这些直接包装器仍然可用,但 ufoo 的
193
280
  主要工作流是在 chat 里完成。
194
281
 
@@ -243,9 +330,10 @@ unregister 都带上该 handle;它是所有权凭证,不应发送给其他 A
243
330
  写进 report。
244
331
 
245
332
  - **Codex App:**前台调用 MCP `wait_for_message`,传入注册所得 subscriber
246
- 和 handle,首次使用 `after_seq: 0`、`timeout_seconds: 600`。工具调用在
247
- ufoo 内保持 pending;有消息立即返回并唤醒当前任务,不依赖 shell stdout。
248
- 超时后用相同游标续挂;处理消息后,用同一 handle 和返回的 `last_seq`
333
+ 和 handle,首次使用 `after_seq: 0`、`timeout_seconds: 0`。工具调用在
334
+ 独立的 `ufoo_wait` MCP 连接中持续等待消息或调用方取消,空闲时不会周期性
335
+ 唤醒模型;有消息立即返回并唤醒当前任务,不依赖 shell stdout。
336
+ 处理消息后,用同一 handle,并以返回的 `last_seq` 作为 `through_seq`
249
337
  调用 MCP `ack_bus`,Agent 再次空闲时以该 `last_seq` 续挂。
250
338
  - **Cursor:**在 monitored background shell 中绑定 MCP subscriber,再运行
251
339
  `export UFOO_SUBSCRIBER_ID="<subscriber-id>"; exec ufoo bus poll
@@ -255,7 +343,10 @@ unregister 都带上该 handle;它是所有权凭证,不应发送给其他 A
255
343
 
256
344
  两条路径都把空闲检查留在 LLM 之外。仅有后台 PTY 输出并不能唤醒 Codex App。
257
345
 
258
- poll skill 不会由 postinstall 或 `skills install all` 安装。如果
346
+ poll skill 不会由 postinstall 或 `skills install all` 首次安装。postinstall
347
+ 只更新确认归 ufoo 管理的符号链接,保留用户目录、文件和外部链接;手动安装
348
+ 会把原内容保存在旁边的 `.backup-*` 路径。`skills install all` 可更新已安装
349
+ 的可选技能。如果
259
350
  `UFOO_SUBSCRIBER_ID` 在 Agent 启动时的继承环境中已经存在,包装器托管的
260
351
  Agent 就跳过 MCP 注册和外部等待;之后在 Cursor 监听 terminal 中导出的值
261
352
  不会重新触发这次分类。接收链路由宿主 App 的能力决定,与外部 Agent 叫
@@ -285,10 +376,29 @@ ufoo history prompt 30
285
376
  ufoo report start "Implement README refresh" --task docs-readme --agent builder
286
377
  ufoo report done "README updated" --task docs-readme --agent builder
287
378
  ufoo report list
379
+
380
+ ufoo trace <task-id> --json
381
+ ufoo trace --agent <id-or-nickname> --follow
382
+ ufoo trace --details --limit 2000
288
383
  ```
289
384
 
290
385
  Decision 只用于计划级约束;长期项目事实应写入 memory。
291
386
 
387
+ `trace` 可串联父子任务的模型、工具、报告、队列与压缩记录,不启动 daemon、
388
+ 不调用模型。MCP 提供相同的只读工具 `read_agent_trace`。参数和结果经过脱敏;
389
+ 读取范围受限、数据缺失或未写完时,JSON 中会明确标记。
390
+
391
+ `ufoo metrics --json` 汇总执行结果、耗时、tokens、工具错误/重复、报告长度
392
+ 与委派验收。保存报告后,可用 `ufoo metrics --baseline baseline.json --json`
393
+ 对比后续样本。MCP 提供 `read_agent_metrics`;指标口径和优化流程见
394
+ [OBSERVABILITY.md](OBSERVABILITY.md)。缺失证据保留 unknown,执行完成与
395
+ 验收通过分开统计。
396
+
397
+ report 和 agent 交接默认使用 1–4 行短消息,包含结果、改动、检查和阻塞;
398
+ 详细计划或证据写入工作区文件,并附准确路径。internal agent 向同伴转发
399
+ 最终回复,过程与工具输出保留在自己的窗口。internal Codex 在 workspace
400
+ 沙箱内开启网络权限,支持 ADB、Gradle 等本地端口服务。
401
+
292
402
  ### Group
293
403
 
294
404
  内置 group 模板位于 `templates/groups/`。
@@ -318,6 +428,14 @@ ufoo online inbox builder --unread
318
428
  默认公开服务地址是 `https://online.ufoo.dev`。本地开发可以用
319
429
  `ufoo online server` 启动自己的 relay。
320
430
 
431
+ Internal Codex、Claude Code 和 ucode 窗格复用独立 ucode TUI 的内容渲染,共用底部一个多行输入框。
432
+ 提交后立即显示 loading;等待、思考、生成、工具执行、等待用户、失败、运行计时、
433
+ 上下文用量和计划进度随当前 agent 的真实事件变化。provider 提供的重试、上下文压缩
434
+ 和后台任务事件也接入同一状态层。
435
+ 文本、思考和工具结果随 provider 事件刷新;在选中的窗格按 Ctrl+O 可展开最近的思考或工具块。
436
+ 显示事件独立于 agent 收件箱,agent 之间派发的任务也能显示,且不会唤醒主 agent。
437
+ 切换单主窗格、激活子窗格和全部子窗格时,保留输出与输入草稿。
438
+
321
439
  ### 原生 ucode 运行时
322
440
 
323
441
  ```bash
@@ -340,22 +458,48 @@ ufoo ucode build
340
458
  {
341
459
  "launchMode": "auto",
342
460
  "agentProvider": "codex-cli",
343
- "controllerMode": "main",
344
- "codexInternalThreadMode": "api",
345
461
  "codexAuthPath": "",
346
462
  "codexOauthRefreshWindowSec": 300,
347
463
  "claudeOauthProfile": "",
348
464
  "claudeOauthTokenPath": "",
349
465
  "claudeOauthRefreshWindowSec": 300,
350
- "routerProvider": "",
351
- "routerModel": "",
352
466
  "agentModel": "",
353
- "autoResume": true
467
+ "autoResume": false
354
468
  }
355
469
  ```
356
470
 
471
+ internal Codex 和 Claude 固定使用各自 SDK,不再提供 thread mode 配置。
472
+
357
473
  `launchMode` 支持 `auto`、`internal`、`tmux`、`terminal`、`host`。
358
- `controllerMode` 支持 `main`、`shadow`、`loop` 和 legacy 兼容值。
474
+ 面板仅支持 internal Codex、Claude 和 ucode 子 agent;provider 的类型独立于 worker 类型。
475
+
476
+ 面板固定使用 internal 子 agent,不提供 `/mode` 命令,二进制也不提供
477
+ `ufoo mode` 命令。直接运行 `ucodex` 或
478
+ `uclaude` 时,包装器通过环境识别 tmux、host 会话、Terminal.app 或 iTerm2,
479
+ 并向 daemon 登记实际终端类型、TTY 及消息通道,无需打开面板即可通过 event bus
480
+ 互联。MCP agent 使用 MCP 消息接口通信,不需要终端适配器。
481
+ 主 agent 使用同一个 runtime 完成编码与路由,只配置 `agentProvider` 和
482
+ `agentModel`。`/settings agent` 管理主 agent 配置,`/settings ucode` 管理
483
+ 独立的 ucode 网关配置。
484
+
485
+ 底部 Settings 提供 `custom`、`model`、`thinking`。选择 `custom` 后依次输入
486
+ API 地址和隐藏显示的 key,再选择模型与思考强度。也可以使用
487
+ `/settings agent custom`、`/settings agent model`、`/settings agent thinking`。
488
+ 模型菜单读取当前 provider 的完整可选目录,包括分页结果;Codex 菜单会过滤
489
+ provider 标记为隐藏的内部模型。服务没有 `/models`
490
+ 接口时可以手动输入模型 ID。切换模型与思考强度保留当前对话,并用于下一次
491
+ 请求;切换 provider 会开始新对话,旧对话仍保留在 runtime 存储中。
492
+ OpenAI 思考强度提供独立的 `xhigh` 和 `max`,请求会保留所选值。
493
+ provider 配置了网关时,模型列表来自该网关;升级 agent SDK 不会改变网关的目录。
494
+
495
+ custom 使用项目 `.ufoo/config.json` 中的 `agentProvider: "custom"`、
496
+ `agentBaseUrl`、`agentApiKey`、`agentModel`、`agentThinking`。
497
+ 默认使用 OpenAI Chat Completions 协议,地址以 `/responses` 结尾时使用
498
+ OpenAI Responses。custom 不提供 Anthropic 协议选项;internal Claude
499
+ 保留自身的原生接入与凭据。
500
+
501
+ 普通 provider 会话通过各自的凭据适配器认证;MCP `agent_handle` 不用于模型请求。
502
+ 独立和 internal ucode 使用下面的独立网关设置。
359
503
 
360
504
  全局 `ucode` 配置:
361
505
 
@@ -379,8 +523,8 @@ src/
379
523
  runtime/ daemon、projects、terminal adapters、contracts、privacy、process helpers
380
524
  coordination/ bus、context、memory、history、reports、state、status
381
525
  orchestration/ router/controller logic、groups、solo roles
382
- agents/ launchers、providers、prompts、internal runner、activity、controller
383
- code/ 原生 ucode runtime、launcher、skills、file/shell tools
526
+ agents/ shared runtime、capabilities、profiles、providers、launchers、prompts
527
+ code/ 原生 ucode host、launcher、skills、file/shell tools
384
528
  tools/ shared controller/worker tool registry 和 handlers
385
529
  online/ relay client/server/runner/token helpers
386
530
  ```
@@ -392,6 +536,7 @@ src/
392
536
 
393
537
  ```bash
394
538
  npm install
539
+ npm run pack:tui
395
540
  npm link
396
541
  node bin/ufoo.js --help
397
542
  npm test
@@ -37,7 +37,13 @@ capabilities from the Agent type or subscriber prefix.
37
37
 
38
38
  In the sections below, `<subscriber-id>` means the wrapper-provided
39
39
  `UFOO_SUBSCRIBER_ID` or the subscriber returned by MCP. `<agent-handle>` means
40
- the opaque capability returned with an external MCP registration.
40
+ the opaque capability returned with an external MCP registration or supplied
41
+ as `UFOO_AGENT_HANDLE` by a current wrapper. When MCP and a handle are available,
42
+ both launch modes prefer `dispatch_message`, `ack_bus`, and
43
+ `report_agent_status` with their existing identity. The CLI examples below are
44
+ the compatibility fallback. Never expose the handle in messages or reports.
45
+ Managed identities must not call MCP `wait_for_message`,
46
+ `publish_activity_state`, or `unregister_agent`; the wrapper owns those duties.
41
47
 
42
48
  ## Synchronize workspace state
43
49
 
@@ -54,6 +60,10 @@ the opaque capability returned with an external MCP registration.
54
60
 
55
61
  ## Handle delivered messages
56
62
 
63
+ Use the same natural language as the user's task prompt for replies, progress,
64
+ report summaries, and handoffs, unless the user requests another language.
65
+ Preserve that language when delegating; English protocol text does not override it.
66
+
57
67
  Treat these prompt prefixes as work inputs:
58
68
 
59
69
  - `[ufoo]<from:id(nickname)>` — event-bus delivery from direct injection or the
@@ -63,7 +73,11 @@ Treat these prompt prefixes as work inputs:
63
73
  For each received bus task:
64
74
 
65
75
  1. Execute it immediately within the current authority.
66
- 2. Acknowledge it only after handling. A wrapper-managed Agent uses:
76
+ 2. In internal mode (`UFOO_LAUNCH_MODE=internal`), the runner confirms the
77
+ delivered task after execution. Do not check or acknowledge the inbox
78
+ yourself; queued messages are future tasks. CLI/MCP ack calls for internal
79
+ agents leave those messages pending.
80
+ Outside internal mode, acknowledge only after handling. A wrapper-managed Agent uses:
67
81
 
68
82
  ```bash
69
83
  ufoo bus ack "<subscriber-id>"
@@ -77,16 +91,38 @@ For each received bus task:
77
91
  uses:
78
92
 
79
93
  ```bash
80
- ufoo report done "<summary>" --agent "<subscriber-id>"
94
+ ufoo report done "<summary>" --task "<delegated-task-id>" --agent "<subscriber-id>"
81
95
  ```
82
96
 
83
97
  An external Agent calls MCP `report_agent_status` with the same subscriber
84
- and handle.
98
+ and handle, plus the exact delegated `task_id`. Reuse that task ID for
99
+ start/progress/done/error; do not invent another ID or infer it from the
100
+ newest conversation. `done` reports execution completion; the parent
101
+ separately validates and accepts the result. Retain the delegation’s
102
+ requested scope and controller: private controller work uses
103
+ `--scope private --controller ufoo-agent`, or the corresponding MCP fields.
104
+
105
+ Acknowledgement-only inputs, repeated completion notices, and unchanged status
106
+ are not new work. If they contain no question, action, new result, or remaining
107
+ assigned obligation, end silently without a bus reply, lifecycle report, or
108
+ final response. Internal final text is automatically sent to the peer: do not
109
+ write "received", "confirmed", or "nothing to do" as a final reply. Never
110
+ acknowledge an acknowledgement or report receipt of a report. Perform an
111
+ assigned validation of a new result once; report the substantive outcome only.
112
+
85
113
  After sending or broadcasting, continue the current task. Do not start an
86
114
  ad-hoc check or poll, sleep, or wait for a reply. A wrapper-managed Agent
87
115
  receives follow-ups by direct injection; an external Agent leaves its existing
88
116
  App-specific `$ufoo-bus-poll` receive wait armed when idle.
89
117
 
118
+ Keep reports, peer handoffs and final replies to 1-4 short lines and at most
119
+ 600 characters unless the user requests inline detail. A result includes the
120
+ outcome, changed files or commit, exact checks (pass/fail/not run), and blockers;
121
+ a handoff adds the next owner's action. Put longer plans, findings and logs in
122
+ a workspace note or existing evidence file and send its exact path. Report only
123
+ new information; omit tool transcripts, repeated analysis and duplicated final
124
+ summaries. Preserve assigned task IDs and required acceptance evidence.
125
+
90
126
  ## Preserve shared knowledge
91
127
 
92
128
  Record a decision only for architecture, meaningful trade-offs, cross-agent
@@ -43,8 +43,22 @@ signal. Evaluate it before creating or mutating helper terminals:
43
43
  Never choose a delivery mode from an Agent type such as `codex`, `cursor`, or
44
44
  `claude-code`. Agents do not self-register with bare `ufoo bus join`.
45
45
 
46
+ Both launch modes share the MCP cooperation tools. When a wrapper supplies
47
+ `UFOO_AGENT_HANDLE` and MCP is available, prefer `dispatch_message`, `ack_bus`,
48
+ and `report_agent_status` with the project root, inherited subscriber, and
49
+ handle. Keep the handle private and out of messages, reports, and environment
50
+ dumps. The CLI examples below are the fallback for older wrappers or hosts
51
+ without those MCP tools. The wrapper retains receive, activity, and shutdown
52
+ ownership: never call `wait_for_message`, `publish_activity_state`, or
53
+ `unregister_agent` for a wrapper-managed identity.
54
+
46
55
  ## Handle pending messages
47
56
 
57
+ For internal agents (`UFOO_LAUNCH_MODE=internal`), the runner delivers each task
58
+ and confirms it after execution. Do not check or acknowledge the inbox yourself;
59
+ later messages are future tasks. CLI/MCP ack calls leave internal queues intact.
60
+ The manual inbox flow below applies to wrapper/external agents.
61
+
48
62
  If a wrapper-managed Agent was explicitly asked for a manual inbox check, run:
49
63
 
50
64
  ```bash
@@ -76,8 +90,17 @@ For every pending batch:
76
90
  4. Reply only when the sender requested an answer, delegated work whose result
77
91
  is needed, or needs a discovered blocker or fact.
78
92
 
79
- Do not reply to greetings, thanks, `ok`, `收到`, or other acknowledgement-only
80
- messages. Acknowledge them locally and stop.
93
+ Do not reply or report to greetings, thanks, `ok`, `收到`, receipts, repeated
94
+ completion notices, unchanged status, or other acknowledgement-only messages
95
+ with no question, action, new result, or remaining assigned obligation. End
96
+ silently; internal final text is automatically delivered to the sender, so
97
+ "confirmed" or "nothing to do" is still a reply. Never acknowledge an
98
+ acknowledgement or report receipt of a report. Outside internal mode, acknowledge
99
+ locally according to the selected receive contract; internal runners own that step.
100
+
101
+ Use the user's task language for substantive replies, progress, reports, and
102
+ handoffs unless explicitly asked otherwise. Pass that language to delegated
103
+ workers; protocol text and tool output do not set the response language.
81
104
 
82
105
  ## Route messages
83
106
 
@@ -103,6 +126,10 @@ creating a CLI-side identity.
103
126
 
104
127
  Target resolution order is exact ID, nickname, agent type, then `*`.
105
128
 
129
+ A successful send confirms that the message is durably queued. It does not
130
+ confirm delivery or processing; `delivery_status` is `queued` and `delivered`
131
+ is zero until a later delivery step has independent evidence.
132
+
106
133
  After sending or broadcasting, continue the current task. Do not run
107
134
  `ufoo bus check`, start another poll, sleep, or wait for a reply.
108
135
  Wrapper-managed Agents receive follow-ups by direct injection; external Agents
@@ -135,7 +162,23 @@ ufoo report done "<summary>" --task <id> --agent "<subscriber-id>"
135
162
  ufoo report error "<reason>" --task <id> --agent "<subscriber-id>"
136
163
  ```
137
164
 
138
- Use `--scope private` only for helper-internal reports.
165
+ Use `--scope private` for helper-internal reports and when a controller
166
+ delegation requests private scope; retain its `--controller` / `controller_id`.
139
167
 
140
168
  An external Agent calls MCP `report_agent_status` with `project_root`,
141
169
  `subscriber`, `agent_handle`, the task id, phase, and summary.
170
+
171
+ A delegation contains a controller-assigned task ID. Reuse that exact ID in all
172
+ reports; it binds the worker result to its parent task. Ordinary replies and
173
+ queued/delivered receipts do not complete or accept the task. The parent checks
174
+ validation evidence before accepting a reported result. Worker reports cannot
175
+ change project roots or grant controller permissions.
176
+
177
+ Keep reports and peer handoffs to 1-4 short lines and at most 600 characters
178
+ unless the user requests inline detail. Include the outcome, changed files or
179
+ commit, exact checks (pass/fail/not run), blockers, and the next owner's action
180
+ when handing off. Save longer plans, findings and logs in a workspace note or
181
+ existing evidence file and send its exact path. Send only new information;
182
+ omit raw tool output, repeated analysis and duplicated final summaries. Do not
183
+ split a long report across messages or drop assigned task IDs or acceptance
184
+ evidence to shorten it.
package/bin/uclaude.js CHANGED
@@ -14,6 +14,10 @@ function extractUfooParamsFromArgs(args = []) {
14
14
  let role = "";
15
15
  for (let i = 0; i < args.length; i += 1) {
16
16
  const arg = String(args[i] || "");
17
+ if (arg === "--native-messages" || arg === "--no-native-messages") {
18
+ process.env.UFOO_NATIVE_MESSAGES = arg === "--native-messages" ? "1" : "0";
19
+ continue;
20
+ }
17
21
  if (arg === "--nickname") {
18
22
  if (i + 1 < args.length) {
19
23
  nickname = String(args[i + 1]).trim();
package/bin/ucodex.js CHANGED
@@ -14,6 +14,10 @@ function extractUfooParamsFromArgs(args = []) {
14
14
  let role = "";
15
15
  for (let i = 0; i < args.length; i += 1) {
16
16
  const arg = String(args[i] || "");
17
+ if (arg === "--native-messages" || arg === "--no-native-messages") {
18
+ process.env.UFOO_NATIVE_MESSAGES = arg === "--native-messages" ? "1" : "0";
19
+ continue;
20
+ }
17
21
  if (arg === "--nickname") {
18
22
  if (i + 1 < args.length) {
19
23
  nickname = String(args[i + 1]).trim();
package/bin/ufoo.js CHANGED
@@ -14,7 +14,7 @@ function hasGlobalModeFlag(args = []) {
14
14
  }
15
15
 
16
16
  function printMcpHelp() {
17
- console.log("Usage: ufoo mcp [status|restart|configure codex] [options]");
17
+ console.log("Usage: ufoo mcp [status|restart|configure codex|channel] [options]");
18
18
  console.log("");
19
19
  console.log("Run the stdio compatibility proxy or control the global MCP listener.");
20
20
  console.log("");
@@ -59,6 +59,8 @@ async function main() {
59
59
  } else if (operation === "configure") {
60
60
  const { runMcpConfigureCli } = require("../src/runtime/daemon/mcpConfigure");
61
61
  runMcpConfigureCli(argv[2], { dryRun: argv.includes("--dry-run") });
62
+ } else if (operation === "channel") {
63
+ await require("../src/runtime/daemon/claudeChannel").runClaudeChannel();
62
64
  } else {
63
65
  await runMcpServer({
64
66
  autoStart: !argv.includes("--no-auto-start"),
@@ -118,7 +120,7 @@ async function main() {
118
120
  inOnlineSection = false;
119
121
  continue;
120
122
  }
121
- // Parse agent line: "ufoo-code:abc123 (nickname)"
123
+ // Parse agent line: "ucode:abc123 (nickname)"
122
124
  const agentMatch = trimmedLine.match(/^[-\s]*([a-z-]+:[a-f0-9]+|[a-z-]+)(?:\s+\(([^)]+)\))?/i);
123
125
  if (agentMatch) {
124
126
  const subscriberId = agentMatch[1];
@@ -148,7 +150,7 @@ async function main() {
148
150
  let scriptName = "";
149
151
  let displayName = "";
150
152
 
151
- if (agentType === "ufoo-code") {
153
+ if (agentType === "ucode") {
152
154
  scriptName = "ucode.js";
153
155
  displayName = "ucode";
154
156
  } else if (agentType === "claude-code") {
@@ -196,7 +198,7 @@ async function main() {
196
198
  const targetLower = target.toLowerCase();
197
199
  let scriptName = "";
198
200
 
199
- if (targetLower === "ucode" || targetLower === "ufoo-code" || targetLower === "ufoo") {
201
+ if (targetLower === "ucode") {
200
202
  scriptName = "ucode.js";
201
203
  } else if (targetLower === "uclaude" || targetLower === "claude-code" || targetLower === "claude") {
202
204
  scriptName = "uclaude.js";
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u-foo",
3
- "version": "3.1.7",
3
+ "version": "4.0.1",
4
4
  "description": "Multi-Agent Workspace Protocol. Just add u. claude → uclaude, codex → ucodex.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://ufoo.dev",
@@ -41,7 +41,8 @@
41
41
  "SKILLS/",
42
42
  "OPTIONAL_SKILLS/",
43
43
  "LICENSE",
44
- "README.md"
44
+ "README.md",
45
+ "OBSERVABILITY.md"
45
46
  ],
46
47
  "type": "commonjs",
47
48
  "engines": {
@@ -56,19 +57,25 @@
56
57
  "test:coverage": "jest --coverage"
57
58
  },
58
59
  "dependencies": {
59
- "@anthropic-ai/claude-agent-sdk": "^0.2.138",
60
- "@modelcontextprotocol/sdk": "^1.30.0",
61
- "@openai/codex-sdk": "^0.145.0",
62
- "@xterm/addon-serialize": "^0.14.0",
63
- "@xterm/headless": "^6.0.0",
60
+ "@anthropic-ai/claude-agent-sdk": "^0.3.295",
61
+ "@anthropic-ai/sdk": "^0.132.1",
62
+ "@modelcontextprotocol/sdk": "^1.32.1",
63
+ "@openai/codex-sdk": "^0.162.0",
64
64
  "chalk": "^4.1.2",
65
65
  "commander": "^13.1.0",
66
66
  "gray-matter": "^4.0.3",
67
67
  "node-pty": "^1.1.0",
68
+ "proper-lockfile": "^4.1.2",
68
69
  "undici": "^6.28.0",
69
70
  "ws": "^8.19.0"
70
71
  },
71
72
  "devDependencies": {
72
73
  "jest": "^30.2.0"
74
+ },
75
+ "overrides": {
76
+ "js-yaml": {
77
+ "argparse": "^2.0.1"
78
+ },
79
+ "@hono/node-server": "^1.19.15"
73
80
  }
74
81
  }
@@ -13,6 +13,37 @@ const LEGACY_COMMAND_NAMES = Object.freeze([
13
13
  "ustatus",
14
14
  ]);
15
15
 
16
+ // A matching name is not ownership evidence: user-authored skills must survive
17
+ // npm install. Only links into this package (or another verified u-foo install)
18
+ // may be refreshed automatically.
19
+ function isManagedSkillLink(linkPath, source) {
20
+ try {
21
+ if (!fs.lstatSync(linkPath).isSymbolicLink()) return false;
22
+ const target = path.resolve(path.dirname(linkPath), fs.readlinkSync(linkPath));
23
+ if (target === path.resolve(source)) return true;
24
+ if (path.basename(target) !== path.basename(source)) return false;
25
+ const collection = path.basename(path.dirname(target));
26
+ if (!["SKILLS", "OPTIONAL_SKILLS"].includes(collection)) return false;
27
+ const manifest = JSON.parse(fs.readFileSync(path.join(target, "..", "..", "package.json"), "utf8"));
28
+ return manifest.name === "u-foo";
29
+ } catch { return false; }
30
+ }
31
+
32
+ function installManagedSkillLink(source, target) {
33
+ try {
34
+ fs.lstatSync(target);
35
+ if (!isManagedSkillLink(target, source)) return "conflict";
36
+ const current = path.resolve(path.dirname(target), fs.readlinkSync(target));
37
+ if (current === path.resolve(source)) return "unchanged";
38
+ fs.unlinkSync(target);
39
+ } catch (error) {
40
+ if (error.code !== "ENOENT") throw error;
41
+ }
42
+ fs.mkdirSync(path.dirname(target), { recursive: true });
43
+ fs.symlinkSync(source, target);
44
+ return "installed";
45
+ }
46
+
16
47
  function removeManagedSymlink(linkPath, expectedTarget) {
17
48
  try {
18
49
  const stat = fs.lstatSync(linkPath);
@@ -73,9 +104,31 @@ function removeLegacySkillAndCommandLinks({ pkgRoot, home, codexHome } = {}) {
73
104
  return removed;
74
105
  }
75
106
 
107
+ function refreshInstalledOptionalSkills({ pkgRoot, targetDirs = [] } = {}) {
108
+ const optionalRoot = path.join(pkgRoot, "OPTIONAL_SKILLS");
109
+ if (!fs.existsSync(optionalRoot)) return [];
110
+ const refreshed = [];
111
+ for (const entry of fs.readdirSync(optionalRoot, { withFileTypes: true })) {
112
+ const source = path.join(optionalRoot, entry.name);
113
+ if (!entry.isDirectory() || !fs.existsSync(path.join(source, "SKILL.md"))) continue;
114
+ for (const targetDir of new Set(targetDirs)) {
115
+ const target = path.join(targetDir, entry.name);
116
+ try { fs.lstatSync(target); } catch { continue; }
117
+ // Do not install new opt-in skills, and do not remove a skill when this
118
+ // checkout is already its source.
119
+ try { if (fs.realpathSync(target) === fs.realpathSync(source)) continue; } catch { /* stale link */ }
120
+ if (installManagedSkillLink(source, target) === "installed") refreshed.push(target);
121
+ }
122
+ }
123
+ return refreshed;
124
+ }
125
+
76
126
  module.exports = {
77
127
  RETIRED_DEFAULT_SKILLS,
78
128
  LEGACY_COMMAND_NAMES,
79
129
  removeManagedSymlink,
80
130
  removeLegacySkillAndCommandLinks,
131
+ refreshInstalledOptionalSkills,
132
+ installManagedSkillLink,
133
+ isManagedSkillLink,
81
134
  };