u-foo 1.0.6 → 1.1.9
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 +44 -4
- package/SKILLS/ufoo/SKILL.md +17 -2
- package/SKILLS/uinit/SKILL.md +8 -3
- package/bin/ucode-core.js +15 -0
- package/bin/ucode.js +125 -0
- package/bin/ufoo-assistant-agent.js +5 -0
- package/bin/ufoo-engine.js +25 -0
- package/bin/ufoo.js +4 -0
- package/modules/AGENTS.template.md +14 -4
- package/modules/bus/README.md +8 -5
- package/modules/bus/SKILLS/ubus/SKILL.md +5 -4
- package/modules/context/SKILLS/uctx/SKILL.md +3 -1
- package/modules/online/SKILLS/ufoo-online/SKILL.md +144 -0
- package/package.json +12 -3
- package/scripts/import-pi-mono.js +124 -0
- package/scripts/postinstall.js +20 -49
- package/scripts/sync-claude-skills.sh +21 -0
- package/src/agent/cliRunner.js +524 -31
- package/src/agent/internalRunner.js +76 -9
- package/src/agent/launcher.js +97 -45
- package/src/agent/normalizeOutput.js +1 -1
- package/src/agent/notifier.js +144 -4
- package/src/agent/ptyRunner.js +480 -10
- package/src/agent/ptyWrapper.js +28 -3
- package/src/agent/readyDetector.js +16 -0
- package/src/agent/ucode.js +443 -0
- package/src/agent/ucodeBootstrap.js +113 -0
- package/src/agent/ucodeBuild.js +67 -0
- package/src/agent/ucodeDoctor.js +184 -0
- package/src/agent/ucodeRuntimeConfig.js +129 -0
- package/src/agent/ufooAgent.js +11 -2
- package/src/assistant/agent.js +260 -0
- package/src/assistant/bridge.js +172 -0
- package/src/assistant/engine.js +252 -0
- package/src/assistant/stdio.js +58 -0
- package/src/assistant/ufooEngineCli.js +306 -0
- package/src/bus/activate.js +27 -11
- package/src/bus/daemon.js +133 -5
- package/src/bus/index.js +137 -80
- package/src/bus/inject.js +47 -17
- package/src/bus/message.js +145 -17
- package/src/bus/nickname.js +3 -1
- package/src/bus/queue.js +6 -1
- package/src/bus/store.js +189 -0
- package/src/bus/subscriber.js +20 -4
- package/src/bus/utils.js +9 -3
- package/src/chat/agentBar.js +117 -0
- package/src/chat/agentDirectory.js +88 -0
- package/src/chat/agentSockets.js +225 -0
- package/src/chat/agentViewController.js +298 -0
- package/src/chat/chatLogController.js +115 -0
- package/src/chat/commandExecutor.js +700 -0
- package/src/chat/commands.js +132 -0
- package/src/chat/completionController.js +414 -0
- package/src/chat/cronScheduler.js +160 -0
- package/src/chat/daemonConnection.js +166 -0
- package/src/chat/daemonCoordinator.js +64 -0
- package/src/chat/daemonMessageRouter.js +257 -0
- package/src/chat/daemonReconnect.js +41 -0
- package/src/chat/daemonTransport.js +36 -0
- package/src/chat/daemonTransportDefaults.js +10 -0
- package/src/chat/dashboardKeyController.js +480 -0
- package/src/chat/dashboardView.js +154 -0
- package/src/chat/index.js +935 -2909
- package/src/chat/inputHistoryController.js +105 -0
- package/src/chat/inputListenerController.js +304 -0
- package/src/chat/inputMath.js +104 -0
- package/src/chat/inputSubmitHandler.js +171 -0
- package/src/chat/layout.js +165 -0
- package/src/chat/pasteController.js +81 -0
- package/src/chat/rawKeyMap.js +42 -0
- package/src/chat/settingsController.js +132 -0
- package/src/chat/statusLineController.js +177 -0
- package/src/chat/streamTracker.js +138 -0
- package/src/chat/text.js +70 -0
- package/src/chat/transport.js +61 -0
- package/src/cli/busCoreCommands.js +59 -0
- package/src/cli/ctxCoreCommands.js +199 -0
- package/src/cli/onlineCoreCommands.js +379 -0
- package/src/cli.js +741 -238
- package/src/code/README.md +29 -0
- package/src/code/UCODE_PROMPT.md +32 -0
- package/src/code/agent.js +1651 -0
- package/src/code/cli.js +158 -0
- package/src/code/config +0 -0
- package/src/code/dispatch.js +42 -0
- package/src/code/index.js +70 -0
- package/src/code/nativeRunner.js +1213 -0
- package/src/code/runtime.js +154 -0
- package/src/code/sessionStore.js +162 -0
- package/src/code/taskDecomposer.js +269 -0
- package/src/code/tools/bash.js +53 -0
- package/src/code/tools/common.js +42 -0
- package/src/code/tools/edit.js +70 -0
- package/src/code/tools/read.js +44 -0
- package/src/code/tools/write.js +35 -0
- package/src/code/tui.js +1580 -0
- package/src/config.js +47 -1
- package/src/context/decisions.js +12 -2
- package/src/context/index.js +18 -1
- package/src/context/sync.js +127 -0
- package/src/daemon/agentProcessManager.js +74 -0
- package/src/daemon/cronOps.js +241 -0
- package/src/daemon/index.js +661 -488
- package/src/daemon/ipcServer.js +99 -0
- package/src/daemon/ops.js +417 -179
- package/src/daemon/promptLoop.js +319 -0
- package/src/daemon/promptRequest.js +101 -0
- package/src/daemon/providerSessions.js +32 -17
- package/src/daemon/reporting.js +90 -0
- package/src/daemon/run.js +2 -5
- package/src/daemon/status.js +24 -1
- package/src/init/index.js +68 -14
- package/src/online/bridge.js +663 -0
- package/src/online/client.js +245 -0
- package/src/online/runner.js +253 -0
- package/src/online/server.js +992 -0
- package/src/online/tokens.js +103 -0
- package/src/report/store.js +331 -0
- package/src/shared/eventContract.js +35 -0
- package/src/shared/ptySocketContract.js +21 -0
- package/src/status/index.js +50 -17
- package/src/terminal/adapterContract.js +87 -0
- package/src/terminal/adapterRouter.js +84 -0
- package/src/terminal/adapters/externalAdapter.js +14 -0
- package/src/terminal/adapters/internalAdapter.js +13 -0
- package/src/terminal/adapters/internalPtyAdapter.js +42 -0
- package/src/terminal/adapters/internalQueueAdapter.js +37 -0
- package/src/terminal/adapters/terminalAdapter.js +31 -0
- package/src/terminal/adapters/tmuxAdapter.js +30 -0
- package/src/ufoo/agentsStore.js +69 -3
- package/src/utils/banner.js +5 -2
- package/scripts/.archived/bash-to-js-migration/README.md +0 -46
- package/scripts/.archived/bash-to-js-migration/banner.sh +0 -89
- package/scripts/.archived/bash-to-js-migration/bus-alert.sh +0 -6
- package/scripts/.archived/bash-to-js-migration/bus-autotrigger.sh +0 -6
- package/scripts/.archived/bash-to-js-migration/bus-daemon.sh +0 -231
- package/scripts/.archived/bash-to-js-migration/bus-inject.sh +0 -176
- package/scripts/.archived/bash-to-js-migration/bus-listen.sh +0 -6
- package/scripts/.archived/bash-to-js-migration/bus.sh +0 -986
- package/scripts/.archived/bash-to-js-migration/context-decisions.sh +0 -167
- package/scripts/.archived/bash-to-js-migration/context-doctor.sh +0 -72
- package/scripts/.archived/bash-to-js-migration/context-lint.sh +0 -110
- package/scripts/.archived/bash-to-js-migration/doctor.sh +0 -22
- package/scripts/.archived/bash-to-js-migration/init.sh +0 -247
- package/scripts/.archived/bash-to-js-migration/skills.sh +0 -113
- package/scripts/.archived/bash-to-js-migration/status.sh +0 -125
- package/scripts/banner.sh +0 -2
- package/src/bus/API_DESIGN.md +0 -204
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { spawnSync } = require("child_process");
|
|
6
|
+
|
|
7
|
+
function usage() {
|
|
8
|
+
console.log("Usage: node scripts/import-pi-mono.js <pi-mono-source-path> [--target <target-path>]");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function shouldSkip(name = "") {
|
|
12
|
+
return name === ".git" || name === "node_modules";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function copyRecursive(source, target) {
|
|
16
|
+
const stat = fs.statSync(source);
|
|
17
|
+
if (stat.isDirectory()) {
|
|
18
|
+
fs.mkdirSync(target, { recursive: true });
|
|
19
|
+
const entries = fs.readdirSync(source);
|
|
20
|
+
for (const entry of entries) {
|
|
21
|
+
if (shouldSkip(entry)) continue;
|
|
22
|
+
copyRecursive(path.join(source, entry), path.join(target, entry));
|
|
23
|
+
}
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
27
|
+
fs.copyFileSync(source, target);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function parseArgs(argv = []) {
|
|
31
|
+
const args = Array.isArray(argv) ? argv : [];
|
|
32
|
+
const parsed = {
|
|
33
|
+
source: "",
|
|
34
|
+
target: "",
|
|
35
|
+
help: false,
|
|
36
|
+
};
|
|
37
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
38
|
+
const item = String(args[i] || "").trim();
|
|
39
|
+
if (!item) continue;
|
|
40
|
+
if (item === "--help" || item === "-h") {
|
|
41
|
+
parsed.help = true;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (item === "--target" || item === "-t") {
|
|
45
|
+
const next = String(args[i + 1] || "").trim();
|
|
46
|
+
if (next) parsed.target = next;
|
|
47
|
+
i += 1;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (!parsed.source) parsed.source = item;
|
|
51
|
+
}
|
|
52
|
+
return parsed;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function readGitValue(sourceRoot = "", gitArgs = []) {
|
|
56
|
+
try {
|
|
57
|
+
const res = spawnSync("git", ["-C", sourceRoot, ...gitArgs], {
|
|
58
|
+
encoding: "utf8",
|
|
59
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
60
|
+
});
|
|
61
|
+
if (res.error || res.status !== 0) return "";
|
|
62
|
+
return String(res.stdout || "").trim();
|
|
63
|
+
} catch {
|
|
64
|
+
return "";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function readGitMetadata(sourceRoot = "") {
|
|
69
|
+
return {
|
|
70
|
+
commit: readGitValue(sourceRoot, ["rev-parse", "HEAD"]),
|
|
71
|
+
branch: readGitValue(sourceRoot, ["rev-parse", "--abbrev-ref", "HEAD"]),
|
|
72
|
+
remote: readGitValue(sourceRoot, ["config", "--get", "remote.origin.url"]),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function main() {
|
|
77
|
+
const parsedArgs = parseArgs(process.argv.slice(2));
|
|
78
|
+
if (parsedArgs.help) {
|
|
79
|
+
usage();
|
|
80
|
+
process.exit(0);
|
|
81
|
+
}
|
|
82
|
+
const sourceArg = parsedArgs.source || "";
|
|
83
|
+
if (!sourceArg) {
|
|
84
|
+
usage();
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const sourceRoot = path.resolve(sourceArg);
|
|
89
|
+
const sourcePackage = path.join(sourceRoot, "package.json");
|
|
90
|
+
if (!fs.existsSync(sourcePackage)) {
|
|
91
|
+
console.error(`Invalid source: missing package.json at ${sourceRoot}`);
|
|
92
|
+
process.exit(2);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const repoRoot = path.resolve(__dirname, "..");
|
|
96
|
+
const targetRoot = path.resolve(parsedArgs.target || path.join(repoRoot, "src", "code", "pi-mono"));
|
|
97
|
+
const backupRoot = `${targetRoot}.backup-${Date.now()}`;
|
|
98
|
+
|
|
99
|
+
if (fs.existsSync(targetRoot)) {
|
|
100
|
+
fs.renameSync(targetRoot, backupRoot);
|
|
101
|
+
console.log(`Backed up existing fork to ${backupRoot}`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
copyRecursive(sourceRoot, targetRoot);
|
|
105
|
+
const upstream = readGitMetadata(sourceRoot);
|
|
106
|
+
|
|
107
|
+
const metadata = {
|
|
108
|
+
imported_at: new Date().toISOString(),
|
|
109
|
+
source_root: sourceRoot,
|
|
110
|
+
target: targetRoot,
|
|
111
|
+
upstream_commit: upstream.commit,
|
|
112
|
+
upstream_branch: upstream.branch,
|
|
113
|
+
upstream_remote: upstream.remote,
|
|
114
|
+
};
|
|
115
|
+
fs.writeFileSync(
|
|
116
|
+
path.join(targetRoot, ".ufoo-import.json"),
|
|
117
|
+
`${JSON.stringify(metadata, null, 2)}\n`,
|
|
118
|
+
"utf8",
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
console.log(`Imported pi-mono into ${targetRoot}${upstream.commit ? ` @ ${upstream.commit}` : ""}`);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
main();
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,59 +1,30 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const fs = require("fs");
|
|
4
|
-
const { spawnSync } = require("child_process");
|
|
5
|
-
|
|
6
|
-
function run(args) {
|
|
7
|
-
const bin = path.join(__dirname, "..", "bin", "ufoo.js");
|
|
8
|
-
const res = spawnSync(process.execPath, [bin, ...args], {
|
|
9
|
-
stdio: "ignore",
|
|
10
|
-
});
|
|
11
|
-
return res.status === 0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function tryInstall(args, label) {
|
|
15
|
-
try {
|
|
16
|
-
run(args);
|
|
17
|
-
} catch (err) {
|
|
18
|
-
console.warn(`[postinstall] ${label} failed: ${err.message || String(err)}`);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
4
|
|
|
22
5
|
// Fix node-pty spawn-helper permissions on macOS (both arm64 and x64)
|
|
23
|
-
|
|
24
|
-
const platforms = ["darwin-arm64", "darwin-x64"];
|
|
6
|
+
const platforms = ["darwin-arm64", "darwin-x64"];
|
|
25
7
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
console.log(`[postinstall] Fixed node-pty spawn-helper permissions (${platform})`);
|
|
44
|
-
}
|
|
8
|
+
for (const platform of platforms) {
|
|
9
|
+
try {
|
|
10
|
+
const spawnHelperPath = path.join(
|
|
11
|
+
__dirname,
|
|
12
|
+
"..",
|
|
13
|
+
"node_modules",
|
|
14
|
+
"node-pty",
|
|
15
|
+
"prebuilds",
|
|
16
|
+
platform,
|
|
17
|
+
"spawn-helper"
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
if (fs.existsSync(spawnHelperPath)) {
|
|
21
|
+
const stats = fs.statSync(spawnHelperPath);
|
|
22
|
+
if ((stats.mode & 0o111) === 0) {
|
|
23
|
+
fs.chmodSync(spawnHelperPath, 0o755);
|
|
24
|
+
console.log(`[postinstall] Fixed node-pty spawn-helper permissions (${platform})`);
|
|
45
25
|
}
|
|
46
|
-
} catch {
|
|
47
|
-
// Silently ignore errors - not critical for non-macOS or if node-pty not installed
|
|
48
26
|
}
|
|
27
|
+
} catch {
|
|
28
|
+
// Silently ignore - not critical for non-macOS or if node-pty not installed
|
|
49
29
|
}
|
|
50
30
|
}
|
|
51
|
-
|
|
52
|
-
fixNodePtyPermissions();
|
|
53
|
-
|
|
54
|
-
const skills = ["ufoo", "ubus", "uctx"];
|
|
55
|
-
|
|
56
|
-
for (const skill of skills) {
|
|
57
|
-
tryInstall(["skills", "install", skill, "--codex"], `install ${skill} skill (codex)`);
|
|
58
|
-
tryInstall(["skills", "install", skill], `install ${skill} skill (claude)`);
|
|
59
|
-
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Sync SKILLS to .claude/commands for Claude Code slash commands
|
|
3
|
+
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
SKILLS_DIR="SKILLS"
|
|
7
|
+
CLAUDE_COMMANDS_DIR=".claude/commands"
|
|
8
|
+
|
|
9
|
+
# Create commands directory if it doesn't exist
|
|
10
|
+
mkdir -p "$CLAUDE_COMMANDS_DIR"
|
|
11
|
+
|
|
12
|
+
# Copy all SKILL.md files to .claude/commands/
|
|
13
|
+
for skill_dir in "$SKILLS_DIR"/*; do
|
|
14
|
+
if [ -d "$skill_dir" ] && [ -f "$skill_dir/SKILL.md" ]; then
|
|
15
|
+
skill_name=$(basename "$skill_dir")
|
|
16
|
+
echo "Syncing $skill_name..."
|
|
17
|
+
cp "$skill_dir/SKILL.md" "$CLAUDE_COMMANDS_DIR/$skill_name.md"
|
|
18
|
+
fi
|
|
19
|
+
done
|
|
20
|
+
|
|
21
|
+
echo "Skills synced to Claude Code commands directory!"
|