@ai-development-environment/control-agent 0.0.72 → 0.0.74
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/control-agent.js +81 -27
- package/package.json +1 -1
package/dist/control-agent.js
CHANGED
|
@@ -3937,8 +3937,8 @@ var require_path_key = __commonJS({
|
|
|
3937
3937
|
"use strict";
|
|
3938
3938
|
var pathKey = (options = {}) => {
|
|
3939
3939
|
const environment = options.env || process.env;
|
|
3940
|
-
const
|
|
3941
|
-
if (
|
|
3940
|
+
const platform2 = options.platform || process.platform;
|
|
3941
|
+
if (platform2 !== "win32") {
|
|
3942
3942
|
return "PATH";
|
|
3943
3943
|
}
|
|
3944
3944
|
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
@@ -5590,7 +5590,15 @@ function subscribeToAgentEvents(client2, agentId, onEvent) {
|
|
|
5590
5590
|
|
|
5591
5591
|
// src/inventory.ts
|
|
5592
5592
|
import { statfsSync } from "node:fs";
|
|
5593
|
-
import {
|
|
5593
|
+
import {
|
|
5594
|
+
arch,
|
|
5595
|
+
cpus,
|
|
5596
|
+
freemem,
|
|
5597
|
+
hostname,
|
|
5598
|
+
platform,
|
|
5599
|
+
release,
|
|
5600
|
+
totalmem
|
|
5601
|
+
} from "node:os";
|
|
5594
5602
|
|
|
5595
5603
|
// ../agent-contract/src/build-data.ts
|
|
5596
5604
|
var BUILD_DATA_SCAN_JOB_KIND = "buildData.scan";
|
|
@@ -8164,18 +8172,15 @@ function buildCoverageReportPayload(input) {
|
|
|
8164
8172
|
}
|
|
8165
8173
|
|
|
8166
8174
|
// src/inventory.ts
|
|
8167
|
-
var AGENT_VERSION = "0.1.0";
|
|
8168
|
-
var
|
|
8175
|
+
var AGENT_VERSION = process.env.CONTROL_AGENT_VERSION ?? "0.1.0";
|
|
8176
|
+
var PORTABLE_AGENT_CAPABILITIES = [
|
|
8169
8177
|
COMMAND_RUN_JOB_KIND,
|
|
8170
8178
|
CCUSAGE_REPORT_JOB_KIND,
|
|
8171
|
-
...BUILD_DATA_JOB_KINDS,
|
|
8172
8179
|
...CODEBASE_JOB_KINDS,
|
|
8173
8180
|
CODEBASE_RECONCILE_EVENT_CAPABILITY,
|
|
8174
8181
|
...WORKTREE_JOB_KINDS,
|
|
8175
8182
|
...SKILL_JOB_KINDS,
|
|
8176
|
-
...IOS_BUILD_JOB_KINDS,
|
|
8177
8183
|
...COVERAGE_JOB_KINDS,
|
|
8178
|
-
...SIGNING_ASSET_JOB_KINDS,
|
|
8179
8184
|
"runs.protocol.v1",
|
|
8180
8185
|
"runs.provider.codex",
|
|
8181
8186
|
"runs.provider.claude",
|
|
@@ -8183,12 +8188,28 @@ var AGENT_CAPABILITIES = [
|
|
|
8183
8188
|
RUN_SESSION_READ_JOB_KIND,
|
|
8184
8189
|
...WORKFLOW_JOB_KINDS
|
|
8185
8190
|
];
|
|
8191
|
+
var MACOS_AGENT_CAPABILITIES = [
|
|
8192
|
+
...BUILD_DATA_JOB_KINDS,
|
|
8193
|
+
...IOS_BUILD_JOB_KINDS,
|
|
8194
|
+
...SIGNING_ASSET_JOB_KINDS
|
|
8195
|
+
];
|
|
8196
|
+
function capabilitiesForPlatform(targetPlatform) {
|
|
8197
|
+
return [
|
|
8198
|
+
...PORTABLE_AGENT_CAPABILITIES,
|
|
8199
|
+
...targetPlatform === "darwin" ? MACOS_AGENT_CAPABILITIES : []
|
|
8200
|
+
];
|
|
8201
|
+
}
|
|
8202
|
+
function operatingSystemVersion(targetPlatform, kernelRelease) {
|
|
8203
|
+
const name = targetPlatform === "darwin" ? "macOS" : targetPlatform === "win32" ? "Windows" : targetPlatform === "linux" ? "Linux" : targetPlatform;
|
|
8204
|
+
return `${name} ${kernelRelease}`;
|
|
8205
|
+
}
|
|
8206
|
+
var AGENT_CAPABILITIES = capabilitiesForPlatform(process.platform);
|
|
8186
8207
|
function collectInventory() {
|
|
8187
8208
|
const disk = statfsSync("/", { bigint: true });
|
|
8188
8209
|
return {
|
|
8189
8210
|
hostname: hostname(),
|
|
8190
8211
|
version: AGENT_VERSION,
|
|
8191
|
-
osVersion:
|
|
8212
|
+
osVersion: operatingSystemVersion(platform(), release()),
|
|
8192
8213
|
architecture: arch(),
|
|
8193
8214
|
cpuModel: (cpus()[0]?.model ?? "Unknown").replace(/^Apple\s+/, ""),
|
|
8194
8215
|
memoryTotalBytes: totalmem(),
|
|
@@ -9134,13 +9155,13 @@ function buildSetting(settings, key) {
|
|
|
9134
9155
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
9135
9156
|
}
|
|
9136
9157
|
function signingPlatform(settings) {
|
|
9137
|
-
const
|
|
9138
|
-
if (
|
|
9139
|
-
if (
|
|
9140
|
-
if (
|
|
9141
|
-
if (
|
|
9142
|
-
if (
|
|
9143
|
-
return
|
|
9158
|
+
const platform2 = buildSetting(settings, "PLATFORM_NAME");
|
|
9159
|
+
if (platform2 === "iphoneos") return "iOS";
|
|
9160
|
+
if (platform2 === "watchos") return "watchOS";
|
|
9161
|
+
if (platform2 === "appletvos") return "tvOS";
|
|
9162
|
+
if (platform2 === "xros") return "visionOS";
|
|
9163
|
+
if (platform2 === "macosx") return "macOS";
|
|
9164
|
+
return platform2;
|
|
9144
9165
|
}
|
|
9145
9166
|
function requiresProvisioningProfile(productType) {
|
|
9146
9167
|
return typeof productType === "string" && (productType.includes("application") || productType.includes("app-extension") || productType.includes("watchkit"));
|
|
@@ -9429,11 +9450,11 @@ function physicalDestinations(value) {
|
|
|
9429
9450
|
["hardwareProperties", "udid"],
|
|
9430
9451
|
["deviceProperties", "identifier"]
|
|
9431
9452
|
]);
|
|
9432
|
-
const
|
|
9453
|
+
const platform2 = nestedString(raw, [
|
|
9433
9454
|
["hardwareProperties", "platform"],
|
|
9434
9455
|
["deviceProperties", "osType"]
|
|
9435
9456
|
]);
|
|
9436
|
-
if (!id2 ||
|
|
9457
|
+
if (!id2 || platform2 && !platform2.toLowerCase().includes("ios")) return [];
|
|
9437
9458
|
const state = nestedString(raw, [
|
|
9438
9459
|
["connectionProperties", "tunnelState"],
|
|
9439
9460
|
["deviceProperties", "connectionState"]
|
|
@@ -12476,16 +12497,44 @@ async function sharedCapacityId(canonicalPath, volumeId, signal) {
|
|
|
12476
12497
|
return volumeId;
|
|
12477
12498
|
}
|
|
12478
12499
|
}
|
|
12479
|
-
async function inspectVolume(configuredPath, role, signal) {
|
|
12500
|
+
async function inspectVolume(configuredPath, role, signal, allowMissing) {
|
|
12480
12501
|
signal.throwIfAborted();
|
|
12481
|
-
|
|
12502
|
+
let canonicalPath;
|
|
12503
|
+
let inspectionPath;
|
|
12504
|
+
try {
|
|
12505
|
+
canonicalPath = await realpath4(configuredPath);
|
|
12506
|
+
inspectionPath = canonicalPath;
|
|
12507
|
+
} catch (error) {
|
|
12508
|
+
if (!allowMissing || error.code !== "ENOENT") {
|
|
12509
|
+
throw error;
|
|
12510
|
+
}
|
|
12511
|
+
const missingSegments = [];
|
|
12512
|
+
let candidate = resolve4(configuredPath);
|
|
12513
|
+
for (; ; ) {
|
|
12514
|
+
signal.throwIfAborted();
|
|
12515
|
+
const parent = dirname3(candidate);
|
|
12516
|
+
if (parent === candidate) throw error;
|
|
12517
|
+
missingSegments.unshift(basename4(candidate));
|
|
12518
|
+
candidate = parent;
|
|
12519
|
+
try {
|
|
12520
|
+
inspectionPath = await realpath4(candidate);
|
|
12521
|
+
canonicalPath = join6(inspectionPath, ...missingSegments);
|
|
12522
|
+
break;
|
|
12523
|
+
} catch (parentError) {
|
|
12524
|
+
if (parentError.code !== "ENOENT") {
|
|
12525
|
+
throw parentError;
|
|
12526
|
+
}
|
|
12527
|
+
}
|
|
12528
|
+
}
|
|
12529
|
+
}
|
|
12482
12530
|
const [information, filesystem] = await Promise.all([
|
|
12483
|
-
stat5(
|
|
12484
|
-
statfs(
|
|
12531
|
+
stat5(inspectionPath),
|
|
12532
|
+
statfs(inspectionPath, { bigint: true })
|
|
12485
12533
|
]);
|
|
12486
12534
|
const id2 = String(information.dev);
|
|
12487
12535
|
return {
|
|
12488
12536
|
canonicalPath,
|
|
12537
|
+
inspectionPath,
|
|
12489
12538
|
volume: {
|
|
12490
12539
|
id: id2,
|
|
12491
12540
|
capacityId: id2,
|
|
@@ -12513,7 +12562,12 @@ async function collectAgentDiskSpace(configuration, signal) {
|
|
|
12513
12562
|
for (const request of requested) {
|
|
12514
12563
|
signal.throwIfAborted();
|
|
12515
12564
|
try {
|
|
12516
|
-
const inspected = await inspectVolume(
|
|
12565
|
+
const inspected = await inspectVolume(
|
|
12566
|
+
request.path,
|
|
12567
|
+
request.role,
|
|
12568
|
+
signal,
|
|
12569
|
+
request.role === "DERIVED_DATA"
|
|
12570
|
+
);
|
|
12517
12571
|
const existing = volumes.get(inspected.volume.id);
|
|
12518
12572
|
if (existing) {
|
|
12519
12573
|
existing.roles.add(request.role);
|
|
@@ -12522,7 +12576,7 @@ async function collectAgentDiskSpace(configuration, signal) {
|
|
|
12522
12576
|
existing.freeBytes = inspected.volume.freeBytes;
|
|
12523
12577
|
} else {
|
|
12524
12578
|
inspected.volume.capacityId = await sharedCapacityId(
|
|
12525
|
-
inspected.
|
|
12579
|
+
inspected.inspectionPath,
|
|
12526
12580
|
inspected.volume.id,
|
|
12527
12581
|
signal
|
|
12528
12582
|
);
|
|
@@ -42724,13 +42778,13 @@ function isExecutable(path) {
|
|
|
42724
42778
|
function findClaudeCodeExecutable(options = {}) {
|
|
42725
42779
|
const env = options.env ?? process.env;
|
|
42726
42780
|
const home = options.home ?? homedir8();
|
|
42727
|
-
const
|
|
42728
|
-
const executable =
|
|
42781
|
+
const platform2 = options.platform ?? process.platform;
|
|
42782
|
+
const executable = platform2 === "win32" ? "claude.exe" : "claude";
|
|
42729
42783
|
const candidates = [
|
|
42730
42784
|
env.CONTROL_AGENT_CLAUDE_EXECUTABLE?.trim(),
|
|
42731
42785
|
...(env.PATH ?? "").split(delimiter).filter(Boolean).map((directory) => join15(directory, executable)),
|
|
42732
42786
|
join15(home, ".local", "bin", executable),
|
|
42733
|
-
...
|
|
42787
|
+
...platform2 === "darwin" ? ["/opt/homebrew/bin/claude", "/usr/local/bin/claude"] : []
|
|
42734
42788
|
].filter((candidate) => Boolean(candidate));
|
|
42735
42789
|
const canExecute = options.isExecutable ?? isExecutable;
|
|
42736
42790
|
return [...new Set(candidates)].find(canExecute);
|