@aiden-ade/sandbox-agent 0.1.11 → 0.1.13
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/dist/index.cjs +278 -45
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5304,17 +5304,39 @@ function buildPlanModePrefix(promptText) {
|
|
|
5304
5304
|
promptText
|
|
5305
5305
|
].join("\n");
|
|
5306
5306
|
}
|
|
5307
|
-
function
|
|
5307
|
+
function planCliSpawn(command, args, env = process.env) {
|
|
5308
5308
|
const isWindows = process.platform === "win32";
|
|
5309
|
-
|
|
5309
|
+
const comSpec = env.ComSpec ?? process.env.ComSpec ?? "cmd.exe";
|
|
5310
|
+
if (isWindows && /\.(cmd|bat)$/i.test(command)) {
|
|
5311
|
+
return {
|
|
5312
|
+
file: comSpec,
|
|
5313
|
+
args: ["/d", "/s", "/c", command, ...args],
|
|
5314
|
+
shell: false,
|
|
5315
|
+
windowsHide: true
|
|
5316
|
+
};
|
|
5317
|
+
}
|
|
5318
|
+
if (isWindows && /[\\/]/.test(command) && /\.exe$/i.test(command)) {
|
|
5319
|
+
return { file: command, args, shell: false, windowsHide: true };
|
|
5320
|
+
}
|
|
5321
|
+
return {
|
|
5322
|
+
file: command,
|
|
5323
|
+
args,
|
|
5324
|
+
shell: isWindows,
|
|
5325
|
+
windowsHide: isWindows ? true : void 0
|
|
5326
|
+
};
|
|
5327
|
+
}
|
|
5328
|
+
function spawnCli(command, args, context) {
|
|
5329
|
+
const plan = planCliSpawn(command, args, context.env);
|
|
5330
|
+
return (0, import_child_process.spawn)(plan.file, plan.args, {
|
|
5310
5331
|
cwd: context.cwd,
|
|
5311
5332
|
env: context.env,
|
|
5312
5333
|
stdio: ["pipe", "pipe", "pipe"],
|
|
5313
|
-
shell:
|
|
5334
|
+
shell: plan.shell,
|
|
5335
|
+
windowsHide: plan.windowsHide,
|
|
5314
5336
|
// Detached on Unix creates a new process group so we can kill the entire tree
|
|
5315
5337
|
// (CLI tools spawn child processes for tool execution that would otherwise be orphaned).
|
|
5316
5338
|
// On Windows, detached opens a new console — shell mode handles grouping instead.
|
|
5317
|
-
detached:
|
|
5339
|
+
detached: process.platform !== "win32"
|
|
5318
5340
|
});
|
|
5319
5341
|
}
|
|
5320
5342
|
function createGenericCliBackend(options) {
|
|
@@ -7181,6 +7203,198 @@ Prefer relative paths and keep your work scoped to this project.`
|
|
|
7181
7203
|
}
|
|
7182
7204
|
};
|
|
7183
7205
|
|
|
7206
|
+
// src/core-agent.ts
|
|
7207
|
+
var import_node_os2 = require("os");
|
|
7208
|
+
|
|
7209
|
+
// src/cli-executable.ts
|
|
7210
|
+
var import_node_fs = require("fs");
|
|
7211
|
+
var import_node_child_process = require("child_process");
|
|
7212
|
+
var import_node_os = require("os");
|
|
7213
|
+
var import_node_path = require("path");
|
|
7214
|
+
var PROVIDER_CLI_COMMANDS = {
|
|
7215
|
+
claude_cli: { provider: "claude_cli", command: "claude", envVar: "AIDEN_CLAUDE_PATH" },
|
|
7216
|
+
codex: { provider: "codex", command: "codex", envVar: "AIDEN_CODEX_PATH" },
|
|
7217
|
+
gemini: { provider: "gemini", command: "gemini", envVar: "AIDEN_GEMINI_PATH" }
|
|
7218
|
+
};
|
|
7219
|
+
var BACKEND_CLI_COMMANDS = {
|
|
7220
|
+
claude_cli: "claude",
|
|
7221
|
+
codex: "codex",
|
|
7222
|
+
codex_app_server: "codex",
|
|
7223
|
+
gemini_cli: "gemini",
|
|
7224
|
+
gemini: "gemini"
|
|
7225
|
+
};
|
|
7226
|
+
var resolvedCliCache = /* @__PURE__ */ new Map();
|
|
7227
|
+
function getDaemonCliEnvironment() {
|
|
7228
|
+
return augmentCliPath(process.env);
|
|
7229
|
+
}
|
|
7230
|
+
function cacheResolvedCli(command, resolvedPath) {
|
|
7231
|
+
resolvedCliCache.set(command, resolvedPath);
|
|
7232
|
+
}
|
|
7233
|
+
function getCachedResolvedCli(command) {
|
|
7234
|
+
return resolvedCliCache.get(command);
|
|
7235
|
+
}
|
|
7236
|
+
function resolveViaWhere(command, env) {
|
|
7237
|
+
if ((0, import_node_os.platform)() !== "win32") return null;
|
|
7238
|
+
const whereExe = (0, import_node_path.join)(env.SystemRoot ?? process.env.SystemRoot ?? "C:\\Windows", "System32", "where.exe");
|
|
7239
|
+
if (!(0, import_node_fs.existsSync)(whereExe)) return null;
|
|
7240
|
+
const result = (0, import_node_child_process.spawnSync)(whereExe, [command], {
|
|
7241
|
+
encoding: "utf8",
|
|
7242
|
+
env,
|
|
7243
|
+
windowsHide: true,
|
|
7244
|
+
timeout: 3e3
|
|
7245
|
+
});
|
|
7246
|
+
if (result.error || result.status !== 0) return null;
|
|
7247
|
+
for (const line of result.stdout.split(/\r?\n/)) {
|
|
7248
|
+
const trimmed = line.trim();
|
|
7249
|
+
if (!trimmed) continue;
|
|
7250
|
+
if (isRunnableFile(trimmed)) return trimmed;
|
|
7251
|
+
}
|
|
7252
|
+
return null;
|
|
7253
|
+
}
|
|
7254
|
+
function runCliVersionProbe(executable, env, args = ["--version"]) {
|
|
7255
|
+
const isWin = (0, import_node_os.platform)() === "win32";
|
|
7256
|
+
if (isWin && /\.(cmd|bat)$/i.test(executable)) {
|
|
7257
|
+
const comSpec = env.ComSpec ?? process.env.ComSpec ?? "cmd.exe";
|
|
7258
|
+
return (0, import_node_child_process.spawnSync)(comSpec, ["/d", "/s", "/c", executable, ...args], {
|
|
7259
|
+
encoding: "utf8",
|
|
7260
|
+
timeout: 3e3,
|
|
7261
|
+
env,
|
|
7262
|
+
windowsHide: true
|
|
7263
|
+
});
|
|
7264
|
+
}
|
|
7265
|
+
const useShell = isWin && !/[\\/]/.test(executable);
|
|
7266
|
+
return (0, import_node_child_process.spawnSync)(executable, args, {
|
|
7267
|
+
encoding: "utf8",
|
|
7268
|
+
timeout: 3e3,
|
|
7269
|
+
env,
|
|
7270
|
+
shell: useShell,
|
|
7271
|
+
windowsHide: isWin ? true : void 0
|
|
7272
|
+
});
|
|
7273
|
+
}
|
|
7274
|
+
function pathSeparator() {
|
|
7275
|
+
return (0, import_node_os.platform)() === "win32" ? ";" : ":";
|
|
7276
|
+
}
|
|
7277
|
+
function splitPath(pathValue) {
|
|
7278
|
+
if (!pathValue) return [];
|
|
7279
|
+
return pathValue.split(pathSeparator()).filter(Boolean);
|
|
7280
|
+
}
|
|
7281
|
+
function isRunnableFile(path) {
|
|
7282
|
+
if (!(0, import_node_fs.existsSync)(path)) return false;
|
|
7283
|
+
if ((0, import_node_os.platform)() === "win32") return true;
|
|
7284
|
+
try {
|
|
7285
|
+
(0, import_node_fs.accessSync)(path, import_node_fs.constants.X_OK);
|
|
7286
|
+
return true;
|
|
7287
|
+
} catch {
|
|
7288
|
+
return false;
|
|
7289
|
+
}
|
|
7290
|
+
}
|
|
7291
|
+
function windowsCommandCandidates(command, pathExt) {
|
|
7292
|
+
const trimmed = command.trim();
|
|
7293
|
+
if (!trimmed) return [];
|
|
7294
|
+
const hasExtension = /\.[a-z0-9]+$/i.test(trimmed);
|
|
7295
|
+
if (hasExtension) return [trimmed];
|
|
7296
|
+
const extensions = pathExt.split(";").map((ext) => ext.trim()).filter(Boolean);
|
|
7297
|
+
return [trimmed, ...extensions.map((ext) => `${trimmed}${ext}`)];
|
|
7298
|
+
}
|
|
7299
|
+
function augmentCliPath(env) {
|
|
7300
|
+
const home = env.HOME || env.USERPROFILE || (0, import_node_os.homedir)();
|
|
7301
|
+
const isWin = (0, import_node_os.platform)() === "win32";
|
|
7302
|
+
const extraPaths = isWin ? [
|
|
7303
|
+
(0, import_node_path.join)(home, "AppData", "Roaming", "npm"),
|
|
7304
|
+
(0, import_node_path.join)(home, "AppData", "Local", "Programs", "Microsoft", "WindowsApps"),
|
|
7305
|
+
(0, import_node_path.join)(home, ".local", "bin"),
|
|
7306
|
+
"C:\\Program Files\\nodejs",
|
|
7307
|
+
"C:\\Program Files\\Git\\cmd"
|
|
7308
|
+
] : [
|
|
7309
|
+
(0, import_node_path.join)(home, ".local", "bin"),
|
|
7310
|
+
(0, import_node_path.join)(home, ".local", "node", "bin"),
|
|
7311
|
+
(0, import_node_path.join)(home, ".bun", "bin"),
|
|
7312
|
+
(0, import_node_path.join)(home, ".cargo", "bin"),
|
|
7313
|
+
"/opt/homebrew/bin",
|
|
7314
|
+
"/usr/local/bin"
|
|
7315
|
+
];
|
|
7316
|
+
const basePath = env.PATH ?? "";
|
|
7317
|
+
const existing = new Set(splitPath(basePath));
|
|
7318
|
+
const missing = extraPaths.filter((dir) => !existing.has(dir));
|
|
7319
|
+
if (missing.length === 0) return env;
|
|
7320
|
+
return {
|
|
7321
|
+
...env,
|
|
7322
|
+
PATH: missing.length > 0 ? `${missing.join(pathSeparator())}${pathSeparator()}${basePath}` : basePath
|
|
7323
|
+
};
|
|
7324
|
+
}
|
|
7325
|
+
function resolveCliExecutable(command, env = getDaemonCliEnvironment()) {
|
|
7326
|
+
const trimmed = command.trim();
|
|
7327
|
+
if (!trimmed) return null;
|
|
7328
|
+
const cached = resolvedCliCache.get(trimmed);
|
|
7329
|
+
if (cached && isRunnableFile(cached)) return cached;
|
|
7330
|
+
if ((trimmed.includes("/") || trimmed.includes("\\")) && isRunnableFile(trimmed)) {
|
|
7331
|
+
resolvedCliCache.set(trimmed, trimmed);
|
|
7332
|
+
return trimmed;
|
|
7333
|
+
}
|
|
7334
|
+
const enriched = augmentCliPath(env);
|
|
7335
|
+
const home = enriched.HOME || enriched.USERPROFILE || (0, import_node_os.homedir)();
|
|
7336
|
+
const isWin = (0, import_node_os.platform)() === "win32";
|
|
7337
|
+
const pathExt = enriched.PATHEXT ?? (isWin ? ".EXE;.CMD;.BAT;.COM" : "");
|
|
7338
|
+
const names = isWin ? windowsCommandCandidates(trimmed, pathExt) : [trimmed];
|
|
7339
|
+
const candidates = [];
|
|
7340
|
+
for (const name of names) {
|
|
7341
|
+
if (name.includes("/") || name.includes("\\")) {
|
|
7342
|
+
candidates.push(name);
|
|
7343
|
+
continue;
|
|
7344
|
+
}
|
|
7345
|
+
for (const dir of splitPath(enriched.PATH)) {
|
|
7346
|
+
candidates.push((0, import_node_path.join)(dir, name));
|
|
7347
|
+
}
|
|
7348
|
+
candidates.push(
|
|
7349
|
+
(0, import_node_path.join)(home, ".local", "bin", name),
|
|
7350
|
+
(0, import_node_path.join)(home, ".local", "node", "bin", name)
|
|
7351
|
+
);
|
|
7352
|
+
if (!isWin) {
|
|
7353
|
+
candidates.push((0, import_node_path.join)("/opt/homebrew/bin", name), (0, import_node_path.join)("/usr/local/bin", name));
|
|
7354
|
+
} else {
|
|
7355
|
+
candidates.push((0, import_node_path.join)(home, "AppData", "Roaming", "npm", name));
|
|
7356
|
+
}
|
|
7357
|
+
}
|
|
7358
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7359
|
+
for (const candidate of candidates) {
|
|
7360
|
+
if (seen.has(candidate)) continue;
|
|
7361
|
+
seen.add(candidate);
|
|
7362
|
+
if (isRunnableFile(candidate)) {
|
|
7363
|
+
resolvedCliCache.set(trimmed, candidate);
|
|
7364
|
+
return candidate;
|
|
7365
|
+
}
|
|
7366
|
+
}
|
|
7367
|
+
const viaWhere = resolveViaWhere(trimmed, enriched);
|
|
7368
|
+
if (viaWhere) {
|
|
7369
|
+
resolvedCliCache.set(trimmed, viaWhere);
|
|
7370
|
+
return viaWhere;
|
|
7371
|
+
}
|
|
7372
|
+
return null;
|
|
7373
|
+
}
|
|
7374
|
+
function resolveProviderCliCommand(provider, env = getDaemonCliEnvironment()) {
|
|
7375
|
+
const spec = PROVIDER_CLI_COMMANDS[provider];
|
|
7376
|
+
const override = process.env[spec.envVar]?.trim();
|
|
7377
|
+
if (override) {
|
|
7378
|
+
const resolved2 = resolveCliExecutable(override, env) ?? (isRunnableFile(override) ? override : null);
|
|
7379
|
+
if (resolved2) cacheResolvedCli(spec.command, resolved2);
|
|
7380
|
+
return resolved2;
|
|
7381
|
+
}
|
|
7382
|
+
const resolved = resolveCliExecutable(spec.command, env);
|
|
7383
|
+
if (resolved) cacheResolvedCli(spec.command, resolved);
|
|
7384
|
+
return resolved;
|
|
7385
|
+
}
|
|
7386
|
+
function resolveBackendRuntimeCommand(backendKind, env = getDaemonCliEnvironment()) {
|
|
7387
|
+
if (!backendKind) return void 0;
|
|
7388
|
+
const command = BACKEND_CLI_COMMANDS[backendKind];
|
|
7389
|
+
if (!command) return void 0;
|
|
7390
|
+
const cached = getCachedResolvedCli(command);
|
|
7391
|
+
if (cached && isRunnableFile(cached)) return cached;
|
|
7392
|
+
const envOverride = command === "codex" ? env.AIDEN_CODEX_PATH : command === "claude" ? env.AIDEN_CLAUDE_PATH : command === "gemini" ? env.AIDEN_GEMINI_PATH : void 0;
|
|
7393
|
+
const resolved = resolveCliExecutable(envOverride?.trim() || command, env);
|
|
7394
|
+
if (resolved) cacheResolvedCli(command, resolved);
|
|
7395
|
+
return resolved ?? void 0;
|
|
7396
|
+
}
|
|
7397
|
+
|
|
7184
7398
|
// src/core-agent.ts
|
|
7185
7399
|
var CoreAgent = class _CoreAgent extends BaseMachineAgent {
|
|
7186
7400
|
childProcess = null;
|
|
@@ -7308,18 +7522,23 @@ var CoreAgent = class _CoreAgent extends BaseMachineAgent {
|
|
|
7308
7522
|
};
|
|
7309
7523
|
}
|
|
7310
7524
|
async buildCliEnvironment() {
|
|
7311
|
-
const loginEnv = process.env;
|
|
7312
7525
|
const env = {};
|
|
7313
|
-
for (const [key, value2] of Object.entries(
|
|
7526
|
+
for (const [key, value2] of Object.entries(process.env)) {
|
|
7314
7527
|
if (value2 !== void 0) env[key] = value2;
|
|
7315
7528
|
}
|
|
7316
|
-
const
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7529
|
+
const augmented = getDaemonCliEnvironment();
|
|
7530
|
+
if ((0, import_node_os2.platform)() !== "win32") {
|
|
7531
|
+
const home = augmented.HOME ?? "/home/user";
|
|
7532
|
+
const extraPaths = [`${home}/.local/node/bin`, `${home}/.local/bin`];
|
|
7533
|
+
const separator = ":";
|
|
7534
|
+
const basePath = augmented.PATH ?? "";
|
|
7535
|
+
const existingSegments = new Set(basePath.split(separator).filter(Boolean));
|
|
7536
|
+
const missing = extraPaths.filter((p) => !existingSegments.has(p));
|
|
7537
|
+
if (missing.length > 0) {
|
|
7538
|
+
augmented.PATH = `${missing.join(separator)}${separator}${basePath}`;
|
|
7539
|
+
}
|
|
7540
|
+
}
|
|
7541
|
+
return augmented;
|
|
7323
7542
|
}
|
|
7324
7543
|
buildExtraSystemPromptParts(config) {
|
|
7325
7544
|
const parts2 = [];
|
|
@@ -11142,7 +11361,7 @@ var WSClient = class {
|
|
|
11142
11361
|
};
|
|
11143
11362
|
|
|
11144
11363
|
// src/version.ts
|
|
11145
|
-
var AGENT_VERSION = "0.1.
|
|
11364
|
+
var AGENT_VERSION = "0.1.13";
|
|
11146
11365
|
|
|
11147
11366
|
// src/sandbox.ts
|
|
11148
11367
|
async function runSandbox(config) {
|
|
@@ -11318,44 +11537,43 @@ async function runSandbox(config) {
|
|
|
11318
11537
|
}
|
|
11319
11538
|
|
|
11320
11539
|
// src/daemon.ts
|
|
11321
|
-
var
|
|
11540
|
+
var import_node_fs2 = require("fs");
|
|
11322
11541
|
var import_node_http = __toESM(require("http"), 1);
|
|
11323
11542
|
var import_node_crypto = require("crypto");
|
|
11324
|
-
var
|
|
11325
|
-
var
|
|
11326
|
-
var import_node_child_process = require("child_process");
|
|
11543
|
+
var import_node_os3 = require("os");
|
|
11544
|
+
var import_node_path2 = require("path");
|
|
11327
11545
|
var PRODUCTION_API_URL = "https://api.aiden-platform.com";
|
|
11328
11546
|
var PRODUCTION_WS_URL = "wss://ws.aiden-platform.com";
|
|
11329
11547
|
var LOCAL_API_URL = "http://localhost:8400";
|
|
11330
11548
|
var LOCAL_WS_URL = "ws://localhost:8401";
|
|
11331
11549
|
function getConfigPath() {
|
|
11332
|
-
return process.env.AIDEN_AGENT_CONFIG_PATH ?? (0,
|
|
11550
|
+
return process.env.AIDEN_AGENT_CONFIG_PATH ?? (0, import_node_path2.join)((0, import_node_os3.homedir)(), ".aiden", "agent", "config.json");
|
|
11333
11551
|
}
|
|
11334
11552
|
function getEndpointDefaultsPath() {
|
|
11335
|
-
return process.env.AIDEN_AGENT_ENDPOINTS_PATH ?? (0,
|
|
11553
|
+
return process.env.AIDEN_AGENT_ENDPOINTS_PATH ?? (0, import_node_path2.join)((0, import_node_path2.dirname)(getConfigPath()), "endpoints.json");
|
|
11336
11554
|
}
|
|
11337
11555
|
function readConfig() {
|
|
11338
11556
|
const configPath = getConfigPath();
|
|
11339
|
-
if (!(0,
|
|
11340
|
-
return JSON.parse((0,
|
|
11557
|
+
if (!(0, import_node_fs2.existsSync)(configPath)) return {};
|
|
11558
|
+
return JSON.parse((0, import_node_fs2.readFileSync)(configPath, "utf8"));
|
|
11341
11559
|
}
|
|
11342
11560
|
function readEndpointDefaults() {
|
|
11343
11561
|
const endpointsPath = getEndpointDefaultsPath();
|
|
11344
|
-
if (!(0,
|
|
11562
|
+
if (!(0, import_node_fs2.existsSync)(endpointsPath)) return {};
|
|
11345
11563
|
try {
|
|
11346
|
-
return JSON.parse((0,
|
|
11564
|
+
return JSON.parse((0, import_node_fs2.readFileSync)(endpointsPath, "utf8"));
|
|
11347
11565
|
} catch {
|
|
11348
11566
|
return {};
|
|
11349
11567
|
}
|
|
11350
11568
|
}
|
|
11351
11569
|
function writeConfig(config) {
|
|
11352
11570
|
const configPath = getConfigPath();
|
|
11353
|
-
(0,
|
|
11354
|
-
(0,
|
|
11571
|
+
(0, import_node_fs2.mkdirSync)((0, import_node_path2.dirname)(configPath), { recursive: true, mode: 448 });
|
|
11572
|
+
(0, import_node_fs2.writeFileSync)(configPath, JSON.stringify(config, null, 2), { mode: 384 });
|
|
11355
11573
|
}
|
|
11356
11574
|
function removeConfig() {
|
|
11357
11575
|
const configPath = getConfigPath();
|
|
11358
|
-
if ((0,
|
|
11576
|
+
if ((0, import_node_fs2.existsSync)(configPath)) (0, import_node_fs2.rmSync)(configPath, { force: true });
|
|
11359
11577
|
}
|
|
11360
11578
|
function argValue(args, name) {
|
|
11361
11579
|
const index = args.indexOf(name);
|
|
@@ -11392,20 +11610,24 @@ function sleep(ms) {
|
|
|
11392
11610
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
11393
11611
|
}
|
|
11394
11612
|
function commandVersion(command, args = ["--version"]) {
|
|
11395
|
-
const
|
|
11613
|
+
const env = getDaemonCliEnvironment();
|
|
11614
|
+
const executable = command === "claude" ? resolveProviderCliCommand("claude_cli", env) : command === "codex" ? resolveProviderCliCommand("codex", env) : command === "gemini" ? resolveProviderCliCommand("gemini", env) : resolveCliExecutable(command, env);
|
|
11615
|
+
if (!executable) return void 0;
|
|
11616
|
+
const result = runCliVersionProbe(executable, env, args);
|
|
11396
11617
|
if (result.error || result.status !== 0) return void 0;
|
|
11397
11618
|
return (result.stdout || result.stderr).split("\n")[0]?.trim() || void 0;
|
|
11398
11619
|
}
|
|
11620
|
+
function normalizeBackendKind(backendKind) {
|
|
11621
|
+
if (backendKind === "codex") return "codex_app_server";
|
|
11622
|
+
return backendKind;
|
|
11623
|
+
}
|
|
11399
11624
|
function discoverCapabilities() {
|
|
11400
11625
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
11401
|
-
const providers = [
|
|
11402
|
-
{ provider: "claude_cli", command: process.env.AIDEN_CLAUDE_PATH ?? "claude" },
|
|
11403
|
-
{ provider: "codex", command: process.env.AIDEN_CODEX_PATH ?? "codex" },
|
|
11404
|
-
{ provider: "gemini", command: process.env.AIDEN_GEMINI_PATH ?? "gemini" }
|
|
11405
|
-
];
|
|
11626
|
+
const providers = ["claude_cli", "codex", "gemini"];
|
|
11406
11627
|
return {
|
|
11407
|
-
agents: providers.map((
|
|
11408
|
-
const
|
|
11628
|
+
agents: providers.map((provider) => {
|
|
11629
|
+
const executable = resolveProviderCliCommand(provider);
|
|
11630
|
+
const version = executable ? commandVersion(executable) : void 0;
|
|
11409
11631
|
return {
|
|
11410
11632
|
provider,
|
|
11411
11633
|
available: Boolean(version),
|
|
@@ -11494,7 +11716,7 @@ async function setupDaemon(args) {
|
|
|
11494
11716
|
const teamId = argValue(args, "--team") ?? process.env.AIDEN_TEAM_ID;
|
|
11495
11717
|
const setupToken = argValue(args, "--setup-token") ?? process.env.AIDEN_RUNTIME_SETUP_TOKEN;
|
|
11496
11718
|
const token = argValue(args, "--token") ?? process.env.AIDEN_SETUP_TOKEN;
|
|
11497
|
-
const displayName = argValue(args, "--name") ?? (0,
|
|
11719
|
+
const displayName = argValue(args, "--name") ?? (0, import_node_os3.hostname)();
|
|
11498
11720
|
const legacyLocalMachineId = argValue(args, "--legacy-local-machine-id") ?? process.env.AIDEN_LEGACY_LOCAL_MACHINE_ID;
|
|
11499
11721
|
const scope = argValue(args, "--scope") ?? process.env.AIDEN_RUNTIME_SCOPE ?? "team";
|
|
11500
11722
|
if (scope !== "team" && scope !== "user") {
|
|
@@ -11515,7 +11737,7 @@ async function setupDaemon(args) {
|
|
|
11515
11737
|
...teamId ? { teamId } : {},
|
|
11516
11738
|
...setupToken ? { setupToken } : {},
|
|
11517
11739
|
displayName,
|
|
11518
|
-
hostname: (0,
|
|
11740
|
+
hostname: (0, import_node_os3.hostname)(),
|
|
11519
11741
|
...legacyLocalMachineId ? { legacyLocalMachineId } : {},
|
|
11520
11742
|
runtimeKind: "machine",
|
|
11521
11743
|
managementKind: "user_managed",
|
|
@@ -11525,8 +11747,8 @@ async function setupDaemon(args) {
|
|
|
11525
11747
|
visibility: scope,
|
|
11526
11748
|
capabilities: discoverCapabilities(),
|
|
11527
11749
|
metadata: {
|
|
11528
|
-
platform: (0,
|
|
11529
|
-
arch: (0,
|
|
11750
|
+
platform: (0, import_node_os3.platform)(),
|
|
11751
|
+
arch: (0, import_node_os3.arch)(),
|
|
11530
11752
|
agentVersion: AGENT_VERSION
|
|
11531
11753
|
}
|
|
11532
11754
|
})
|
|
@@ -11550,18 +11772,18 @@ async function setupDaemon(args) {
|
|
|
11550
11772
|
}
|
|
11551
11773
|
async function loginWithDeviceCode(args) {
|
|
11552
11774
|
const { apiUrl, wsUrl, endpointProfile } = resolveEndpoints(args);
|
|
11553
|
-
const displayName = argValue(args, "--name") ?? (0,
|
|
11775
|
+
const displayName = argValue(args, "--name") ?? (0, import_node_os3.hostname)();
|
|
11554
11776
|
const maxPolls = Number.parseInt(argValue(args, "--max-polls") ?? "300", 10);
|
|
11555
11777
|
const start = await fetch(`${apiUrl}/public/runtimes/device-authorizations`, {
|
|
11556
11778
|
method: "POST",
|
|
11557
11779
|
headers: { "content-type": "application/json" },
|
|
11558
11780
|
body: JSON.stringify({
|
|
11559
11781
|
displayName,
|
|
11560
|
-
hostname: (0,
|
|
11782
|
+
hostname: (0, import_node_os3.hostname)(),
|
|
11561
11783
|
capabilities: discoverCapabilities(),
|
|
11562
11784
|
metadata: {
|
|
11563
|
-
platform: (0,
|
|
11564
|
-
arch: (0,
|
|
11785
|
+
platform: (0, import_node_os3.platform)(),
|
|
11786
|
+
arch: (0, import_node_os3.arch)(),
|
|
11565
11787
|
agentVersion: AGENT_VERSION
|
|
11566
11788
|
}
|
|
11567
11789
|
})
|
|
@@ -11657,11 +11879,21 @@ async function startDaemon(args) {
|
|
|
11657
11879
|
socket.emit("agent.rejected", { runId: payload.runId, message: "Run is already active" });
|
|
11658
11880
|
return;
|
|
11659
11881
|
}
|
|
11882
|
+
const backendKind = normalizeBackendKind(payload.backendKind);
|
|
11883
|
+
const runtimeCommand = resolveBackendRuntimeCommand(backendKind ?? payload.backendKind);
|
|
11884
|
+
if (!runtimeCommand && backendKind) {
|
|
11885
|
+
socket.emit("agent.rejected", {
|
|
11886
|
+
runId: payload.runId,
|
|
11887
|
+
message: `CLI command not found for ${backendKind}. Install the provider CLI and restart the daemon.`
|
|
11888
|
+
});
|
|
11889
|
+
return;
|
|
11890
|
+
}
|
|
11660
11891
|
socket.emit("agent.accepted", { runId: payload.runId });
|
|
11661
11892
|
pushLog(`accepted run=${payload.runId}`);
|
|
11662
11893
|
const presenter = new RuntimePresenter(socket, payload.conversationId, payload.runId);
|
|
11663
11894
|
const agent = new CoreAgent(presenter, {
|
|
11664
|
-
backendKind
|
|
11895
|
+
backendKind,
|
|
11896
|
+
runtimeCommand
|
|
11665
11897
|
});
|
|
11666
11898
|
activeAgents.set(payload.runId, agent);
|
|
11667
11899
|
const cwd = payload.projectPath ?? process.cwd();
|
|
@@ -11670,7 +11902,8 @@ async function startDaemon(args) {
|
|
|
11670
11902
|
maxIterations: payload.maxIterations ?? 50,
|
|
11671
11903
|
teamPath: cwd,
|
|
11672
11904
|
cwd,
|
|
11673
|
-
backendKind
|
|
11905
|
+
backendKind,
|
|
11906
|
+
runtimeCommand,
|
|
11674
11907
|
agentId: payload.agentId,
|
|
11675
11908
|
agentPrompt: payload.agentPrompt,
|
|
11676
11909
|
mode: payload.mode ?? "agent",
|