@aiden-ade/sandbox-agent 0.1.9 → 0.1.10
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 +61 -5
- package/package.json +11 -11
package/dist/index.cjs
CHANGED
|
@@ -11457,7 +11457,9 @@ async function setupDaemon(args) {
|
|
|
11457
11457
|
const displayName = argValue(args, "--name") ?? (0, import_node_os.hostname)();
|
|
11458
11458
|
const legacyLocalMachineId = argValue(args, "--legacy-local-machine-id") ?? process.env.AIDEN_LEGACY_LOCAL_MACHINE_ID;
|
|
11459
11459
|
if (!setupToken && (!teamId || !token)) {
|
|
11460
|
-
throw new Error(
|
|
11460
|
+
throw new Error(
|
|
11461
|
+
"setup requires the full command generated by Aiden: aiden-agent setup --api-url <api-url> --ws-url <ws-url> --setup-token <token>\nAlternatively, use browser authorization with: aiden-agent login --api-url <api-url> --ws-url <ws-url>"
|
|
11462
|
+
);
|
|
11461
11463
|
}
|
|
11462
11464
|
const response = await fetch(`${apiUrl}/public/runtimes${setupToken ? "/register-with-setup-token" : ""}`, {
|
|
11463
11465
|
method: "POST",
|
|
@@ -11708,9 +11710,20 @@ async function startDaemon(args) {
|
|
|
11708
11710
|
res.writeHead(404, { "content-type": "application/json" }).end(JSON.stringify({ error: "Not found" }));
|
|
11709
11711
|
});
|
|
11710
11712
|
await new Promise((resolve2, reject) => {
|
|
11711
|
-
|
|
11713
|
+
const onError = (error) => {
|
|
11714
|
+
clearInterval(heartbeat);
|
|
11715
|
+
socket.disconnect();
|
|
11716
|
+
if (error.code === "EADDRINUSE") {
|
|
11717
|
+
reject(new Error(
|
|
11718
|
+
`local daemon API port ${localApiPort} is already in use. Another aiden-agent daemon may already be running; use \`aiden-agent status\` or stop the existing daemon before starting a new one.`
|
|
11719
|
+
));
|
|
11720
|
+
return;
|
|
11721
|
+
}
|
|
11722
|
+
reject(error);
|
|
11723
|
+
};
|
|
11724
|
+
localServer.once("error", onError);
|
|
11712
11725
|
localServer.listen(localApiPort, "127.0.0.1", () => {
|
|
11713
|
-
localServer.off("error",
|
|
11726
|
+
localServer.off("error", onError);
|
|
11714
11727
|
const address = localServer.address();
|
|
11715
11728
|
if (address && typeof address === "object") localApiPort = address.port;
|
|
11716
11729
|
pushLog(`local_api listening port=${localApiPort}`);
|
|
@@ -11831,6 +11844,43 @@ async function printDoctor(args = []) {
|
|
|
11831
11844
|
}, null, 2));
|
|
11832
11845
|
}
|
|
11833
11846
|
|
|
11847
|
+
// src/cli-help.ts
|
|
11848
|
+
var HELP_TEXT = `Aiden agent CLI
|
|
11849
|
+
|
|
11850
|
+
Usage:
|
|
11851
|
+
aiden-agent <command> [options]
|
|
11852
|
+
|
|
11853
|
+
Commands:
|
|
11854
|
+
setup Register this computer with a setup token from Aiden
|
|
11855
|
+
login Register this computer through browser authorization
|
|
11856
|
+
daemon Start the durable runtime daemon
|
|
11857
|
+
status Show local runtime configuration without secrets
|
|
11858
|
+
doctor Check local CLI capabilities
|
|
11859
|
+
logout Remove local runtime configuration
|
|
11860
|
+
token Rotate or revoke the configured runtime token
|
|
11861
|
+
run-session Run a sandbox session from AIDEN_* environment variables
|
|
11862
|
+
|
|
11863
|
+
Common flows:
|
|
11864
|
+
aiden-agent setup --api-url <api-url> --ws-url <ws-url> --setup-token <token>
|
|
11865
|
+
aiden-agent login --api-url <api-url> --ws-url <ws-url>
|
|
11866
|
+
aiden-agent daemon
|
|
11867
|
+
`;
|
|
11868
|
+
function hasRunSessionEnv(env) {
|
|
11869
|
+
return Boolean(
|
|
11870
|
+
env.AIDEN_WS_URL && env.AIDEN_SESSION_ID && env.AIDEN_TASK_ID && env.AIDEN_SESSION_TOKEN && env.AIDEN_TASK !== void 0
|
|
11871
|
+
);
|
|
11872
|
+
}
|
|
11873
|
+
function resolveCommand(args, env) {
|
|
11874
|
+
const [command, ...commandArgs] = args;
|
|
11875
|
+
if (!command) {
|
|
11876
|
+
return { command: hasRunSessionEnv(env) ? "run-session" : "help", commandArgs: [] };
|
|
11877
|
+
}
|
|
11878
|
+
if (command === "help" || command === "--help" || command === "-h") {
|
|
11879
|
+
return { command: "help", commandArgs };
|
|
11880
|
+
}
|
|
11881
|
+
return { command, commandArgs };
|
|
11882
|
+
}
|
|
11883
|
+
|
|
11834
11884
|
// src/index.ts
|
|
11835
11885
|
async function runSessionFromEnv() {
|
|
11836
11886
|
const wsUrl = process.env.AIDEN_WS_URL;
|
|
@@ -11877,7 +11927,11 @@ async function main() {
|
|
|
11877
11927
|
`);
|
|
11878
11928
|
return;
|
|
11879
11929
|
}
|
|
11880
|
-
const
|
|
11930
|
+
const { command, commandArgs } = resolveCommand(process.argv.slice(2), process.env);
|
|
11931
|
+
if (command === "help") {
|
|
11932
|
+
process.stdout.write(HELP_TEXT);
|
|
11933
|
+
return;
|
|
11934
|
+
}
|
|
11881
11935
|
if (command === "setup") {
|
|
11882
11936
|
await setupDaemon(commandArgs);
|
|
11883
11937
|
return;
|
|
@@ -11914,7 +11968,9 @@ async function main() {
|
|
|
11914
11968
|
await runSessionFromEnv();
|
|
11915
11969
|
return;
|
|
11916
11970
|
}
|
|
11917
|
-
throw new Error(`Unknown command: ${command}
|
|
11971
|
+
throw new Error(`Unknown command: ${command}
|
|
11972
|
+
|
|
11973
|
+
${HELP_TEXT}`);
|
|
11918
11974
|
}
|
|
11919
11975
|
main().catch((error) => {
|
|
11920
11976
|
console.error("[aiden-agent] Fatal error:", error instanceof Error ? error.message : error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiden-ade/sandbox-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"aiden-agent": "./dist/index.cjs"
|
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsup",
|
|
16
|
+
"dev": "tsx src/index.ts",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"type-check": "tsc --noEmit"
|
|
19
|
+
},
|
|
14
20
|
"dependencies": {},
|
|
15
21
|
"devDependencies": {
|
|
22
|
+
"@aiden/agent-core": "workspace:*",
|
|
23
|
+
"@aiden/shared": "workspace:*",
|
|
16
24
|
"socket.io-client": "^4.8.0",
|
|
17
25
|
"socket.io": "^4.8.0",
|
|
18
26
|
"@types/node": "^22.0.0",
|
|
19
27
|
"tsup": "^8.5.1",
|
|
20
28
|
"tsx": "^4.19.0",
|
|
21
|
-
"typescript": "~5.9.3"
|
|
22
|
-
"@aiden/shared": "0.1.0",
|
|
23
|
-
"@aiden/agent-core": "0.1.0"
|
|
24
|
-
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "tsup",
|
|
27
|
-
"dev": "tsx src/index.ts",
|
|
28
|
-
"test": "vitest run",
|
|
29
|
-
"type-check": "tsc --noEmit"
|
|
29
|
+
"typescript": "~5.9.3"
|
|
30
30
|
}
|
|
31
|
-
}
|
|
31
|
+
}
|