u-foo 2.3.31 → 2.4.0
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/README.md +157 -213
- package/README.zh-CN.md +151 -197
- package/SKILLS/ufoo/SKILL.md +8 -8
- package/bin/uagy.js +69 -0
- package/bin/uclaude.js +2 -2
- package/bin/ucode.js +4 -4
- package/bin/ucodex.js +2 -2
- package/bin/ufoo.js +5 -23
- package/modules/AGENTS.template.md +1 -1
- package/modules/bus/SKILLS/ubus/SKILL.md +35 -10
- package/package.json +9 -5
- package/scripts/chat-app-smoke.js +30 -0
- package/scripts/global-chat-switch-benchmark.js +5 -5
- package/scripts/ink-demo.js +23 -0
- package/scripts/ink-smoke.js +30 -0
- package/scripts/ucode-app-smoke.js +36 -0
- package/src/{agent → agents/activity}/activityDetector.js +39 -2
- package/src/{agent → agents/activity}/activityStatePublisher.js +1 -1
- package/src/{agent → agents/activity}/activityStateWriter.js +2 -2
- package/src/{agent → agents/activity}/activityTracker.js +1 -1
- package/src/agents/activity/index.js +8 -0
- package/src/{agent → agents/controller}/controllerToolExecutor.js +4 -4
- package/src/agents/controller/index.js +8 -0
- package/src/{agent → agents/controller}/loopObservability.js +2 -2
- package/src/{agent → agents/controller}/loopRuntime.js +1 -1
- package/src/{agent → agents/controller}/ufooAgent.js +9 -9
- package/src/agents/index.js +10 -0
- package/src/agents/internal/index.js +3 -0
- package/src/{agent → agents/internal}/internalRunner.js +45 -22
- package/src/agents/launch/agyConversation.js +159 -0
- package/src/agents/launch/index.js +12 -0
- package/src/{agent → agents/launch}/launchEnvironment.js +2 -3
- package/src/{agent → agents/launch}/launcher.js +64 -21
- package/src/{agent → agents/launch}/notifier.js +23 -12
- package/src/{agent → agents/launch}/ptyRunner.js +44 -12
- package/src/{agent → agents/launch}/ptyWrapper.js +2 -2
- package/src/{agent → agents/launch}/publisherRouting.js +1 -1
- package/src/{agent → agents/launch}/readyDetector.js +23 -0
- package/src/{agent → agents/prompts}/defaultBootstrap.js +63 -4
- package/src/{group/bootstrap.js → agents/prompts/groupBootstrap.js} +41 -6
- package/src/agents/prompts/index.js +8 -0
- package/src/{code/prompts → agents/prompts/native}/index.js +1 -1
- package/src/{agent → agents/providers}/claudeThreadProvider.js +1 -1
- package/src/{agent → agents/providers}/codexThreadProvider.js +1 -1
- package/src/{agent → agents/providers}/directAuthStatus.js +184 -1
- package/src/agents/providers/index.js +13 -0
- package/src/{agent → agents/providers}/upstreamTransport.js +2 -2
- package/src/{chat → app/chat}/agentSockets.js +1 -1
- package/src/{chat → app/chat}/commandExecutor.js +56 -28
- package/src/{chat → app/chat}/commands.js +119 -5
- package/src/{chat → app/chat}/daemonConnection.js +1 -1
- package/src/{chat → app/chat}/daemonMessageRouter.js +54 -4
- package/src/{chat → app/chat}/daemonTransport.js +2 -1
- package/src/{chat → app/chat}/dashboardView.js +2 -21
- package/src/app/chat/index.js +6 -0
- package/src/{chat → app/chat}/inputSubmitHandler.js +38 -13
- package/src/{chat → app/chat}/internalAgentLogHistory.js +1 -1
- package/src/app/chat/multiWindow/index.js +268 -0
- package/src/app/chat/multiWindow/paneLayout.js +84 -0
- package/src/app/chat/multiWindow/paneManager.js +299 -0
- package/src/app/chat/multiWindow/renderer.js +384 -0
- package/src/app/chat/multiWindow/virtualTerminal.js +327 -0
- package/src/{chat → app/chat}/projectCloseController.js +1 -1
- package/src/app/chat/shellCommand.js +42 -0
- package/src/{chat → app/chat}/transport.js +16 -3
- package/src/{cli → app/cli}/ctxCoreCommands.js +3 -3
- package/src/{doctor/index.js → app/cli/features/doctor.js} +1 -1
- package/src/{init/index.js → app/cli/features/init.js} +14 -32
- package/src/{cli → app/cli}/groupCoreCommands.js +2 -2
- package/src/app/cli/index.js +9 -0
- package/src/{cli → app/cli}/onlineCoreCommands.js +5 -5
- package/src/{cli.js → app/cli/run.js} +62 -59
- package/src/app/index.js +6 -0
- package/src/code/agent.js +10 -9
- package/src/code/index.js +2 -0
- package/src/code/launcher/index.js +9 -0
- package/src/{agent → code/launcher}/ucode.js +7 -8
- package/src/{agent → code/launcher}/ucodeBootstrap.js +3 -3
- package/src/{agent → code/launcher}/ucodeBuild.js +2 -2
- package/src/{agent → code/launcher}/ucodeDoctor.js +2 -2
- package/src/{agent → code/launcher}/ucodeRuntimeConfig.js +1 -2
- package/src/code/nativeRunner.js +4 -4
- package/src/code/taskDecomposer.js +5 -4
- package/src/code/tui.js +39 -1997
- package/src/config.js +15 -2
- package/src/{bus → coordination/bus}/activate.js +2 -2
- package/src/{bus → coordination/bus}/daemon.js +15 -5
- package/src/coordination/bus/envelope.js +173 -0
- package/src/{bus → coordination/bus}/index.js +7 -3
- package/src/{bus → coordination/bus}/inject.js +11 -3
- package/src/{bus → coordination/bus}/message.js +1 -1
- package/src/coordination/bus/messageMeta.js +130 -0
- package/src/coordination/bus/promptEnvelope.js +65 -0
- package/src/{bus → coordination/bus}/shake.js +1 -1
- package/src/{bus → coordination/bus}/store.js +3 -3
- package/src/{bus → coordination/bus}/subscriber.js +2 -2
- package/src/{bus → coordination/bus}/utils.js +2 -2
- package/src/{history → coordination/history}/inputTimeline.js +5 -5
- package/src/coordination/index.js +10 -0
- package/src/{memory → coordination/memory}/historySearch.js +1 -1
- package/src/{memory → coordination/memory}/index.js +3 -3
- package/src/{report → coordination/report}/store.js +2 -2
- package/src/{ufoo → coordination/state}/agentRegistryDiagnostics.js +43 -0
- package/src/{status → coordination/status}/index.js +3 -3
- package/src/online/bridge.js +2 -2
- package/src/{controller → orchestration/controller}/flags.js +1 -1
- package/src/{controller → orchestration/controller}/gateRouter.js +1 -1
- package/src/orchestration/controller/index.js +10 -0
- package/src/{controller → orchestration/controller}/shadowGuard.js +1 -1
- package/src/orchestration/groups/bootstrap.js +3 -0
- package/src/orchestration/groups/index.js +10 -0
- package/src/orchestration/groups/promptProfiles.js +3 -0
- package/src/{group → orchestration/groups}/templates.js +1 -1
- package/src/{group → orchestration/groups}/validateTemplate.js +1 -1
- package/src/orchestration/index.js +7 -0
- package/src/orchestration/solo/index.js +3 -0
- package/src/{daemon → runtime/daemon}/agentProcessManager.js +1 -1
- package/src/{daemon → runtime/daemon}/cronOps.js +3 -2
- package/src/{daemon → runtime/daemon}/groupOrchestrator.js +26 -9
- package/src/{daemon → runtime/daemon}/index.js +273 -79
- package/src/{daemon → runtime/daemon}/ipcServer.js +24 -2
- package/src/{daemon → runtime/daemon}/nicknameScope.js +6 -3
- package/src/{daemon → runtime/daemon}/ops.js +48 -61
- package/src/{daemon → runtime/daemon}/promptLoop.js +1 -1
- package/src/{daemon → runtime/daemon}/promptRequest.js +13 -8
- package/src/runtime/daemon/providerSessions.js +230 -0
- package/src/{daemon → runtime/daemon}/reporting.js +4 -4
- package/src/{daemon → runtime/daemon}/run.js +12 -5
- package/src/{daemon → runtime/daemon}/soloBootstrap.js +7 -7
- package/src/{daemon → runtime/daemon}/status.js +5 -5
- package/src/runtime/index.js +10 -0
- package/src/runtime/process/nodeExecutable.js +26 -0
- package/src/{projects → runtime/projects}/registry.js +1 -1
- package/src/{projects → runtime/projects}/runtimes.js +1 -1
- package/src/{terminal → runtime/terminal}/adapterRouter.js +0 -10
- package/src/{terminal → runtime/terminal}/adapters/internalAdapter.js +0 -4
- package/src/tools/handlers/common.js +1 -1
- package/src/tools/handlers/listAgents.js +1 -1
- package/src/tools/handlers/memory.js +3 -3
- package/src/tools/handlers/readBusSummary.js +1 -1
- package/src/tools/handlers/readOpenDecisions.js +1 -1
- package/src/tools/handlers/readProjectRegistry.js +1 -1
- package/src/tools/handlers/readPromptHistory.js +2 -2
- package/src/tools/schemaFixtures.js +1 -1
- package/src/ui/MIGRATION.md +336 -0
- package/src/ui/format/index.js +974 -0
- package/src/ui/index.js +9 -0
- package/src/ui/ink/ChatApp.js +3674 -0
- package/src/ui/ink/DashboardBar.js +685 -0
- package/src/ui/ink/InkDemo.js +96 -0
- package/src/ui/ink/MultilineInput.js +612 -0
- package/src/ui/ink/UcodeApp.js +822 -0
- package/src/ui/ink/agentMirror.js +730 -0
- package/src/ui/ink/chatReducer.js +359 -0
- package/src/ui/runInk.js +57 -0
- package/src/bus/messageMeta.js +0 -52
- package/src/chat/agentViewController.js +0 -1072
- package/src/chat/chatLogController.js +0 -138
- package/src/chat/completionController.js +0 -533
- package/src/chat/dashboardKeyController.js +0 -573
- package/src/chat/index.js +0 -2214
- package/src/chat/inputHistoryController.js +0 -135
- package/src/chat/inputListenerController.js +0 -470
- package/src/chat/layout.js +0 -186
- package/src/chat/pasteController.js +0 -81
- package/src/chat/statusLineController.js +0 -223
- package/src/chat/streamTracker.js +0 -156
- package/src/code/config +0 -0
- package/src/daemon/providerSessions.js +0 -488
- package/src/terminal/adapters/internalPtyAdapter.js +0 -42
- /package/src/{code/prompts → agents/prompts/native}/actions.js +0 -0
- /package/src/{code/prompts → agents/prompts/native}/efficiency.js +0 -0
- /package/src/{code/prompts → agents/prompts/native}/environment.js +0 -0
- /package/src/{code/prompts → agents/prompts/native}/identity.js +0 -0
- /package/src/{code/prompts → agents/prompts/native}/safety.js +0 -0
- /package/src/{code/prompts → agents/prompts/native}/sections.js +0 -0
- /package/src/{code/prompts → agents/prompts/native}/system.js +0 -0
- /package/src/{code/prompts → agents/prompts/native}/tasks.js +0 -0
- /package/src/{code/prompts → agents/prompts/native}/toolDescriptions/bash.js +0 -0
- /package/src/{code/prompts → agents/prompts/native}/toolDescriptions/edit.js +0 -0
- /package/src/{code/prompts → agents/prompts/native}/toolDescriptions/read.js +0 -0
- /package/src/{code/prompts → agents/prompts/native}/toolDescriptions/write.js +0 -0
- /package/src/{code/prompts → agents/prompts/native}/ufoo.js +0 -0
- /package/src/{group → agents/prompts}/promptProfiles.js +0 -0
- /package/src/{agent → agents/providers}/claudeEventTranslator.js +0 -0
- /package/src/{agent → agents/providers}/claudeOauthTokenReader.js +0 -0
- /package/src/{agent → agents/providers}/claudeSessionFiles.js +0 -0
- /package/src/{agent → agents/providers}/codexEventTranslator.js +0 -0
- /package/src/{agent → agents/providers}/credentials/claude.js +0 -0
- /package/src/{agent → agents/providers}/credentials/codex.js +0 -0
- /package/src/{agent → agents/providers}/credentials/index.js +0 -0
- /package/src/{chat → app/chat}/agentBar.js +0 -0
- /package/src/{chat → app/chat}/agentDirectory.js +0 -0
- /package/src/{chat → app/chat}/cronScheduler.js +0 -0
- /package/src/{chat → app/chat}/daemonCoordinator.js +0 -0
- /package/src/{chat → app/chat}/daemonReconnect.js +0 -0
- /package/src/{chat → app/chat}/daemonTransportDefaults.js +0 -0
- /package/src/{chat → app/chat}/inputMath.js +0 -0
- /package/src/{chat → app/chat}/rawKeyMap.js +0 -0
- /package/src/{chat → app/chat}/settingsController.js +0 -0
- /package/src/{chat → app/chat}/text.js +0 -0
- /package/src/{chat → app/chat}/transientAgentState.js +0 -0
- /package/src/{cli → app/cli}/busCoreCommands.js +0 -0
- /package/src/{skills/index.js → app/cli/features/skills.js} +0 -0
- /package/src/{bus → coordination/bus}/nickname.js +0 -0
- /package/src/{bus → coordination/bus}/queue.js +0 -0
- /package/src/{context → coordination/context}/decisions.js +0 -0
- /package/src/{context → coordination/context}/doctor.js +0 -0
- /package/src/{context → coordination/context}/index.js +0 -0
- /package/src/{context → coordination/context}/sync.js +0 -0
- /package/src/{ufoo → coordination/state}/agentsStore.js +0 -0
- /package/src/{ufoo → coordination/state}/paths.js +0 -0
- /package/src/{controller → orchestration/controller}/launchRouting.js +0 -0
- /package/src/{controller → orchestration/controller}/routerFastPath.js +0 -0
- /package/src/{controller → orchestration/controller}/routerFinalize.js +0 -0
- /package/src/{group → orchestration/groups}/diagram.js +0 -0
- /package/src/{group → orchestration/groups}/templateValidation.js +0 -0
- /package/src/{solo → orchestration/solo}/commands.js +0 -0
- /package/src/{shared → runtime/contracts}/eventContract.js +0 -0
- /package/src/{shared → runtime/contracts}/ptySocketContract.js +0 -0
- /package/src/{providerapi → runtime/privacy}/redactor.js +0 -0
- /package/src/{providerapi → runtime/privacy}/shadowDiff.js +0 -0
- /package/src/{projects → runtime/projects}/identity.js +0 -0
- /package/src/{projects → runtime/projects}/index.js +0 -0
- /package/src/{projects → runtime/projects}/projectId.js +0 -0
- /package/src/{terminal → runtime/terminal}/adapterContract.js +0 -0
- /package/src/{terminal → runtime/terminal}/adapters/externalAdapter.js +0 -0
- /package/src/{terminal → runtime/terminal}/adapters/hostAdapter.js +0 -0
- /package/src/{terminal → runtime/terminal}/adapters/internalQueueAdapter.js +0 -0
- /package/src/{terminal → runtime/terminal}/adapters/terminalAdapter.js +0 -0
- /package/src/{terminal → runtime/terminal}/adapters/tmuxAdapter.js +0 -0
- /package/src/{terminal → runtime/terminal}/detect.js +0 -0
- /package/src/{terminal → runtime/terminal}/index.js +0 -0
- /package/src/{terminal → runtime/terminal}/iterm2.js +0 -0
- /package/src/{utils → ui/format}/banner.js +0 -0
- /package/src/{shared → ui/format}/markdownRenderer.js +0 -0
|
@@ -3,20 +3,21 @@ const os = require("os");
|
|
|
3
3
|
const { spawnSync } = require("child_process");
|
|
4
4
|
const net = require("net");
|
|
5
5
|
const fs = require("fs");
|
|
6
|
-
const { socketPath, isRunning } = require("
|
|
7
|
-
const { runBusCoreCommand } = require("./
|
|
8
|
-
const { runCtxCommand } = require("./
|
|
9
|
-
const { runOnlineCommand } = require("./
|
|
10
|
-
const { runGroupCoreCommand } = require("./
|
|
11
|
-
const { loadConfig } = require("
|
|
12
|
-
const { loadPromptProfileRegistry } = require("
|
|
13
|
-
const { resolveSoloAgentType } = require("
|
|
14
|
-
const { listProjectRuntimes, getCurrentProjectRuntime } = require("
|
|
15
|
-
const { canonicalProjectRoot, buildProjectId } = require("
|
|
16
|
-
const { getUfooPaths } = require("
|
|
6
|
+
const { socketPath, isRunning } = require("../../runtime/daemon");
|
|
7
|
+
const { runBusCoreCommand } = require("./busCoreCommands");
|
|
8
|
+
const { runCtxCommand } = require("./ctxCoreCommands");
|
|
9
|
+
const { runOnlineCommand } = require("./onlineCoreCommands");
|
|
10
|
+
const { runGroupCoreCommand } = require("./groupCoreCommands");
|
|
11
|
+
const { loadConfig } = require("../../config");
|
|
12
|
+
const { loadPromptProfileRegistry } = require("../../orchestration/groups/promptProfiles");
|
|
13
|
+
const { resolveSoloAgentType } = require("../../orchestration/solo/commands");
|
|
14
|
+
const { listProjectRuntimes, getCurrentProjectRuntime } = require("../../runtime/projects/registry");
|
|
15
|
+
const { canonicalProjectRoot, buildProjectId } = require("../../runtime/projects/projectId");
|
|
16
|
+
const { getUfooPaths } = require("../../coordination/state/paths");
|
|
17
|
+
const { resolveNodeExecutable } = require("../../runtime/process/nodeExecutable");
|
|
17
18
|
|
|
18
19
|
function getPackageRoot() {
|
|
19
|
-
return path.resolve(__dirname, "..");
|
|
20
|
+
return path.resolve(__dirname, "..", "..", "..");
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
function run(cmd, args, options = {}) {
|
|
@@ -60,7 +61,7 @@ async function connectWithRetry(sockPath, retries, delayMs) {
|
|
|
60
61
|
async function ensureDaemonRunning(projectRoot) {
|
|
61
62
|
if (isRunning(projectRoot)) return;
|
|
62
63
|
const repoRoot = getPackageRoot();
|
|
63
|
-
run(
|
|
64
|
+
run(resolveNodeExecutable(), [path.join(repoRoot, "bin", "ufoo.js"), "daemon", "start"]);
|
|
64
65
|
const sock = socketPath(projectRoot);
|
|
65
66
|
for (let i = 0; i < 30; i += 1) {
|
|
66
67
|
if (fs.existsSync(sock)) {
|
|
@@ -285,7 +286,7 @@ function runMemoryCommand({
|
|
|
285
286
|
write = (line) => console.log(line),
|
|
286
287
|
writeError = (line) => console.error(line),
|
|
287
288
|
} = {}) {
|
|
288
|
-
const MemoryManager = require("
|
|
289
|
+
const MemoryManager = require("../../coordination/memory");
|
|
289
290
|
const manager = new MemoryManager(cwd);
|
|
290
291
|
const sub = String(subcommand || "list").trim().toLowerCase();
|
|
291
292
|
const outputJson = opts.json === true;
|
|
@@ -474,7 +475,7 @@ function resolveOnlineAuthToken(opts) {
|
|
|
474
475
|
let tokens = null;
|
|
475
476
|
try {
|
|
476
477
|
// eslint-disable-next-line global-require
|
|
477
|
-
tokens = require("
|
|
478
|
+
tokens = require("../../online/tokens");
|
|
478
479
|
} catch {
|
|
479
480
|
return "";
|
|
480
481
|
}
|
|
@@ -512,7 +513,7 @@ async function runCli(argv) {
|
|
|
512
513
|
.description("Run repo doctor checks")
|
|
513
514
|
.action(() => {
|
|
514
515
|
const repoRoot = getPackageRoot();
|
|
515
|
-
const RepoDoctor = require("./doctor");
|
|
516
|
+
const RepoDoctor = require("./features/doctor");
|
|
516
517
|
const doctor = new RepoDoctor(repoRoot);
|
|
517
518
|
const ok = doctor.run();
|
|
518
519
|
if (!ok) process.exitCode = 1;
|
|
@@ -521,7 +522,7 @@ async function runCli(argv) {
|
|
|
521
522
|
.command("status")
|
|
522
523
|
.description("Show project status (banner, unread bus, open decisions)")
|
|
523
524
|
.action(async () => {
|
|
524
|
-
const StatusDisplay = require("
|
|
525
|
+
const StatusDisplay = require("../../coordination/status");
|
|
525
526
|
const status = new StatusDisplay(process.cwd());
|
|
526
527
|
await status.show();
|
|
527
528
|
});
|
|
@@ -687,8 +688,8 @@ async function runCli(argv) {
|
|
|
687
688
|
|
|
688
689
|
program
|
|
689
690
|
.command("launch")
|
|
690
|
-
.description("Launch an agent (
|
|
691
|
-
.argument("<agent>", "Agent type:
|
|
691
|
+
.description("Launch an agent (uclaude, ucodex, uagy, ucode)")
|
|
692
|
+
.argument("<agent>", "Agent type: uclaude|ucodex|uagy|ucode|claude|codex|agy")
|
|
692
693
|
.argument("[nickname]", "Optional nickname for the agent")
|
|
693
694
|
.option("--profile <id>", "Prompt profile to assign after launch")
|
|
694
695
|
.action(async (agent, nickname, opts) => {
|
|
@@ -699,15 +700,17 @@ async function runCli(argv) {
|
|
|
699
700
|
// Normalize agent type
|
|
700
701
|
const agentLower = agent.toLowerCase();
|
|
701
702
|
let normalizedAgent = "";
|
|
702
|
-
if (agentLower === "
|
|
703
|
-
normalizedAgent = "ucode";
|
|
704
|
-
} else if (agentLower === "uclaude" || agentLower === "claude-code" || agentLower === "claude") {
|
|
703
|
+
if (agentLower === "uclaude" || agentLower === "claude-code" || agentLower === "claude") {
|
|
705
704
|
normalizedAgent = "claude";
|
|
706
705
|
} else if (agentLower === "ucodex" || agentLower === "codex" || agentLower === "openai") {
|
|
707
706
|
normalizedAgent = "codex";
|
|
707
|
+
} else if (agentLower === "uagy" || agentLower === "agy" || agentLower === "antigravity") {
|
|
708
|
+
normalizedAgent = "agy";
|
|
709
|
+
} else if (agentLower === "ucode" || agentLower === "ufoo-code" || agentLower === "ufoo") {
|
|
710
|
+
normalizedAgent = "ucode";
|
|
708
711
|
} else {
|
|
709
712
|
console.error(`Unknown agent type: ${agent}`);
|
|
710
|
-
console.error("Valid types:
|
|
713
|
+
console.error("Valid types: uclaude, ucodex, uagy, ucode, claude, codex, agy");
|
|
711
714
|
process.exitCode = 1;
|
|
712
715
|
return;
|
|
713
716
|
}
|
|
@@ -732,7 +735,7 @@ async function runCli(argv) {
|
|
|
732
735
|
.description("Solo role agent operations")
|
|
733
736
|
.argument("<action>", "run|list")
|
|
734
737
|
.argument("[profile]", "Prompt profile id or alias")
|
|
735
|
-
.option("--agent <type>", "Agent type: codex|claude|ucode")
|
|
738
|
+
.option("--agent <type>", "Agent type: codex|claude|ucode|agy")
|
|
736
739
|
.option("--nickname <name>", "Optional nickname")
|
|
737
740
|
.option("--scope <scope>", "Launch scope: inplace|window", "inplace")
|
|
738
741
|
.option("--json", "Output role list as JSON")
|
|
@@ -914,7 +917,7 @@ async function runCli(argv) {
|
|
|
914
917
|
const normalized = normalizeReportPhase(action);
|
|
915
918
|
const text = Array.isArray(messageParts) ? messageParts.join(" ").trim() : String(messageParts || "").trim();
|
|
916
919
|
const projectRoot = process.cwd();
|
|
917
|
-
const { listReports } = require("
|
|
920
|
+
const { listReports } = require("../../coordination/report/store");
|
|
918
921
|
|
|
919
922
|
if ((action || "").toLowerCase() === "list") {
|
|
920
923
|
try {
|
|
@@ -1001,8 +1004,8 @@ async function runCli(argv) {
|
|
|
1001
1004
|
.argument("[action]", "doctor|prepare|build", "doctor")
|
|
1002
1005
|
.option("--skip-install", "Skip npm install even if node_modules is missing")
|
|
1003
1006
|
.action((action, opts) => {
|
|
1004
|
-
const { inspectUcodeSetup, formatUcodeDoctor, prepareAndInspectUcode } = require("
|
|
1005
|
-
const { buildUcodeCore } = require("
|
|
1007
|
+
const { inspectUcodeSetup, formatUcodeDoctor, prepareAndInspectUcode } = require("../../code/launcher/ucodeDoctor");
|
|
1008
|
+
const { buildUcodeCore } = require("../../code/launcher/ucodeBuild");
|
|
1006
1009
|
const normalized = String(action || "doctor").trim().toLowerCase();
|
|
1007
1010
|
if (normalized !== "doctor" && normalized !== "prepare" && normalized !== "build") {
|
|
1008
1011
|
console.error("ucode action must be doctor|prepare|build");
|
|
@@ -1043,7 +1046,7 @@ async function runCli(argv) {
|
|
|
1043
1046
|
.option("--modules <list>", "Comma-separated modules (context,bus,resources)", "context")
|
|
1044
1047
|
.option("--project <dir>", "Target project directory", process.cwd())
|
|
1045
1048
|
.action(async (opts) => {
|
|
1046
|
-
const UfooInit = require("./init");
|
|
1049
|
+
const UfooInit = require("./features/init");
|
|
1047
1050
|
const repoRoot = getPackageRoot();
|
|
1048
1051
|
const init = new UfooInit(repoRoot);
|
|
1049
1052
|
try {
|
|
@@ -1059,7 +1062,7 @@ async function runCli(argv) {
|
|
|
1059
1062
|
.command("list")
|
|
1060
1063
|
.description("List available skills")
|
|
1061
1064
|
.action(() => {
|
|
1062
|
-
const SkillsManager = require("./skills");
|
|
1065
|
+
const SkillsManager = require("./features/skills");
|
|
1063
1066
|
const repoRoot = getPackageRoot();
|
|
1064
1067
|
const manager = new SkillsManager(repoRoot);
|
|
1065
1068
|
const skillsList = manager.list();
|
|
@@ -1073,7 +1076,7 @@ async function runCli(argv) {
|
|
|
1073
1076
|
.option("--codex", "Install into ~/.codex/skills")
|
|
1074
1077
|
.option("--agents", "Install into ~/.agents/skills")
|
|
1075
1078
|
.action(async (name, opts) => {
|
|
1076
|
-
const SkillsManager = require("./skills");
|
|
1079
|
+
const SkillsManager = require("./features/skills");
|
|
1077
1080
|
const repoRoot = getPackageRoot();
|
|
1078
1081
|
const manager = new SkillsManager(repoRoot);
|
|
1079
1082
|
try {
|
|
@@ -1445,7 +1448,7 @@ async function runCli(argv) {
|
|
|
1445
1448
|
.option("--no-bell", "Disable terminal bell")
|
|
1446
1449
|
.allowUnknownOption(true)
|
|
1447
1450
|
.action((subscriber, interval, opts) => {
|
|
1448
|
-
const EventBus = require("
|
|
1451
|
+
const EventBus = require("../../coordination/bus");
|
|
1449
1452
|
const eventBus = new EventBus(process.cwd());
|
|
1450
1453
|
const parsedInterval = parseInt(interval, 10);
|
|
1451
1454
|
eventBus
|
|
@@ -1469,7 +1472,7 @@ async function runCli(argv) {
|
|
|
1469
1472
|
.option("--reset", "Truncate pending queue before listening")
|
|
1470
1473
|
.option("--auto-join", "Auto-join bus to get subscriber ID")
|
|
1471
1474
|
.action((subscriber, opts) => {
|
|
1472
|
-
const EventBus = require("
|
|
1475
|
+
const EventBus = require("../../coordination/bus");
|
|
1473
1476
|
const eventBus = new EventBus(process.cwd());
|
|
1474
1477
|
eventBus
|
|
1475
1478
|
.listen(subscriber, {
|
|
@@ -1490,7 +1493,7 @@ async function runCli(argv) {
|
|
|
1490
1493
|
.option("--stop", "Stop running daemon")
|
|
1491
1494
|
.option("--status", "Check daemon status")
|
|
1492
1495
|
.action((opts) => {
|
|
1493
|
-
const EventBus = require("
|
|
1496
|
+
const EventBus = require("../../coordination/bus");
|
|
1494
1497
|
const eventBus = new EventBus(process.cwd());
|
|
1495
1498
|
(async () => {
|
|
1496
1499
|
try {
|
|
@@ -1513,7 +1516,7 @@ async function runCli(argv) {
|
|
|
1513
1516
|
.description("Inject /bus into a Terminal.app tab by subscriber ID")
|
|
1514
1517
|
.argument("<subscriber>", "Subscriber ID to inject into")
|
|
1515
1518
|
.action((subscriber) => {
|
|
1516
|
-
const EventBus = require("
|
|
1519
|
+
const EventBus = require("../../coordination/bus");
|
|
1517
1520
|
const eventBus = new EventBus(process.cwd());
|
|
1518
1521
|
(async () => {
|
|
1519
1522
|
try {
|
|
@@ -1531,7 +1534,7 @@ async function runCli(argv) {
|
|
|
1531
1534
|
.option("--reason <reason>", "Wake reason")
|
|
1532
1535
|
.option("--no-shake", "Disable window shake")
|
|
1533
1536
|
.action((target, opts) => {
|
|
1534
|
-
const EventBus = require("
|
|
1537
|
+
const EventBus = require("../../coordination/bus");
|
|
1535
1538
|
const eventBus = new EventBus(process.cwd());
|
|
1536
1539
|
(async () => {
|
|
1537
1540
|
try {
|
|
@@ -1547,7 +1550,7 @@ async function runCli(argv) {
|
|
|
1547
1550
|
.description("Activate (focus) the terminal/tmux window of an agent")
|
|
1548
1551
|
.argument("<agent-id>", "Agent ID or nickname to activate")
|
|
1549
1552
|
.action((agentId) => {
|
|
1550
|
-
const AgentActivator = require("
|
|
1553
|
+
const AgentActivator = require("../../coordination/bus/activate");
|
|
1551
1554
|
const activator = new AgentActivator(process.cwd());
|
|
1552
1555
|
(async () => {
|
|
1553
1556
|
try {
|
|
@@ -1564,7 +1567,7 @@ async function runCli(argv) {
|
|
|
1564
1567
|
.allowUnknownOption(true)
|
|
1565
1568
|
.argument("<args...>", "Arguments passed to bus module")
|
|
1566
1569
|
.action(async (args) => {
|
|
1567
|
-
const EventBus = require("
|
|
1570
|
+
const EventBus = require("../../coordination/bus");
|
|
1568
1571
|
const eventBus = new EventBus(process.cwd());
|
|
1569
1572
|
const cmd = args[0];
|
|
1570
1573
|
const cmdArgs = args.slice(1);
|
|
@@ -1609,7 +1612,7 @@ async function runCli(argv) {
|
|
|
1609
1612
|
.description("Build unified input timeline (incremental by default)")
|
|
1610
1613
|
.option("--force", "Full rebuild (ignore watermark)")
|
|
1611
1614
|
.action((opts) => {
|
|
1612
|
-
const { buildTimeline } = require("
|
|
1615
|
+
const { buildTimeline } = require("../../coordination/history/inputTimeline");
|
|
1613
1616
|
const result = buildTimeline(process.cwd(), { force: opts.force === true });
|
|
1614
1617
|
console.log(`Timeline: ${result.count} total, ${result.newCount} new → ${result.file}`);
|
|
1615
1618
|
});
|
|
@@ -1618,7 +1621,7 @@ async function runCli(argv) {
|
|
|
1618
1621
|
.description("Show recent timeline entries")
|
|
1619
1622
|
.argument("[limit]", "Number of entries to show", "50")
|
|
1620
1623
|
.action((limit) => {
|
|
1621
|
-
const { showTimeline } = require("
|
|
1624
|
+
const { showTimeline } = require("../../coordination/history/inputTimeline");
|
|
1622
1625
|
showTimeline(process.cwd(), parseInt(limit, 10) || 50);
|
|
1623
1626
|
});
|
|
1624
1627
|
history
|
|
@@ -1626,7 +1629,7 @@ async function runCli(argv) {
|
|
|
1626
1629
|
.description("Render timeline as injectable prompt context")
|
|
1627
1630
|
.argument("[limit]", "Number of entries to include", "30")
|
|
1628
1631
|
.action((limit) => {
|
|
1629
|
-
const { renderTimelineForPrompt } = require("
|
|
1632
|
+
const { renderTimelineForPrompt } = require("../../coordination/history/inputTimeline");
|
|
1630
1633
|
const text = renderTimelineForPrompt(process.cwd(), parseInt(limit, 10) || 30);
|
|
1631
1634
|
if (text) {
|
|
1632
1635
|
console.log(text);
|
|
@@ -1646,7 +1649,7 @@ async function runCli(argv) {
|
|
|
1646
1649
|
|
|
1647
1650
|
// 检查是否是 --version 或 -V 参数
|
|
1648
1651
|
if (argv.includes("--version") || argv.includes("-V")) {
|
|
1649
|
-
const { showUfooBanner } = require("
|
|
1652
|
+
const { showUfooBanner } = require("../../ui/format/banner");
|
|
1650
1653
|
showUfooBanner({ version: pkg.version });
|
|
1651
1654
|
return;
|
|
1652
1655
|
}
|
|
@@ -1686,7 +1689,7 @@ async function runCli(argv) {
|
|
|
1686
1689
|
console.log(" ufoo group diagram <alias|groupId> [--ascii|--mermaid] [--json]");
|
|
1687
1690
|
console.log(" ufoo group stop <groupId> [--json]");
|
|
1688
1691
|
console.log(" ufoo solo list [--json]");
|
|
1689
|
-
console.log(" ufoo solo run <profile> [--agent <codex|claude|ucode>] [--nickname <name>] [--scope <inplace|window>]");
|
|
1692
|
+
console.log(" ufoo solo run <profile> [--agent <codex|claude|ucode|agy>] [--nickname <name>] [--scope <inplace|window>]");
|
|
1690
1693
|
console.log(" ufoo online server [--port 8787] [--host 127.0.0.1] [--token-file <path>]");
|
|
1691
1694
|
console.log(" ufoo online token <subscriber> [--nickname <name>] [--server <url>] [--file <path>]");
|
|
1692
1695
|
console.log(" ufoo online room create [--name <room>] --type public|private [--password <pwd>] [--created-by <name>] [--server <url>]");
|
|
@@ -1711,20 +1714,20 @@ async function runCli(argv) {
|
|
|
1711
1714
|
}
|
|
1712
1715
|
|
|
1713
1716
|
if (cmd === "--version" || cmd === "-V") {
|
|
1714
|
-
const { showUfooBanner } = require("
|
|
1717
|
+
const { showUfooBanner } = require("../../ui/format/banner");
|
|
1715
1718
|
showUfooBanner({ version: pkg.version });
|
|
1716
1719
|
return;
|
|
1717
1720
|
}
|
|
1718
1721
|
|
|
1719
1722
|
if (cmd === "doctor") {
|
|
1720
|
-
const RepoDoctor = require("./doctor");
|
|
1723
|
+
const RepoDoctor = require("./features/doctor");
|
|
1721
1724
|
const doctor = new RepoDoctor(repoRoot);
|
|
1722
1725
|
const ok = doctor.run();
|
|
1723
1726
|
if (!ok) process.exitCode = 1;
|
|
1724
1727
|
return;
|
|
1725
1728
|
}
|
|
1726
1729
|
if (cmd === "status") {
|
|
1727
|
-
const StatusDisplay = require("
|
|
1730
|
+
const StatusDisplay = require("../../coordination/status");
|
|
1728
1731
|
const status = new StatusDisplay(process.cwd());
|
|
1729
1732
|
status.show().catch((err) => {
|
|
1730
1733
|
console.error(err.message);
|
|
@@ -1733,7 +1736,7 @@ async function runCli(argv) {
|
|
|
1733
1736
|
return;
|
|
1734
1737
|
}
|
|
1735
1738
|
if (cmd === "daemon") {
|
|
1736
|
-
run(
|
|
1739
|
+
run(resolveNodeExecutable(), [path.join(repoRoot, "bin", "ufoo.js"), "daemon", ...rest]);
|
|
1737
1740
|
return;
|
|
1738
1741
|
}
|
|
1739
1742
|
if (cmd === "chat") {
|
|
@@ -1741,7 +1744,7 @@ async function runCli(argv) {
|
|
|
1741
1744
|
if (rest.includes("-g") || rest.includes("--global")) {
|
|
1742
1745
|
chatArgs.push("-g");
|
|
1743
1746
|
}
|
|
1744
|
-
run(
|
|
1747
|
+
run(resolveNodeExecutable(), [path.join(repoRoot, "bin", "ufoo.js"), ...chatArgs]);
|
|
1745
1748
|
return;
|
|
1746
1749
|
}
|
|
1747
1750
|
if (cmd === "project") {
|
|
@@ -1831,7 +1834,7 @@ async function runCli(argv) {
|
|
|
1831
1834
|
if (cmd === "report") {
|
|
1832
1835
|
const action = String(rest[0] || "").toLowerCase();
|
|
1833
1836
|
const normalized = normalizeReportPhase(action);
|
|
1834
|
-
const { listReports } = require("
|
|
1837
|
+
const { listReports } = require("../../coordination/report/store");
|
|
1835
1838
|
|
|
1836
1839
|
if (action === "list") {
|
|
1837
1840
|
const agentIdx = rest.indexOf("--agent");
|
|
@@ -1946,8 +1949,8 @@ async function runCli(argv) {
|
|
|
1946
1949
|
}
|
|
1947
1950
|
if (cmd === "ucode") {
|
|
1948
1951
|
const action = String(rest[0] || "doctor").trim().toLowerCase();
|
|
1949
|
-
const { inspectUcodeSetup, formatUcodeDoctor, prepareAndInspectUcode } = require("
|
|
1950
|
-
const { buildUcodeCore } = require("
|
|
1952
|
+
const { inspectUcodeSetup, formatUcodeDoctor, prepareAndInspectUcode } = require("../../code/launcher/ucodeDoctor");
|
|
1953
|
+
const { buildUcodeCore } = require("../../code/launcher/ucodeBuild");
|
|
1951
1954
|
const skipInstall = rest.includes("--skip-install");
|
|
1952
1955
|
if (action !== "doctor" && action !== "prepare" && action !== "build") {
|
|
1953
1956
|
console.error("ucode action must be doctor|prepare|build");
|
|
@@ -2015,7 +2018,7 @@ async function runCli(argv) {
|
|
|
2015
2018
|
return;
|
|
2016
2019
|
}
|
|
2017
2020
|
if (cmd === "init") {
|
|
2018
|
-
const UfooInit = require("./init");
|
|
2021
|
+
const UfooInit = require("./features/init");
|
|
2019
2022
|
const init = new UfooInit(repoRoot);
|
|
2020
2023
|
|
|
2021
2024
|
const getOpt = (name, def) => {
|
|
@@ -2037,7 +2040,7 @@ async function runCli(argv) {
|
|
|
2037
2040
|
return;
|
|
2038
2041
|
}
|
|
2039
2042
|
if (cmd === "skills") {
|
|
2040
|
-
const SkillsManager = require("./skills");
|
|
2043
|
+
const SkillsManager = require("./features/skills");
|
|
2041
2044
|
const manager = new SkillsManager(repoRoot);
|
|
2042
2045
|
const sub = rest[0] || "";
|
|
2043
2046
|
|
|
@@ -2297,7 +2300,7 @@ async function runCli(argv) {
|
|
|
2297
2300
|
if (cmd === "bus") {
|
|
2298
2301
|
const sub = rest[0] || "";
|
|
2299
2302
|
if (sub === "alert") {
|
|
2300
|
-
const EventBus = require("
|
|
2303
|
+
const EventBus = require("../../coordination/bus");
|
|
2301
2304
|
const eventBus = new EventBus(process.cwd());
|
|
2302
2305
|
const args = rest.slice(1);
|
|
2303
2306
|
const subscriber = args[0];
|
|
@@ -2323,7 +2326,7 @@ async function runCli(argv) {
|
|
|
2323
2326
|
return;
|
|
2324
2327
|
}
|
|
2325
2328
|
if (sub === "listen") {
|
|
2326
|
-
const EventBus = require("
|
|
2329
|
+
const EventBus = require("../../coordination/bus");
|
|
2327
2330
|
const eventBus = new EventBus(process.cwd());
|
|
2328
2331
|
const args = rest.slice(1);
|
|
2329
2332
|
const subscriber = args.find((arg) => !arg.startsWith("--"));
|
|
@@ -2342,7 +2345,7 @@ async function runCli(argv) {
|
|
|
2342
2345
|
}
|
|
2343
2346
|
if (sub === "daemon") {
|
|
2344
2347
|
// 使用 JavaScript daemon
|
|
2345
|
-
const EventBus = require("
|
|
2348
|
+
const EventBus = require("../../coordination/bus");
|
|
2346
2349
|
const eventBus = new EventBus(process.cwd());
|
|
2347
2350
|
|
|
2348
2351
|
(async () => {
|
|
@@ -2369,7 +2372,7 @@ async function runCli(argv) {
|
|
|
2369
2372
|
}
|
|
2370
2373
|
if (sub === "inject") {
|
|
2371
2374
|
// 使用 JavaScript inject
|
|
2372
|
-
const EventBus = require("
|
|
2375
|
+
const EventBus = require("../../coordination/bus");
|
|
2373
2376
|
const eventBus = new EventBus(process.cwd());
|
|
2374
2377
|
|
|
2375
2378
|
(async () => {
|
|
@@ -2387,7 +2390,7 @@ async function runCli(argv) {
|
|
|
2387
2390
|
return;
|
|
2388
2391
|
}
|
|
2389
2392
|
if (sub === "wake") {
|
|
2390
|
-
const EventBus = require("
|
|
2393
|
+
const EventBus = require("../../coordination/bus");
|
|
2391
2394
|
const eventBus = new EventBus(process.cwd());
|
|
2392
2395
|
(async () => {
|
|
2393
2396
|
try {
|
|
@@ -2406,7 +2409,7 @@ async function runCli(argv) {
|
|
|
2406
2409
|
}
|
|
2407
2410
|
|
|
2408
2411
|
// Use JavaScript EventBus module for core commands
|
|
2409
|
-
const EventBus = require("
|
|
2412
|
+
const EventBus = require("../../coordination/bus");
|
|
2410
2413
|
const eventBus = new EventBus(process.cwd());
|
|
2411
2414
|
|
|
2412
2415
|
(async () => {
|
|
@@ -2444,7 +2447,7 @@ async function runCli(argv) {
|
|
|
2444
2447
|
if (cmd === "history") {
|
|
2445
2448
|
const sub = rest[0] || "show";
|
|
2446
2449
|
const cwd = process.cwd();
|
|
2447
|
-
const { buildTimeline, showTimeline, renderTimelineForPrompt } = require("
|
|
2450
|
+
const { buildTimeline, showTimeline, renderTimelineForPrompt } = require("../../coordination/history/inputTimeline");
|
|
2448
2451
|
|
|
2449
2452
|
if (sub === "build") {
|
|
2450
2453
|
const force = rest.includes("--force");
|
package/src/app/index.js
ADDED
package/src/code/agent.js
CHANGED
|
@@ -16,7 +16,7 @@ const {
|
|
|
16
16
|
createEscapeTagStripper,
|
|
17
17
|
stripLeakedEscapeTags,
|
|
18
18
|
} = require("./tui");
|
|
19
|
-
const { stripBlessedTags } = require("../chat/text");
|
|
19
|
+
const { stripBlessedTags } = require("../app/chat/text");
|
|
20
20
|
const { loadConfig, defaultAgentModelForProvider, sameModelProvider } = require("../config");
|
|
21
21
|
const {
|
|
22
22
|
resolveSessionId,
|
|
@@ -24,7 +24,7 @@ const {
|
|
|
24
24
|
saveSessionSnapshot,
|
|
25
25
|
loadSessionSnapshot,
|
|
26
26
|
} = require("./sessionStore");
|
|
27
|
-
const { buildPromptContext } = require("
|
|
27
|
+
const { buildPromptContext } = require("../agents/prompts/native");
|
|
28
28
|
const {
|
|
29
29
|
buildSkillInjections,
|
|
30
30
|
formatSkillsList,
|
|
@@ -50,10 +50,11 @@ function normalizeLine(input = "") {
|
|
|
50
50
|
return String(input || "").trim();
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
function
|
|
53
|
+
function parseLegacyUfooMarkerCommand(input = "") {
|
|
54
54
|
const text = String(input || "").trim();
|
|
55
55
|
if (!text) return "";
|
|
56
|
-
//
|
|
56
|
+
// Old daemons injected strict "<prefix> <single-token>" commands for
|
|
57
|
+
// session discovery. Keep ignoring those inputs after removing injection.
|
|
57
58
|
const match = text.match(/^(?:\$ufoo|\/ufoo|ufoo)\s+([A-Za-z0-9][A-Za-z0-9._:-]{0,63})$/);
|
|
58
59
|
return match ? String(match[1] || "").trim() : "";
|
|
59
60
|
}
|
|
@@ -1321,11 +1322,11 @@ function runSingleCommand(line = "", workspaceRoot = process.cwd()) {
|
|
|
1321
1322
|
].join("\n"),
|
|
1322
1323
|
};
|
|
1323
1324
|
}
|
|
1324
|
-
const
|
|
1325
|
-
if (
|
|
1325
|
+
const legacyUfooMarker = parseLegacyUfooMarkerCommand(text);
|
|
1326
|
+
if (legacyUfooMarker) {
|
|
1326
1327
|
return {
|
|
1327
|
-
kind: "
|
|
1328
|
-
marker:
|
|
1328
|
+
kind: "legacy_ufoo_marker",
|
|
1329
|
+
marker: legacyUfooMarker,
|
|
1329
1330
|
};
|
|
1330
1331
|
}
|
|
1331
1332
|
if (text === "ubus" || text === "/ubus") {
|
|
@@ -1613,7 +1614,7 @@ async function runUcodeCoreAgent({
|
|
|
1613
1614
|
rl.close();
|
|
1614
1615
|
return;
|
|
1615
1616
|
}
|
|
1616
|
-
if (result.kind === "
|
|
1617
|
+
if (result.kind === "legacy_ufoo_marker") {
|
|
1617
1618
|
return;
|
|
1618
1619
|
}
|
|
1619
1620
|
if (result.kind === "help" || result.kind === "tool" || result.kind === "skills" || result.kind === "error") {
|
package/src/code/index.js
CHANGED
|
@@ -32,6 +32,7 @@ const {
|
|
|
32
32
|
saveSessionSnapshot,
|
|
33
33
|
loadSessionSnapshot,
|
|
34
34
|
} = require("./sessionStore");
|
|
35
|
+
const launcher = require("./launcher");
|
|
35
36
|
|
|
36
37
|
module.exports = {
|
|
37
38
|
TOOL_NAMES,
|
|
@@ -67,4 +68,5 @@ module.exports = {
|
|
|
67
68
|
getSessionFilePath,
|
|
68
69
|
saveSessionSnapshot,
|
|
69
70
|
loadSessionSnapshot,
|
|
71
|
+
...launcher,
|
|
70
72
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
const { loadConfig } = require("
|
|
1
|
+
const { loadConfig } = require("../../config");
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const fs = require("fs");
|
|
4
4
|
|
|
5
5
|
function bundledModuleRoots() {
|
|
6
|
-
const repoRoot = path.join(__dirname, "..", "..");
|
|
7
6
|
return [
|
|
8
|
-
path.join(
|
|
7
|
+
path.join(__dirname, ".."),
|
|
9
8
|
];
|
|
10
9
|
}
|
|
11
10
|
|
|
@@ -22,7 +21,7 @@ function resolveFirstExisting(paths = []) {
|
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
function defaultBundledCoreRoot() {
|
|
25
|
-
const root = path.join(__dirname, ".."
|
|
24
|
+
const root = path.join(__dirname, "..");
|
|
26
25
|
const agentEntry = path.join(root, "agent.js");
|
|
27
26
|
if (resolveFirstExisting([agentEntry])) return root;
|
|
28
27
|
return root;
|
|
@@ -289,8 +288,8 @@ function resolveCandidateCoreRoot({
|
|
|
289
288
|
|
|
290
289
|
function resolveNativeFallbackCommand({ env = process.env } = {}) {
|
|
291
290
|
const candidates = [
|
|
292
|
-
path.resolve(__dirname, "..", "
|
|
293
|
-
path.resolve(__dirname, "..", "..", "bin", "ucode-core.js"),
|
|
291
|
+
path.resolve(__dirname, "..", "agent.js"),
|
|
292
|
+
path.resolve(__dirname, "..", "..", "..", "bin", "ucode-core.js"),
|
|
294
293
|
];
|
|
295
294
|
for (const entry of candidates) {
|
|
296
295
|
try {
|
|
@@ -299,7 +298,7 @@ function resolveNativeFallbackCommand({ env = process.env } = {}) {
|
|
|
299
298
|
return {
|
|
300
299
|
command: process.execPath,
|
|
301
300
|
args: [entry],
|
|
302
|
-
root: path.resolve(__dirname, ".."
|
|
301
|
+
root: path.resolve(__dirname, ".."),
|
|
303
302
|
kind: "native",
|
|
304
303
|
available: true,
|
|
305
304
|
resolvedPath: entry,
|
|
@@ -308,7 +307,7 @@ function resolveNativeFallbackCommand({ env = process.env } = {}) {
|
|
|
308
307
|
return {
|
|
309
308
|
command: process.execPath,
|
|
310
309
|
args: [entry, "agent"],
|
|
311
|
-
root: path.resolve(__dirname, ".."
|
|
310
|
+
root: path.resolve(__dirname, ".."),
|
|
312
311
|
kind: "native",
|
|
313
312
|
available: true,
|
|
314
313
|
resolvedPath: entry,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
|
3
|
-
const { getUfooPaths } = require("
|
|
4
|
-
const { buildDefaultStartupBootstrapPrompt } = require("
|
|
3
|
+
const { getUfooPaths } = require("../../coordination/state/paths");
|
|
4
|
+
const { buildDefaultStartupBootstrapPrompt } = require("../../agents/prompts/defaultBootstrap");
|
|
5
5
|
|
|
6
6
|
function readFileSafe(filePath = "") {
|
|
7
7
|
if (!filePath) return "";
|
|
@@ -77,7 +77,7 @@ function buildBootstrapContent({
|
|
|
77
77
|
|
|
78
78
|
function hasUfooProtocolPrompt(promptText = "") {
|
|
79
79
|
const text = String(promptText || "");
|
|
80
|
-
return text.includes("
|
|
80
|
+
return text.includes("Session harness: ufoo") && text.includes("ufoo ctx decisions -l");
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
function mergeDefaultUfooProtocolPrompt(projectRoot = "", promptText = "") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
|
3
|
-
const { loadConfig } = require("
|
|
3
|
+
const { loadConfig } = require("../../config");
|
|
4
4
|
const {
|
|
5
5
|
resolveNativeFallbackCommand,
|
|
6
6
|
} = require("./ucode");
|
|
@@ -12,7 +12,7 @@ function resolveCoreRoot({
|
|
|
12
12
|
void env;
|
|
13
13
|
void config;
|
|
14
14
|
const native = resolveNativeFallbackCommand();
|
|
15
|
-
return native.root || path.resolve(__dirname, ".."
|
|
15
|
+
return native.root || path.resolve(__dirname, "..");
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function inspectUcodeBuildSetup({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
|
3
|
-
const { loadConfig } = require("
|
|
3
|
+
const { loadConfig } = require("../../config");
|
|
4
4
|
const {
|
|
5
5
|
resolveNativeFallbackCommand,
|
|
6
6
|
defaultBundledPromptFile,
|
|
@@ -20,7 +20,7 @@ function inspectUcodeSetup({
|
|
|
20
20
|
const native = resolveNativeImpl({ env, config, cwd: root });
|
|
21
21
|
const coreAvailable = Boolean(native && native.available !== false && native.command);
|
|
22
22
|
const core = native ? {
|
|
23
|
-
root: native.root || path.resolve(__dirname, ".."
|
|
23
|
+
root: native.root || path.resolve(__dirname, ".."),
|
|
24
24
|
command: native.command,
|
|
25
25
|
args: native.args || [],
|
|
26
26
|
available: coreAvailable,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
|
3
|
-
const { loadGlobalUcodeConfig } = require("
|
|
3
|
+
const { loadGlobalUcodeConfig } = require("../../config");
|
|
4
4
|
|
|
5
5
|
function readJson(filePath = "", fallback = {}) {
|
|
6
6
|
if (!filePath) return fallback;
|
|
@@ -134,4 +134,3 @@ module.exports = {
|
|
|
134
134
|
inspectUcodeRuntimeConfig,
|
|
135
135
|
prepareUcodeRuntimeConfig,
|
|
136
136
|
};
|
|
137
|
-
|
package/src/code/nativeRunner.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const { randomUUID } = require("crypto");
|
|
2
2
|
const { loadConfig, defaultAgentModelForProvider, sameModelProvider } = require("../config");
|
|
3
3
|
const { runToolCall } = require("./dispatch");
|
|
4
|
-
const { getReadToolDescription } = require("
|
|
5
|
-
const { getWriteToolDescription } = require("
|
|
6
|
-
const { getEditToolDescription } = require("
|
|
7
|
-
const { getBashToolDescription } = require("
|
|
4
|
+
const { getReadToolDescription } = require("../agents/prompts/native/toolDescriptions/read");
|
|
5
|
+
const { getWriteToolDescription } = require("../agents/prompts/native/toolDescriptions/write");
|
|
6
|
+
const { getEditToolDescription } = require("../agents/prompts/native/toolDescriptions/edit");
|
|
7
|
+
const { getBashToolDescription } = require("../agents/prompts/native/toolDescriptions/bash");
|
|
8
8
|
|
|
9
9
|
const CORE_TOOL_NAMES = new Set(["read", "write", "edit", "bash"]);
|
|
10
10
|
const DEFAULT_OPENAI_BASE_URL = "https://api.openai.com/v1";
|