@solar_orb/agent_orb 0.1.3 → 0.1.5
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 +1 -1
- package/dist/config.js +1 -1
- package/dist/download.js +14 -2
- package/dist/index.js +1 -1
- package/dist/setup.js +14 -6
- package/dist/shell.js +39 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/config.js
CHANGED
|
@@ -14,7 +14,7 @@ export function writeConfig(configDir, selectedAdapters, runtime = runtimeConfig
|
|
|
14
14
|
fs.mkdirSync(configDir, { recursive: true });
|
|
15
15
|
const configPath = path.join(configDir, 'config.toml');
|
|
16
16
|
const enabled = new Set(selectedAdapters.map((adapter) => adapter.name));
|
|
17
|
-
const content = `# Generated by npx agent_orb\n\n[install]\nmethod = "npx"\nversion = "0.1.
|
|
17
|
+
const content = `# Generated by npx agent_orb\n\n[install]\nmethod = "npx"\nversion = "0.1.5"\n\n[adapters.codex]\nenabled = ${enabled.has('codex')}\nbinary = "codex"\nwrapper = "agent_orb-codex"\n\n[adapters.claude]\nenabled = ${enabled.has('claude')}\nbinary = "claude"\nwrapper = "agent_orb-claude"\n\n[daemon]\nhost = "${runtime.daemonHost}"\nport = ${runtime.daemonPort}\nauto_start = true\n\n[orb]\nposition = "top-right"\nsize = 36\nopacity = 0.88\nalways_on_top = true\nclick_through = false\n\n[colors]\ndisconnected = "#6B7280"\nidle = "#9CA3AF"\nstarting = "#60A5FA"\nactive = "#3B82F6"\nthinking_like = "#8B5CF6"\nwaiting_input = "#FBBF24"\ncompleted = "#22C55E"\nerror = "#EF4444"\nwarning = "#F97316"\n\n[behavior]\nsilent_threshold_seconds = 20\nstuck_threshold_seconds = 180\ncompleted_hold_seconds = 10\nerror_requires_click_to_clear = true\n\n[privacy]\ninclude_output_sample = false\nmax_sample_chars = 512\n`;
|
|
18
18
|
fs.writeFileSync(configPath, content, 'utf8');
|
|
19
19
|
return configPath;
|
|
20
20
|
}
|
package/dist/download.js
CHANGED
|
@@ -30,6 +30,7 @@ export async function installRuntimeBundle(platform, options = {}) {
|
|
|
30
30
|
console.log(`✓ checksum verified: ${platform.bundleName}`);
|
|
31
31
|
cleanupInstalledRuntime(platform);
|
|
32
32
|
extractBundle(bundlePath, tempDir, platform);
|
|
33
|
+
assertRuntimeInstalled(platform);
|
|
33
34
|
writeInstallManifest(platform, {
|
|
34
35
|
bundle: platform.bundleName,
|
|
35
36
|
sha256: expected,
|
|
@@ -43,8 +44,19 @@ export async function installRuntimeBundle(platform, options = {}) {
|
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
export function runtimeLooksInstalled(platform) {
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
return requiredRuntimeFiles(platform).every((file) => fs.existsSync(file));
|
|
48
|
+
}
|
|
49
|
+
function assertRuntimeInstalled(platform) {
|
|
50
|
+
const missing = requiredRuntimeFiles(platform).filter((file) => !fs.existsSync(file));
|
|
51
|
+
if (missing.length === 0)
|
|
52
|
+
return;
|
|
53
|
+
const installed = fs.existsSync(platform.runtimeDir)
|
|
54
|
+
? fs.readdirSync(platform.runtimeDir).sort().join(', ')
|
|
55
|
+
: '<runtime dir missing>';
|
|
56
|
+
throw new Error(`Runtime install incomplete; missing ${missing.join(', ')}. Installed files: ${installed}`);
|
|
57
|
+
}
|
|
58
|
+
function requiredRuntimeFiles(platform) {
|
|
59
|
+
return ['agent_orb', 'agent_orbd'].map((name) => path.join(platform.runtimeDir, `${name}${platform.exeSuffix}`));
|
|
48
60
|
}
|
|
49
61
|
export function cleanupInstalledRuntime(platform) {
|
|
50
62
|
if (!fs.existsSync(platform.runtimeDir))
|
package/dist/index.js
CHANGED
package/dist/setup.js
CHANGED
|
@@ -200,10 +200,10 @@ function createAdapterShims(platform, adapters) {
|
|
|
200
200
|
for (const command of commands) {
|
|
201
201
|
const shimPath = path.join(platform.runtimeDir, command);
|
|
202
202
|
if (platform.platform === 'windows') {
|
|
203
|
-
fs.writeFileSync(shimPath, windowsAdapterShim(adapter.name), 'ascii');
|
|
203
|
+
fs.writeFileSync(shimPath, windowsAdapterShim(adapter.name, adapter.foundBinary), 'ascii');
|
|
204
204
|
}
|
|
205
205
|
else {
|
|
206
|
-
fs.writeFileSync(shimPath, unixAdapterShim(adapter.name), 'utf8');
|
|
206
|
+
fs.writeFileSync(shimPath, unixAdapterShim(adapter.name, adapter.foundBinary), 'utf8');
|
|
207
207
|
fs.chmodSync(shimPath, 0o755);
|
|
208
208
|
}
|
|
209
209
|
console.log(`✓ ${shimPath}`);
|
|
@@ -213,11 +213,19 @@ function createAdapterShims(platform, adapters) {
|
|
|
213
213
|
function uniqueStrings(values) {
|
|
214
214
|
return [...new Set(values)];
|
|
215
215
|
}
|
|
216
|
-
function windowsAdapterShim(adapterName) {
|
|
217
|
-
|
|
216
|
+
function windowsAdapterShim(adapterName, adapterBinary) {
|
|
217
|
+
const adapterCommand = escapeWindowsCmdSetValue(adapterBinary ?? adapterName);
|
|
218
|
+
return `@echo off\r\nsetlocal\r\nset "AGENT_ORB_EXE=%~dp0agent_orb.exe"\r\nif not exist "%AGENT_ORB_EXE%" (\r\n for %%I in (agent_orb.exe) do set "AGENT_ORB_EXE=%%~$PATH:I"\r\n)\r\nif not exist "%AGENT_ORB_EXE%" (\r\n echo agent_orb runtime is missing: %~dp0agent_orb.exe 1>&2\r\n echo Run: npx --yes @solar_orb/agent_orb upgrade --yes 1>&2\r\n exit /b 1\r\n)\r\nset "ADAPTER_CMD=${adapterCommand}"\r\nset "ORB_UI=%~dp0agent-orb-ui.exe"\r\nif exist "%ORB_UI%" (\r\n tasklist /FI "IMAGENAME eq agent-orb-ui.exe" 2>NUL | find /I "agent-orb-ui.exe" >NUL\r\n if errorlevel 1 start "" "%ORB_UI%"\r\n)\r\n"%AGENT_ORB_EXE%" run -- "%ADAPTER_CMD%" %*\r\nexit /b %ERRORLEVEL%\r\n`;
|
|
218
219
|
}
|
|
219
|
-
function unixAdapterShim(adapterName) {
|
|
220
|
-
|
|
220
|
+
function unixAdapterShim(adapterName, adapterBinary) {
|
|
221
|
+
const adapterCommand = shellSingleQuote(adapterBinary ?? adapterName);
|
|
222
|
+
return `#!/usr/bin/env sh\nset -eu\nDIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)\nAGENT_ORB_EXE="$DIR/agent_orb"\nif [ ! -x "$AGENT_ORB_EXE" ]; then\n AGENT_ORB_EXE=$(command -v agent_orb || true)\nfi\nif [ -z "$AGENT_ORB_EXE" ] || [ ! -x "$AGENT_ORB_EXE" ]; then\n echo "agent_orb runtime is missing: $DIR/agent_orb" >&2\n echo "Run: npx --yes @solar_orb/agent_orb upgrade --yes" >&2\n exit 1\nfi\nADAPTER_CMD=${adapterCommand}\nORB_UI="$DIR/agent-orb-ui"\nif [ -x "$ORB_UI" ] && { [ -n "\${DISPLAY:-}" ] || [ -n "\${WAYLAND_DISPLAY:-}" ]; }; then\n running=0\n if command -v pgrep >/dev/null 2>&1 && pgrep -x agent-orb-ui >/dev/null 2>&1; then\n running=1\n fi\n if [ "$running" = "0" ]; then\n "$ORB_UI" >/dev/null 2>&1 &\n fi\nfi\nexec "$AGENT_ORB_EXE" run -- "$ADAPTER_CMD" "$@"\n`;
|
|
223
|
+
}
|
|
224
|
+
function escapeWindowsCmdSetValue(value) {
|
|
225
|
+
return value.replace(/[\^&|<>()%!\"]/g, (char) => `^${char}`);
|
|
226
|
+
}
|
|
227
|
+
function shellSingleQuote(value) {
|
|
228
|
+
return `'${value.replace(/'/g, `'"'"'`)}'`;
|
|
221
229
|
}
|
|
222
230
|
function ensurePathConfigured(platform) {
|
|
223
231
|
const currentPath = getPathEnv();
|
package/dist/shell.js
CHANGED
|
@@ -6,7 +6,8 @@ export function commandExists(command) {
|
|
|
6
6
|
}
|
|
7
7
|
export function findCommand(command) {
|
|
8
8
|
const pathEnv = getPathEnv();
|
|
9
|
-
const
|
|
9
|
+
const pathDirs = pathEnv.split(process.platform === 'win32' ? ';' : ':').filter(Boolean);
|
|
10
|
+
const searchDirs = uniquePaths([...pathDirs, ...extraCommandSearchDirs()]);
|
|
10
11
|
const candidates = process.platform === 'win32'
|
|
11
12
|
? commandCandidates(command)
|
|
12
13
|
: [command];
|
|
@@ -63,6 +64,43 @@ export function spawnDetached(command, args, cwd) {
|
|
|
63
64
|
child.unref();
|
|
64
65
|
return child.pid;
|
|
65
66
|
}
|
|
67
|
+
function uniquePaths(values) {
|
|
68
|
+
const seen = new Set();
|
|
69
|
+
const result = [];
|
|
70
|
+
for (const value of values) {
|
|
71
|
+
const normalized = process.platform === 'win32' ? value.trim().toLowerCase() : value.trim();
|
|
72
|
+
if (!normalized || seen.has(normalized))
|
|
73
|
+
continue;
|
|
74
|
+
seen.add(normalized);
|
|
75
|
+
result.push(value);
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
function extraCommandSearchDirs() {
|
|
80
|
+
if (process.platform !== 'win32')
|
|
81
|
+
return [];
|
|
82
|
+
const dirs = new Set();
|
|
83
|
+
const add = (value) => {
|
|
84
|
+
if (value?.trim())
|
|
85
|
+
dirs.add(value.trim());
|
|
86
|
+
};
|
|
87
|
+
add(process.env.NVM_SYMLINK);
|
|
88
|
+
add(process.env.NVM_HOME);
|
|
89
|
+
add(process.env.APPDATA ? path.join(process.env.APPDATA, 'npm') : undefined);
|
|
90
|
+
add(process.env.LOCALAPPDATA ? path.join(process.env.LOCALAPPDATA, 'Programs', 'nodejs') : undefined);
|
|
91
|
+
add(path.dirname(process.execPath));
|
|
92
|
+
add('C:\\nvm4w\\nodejs');
|
|
93
|
+
add('C:\\Program Files\\nodejs');
|
|
94
|
+
add('C:\\Program Files (x86)\\nodejs');
|
|
95
|
+
return [...dirs].filter((dir) => {
|
|
96
|
+
try {
|
|
97
|
+
return fs.statSync(dir).isDirectory();
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
66
104
|
function commandCandidates(command) {
|
|
67
105
|
if (path.extname(command))
|
|
68
106
|
return [command];
|