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.
- package/OBSERVABILITY.md +65 -0
- package/README.md +238 -21
- package/README.zh-CN.md +165 -20
- package/SKILLS/ufoo/SKILL.md +40 -4
- package/SKILLS/ufoo-bus/SKILL.md +46 -3
- package/bin/uclaude.js +4 -0
- package/bin/ucodex.js +4 -0
- package/bin/ufoo.js +6 -4
- package/dist/tui/darwin-arm64/ufoo-tui +0 -0
- package/dist/tui/darwin-x64/ufoo-tui +0 -0
- package/dist/tui/linux-arm64/ufoo-tui +0 -0
- package/dist/tui/linux-x64/ufoo-tui +0 -0
- package/package.json +14 -7
- package/scripts/postinstall-skills.js +53 -0
- package/scripts/postinstall.js +11 -16
- package/scripts/smoke-native-messages.js +214 -0
- package/src/agents/activity/activityDetector.js +1 -1
- package/src/agents/activity/activityStateWriter.js +37 -38
- package/src/agents/capabilities/agentManagement/index.js +4 -0
- package/src/agents/capabilities/agentManagement/service.js +140 -0
- package/src/agents/capabilities/agentRouting/index.js +4 -0
- package/src/agents/capabilities/coding/index.js +32 -0
- package/src/agents/capabilities/coordination/index.js +37 -0
- package/src/agents/capabilities/globalRouting/index.js +5 -0
- package/src/agents/capabilities/groups/index.js +3 -0
- package/src/agents/capabilities/index.js +25 -0
- package/src/agents/capabilities/planning/index.js +123 -0
- package/src/agents/capabilities/planning/main.js +28 -0
- package/src/agents/capabilities/projectDiscovery/index.js +3 -0
- package/src/agents/capabilities/scheduling/index.js +3 -0
- package/src/agents/capabilities/sharedMemory/index.js +4 -0
- package/src/agents/capabilities/skills/index.js +12 -0
- package/src/agents/capabilities/taskExecution/index.js +3 -0
- package/src/agents/capabilities/taskReports/index.js +6 -0
- package/src/agents/controller/controllerToolExecutor.js +40 -22
- package/src/agents/controller/index.js +1 -6
- package/src/agents/internal/internalRunner.js +181 -76
- package/src/agents/launch/index.js +0 -1
- package/src/agents/launch/launcher.js +96 -14
- package/src/agents/launch/nativeCapabilities.js +40 -0
- package/src/agents/launch/nativeMessages.js +362 -0
- package/src/agents/launch/notifier.js +15 -20
- package/src/agents/launch/readyDetector.js +28 -14
- package/src/agents/profiles/coding.js +6 -0
- package/src/agents/profiles/globalRouter.js +2 -0
- package/src/agents/profiles/main.js +5 -0
- package/src/agents/prompts/cooperation.js +14 -0
- package/src/agents/prompts/defaultBootstrap.js +1 -1
- package/src/agents/prompts/groupBootstrap.js +32 -6
- package/src/agents/prompts/mainAgent.js +48 -0
- package/src/agents/prompts/native/system.js +4 -1
- package/src/agents/prompts/native/tasks.js +2 -2
- package/src/agents/prompts/native/ufoo.js +14 -3
- package/src/agents/prompts/promptProfiles.js +2 -0
- package/src/agents/prompts/reporting.js +16 -0
- package/src/agents/providers/claudeEventTranslator.js +9 -1
- package/src/agents/providers/claudeThreadProvider.js +47 -4
- package/src/agents/providers/clientIdentity.js +75 -0
- package/src/agents/providers/codexEventTranslator.js +68 -7
- package/src/agents/providers/codexThreadProvider.js +18 -8
- package/src/agents/providers/credentials/claude.js +10 -3
- package/src/agents/providers/credentials/index.js +2 -0
- package/src/agents/providers/directAuthStatus.js +1 -1
- package/src/agents/providers/index.js +1 -1
- package/src/agents/providers/modelSettings.js +34 -0
- package/src/agents/providers/modelsCatalog.js +379 -0
- package/src/agents/providers/nativeTransport.js +1146 -0
- package/src/agents/providers/runtimeConfig.js +188 -0
- package/src/agents/providers/thinkingLevels.js +106 -0
- package/src/agents/providers/transports/anthropicMessagesTransport.js +121 -0
- package/src/agents/providers/transports/index.js +10 -0
- package/src/agents/providers/transports/openaiChatTransport.js +117 -0
- package/src/agents/providers/transports/openaiResponsesTransport.js +120 -0
- package/src/agents/providers/transports/responsesProtocol.js +504 -0
- package/src/agents/providers/transports/systemBlocks.js +16 -0
- package/src/agents/providers/transports/transportContract.js +50 -0
- package/src/agents/providers/transports/visionBlocks.js +151 -0
- package/src/agents/providers/upstreamRuntime.js +135 -0
- package/src/agents/runtime/composeCapabilities.js +89 -0
- package/src/agents/runtime/context/checkpointStore.js +38 -0
- package/src/agents/runtime/context/commandStore.js +43 -0
- package/src/agents/runtime/context/compaction.js +151 -0
- package/src/agents/runtime/context/contextBudget.js +93 -0
- package/src/agents/runtime/context/contextWindow.js +119 -0
- package/src/agents/runtime/context/fileLock.js +36 -0
- package/src/agents/runtime/context/replayHistory.js +28 -0
- package/src/agents/runtime/context/runtimeStore.js +127 -0
- package/src/agents/runtime/context/sessionJournal.js +360 -0
- package/src/agents/runtime/context/sessionStore.js +57 -0
- package/src/agents/runtime/core/agentLoop.js +351 -0
- package/src/agents/runtime/core/executionBudget.js +36 -0
- package/src/agents/runtime/core/stableJson.js +29 -0
- package/src/agents/runtime/core/toolLoopGuard.js +55 -0
- package/src/agents/runtime/createAgentRuntime.js +259 -0
- package/src/agents/runtime/index.js +14 -0
- package/src/agents/runtime/prompts/responseLanguage.js +12 -0
- package/src/agents/runtime/protocol/faultHarness.js +90 -0
- package/src/agents/runtime/protocol/materialize.js +107 -0
- package/src/agents/runtime/protocol/runObservation.js +24 -0
- package/src/agents/runtime/protocol/toolCallLedger.js +221 -0
- package/src/agents/runtime/protocol/traceContext.js +9 -0
- package/src/agents/runtime/tasks/resourceLease.js +66 -0
- package/src/agents/runtime/tasks/scheduler.js +73 -0
- package/src/agents/runtime/tools/registry.js +57 -0
- package/src/app/chat/ChatController.js +29 -45
- package/src/app/chat/agentDirectory.js +9 -18
- package/src/app/chat/bootstrap.js +1 -2
- package/src/app/chat/commandExecutor.js +111 -313
- package/src/app/chat/commands.js +39 -45
- package/src/app/chat/daemonConnection.js +58 -5
- package/src/app/chat/daemonMessageRouter.js +61 -48
- package/src/app/chat/historyStore.js +12 -48
- package/src/app/chat/inputSubmitHandler.js +21 -35
- package/src/app/chat/internalAgentLogHistory.js +19 -60
- package/src/app/chat/launchRequestContext.js +42 -0
- package/src/app/chat/multiWindow/paneManager.js +91 -164
- package/src/app/chat/streamState.js +3 -7
- package/src/app/chat/transport.js +1 -1
- package/src/app/cli/busCoreCommands.js +9 -0
- package/src/app/cli/features/doctor.js +33 -0
- package/src/app/cli/features/init.js +5 -5
- package/src/app/cli/features/skills.js +16 -4
- package/src/app/cli/metricsCommands.js +68 -0
- package/src/app/cli/reportCoreCommands.js +37 -0
- package/src/app/cli/run.js +82 -42
- package/src/app/cli/traceCommands.js +36 -0
- package/src/code/agent.js +34 -17
- package/src/code/busConsumer.js +1 -3
- package/src/code/commands.js +1 -1
- package/src/code/context/artifacts.js +12 -11
- package/src/code/context/assembler.js +9 -9
- package/src/code/context/promptLayers.js +1 -13
- package/src/code/context/stableJson.js +2 -27
- package/src/code/context/stateCommit.js +2 -1
- package/src/code/contextWindow.js +2 -117
- package/src/code/conversation/sessionJournal.js +3 -349
- package/src/code/internalThread.js +107 -0
- package/src/code/launcher/ucode.js +1 -1
- package/src/code/launcher/ucodeBootstrap.js +1 -1
- package/src/code/modelCommand.js +11 -35
- package/src/code/nativeRunner.js +104 -2697
- package/src/code/protocol/faultHarness.js +2 -88
- package/src/code/protocol/materialize.js +2 -105
- package/src/code/protocol/toolCallLedger.js +5 -215
- package/src/code/providers/anthropicMessagesTransport.js +2 -118
- package/src/code/providers/modelsCatalog.js +1 -317
- package/src/code/providers/openaiChatTransport.js +2 -114
- package/src/code/providers/openaiResponsesTransport.js +2 -117
- package/src/code/providers/responsesProtocol.js +2 -497
- package/src/code/providers/transportContract.js +2 -48
- package/src/code/providers/visionBlocks.js +2 -149
- package/src/code/repl.js +2 -11
- package/src/code/sessionStore.js +27 -99
- package/src/code/taskDecomposer.js +18 -0
- package/src/code/thinkingLevels.js +1 -130
- package/src/code/toolBudget.js +1 -17
- package/src/code/toolLoopGuard.js +3 -49
- package/src/code/tools/artifactRead.js +1 -1
- package/src/code/tools/executor.js +373 -0
- package/src/code/tools/specs.js +312 -0
- package/src/config.js +95 -131
- package/src/coordination/bus/deliveryQueue.js +16 -2
- package/src/coordination/bus/index.js +14 -9
- package/src/coordination/bus/inject.js +15 -7
- package/src/coordination/bus/message.js +15 -1
- package/src/coordination/bus/nativeReceipts.js +100 -0
- package/src/coordination/bus/nickname.js +1 -1
- package/src/coordination/bus/queue.js +1 -3
- package/src/coordination/bus/subscriber.js +3 -2
- package/src/coordination/bus/utils.js +8 -4
- package/src/coordination/history/agentPerformance.js +279 -0
- package/src/coordination/history/agentSurface.js +142 -0
- package/src/coordination/history/agentTrace.js +249 -0
- package/src/coordination/memory/index.js +5 -21
- package/src/coordination/report/store.js +103 -83
- package/src/coordination/state/agentsStore.js +57 -3
- package/src/coordination/state/fileLock.js +2 -0
- package/src/coordination/state/workspaceAccess.js +36 -0
- package/src/orchestration/controller/index.js +1 -8
- package/src/orchestration/controller/launchRouting.js +1 -1
- package/src/orchestration/solo/commands.js +3 -1
- package/src/runtime/contracts/agentMode.js +26 -0
- package/src/runtime/contracts/eventContract.js +3 -0
- package/src/runtime/contracts/uiProtocol.js +20 -17
- package/src/runtime/daemon/agentHost.js +407 -0
- package/src/runtime/daemon/agentRecoveryGroups.js +70 -0
- package/src/runtime/daemon/busBridge.js +396 -0
- package/src/runtime/daemon/claudeChannel.js +159 -0
- package/src/runtime/daemon/controlPlaneService.js +28 -18
- package/src/runtime/daemon/cronOps.js +25 -17
- package/src/runtime/daemon/deliveryScheduler.js +32 -5
- package/src/runtime/daemon/globalDaemon.js +28 -1
- package/src/runtime/daemon/groupOrchestrator.js +21 -5
- package/src/runtime/daemon/groupStatus.js +20 -0
- package/src/runtime/daemon/index.js +120 -375
- package/src/runtime/daemon/ipcServer.js +32 -10
- package/src/runtime/daemon/mcpConfigure.js +113 -20
- package/src/runtime/daemon/mcpHttpServer.js +27 -5
- package/src/runtime/daemon/mcpServer.js +8 -5
- package/src/runtime/daemon/mcpStdioProxy.js +127 -10
- package/src/runtime/daemon/nicknameScope.js +1 -1
- package/src/runtime/daemon/ops.js +68 -40
- package/src/runtime/daemon/projectRuntimeGateway.js +2 -0
- package/src/runtime/daemon/promptRequest.js +92 -570
- package/src/runtime/daemon/providerSessions.js +67 -33
- package/src/runtime/daemon/reportControlBus.js +59 -25
- package/src/runtime/daemon/status.js +9 -6
- package/src/runtime/privacy/redactor.js +2 -2
- package/src/runtime/projects/identity.js +2 -1
- package/src/runtime/projects/registry.js +98 -38
- package/src/tools/controllerSchemas.js +28 -0
- package/src/tools/handlers/dispatchMessage.js +5 -2
- package/src/tools/handlers/listAgents.js +3 -1
- package/src/tools/handlers/readBusSummary.js +3 -1
- package/src/tools/handlers/readProjectRegistry.js +29 -2
- package/src/tools/handlers/routeAgent.js +35 -0
- package/src/tools/handlers/tier2.js +4 -2
- package/src/tools/index.js +1 -0
- package/src/tools/registry.js +6 -0
- package/src/tools/schemaFixtures.js +42 -5
- package/src/tools/tier0/readAgentMetrics.js +14 -0
- package/src/tools/tier0/readAgentTrace.js +12 -0
- package/src/tools/tier1/routeAgent.js +2 -2
- package/src/tools/tier2/runtimeCoordination.js +38 -0
- package/src/tools/types.js +2 -0
- package/src/ui/agentPresentation.js +109 -0
- package/src/ui/agentSettingsController.js +107 -0
- package/src/ui/agentSurface.js +270 -0
- package/src/ui/dashboardBridge.js +1 -1
- package/src/ui/format/banner.js +9 -15
- package/src/ui/format/index.js +14 -10
- package/src/ui/format/loopSummary.js +50 -0
- package/src/ui/format/markdownRenderer.js +3 -4
- package/src/ui/format/startupBanner.js +50 -0
- package/src/ui/multiPaneBusMirror.js +29 -3
- package/src/ui/rustChatHost.js +316 -599
- package/src/ui/rustMultiSession.js +288 -73
- package/src/ui/rustUcodeHost.js +21 -88
- package/src/ui/settingsBridge.js +34 -14
- package/src/ui/toolMergeBridge.js +0 -4
- package/src/ui/uiHostServer.js +5 -8
- package/src/agents/controller/loopObservability.js +0 -200
- package/src/agents/controller/loopRuntime.js +0 -472
- package/src/agents/controller/ufooAgent.js +0 -829
- package/src/agents/launch/ptyRunner.js +0 -1135
- package/src/agents/providers/upstreamTransport.js +0 -689
- package/src/app/chat/agentBar.js +0 -135
- package/src/app/chat/agentEnter.js +0 -70
- package/src/app/chat/agentSockets.js +0 -225
- package/src/app/chat/dashboardView.js +0 -405
- package/src/app/chat/multiWindow/index.js +0 -310
- package/src/app/chat/multiWindow/paneLayout.js +0 -84
- package/src/app/chat/multiWindow/renderer.js +0 -420
- package/src/app/chat/multiWindow/virtualTerminal.js +0 -327
- package/src/app/chat/multiWindow/vtFrame.js +0 -93
- package/src/app/chat/rawKeyMap.js +0 -42
- package/src/app/chat/settingsController.js +0 -111
- package/src/orchestration/controller/flags.js +0 -167
- package/src/orchestration/controller/gateRouter.js +0 -211
- package/src/orchestration/controller/routerFastPath.js +0 -22
- package/src/orchestration/controller/routerFinalize.js +0 -222
- package/src/orchestration/controller/shadowGuard.js +0 -280
- package/src/runtime/daemon/promptLoop.js +0 -136
- package/src/runtime/privacy/shadowDiff.js +0 -174
- package/src/ui/multiWindowHandoff.js +0 -232
- package/src/ui/ptyHandoff.js +0 -23
|
@@ -82,60 +82,10 @@ function parseStreamMessage(raw = "") {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
function
|
|
86
|
-
const clean = normalizeText(text);
|
|
87
|
-
if (!clean) return;
|
|
88
|
-
const parts = clean.split("\n");
|
|
89
|
-
parts.forEach((part, index) => {
|
|
90
|
-
if (index === parts.length - 1 && part === "") return;
|
|
91
|
-
lines.push(`${index === 0 ? prefix : " "}${part}`);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function appendUserText(lines, text, state) {
|
|
96
|
-
appendPrefixedText(lines, "> ", text);
|
|
97
|
-
state.replyActive = false;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function ensureAgentReplyPrefix(lines, prefix = "• ") {
|
|
101
|
-
if (lines.length === 0) {
|
|
102
|
-
lines.push(prefix);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
if (lines[lines.length - 1] === "") {
|
|
106
|
-
lines[lines.length - 1] = prefix;
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
lines.push(prefix);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function appendAgentStreamText(lines, text, state) {
|
|
113
|
-
const clean = normalizeText(text);
|
|
114
|
-
if (!clean) return;
|
|
115
|
-
for (const char of clean) {
|
|
116
|
-
if (char === "\n") {
|
|
117
|
-
lines.push("");
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
if (!state.replyActive) {
|
|
121
|
-
ensureAgentReplyPrefix(lines, "• ");
|
|
122
|
-
state.replyActive = true;
|
|
123
|
-
} else if (lines.length === 0 || lines[lines.length - 1] === "") {
|
|
124
|
-
ensureAgentReplyPrefix(lines, " ");
|
|
125
|
-
}
|
|
126
|
-
lines[lines.length - 1] += char;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function appendAgentMessage(lines, text, state) {
|
|
131
|
-
appendPrefixedText(lines, "• ", text);
|
|
132
|
-
state.replyActive = false;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function loadInternalAgentLogHistory(projectRoot, agentId, options = {}) {
|
|
85
|
+
function loadInternalAgentTranscript(projectRoot, agentId, options = {}) {
|
|
136
86
|
const paths = getUfooPaths(projectRoot || process.cwd());
|
|
137
87
|
const maxEvents = Number.isFinite(options.maxEvents) ? Math.max(1, options.maxEvents) : 400;
|
|
138
|
-
const
|
|
88
|
+
const maxEntries = Number.isFinite(options.maxEntries) ? Math.max(1, options.maxEntries) : 1000;
|
|
139
89
|
let agents = {};
|
|
140
90
|
try {
|
|
141
91
|
const bus = JSON.parse(fs.readFileSync(paths.agentsFile, "utf8"));
|
|
@@ -164,8 +114,15 @@ function loadInternalAgentLogHistory(projectRoot, agentId, options = {}) {
|
|
|
164
114
|
reversedEvents.push(...readMatchingEventsFromFileReverse(file, aliases, remaining));
|
|
165
115
|
}
|
|
166
116
|
|
|
167
|
-
const
|
|
168
|
-
|
|
117
|
+
const entries = [];
|
|
118
|
+
let streamEntry = null;
|
|
119
|
+
function append(kind, text, seq) {
|
|
120
|
+
const clean = normalizeText(text);
|
|
121
|
+
if (!clean) return null;
|
|
122
|
+
const entry = { id: `history-${seq || entries.length + 1}`, kind, text: clean };
|
|
123
|
+
entries.push(entry);
|
|
124
|
+
return entry;
|
|
125
|
+
}
|
|
169
126
|
for (const evt of reversedEvents.reverse()) {
|
|
170
127
|
const data = eventData(evt);
|
|
171
128
|
const rawMessage = typeof data.message === "string" ? data.message : "";
|
|
@@ -177,24 +134,26 @@ function loadInternalAgentLogHistory(projectRoot, agentId, options = {}) {
|
|
|
177
134
|
|
|
178
135
|
if (streamDelta !== null) {
|
|
179
136
|
if (isFromAgent && streamDelta) {
|
|
180
|
-
|
|
137
|
+
if (streamEntry) streamEntry.text += streamDelta;
|
|
138
|
+
else streamEntry = append("assistant", streamDelta, evt.seq);
|
|
181
139
|
} else if (isFromAgent) {
|
|
182
|
-
|
|
140
|
+
streamEntry = null;
|
|
183
141
|
}
|
|
184
142
|
continue;
|
|
185
143
|
}
|
|
186
144
|
|
|
187
145
|
if (isFromAgent) {
|
|
188
|
-
|
|
146
|
+
append("assistant", rawMessage, evt.seq);
|
|
189
147
|
} else if (isToAgent) {
|
|
190
|
-
|
|
148
|
+
append("user", rawMessage, evt.seq);
|
|
191
149
|
}
|
|
150
|
+
streamEntry = null;
|
|
192
151
|
}
|
|
193
152
|
|
|
194
|
-
return
|
|
153
|
+
return entries.slice(-maxEntries);
|
|
195
154
|
}
|
|
196
155
|
|
|
197
156
|
module.exports = {
|
|
198
|
-
|
|
157
|
+
loadInternalAgentTranscript,
|
|
199
158
|
buildAgentAliases,
|
|
200
159
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function defaultResolveTerminalApp() {
|
|
4
|
+
const program = String(process.env.TERM_PROGRAM || "").trim();
|
|
5
|
+
if (program === "Apple_Terminal") return "terminal";
|
|
6
|
+
if (program === "iTerm.app" || process.env.ITERM_SESSION_ID) return "iterm2";
|
|
7
|
+
return "";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function collectHostLaunchRequestContext(env = process.env) {
|
|
11
|
+
const hostInjectSock = String(env.UFOO_HOST_INJECT_SOCK || env.HORIZON_INJECT_SOCK || "").trim();
|
|
12
|
+
const hostDaemonSock = String(env.UFOO_HOST_DAEMON_SOCK || "").trim();
|
|
13
|
+
const hostName = String(env.UFOO_HOST_NAME || "").trim();
|
|
14
|
+
const hostSessionId = String(env.UFOO_HOST_SESSION_ID || env.HORIZON_SESSION_ID || "").trim();
|
|
15
|
+
const context = {};
|
|
16
|
+
if (hostInjectSock) context.host_inject_sock = hostInjectSock;
|
|
17
|
+
if (hostDaemonSock) context.host_daemon_sock = hostDaemonSock;
|
|
18
|
+
if (hostName) context.host_name = hostName;
|
|
19
|
+
if (hostSessionId) context.host_session_id = hostSessionId;
|
|
20
|
+
return context;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function collectTerminalLaunchRequestContext(resolveTerminalApp = defaultResolveTerminalApp) {
|
|
24
|
+
const terminalApp = String(resolveTerminalApp() || "").trim().toLowerCase();
|
|
25
|
+
if (terminalApp === "terminal" || terminalApp === "iterm2") {
|
|
26
|
+
return { terminal_app: terminalApp };
|
|
27
|
+
}
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function collectTmuxLaunchRequestContext(env = process.env) {
|
|
32
|
+
const tmuxTarget = String(env.UFOO_TMUX_TARGET || "").trim();
|
|
33
|
+
const tmuxPane = String(env.UFOO_TMUX_PANE || env.TMUX_PANE || "").trim();
|
|
34
|
+
const tmuxSession = String(env.UFOO_TMUX_SESSION || "").trim();
|
|
35
|
+
const context = {};
|
|
36
|
+
if (tmuxTarget) context.tmux_target = tmuxTarget;
|
|
37
|
+
if (tmuxPane) context.tmux_pane = tmuxPane;
|
|
38
|
+
if (tmuxSession) context.tmux_session = tmuxSession;
|
|
39
|
+
return context;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = { defaultResolveTerminalApp, collectHostLaunchRequestContext, collectTerminalLaunchRequestContext, collectTmuxLaunchRequestContext };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const { PTY_SOCKET_MESSAGE_TYPES, PTY_SOCKET_SUBSCRIBE_MODES } = require("../../../runtime/contracts/ptySocketContract");
|
|
4
|
-
const { createVirtualTerminal } = require("./virtualTerminal");
|
|
1
|
+
const { moveCursorVertically, deleteWordBeforeCursor, charDisplayWidth } = require("../../../ui/format");
|
|
2
|
+
const { createAgentSurface } = require("../../../ui/agentSurface");
|
|
5
3
|
|
|
6
4
|
function createPaneManager(options = {}) {
|
|
7
5
|
const {
|
|
8
|
-
getInjectSockPath = () => "",
|
|
9
6
|
onPaneOutput = () => {},
|
|
10
7
|
onInternalSubmit = () => {},
|
|
11
8
|
} = options;
|
|
@@ -15,35 +12,36 @@ function createPaneManager(options = {}) {
|
|
|
15
12
|
|
|
16
13
|
function addAgent(agentId, cols, rows, options = {}) {
|
|
17
14
|
if (panes.has(agentId)) return;
|
|
18
|
-
|
|
19
|
-
const mode =
|
|
15
|
+
if (options.mode && options.mode !== "internal") throw new Error("Dashboard panes support internal agents only");
|
|
16
|
+
const mode = "internal";
|
|
17
|
+
const surface = options.surface || createAgentSurface();
|
|
20
18
|
const pane = {
|
|
21
19
|
agentId,
|
|
22
20
|
mode,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
surface,
|
|
22
|
+
cols,
|
|
23
|
+
inputCols: cols,
|
|
24
|
+
rows,
|
|
25
|
+
scrollOffset: Number(options.scrollOffset) || 0,
|
|
26
|
+
internalInput: String(options.initialInput || ""),
|
|
27
|
+
internalCursor: Math.max(0, Math.min(String(options.initialInput || "").length, Number(options.initialCursor) || 0)),
|
|
28
|
+
inputRevision: Number(options.inputRevision) || 0,
|
|
29
29
|
};
|
|
30
30
|
panes.set(agentId, pane);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
} else {
|
|
38
|
-
connectOutput(pane);
|
|
31
|
+
const initialOutput = Array.isArray(options.initialLines)
|
|
32
|
+
? options.initialLines.join("\r\n")
|
|
33
|
+
: String(options.initialOutput || "");
|
|
34
|
+
if (!options.surface) {
|
|
35
|
+
if (Array.isArray(options.initialEntries)) surface.apply("transcript.reset", { entries: options.initialEntries });
|
|
36
|
+
else if (initialOutput) surface.apply("transcript.append", { kind: "system", text: initialOutput });
|
|
39
37
|
}
|
|
38
|
+
onPaneOutput(pane.agentId);
|
|
40
39
|
if (!focusedAgent) focusedAgent = agentId;
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
function removeAgent(agentId) {
|
|
44
43
|
const pane = panes.get(agentId);
|
|
45
44
|
if (!pane) return;
|
|
46
|
-
disconnect(pane);
|
|
47
45
|
panes.delete(agentId);
|
|
48
46
|
if (focusedAgent === agentId) {
|
|
49
47
|
const keys = [...panes.keys()];
|
|
@@ -51,92 +49,6 @@ function createPaneManager(options = {}) {
|
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
function connectOutput(pane) {
|
|
55
|
-
const sockPath = getInjectSockPath(pane.agentId);
|
|
56
|
-
if (!sockPath || !fs.existsSync(sockPath)) {
|
|
57
|
-
pane.vt.write("\x1b[33m[waiting]\x1b[0m inject.sock not found\r\n");
|
|
58
|
-
onPaneOutput(pane.agentId);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
try {
|
|
63
|
-
const client = net.createConnection(sockPath, () => {
|
|
64
|
-
const { cols, rows } = pane.vt.getScreen();
|
|
65
|
-
client.write(JSON.stringify({
|
|
66
|
-
type: PTY_SOCKET_MESSAGE_TYPES.RESIZE,
|
|
67
|
-
cols,
|
|
68
|
-
rows,
|
|
69
|
-
}) + "\n");
|
|
70
|
-
client.write(JSON.stringify({
|
|
71
|
-
type: PTY_SOCKET_MESSAGE_TYPES.SUBSCRIBE,
|
|
72
|
-
mode: PTY_SOCKET_SUBSCRIBE_MODES.FULL,
|
|
73
|
-
}) + "\n");
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
client.on("data", (data) => {
|
|
77
|
-
pane.buffer += data.toString("utf8");
|
|
78
|
-
const lines = pane.buffer.split("\n");
|
|
79
|
-
pane.buffer = lines.pop() || "";
|
|
80
|
-
for (const line of lines) {
|
|
81
|
-
if (!line.trim()) continue;
|
|
82
|
-
try {
|
|
83
|
-
const msg = JSON.parse(line);
|
|
84
|
-
if (msg.type === PTY_SOCKET_MESSAGE_TYPES.OUTPUT) {
|
|
85
|
-
if (msg.data) {
|
|
86
|
-
pane.vt.write(msg.data);
|
|
87
|
-
onPaneOutput(pane.agentId);
|
|
88
|
-
}
|
|
89
|
-
} else if (msg.type === PTY_SOCKET_MESSAGE_TYPES.REPLAY) {
|
|
90
|
-
if (msg.data) {
|
|
91
|
-
pane.vt.write(msg.data);
|
|
92
|
-
onPaneOutput(pane.agentId);
|
|
93
|
-
}
|
|
94
|
-
} else if (msg.type === PTY_SOCKET_MESSAGE_TYPES.SNAPSHOT) {
|
|
95
|
-
if (msg.data) {
|
|
96
|
-
pane.vt.write(msg.data);
|
|
97
|
-
onPaneOutput(pane.agentId);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
} catch {
|
|
101
|
-
// ignore malformed messages or render errors
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
client.on("error", (err) => {
|
|
107
|
-
pane.outputClient = null;
|
|
108
|
-
pane.vt.write(`\r\n\x1b[31m[connection error]\x1b[0m ${err && err.message ? err.message : "socket error"}\r\n`);
|
|
109
|
-
onPaneOutput(pane.agentId);
|
|
110
|
-
});
|
|
111
|
-
client.on("close", () => {
|
|
112
|
-
pane.outputClient = null;
|
|
113
|
-
pane.vt.write("\r\n\x1b[33m[disconnected]\x1b[0m\r\n");
|
|
114
|
-
onPaneOutput(pane.agentId);
|
|
115
|
-
});
|
|
116
|
-
pane.outputClient = client;
|
|
117
|
-
} catch (err) {
|
|
118
|
-
pane.vt.write(`\x1b[31m[connection error]\x1b[0m ${err && err.message ? err.message : "connection failed"}\r\n`);
|
|
119
|
-
onPaneOutput(pane.agentId);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function disconnect(pane) {
|
|
124
|
-
if (pane.outputClient) {
|
|
125
|
-
try {
|
|
126
|
-
pane.outputClient.removeAllListeners();
|
|
127
|
-
pane.outputClient.destroy();
|
|
128
|
-
} catch {}
|
|
129
|
-
pane.outputClient = null;
|
|
130
|
-
}
|
|
131
|
-
if (pane.inputClient) {
|
|
132
|
-
try {
|
|
133
|
-
pane.inputClient.removeAllListeners();
|
|
134
|
-
pane.inputClient.destroy();
|
|
135
|
-
} catch {}
|
|
136
|
-
pane.inputClient = null;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
52
|
function sendInput(data) {
|
|
141
53
|
if (!focusedAgent) return;
|
|
142
54
|
sendInputToPane(panes.get(focusedAgent), data);
|
|
@@ -149,39 +61,7 @@ function createPaneManager(options = {}) {
|
|
|
149
61
|
|
|
150
62
|
function sendInputToPane(pane, data) {
|
|
151
63
|
if (!pane) return;
|
|
152
|
-
|
|
153
|
-
handleInternalInput(pane, data);
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
const sockPath = getInjectSockPath(pane.agentId);
|
|
157
|
-
if (!sockPath) return;
|
|
158
|
-
|
|
159
|
-
if (!pane.inputClient || pane.inputClient.destroyed) {
|
|
160
|
-
try {
|
|
161
|
-
const client = net.createConnection(sockPath);
|
|
162
|
-
pane.inputClient = client;
|
|
163
|
-
client.on("error", () => { pane.inputClient = null; });
|
|
164
|
-
client.on("close", () => { pane.inputClient = null; });
|
|
165
|
-
client.once("connect", () => {
|
|
166
|
-
try {
|
|
167
|
-
client.write(JSON.stringify({
|
|
168
|
-
type: PTY_SOCKET_MESSAGE_TYPES.RAW,
|
|
169
|
-
data,
|
|
170
|
-
}) + "\n");
|
|
171
|
-
} catch {}
|
|
172
|
-
});
|
|
173
|
-
} catch { return; }
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
try {
|
|
178
|
-
pane.inputClient.write(JSON.stringify({
|
|
179
|
-
type: PTY_SOCKET_MESSAGE_TYPES.RAW,
|
|
180
|
-
data,
|
|
181
|
-
}) + "\n");
|
|
182
|
-
} catch {
|
|
183
|
-
pane.inputClient = null;
|
|
184
|
-
}
|
|
64
|
+
handleInternalInput(pane, data);
|
|
185
65
|
}
|
|
186
66
|
|
|
187
67
|
function previousInputBoundary(text = "", cursor = 0) {
|
|
@@ -199,13 +79,25 @@ function createPaneManager(options = {}) {
|
|
|
199
79
|
function handleInternalInput(pane, data) {
|
|
200
80
|
const raw = String(data || "");
|
|
201
81
|
if (!raw) return;
|
|
202
|
-
if (raw === "\r"
|
|
82
|
+
if (raw === "\r") {
|
|
203
83
|
const message = String(pane.internalInput || "").trim();
|
|
84
|
+
const submittedRevision = pane.inputRevision;
|
|
204
85
|
pane.internalInput = "";
|
|
205
86
|
pane.internalCursor = 0;
|
|
206
87
|
if (message) {
|
|
207
|
-
pane.
|
|
208
|
-
|
|
88
|
+
pane.surface.apply("transcript.append", { kind: "user", text: message });
|
|
89
|
+
if (!/^\/window(?:\s|$)/.test(message)) pane.surface.accept({ type: "task_submitted", message });
|
|
90
|
+
const failed = (error) => {
|
|
91
|
+
pane.surface.accept({ type: "submission_failed", message, error: `Message delivery failed: ${error?.message || error}` });
|
|
92
|
+
if (!pane.internalInput && pane.inputRevision === submittedRevision) {
|
|
93
|
+
pane.internalInput = message; pane.internalCursor = message.length;
|
|
94
|
+
}
|
|
95
|
+
onPaneOutput(pane.agentId);
|
|
96
|
+
};
|
|
97
|
+
try {
|
|
98
|
+
const result = onInternalSubmit(pane.agentId, message);
|
|
99
|
+
if (result?.catch) result.catch(failed);
|
|
100
|
+
} catch (error) { failed(error); }
|
|
209
101
|
}
|
|
210
102
|
onPaneOutput(pane.agentId);
|
|
211
103
|
return;
|
|
@@ -231,7 +123,47 @@ function createPaneManager(options = {}) {
|
|
|
231
123
|
onPaneOutput(pane.agentId);
|
|
232
124
|
return;
|
|
233
125
|
}
|
|
234
|
-
if (raw === "\x1b[
|
|
126
|
+
if (raw === "\x1b[H" || raw === "\x1b[F") {
|
|
127
|
+
pane.internalCursor = raw === "\x1b[H" ? 0 : pane.internalInput.length;
|
|
128
|
+
onPaneOutput(pane.agentId);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (["\x01", "\x05", "\x15", "\x0b"].includes(raw)) {
|
|
132
|
+
const before = pane.internalInput.slice(0, pane.internalCursor);
|
|
133
|
+
const start = before.lastIndexOf("\n") + 1;
|
|
134
|
+
const nextLine = pane.internalInput.indexOf("\n", pane.internalCursor);
|
|
135
|
+
const end = nextLine < 0 ? pane.internalInput.length : nextLine;
|
|
136
|
+
if (raw === "\x01") pane.internalCursor = start;
|
|
137
|
+
else if (raw === "\x05") pane.internalCursor = end;
|
|
138
|
+
else if (raw === "\x15") {
|
|
139
|
+
pane.internalInput = pane.internalInput.slice(0, start) + pane.internalInput.slice(pane.internalCursor);
|
|
140
|
+
pane.internalCursor = start;
|
|
141
|
+
} else pane.internalInput = before + pane.internalInput.slice(end);
|
|
142
|
+
onPaneOutput(pane.agentId);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (raw === "\x1b[A" || raw === "\x1b[B") {
|
|
146
|
+
const move = moveCursorVertically({ inputValue: pane.internalInput, cursorPos: pane.internalCursor,
|
|
147
|
+
width: pane.inputCols, direction: raw === "\x1b[A" ? "up" : "down",
|
|
148
|
+
strWidth: (text) => Array.from(text).reduce((sum, ch) => sum + charDisplayWidth(ch), 0) });
|
|
149
|
+
pane.internalCursor = move.nextCursorPos;
|
|
150
|
+
onPaneOutput(pane.agentId);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (raw === "\x1b[3~") {
|
|
154
|
+
const next = Array.from(pane.internalInput.slice(pane.internalCursor))[0] || "";
|
|
155
|
+
pane.internalInput = pane.internalInput.slice(0, pane.internalCursor) + pane.internalInput.slice(pane.internalCursor + next.length);
|
|
156
|
+
onPaneOutput(pane.agentId);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (raw === "\x17") {
|
|
160
|
+
const deleted = deleteWordBeforeCursor(pane.internalInput, pane.internalCursor);
|
|
161
|
+
pane.internalInput = deleted.value;
|
|
162
|
+
pane.internalCursor = deleted.cursorPos;
|
|
163
|
+
onPaneOutput(pane.agentId);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (raw === "\t" || raw === "\x1b") return;
|
|
235
167
|
|
|
236
168
|
const clean = raw.replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/[\x00-\x08\x0b-\x0c\x0e-\x1f\x7f]/g, "");
|
|
237
169
|
if (!clean) return;
|
|
@@ -240,25 +172,12 @@ function createPaneManager(options = {}) {
|
|
|
240
172
|
onPaneOutput(pane.agentId);
|
|
241
173
|
}
|
|
242
174
|
|
|
243
|
-
function sendResize(agentId, cols, rows) {
|
|
175
|
+
function sendResize(agentId, cols, rows, inputCols = cols) {
|
|
244
176
|
const pane = panes.get(agentId);
|
|
245
177
|
if (!pane) return;
|
|
246
|
-
pane.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
if ((!pane.outputClient || pane.outputClient.destroyed) && sockPath && fs.existsSync(sockPath)) {
|
|
250
|
-
connectOutput(pane);
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
if (pane.outputClient && !pane.outputClient.destroyed) {
|
|
254
|
-
try {
|
|
255
|
-
pane.outputClient.write(JSON.stringify({
|
|
256
|
-
type: PTY_SOCKET_MESSAGE_TYPES.RESIZE,
|
|
257
|
-
cols,
|
|
258
|
-
rows,
|
|
259
|
-
}) + "\n");
|
|
260
|
-
} catch {}
|
|
261
|
-
}
|
|
178
|
+
pane.cols = cols;
|
|
179
|
+
pane.inputCols = inputCols;
|
|
180
|
+
pane.rows = rows;
|
|
262
181
|
}
|
|
263
182
|
|
|
264
183
|
function cycleFocus() {
|
|
@@ -277,13 +196,20 @@ function createPaneManager(options = {}) {
|
|
|
277
196
|
function writeToPane(agentId, data) {
|
|
278
197
|
const pane = panes.get(agentId);
|
|
279
198
|
if (!pane) return false;
|
|
280
|
-
pane.
|
|
199
|
+
pane.surface.accept({ type: "text_delta", delta: String(data || "").replace(/\r\n/g, "\n") });
|
|
281
200
|
onPaneOutput(pane.agentId);
|
|
282
201
|
return true;
|
|
283
202
|
}
|
|
284
203
|
|
|
204
|
+
function scrollPane(agentId, lines, maxOffset = 2000) {
|
|
205
|
+
const pane = panes.get(agentId);
|
|
206
|
+
if (!pane) return false;
|
|
207
|
+
pane.scrollOffset = Math.max(0, Math.min(maxOffset, pane.scrollOffset + lines));
|
|
208
|
+
onPaneOutput(agentId);
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
|
|
285
212
|
function disconnectAll() {
|
|
286
|
-
for (const pane of panes.values()) disconnect(pane);
|
|
287
213
|
panes.clear();
|
|
288
214
|
focusedAgent = null;
|
|
289
215
|
}
|
|
@@ -301,6 +227,7 @@ function createPaneManager(options = {}) {
|
|
|
301
227
|
getAllPanes,
|
|
302
228
|
getAgentIds,
|
|
303
229
|
writeToPane,
|
|
230
|
+
scrollPane,
|
|
304
231
|
disconnectAll,
|
|
305
232
|
};
|
|
306
233
|
}
|
|
@@ -122,7 +122,7 @@ function createChatStreamState({
|
|
|
122
122
|
meta: meta || {},
|
|
123
123
|
};
|
|
124
124
|
streams.set(key, state);
|
|
125
|
-
dispatch({ type: "stream/begin", publisher: displayName });
|
|
125
|
+
dispatch({ type: "stream/begin", publisher: key, displayName });
|
|
126
126
|
return state;
|
|
127
127
|
}
|
|
128
128
|
|
|
@@ -132,7 +132,7 @@ function createChatStreamState({
|
|
|
132
132
|
state.parts.push(text);
|
|
133
133
|
let batch = pendingDeltas.get(state.publisher);
|
|
134
134
|
if (!batch) {
|
|
135
|
-
batch = { publisher: state.
|
|
135
|
+
batch = { publisher: state.publisher, parts: [] };
|
|
136
136
|
pendingDeltas.set(state.publisher, batch);
|
|
137
137
|
}
|
|
138
138
|
batch.parts.push(text);
|
|
@@ -144,7 +144,7 @@ function createChatStreamState({
|
|
|
144
144
|
const state = streams.get(key);
|
|
145
145
|
if (!state) return;
|
|
146
146
|
flushDeltas();
|
|
147
|
-
dispatch({ type: "stream/end" });
|
|
147
|
+
dispatch({ type: "stream/end", publisher: key });
|
|
148
148
|
if (typeof appendHistory === "function") {
|
|
149
149
|
const full = state.parts.join("");
|
|
150
150
|
const text = state.displayName
|
|
@@ -171,12 +171,8 @@ function createChatStreamState({
|
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
/** @deprecated Prefer createChatStreamState. */
|
|
175
|
-
const createInkStreamState = createChatStreamState;
|
|
176
|
-
|
|
177
174
|
module.exports = {
|
|
178
175
|
STREAM_FLUSH_INTERVAL_MS,
|
|
179
176
|
createThrottledSender,
|
|
180
177
|
createChatStreamState,
|
|
181
|
-
createInkStreamState,
|
|
182
178
|
};
|
|
@@ -52,7 +52,7 @@ function connectSocket(sockPath, options = {}) {
|
|
|
52
52
|
function resolveProjectFile(projectRoot, relativePath, fallbackRelativePath) {
|
|
53
53
|
const local = path.join(projectRoot, relativePath);
|
|
54
54
|
if (fs.existsSync(local)) return local;
|
|
55
|
-
return path.join(__dirname, "..", "..", fallbackRelativePath);
|
|
55
|
+
return path.join(__dirname, "..", "..", "..", fallbackRelativePath);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
function startDaemon(projectRoot, options = {}) {
|
|
@@ -142,6 +142,15 @@ function resolveAckArgs(cmdArgs = []) {
|
|
|
142
142
|
|
|
143
143
|
async function runBusCoreCommand(eventBus, cmd, cmdArgs = []) {
|
|
144
144
|
switch (cmd) {
|
|
145
|
+
case "deliveries": {
|
|
146
|
+
const { listNativeReceipts, resolveNativeReceipt } = require("../../coordination/bus/nativeReceipts");
|
|
147
|
+
const [subscriber, id, resolution, ...extra] = cmdArgs;
|
|
148
|
+
if (!subscriber || extra.length || (id && !resolution)) throw new Error("Usage: ufoo bus deliveries <subscriber> [<receipt-id> accepted|retry]");
|
|
149
|
+
const result = id ? resolveNativeReceipt(eventBus.projectRoot, subscriber, id, resolution)
|
|
150
|
+
: listNativeReceipts(eventBus.projectRoot, subscriber);
|
|
151
|
+
console.log(JSON.stringify(result, null, 2));
|
|
152
|
+
return {};
|
|
153
|
+
}
|
|
145
154
|
case "init":
|
|
146
155
|
await eventBus.init();
|
|
147
156
|
return {};
|
|
@@ -34,6 +34,37 @@ class RepoDoctor {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
reportMcp() {
|
|
38
|
+
try {
|
|
39
|
+
const { inspectCodexMcpConfig } = require("../../../runtime/daemon/mcpConfigure");
|
|
40
|
+
const status = inspectCodexMcpConfig();
|
|
41
|
+
if (!status.configured) return;
|
|
42
|
+
if (status.changed) this.fail(`Codex ufoo MCP config is outdated: ${status.target}; run ufoo mcp configure codex`);
|
|
43
|
+
else console.log("MCP: Codex normal tools and resident wait configuration are current.");
|
|
44
|
+
} catch {
|
|
45
|
+
console.log("MCP: configuration check unavailable; start the daemon and run ufoo mcp configure codex.");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
reportNative() {
|
|
50
|
+
const { probeNativeCapabilities } = require("../../../agents/launch/nativeCapabilities");
|
|
51
|
+
const { loadAgentsData } = require("../../../coordination/state/agentsStore");
|
|
52
|
+
const { getUfooPaths } = require("../../../coordination/state/paths");
|
|
53
|
+
const { listNativeReceipts } = require("../../../coordination/bus/nativeReceipts");
|
|
54
|
+
console.log("Native message delivery:");
|
|
55
|
+
for (const agentType of ["codex", "claude-code"]) {
|
|
56
|
+
const capability = probeNativeCapabilities({ agentType });
|
|
57
|
+
console.log(`- ${agentType}: ${capability.version || "unavailable"} (${capability.supported ? "version compatible; runtime readiness still required" : capability.reason})`);
|
|
58
|
+
}
|
|
59
|
+
const agentsFile = getUfooPaths(process.cwd()).agentsFile;
|
|
60
|
+
if (!fs.existsSync(agentsFile)) return;
|
|
61
|
+
for (const [id, meta] of Object.entries(loadAgentsData(agentsFile).agents)) {
|
|
62
|
+
if (meta.native_delivery) console.log(`- ${id}: ${meta.native_delivery}, ready=${meta.native_delivery_ready === true}${meta.native_delivery_diagnostic ? `, ${meta.native_delivery_diagnostic}` : ""}`);
|
|
63
|
+
const uncertain = listNativeReceipts(process.cwd(), id).filter((receipt) => ["unknown", "inflight"].includes(receipt.state));
|
|
64
|
+
if (uncertain.length) console.log(`- ${id}: ${uncertain.length} uncertain receipt(s); inspect with ufoo bus deliveries ${id}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
37
68
|
run() {
|
|
38
69
|
const skillsDir = path.join(this.repoRoot, "SKILLS");
|
|
39
70
|
const contextSkill = path.join(skillsDir, "ufoo-context", "SKILL.md");
|
|
@@ -52,6 +83,8 @@ class RepoDoctor {
|
|
|
52
83
|
if (fs.existsSync(contextSkill)) console.log(`- ufoo-context: ${contextSkill}`);
|
|
53
84
|
if (fs.existsSync(busSkill)) console.log(`- ufoo-bus: ${busSkill}`);
|
|
54
85
|
this.reportTui();
|
|
86
|
+
this.reportMcp();
|
|
87
|
+
this.reportNative();
|
|
55
88
|
|
|
56
89
|
if (this.failed) {
|
|
57
90
|
console.log("Status: FAILED");
|
|
@@ -18,19 +18,19 @@ class UfooInit {
|
|
|
18
18
|
.map((item) => item.trim())
|
|
19
19
|
.filter(Boolean);
|
|
20
20
|
const project = options.project || process.cwd();
|
|
21
|
-
const
|
|
21
|
+
const globalController = options.globalController === true;
|
|
22
22
|
|
|
23
23
|
console.log("=== ufoo init ===");
|
|
24
24
|
console.log(`Project directory: ${project}`);
|
|
25
25
|
console.log(`Targets: ${targets.join(", ")}`);
|
|
26
26
|
console.log();
|
|
27
27
|
|
|
28
|
-
if (!
|
|
28
|
+
if (!globalController) {
|
|
29
29
|
this.ensureAgentsFiles(project);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
// 初始化核心
|
|
33
|
-
this.initCore(project, {
|
|
33
|
+
this.initCore(project, { globalController });
|
|
34
34
|
|
|
35
35
|
// Initialize selected workspace features.
|
|
36
36
|
for (const target of targets) {
|
|
@@ -77,7 +77,7 @@ class UfooInit {
|
|
|
77
77
|
*/
|
|
78
78
|
initCore(project, options = {}) {
|
|
79
79
|
console.log("[core] Initializing .ufoo core...");
|
|
80
|
-
const
|
|
80
|
+
const globalController = options.globalController === true;
|
|
81
81
|
|
|
82
82
|
const ufooDir = path.join(project, ".ufoo");
|
|
83
83
|
if (!fs.existsSync(ufooDir)) {
|
|
@@ -92,7 +92,7 @@ class UfooInit {
|
|
|
92
92
|
const docsLink = path.join(ufooDir, "docs");
|
|
93
93
|
const projectDocs = path.join(project, "docs");
|
|
94
94
|
|
|
95
|
-
if (!
|
|
95
|
+
if (!globalController && fs.existsSync(projectDocs)) {
|
|
96
96
|
const linkStat = this.safeLstat(docsLink);
|
|
97
97
|
if (linkStat) {
|
|
98
98
|
fs.unlinkSync(docsLink);
|