@aiden-ade/sandbox-agent 0.1.36 → 0.1.37
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 +27 -10
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -13534,6 +13534,14 @@ var AGENT_CONFIG_KEYS = /* @__PURE__ */ new Map([
|
|
|
13534
13534
|
["localApiToken", "string"],
|
|
13535
13535
|
["displayName", "string"]
|
|
13536
13536
|
]);
|
|
13537
|
+
function sanitizeAgentConfig(config) {
|
|
13538
|
+
const sanitized = { ...config };
|
|
13539
|
+
delete sanitized.teamId;
|
|
13540
|
+
delete sanitized.organizationId;
|
|
13541
|
+
delete sanitized.currentTeamId;
|
|
13542
|
+
delete sanitized.currentOrganizationId;
|
|
13543
|
+
return sanitized;
|
|
13544
|
+
}
|
|
13537
13545
|
function isValidAgentConfig(configPath) {
|
|
13538
13546
|
try {
|
|
13539
13547
|
const stat = (0, import_node_fs4.lstatSync)(configPath);
|
|
@@ -13571,6 +13579,10 @@ function migrateLegacyAgentConfig(input) {
|
|
|
13571
13579
|
if (!alanDirectoryExisted) (0, import_node_fs4.chmodSync)(alanBaseDir, sourceDirectoryStat.mode & 511);
|
|
13572
13580
|
(0, import_node_fs4.copyFileSync)(legacyPath, alanPath, import_node_fs4.constants.COPYFILE_EXCL);
|
|
13573
13581
|
copied = true;
|
|
13582
|
+
const migrated = sanitizeAgentConfig(
|
|
13583
|
+
JSON.parse((0, import_node_fs4.readFileSync)(alanPath, "utf8"))
|
|
13584
|
+
);
|
|
13585
|
+
(0, import_node_fs4.writeFileSync)(alanPath, JSON.stringify(migrated, null, 2));
|
|
13574
13586
|
(0, import_node_fs4.chmodSync)(alanPath, sourceFileStat.mode & 511);
|
|
13575
13587
|
(0, import_node_fs4.utimesSync)(alanPath, sourceFileStat.atime, sourceFileStat.mtime);
|
|
13576
13588
|
if (!isValidAgentConfig(alanPath)) {
|
|
@@ -21812,7 +21824,7 @@ var RunStartGate = class {
|
|
|
21812
21824
|
};
|
|
21813
21825
|
|
|
21814
21826
|
// src/version.ts
|
|
21815
|
-
var AGENT_VERSION = "0.1.
|
|
21827
|
+
var AGENT_VERSION = "0.1.37";
|
|
21816
21828
|
|
|
21817
21829
|
// src/workspace-relocation.ts
|
|
21818
21830
|
var import_node_child_process3 = require("child_process");
|
|
@@ -22456,7 +22468,12 @@ function getEndpointDefaultsPath() {
|
|
|
22456
22468
|
function readConfig() {
|
|
22457
22469
|
const configPath = getConfigPath();
|
|
22458
22470
|
if (!(0, import_node_fs12.existsSync)(configPath)) return {};
|
|
22459
|
-
|
|
22471
|
+
const parsed = JSON.parse((0, import_node_fs12.readFileSync)(configPath, "utf8"));
|
|
22472
|
+
const sanitized = sanitizeAgentConfig(parsed);
|
|
22473
|
+
if (Object.keys(parsed).some((key) => !Object.hasOwn(sanitized, key))) {
|
|
22474
|
+
writeConfig(sanitized);
|
|
22475
|
+
}
|
|
22476
|
+
return sanitized;
|
|
22460
22477
|
}
|
|
22461
22478
|
function readConfigForRegistration() {
|
|
22462
22479
|
try {
|
|
@@ -22479,7 +22496,11 @@ function writeConfig(config) {
|
|
|
22479
22496
|
(0, import_node_fs12.mkdirSync)((0, import_node_path10.dirname)(configPath), { recursive: true, mode: 448 });
|
|
22480
22497
|
const pendingPath = `${configPath}.pending-${process.pid}-${(0, import_node_crypto3.randomBytes)(6).toString("hex")}`;
|
|
22481
22498
|
try {
|
|
22482
|
-
(0, import_node_fs12.writeFileSync)(
|
|
22499
|
+
(0, import_node_fs12.writeFileSync)(
|
|
22500
|
+
pendingPath,
|
|
22501
|
+
JSON.stringify(sanitizeAgentConfig(config), null, 2),
|
|
22502
|
+
{ mode: 384 }
|
|
22503
|
+
);
|
|
22483
22504
|
(0, import_node_fs12.chmodSync)(pendingPath, 384);
|
|
22484
22505
|
(0, import_node_fs12.renameSync)(pendingPath, configPath);
|
|
22485
22506
|
} finally {
|
|
@@ -23513,14 +23534,14 @@ async function setupDaemon(args) {
|
|
|
23513
23534
|
const setupToken = argValue(args, "--setup-token") ?? process.env.ALAN_RUNTIME_SETUP_TOKEN;
|
|
23514
23535
|
const token = argValue(args, "--token") ?? process.env.ALAN_SETUP_TOKEN;
|
|
23515
23536
|
const displayName = argValue(args, "--name") ?? (0, import_node_os7.hostname)();
|
|
23516
|
-
const scope = argValue(args, "--scope") ?? process.env.ALAN_RUNTIME_SCOPE ?? "team";
|
|
23537
|
+
const scope = argValue(args, "--scope") ?? process.env.ALAN_RUNTIME_SCOPE ?? (setupToken ? "team" : "user");
|
|
23517
23538
|
const installationId = argValue(args, "--installation-id") ?? previousConfig.installationId ?? (0, import_node_crypto3.randomUUID)();
|
|
23518
23539
|
if (scope !== "team" && scope !== "user") {
|
|
23519
23540
|
throw new Error("setup --scope must be either 'team' or 'user'");
|
|
23520
23541
|
}
|
|
23521
|
-
if (!setupToken &&
|
|
23542
|
+
if (!setupToken && !token) {
|
|
23522
23543
|
throw new Error(
|
|
23523
|
-
"setup requires --setup-token <token> or --
|
|
23544
|
+
"setup requires --setup-token <token> or --token <Alan access token>.\nFor normal setup, copy the setup token from Alan and run: alan-agent setup --setup-token <token>\nFor browser authorization, run: alan-agent login"
|
|
23524
23545
|
);
|
|
23525
23546
|
}
|
|
23526
23547
|
const registrationAttemptId = setupToken ? getOrCreateSetupAttemptId(setupToken) : (0, import_node_crypto3.randomUUID)();
|
|
@@ -23540,8 +23561,6 @@ async function setupDaemon(args) {
|
|
|
23540
23561
|
managementKind: "user_managed",
|
|
23541
23562
|
hostKind: "daemon",
|
|
23542
23563
|
lifecycle: "durable",
|
|
23543
|
-
ownerType: scope,
|
|
23544
|
-
visibility: scope,
|
|
23545
23564
|
capabilities: discoverCapabilities(),
|
|
23546
23565
|
metadata: {
|
|
23547
23566
|
...await collectRuntimeMetadataWithProviderLimits(),
|
|
@@ -23587,7 +23606,6 @@ async function setupDaemon(args) {
|
|
|
23587
23606
|
apiUrl,
|
|
23588
23607
|
wsUrl,
|
|
23589
23608
|
endpointProfile,
|
|
23590
|
-
teamId,
|
|
23591
23609
|
runtimeId: body.runtime.id,
|
|
23592
23610
|
runtimeToken: body.runtimeToken,
|
|
23593
23611
|
runtimeRenewalToken: body.runtimeRenewalToken,
|
|
@@ -23697,7 +23715,6 @@ async function loginWithDeviceCode(args) {
|
|
|
23697
23715
|
apiUrl,
|
|
23698
23716
|
wsUrl,
|
|
23699
23717
|
endpointProfile,
|
|
23700
|
-
teamId: body.runtime.teamId ?? void 0,
|
|
23701
23718
|
runtimeId: body.runtime.id,
|
|
23702
23719
|
runtimeToken: body.runtimeToken,
|
|
23703
23720
|
runtimeRenewalToken: body.runtimeRenewalToken,
|
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.37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Alan agent runtime — cloud sandbox and local daemon (alan-agent CLI)",
|
|
6
6
|
"bin": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"lint": "biome check .",
|
|
33
33
|
"lint:fix": "biome check --write .",
|
|
34
34
|
"format": "biome format --write .",
|
|
35
|
-
"test": "vitest run",
|
|
35
|
+
"test": "vitest run src/__tests__/daemon-socket.integration.test.ts && vitest run --exclude src/__tests__/daemon-socket.integration.test.ts",
|
|
36
36
|
"test:coverage": "vitest run --coverage",
|
|
37
37
|
"test:watch": "vitest",
|
|
38
38
|
"type-check": "tsc --noEmit",
|