@alan-ai-hq/agent-manager-linux-arm64 0.1.129 → 0.1.130
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/alan-agent.cjs +453 -480
- package/alan-holder.cjs +271 -319
- package/package.json +1 -1
package/alan-holder.cjs
CHANGED
|
@@ -21299,11 +21299,8 @@ var init_workflow_tools_filter = __esm({
|
|
|
21299
21299
|
"create_test_report",
|
|
21300
21300
|
"create_plan",
|
|
21301
21301
|
"create_document_artifact",
|
|
21302
|
-
"upsert_prototype_version",
|
|
21303
21302
|
"list_artifacts",
|
|
21304
|
-
"get_artifact"
|
|
21305
|
-
"list_prototypes",
|
|
21306
|
-
"get_prototype"
|
|
21303
|
+
"get_artifact"
|
|
21307
21304
|
];
|
|
21308
21305
|
LEGACY_WORKFLOW_BUILTIN_TOOLS = {
|
|
21309
21306
|
list_document_comments: "get_document",
|
|
@@ -22238,7 +22235,7 @@ var init_chunk_YXWJW7I5 = __esm({
|
|
|
22238
22235
|
}
|
|
22239
22236
|
});
|
|
22240
22237
|
|
|
22241
|
-
// ../agent-core/dist/chunk-
|
|
22238
|
+
// ../agent-core/dist/chunk-NDAB5G24.js
|
|
22242
22239
|
function windowsEnvValue(env, name) {
|
|
22243
22240
|
const wanted = name.toLowerCase();
|
|
22244
22241
|
for (const [key, value] of Object.entries(env)) {
|
|
@@ -22362,6 +22359,12 @@ function planSpawn({ command, args, env, platform, files }) {
|
|
|
22362
22359
|
if (launch === void 0) {
|
|
22363
22360
|
throw new CoreFault("spawn_failed", `Could not start ${command} (not found on PATH)`);
|
|
22364
22361
|
}
|
|
22362
|
+
if (launch.kind === "batch") {
|
|
22363
|
+
throw new CoreFault(
|
|
22364
|
+
"spawn_failed",
|
|
22365
|
+
`${command} resolves to a batch file that cannot run as a managed Windows agent; install its native executable or supported npm shim`
|
|
22366
|
+
);
|
|
22367
|
+
}
|
|
22365
22368
|
return { file: launch.file, args: launch.args, commandLine: windowsCommandLine(launch, env) };
|
|
22366
22369
|
}
|
|
22367
22370
|
function planDirectLaunch({
|
|
@@ -22693,45 +22696,90 @@ function createProcessTree(child, options = {}) {
|
|
|
22693
22696
|
}
|
|
22694
22697
|
};
|
|
22695
22698
|
}
|
|
22696
|
-
function
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22702
|
-
|
|
22703
|
-
|
|
22704
|
-
].join("\n");
|
|
22699
|
+
function providerEnvironment(env) {
|
|
22700
|
+
const unique = /* @__PURE__ */ new Map();
|
|
22701
|
+
for (const [name, value] of Object.entries(env)) {
|
|
22702
|
+
if (/^ALAN_JOB_(FILE|COMMAND|STATUS)$/i.test(name) || /^ALAN_WINHELPER_PATH$/i.test(name))
|
|
22703
|
+
continue;
|
|
22704
|
+
unique.set(name.toLowerCase(), [name, value]);
|
|
22705
|
+
}
|
|
22706
|
+
return Object.fromEntries(unique.values());
|
|
22705
22707
|
}
|
|
22706
|
-
function
|
|
22707
|
-
|
|
22708
|
-
|
|
22709
|
-
|
|
22710
|
-
|
|
22711
|
-
|
|
22712
|
-
|
|
22713
|
-
|
|
22714
|
-
|
|
22715
|
-
|
|
22716
|
-
|
|
22717
|
-
|
|
22718
|
-
|
|
22719
|
-
|
|
22720
|
-
|
|
22721
|
-
|
|
22708
|
+
function requireStartedProvider(response, command) {
|
|
22709
|
+
if (response.startsWith("error:")) {
|
|
22710
|
+
throw new CoreFault("spawn_failed", `Could not start ${command} (${response.slice(6)})`);
|
|
22711
|
+
}
|
|
22712
|
+
if (!/^\d+$/.test(response)) {
|
|
22713
|
+
throw new CoreFault("spawn_failed", `Could not start ${command} (invalid helper response)`);
|
|
22714
|
+
}
|
|
22715
|
+
}
|
|
22716
|
+
function isWindowsJob(child) {
|
|
22717
|
+
return statuses.has(child);
|
|
22718
|
+
}
|
|
22719
|
+
function helperFile(env) {
|
|
22720
|
+
const override = Object.entries(env).find(([name]) => /^ALAN_WINHELPER_PATH$/i.test(name))?.[1];
|
|
22721
|
+
if (override) return override;
|
|
22722
|
+
const entry = process.argv[1];
|
|
22723
|
+
if (!entry) throw new CoreFault("spawn_failed", "Cannot locate the Windows agent helper");
|
|
22724
|
+
return (0, import_path2.join)((0, import_path2.dirname)(entry), "alan-winhelper.exe");
|
|
22722
22725
|
}
|
|
22723
22726
|
function spawnInWindowsJob(plan2, options) {
|
|
22724
22727
|
if (plan2.commandLine === null) {
|
|
22725
22728
|
throw new CoreFault("internal", `No Windows command line was planned for ${plan2.file}`);
|
|
22726
22729
|
}
|
|
22727
|
-
const
|
|
22728
|
-
|
|
22730
|
+
const file2 = helperFile(options.env);
|
|
22731
|
+
const directory = (0, import_fs2.mkdtempSync)((0, import_path2.join)((0, import_os.tmpdir)(), `alan-job-${(0, import_crypto.randomUUID)()}-`));
|
|
22732
|
+
const path = (0, import_path2.join)(directory, "started");
|
|
22733
|
+
const child = (0, import_child_process6.spawn)(file2, [String(process.pid)], {
|
|
22729
22734
|
cwd: options.cwd,
|
|
22730
|
-
env: {
|
|
22735
|
+
env: {
|
|
22736
|
+
...providerEnvironment(options.env),
|
|
22737
|
+
ALAN_JOB_FILE: plan2.file,
|
|
22738
|
+
ALAN_JOB_COMMAND: plan2.commandLine,
|
|
22739
|
+
ALAN_JOB_STATUS: path
|
|
22740
|
+
},
|
|
22731
22741
|
stdio: ["pipe", "pipe", "pipe"],
|
|
22732
22742
|
shell: false,
|
|
22733
22743
|
windowsHide: true
|
|
22734
22744
|
});
|
|
22745
|
+
const status = { directory, path };
|
|
22746
|
+
child.once("error", (error61) => {
|
|
22747
|
+
status.error = error61;
|
|
22748
|
+
});
|
|
22749
|
+
statuses.set(child, status);
|
|
22750
|
+
return child;
|
|
22751
|
+
}
|
|
22752
|
+
async function waitForWindowsJob(child, command) {
|
|
22753
|
+
const status = statuses.get(child);
|
|
22754
|
+
if (!status) throw new CoreFault("internal", "Missing Windows helper startup state");
|
|
22755
|
+
const deadline = systemClock2.monotonic() + START_TIMEOUT_MS;
|
|
22756
|
+
try {
|
|
22757
|
+
while (systemClock2.monotonic() < deadline) {
|
|
22758
|
+
const providerPid = await (0, import_promises6.readFile)(status.path, "utf8").catch(() => void 0);
|
|
22759
|
+
if (providerPid !== void 0) {
|
|
22760
|
+
requireStartedProvider(providerPid, command);
|
|
22761
|
+
return;
|
|
22762
|
+
}
|
|
22763
|
+
if (status.error) {
|
|
22764
|
+
throw new CoreFault(
|
|
22765
|
+
"spawn_failed",
|
|
22766
|
+
`Could not start ${command} (${status.error.message})`,
|
|
22767
|
+
{
|
|
22768
|
+
cause: status.error
|
|
22769
|
+
}
|
|
22770
|
+
);
|
|
22771
|
+
}
|
|
22772
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
22773
|
+
throw new CoreFault("spawn_failed", `Could not start ${command} (Windows helper exited)`);
|
|
22774
|
+
}
|
|
22775
|
+
await systemClock2.sleep(25);
|
|
22776
|
+
}
|
|
22777
|
+
child.kill("SIGKILL");
|
|
22778
|
+
throw new CoreFault("spawn_failed", `Could not start ${command} (Windows helper timed out)`);
|
|
22779
|
+
} finally {
|
|
22780
|
+
statuses.delete(child);
|
|
22781
|
+
await (0, import_promises6.rm)(status.directory, { recursive: true, force: true });
|
|
22782
|
+
}
|
|
22735
22783
|
}
|
|
22736
22784
|
function spawnCli(options) {
|
|
22737
22785
|
const platform = options.platform ?? process.platform;
|
|
@@ -22746,6 +22794,7 @@ function spawnCli(options) {
|
|
|
22746
22794
|
});
|
|
22747
22795
|
}
|
|
22748
22796
|
function waitForSpawn(child, command) {
|
|
22797
|
+
if (isWindowsJob(child)) return waitForWindowsJob(child, command);
|
|
22749
22798
|
if (child.pid !== void 0) return Promise.resolve();
|
|
22750
22799
|
return new Promise((resolve4, reject) => {
|
|
22751
22800
|
const onSpawn = () => {
|
|
@@ -22763,9 +22812,9 @@ function waitForSpawn(child, command) {
|
|
|
22763
22812
|
child.once("error", onError);
|
|
22764
22813
|
});
|
|
22765
22814
|
}
|
|
22766
|
-
var import_child_process, import_fs, import_path, import_child_process2, import_promises5, import_child_process3, import_child_process4, import_child_process5, import_child_process6, import_path2, SHIM_MAX_BYTES, CMD_MAX_COMMAND_LINE, MAX_COMMAND_LINE, DEFAULT_PATHEXT, nodeWindowsFiles, NODE_SHIM_ENTRY, CMD_META, NEVER_STARTED, HIDDEN_FLAG_PROBE_VALUE, NEWLINE, CARRIAGE_RETURN, EMPTY, MAX_LINE_BYTES, LineSplitter, PS_LINE, POLL_MS, DEFAULT_GRACE_MS, DEFAULT_KILL_WAIT_MS, DEFAULT_TASKKILL_TIMEOUT_MS,
|
|
22767
|
-
var
|
|
22768
|
-
"../agent-core/dist/chunk-
|
|
22815
|
+
var import_child_process, import_fs, import_path, import_child_process2, import_promises5, import_child_process3, import_child_process4, import_child_process5, import_child_process6, import_crypto, import_fs2, import_promises6, import_os, import_path2, SHIM_MAX_BYTES, CMD_MAX_COMMAND_LINE, MAX_COMMAND_LINE, DEFAULT_PATHEXT, nodeWindowsFiles, NODE_SHIM_ENTRY, CMD_META, NEVER_STARTED, HIDDEN_FLAG_PROBE_VALUE, NEWLINE, CARRIAGE_RETURN, EMPTY, MAX_LINE_BYTES, LineSplitter, PS_LINE, POLL_MS, DEFAULT_GRACE_MS, DEFAULT_KILL_WAIT_MS, DEFAULT_TASKKILL_TIMEOUT_MS, statuses, START_TIMEOUT_MS;
|
|
22816
|
+
var init_chunk_NDAB5G24 = __esm({
|
|
22817
|
+
"../agent-core/dist/chunk-NDAB5G24.js"() {
|
|
22769
22818
|
"use strict";
|
|
22770
22819
|
init_chunk_YXWJW7I5();
|
|
22771
22820
|
import_child_process = require("child_process");
|
|
@@ -22777,6 +22826,10 @@ var init_chunk_VZIZDY3T = __esm({
|
|
|
22777
22826
|
import_child_process4 = require("child_process");
|
|
22778
22827
|
import_child_process5 = require("child_process");
|
|
22779
22828
|
import_child_process6 = require("child_process");
|
|
22829
|
+
import_crypto = require("crypto");
|
|
22830
|
+
import_fs2 = require("fs");
|
|
22831
|
+
import_promises6 = require("fs/promises");
|
|
22832
|
+
import_os = require("os");
|
|
22780
22833
|
import_path2 = require("path");
|
|
22781
22834
|
SHIM_MAX_BYTES = 64 * 1024;
|
|
22782
22835
|
CMD_MAX_COMMAND_LINE = 8191;
|
|
@@ -22848,87 +22901,8 @@ var init_chunk_VZIZDY3T = __esm({
|
|
|
22848
22901
|
DEFAULT_GRACE_MS = 3e3;
|
|
22849
22902
|
DEFAULT_KILL_WAIT_MS = 2e3;
|
|
22850
22903
|
DEFAULT_TASKKILL_TIMEOUT_MS = 5e3;
|
|
22851
|
-
|
|
22852
|
-
|
|
22853
|
-
using System;
|
|
22854
|
-
using System.Text;
|
|
22855
|
-
using System.Runtime.InteropServices;
|
|
22856
|
-
using System.ComponentModel;
|
|
22857
|
-
public static class AlanProviderJob {
|
|
22858
|
-
[StructLayout(LayoutKind.Sequential)] struct IO { public ulong a,b,c,d,e,f; }
|
|
22859
|
-
[StructLayout(LayoutKind.Sequential)] struct Limits {
|
|
22860
|
-
public long perProcess, perJob; public uint flags;
|
|
22861
|
-
public UIntPtr minWorkingSet, maxWorkingSet; public uint activeProcesses;
|
|
22862
|
-
public UIntPtr affinity; public uint priority, scheduling;
|
|
22863
|
-
}
|
|
22864
|
-
[StructLayout(LayoutKind.Sequential)] struct ExtendedLimits {
|
|
22865
|
-
public Limits basic; public IO io;
|
|
22866
|
-
public UIntPtr processMemory, jobMemory, peakProcessMemory, peakJobMemory;
|
|
22867
|
-
}
|
|
22868
|
-
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] struct Startup {
|
|
22869
|
-
public uint cb; public string reserved, desktop, title;
|
|
22870
|
-
public uint x,y,xSize,ySize,xChars,yChars,fill,flags;
|
|
22871
|
-
public ushort show,reservedSize; public IntPtr reserved2, stdin, stdout, stderr;
|
|
22872
|
-
}
|
|
22873
|
-
[StructLayout(LayoutKind.Sequential)] struct ProcessInfo {
|
|
22874
|
-
public IntPtr process, thread; public uint pid, tid;
|
|
22875
|
-
}
|
|
22876
|
-
[DllImport("kernel32.dll", SetLastError=true)] static extern IntPtr CreateJobObject(IntPtr security, string name);
|
|
22877
|
-
[DllImport("kernel32.dll", SetLastError=true)] static extern bool SetInformationJobObject(IntPtr job, int kind, ref ExtendedLimits limits, uint size);
|
|
22878
|
-
[DllImport("kernel32.dll", SetLastError=true)] static extern bool AssignProcessToJobObject(IntPtr job, IntPtr process);
|
|
22879
|
-
[DllImport("kernel32.dll", SetLastError=true)] static extern bool TerminateJobObject(IntPtr job, uint code);
|
|
22880
|
-
[DllImport("kernel32.dll", SetLastError=true)] static extern bool TerminateProcess(IntPtr process, uint code);
|
|
22881
|
-
[DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] static extern bool CreateProcess(string app, StringBuilder command, IntPtr ps, IntPtr ts, bool inherit, uint flags, IntPtr env, string cwd, ref Startup si, out ProcessInfo pi);
|
|
22882
|
-
[DllImport("kernel32.dll")] static extern IntPtr GetStdHandle(int id);
|
|
22883
|
-
[DllImport("kernel32.dll")] static extern IntPtr GetCurrentProcess();
|
|
22884
|
-
[DllImport("kernel32.dll", SetLastError=true)] static extern bool DuplicateHandle(IntPtr sourceProcess, IntPtr source, IntPtr targetProcess, out IntPtr target, uint access, bool inherit, uint options);
|
|
22885
|
-
[DllImport("kernel32.dll", SetLastError=true)] static extern uint ResumeThread(IntPtr thread);
|
|
22886
|
-
[DllImport("kernel32.dll", SetLastError=true)] static extern IntPtr OpenProcess(uint access, bool inherit, int pid);
|
|
22887
|
-
[DllImport("kernel32.dll", SetLastError=true)] static extern uint WaitForMultipleObjects(uint count, IntPtr[] handles, bool all, uint ms);
|
|
22888
|
-
[DllImport("kernel32.dll")] static extern bool GetExitCodeProcess(IntPtr process, out uint code);
|
|
22889
|
-
[DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr handle);
|
|
22890
|
-
static void Check(bool ok) { if (!ok) throw new Win32Exception(Marshal.GetLastWin32Error()); }
|
|
22891
|
-
static IntPtr CopyStd(int id) {
|
|
22892
|
-
IntPtr result; var self = GetCurrentProcess();
|
|
22893
|
-
Check(DuplicateHandle(self, GetStdHandle(id), self, out result, 0, true, 2));
|
|
22894
|
-
return result;
|
|
22895
|
-
}
|
|
22896
|
-
public static int Run(string command, int ownerPid) {
|
|
22897
|
-
Environment.SetEnvironmentVariable("${JOB_COMMAND_VARIABLE}", null);
|
|
22898
|
-
IntPtr owner = OpenProcess(0x100000, false, ownerPid);
|
|
22899
|
-
if (owner == IntPtr.Zero) throw new Win32Exception(Marshal.GetLastWin32Error());
|
|
22900
|
-
IntPtr job = CreateJobObject(IntPtr.Zero, null);
|
|
22901
|
-
if (job == IntPtr.Zero) { CloseHandle(owner); throw new Win32Exception(Marshal.GetLastWin32Error()); }
|
|
22902
|
-
ProcessInfo pi = new ProcessInfo(); Startup si = new Startup();
|
|
22903
|
-
try {
|
|
22904
|
-
var limits = new ExtendedLimits(); limits.basic.flags = 0x2000;
|
|
22905
|
-
Check(SetInformationJobObject(job, 9, ref limits, (uint)Marshal.SizeOf(limits)));
|
|
22906
|
-
si.cb = (uint)Marshal.SizeOf(si); si.flags = 0x100;
|
|
22907
|
-
si.stdin = CopyStd(-10); si.stdout = CopyStd(-11); si.stderr = CopyStd(-12);
|
|
22908
|
-
Check(CreateProcess(null, new StringBuilder(command), IntPtr.Zero, IntPtr.Zero, true, 0x08000004, IntPtr.Zero, null, ref si, out pi));
|
|
22909
|
-
if (!AssignProcessToJobObject(job, pi.process)) {
|
|
22910
|
-
int error = Marshal.GetLastWin32Error(); TerminateProcess(pi.process, 1);
|
|
22911
|
-
throw new Win32Exception(error);
|
|
22912
|
-
}
|
|
22913
|
-
if (ResumeThread(pi.thread) == 0xffffffff) throw new Win32Exception(Marshal.GetLastWin32Error());
|
|
22914
|
-
uint wait = WaitForMultipleObjects(2, new IntPtr[] { pi.process, owner }, false, 0xffffffff);
|
|
22915
|
-
if (wait == 1) return 1;
|
|
22916
|
-
if (wait != 0) throw new Win32Exception(Marshal.GetLastWin32Error());
|
|
22917
|
-
uint code; Check(GetExitCodeProcess(pi.process, out code));
|
|
22918
|
-
Check(TerminateJobObject(job, code));
|
|
22919
|
-
return unchecked((int)code);
|
|
22920
|
-
} finally {
|
|
22921
|
-
CloseHandle(job);
|
|
22922
|
-
CloseHandle(owner);
|
|
22923
|
-
if (pi.thread != IntPtr.Zero) CloseHandle(pi.thread);
|
|
22924
|
-
if (pi.process != IntPtr.Zero) CloseHandle(pi.process);
|
|
22925
|
-
if (si.stdin != IntPtr.Zero) CloseHandle(si.stdin);
|
|
22926
|
-
if (si.stdout != IntPtr.Zero) CloseHandle(si.stdout);
|
|
22927
|
-
if (si.stderr != IntPtr.Zero) CloseHandle(si.stderr);
|
|
22928
|
-
}
|
|
22929
|
-
}
|
|
22930
|
-
}
|
|
22931
|
-
`;
|
|
22904
|
+
statuses = /* @__PURE__ */ new WeakMap();
|
|
22905
|
+
START_TIMEOUT_MS = 1e4;
|
|
22932
22906
|
}
|
|
22933
22907
|
});
|
|
22934
22908
|
|
|
@@ -24038,13 +24012,13 @@ var init_acp2 = __esm({
|
|
|
24038
24012
|
});
|
|
24039
24013
|
|
|
24040
24014
|
// ../agent-core/dist/chunk-LR52JUGL.js
|
|
24041
|
-
var
|
|
24015
|
+
var import_fs3, NEWLINE2, TranscriptCursor, TranscriptLineLookup;
|
|
24042
24016
|
var init_chunk_LR52JUGL = __esm({
|
|
24043
24017
|
"../agent-core/dist/chunk-LR52JUGL.js"() {
|
|
24044
24018
|
"use strict";
|
|
24045
24019
|
init_chunk_OUQ7HMD3();
|
|
24046
24020
|
init_chunk_YXWJW7I5();
|
|
24047
|
-
|
|
24021
|
+
import_fs3 = require("fs");
|
|
24048
24022
|
NEWLINE2 = 10;
|
|
24049
24023
|
TranscriptCursor = class {
|
|
24050
24024
|
#path;
|
|
@@ -24062,7 +24036,7 @@ var init_chunk_LR52JUGL = __esm({
|
|
|
24062
24036
|
try {
|
|
24063
24037
|
this.#offset = Math.max(
|
|
24064
24038
|
this.#offset,
|
|
24065
|
-
(0,
|
|
24039
|
+
(0, import_fs3.statSync)(this.#path, { throwIfNoEntry: false })?.size ?? 0
|
|
24066
24040
|
);
|
|
24067
24041
|
} catch {
|
|
24068
24042
|
}
|
|
@@ -24084,15 +24058,15 @@ var init_chunk_LR52JUGL = __esm({
|
|
|
24084
24058
|
/** Runs on the CLI's stdout path, so an unreadable file reads as no new lines. */
|
|
24085
24059
|
#unread() {
|
|
24086
24060
|
try {
|
|
24087
|
-
const size = (0,
|
|
24061
|
+
const size = (0, import_fs3.statSync)(this.#path, { throwIfNoEntry: false })?.size ?? 0;
|
|
24088
24062
|
if (size <= this.#offset) return void 0;
|
|
24089
24063
|
const buffer = Buffer.alloc(size - this.#offset);
|
|
24090
|
-
const fd = (0,
|
|
24064
|
+
const fd = (0, import_fs3.openSync)(this.#path, "r");
|
|
24091
24065
|
try {
|
|
24092
|
-
const read = (0,
|
|
24066
|
+
const read = (0, import_fs3.readSync)(fd, buffer, 0, buffer.length, this.#offset);
|
|
24093
24067
|
return buffer.subarray(0, read);
|
|
24094
24068
|
} finally {
|
|
24095
|
-
(0,
|
|
24069
|
+
(0, import_fs3.closeSync)(fd);
|
|
24096
24070
|
}
|
|
24097
24071
|
} catch {
|
|
24098
24072
|
return void 0;
|
|
@@ -24281,7 +24255,7 @@ function createCliProblem(classified, options) {
|
|
|
24281
24255
|
return createAlanProblem({
|
|
24282
24256
|
domain: "agent_cli",
|
|
24283
24257
|
code: problemCodeFor(classified, options),
|
|
24284
|
-
id: options.id ?? (0,
|
|
24258
|
+
id: options.id ?? (0, import_crypto2.randomUUID)(),
|
|
24285
24259
|
title: terminal2 ? "Agent CLI run failed" : "Agent CLI problem observed",
|
|
24286
24260
|
detail: classified.message,
|
|
24287
24261
|
occurredAt: options.occurredAt,
|
|
@@ -24302,12 +24276,12 @@ function createCliProblem(classified, options) {
|
|
|
24302
24276
|
...classified.resetsAt ? { resetsAt: classified.resetsAt } : {}
|
|
24303
24277
|
});
|
|
24304
24278
|
}
|
|
24305
|
-
var
|
|
24279
|
+
var import_crypto2, ERROR_SPECS, AGENT_ERROR_KINDS, STATUS_PREFIX, TEXT_RULES, CODEX_TIMEOUT_MESSAGE, CODEX_EXPIRED_MESSAGE, EPOCH_RESET, WORDED_RESET, COMMAND_NOT_FOUND, CODE_RULES, TEXT_REFINES, CLI_PROBLEM_CODE_BY_ERROR_KIND, KEY_REJECTION_KINDS;
|
|
24306
24280
|
var init_chunk_R32NAS3B = __esm({
|
|
24307
24281
|
"../agent-core/dist/chunk-R32NAS3B.js"() {
|
|
24308
24282
|
"use strict";
|
|
24309
24283
|
init_chunk_YXWJW7I5();
|
|
24310
|
-
|
|
24284
|
+
import_crypto2 = require("crypto");
|
|
24311
24285
|
init_agent2();
|
|
24312
24286
|
ERROR_SPECS = {
|
|
24313
24287
|
model_mismatch: {
|
|
@@ -24542,7 +24516,7 @@ var init_chunk_R32NAS3B = __esm({
|
|
|
24542
24516
|
}
|
|
24543
24517
|
});
|
|
24544
24518
|
|
|
24545
|
-
// ../agent-core/dist/chunk-
|
|
24519
|
+
// ../agent-core/dist/chunk-BVWCFGFG.js
|
|
24546
24520
|
function collectStrings(value, out) {
|
|
24547
24521
|
if (typeof value === "string") out.push(value);
|
|
24548
24522
|
else if (Array.isArray(value)) for (const item of value) collectStrings(item, out);
|
|
@@ -24630,13 +24604,13 @@ function readMediaFiles(candidates2, cwd, mimeByExt, maxBytes) {
|
|
|
24630
24604
|
const files = [];
|
|
24631
24605
|
for (const candidate of candidates2) {
|
|
24632
24606
|
const path = normalizePath(candidate, cwd);
|
|
24633
|
-
if (!path || seen.has(path) || !(0,
|
|
24607
|
+
if (!path || seen.has(path) || !(0, import_fs4.existsSync)(path)) continue;
|
|
24634
24608
|
seen.add(path);
|
|
24635
24609
|
const mimeType = mimeByExt[(0, import_path3.extname)(path).toLowerCase()];
|
|
24636
24610
|
if (!mimeType) continue;
|
|
24637
|
-
const stat12 = (0,
|
|
24611
|
+
const stat12 = (0, import_fs4.statSync)(path);
|
|
24638
24612
|
if (!stat12.isFile() || stat12.size <= 0 || stat12.size > maxBytes) continue;
|
|
24639
|
-
files.push({ path, mimeType, buffer: (0,
|
|
24613
|
+
files.push({ path, mimeType, buffer: (0, import_fs4.readFileSync)(path) });
|
|
24640
24614
|
}
|
|
24641
24615
|
return files;
|
|
24642
24616
|
}
|
|
@@ -24911,16 +24885,16 @@ function silentStartError(name, timeoutMs) {
|
|
|
24911
24885
|
message: `${name} printed nothing for ${seconds}s after it started and was stopped. Send your message again.`
|
|
24912
24886
|
};
|
|
24913
24887
|
}
|
|
24914
|
-
var
|
|
24915
|
-
var
|
|
24916
|
-
"../agent-core/dist/chunk-
|
|
24888
|
+
var import_crypto3, import_fs4, import_path3, IMAGE_MIME_BY_EXT, VIDEO_MIME_BY_EXT, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, MAX_IMAGE_BYTES, MAX_VIDEO_BYTES, AGENT_BROWSER_MENTION, LocalMediaReader, SessionOpenRefusal, JsonRpcError, ACP_PROTOCOL_VERSION, ACP_ERROR, STDERR_TAIL_LINES, RESULT_EXIT_GRACE_MS, PerTurnSession;
|
|
24889
|
+
var init_chunk_BVWCFGFG = __esm({
|
|
24890
|
+
"../agent-core/dist/chunk-BVWCFGFG.js"() {
|
|
24917
24891
|
"use strict";
|
|
24918
24892
|
init_chunk_OUQ7HMD3();
|
|
24919
24893
|
init_chunk_R32NAS3B();
|
|
24920
|
-
|
|
24894
|
+
init_chunk_NDAB5G24();
|
|
24921
24895
|
init_chunk_YXWJW7I5();
|
|
24922
|
-
|
|
24923
|
-
|
|
24896
|
+
import_crypto3 = require("crypto");
|
|
24897
|
+
import_fs4 = require("fs");
|
|
24924
24898
|
import_path3 = require("path");
|
|
24925
24899
|
init_agent2();
|
|
24926
24900
|
init_acp();
|
|
@@ -24981,13 +24955,13 @@ var init_chunk_2KE6BVIX = __esm({
|
|
|
24981
24955
|
}
|
|
24982
24956
|
#payloadFields(file2, toolId) {
|
|
24983
24957
|
return {
|
|
24984
|
-
id: (0,
|
|
24958
|
+
id: (0, import_crypto3.randomUUID)(),
|
|
24985
24959
|
filename: (0, import_path3.basename)(file2.path),
|
|
24986
24960
|
mimeType: file2.mimeType,
|
|
24987
24961
|
size: file2.buffer.length,
|
|
24988
24962
|
data: file2.buffer.toString("base64"),
|
|
24989
24963
|
sourcePath: file2.path,
|
|
24990
|
-
sourceHash: (0,
|
|
24964
|
+
sourceHash: (0, import_crypto3.createHash)("sha256").update(file2.buffer).digest("hex"),
|
|
24991
24965
|
toolId,
|
|
24992
24966
|
ts: this.#clock.now()
|
|
24993
24967
|
};
|
|
@@ -25271,7 +25245,7 @@ function selectExternalMcpServers(spec) {
|
|
|
25271
25245
|
return selected;
|
|
25272
25246
|
}
|
|
25273
25247
|
function headerEnvName(server, header) {
|
|
25274
|
-
const fingerprint = (0,
|
|
25248
|
+
const fingerprint = (0, import_crypto4.createHash)("sha256").update(`${server}\0${header}`).digest("hex").slice(0, 12);
|
|
25275
25249
|
return `ALAN_MCP_HEADER_${fingerprint.toUpperCase()}`;
|
|
25276
25250
|
}
|
|
25277
25251
|
function deliverRemote(name, server, env) {
|
|
@@ -25335,7 +25309,7 @@ function managedMcpHeaders(identity) {
|
|
|
25335
25309
|
}
|
|
25336
25310
|
function credentialDigest(authorization) {
|
|
25337
25311
|
if (authorization === void 0) return void 0;
|
|
25338
|
-
return (0,
|
|
25312
|
+
return (0, import_crypto5.createHash)("sha256").update(authorization).digest("hex").slice(0, 16);
|
|
25339
25313
|
}
|
|
25340
25314
|
function canonicalizeManagedMcpServerName(serverName) {
|
|
25341
25315
|
return RUN_SCOPED_SERVER.test(serverName) ? MANAGED_MCP_SERVER_NAME : serverName;
|
|
@@ -25347,30 +25321,30 @@ function canonicalizeManagedMcpToolName(toolName) {
|
|
|
25347
25321
|
return flattened ? `mcp__${MANAGED_MCP_SERVER_NAME}__${flattened[1]}` : toolName;
|
|
25348
25322
|
}
|
|
25349
25323
|
async function writeSecretFile(name, contents) {
|
|
25350
|
-
const dir = await (0,
|
|
25324
|
+
const dir = await (0, import_promises12.mkdtemp)((0, import_path4.join)((0, import_os2.tmpdir)(), "alan-mcp-"));
|
|
25351
25325
|
const path = (0, import_path4.join)(dir, name);
|
|
25352
25326
|
const remove = async () => {
|
|
25353
|
-
await (0,
|
|
25327
|
+
await (0, import_promises12.rm)(dir, { recursive: true, force: true });
|
|
25354
25328
|
};
|
|
25355
25329
|
try {
|
|
25356
|
-
await (0,
|
|
25330
|
+
await (0, import_promises12.writeFile)(path, contents, { mode: 384, flag: "wx" });
|
|
25357
25331
|
} catch (error61) {
|
|
25358
25332
|
await remove();
|
|
25359
25333
|
throw error61;
|
|
25360
25334
|
}
|
|
25361
25335
|
return { path, remove, [Symbol.asyncDispose]: remove };
|
|
25362
25336
|
}
|
|
25363
|
-
var
|
|
25337
|
+
var import_crypto4, import_crypto5, import_promises12, import_os2, import_path4, MANAGED_MCP_SERVER_NAME, RUN_SCOPED_SERVER, NAMESPACED_RUN_TOOL, FLATTENED_RUN_TOOL;
|
|
25364
25338
|
var init_chunk_J2KTV5FP = __esm({
|
|
25365
25339
|
"../agent-core/dist/chunk-J2KTV5FP.js"() {
|
|
25366
25340
|
"use strict";
|
|
25367
|
-
import_crypto3 = require("crypto");
|
|
25368
|
-
init_agent2();
|
|
25369
25341
|
import_crypto4 = require("crypto");
|
|
25370
25342
|
init_agent2();
|
|
25343
|
+
import_crypto5 = require("crypto");
|
|
25344
|
+
init_agent2();
|
|
25371
25345
|
init_runtime_v2();
|
|
25372
|
-
|
|
25373
|
-
|
|
25346
|
+
import_promises12 = require("fs/promises");
|
|
25347
|
+
import_os2 = require("os");
|
|
25374
25348
|
import_path4 = require("path");
|
|
25375
25349
|
MANAGED_MCP_SERVER_NAME = "alan";
|
|
25376
25350
|
RUN_SCOPED_SERVER = /^alan-run-[a-f0-9]{16}$/;
|
|
@@ -25379,7 +25353,7 @@ var init_chunk_J2KTV5FP = __esm({
|
|
|
25379
25353
|
}
|
|
25380
25354
|
});
|
|
25381
25355
|
|
|
25382
|
-
// ../agent-core/dist/chunk-
|
|
25356
|
+
// ../agent-core/dist/chunk-GXBS4QWA.js
|
|
25383
25357
|
function truncate(value, limit) {
|
|
25384
25358
|
const normalized2 = Array.from(value, (character) => {
|
|
25385
25359
|
const code = character.charCodeAt(0);
|
|
@@ -25581,7 +25555,6 @@ function artifactIdsSection(owner) {
|
|
|
25581
25555
|
const ids = artifactIds(owner);
|
|
25582
25556
|
if (ids.length === 0) return void 0;
|
|
25583
25557
|
const tools = ["create_plan", "create_document_artifact", "create_test_report"];
|
|
25584
|
-
if (owner.taskId || owner.isWorkflowSession) tools.push("upsert_prototype_version");
|
|
25585
25558
|
return [
|
|
25586
25559
|
`When creating artifacts using MCP tools (${tools.join(", ")}), always pass these IDs:`,
|
|
25587
25560
|
...ids
|
|
@@ -25593,26 +25566,6 @@ function standaloneChatSection(owner) {
|
|
|
25593
25566
|
}
|
|
25594
25567
|
return "This is a standalone chat. For create_plan, create_document_artifact, and create_test_report, omit taskId and workflowId; conversationId is the artifact owner. Do not use create_document unless the user explicitly asks for a standalone team Document.";
|
|
25595
25568
|
}
|
|
25596
|
-
function prototypeScope(owner) {
|
|
25597
|
-
if (owner.workflowId) {
|
|
25598
|
-
return {
|
|
25599
|
-
ids: "teamId, workflowId, workflowExecutionId, conversationId",
|
|
25600
|
-
lookup: "list_prototypes (with workflowId) or get_prototype"
|
|
25601
|
-
};
|
|
25602
|
-
}
|
|
25603
|
-
return owner.taskId ? { ids: "teamId, taskId, conversationId", lookup: "list_prototypes or get_prototype" } : void 0;
|
|
25604
|
-
}
|
|
25605
|
-
function prototypeSection(owner) {
|
|
25606
|
-
if (!owner.conversationId || !owner.teamId) return void 0;
|
|
25607
|
-
const scope = prototypeScope(owner);
|
|
25608
|
-
if (!scope) return void 0;
|
|
25609
|
-
return [
|
|
25610
|
-
"## Prototype Artifacts",
|
|
25611
|
-
"When the user asks to create, build, modify, or iterate on a prototype, do not create local prototype files such as prototype/index.html.",
|
|
25612
|
-
`Instead, generate a Vite React TypeScript source snapshot and call the Alan MCP tool upsert_prototype_version with ${scope.ids}, title, sourceSnapshot, and packageJson.`,
|
|
25613
|
-
`For follow-up changes to the same prototype, call ${scope.lookup} if needed, then call upsert_prototype_version again with the existing prototypeId and parentVersionId.`
|
|
25614
|
-
].join("\n");
|
|
25615
|
-
}
|
|
25616
25569
|
function contextSections(spec) {
|
|
25617
25570
|
const owner = ownershipOf(spec);
|
|
25618
25571
|
const context = spec.promptContext;
|
|
@@ -25621,8 +25574,7 @@ function contextSections(spec) {
|
|
|
25621
25574
|
taskContextSection(context?.taskMeta),
|
|
25622
25575
|
pullRequestSection(context?.prMeta),
|
|
25623
25576
|
artifactIdsSection(owner),
|
|
25624
|
-
standaloneChatSection(owner)
|
|
25625
|
-
prototypeSection(owner)
|
|
25577
|
+
standaloneChatSection(owner)
|
|
25626
25578
|
].filter((section) => section !== void 0);
|
|
25627
25579
|
}
|
|
25628
25580
|
function taskLifecycleSection(spec) {
|
|
@@ -25728,8 +25680,8 @@ ${body}` : body;
|
|
|
25728
25680
|
return spec.mode === "plan" ? planModePrefix(prefixed) : prefixed;
|
|
25729
25681
|
}
|
|
25730
25682
|
var MAX_PARSED_ATTACHMENTS, MAX_PARSED_ATTACHMENT_CHARS, MAX_METADATA_CHARS, UNAVAILABLE, READ_ONLY_MODES, AGENT_MODES;
|
|
25731
|
-
var
|
|
25732
|
-
"../agent-core/dist/chunk-
|
|
25683
|
+
var init_chunk_GXBS4QWA = __esm({
|
|
25684
|
+
"../agent-core/dist/chunk-GXBS4QWA.js"() {
|
|
25733
25685
|
"use strict";
|
|
25734
25686
|
init_agent2();
|
|
25735
25687
|
MAX_PARSED_ATTACHMENTS = 3;
|
|
@@ -26707,7 +26659,7 @@ function encodeProjectDir(cwd) {
|
|
|
26707
26659
|
}
|
|
26708
26660
|
function realCwd(cwd) {
|
|
26709
26661
|
try {
|
|
26710
|
-
return (0,
|
|
26662
|
+
return (0, import_fs5.realpathSync)(cwd);
|
|
26711
26663
|
} catch {
|
|
26712
26664
|
return cwd;
|
|
26713
26665
|
}
|
|
@@ -26721,12 +26673,12 @@ function claudeSessionLogExists(query) {
|
|
|
26721
26673
|
encodeProjectDir(cwd),
|
|
26722
26674
|
`${query.sessionId}.jsonl`
|
|
26723
26675
|
);
|
|
26724
|
-
if ((0,
|
|
26676
|
+
if ((0, import_fs5.existsSync)(log)) return true;
|
|
26725
26677
|
}
|
|
26726
26678
|
return false;
|
|
26727
26679
|
}
|
|
26728
26680
|
function envDigest(env) {
|
|
26729
|
-
const hash2 = (0,
|
|
26681
|
+
const hash2 = (0, import_crypto7.createHash)("sha256");
|
|
26730
26682
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
26731
26683
|
return hash2.digest("hex");
|
|
26732
26684
|
}
|
|
@@ -26789,35 +26741,35 @@ async function claudeTurnInput(run, context) {
|
|
|
26789
26741
|
const encoded = await Promise.all(
|
|
26790
26742
|
images.map(async (image) => ({
|
|
26791
26743
|
mimeType: image.mimeType,
|
|
26792
|
-
data: (await (0,
|
|
26744
|
+
data: (await (0, import_promises13.readFile)(image.path)).toString("base64")
|
|
26793
26745
|
}))
|
|
26794
26746
|
);
|
|
26795
26747
|
return { turnId: run.runId, text: text2, ...encoded.length ? { images: encoded } : {} };
|
|
26796
26748
|
}
|
|
26797
|
-
var
|
|
26749
|
+
var import_crypto6, import_fs5, import_path5, import_crypto7, import_promises13, EDIT_TOOLS, ThoughtBlocks, UNDERSTOOD_SYSTEM_SUBTYPES, RATE_LIMIT_WARN_AT, CLAUDE_GRAMMAR_NAME, SUBAGENT_TOOL_NAMES, PLAN_ENTRY_STATUSES, controlResponseSchema, STOPPED_STATUSES, TaskRecords, TERMINAL_BACKGROUND_STATUSES, NON_TERMINAL_BACKGROUND_STATUSES, ASYNC_LAUNCH_ACK, BackgroundTasks, FAILED_STATUSES, STOPPED_BY_USER_TEXT, ClaudeTurn, STDERR_TAIL_LINES2, MAX_EARLY_LINES, UNSUPPORTED_STOP, OUTPUT_CLOSED_REASON, ClaudeSession, DEFAULTS, READ_ONLY_DISALLOWED_TOOLS, DEFAULT_MCP_TIMEOUT_MS;
|
|
26798
26750
|
var init_claude = __esm({
|
|
26799
26751
|
"../agent-core/dist/providers/claude.js"() {
|
|
26800
26752
|
"use strict";
|
|
26801
26753
|
init_chunk_LR52JUGL();
|
|
26802
|
-
|
|
26754
|
+
init_chunk_BVWCFGFG();
|
|
26803
26755
|
init_chunk_OUQ7HMD3();
|
|
26804
26756
|
init_chunk_R32NAS3B();
|
|
26805
26757
|
init_chunk_J2KTV5FP();
|
|
26806
|
-
|
|
26807
|
-
|
|
26758
|
+
init_chunk_NDAB5G24();
|
|
26759
|
+
init_chunk_GXBS4QWA();
|
|
26808
26760
|
init_chunk_YXWJW7I5();
|
|
26809
26761
|
init_effort();
|
|
26810
|
-
|
|
26762
|
+
import_crypto6 = require("crypto");
|
|
26811
26763
|
init_constants();
|
|
26812
26764
|
init_zod();
|
|
26813
26765
|
init_acp();
|
|
26814
26766
|
init_acp();
|
|
26815
26767
|
init_constants();
|
|
26816
26768
|
init_agent2();
|
|
26817
|
-
|
|
26769
|
+
import_fs5 = require("fs");
|
|
26818
26770
|
import_path5 = require("path");
|
|
26819
|
-
|
|
26820
|
-
|
|
26771
|
+
import_crypto7 = require("crypto");
|
|
26772
|
+
import_promises13 = require("fs/promises");
|
|
26821
26773
|
init_agent2();
|
|
26822
26774
|
EDIT_TOOLS = /* @__PURE__ */ new Set([
|
|
26823
26775
|
"Edit",
|
|
@@ -27459,7 +27411,7 @@ var init_claude = __esm({
|
|
|
27459
27411
|
sessionId: this.#lastTurn.grammar.sessionId,
|
|
27460
27412
|
taskRecords: this.#taskRecords
|
|
27461
27413
|
});
|
|
27462
|
-
const messageId = this.#replaysUserMessages ? (0,
|
|
27414
|
+
const messageId = this.#replaysUserMessages ? (0, import_crypto6.randomUUID)() : void 0;
|
|
27463
27415
|
const active = this.#startTurn(input2.turnId, turn, messageId);
|
|
27464
27416
|
this.#host.writer.write(claudeUserMessage(input2, messageId)).catch((error61) => {
|
|
27465
27417
|
this.#options.log.warn("claude.stdin_write_failed", { turnId: input2.turnId, error: error61 });
|
|
@@ -27854,7 +27806,7 @@ function codexHomeOf(env) {
|
|
|
27854
27806
|
}
|
|
27855
27807
|
function namesNewestFirst(dir, isDir) {
|
|
27856
27808
|
try {
|
|
27857
|
-
return (0,
|
|
27809
|
+
return (0, import_fs6.readdirSync)(dir, { withFileTypes: true }).filter((entry) => isDir ? entry.isDirectory() : entry.isFile()).map((entry) => entry.name).sort().reverse();
|
|
27858
27810
|
} catch {
|
|
27859
27811
|
return [];
|
|
27860
27812
|
}
|
|
@@ -28034,7 +27986,7 @@ function codexGeneratedImage(payload, ts) {
|
|
|
28034
27986
|
const declared = asString(payload.mimeType) || asString(payload.mime_type);
|
|
28035
27987
|
const mimeType = declared.startsWith("image/") ? declared : inferImageMimeType(buffer);
|
|
28036
27988
|
if (!mimeType) return null;
|
|
28037
|
-
const sourceHash = (0,
|
|
27989
|
+
const sourceHash = (0, import_crypto8.createHash)("sha256").update(buffer).digest("hex");
|
|
28038
27990
|
const toolId = asString(payload.call_id);
|
|
28039
27991
|
const id = asString(payload.id) || toolId || sourceHash;
|
|
28040
27992
|
const sourcePath = asString(payload.sourcePath);
|
|
@@ -28816,7 +28768,7 @@ function createCodexExecDriver(options = {}) {
|
|
|
28816
28768
|
};
|
|
28817
28769
|
}
|
|
28818
28770
|
function envDigest2(env) {
|
|
28819
|
-
const hash2 = (0,
|
|
28771
|
+
const hash2 = (0, import_crypto9.createHash)("sha256");
|
|
28820
28772
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
28821
28773
|
return hash2.digest("hex");
|
|
28822
28774
|
}
|
|
@@ -28857,7 +28809,7 @@ function planCodexExecSession(run, context) {
|
|
|
28857
28809
|
};
|
|
28858
28810
|
}
|
|
28859
28811
|
function envDigest22(env) {
|
|
28860
|
-
const hash2 = (0,
|
|
28812
|
+
const hash2 = (0, import_crypto10.createHash)("sha256");
|
|
28861
28813
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
28862
28814
|
return hash2.digest("hex");
|
|
28863
28815
|
}
|
|
@@ -28926,26 +28878,26 @@ function codexTurnInput(run, context) {
|
|
|
28926
28878
|
...images.length ? { imagePaths: images.map((image) => image.path) } : {}
|
|
28927
28879
|
};
|
|
28928
28880
|
}
|
|
28929
|
-
var
|
|
28881
|
+
var import_fs6, import_path6, import_crypto8, import_crypto9, import_crypto10, TokenRefresher, MCP_STARTUP_TIMEOUT_SEC, FIELD_TYPES, YES_NO, ACCEPT_DECLINE, MAX_INLINE_GENERATED_IMAGE_BYTES, PNG_SIGNATURE, JPEG_NON_FRAME_MARKERS, IMAGE_GEN_CALL, PROMPT_LITERAL, TURN_END_EVENTS, RELOCATE_EVERY_MS, CodexImageGenerationFold, CodexRolloutImages, USER_INPUT_METHOD, PERMISSIONS_METHOD, ELICITATION_METHOD, COMMAND_OR_FILE, LEGACY, DECISIONS, COORDINATION_TOOLS, SETTLED_AGENT, STATUS, CHANGE_OPERATIONS, SILENT_ON_START, IGNORED_ITEMS, PLAN_STATUS, WORKER_LIFECYCLE, INFO_KINDS, SILENT, CodexTurn, STDERR_TAIL_LINES3, MAX_BETWEEN_UPDATES, UNSUPPORTED_REQUEST, DECLINED_ELICITATION, IMAGE_CATCH_UP_MS, IMAGE_POLL_MS, CodexSession, CODEX_MIN_VERSION, CODEX_REQUIREMENT, CODEX_TESTED_LINE, DEFAULTS2, CLIENT_INFO, STATUS2, EXITED_WITHOUT_RESPONSE, CodexExecTurn, DEFAULTS22, CodexExecSession;
|
|
28930
28882
|
var init_codex = __esm({
|
|
28931
28883
|
"../agent-core/dist/providers/codex.js"() {
|
|
28932
28884
|
"use strict";
|
|
28933
28885
|
init_chunk_LR52JUGL();
|
|
28934
|
-
|
|
28886
|
+
init_chunk_BVWCFGFG();
|
|
28935
28887
|
init_chunk_OUQ7HMD3();
|
|
28936
28888
|
init_chunk_R32NAS3B();
|
|
28937
28889
|
init_chunk_J2KTV5FP();
|
|
28938
|
-
|
|
28939
|
-
|
|
28890
|
+
init_chunk_NDAB5G24();
|
|
28891
|
+
init_chunk_GXBS4QWA();
|
|
28940
28892
|
init_chunk_YXWJW7I5();
|
|
28941
|
-
|
|
28893
|
+
import_fs6 = require("fs");
|
|
28942
28894
|
import_path6 = require("path");
|
|
28943
28895
|
init_effort();
|
|
28944
|
-
import_crypto7 = require("crypto");
|
|
28945
|
-
init_agent2();
|
|
28946
28896
|
import_crypto8 = require("crypto");
|
|
28947
28897
|
init_agent2();
|
|
28948
28898
|
import_crypto9 = require("crypto");
|
|
28899
|
+
init_agent2();
|
|
28900
|
+
import_crypto10 = require("crypto");
|
|
28949
28901
|
init_effort();
|
|
28950
28902
|
TokenRefresher = class {
|
|
28951
28903
|
#auth;
|
|
@@ -30102,9 +30054,9 @@ function packagedAlanCodeEnginePath(bundle, platform) {
|
|
|
30102
30054
|
}
|
|
30103
30055
|
function isRunnableFile(path, platform) {
|
|
30104
30056
|
try {
|
|
30105
|
-
if (!(0,
|
|
30057
|
+
if (!(0, import_fs7.statSync)(path).isFile()) return false;
|
|
30106
30058
|
if (platform === "win32") return WINDOWS_RUNNABLE_EXTENSION.test(path);
|
|
30107
|
-
(0,
|
|
30059
|
+
(0, import_fs7.accessSync)(path, import_fs7.constants.X_OK);
|
|
30108
30060
|
return true;
|
|
30109
30061
|
} catch {
|
|
30110
30062
|
return false;
|
|
@@ -30273,18 +30225,18 @@ function alanCodeEngineEnv(input2) {
|
|
|
30273
30225
|
};
|
|
30274
30226
|
}
|
|
30275
30227
|
async function writePlugin(directory, apiOrigin) {
|
|
30276
|
-
const origin = (0,
|
|
30228
|
+
const origin = (0, import_crypto11.createHash)("sha256").update(apiOrigin).digest("hex").slice(0, 12);
|
|
30277
30229
|
const target = (0, import_path8.join)(directory, `engine-plugin-v${ALAN_CODE_ENGINE_PLUGIN_VERSION}-${origin}.mjs`);
|
|
30278
|
-
const temporary = `${target}.${(0,
|
|
30279
|
-
await (0,
|
|
30280
|
-
await (0,
|
|
30281
|
-
await (0,
|
|
30230
|
+
const temporary = `${target}.${(0, import_crypto11.randomUUID)()}.tmp`;
|
|
30231
|
+
await (0, import_promises14.mkdir)(directory, { recursive: true, mode: 448 });
|
|
30232
|
+
await (0, import_promises14.writeFile)(temporary, alanCodeEnginePluginSource(apiOrigin), { mode: 384 });
|
|
30233
|
+
await (0, import_promises14.rename)(temporary, target);
|
|
30282
30234
|
return (0, import_url.pathToFileURL)(target).href;
|
|
30283
30235
|
}
|
|
30284
30236
|
async function prepareAlanCodeProfile(input2) {
|
|
30285
30237
|
const directories = Object.values(alanCodeEngineDirectories(input2.engineRoot));
|
|
30286
30238
|
await Promise.all(
|
|
30287
|
-
directories.map((directory) => (0,
|
|
30239
|
+
directories.map((directory) => (0, import_promises14.mkdir)(directory, { recursive: true, mode: 448 }))
|
|
30288
30240
|
);
|
|
30289
30241
|
const [pluginUrl, models] = await Promise.all([
|
|
30290
30242
|
writePlugin((0, import_path8.join)(input2.engineRoot, "plugin"), input2.access.apiOrigin),
|
|
@@ -30307,7 +30259,7 @@ function alanCodeSystemPrompt(alanSystemPrompt) {
|
|
|
30307
30259
|
|
|
30308
30260
|
${instructions}` : ALAN_CODE_TOOL_NAMING_PROMPT;
|
|
30309
30261
|
}
|
|
30310
|
-
var import_http3, import_https,
|
|
30262
|
+
var import_http3, import_https, import_fs7, import_path7, import_crypto11, import_promises14, import_path8, import_url, ALAN_CODE_BASELINE_PROMPT, ALAN_CODE_ENGINE_PROVIDER_ID, DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_OUTPUT_TOKENS, ALAN_CODE_API_KEY_ENV, ALAN_CODE_CONVERSATION_ID_ENV, ALAN_CODE_PROXY_PATH, ALAN_CODE_WEBSEARCH_PATH, ALAN_CODE_CATALOG_PATH, CATALOG_TIMEOUT_MS, MAX_CATALOG_BYTES, ALAN_CODE_ENGINE_PATH_ENV, ALAN_CODE_ENGINE_COMMAND, ALAN_CODE_ENGINE_NAME, WINDOWS_RUNNABLE_EXTENSION, ALAN_CODE_ENGINE_PLUGIN_VERSION, ALAN_CODE_TOOL_NAMING_PROMPT;
|
|
30311
30263
|
var init_alan_code = __esm({
|
|
30312
30264
|
"../agent-core/dist/providers/alan-code.js"() {
|
|
30313
30265
|
"use strict";
|
|
@@ -30317,11 +30269,11 @@ var init_alan_code = __esm({
|
|
|
30317
30269
|
init_runtime_v2();
|
|
30318
30270
|
init_runtime_v2();
|
|
30319
30271
|
init_models();
|
|
30320
|
-
|
|
30272
|
+
import_fs7 = require("fs");
|
|
30321
30273
|
import_path7 = require("path");
|
|
30322
30274
|
init_runtime_v2();
|
|
30323
|
-
|
|
30324
|
-
|
|
30275
|
+
import_crypto11 = require("crypto");
|
|
30276
|
+
import_promises14 = require("fs/promises");
|
|
30325
30277
|
import_path8 = require("path");
|
|
30326
30278
|
import_url = require("url");
|
|
30327
30279
|
ALAN_CODE_BASELINE_PROMPT = "You are alan-code, an interactive CLI coding agent that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\n\nIMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.\n\nIf the user asks for help or wants to give feedback, inform them of the following:\n- `--harness-help` / harness help: learn how to run alan-code\n- For product feedback or bugs, report through the Alan / Supatest issue channels used by this repository\n\nWhen the user directly asks about alan-code capabilities (for example \"can alan-code\u2026\", \"does the harness have\u2026\") or asks in second person about your abilities, answer from the tools and instructions available in this session. If a docs/fetch tool is available and project docs URLs are known, use them; otherwise inspect local README / AGENTS.md rather than inventing product claims.\n\n# Personality\n\nYour default personality and tone is concise, direct, and friendly. You communicate efficiently, always keeping the user clearly informed about ongoing actions without unnecessary detail. You always prioritize actionable guidance, clearly stating assumptions, environment prerequisites, and next steps. Unless explicitly asked, you avoid excessively verbose explanations about your work.\n\n# Tone and style\n\nYou should be concise, direct, and to the point. When you run a non-trivial bash command, you should explain what the command does and why you are running it, so the user understands what you are doing (especially important for commands that change their system).\nRemember that your output will be displayed on a command line interface. Your responses can use GitHub-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.\nOutput text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.\nIf you cannot or will not help the user with something, do not lecture about why. Offer helpful alternatives if possible; otherwise keep the response to 1-2 sentences.\nOnly use emojis if the user explicitly requests it. Avoid emojis in all communication unless asked.\nIMPORTANT: Minimize output tokens while staying helpful, correct, and accurate. Only address the specific query or task. Avoid tangential information unless it is critical to completing the request. If you can answer in 1-3 sentences or a short paragraph, do that.\nAnswer the user's question directly. One-word answers are best when they suffice. Avoid text before/after your response such as \"The answer is <answer>.\", \"Here is the content of the file\u2026\", \"Based on the information provided\u2026\", or \"Here is what I will do next\u2026\". Examples of appropriate verbosity:\n<example>\nuser: what is 2+2?\nassistant: 4\n</example>\n\n<example>\nuser: is 11 a prime number?\nassistant: Yes\n</example>\n\n<example>\nuser: what command should I run to list files in the current directory?\nassistant: ls\n</example>\n\n<example>\nuser: what command should I run to watch files in the current directory?\nassistant: [use tools to inspect the project, then answer]\nnpm run dev\n</example>\n\n<example>\nuser: what files are in the directory src/?\nassistant: [lists files and sees foo.c, bar.c, baz.c]\nuser: which file contains the implementation of foo?\nassistant: src/foo.c\n</example>\n\n<example>\nuser: write tests for new feature\nassistant: [searches for similar tests, reads relevant files concurrently, edits/writes tests]\n</example>\n\n# Responsiveness\n\n## Preamble messages\n\nBefore making tool calls, send a brief preamble to the user explaining what you're about to do. When sending preamble messages, follow these principles and examples:\n\n- **Logically group related actions**: if you're about to run several related commands, describe them together in one preamble rather than sending a separate note for each.\n- **Keep it concise**: be no more than 1-2 sentences, focused on immediate, tangible next steps. (8\u201312 words for quick updates).\n- **Build on prior context**: if this is not your first tool call, use the preamble message to connect the dots with what's been done so far and create a sense of momentum and clarity for the user to understand your next actions.\n- **Keep your tone light, friendly and curious**: add small touches of personality in preambles feel collaborative and engaging.\n- **Exception**: Avoid adding a preamble for every trivial read (e.g., `cat` a single file) unless it's part of a larger grouped action.\n\nExamples:\n\n- \"I've explored the repo; now checking the API route definitions.\"\n- \"Next, I'll patch the config and update the related tests.\"\n- \"I'm about to scaffold the CLI commands and helper functions.\"\n- \"Ok cool, so I've wrapped my head around the repo. Now digging into the API routes.\"\n- \"Config's looking tidy. Next up is patching helpers to keep things in sync.\"\n- \"Finished poking at the DB gateway. I will now chase down error handling.\"\n- \"Alright, build pipeline order is interesting. Checking how it reports failures.\"\n- \"Spotted a clever caching util; now hunting where it gets used.\"\n\n# Planning\n\nYou have access to a `todowrite` tool which tracks steps and progress and renders them to the user. Using the tool helps demonstrate that you've understood the task and convey how you're approaching it. Plans can help to make complex, ambiguous, or multi-phase work clearer and more collaborative for the user. A good plan should break the task into meaningful, logically ordered steps that are easy to verify as you go.\n\nNote that plans are not for padding out simple work with filler steps or stating the obvious. The content of your plan should not involve doing anything that you aren't capable of doing (i.e. don't try to test things that you can't test). Do not use plans for simple or single-step queries that you can just do or answer immediately.\n\nDo not repeat the full contents of the plan after a `todowrite` call \u2014 the harness already displays it. Instead, summarize the change made and highlight any important context or next step.\n\nBefore running a command, consider whether or not you have completed the previous step, and make sure to mark it as completed before moving on to the next step. It may be the case that you complete all steps in your plan after a single pass of implementation. If this is the case, you can simply mark all the planned steps as completed. Sometimes, you may need to change plans in the middle of a task: call `todowrite` with the updated plan and make sure to explain the rationale when doing so.\n\nUse a plan when:\n\n- The task is non-trivial and will require multiple actions over a long time horizon.\n- There are logical phases or dependencies where sequencing matters.\n- The work has ambiguity that benefits from outlining high-level goals.\n- You want intermediate checkpoints for feedback and validation.\n- When the user asked you to do more than one thing in a single prompt\n- The user has asked you to use the plan tool (aka \"TODOs\")\n- You generate additional steps while working, and plan to do them before yielding to the user\n\n## Examples\n\n**High-quality plans**\n\nExample 1:\n\n1. Add CLI entry with file args\n2. Parse Markdown via CommonMark library\n3. Apply semantic HTML template\n4. Handle code blocks, images, links\n5. Add error handling for invalid files\n\nExample 2:\n\n1. Define CSS variables for colors\n2. Add toggle with localStorage state\n3. Refactor components to use variables\n4. Verify all views for readability\n5. Add smooth theme-change transition\n\nExample 3:\n\n1. Set up Node.js + WebSocket server\n2. Add join/leave broadcast events\n3. Implement messaging with timestamps\n4. Add usernames + mention highlighting\n5. Persist messages in lightweight DB\n6. Add typing indicators + unread count\n\n**Low-quality plans**\n\nExample 1:\n\n1. Create CLI tool\n2. Add Markdown parser\n3. Convert to HTML\n\nExample 2:\n\n1. Add dark mode toggle\n2. Save preference\n3. Make styles look good\n\nExample 3:\n\n1. Create single-file HTML game\n2. Run quick sanity check\n3. Summarize usage instructions\n\nIf you need to write a plan, only write high quality plans, not low quality ones.\n\n## Plan mode and clarification (harness specifics)\n\n- For multi-step or risky work, enter plan mode (`/plan` or `--plan`) before editing. Explore read-only, then call `plan_write` with a decision-complete markdown plan (approach, rejected alternatives, verification, assumptions). Wait for user approval before implementing.\n- Prefer the durable plan file path over relying on chat memory after compaction.\n- When requirements are ambiguous, use the `question` tool with concrete options instead of guessing.\n- `todowrite` tracks execution steps (see its Tool Guidelines entry); it is not a substitute for a durable plan file.\n\n# Task execution\n\nYou are a coding agent. Please keep going until the query is completely resolved, before ending your turn and yielding back to the user. Only terminate your turn when you are sure that the problem is solved. Autonomously resolve the query to the best of your ability, using the tools available to you, before coming back to the user. Do NOT guess or make up an answer.\n\nYou MUST adhere to the following criteria when solving queries:\n\n- Working on the repo(s) in the current environment is allowed, even if they are proprietary.\n- Analyzing code for vulnerabilities is allowed.\n- Showing user code and tool call details is allowed.\n- Use the `edit` tool to modify existing files and the `write` tool to create new ones. This harness has no structured-patch tool \u2014 never try `apply_patch`, `applypatch`, or `apply-patch`.\n\nIf completing the user's task requires writing or modifying files, your code and final answer should follow these coding guidelines, though user instructions (i.e. AGENTS.md) may override these guidelines:\n\n- Fix the problem at the root cause rather than applying surface-level patches, when possible.\n- Avoid unneeded complexity in your solution.\n- Do not attempt to fix unrelated bugs or broken tests. It is not your responsibility to fix them. (You may mention them to the user in your final message though.)\n- Update documentation as necessary.\n- Keep changes consistent with the style of the existing codebase. Changes should be minimal and focused on the task.\n- Use `git log` and `git blame` to search the history of the codebase if additional context is required.\n- NEVER add copyright or license headers unless specifically requested.\n- Do not waste tokens by re-reading files after editing them. The tool call will fail if it didn't work. The same goes for making folders, deleting folders, etc.\n- Do not `git commit` your changes or create new git branches unless explicitly requested.\n- Do not add inline comments within code unless explicitly requested.\n- Do not use one-letter variable names unless explicitly requested.\n- NEVER output inline citations like \"\u3010F:README.md\u2020L5-L14\u3011\" in your outputs. The CLI is not able to render these so they will just be broken in the UI. Instead, if you output valid filepaths, users will be able to click on them to open the files in their editor.\n\n# Validating your work\n\nIf the codebase has tests or the ability to build or run, consider using them to verify that your work is complete.\n\nWhen testing, your philosophy should be to start as specific as possible to the code you changed so that you can catch issues efficiently, then make your way to broader tests as you build confidence. If there's no test for the code you changed, and if the adjacent patterns in the codebases show that there's a logical place for you to add a test, you may do so. However, do not add tests to codebases with no tests.\n\nSimilarly, once you're confident in correctness, you can suggest or use formatting commands to ensure that your code is well formatted. If there are issues you can iterate up to 3 times to get formatting right, but if you still can't manage it's better to save the user time and present them a correct solution where you call out the formatting in your final message. If the codebase does not have a formatter configured, do not add one.\n\nFor all of testing, running, building, and formatting, do not attempt to fix unrelated bugs. It is not your responsibility to fix them. (You may mention them to the user in your final message though.)\n\nBe mindful of whether to run validation commands proactively. In the absence of behavioral guidance:\n\n- When running in a non-interactive mode where edits are auto-approved (print/headless, or the `allow edits` permission mode), proactively run tests, lint and do whatever you need to ensure you've completed the task.\n- When working in interactive permission modes like `ask before edits` or `plan`, hold off on running tests or lint commands until the user is ready for you to finalize your output, because these commands take time to run and slow down iteration. Instead suggest what you want to do next, and let the user confirm first.\n- When working on test-related tasks, such as adding tests, fixing tests, or reproducing a bug to verify behavior, you may proactively run tests regardless of permission mode. Use your judgement to decide whether this is a test-related task.\n\n# Ambition vs. precision\n\nFor tasks that have no prior context (i.e. the user is starting something brand new), you should feel free to be ambitious and demonstrate creativity with your implementation.\n\nIf you're operating in an existing codebase, you should make sure you do exactly what the user asks with surgical precision. Treat the surrounding codebase with respect, and don't overstep (i.e. changing filenames or variables unnecessarily). You should balance being sufficiently ambitious and proactive when completing tasks of this nature.\n\nYou should use judicious initiative to decide on the right level of detail and complexity to deliver based on the user's needs. This means showing good judgment that you're capable of doing the right extras without gold-plating. This might be demonstrated by high-value, creative touches when scope of the task is vague; while being surgical and targeted when scope is tightly specified.\n\n# Sharing progress updates\n\nFor especially longer tasks that you work on (i.e. requiring many tool calls, or a plan with multiple steps), you should provide progress updates back to the user at reasonable intervals. These updates should be structured as a concise sentence or two (no more than 8-10 words long) recapping progress so far in plain language: this update demonstrates your understanding of what needs to be done, progress so far (i.e. files explores, subtasks complete), and where you're going next.\n\nBefore doing large chunks of work that may incur latency as experienced by the user (i.e. writing a new file), you should send a concise message to the user with an update indicating what you're about to do to ensure they know what you're spending time on. Don't start editing or writing large files before informing the user what you are doing and why.\n\nThe messages you send before tool calls should describe what is immediately about to be done next in very concise language. If there was previous work done, this preamble message should also include a note about the work done so far to bring the user along.\n\n# Presenting your work and final message\n\nYour final message should read naturally, like an update from a concise teammate. For casual conversation, brainstorming tasks, or quick questions from the user, respond in a friendly, conversational tone. You should ask questions, suggest ideas, and adapt to the user's style. If you've finished a large amount of work, when describing what you've done to the user, you should follow the final answer formatting guidelines to communicate substantive changes. You don't need to add structured formatting for one-word answers, greetings, or purely conversational exchanges.\n\nYou can skip heavy formatting for single, simple actions or confirmations. In these cases, respond in plain sentences with any relevant next step or quick option. Reserve multi-section structured responses for results that need grouping or explanation.\n\nThe user is working on the same computer as you, and has access to your work. As such there's no need to show the full contents of large files you have already written unless the user explicitly asks for them. Similarly, if you've created or modified files, there's no need to tell users to \"save the file\" or \"copy the code into a file\"\u2014just reference the file path.\n\nIf there's something that you think you could help with as a logical next step, concisely ask the user if they want you to do so. Good examples of this are running tests, committing changes, or building out the next logical component. If there's something that you couldn't do (even with approval) but that the user might want to do (such as verifying changes by running the app), include those instructions succinctly.\n\nBrevity is very important as a default. You should be very concise (i.e. no more than 10 lines), but can relax this requirement for tasks where additional detail and comprehensiveness is important for the user's understanding.\n\n## Final answer structure and style guidelines\n\nYou are producing plain text that will later be styled by the CLI. Follow these rules exactly. Formatting should make results easy to scan, but not feel mechanical. Use judgment to decide how much structure adds value.\n\n**Section Headers**\n\n- Use only when they improve clarity \u2014 they are not mandatory for every answer.\n- Choose descriptive names that fit the content\n- Keep headers short (1\u20133 words) and in `**Title Case**`. Always start headers with `**` and end with `**`\n- Leave no blank line before the first bullet under a header.\n- Section headers should only be used where they genuinely improve scanability; avoid fragmenting the answer.\n\n**Bullets**\n\n- Use `-` followed by a space for every bullet.\n- Merge related points when possible; avoid a bullet for every trivial detail.\n- Keep bullets to one line unless breaking for clarity is unavoidable.\n- Group into short lists (4\u20136 bullets) ordered by importance.\n- Use consistent keyword phrasing and formatting across sections.\n\n**Monospace**\n\n- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``).\n- Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command.\n- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``).\n\n**File References**\n\nWhen referencing files in your response, make sure to include the relevant start line and always follow the below rules:\n\n- Use inline code to make file paths clickable.\n- Each reference should have a stand alone path. Even if it's the same file.\n- Accepted: absolute, workspace\u2011relative, a/ or b/ diff prefixes, or bare filename/suffix.\n- Line/column (1\u2011based, optional): :line[:column] or #Lline[Ccolumn] (column defaults to 1).\n- Do not use URIs like file://, vscode://, or https://.\n- Do not provide range of lines\n- Examples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\\repo\\project\\main.rs:12:5\n\n**Structure**\n\n- Place related bullets together; don't mix unrelated concepts in the same section.\n- Order sections from general \u2192 specific \u2192 supporting info.\n- For subsections (e.g., \"Binaries\" under \"Rust Workspace\"), introduce with a bolded keyword bullet, then list items under it.\n- Match structure to complexity:\n - Multi-part or detailed results \u2192 use clear headers and grouped bullets.\n - Simple results \u2192 minimal headers, possibly just a short list or paragraph.\n\n**Tone**\n\n- Keep the voice collaborative and natural, like a coding partner handing off work.\n- Be concise and factual \u2014 no filler or conversational commentary and avoid unnecessary repetition\n- Use present tense and active voice (e.g., \"Runs tests\" not \"This will run tests\").\n- Keep descriptions self-contained; don't refer to \"above\" or \"below\".\n- Use parallel structure in lists for consistency.\n\n**Don't**\n\n- Don't use literal words \"bold\" or \"monospace\" in the content.\n- Don't nest bullets or create deep hierarchies.\n- Don't output ANSI escape codes directly \u2014 the CLI renderer applies them.\n- Don't cram unrelated keywords into a single bullet; split for clarity.\n- Don't let keyword lists run long \u2014 wrap or reformat for scanability.\n\nGenerally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what's needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable.\n\nFor casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting.\n\n# Professional objectivity\n\nPrioritize technical accuracy and truthfulness over validating the user's beliefs. Focus on facts and problem-solving. Be direct and objective without unnecessary praise or emotional validation. Disagree when needed. When uncertain, investigate before confirming the user's assumptions.\n\n# Proactiveness\n\nYou may be proactive, but only when the user asks you to do something. Strike a balance between:\n\n1. Doing the right thing when asked, including follow-up actions\n2. Not surprising the user with unrequested actions\n For example, if the user asks how to approach something, answer first; do not immediately jump into edits.\n\n# Following conventions\n\nWhen changing files, first understand the file's conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.\n\n- NEVER assume a library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses it (neighboring files, package.json, cargo.toml, go.mod, etc.).\n- When creating a new component, first look at existing components for framework choice, naming, typing, and other conventions.\n- When editing code, first look at surrounding context (especially imports) to understand chosen frameworks/libraries, then make the change idiomatically.\n- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.\n\n# Doing tasks\n\nThe user will primarily request software engineering tasks: bugs, features, refactors, explanations, and more. Recommended steps:\n\n- Use available search/read tools extensively to understand the codebase and the query (in parallel when independent).\n- Implement the solution with the tools available to you.\n- Prefer editing existing files over creating new ones. Do not create documentation or markdown files unless asked.\n- Verify when possible with tests. NEVER assume a specific test framework or script \u2014 check README / AGENTS.md or search the repo.\n- Run lint and typecheck commands (for example npm run lint, npm run typecheck, ruff, pnpm lint) if they were provided to you \u2014 see Validating your work for when to run them proactively vs. when to hold off. If you cannot find the correct command, ask the user, and if they supply it, proactively suggest writing it to AGENTS.md so you know next time.\n\n- Tool results and user messages may include <system-reminder> tags. Those tags contain useful reminders. They are NOT part of the user's provided input or the tool result.\n\n# Tool usage policy\n\n- Prefer specialized file tools over shell for reading, editing, writing, listing, and searching when those tools are available. Use the `grep`, `glob`, and `list` tools instead of bash for search and listing \u2014 they are ripgrep-backed and return structured, length-capped results. Use shell for real system commands (git, package managers, builds, tests, process control).\n- When doing broad codebase exploration, prefer a task/subagent tool if one is available to reduce context usage; otherwise use the available search tools.\n- You can call multiple tools in one response. When multiple independent pieces of information are needed, batch tool calls for performance. When making multiple bash tool calls, send a single message with multiple tool calls so they can run in parallel (for example git status and git diff together).\n- Match edit old-text exactly, including whitespace.\n- If a tool call is denied by policy, adapt: use an allowed approach or ask the user. Do not retry the same blocked call in a loop.\n\n## Shell commands\n\nWhen using the shell, you must adhere to the following guidelines:\n\n- When searching for text or files, prefer using `rg` or `rg --files` respectively because `rg` is much faster than alternatives like `grep` and `find`. (If the `rg` command is not found, then use alternatives.) Reach for the shell only when the `grep`/`glob` tools cannot express the query \u2014 for example counting matches, or piping results into another command.\n- Search narrow first: use `rg -l` or `rg -c` to find which files match, then read only those files. Do not dump full match bodies across a repo into context.\n- Never pipe a large file into your context. Do not `cat` a big file; use the `read` tool with an offset/limit, or `sed -n 'START,ENDp'` for a specific range.\n- Do not use python scripts to attempt to output larger chunks of a file.\n\n## `todowrite`\n\nA tool named `todowrite` is available to you. You can use it to keep an up-to-date, step-by-step plan for the task.\n\nTo create a new plan, call `todowrite` with a short list of 1-sentence steps (no more than 5-7 words each) with a `status` for each step (`pending`, `in_progress`, `completed`, or `cancelled`). The call is a full replace \u2014 always send the complete list, not a delta.\n\nWhen steps have been completed, use `todowrite` to mark each finished step as `completed` and the next step you are working on as `in_progress`. There should always be exactly one `in_progress` step until everything is done. You can mark multiple items as complete in a single `todowrite` call.\n\nIf all steps are complete, ensure you call `todowrite` to mark all steps as `completed`.\n\nIMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames and directory structure.\n\n# AGENTS.md spec\n\n- Repos often contain AGENTS.md files. These files can appear anywhere within the repository.\n- These files are a way for humans to give you (the agent) instructions or tips for working within the container.\n- Some examples might be: coding conventions, info about how code is organized, or instructions for how to run or test code.\n- Instructions in AGENTS.md files:\n - The scope of an AGENTS.md file is the entire directory tree rooted at the folder that contains it.\n - For every file you touch in the final change, you must obey instructions in any AGENTS.md file whose scope includes that file.\n - Instructions about code style, structure, naming, etc. apply only to code within the AGENTS.md file's scope, unless the file states otherwise.\n - More-deeply-nested AGENTS.md files take precedence in the case of conflicting instructions.\n - Direct system/developer/user instructions (as part of a prompt) take precedence over AGENTS.md instructions.\n- The contents of the AGENTS.md file at the root of the repo and the project directory are loaded into your context automatically and don't need to be re-read. AGENTS.md files in subdirectories are NOT loaded automatically: when working in a subdirectory, or a directory outside the CWD, check for any AGENTS.md files that may be applicable.\n\n# Permissions and safety\n\n- Never commit secrets or keys.\n- Never create a git commit unless the user explicitly asks.\n- Do not run destructive commands (mass delete, force-push, hard reset) unless the user clearly requested them.\n";
|
|
@@ -37680,10 +37632,10 @@ var require_dist = __commonJS({
|
|
|
37680
37632
|
var init_dist = __esm({
|
|
37681
37633
|
"../agent-core/dist/index.js"() {
|
|
37682
37634
|
"use strict";
|
|
37683
|
-
|
|
37635
|
+
init_chunk_BVWCFGFG();
|
|
37684
37636
|
init_chunk_OUQ7HMD3();
|
|
37685
37637
|
init_chunk_R32NAS3B();
|
|
37686
|
-
|
|
37638
|
+
init_chunk_NDAB5G24();
|
|
37687
37639
|
init_chunk_YXWJW7I5();
|
|
37688
37640
|
}
|
|
37689
37641
|
});
|
|
@@ -37775,7 +37727,7 @@ function within(root, path) {
|
|
|
37775
37727
|
}
|
|
37776
37728
|
async function resolveReal(path) {
|
|
37777
37729
|
try {
|
|
37778
|
-
return await (0,
|
|
37730
|
+
return await (0, import_promises20.realpath)(path);
|
|
37779
37731
|
} catch {
|
|
37780
37732
|
const parent = (0, import_path9.dirname)(path);
|
|
37781
37733
|
if (parent === path) return path;
|
|
@@ -37804,14 +37756,14 @@ function createWorkspaceFs(roots, writable) {
|
|
|
37804
37756
|
return {
|
|
37805
37757
|
read: async (params) => {
|
|
37806
37758
|
const path = await confined(params);
|
|
37807
|
-
const bytes = await (0,
|
|
37759
|
+
const bytes = await (0, import_promises20.readFile)(path);
|
|
37808
37760
|
if (bytes.byteLength > MAX_READ_BYTES) throw new FsDenied(`${path} is too large to read`);
|
|
37809
37761
|
return { content: sliceLines(bytes.toString("utf8"), params) };
|
|
37810
37762
|
},
|
|
37811
37763
|
write: async (params) => {
|
|
37812
37764
|
if (!writable) throw new FsDenied("This session is read-only");
|
|
37813
37765
|
const path = await confined(params);
|
|
37814
|
-
await (0,
|
|
37766
|
+
await (0, import_promises20.writeFile)(path, asString(params.content));
|
|
37815
37767
|
return {};
|
|
37816
37768
|
}
|
|
37817
37769
|
};
|
|
@@ -38356,7 +38308,7 @@ function isAcpBackendKind(value) {
|
|
|
38356
38308
|
return Object.hasOwn(ACP_PROFILES, value);
|
|
38357
38309
|
}
|
|
38358
38310
|
function envDigest3(env) {
|
|
38359
|
-
const hash2 = (0,
|
|
38311
|
+
const hash2 = (0, import_crypto12.createHash)("sha256");
|
|
38360
38312
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
38361
38313
|
return hash2.digest("hex");
|
|
38362
38314
|
}
|
|
@@ -38414,7 +38366,7 @@ async function acpTurnInput(run, context) {
|
|
|
38414
38366
|
const encoded = await Promise.all(
|
|
38415
38367
|
images.map(async (image) => ({
|
|
38416
38368
|
mimeType: image.mimeType,
|
|
38417
|
-
data: (await (0,
|
|
38369
|
+
data: (await (0, import_promises21.readFile)(image.path)).toString("base64")
|
|
38418
38370
|
}))
|
|
38419
38371
|
);
|
|
38420
38372
|
return {
|
|
@@ -38423,23 +38375,23 @@ async function acpTurnInput(run, context) {
|
|
|
38423
38375
|
...encoded.length ? { images: encoded, imagePaths: images.map((image) => image.path) } : {}
|
|
38424
38376
|
};
|
|
38425
38377
|
}
|
|
38426
|
-
var
|
|
38378
|
+
var import_promises20, import_path9, import_crypto12, import_promises21, CURSOR_ASK_QUESTION, copilotAcpProfile, cursorAcpProfile, MODEL_REJECTED, MAX_READ_BYTES, FsDenied, ENV_REFERENCE, AcpBackgroundTasks, CURSOR_CREATE_PLAN, STATUSES, READ_KINDS, ALLOW_KINDS, REJECT_KINDS, CANCELLED_PERMISSION, STOP_REASONS, CHUNKS, ECHOES, AcpTurn, STDERR_TAIL_LINES4, MAX_BETWEEN_UPDATES2, AcpSession, DEFAULTS3, CLIENT_INFO2, TASK_BACKGROUNDED, TASK_COMPLETED, SESSION_NOTIFICATION, KILLED_STATUSES, SUCCESS_STATUSES, SUBAGENT_ID, grokTaskDialect, grokAcpProfile, kimiAcpProfile, ACP_PROFILES, ACP_MODES;
|
|
38427
38379
|
var init_acp3 = __esm({
|
|
38428
38380
|
"../agent-core/dist/providers/acp.js"() {
|
|
38429
38381
|
"use strict";
|
|
38430
|
-
|
|
38382
|
+
init_chunk_BVWCFGFG();
|
|
38431
38383
|
init_chunk_OUQ7HMD3();
|
|
38432
38384
|
init_chunk_R32NAS3B();
|
|
38433
38385
|
init_chunk_J2KTV5FP();
|
|
38434
|
-
|
|
38435
|
-
|
|
38386
|
+
init_chunk_NDAB5G24();
|
|
38387
|
+
init_chunk_GXBS4QWA();
|
|
38436
38388
|
init_chunk_YXWJW7I5();
|
|
38437
|
-
|
|
38389
|
+
import_promises20 = require("fs/promises");
|
|
38438
38390
|
import_path9 = require("path");
|
|
38439
38391
|
init_effort();
|
|
38440
38392
|
init_acp();
|
|
38441
|
-
|
|
38442
|
-
|
|
38393
|
+
import_crypto12 = require("crypto");
|
|
38394
|
+
import_promises21 = require("fs/promises");
|
|
38443
38395
|
init_agent2();
|
|
38444
38396
|
CURSOR_ASK_QUESTION = "cursor/ask_question";
|
|
38445
38397
|
copilotAcpProfile = {
|
|
@@ -39963,7 +39915,7 @@ function createOpenCodeDriver(options = {}) {
|
|
|
39963
39915
|
await authorization?.remove();
|
|
39964
39916
|
};
|
|
39965
39917
|
const spec = { ...planned, env: launchEnv(planned, authorization) };
|
|
39966
|
-
const password = options.password?.() ?? (0,
|
|
39918
|
+
const password = options.password?.() ?? (0, import_crypto13.randomBytes)(24).toString("base64url");
|
|
39967
39919
|
const attempt = { abandoned: false };
|
|
39968
39920
|
const { session, url: url2 } = await withDeadline3(
|
|
39969
39921
|
startServer(spec, password, resolved, attempt),
|
|
@@ -40007,7 +39959,7 @@ function createOpenCodeDriver(options = {}) {
|
|
|
40007
39959
|
};
|
|
40008
39960
|
}
|
|
40009
39961
|
function envDigest4(env) {
|
|
40010
|
-
const hash2 = (0,
|
|
39962
|
+
const hash2 = (0, import_crypto14.createHash)("sha256");
|
|
40011
39963
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
40012
39964
|
return hash2.digest("hex");
|
|
40013
39965
|
}
|
|
@@ -40087,25 +40039,25 @@ function openCodeTurnInput(run, context) {
|
|
|
40087
40039
|
...images.length ? { imagePaths: images.map((image) => image.path) } : {}
|
|
40088
40040
|
};
|
|
40089
40041
|
}
|
|
40090
|
-
var import_http4,
|
|
40042
|
+
var import_http4, import_crypto13, import_path10, import_url2, import_crypto14, IDLE_SOCKET_MS2, OpenCodeHttpError, OpenCodeClient, OPENCODE_CONFIG_ENV, OPENCODE_ENGINE, TEXT_PARTS, STEP_PARTS, STOPPED_BY_USER, OpenCodeSubagents, NAMED_KINDS, OPENCODE_ABORTED_ERROR, PROVIDER_EVENT_META, TASK_TOOL_NAME, TASK_RESULT_TAG, TASK_ERROR_TAG, PERMISSION_DENIED, FILE_OPERATIONS, PartReader, NOTHING, NON_INTERACTIVE_PERMISSIONS, CONTENT_FILTER_FINISHES, OUTPUT_PARTS, OpenCodeTurn, LISTENING, OUTPUT_TAIL_LINES, IMAGE_TYPES, OpenCodeSession, OPENCODE_MIN_VERSION, OPENCODE_REQUIREMENT, OPENCODE_TESTED_LINE, OPENCODE_SUPPORTED_MAJOR, DEFAULTS4, STORE_LOCKED, NON_INTERACTIVE_RULES, TITLE_LENGTH, MAX_VARIANT_LENGTH;
|
|
40091
40043
|
var init_opencode = __esm({
|
|
40092
40044
|
"../agent-core/dist/providers/opencode.js"() {
|
|
40093
40045
|
"use strict";
|
|
40094
|
-
|
|
40046
|
+
init_chunk_BVWCFGFG();
|
|
40095
40047
|
init_chunk_OUQ7HMD3();
|
|
40096
40048
|
init_chunk_R32NAS3B();
|
|
40097
40049
|
init_chunk_J2KTV5FP();
|
|
40098
|
-
|
|
40099
|
-
|
|
40050
|
+
init_chunk_NDAB5G24();
|
|
40051
|
+
init_chunk_GXBS4QWA();
|
|
40100
40052
|
init_chunk_YXWJW7I5();
|
|
40101
40053
|
import_http4 = require("http");
|
|
40102
40054
|
init_runtime_v2();
|
|
40103
|
-
|
|
40055
|
+
import_crypto13 = require("crypto");
|
|
40104
40056
|
init_agent2();
|
|
40105
40057
|
import_path10 = require("path");
|
|
40106
40058
|
import_url2 = require("url");
|
|
40107
40059
|
init_acp();
|
|
40108
|
-
|
|
40060
|
+
import_crypto14 = require("crypto");
|
|
40109
40061
|
init_agent2();
|
|
40110
40062
|
IDLE_SOCKET_MS2 = 4e3;
|
|
40111
40063
|
OpenCodeHttpError = class extends Error {
|
|
@@ -41786,7 +41738,7 @@ function createDroidDriver(options = {}) {
|
|
|
41786
41738
|
};
|
|
41787
41739
|
}
|
|
41788
41740
|
function envDigest5(env) {
|
|
41789
|
-
const hash2 = (0,
|
|
41741
|
+
const hash2 = (0, import_crypto15.createHash)("sha256");
|
|
41790
41742
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
41791
41743
|
return hash2.digest("hex");
|
|
41792
41744
|
}
|
|
@@ -41841,25 +41793,25 @@ async function droidTurnInput(run, context) {
|
|
|
41841
41793
|
const encoded = await Promise.all(
|
|
41842
41794
|
images.map(async (image) => ({
|
|
41843
41795
|
mimeType: image.mimeType,
|
|
41844
|
-
data: (await (0,
|
|
41796
|
+
data: (await (0, import_promises22.readFile)(image.path)).toString("base64")
|
|
41845
41797
|
}))
|
|
41846
41798
|
);
|
|
41847
41799
|
return { turnId: run.runId, text: text2, ...encoded.length ? { images: encoded } : {} };
|
|
41848
41800
|
}
|
|
41849
|
-
var
|
|
41801
|
+
var import_crypto15, import_promises22, FACTORY_API_VERSION, FACTORY_PROTOCOL_VERSION, SUBAGENT_TOOLS, TASK_OUTPUT_TOOLS, TASK_STOP_TOOLS, SILENT2, DroidTurn, STDERR_TAIL_LINES5, UNSUPPORTED_REQUEST2, DroidSession, DEFAULTS5, DROID_REQUIREMENT, DROID_JSONRPC_ARGS;
|
|
41850
41802
|
var init_droid = __esm({
|
|
41851
41803
|
"../agent-core/dist/providers/droid.js"() {
|
|
41852
41804
|
"use strict";
|
|
41853
|
-
|
|
41805
|
+
init_chunk_BVWCFGFG();
|
|
41854
41806
|
init_chunk_OUQ7HMD3();
|
|
41855
41807
|
init_chunk_R32NAS3B();
|
|
41856
41808
|
init_chunk_J2KTV5FP();
|
|
41857
|
-
|
|
41858
|
-
|
|
41809
|
+
init_chunk_NDAB5G24();
|
|
41810
|
+
init_chunk_GXBS4QWA();
|
|
41859
41811
|
init_chunk_YXWJW7I5();
|
|
41860
41812
|
init_runtime_v2();
|
|
41861
|
-
|
|
41862
|
-
|
|
41813
|
+
import_crypto15 = require("crypto");
|
|
41814
|
+
import_promises22 = require("fs/promises");
|
|
41863
41815
|
init_agent2();
|
|
41864
41816
|
FACTORY_API_VERSION = "1.0.0";
|
|
41865
41817
|
FACTORY_PROTOCOL_VERSION = "1.187.0";
|
|
@@ -42364,7 +42316,7 @@ function antigravityArgs(input2, capabilities, prompt) {
|
|
|
42364
42316
|
}
|
|
42365
42317
|
function workspaceRoot(cwd) {
|
|
42366
42318
|
for (let current = (0, import_path11.resolve)(cwd); ; current = (0, import_path11.dirname)(current)) {
|
|
42367
|
-
if ((0,
|
|
42319
|
+
if ((0, import_fs8.existsSync)((0, import_path11.join)(current, ".git"))) return current;
|
|
42368
42320
|
if ((0, import_path11.dirname)(current) === current) return (0, import_path11.resolve)(cwd);
|
|
42369
42321
|
}
|
|
42370
42322
|
}
|
|
@@ -42374,7 +42326,7 @@ function instructionPaths(cwd) {
|
|
|
42374
42326
|
for (let current = (0, import_path11.resolve)(cwd); ; current = (0, import_path11.dirname)(current)) {
|
|
42375
42327
|
const path = (0, import_path11.join)(current, INSTRUCTIONS_FILE);
|
|
42376
42328
|
try {
|
|
42377
|
-
if ((0,
|
|
42329
|
+
if ((0, import_fs8.existsSync)(path) && (0, import_fs8.statSync)(path).isFile()) paths.unshift(path);
|
|
42378
42330
|
} catch {
|
|
42379
42331
|
}
|
|
42380
42332
|
if (current === root || (0, import_path11.dirname)(current) === current) return paths;
|
|
@@ -42388,7 +42340,7 @@ function antigravityWorkspaceInstructions(cwd, maxChars = MAX_INSTRUCTION_CHARS)
|
|
|
42388
42340
|
if (remaining <= 0) break;
|
|
42389
42341
|
let content;
|
|
42390
42342
|
try {
|
|
42391
|
-
content = (0,
|
|
42343
|
+
content = (0, import_fs8.readFileSync)(path, "utf8").trim();
|
|
42392
42344
|
} catch {
|
|
42393
42345
|
continue;
|
|
42394
42346
|
}
|
|
@@ -42869,7 +42821,7 @@ ${output2.stderr}`).join("\n")
|
|
|
42869
42821
|
};
|
|
42870
42822
|
}
|
|
42871
42823
|
function envDigest6(env) {
|
|
42872
|
-
const hash2 = (0,
|
|
42824
|
+
const hash2 = (0, import_crypto16.createHash)("sha256");
|
|
42873
42825
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
42874
42826
|
return hash2.digest("hex");
|
|
42875
42827
|
}
|
|
@@ -42915,23 +42867,23 @@ function antigravityTurnInput(run, context) {
|
|
|
42915
42867
|
});
|
|
42916
42868
|
return { turnId: run.runId, text: appendImagePathReferences(text2, images) };
|
|
42917
42869
|
}
|
|
42918
|
-
var
|
|
42870
|
+
var import_fs8, import_path11, import_path12, import_url3, import_crypto16, NO_ANTIGRAVITY_CAPABILITIES, INSTRUCTIONS_FILE, MAX_INSTRUCTION_CHARS, SHORTENED_NOTE, DIFF_BLOCK_START, DIFF_BLOCK_END, HUNK_HEADER, TRANSCRIPT_FILE, FULL_TRANSCRIPT_FILE, LOG_DIRS, TOOL_RESULT_TYPES, BrainTranscript, AntigravityTranscripts, ANTIGRAVITY_GRAMMAR_NAME, AntigravityGrammar, ignored, HANDLERS, SUCCESSFUL_STATUSES, SESSION_START_TYPES, RESULT_TYPES, SUBAGENT_START_TYPES, RESUME_FORKED, AntigravityTurn, DEFAULTS6, AntigravitySession, WINDOWS_LINE_MARGIN;
|
|
42919
42871
|
var init_antigravity = __esm({
|
|
42920
42872
|
"../agent-core/dist/providers/antigravity.js"() {
|
|
42921
42873
|
"use strict";
|
|
42922
42874
|
init_chunk_LR52JUGL();
|
|
42923
|
-
|
|
42875
|
+
init_chunk_BVWCFGFG();
|
|
42924
42876
|
init_chunk_OUQ7HMD3();
|
|
42925
42877
|
init_chunk_R32NAS3B();
|
|
42926
|
-
|
|
42927
|
-
|
|
42878
|
+
init_chunk_NDAB5G24();
|
|
42879
|
+
init_chunk_GXBS4QWA();
|
|
42928
42880
|
init_chunk_YXWJW7I5();
|
|
42929
|
-
|
|
42881
|
+
import_fs8 = require("fs");
|
|
42930
42882
|
import_path11 = require("path");
|
|
42931
42883
|
init_effort();
|
|
42932
42884
|
import_path12 = require("path");
|
|
42933
42885
|
import_url3 = require("url");
|
|
42934
|
-
|
|
42886
|
+
import_crypto16 = require("crypto");
|
|
42935
42887
|
init_agent2();
|
|
42936
42888
|
NO_ANTIGRAVITY_CAPABILITIES = {
|
|
42937
42889
|
structuredPrint: false,
|
|
@@ -43417,7 +43369,7 @@ function parseConfig(raw) {
|
|
|
43417
43369
|
}
|
|
43418
43370
|
async function writeCommandCodeProjectMcp(cwd, mcp) {
|
|
43419
43371
|
const path = (0, import_path13.join)(cwd, ".mcp.json");
|
|
43420
|
-
const original = await (0,
|
|
43372
|
+
const original = await (0, import_promises23.readFile)(path, "utf8").catch(() => null);
|
|
43421
43373
|
const config2 = parseConfig(original);
|
|
43422
43374
|
const next = {
|
|
43423
43375
|
...config2,
|
|
@@ -43434,12 +43386,12 @@ async function writeCommandCodeProjectMcp(cwd, mcp) {
|
|
|
43434
43386
|
}
|
|
43435
43387
|
}
|
|
43436
43388
|
};
|
|
43437
|
-
await (0,
|
|
43438
|
-
await (0,
|
|
43389
|
+
await (0, import_promises23.mkdir)(cwd, { recursive: true });
|
|
43390
|
+
await (0, import_promises23.writeFile)(path, `${JSON.stringify(next, null, 2)}
|
|
43439
43391
|
`);
|
|
43440
43392
|
return async () => {
|
|
43441
|
-
if (original === null) await (0,
|
|
43442
|
-
else await (0,
|
|
43393
|
+
if (original === null) await (0, import_promises23.rm)(path, { force: true });
|
|
43394
|
+
else await (0, import_promises23.writeFile)(path, original);
|
|
43443
43395
|
};
|
|
43444
43396
|
}
|
|
43445
43397
|
function commandCodeString(value) {
|
|
@@ -43548,7 +43500,7 @@ function createCommandCodeDriver(options = {}) {
|
|
|
43548
43500
|
};
|
|
43549
43501
|
}
|
|
43550
43502
|
function envDigest7(env) {
|
|
43551
|
-
const hash2 = (0,
|
|
43503
|
+
const hash2 = (0, import_crypto17.createHash)("sha256");
|
|
43552
43504
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
43553
43505
|
return hash2.digest("hex");
|
|
43554
43506
|
}
|
|
@@ -43600,22 +43552,22 @@ function commandCodeTurnInput(run, context) {
|
|
|
43600
43552
|
});
|
|
43601
43553
|
return { turnId: run.runId, text: appendImagePathReferences(text2, images) };
|
|
43602
43554
|
}
|
|
43603
|
-
var
|
|
43555
|
+
var import_promises23, import_path13, import_crypto17, COMMAND_CODE_GRAMMAR_NAME, SILENT3, CommandCodeGrammar, CommandCodeTurn, COMMAND_CODE_MAX_TURNS, DEFAULTS7, CommandCodeSession;
|
|
43604
43556
|
var init_command_code = __esm({
|
|
43605
43557
|
"../agent-core/dist/providers/command-code.js"() {
|
|
43606
43558
|
"use strict";
|
|
43607
|
-
|
|
43559
|
+
init_chunk_BVWCFGFG();
|
|
43608
43560
|
init_chunk_OUQ7HMD3();
|
|
43609
43561
|
init_chunk_R32NAS3B();
|
|
43610
43562
|
init_chunk_J2KTV5FP();
|
|
43611
|
-
|
|
43612
|
-
|
|
43563
|
+
init_chunk_NDAB5G24();
|
|
43564
|
+
init_chunk_GXBS4QWA();
|
|
43613
43565
|
init_chunk_YXWJW7I5();
|
|
43614
|
-
|
|
43566
|
+
import_promises23 = require("fs/promises");
|
|
43615
43567
|
import_path13 = require("path");
|
|
43616
43568
|
init_agent2();
|
|
43617
43569
|
init_runtime_v2();
|
|
43618
|
-
|
|
43570
|
+
import_crypto17 = require("crypto");
|
|
43619
43571
|
init_agent2();
|
|
43620
43572
|
COMMAND_CODE_GRAMMAR_NAME = "command_code_cli";
|
|
43621
43573
|
SILENT3 = /* @__PURE__ */ new Set([
|
|
@@ -44487,7 +44439,7 @@ var GitFault = class extends Error {
|
|
|
44487
44439
|
var import_node_child_process = require("child_process");
|
|
44488
44440
|
|
|
44489
44441
|
// ../agent-core/dist/process.js
|
|
44490
|
-
|
|
44442
|
+
init_chunk_NDAB5G24();
|
|
44491
44443
|
init_chunk_YXWJW7I5();
|
|
44492
44444
|
|
|
44493
44445
|
// src/capabilities/git/run-git.ts
|
|
@@ -44668,7 +44620,7 @@ function createGitRunner(options) {
|
|
|
44668
44620
|
|
|
44669
44621
|
// src/platform/credential-store/credential-store.ts
|
|
44670
44622
|
var import_node_crypto3 = require("crypto");
|
|
44671
|
-
var
|
|
44623
|
+
var import_promises7 = require("fs/promises");
|
|
44672
44624
|
|
|
44673
44625
|
// src/platform/credential-store/parse.ts
|
|
44674
44626
|
function parseStoredJson(text2, schema) {
|
|
@@ -44817,7 +44769,7 @@ function createFileCredentialStore(path) {
|
|
|
44817
44769
|
kind: "file",
|
|
44818
44770
|
read: (schema) => readJsonFile(path, schema),
|
|
44819
44771
|
write: (value) => writeJsonFileAtomic(path, value),
|
|
44820
|
-
clear: () => (0,
|
|
44772
|
+
clear: () => (0, import_promises7.rm)(path, { force: true })
|
|
44821
44773
|
};
|
|
44822
44774
|
}
|
|
44823
44775
|
var KEYCHAIN_SERVICE = "ai.tryalan.runtime";
|
|
@@ -44912,14 +44864,14 @@ function defaultCredentialStoreKind(platform) {
|
|
|
44912
44864
|
var import_node_child_process3 = require("child_process");
|
|
44913
44865
|
var import_node_crypto4 = require("crypto");
|
|
44914
44866
|
var import_node_fs3 = require("fs");
|
|
44915
|
-
var
|
|
44867
|
+
var import_promises9 = require("fs/promises");
|
|
44916
44868
|
var import_node_path3 = require("path");
|
|
44917
44869
|
var import_node_util2 = require("util");
|
|
44918
44870
|
init_zod();
|
|
44919
44871
|
|
|
44920
44872
|
// src/platform/process-identity.ts
|
|
44921
44873
|
var import_node_child_process2 = require("child_process");
|
|
44922
|
-
var
|
|
44874
|
+
var import_promises8 = require("fs/promises");
|
|
44923
44875
|
var import_node_util = require("util");
|
|
44924
44876
|
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process2.execFile);
|
|
44925
44877
|
function isProcessAlive(pid) {
|
|
@@ -44931,13 +44883,13 @@ function isProcessAlive(pid) {
|
|
|
44931
44883
|
}
|
|
44932
44884
|
}
|
|
44933
44885
|
async function linuxStartTime(pid) {
|
|
44934
|
-
const stat12 = await (0,
|
|
44886
|
+
const stat12 = await (0, import_promises8.readFile)(`/proc/${pid}/stat`, "utf8").catch(() => null);
|
|
44935
44887
|
if (stat12 === null) return null;
|
|
44936
44888
|
const fields = stat12.slice(stat12.lastIndexOf(")") + 2).split(" ");
|
|
44937
44889
|
return fields[19] ?? null;
|
|
44938
44890
|
}
|
|
44939
44891
|
async function linuxCommand(pid) {
|
|
44940
|
-
const raw = await (0,
|
|
44892
|
+
const raw = await (0, import_promises8.readFile)(`/proc/${pid}/cmdline`, "utf8").catch(() => null);
|
|
44941
44893
|
return raw === null ? null : normalizeCommand(raw.replaceAll("\0", " "));
|
|
44942
44894
|
}
|
|
44943
44895
|
async function darwinCommand(pid) {
|
|
@@ -45110,13 +45062,13 @@ function runtimePaths(stateDir) {
|
|
|
45110
45062
|
|
|
45111
45063
|
// src/platform/process-memory.ts
|
|
45112
45064
|
var import_node_child_process4 = require("child_process");
|
|
45113
|
-
var
|
|
45065
|
+
var import_promises10 = require("fs/promises");
|
|
45114
45066
|
var import_node_util3 = require("util");
|
|
45115
45067
|
var execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process4.execFile);
|
|
45116
45068
|
var PROBE_TIMEOUT_MS = 2e3;
|
|
45117
45069
|
async function readProcessRss(pid) {
|
|
45118
45070
|
if (process.platform === "linux") {
|
|
45119
|
-
const status = await (0,
|
|
45071
|
+
const status = await (0, import_promises10.readFile)(`/proc/${pid}/status`, "utf8").catch(() => null);
|
|
45120
45072
|
const kilobytes = status === null ? void 0 : /^VmRSS:\s+(\d+)\s+kB$/m.exec(status)?.[1];
|
|
45121
45073
|
return kilobytes === void 0 ? null : Number(kilobytes) * 1024;
|
|
45122
45074
|
}
|
|
@@ -45133,7 +45085,7 @@ async function readProcessRss(pid) {
|
|
|
45133
45085
|
}
|
|
45134
45086
|
|
|
45135
45087
|
// src/platform/runtime-host.ts
|
|
45136
|
-
var
|
|
45088
|
+
var import_promises11 = require("fs/promises");
|
|
45137
45089
|
var RUNTIME_HOST_KINDS = ["app", "standalone"];
|
|
45138
45090
|
|
|
45139
45091
|
// src/platform/service/exec.ts
|
|
@@ -45172,7 +45124,7 @@ init_alan_code();
|
|
|
45172
45124
|
|
|
45173
45125
|
// src/capabilities/providers/commands.ts
|
|
45174
45126
|
var import_node_fs5 = require("fs");
|
|
45175
|
-
var
|
|
45127
|
+
var import_promises15 = require("fs/promises");
|
|
45176
45128
|
var import_node_path6 = require("path");
|
|
45177
45129
|
var PROVIDER_COMMANDS = [
|
|
45178
45130
|
// The engine, not a CLI of its own: `resolveProviderExecutable` finds the bundled one first.
|
|
@@ -45206,8 +45158,8 @@ function pathDelimiter(platform) {
|
|
|
45206
45158
|
}
|
|
45207
45159
|
async function isRunnable(path, platform) {
|
|
45208
45160
|
try {
|
|
45209
|
-
if (!(await (0,
|
|
45210
|
-
if (platform !== "win32") await (0,
|
|
45161
|
+
if (!(await (0, import_promises15.stat)(path)).isFile()) return false;
|
|
45162
|
+
if (platform !== "win32") await (0, import_promises15.access)(path, import_node_fs5.constants.X_OK);
|
|
45211
45163
|
return true;
|
|
45212
45164
|
} catch {
|
|
45213
45165
|
return false;
|
|
@@ -45252,7 +45204,7 @@ function resolveProviderExecutable(provider4, env, platform) {
|
|
|
45252
45204
|
// ../shared/dist/node/skill-package.js
|
|
45253
45205
|
var import_node_buffer = require("buffer");
|
|
45254
45206
|
var import_node_crypto6 = require("crypto");
|
|
45255
|
-
var
|
|
45207
|
+
var import_promises16 = require("fs/promises");
|
|
45256
45208
|
var import_node_path7 = require("path");
|
|
45257
45209
|
var import_yaml = __toESM(require_dist(), 1);
|
|
45258
45210
|
init_contracts();
|
|
@@ -45342,11 +45294,11 @@ async function inspectSkillPackage(packageRoot, options = {}) {
|
|
|
45342
45294
|
};
|
|
45343
45295
|
}
|
|
45344
45296
|
async function requirePackageRoot(packageRoot) {
|
|
45345
|
-
const root = await (0,
|
|
45297
|
+
const root = await (0, import_promises16.realpath)((0, import_node_path7.resolve)(packageRoot)).catch(() => null);
|
|
45346
45298
|
if (!root) {
|
|
45347
45299
|
throw new SkillPackageError("INVALID_PACKAGE_ROOT", "Skill package directory does not exist");
|
|
45348
45300
|
}
|
|
45349
|
-
const rootStat = await (0,
|
|
45301
|
+
const rootStat = await (0, import_promises16.lstat)(root);
|
|
45350
45302
|
if (!rootStat.isDirectory()) {
|
|
45351
45303
|
throw new SkillPackageError("INVALID_PACKAGE_ROOT", "Skill package root must be a directory");
|
|
45352
45304
|
}
|
|
@@ -45366,13 +45318,13 @@ async function walkPackage(root, ignoredPaths) {
|
|
|
45366
45318
|
}
|
|
45367
45319
|
return files;
|
|
45368
45320
|
async function walkDirectory(directory) {
|
|
45369
|
-
const entries = await (0,
|
|
45321
|
+
const entries = await (0, import_promises16.readdir)(directory, { withFileTypes: true });
|
|
45370
45322
|
for (const entry of entries) {
|
|
45371
45323
|
const absolutePath = (0, import_node_path7.resolve)(directory, entry.name);
|
|
45372
45324
|
const normalizedPath = normalizeRelativePath(root, absolutePath);
|
|
45373
45325
|
if (isIgnored(normalizedPath, entry.name, entry.isDirectory(), ignored2))
|
|
45374
45326
|
continue;
|
|
45375
|
-
const entryStat = await (0,
|
|
45327
|
+
const entryStat = await (0, import_promises16.lstat)(absolutePath);
|
|
45376
45328
|
if (entryStat.isSymbolicLink()) {
|
|
45377
45329
|
throw new SkillPackageError("SYMLINK_BLOCKED", `Nested symbolic links are not allowed in Skill packages: ${normalizedPath}`, normalizedPath);
|
|
45378
45330
|
}
|
|
@@ -45481,7 +45433,7 @@ function isSecretPath(path) {
|
|
|
45481
45433
|
return name.endsWith(".private-key.pem") || name.endsWith(".private-key.key");
|
|
45482
45434
|
}
|
|
45483
45435
|
async function readPackageFile(file2) {
|
|
45484
|
-
const bytes = await (0,
|
|
45436
|
+
const bytes = await (0, import_promises16.readFile)(file2.absolutePath);
|
|
45485
45437
|
return {
|
|
45486
45438
|
bytes,
|
|
45487
45439
|
manifest: {
|
|
@@ -45651,7 +45603,7 @@ function uint642(value) {
|
|
|
45651
45603
|
}
|
|
45652
45604
|
|
|
45653
45605
|
// src/capabilities/skills/store.ts
|
|
45654
|
-
var
|
|
45606
|
+
var import_promises17 = require("fs/promises");
|
|
45655
45607
|
var import_node_path8 = require("path");
|
|
45656
45608
|
init_runtime_v2();
|
|
45657
45609
|
init_zod();
|
|
@@ -45693,7 +45645,7 @@ async function readLocalSkills(layout) {
|
|
|
45693
45645
|
async function isLocalSkillCurrent(entry, contentHash, ignoredPaths) {
|
|
45694
45646
|
if (entry.contentHash !== contentHash) return false;
|
|
45695
45647
|
try {
|
|
45696
|
-
if (await (0,
|
|
45648
|
+
if (await (0, import_promises17.realpath)(entry.path) !== entry.path) return false;
|
|
45697
45649
|
const inspected = await inspectSkillPackage(entry.path, { expectedName: null, ignoredPaths });
|
|
45698
45650
|
return inspected.contentHash === contentHash;
|
|
45699
45651
|
} catch {
|
|
@@ -45708,7 +45660,7 @@ async function resolveLocalSkill(local, invocation) {
|
|
|
45708
45660
|
}
|
|
45709
45661
|
async function hasSkillFile(directory) {
|
|
45710
45662
|
try {
|
|
45711
|
-
return (await (0,
|
|
45663
|
+
return (await (0, import_promises17.stat)((0, import_node_path8.join)(directory, "SKILL.md"))).isFile();
|
|
45712
45664
|
} catch {
|
|
45713
45665
|
return false;
|
|
45714
45666
|
}
|
|
@@ -45752,7 +45704,7 @@ async function resolveSkillInvocations(layout, invocations) {
|
|
|
45752
45704
|
var import_node_path11 = require("path");
|
|
45753
45705
|
|
|
45754
45706
|
// src/capabilities/workspace/approved-paths.ts
|
|
45755
|
-
var
|
|
45707
|
+
var import_promises18 = require("fs/promises");
|
|
45756
45708
|
init_zod();
|
|
45757
45709
|
|
|
45758
45710
|
// src/capabilities/workspace/paths.ts
|
|
@@ -45790,7 +45742,7 @@ var storeSchema = external_exports.object({
|
|
|
45790
45742
|
});
|
|
45791
45743
|
async function realpathOrNull(path) {
|
|
45792
45744
|
try {
|
|
45793
|
-
return await (0,
|
|
45745
|
+
return await (0, import_promises18.realpath)(path);
|
|
45794
45746
|
} catch (error61) {
|
|
45795
45747
|
const code = errnoCode(error61);
|
|
45796
45748
|
if (code === "ENOENT" || code === "ENOTDIR" || code === "EACCES" || code === "EPERM") {
|
|
@@ -45850,7 +45802,7 @@ async function openApprovedPaths(options) {
|
|
|
45850
45802
|
|
|
45851
45803
|
// src/capabilities/workspace/locks.ts
|
|
45852
45804
|
var import_node_crypto7 = require("crypto");
|
|
45853
|
-
var
|
|
45805
|
+
var import_promises19 = require("fs/promises");
|
|
45854
45806
|
var import_node_path10 = require("path");
|
|
45855
45807
|
init_zod();
|
|
45856
45808
|
var LOCK_FORMAT = 1;
|
|
@@ -45871,7 +45823,7 @@ function repositoryLockKey(commonDir, platform) {
|
|
|
45871
45823
|
async function readOwner(path) {
|
|
45872
45824
|
let text2;
|
|
45873
45825
|
try {
|
|
45874
|
-
text2 = await (0,
|
|
45826
|
+
text2 = await (0, import_promises19.readFile)(path, "utf8");
|
|
45875
45827
|
} catch (error61) {
|
|
45876
45828
|
if (errnoCode(error61) === "ENOENT") return { kind: "missing" };
|
|
45877
45829
|
return { kind: "unreadable" };
|
|
@@ -45892,7 +45844,7 @@ async function removeIfSame(path, expected) {
|
|
|
45892
45844
|
if (current.kind !== "owner" || current.owner.since !== expected.since) return;
|
|
45893
45845
|
if (current.owner.pid !== expected.pid || current.owner.holder !== expected.holder) return;
|
|
45894
45846
|
}
|
|
45895
|
-
await (0,
|
|
45847
|
+
await (0, import_promises19.unlink)(path).catch((error61) => {
|
|
45896
45848
|
if (errnoCode(error61) !== "ENOENT") throw error61;
|
|
45897
45849
|
});
|
|
45898
45850
|
}
|
|
@@ -45917,7 +45869,7 @@ function openRepositoryLocks(options) {
|
|
|
45917
45869
|
await removeIfSame(path, read.owner);
|
|
45918
45870
|
return null;
|
|
45919
45871
|
}
|
|
45920
|
-
const age = await (0,
|
|
45872
|
+
const age = await (0, import_promises19.stat)(path).then(
|
|
45921
45873
|
(info) => clock.now() - info.mtimeMs,
|
|
45922
45874
|
() => 0
|
|
45923
45875
|
);
|
|
@@ -45932,12 +45884,12 @@ function openRepositoryLocks(options) {
|
|
|
45932
45884
|
const folder = async (commonDir) => {
|
|
45933
45885
|
const key = repositoryLockKey(commonDir, platform);
|
|
45934
45886
|
const dir = (0, import_node_path10.join)(options.dir, key);
|
|
45935
|
-
await (0,
|
|
45887
|
+
await (0, import_promises19.mkdir)(dir, { recursive: true, mode: 448 });
|
|
45936
45888
|
return { key, dir };
|
|
45937
45889
|
};
|
|
45938
45890
|
const createExclusive = async (path, owner) => {
|
|
45939
45891
|
try {
|
|
45940
|
-
const handle = await (0,
|
|
45892
|
+
const handle = await (0, import_promises19.open)(path, "wx", 384);
|
|
45941
45893
|
try {
|
|
45942
45894
|
await handle.writeFile(JSON.stringify(owner));
|
|
45943
45895
|
} finally {
|
|
@@ -45950,7 +45902,7 @@ function openRepositoryLocks(options) {
|
|
|
45950
45902
|
}
|
|
45951
45903
|
};
|
|
45952
45904
|
const liveRun = async (dir) => {
|
|
45953
|
-
const entries = await (0,
|
|
45905
|
+
const entries = await (0, import_promises19.readdir)(dir);
|
|
45954
45906
|
for (const entry of entries) {
|
|
45955
45907
|
if (!entry.startsWith(RUN_FILE_PREFIX)) continue;
|
|
45956
45908
|
const holder = await heldBy((0, import_node_path10.join)(dir, entry));
|
|
@@ -46016,7 +45968,7 @@ function defaultInstallDir({ platform, home, env }) {
|
|
|
46016
45968
|
|
|
46017
45969
|
// src/sessions/index.ts
|
|
46018
45970
|
var import_node_crypto10 = require("crypto");
|
|
46019
|
-
var
|
|
45971
|
+
var import_promises30 = require("fs/promises");
|
|
46020
45972
|
var import_node_os6 = require("os");
|
|
46021
45973
|
var import_node_path20 = require("path");
|
|
46022
45974
|
|
|
@@ -46202,7 +46154,7 @@ function createConversationMcpAuthorization(options) {
|
|
|
46202
46154
|
}
|
|
46203
46155
|
|
|
46204
46156
|
// src/holder/run-inputs.ts
|
|
46205
|
-
var
|
|
46157
|
+
var import_promises24 = require("fs/promises");
|
|
46206
46158
|
var import_node_path13 = require("path");
|
|
46207
46159
|
var NO_RUN_INPUTS = {
|
|
46208
46160
|
attachments: [],
|
|
@@ -46218,16 +46170,16 @@ function safeFilename(filename) {
|
|
|
46218
46170
|
async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [] }) {
|
|
46219
46171
|
const dir = (0, import_node_path13.join)(tmpDir, "runs", spec.runId);
|
|
46220
46172
|
const cleanup = async () => {
|
|
46221
|
-
await (0,
|
|
46173
|
+
await (0, import_promises24.rm)(dir, { recursive: true, force: true });
|
|
46222
46174
|
};
|
|
46223
46175
|
try {
|
|
46224
46176
|
const credential = await source.fetchProviderCredential(spec.runId, signal);
|
|
46225
46177
|
const attachments = [];
|
|
46226
|
-
if (spec.attachments?.length) await (0,
|
|
46178
|
+
if (spec.attachments?.length) await (0, import_promises24.mkdir)(dir, { recursive: true, mode: 448 });
|
|
46227
46179
|
for (const [index, attachment] of (spec.attachments ?? []).entries()) {
|
|
46228
46180
|
const bytes = await source.downloadAttachment(spec.runId, attachment.id, signal);
|
|
46229
46181
|
const path = (0, import_node_path13.join)(dir, `${index}-${safeFilename(attachment.filename)}`);
|
|
46230
|
-
await (0,
|
|
46182
|
+
await (0, import_promises24.writeFile)(path, bytes, { mode: 384 });
|
|
46231
46183
|
attachments.push({
|
|
46232
46184
|
id: attachment.id,
|
|
46233
46185
|
kind: attachment.kind,
|
|
@@ -46255,7 +46207,7 @@ init_runtime_v2();
|
|
|
46255
46207
|
|
|
46256
46208
|
// src/holder/admission.ts
|
|
46257
46209
|
var import_node_fs7 = require("fs");
|
|
46258
|
-
var
|
|
46210
|
+
var import_promises27 = require("fs/promises");
|
|
46259
46211
|
var import_node_os5 = require("os");
|
|
46260
46212
|
var import_node_path17 = require("path");
|
|
46261
46213
|
init_constants();
|
|
@@ -46269,7 +46221,7 @@ function resolveAlanDefaultWorkspacePath(homeDirectory = (0, import_node_os4.hom
|
|
|
46269
46221
|
}
|
|
46270
46222
|
|
|
46271
46223
|
// src/holder/admission-relocation.ts
|
|
46272
|
-
var
|
|
46224
|
+
var import_promises25 = require("fs/promises");
|
|
46273
46225
|
var import_node_path15 = require("path");
|
|
46274
46226
|
var MAX_RELOCATION_CANDIDATES = 200;
|
|
46275
46227
|
var RELOCATION_BUDGET_MS = 2e4;
|
|
@@ -46305,7 +46257,7 @@ async function originIdentity(git, path, signal) {
|
|
|
46305
46257
|
}
|
|
46306
46258
|
async function childDirectories(parent, limit) {
|
|
46307
46259
|
try {
|
|
46308
|
-
const entries = await (0,
|
|
46260
|
+
const entries = await (0, import_promises25.readdir)(parent, { withFileTypes: true });
|
|
46309
46261
|
return entries.filter((entry) => entry.isDirectory()).slice(0, limit).map((entry) => (0, import_node_path15.join)(parent, entry.name));
|
|
46310
46262
|
} catch {
|
|
46311
46263
|
return [];
|
|
@@ -46341,7 +46293,7 @@ async function discoverRelocatedWorkspace(search) {
|
|
|
46341
46293
|
}
|
|
46342
46294
|
|
|
46343
46295
|
// src/holder/lease.ts
|
|
46344
|
-
var
|
|
46296
|
+
var import_promises26 = require("fs/promises");
|
|
46345
46297
|
var import_node_path16 = require("path");
|
|
46346
46298
|
var LEASE_CHECK_EVERY_MS = 5e3;
|
|
46347
46299
|
var MAX_TRANSIENT_FAILURES = 3;
|
|
@@ -46356,8 +46308,8 @@ function identityFailure(code, workspacePath) {
|
|
|
46356
46308
|
return { code, problemCode: "app.workspace.missing", message: MESSAGES[code], workspacePath };
|
|
46357
46309
|
}
|
|
46358
46310
|
async function fileIdentity(path) {
|
|
46359
|
-
const canonical = await (0,
|
|
46360
|
-
const info = await (0,
|
|
46311
|
+
const canonical = await (0, import_promises26.realpath)(path);
|
|
46312
|
+
const info = await (0, import_promises26.stat)(canonical, { bigint: true });
|
|
46361
46313
|
return `${canonical}:${info.dev}:${info.ino}`;
|
|
46362
46314
|
}
|
|
46363
46315
|
async function snapshot(git, path, signal) {
|
|
@@ -46376,7 +46328,7 @@ async function snapshot(git, path, signal) {
|
|
|
46376
46328
|
workspace: await fileIdentity(path),
|
|
46377
46329
|
repository: await fileIdentity(commonDir),
|
|
46378
46330
|
worktree: await fileIdentity(gitDir),
|
|
46379
|
-
commonDir: await (0,
|
|
46331
|
+
commonDir: await (0, import_promises26.realpath)(commonDir)
|
|
46380
46332
|
};
|
|
46381
46333
|
} catch {
|
|
46382
46334
|
return null;
|
|
@@ -46389,7 +46341,7 @@ async function gitValue(git, path, args, signal) {
|
|
|
46389
46341
|
}
|
|
46390
46342
|
async function pathExists(path) {
|
|
46391
46343
|
try {
|
|
46392
|
-
await (0,
|
|
46344
|
+
await (0, import_promises26.stat)(path);
|
|
46393
46345
|
return true;
|
|
46394
46346
|
} catch (error61) {
|
|
46395
46347
|
return errnoCode(error61) !== "ENOENT" && errnoCode(error61) !== "ENOTDIR";
|
|
@@ -46398,13 +46350,13 @@ async function pathExists(path) {
|
|
|
46398
46350
|
async function hasGitMarker(path) {
|
|
46399
46351
|
let directory;
|
|
46400
46352
|
try {
|
|
46401
|
-
directory = await (0,
|
|
46353
|
+
directory = await (0, import_promises26.realpath)(path);
|
|
46402
46354
|
} catch {
|
|
46403
46355
|
return true;
|
|
46404
46356
|
}
|
|
46405
46357
|
for (; ; ) {
|
|
46406
46358
|
try {
|
|
46407
|
-
await (0,
|
|
46359
|
+
await (0, import_promises26.stat)((0, import_node_path16.join)(directory, ".git"));
|
|
46408
46360
|
return true;
|
|
46409
46361
|
} catch (error61) {
|
|
46410
46362
|
const code = errnoCode(error61);
|
|
@@ -46574,7 +46526,7 @@ function volumeRoot(path) {
|
|
|
46574
46526
|
}
|
|
46575
46527
|
async function exists(path) {
|
|
46576
46528
|
try {
|
|
46577
|
-
await (0,
|
|
46529
|
+
await (0, import_promises27.stat)(path);
|
|
46578
46530
|
return true;
|
|
46579
46531
|
} catch {
|
|
46580
46532
|
return false;
|
|
@@ -46582,10 +46534,10 @@ async function exists(path) {
|
|
|
46582
46534
|
}
|
|
46583
46535
|
async function inspectReadiness(path) {
|
|
46584
46536
|
try {
|
|
46585
|
-
if (!(await (0,
|
|
46537
|
+
if (!(await (0, import_promises27.stat)(path)).isDirectory()) {
|
|
46586
46538
|
return { ready: false, missing: true, message: MESSAGES2.missing };
|
|
46587
46539
|
}
|
|
46588
|
-
await (0,
|
|
46540
|
+
await (0, import_promises27.access)(path, import_node_fs7.constants.R_OK | import_node_fs7.constants.W_OK | import_node_fs7.constants.X_OK);
|
|
46589
46541
|
return { ready: true };
|
|
46590
46542
|
} catch (error61) {
|
|
46591
46543
|
const code = errnoCode(error61) ?? "";
|
|
@@ -46663,8 +46615,8 @@ async function admitDefaultWorkspace(spec, context, skills) {
|
|
|
46663
46615
|
const { env } = context;
|
|
46664
46616
|
const path = resolveAlanDefaultWorkspacePath(env.HOME || env.USERPROFILE || (0, import_node_os5.homedir)());
|
|
46665
46617
|
try {
|
|
46666
|
-
await (0,
|
|
46667
|
-
await (0,
|
|
46618
|
+
await (0, import_promises27.mkdir)(path, { recursive: true, mode: 448 });
|
|
46619
|
+
await (0, import_promises27.access)(path, import_node_fs7.constants.R_OK | import_node_fs7.constants.W_OK | import_node_fs7.constants.X_OK);
|
|
46668
46620
|
return {
|
|
46669
46621
|
kind: "admitted",
|
|
46670
46622
|
spec: { ...spec, projectPath: path },
|
|
@@ -46776,7 +46728,7 @@ async function respondToTurn(runningRunId, gate, driver, request2) {
|
|
|
46776
46728
|
}
|
|
46777
46729
|
|
|
46778
46730
|
// src/holder/session-facts.ts
|
|
46779
|
-
var
|
|
46731
|
+
var import_promises28 = require("fs/promises");
|
|
46780
46732
|
var CLI_RSS_CACHE_MS = 1e4;
|
|
46781
46733
|
var LOGIN_PROBLEM_PREFIX = "cli.auth.";
|
|
46782
46734
|
function isLoginFailure(result) {
|
|
@@ -46800,8 +46752,8 @@ function createSessionFacts(options) {
|
|
|
46800
46752
|
const path = await resolveCommandOnPath(command, env, platform);
|
|
46801
46753
|
if (path === null) return null;
|
|
46802
46754
|
try {
|
|
46803
|
-
const real = await (0,
|
|
46804
|
-
const info = await (0,
|
|
46755
|
+
const real = await (0, import_promises28.realpath)(path);
|
|
46756
|
+
const info = await (0, import_promises28.stat)(real);
|
|
46805
46757
|
return { command, key: `${real}:${info.ino}:${info.size}:${info.mtimeMs}` };
|
|
46806
46758
|
} catch {
|
|
46807
46759
|
return null;
|
|
@@ -46877,7 +46829,7 @@ function createSessionFacts(options) {
|
|
|
46877
46829
|
init_acp2();
|
|
46878
46830
|
|
|
46879
46831
|
// src/run-log/directory.ts
|
|
46880
|
-
var
|
|
46832
|
+
var import_promises29 = require("fs/promises");
|
|
46881
46833
|
var import_node_path18 = require("path");
|
|
46882
46834
|
init_runtime_v2();
|
|
46883
46835
|
init_zod();
|
|
@@ -46893,7 +46845,7 @@ function runDirectory(runsDir, runId) {
|
|
|
46893
46845
|
}
|
|
46894
46846
|
async function isRunClaimed(runsDir, runId) {
|
|
46895
46847
|
try {
|
|
46896
|
-
return (await (0,
|
|
46848
|
+
return (await (0, import_promises29.stat)(runDirectory(runsDir, runId).log)).size > 0;
|
|
46897
46849
|
} catch (error61) {
|
|
46898
46850
|
if (errnoCode(error61) === "ENOENT") return false;
|
|
46899
46851
|
throw error61;
|