@ai-development-environment/control-agent 0.0.55 → 0.0.57
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 +41 -12
- package/package.json +1 -1
package/dist/control-agent.js
CHANGED
|
@@ -12121,10 +12121,10 @@ function runLoggedCommand(options) {
|
|
|
12121
12121
|
let remainder = "";
|
|
12122
12122
|
const drain = (final = false) => {
|
|
12123
12123
|
while (remainder) {
|
|
12124
|
-
const
|
|
12125
|
-
if (
|
|
12126
|
-
let end =
|
|
12127
|
-
if (remainder[
|
|
12124
|
+
const delimiter2 = remainder.search(/[\r\n]/);
|
|
12125
|
+
if (delimiter2 < 0 && !final) return;
|
|
12126
|
+
let end = delimiter2 < 0 ? remainder.length : delimiter2 + 1;
|
|
12127
|
+
if (remainder[delimiter2] === "\r" && remainder[delimiter2 + 1] === "\n") {
|
|
12128
12128
|
end += 1;
|
|
12129
12129
|
}
|
|
12130
12130
|
const record = remainder.slice(0, end);
|
|
@@ -16147,7 +16147,7 @@ var CodebaseMonitor = class {
|
|
|
16147
16147
|
// src/runs/run-manager.ts
|
|
16148
16148
|
import { execFile as execFile4 } from "node:child_process";
|
|
16149
16149
|
import { mkdir as mkdir6, rm as rm13 } from "node:fs/promises";
|
|
16150
|
-
import { dirname as dirname8, join as
|
|
16150
|
+
import { dirname as dirname8, join as join16 } from "node:path";
|
|
16151
16151
|
import { promisify as promisify4 } from "node:util";
|
|
16152
16152
|
|
|
16153
16153
|
// src/runs/journal.ts
|
|
@@ -16300,6 +16300,9 @@ var RunJournal = class {
|
|
|
16300
16300
|
|
|
16301
16301
|
// src/runs/claude-adapter.ts
|
|
16302
16302
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
16303
|
+
import { accessSync, constants } from "node:fs";
|
|
16304
|
+
import { homedir as homedir8 } from "node:os";
|
|
16305
|
+
import { delimiter, join as join14 } from "node:path";
|
|
16303
16306
|
|
|
16304
16307
|
// ../../node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
|
|
16305
16308
|
import { createRequire as RV } from "node:module";
|
|
@@ -42107,6 +42110,28 @@ function answerArrays(value) {
|
|
|
42107
42110
|
}
|
|
42108
42111
|
|
|
42109
42112
|
// src/runs/claude-adapter.ts
|
|
42113
|
+
function isExecutable(path) {
|
|
42114
|
+
try {
|
|
42115
|
+
accessSync(path, constants.X_OK);
|
|
42116
|
+
return true;
|
|
42117
|
+
} catch {
|
|
42118
|
+
return false;
|
|
42119
|
+
}
|
|
42120
|
+
}
|
|
42121
|
+
function findClaudeCodeExecutable(options = {}) {
|
|
42122
|
+
const env = options.env ?? process.env;
|
|
42123
|
+
const home = options.home ?? homedir8();
|
|
42124
|
+
const platform = options.platform ?? process.platform;
|
|
42125
|
+
const executable = platform === "win32" ? "claude.exe" : "claude";
|
|
42126
|
+
const candidates = [
|
|
42127
|
+
env.CONTROL_AGENT_CLAUDE_EXECUTABLE?.trim(),
|
|
42128
|
+
...(env.PATH ?? "").split(delimiter).filter(Boolean).map((directory) => join14(directory, executable)),
|
|
42129
|
+
join14(home, ".local", "bin", executable),
|
|
42130
|
+
...platform === "darwin" ? ["/opt/homebrew/bin/claude", "/usr/local/bin/claude"] : []
|
|
42131
|
+
].filter((candidate) => Boolean(candidate));
|
|
42132
|
+
const canExecute = options.isExecutable ?? isExecutable;
|
|
42133
|
+
return [...new Set(candidates)].find(canExecute);
|
|
42134
|
+
}
|
|
42110
42135
|
var MessageQueue = class {
|
|
42111
42136
|
values = [];
|
|
42112
42137
|
waiters = [];
|
|
@@ -42240,9 +42265,11 @@ var ClaudeAdapter = class {
|
|
|
42240
42265
|
catalog() {
|
|
42241
42266
|
this.catalogPromise ??= (async () => {
|
|
42242
42267
|
const messages = new MessageQueue();
|
|
42268
|
+
const pathToClaudeCodeExecutable = findClaudeCodeExecutable();
|
|
42243
42269
|
const instance = uAt({
|
|
42244
42270
|
prompt: messages,
|
|
42245
42271
|
options: {
|
|
42272
|
+
...pathToClaudeCodeExecutable ? { pathToClaudeCodeExecutable } : {},
|
|
42246
42273
|
env: claudeEnvironment(),
|
|
42247
42274
|
permissionMode: "plan"
|
|
42248
42275
|
}
|
|
@@ -42276,9 +42303,11 @@ var ClaudeAdapter = class {
|
|
|
42276
42303
|
const effort = ["low", "medium", "high", "xhigh", "max"].includes(
|
|
42277
42304
|
input.run.effort ?? ""
|
|
42278
42305
|
) ? input.run.effort : void 0;
|
|
42306
|
+
const pathToClaudeCodeExecutable = findClaudeCodeExecutable();
|
|
42279
42307
|
activeQuery = uAt({
|
|
42280
42308
|
prompt: messages,
|
|
42281
42309
|
options: {
|
|
42310
|
+
...pathToClaudeCodeExecutable ? { pathToClaudeCodeExecutable } : {},
|
|
42282
42311
|
cwd: input.run.worktree.folder,
|
|
42283
42312
|
...input.run.model !== "default" ? { model: input.run.model } : {},
|
|
42284
42313
|
...effort ? { effort } : {},
|
|
@@ -42441,7 +42470,7 @@ import {
|
|
|
42441
42470
|
} from "node:child_process";
|
|
42442
42471
|
import { mkdtemp as mkdtemp7, rm as rm12, writeFile as writeFile8 } from "node:fs/promises";
|
|
42443
42472
|
import { tmpdir as tmpdir7 } from "node:os";
|
|
42444
|
-
import { join as
|
|
42473
|
+
import { join as join15 } from "node:path";
|
|
42445
42474
|
import { createInterface } from "node:readline";
|
|
42446
42475
|
import { promisify as promisify3 } from "node:util";
|
|
42447
42476
|
var SUPPORTED_CODEX_APP_SERVER_MINORS = ["0.144", "0.145"];
|
|
@@ -42568,7 +42597,7 @@ var CodexAppServer = class {
|
|
|
42568
42597
|
}
|
|
42569
42598
|
}
|
|
42570
42599
|
async createBundledModelCatalog() {
|
|
42571
|
-
const directory = await mkdtemp7(
|
|
42600
|
+
const directory = await mkdtemp7(join15(tmpdir7(), "aide-codex-models-"));
|
|
42572
42601
|
try {
|
|
42573
42602
|
const { stdout } = await execFileAsync2(
|
|
42574
42603
|
"codex",
|
|
@@ -42578,7 +42607,7 @@ var CodexAppServer = class {
|
|
|
42578
42607
|
maxBuffer: 16 * 1024 * 1024
|
|
42579
42608
|
}
|
|
42580
42609
|
);
|
|
42581
|
-
const catalogPath =
|
|
42610
|
+
const catalogPath = join15(directory, "models.json");
|
|
42582
42611
|
await writeFile8(catalogPath, stdout, "utf8");
|
|
42583
42612
|
this.modelCatalogDirectory = directory;
|
|
42584
42613
|
return catalogPath;
|
|
@@ -49272,7 +49301,7 @@ var RunManager = class {
|
|
|
49272
49301
|
5
|
|
49273
49302
|
);
|
|
49274
49303
|
await this.completeCommand(command3.id, "SUCCEEDED");
|
|
49275
|
-
await rm13(
|
|
49304
|
+
await rm13(join16(dirname8(configPath()), "runs", run.id, "attachments"), {
|
|
49276
49305
|
recursive: true,
|
|
49277
49306
|
force: true
|
|
49278
49307
|
}).catch(() => void 0);
|
|
@@ -49453,7 +49482,7 @@ var RunManager = class {
|
|
|
49453
49482
|
this.active.delete(run.id);
|
|
49454
49483
|
this.interruptionRequests.delete(run.id);
|
|
49455
49484
|
this.executingCommands.delete(command3.id);
|
|
49456
|
-
await rm13(
|
|
49485
|
+
await rm13(join16(dirname8(configPath()), "runs", run.id, "attachments"), {
|
|
49457
49486
|
recursive: true,
|
|
49458
49487
|
force: true
|
|
49459
49488
|
}).catch(() => void 0);
|
|
@@ -49681,11 +49710,11 @@ var RunManager = class {
|
|
|
49681
49710
|
}
|
|
49682
49711
|
async stageAttachments(runId, attachments) {
|
|
49683
49712
|
if (!attachments.length) return [];
|
|
49684
|
-
const directory =
|
|
49713
|
+
const directory = join16(dirname8(configPath()), "runs", runId, "attachments");
|
|
49685
49714
|
await mkdir6(directory, { recursive: true, mode: 448 });
|
|
49686
49715
|
return Promise.all(
|
|
49687
49716
|
attachments.map(async (attachment) => {
|
|
49688
|
-
const path =
|
|
49717
|
+
const path = join16(
|
|
49689
49718
|
directory,
|
|
49690
49719
|
`${attachment.id}-${safeFilename(attachment.filename)}`
|
|
49691
49720
|
);
|