@alan-ai-hq/agent-manager-linux-x64 0.1.136 → 0.1.138
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 +2081 -351
- package/alan-holder.cjs +336 -94
- package/package.json +1 -1
package/alan-holder.cjs
CHANGED
|
@@ -20104,7 +20104,12 @@ var init_run_context = __esm({
|
|
|
20104
20104
|
prMeta: pullRequestMetaSchema.optional(),
|
|
20105
20105
|
currentUser: agentUserIdentitySchema.optional(),
|
|
20106
20106
|
sessionVisibility: external_exports.enum(["private", "team"]).nullable().optional(),
|
|
20107
|
-
workflowTools: external_exports.array(workflowToolRefSchema).optional()
|
|
20107
|
+
workflowTools: external_exports.array(workflowToolRefSchema).optional(),
|
|
20108
|
+
availableSkills: external_exports.array(external_exports.object({
|
|
20109
|
+
name: external_exports.string().min(1),
|
|
20110
|
+
description: external_exports.string(),
|
|
20111
|
+
packageDirectory: external_exports.string().min(1)
|
|
20112
|
+
})).max(2e3).optional()
|
|
20108
20113
|
});
|
|
20109
20114
|
}
|
|
20110
20115
|
});
|
|
@@ -20355,6 +20360,7 @@ var init_desired_state = __esm({
|
|
|
20355
20360
|
/** Omitted by older servers; only an explicit entitlement enables context-search guidance. */
|
|
20356
20361
|
contextGraphEnabled: external_exports.boolean().optional(),
|
|
20357
20362
|
cloudEnvironmentId: external_exports.guid().optional(),
|
|
20363
|
+
sandboxId: external_exports.string().min(1).optional(),
|
|
20358
20364
|
localRepoUrls: external_exports.array(external_exports.string().min(1)).optional()
|
|
20359
20365
|
// Never here: the provider API key. The holder fetches it per run (RUN_PROVIDER_CREDENTIAL_PATH).
|
|
20360
20366
|
});
|
|
@@ -21313,6 +21319,7 @@ var init_workflow_tools_filter = __esm({
|
|
|
21313
21319
|
WORKFLOW_ALWAYS_ALLOWED_BUILTIN_TOOLS = [
|
|
21314
21320
|
"search_context",
|
|
21315
21321
|
"create_test_report",
|
|
21322
|
+
"publish_capture",
|
|
21316
21323
|
"create_plan",
|
|
21317
21324
|
"create_document_artifact",
|
|
21318
21325
|
"list_artifacts",
|
|
@@ -21794,12 +21801,14 @@ function isExternalMcpServerName(name) {
|
|
|
21794
21801
|
function isMcpConfigKey(name) {
|
|
21795
21802
|
return MCP_CONFIG_KEY.test(name);
|
|
21796
21803
|
}
|
|
21797
|
-
var ALAN_MCP_AUTHORIZATION_ENV, ALAN_RUN_ID_ENV, MCP_CONFIG_KEY;
|
|
21804
|
+
var ALAN_MCP_AUTHORIZATION_ENV, ALAN_RUN_ID_ENV, ALAN_MCP_URL_ENV, ALAN_MCP_CREDENTIAL_FILE_ENV, MCP_CONFIG_KEY;
|
|
21798
21805
|
var init_mcp_config = __esm({
|
|
21799
21806
|
"../shared/dist/agent/mcp-config.js"() {
|
|
21800
21807
|
"use strict";
|
|
21801
21808
|
ALAN_MCP_AUTHORIZATION_ENV = "ALAN_MCP_AUTHORIZATION";
|
|
21802
21809
|
ALAN_RUN_ID_ENV = "ALAN_RUN_ID";
|
|
21810
|
+
ALAN_MCP_URL_ENV = "ALAN_MCP_URL";
|
|
21811
|
+
ALAN_MCP_CREDENTIAL_FILE_ENV = "ALAN_MCP_CREDENTIAL_FILE";
|
|
21803
21812
|
MCP_CONFIG_KEY = /^[A-Za-z0-9_-]+$/;
|
|
21804
21813
|
}
|
|
21805
21814
|
});
|
|
@@ -22221,23 +22230,31 @@ var init_chunk_YXWJW7I5 = __esm({
|
|
|
22221
22230
|
}
|
|
22222
22231
|
});
|
|
22223
22232
|
|
|
22224
|
-
// ../agent-core/dist/chunk-
|
|
22233
|
+
// ../agent-core/dist/chunk-M6YHY2EZ.js
|
|
22225
22234
|
function windowsEnvValue(env, name) {
|
|
22226
22235
|
const wanted = name.toLowerCase();
|
|
22227
|
-
for (const [key, value] of Object.entries(env)) {
|
|
22236
|
+
for (const [key, value] of Object.entries(env).reverse()) {
|
|
22228
22237
|
if (key.toLowerCase() === wanted) return value;
|
|
22229
22238
|
}
|
|
22230
22239
|
return void 0;
|
|
22231
22240
|
}
|
|
22241
|
+
function canonicalWindowsEnvironment(env) {
|
|
22242
|
+
const unique = /* @__PURE__ */ new Map();
|
|
22243
|
+
for (const [name, value] of Object.entries(env)) {
|
|
22244
|
+
unique.set(name.toLowerCase(), [name.toLowerCase() === "path" ? "PATH" : name, value]);
|
|
22245
|
+
}
|
|
22246
|
+
return Object.fromEntries(unique.values());
|
|
22247
|
+
}
|
|
22232
22248
|
function hasExtension(name, extensions) {
|
|
22233
22249
|
const ext = import_path.win32.extname(name).toLowerCase();
|
|
22234
22250
|
return ext.length > 0 && extensions.includes(ext);
|
|
22235
22251
|
}
|
|
22236
22252
|
function candidates(base, extensions) {
|
|
22237
|
-
|
|
22253
|
+
const extension = import_path.win32.extname(base).toLowerCase();
|
|
22254
|
+
return extension === ".exe" || extension === ".com" || hasExtension(base, extensions) ? [base] : extensions.map((ext) => `${base}${ext}`);
|
|
22238
22255
|
}
|
|
22239
22256
|
function resolveWindowsCommand(command, env, files) {
|
|
22240
|
-
const extensions = (windowsEnvValue(env, "PATHEXT") ?? DEFAULT_PATHEXT).split(";").map((ext) => ext.trim().toLowerCase()).filter((ext) =>
|
|
22257
|
+
const extensions = (windowsEnvValue(env, "PATHEXT") ?? DEFAULT_PATHEXT).split(";").map((ext) => ext.trim().toLowerCase()).filter((ext) => LAUNCHABLE_EXTENSIONS.has(ext));
|
|
22241
22258
|
if (/[\\/]/.test(command)) {
|
|
22242
22259
|
return candidates(command, extensions).find((path) => files.isFile(path));
|
|
22243
22260
|
}
|
|
@@ -22250,6 +22267,18 @@ function resolveWindowsCommand(command, env, files) {
|
|
|
22250
22267
|
}
|
|
22251
22268
|
return void 0;
|
|
22252
22269
|
}
|
|
22270
|
+
function unwrapNativeShim(shim, args, files) {
|
|
22271
|
+
const lines = files.readShim(shim)?.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
22272
|
+
if (lines?.length !== NATIVE_SHIM_LINES.length + 1) return void 0;
|
|
22273
|
+
if (!NATIVE_SHIM_LINES.every((pattern, index) => pattern.test(lines[index] ?? ""))) {
|
|
22274
|
+
return void 0;
|
|
22275
|
+
}
|
|
22276
|
+
const target = NATIVE_SHIM_ENTRY.exec(lines.at(-1) ?? "")?.[1];
|
|
22277
|
+
if (target === void 0) return void 0;
|
|
22278
|
+
const directory = import_path.win32.dirname(shim);
|
|
22279
|
+
const file2 = import_path.win32.resolve(directory, target.replace(/^%dp0%\\/i, ""));
|
|
22280
|
+
return files.isFile(file2) ? { kind: "native", file: file2, args } : void 0;
|
|
22281
|
+
}
|
|
22253
22282
|
function isSimpleNodeShim(text2) {
|
|
22254
22283
|
return text2.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0).every((line) => /^@?echo off$/i.test(line) || NODE_SHIM_ENTRY.test(line));
|
|
22255
22284
|
}
|
|
@@ -22275,7 +22304,7 @@ function planWindowsLaunch(command, args, env, files) {
|
|
|
22275
22304
|
const file2 = resolveWindowsCommand(command, env, files);
|
|
22276
22305
|
if (file2 === void 0) return void 0;
|
|
22277
22306
|
if (!/\.(cmd|bat)$/i.test(file2)) return { kind: "native", file: file2, args };
|
|
22278
|
-
return unwrapNodeShim(file2, args, env, files) ?? { kind: "batch", file: file2, args };
|
|
22307
|
+
return unwrapNativeShim(file2, args, files) ?? unwrapNodeShim(file2, args, env, files) ?? { kind: "batch", file: file2, args };
|
|
22279
22308
|
}
|
|
22280
22309
|
function quoteWindowsArgument(value) {
|
|
22281
22310
|
if (value.length === 0) return '""';
|
|
@@ -22777,11 +22806,12 @@ function onCliSpawned(listener) {
|
|
|
22777
22806
|
}
|
|
22778
22807
|
function spawnCli(options) {
|
|
22779
22808
|
const platform = options.platform ?? process.platform;
|
|
22780
|
-
const
|
|
22781
|
-
|
|
22809
|
+
const env = platform === "win32" ? canonicalWindowsEnvironment(options.env) : options.env;
|
|
22810
|
+
const plan2 = planSpawn({ ...options, env, platform });
|
|
22811
|
+
if (plan2.commandLine !== null) return spawnInWindowsJob(plan2, { ...options, env });
|
|
22782
22812
|
const child = (0, import_child_process5.spawn)(plan2.file, [...plan2.args], {
|
|
22783
22813
|
cwd: options.cwd,
|
|
22784
|
-
env: { ...
|
|
22814
|
+
env: { ...env },
|
|
22785
22815
|
stdio: ["pipe", "pipe", "pipe"],
|
|
22786
22816
|
shell: false,
|
|
22787
22817
|
detached: true
|
|
@@ -22808,9 +22838,9 @@ function waitForSpawn(child, command) {
|
|
|
22808
22838
|
child.once("error", onError);
|
|
22809
22839
|
});
|
|
22810
22840
|
}
|
|
22811
|
-
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, spawnListeners;
|
|
22812
|
-
var
|
|
22813
|
-
"../agent-core/dist/chunk-
|
|
22841
|
+
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, LAUNCHABLE_EXTENSIONS, nodeWindowsFiles, NODE_SHIM_ENTRY, NATIVE_SHIM_LINES, NATIVE_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, spawnListeners;
|
|
22842
|
+
var init_chunk_M6YHY2EZ = __esm({
|
|
22843
|
+
"../agent-core/dist/chunk-M6YHY2EZ.js"() {
|
|
22814
22844
|
"use strict";
|
|
22815
22845
|
init_chunk_YXWJW7I5();
|
|
22816
22846
|
import_child_process = require("child_process");
|
|
@@ -22831,6 +22861,7 @@ var init_chunk_J4T6L5LX = __esm({
|
|
|
22831
22861
|
CMD_MAX_COMMAND_LINE = 8191;
|
|
22832
22862
|
MAX_COMMAND_LINE = 32766;
|
|
22833
22863
|
DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
22864
|
+
LAUNCHABLE_EXTENSIONS = /* @__PURE__ */ new Set([".com", ".exe", ".bat", ".cmd"]);
|
|
22834
22865
|
nodeWindowsFiles = {
|
|
22835
22866
|
isFile: (path) => {
|
|
22836
22867
|
try {
|
|
@@ -22849,6 +22880,17 @@ var init_chunk_J4T6L5LX = __esm({
|
|
|
22849
22880
|
}
|
|
22850
22881
|
};
|
|
22851
22882
|
NODE_SHIM_ENTRY = /"(%_prog%|[^"\r\n]*node(?:\.exe)?)"\s+"([^"\r\n]+\.(?:c?js|mjs))"\s+%\*/i;
|
|
22883
|
+
NATIVE_SHIM_LINES = [
|
|
22884
|
+
/^@echo off$/i,
|
|
22885
|
+
/^goto start$/i,
|
|
22886
|
+
/^:find_dp0$/i,
|
|
22887
|
+
/^set dp0=%~dp0$/i,
|
|
22888
|
+
/^exit \/b$/i,
|
|
22889
|
+
/^:start$/i,
|
|
22890
|
+
/^setlocal$/i,
|
|
22891
|
+
/^call :find_dp0$/i
|
|
22892
|
+
];
|
|
22893
|
+
NATIVE_SHIM_ENTRY = /^"(%dp0%\\(?:\.\.\\)?(?:node_modules\\)?[\w@.-]+(?:\\[\w@.-]+)*\.exe)"\s+%\*$/i;
|
|
22852
22894
|
CMD_META = /([()\][%!^"`<>&|;, *?])/g;
|
|
22853
22895
|
NEVER_STARTED = { stdout: "", stderr: "", exitCode: void 0 };
|
|
22854
22896
|
HIDDEN_FLAG_PROBE_VALUE = "__alan_probe__";
|
|
@@ -24584,7 +24626,7 @@ var init_chunk_54ZRJOQP = __esm({
|
|
|
24584
24626
|
}
|
|
24585
24627
|
});
|
|
24586
24628
|
|
|
24587
|
-
// ../agent-core/dist/chunk-
|
|
24629
|
+
// ../agent-core/dist/chunk-KHYYC5IN.js
|
|
24588
24630
|
function collectStrings(value, out) {
|
|
24589
24631
|
if (typeof value === "string") out.push(value);
|
|
24590
24632
|
else if (Array.isArray(value)) for (const item of value) collectStrings(item, out);
|
|
@@ -24954,12 +24996,12 @@ function silentStartError(name, timeoutMs) {
|
|
|
24954
24996
|
};
|
|
24955
24997
|
}
|
|
24956
24998
|
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;
|
|
24957
|
-
var
|
|
24958
|
-
"../agent-core/dist/chunk-
|
|
24999
|
+
var init_chunk_KHYYC5IN = __esm({
|
|
25000
|
+
"../agent-core/dist/chunk-KHYYC5IN.js"() {
|
|
24959
25001
|
"use strict";
|
|
24960
25002
|
init_chunk_UGRKZTAD();
|
|
24961
25003
|
init_chunk_54ZRJOQP();
|
|
24962
|
-
|
|
25004
|
+
init_chunk_M6YHY2EZ();
|
|
24963
25005
|
init_chunk_YXWJW7I5();
|
|
24964
25006
|
import_crypto3 = require("crypto");
|
|
24965
25007
|
import_fs4 = require("fs");
|
|
@@ -25421,7 +25463,7 @@ var init_chunk_J2KTV5FP = __esm({
|
|
|
25421
25463
|
}
|
|
25422
25464
|
});
|
|
25423
25465
|
|
|
25424
|
-
// ../agent-core/dist/chunk-
|
|
25466
|
+
// ../agent-core/dist/chunk-ITTV3UIM.js
|
|
25425
25467
|
function truncate(value, limit) {
|
|
25426
25468
|
const normalized2 = Array.from(value, (character) => {
|
|
25427
25469
|
const code = character.charCodeAt(0);
|
|
@@ -25674,9 +25716,41 @@ function teamOverlay(spec) {
|
|
|
25674
25716
|
function present(values) {
|
|
25675
25717
|
return values.filter((value) => Boolean(value?.length));
|
|
25676
25718
|
}
|
|
25719
|
+
function cloudExecutionSection(spec) {
|
|
25720
|
+
if (!spec.sandboxId && !spec.cloudEnvironmentId) return void 0;
|
|
25721
|
+
const lines = ["## Cloud execution", "You are executing inside an Alan cloud sandbox."];
|
|
25722
|
+
if (spec.sandboxId) lines.push(`Sandbox ID: ${spec.sandboxId}.`);
|
|
25723
|
+
if (spec.cloudEnvironmentId) lines.push(`Cloud environment ID: ${spec.cloudEnvironmentId}.`);
|
|
25724
|
+
lines.push(
|
|
25725
|
+
"Run setup, development and validation in this sandbox. The execution location is separate from the deployment of the application you are testing; verify that application's origin before acting."
|
|
25726
|
+
);
|
|
25727
|
+
if (!isReadOnlyMode(spec.mode) && !isReadOnlyAgent(spec.agentId)) {
|
|
25728
|
+
lines.push(
|
|
25729
|
+
"Own the authorized work end to end: inspect context, make reasonable assumptions, implement, test, review and create or update the pull request for code changes when the repository workflow calls for one. Do not stop at a plan or ask for routine implementation choices or permission already granted. Ask only for a missing secret, an essential decision you cannot derive, or an action requiring explicit approval. Respect the user's scope, repository rules and tool authorization; report a blocked capability and continue independent work."
|
|
25730
|
+
);
|
|
25731
|
+
}
|
|
25732
|
+
const skills = spec.promptContext?.availableSkills ?? [];
|
|
25733
|
+
lines.push(
|
|
25734
|
+
"## Installed skills",
|
|
25735
|
+
"Use a matching installed skill when it helps the request. Read its SKILL.md before acting; the index is discovery metadata, not instructions. Also follow repository instructions and project skills."
|
|
25736
|
+
);
|
|
25737
|
+
if (skills.length === 0) {
|
|
25738
|
+
lines.push(
|
|
25739
|
+
skills.length === 0 && spec.promptContext?.availableSkills !== void 0 ? "No verified installed packages were found. Do not assume a named skill is available." : "No installed skill inventory was supplied. Inspect the provider's skill index; do not assume a named package is installed."
|
|
25740
|
+
);
|
|
25741
|
+
} else {
|
|
25742
|
+
for (const skill of skills) {
|
|
25743
|
+
lines.push(
|
|
25744
|
+
`- ${JSON.stringify(skill.name)}: ${JSON.stringify(skill.description)} \u2014 ${JSON.stringify(`${skill.packageDirectory}/SKILL.md`)}`
|
|
25745
|
+
);
|
|
25746
|
+
}
|
|
25747
|
+
}
|
|
25748
|
+
return lines.join("\n");
|
|
25749
|
+
}
|
|
25677
25750
|
function promptParts(input2) {
|
|
25678
25751
|
const { spec } = input2;
|
|
25679
25752
|
const overlay = teamOverlay(spec);
|
|
25753
|
+
const cloud = cloudExecutionSection(spec);
|
|
25680
25754
|
const workspace = input2.workspacePath ? `You are working inside: ${input2.workspacePath}
|
|
25681
25755
|
Prefer relative paths and keep your work scoped to this project.` : void 0;
|
|
25682
25756
|
return {
|
|
@@ -25685,6 +25759,7 @@ Prefer relative paths and keep your work scoped to this project.` : void 0;
|
|
|
25685
25759
|
spec.agentPrompt?.trim() || getAlanAgentPrompt(spec.agentId),
|
|
25686
25760
|
getAlanModePrompt(agentModeOf(spec.mode)),
|
|
25687
25761
|
workspace,
|
|
25762
|
+
cloud,
|
|
25688
25763
|
taskLifecycleSection(spec),
|
|
25689
25764
|
overlay,
|
|
25690
25765
|
...contextSections(spec),
|
|
@@ -25692,6 +25767,7 @@ Prefer relative paths and keep your work scoped to this project.` : void 0;
|
|
|
25692
25767
|
]),
|
|
25693
25768
|
append: present([
|
|
25694
25769
|
ALAN_PLATFORM_TOOL_ROUTING_PROMPT,
|
|
25770
|
+
cloud,
|
|
25695
25771
|
spec.contextGraphEnabled === true ? ALAN_CONTEXT_SEARCH_PROMPT : void 0,
|
|
25696
25772
|
overlay
|
|
25697
25773
|
])
|
|
@@ -25748,8 +25824,8 @@ ${body}` : body;
|
|
|
25748
25824
|
return spec.mode === "plan" ? planModePrefix(prefixed) : prefixed;
|
|
25749
25825
|
}
|
|
25750
25826
|
var MAX_PARSED_ATTACHMENTS, MAX_PARSED_ATTACHMENT_CHARS, MAX_METADATA_CHARS, UNAVAILABLE, READ_ONLY_MODES, AGENT_MODES;
|
|
25751
|
-
var
|
|
25752
|
-
"../agent-core/dist/chunk-
|
|
25827
|
+
var init_chunk_ITTV3UIM = __esm({
|
|
25828
|
+
"../agent-core/dist/chunk-ITTV3UIM.js"() {
|
|
25753
25829
|
"use strict";
|
|
25754
25830
|
init_agent2();
|
|
25755
25831
|
MAX_PARSED_ATTACHMENTS = 3;
|
|
@@ -26822,12 +26898,12 @@ var init_claude = __esm({
|
|
|
26822
26898
|
"../agent-core/dist/providers/claude.js"() {
|
|
26823
26899
|
"use strict";
|
|
26824
26900
|
init_chunk_DALFHI4B();
|
|
26825
|
-
|
|
26901
|
+
init_chunk_KHYYC5IN();
|
|
26826
26902
|
init_chunk_UGRKZTAD();
|
|
26827
26903
|
init_chunk_54ZRJOQP();
|
|
26828
26904
|
init_chunk_J2KTV5FP();
|
|
26829
|
-
|
|
26830
|
-
|
|
26905
|
+
init_chunk_M6YHY2EZ();
|
|
26906
|
+
init_chunk_ITTV3UIM();
|
|
26831
26907
|
init_chunk_YXWJW7I5();
|
|
26832
26908
|
init_effort();
|
|
26833
26909
|
import_crypto6 = require("crypto");
|
|
@@ -28955,12 +29031,12 @@ var init_codex = __esm({
|
|
|
28955
29031
|
"../agent-core/dist/providers/codex.js"() {
|
|
28956
29032
|
"use strict";
|
|
28957
29033
|
init_chunk_DALFHI4B();
|
|
28958
|
-
|
|
29034
|
+
init_chunk_KHYYC5IN();
|
|
28959
29035
|
init_chunk_UGRKZTAD();
|
|
28960
29036
|
init_chunk_54ZRJOQP();
|
|
28961
29037
|
init_chunk_J2KTV5FP();
|
|
28962
|
-
|
|
28963
|
-
|
|
29038
|
+
init_chunk_M6YHY2EZ();
|
|
29039
|
+
init_chunk_ITTV3UIM();
|
|
28964
29040
|
init_chunk_YXWJW7I5();
|
|
28965
29041
|
import_fs6 = require("fs");
|
|
28966
29042
|
import_path6 = require("path");
|
|
@@ -37724,10 +37800,10 @@ var require_dist = __commonJS({
|
|
|
37724
37800
|
var init_dist = __esm({
|
|
37725
37801
|
"../agent-core/dist/index.js"() {
|
|
37726
37802
|
"use strict";
|
|
37727
|
-
|
|
37803
|
+
init_chunk_KHYYC5IN();
|
|
37728
37804
|
init_chunk_UGRKZTAD();
|
|
37729
37805
|
init_chunk_54ZRJOQP();
|
|
37730
|
-
|
|
37806
|
+
init_chunk_M6YHY2EZ();
|
|
37731
37807
|
init_chunk_YXWJW7I5();
|
|
37732
37808
|
}
|
|
37733
37809
|
});
|
|
@@ -38471,12 +38547,12 @@ var import_promises22, import_path9, import_crypto12, import_promises23, CURSOR_
|
|
|
38471
38547
|
var init_acp3 = __esm({
|
|
38472
38548
|
"../agent-core/dist/providers/acp.js"() {
|
|
38473
38549
|
"use strict";
|
|
38474
|
-
|
|
38550
|
+
init_chunk_KHYYC5IN();
|
|
38475
38551
|
init_chunk_UGRKZTAD();
|
|
38476
38552
|
init_chunk_54ZRJOQP();
|
|
38477
38553
|
init_chunk_J2KTV5FP();
|
|
38478
|
-
|
|
38479
|
-
|
|
38554
|
+
init_chunk_M6YHY2EZ();
|
|
38555
|
+
init_chunk_ITTV3UIM();
|
|
38480
38556
|
init_chunk_YXWJW7I5();
|
|
38481
38557
|
import_promises22 = require("fs/promises");
|
|
38482
38558
|
import_path9 = require("path");
|
|
@@ -40175,12 +40251,12 @@ var import_http4, import_crypto13, import_promises24, import_path10, import_path
|
|
|
40175
40251
|
var init_opencode = __esm({
|
|
40176
40252
|
"../agent-core/dist/providers/opencode.js"() {
|
|
40177
40253
|
"use strict";
|
|
40178
|
-
|
|
40254
|
+
init_chunk_KHYYC5IN();
|
|
40179
40255
|
init_chunk_UGRKZTAD();
|
|
40180
40256
|
init_chunk_54ZRJOQP();
|
|
40181
40257
|
init_chunk_J2KTV5FP();
|
|
40182
|
-
|
|
40183
|
-
|
|
40258
|
+
init_chunk_M6YHY2EZ();
|
|
40259
|
+
init_chunk_ITTV3UIM();
|
|
40184
40260
|
init_chunk_YXWJW7I5();
|
|
40185
40261
|
import_http4 = require("http");
|
|
40186
40262
|
init_runtime_v2();
|
|
@@ -41983,12 +42059,12 @@ var import_crypto15, import_promises25, FACTORY_API_VERSION, FACTORY_PROTOCOL_VE
|
|
|
41983
42059
|
var init_droid = __esm({
|
|
41984
42060
|
"../agent-core/dist/providers/droid.js"() {
|
|
41985
42061
|
"use strict";
|
|
41986
|
-
|
|
42062
|
+
init_chunk_KHYYC5IN();
|
|
41987
42063
|
init_chunk_UGRKZTAD();
|
|
41988
42064
|
init_chunk_54ZRJOQP();
|
|
41989
42065
|
init_chunk_J2KTV5FP();
|
|
41990
|
-
|
|
41991
|
-
|
|
42066
|
+
init_chunk_M6YHY2EZ();
|
|
42067
|
+
init_chunk_ITTV3UIM();
|
|
41992
42068
|
init_chunk_YXWJW7I5();
|
|
41993
42069
|
init_runtime_v2();
|
|
41994
42070
|
import_crypto15 = require("crypto");
|
|
@@ -43086,11 +43162,11 @@ var init_antigravity = __esm({
|
|
|
43086
43162
|
"../agent-core/dist/providers/antigravity.js"() {
|
|
43087
43163
|
"use strict";
|
|
43088
43164
|
init_chunk_DALFHI4B();
|
|
43089
|
-
|
|
43165
|
+
init_chunk_KHYYC5IN();
|
|
43090
43166
|
init_chunk_UGRKZTAD();
|
|
43091
43167
|
init_chunk_54ZRJOQP();
|
|
43092
|
-
|
|
43093
|
-
|
|
43168
|
+
init_chunk_M6YHY2EZ();
|
|
43169
|
+
init_chunk_ITTV3UIM();
|
|
43094
43170
|
init_chunk_YXWJW7I5();
|
|
43095
43171
|
import_promises26 = require("fs/promises");
|
|
43096
43172
|
import_path12 = require("path");
|
|
@@ -43790,12 +43866,12 @@ var import_promises27, import_path15, import_crypto17, COMMAND_CODE_GRAMMAR_NAME
|
|
|
43790
43866
|
var init_command_code = __esm({
|
|
43791
43867
|
"../agent-core/dist/providers/command-code.js"() {
|
|
43792
43868
|
"use strict";
|
|
43793
|
-
|
|
43869
|
+
init_chunk_KHYYC5IN();
|
|
43794
43870
|
init_chunk_UGRKZTAD();
|
|
43795
43871
|
init_chunk_54ZRJOQP();
|
|
43796
43872
|
init_chunk_J2KTV5FP();
|
|
43797
|
-
|
|
43798
|
-
|
|
43873
|
+
init_chunk_M6YHY2EZ();
|
|
43874
|
+
init_chunk_ITTV3UIM();
|
|
43799
43875
|
init_chunk_YXWJW7I5();
|
|
43800
43876
|
import_promises27 = require("fs/promises");
|
|
43801
43877
|
import_path15 = require("path");
|
|
@@ -44883,7 +44959,7 @@ var GitFault = class extends Error {
|
|
|
44883
44959
|
var import_node_child_process = require("child_process");
|
|
44884
44960
|
|
|
44885
44961
|
// ../agent-core/dist/process.js
|
|
44886
|
-
|
|
44962
|
+
init_chunk_M6YHY2EZ();
|
|
44887
44963
|
init_chunk_YXWJW7I5();
|
|
44888
44964
|
|
|
44889
44965
|
// src/capabilities/git/run-git.ts
|
|
@@ -45590,7 +45666,9 @@ function providerCommandFor(backendKind) {
|
|
|
45590
45666
|
return BY_BACKEND.get(backendKind)?.command;
|
|
45591
45667
|
}
|
|
45592
45668
|
function envValue(env, name) {
|
|
45593
|
-
const key = Object.keys(env).
|
|
45669
|
+
const key = Object.keys(env).findLast(
|
|
45670
|
+
(candidate) => candidate.toUpperCase() === name.toUpperCase()
|
|
45671
|
+
);
|
|
45594
45672
|
return key === void 0 ? "" : env[key] ?? "";
|
|
45595
45673
|
}
|
|
45596
45674
|
function pathDelimiter(platform) {
|
|
@@ -45606,12 +45684,18 @@ async function isRunnable(path, platform) {
|
|
|
45606
45684
|
}
|
|
45607
45685
|
}
|
|
45608
45686
|
function windowsExtensions(command, env) {
|
|
45609
|
-
const extensions = (envValue(env, "PATHEXT") || ".COM;.EXE;.BAT;.CMD").split(";").
|
|
45687
|
+
const extensions = (envValue(env, "PATHEXT") || ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter((extension) => [".COM", ".EXE", ".BAT", ".CMD"].includes(extension.toUpperCase()));
|
|
45610
45688
|
const named = command.toLowerCase();
|
|
45611
|
-
return extensions.
|
|
45689
|
+
return [".com", ".exe", ...extensions.map((extension) => extension.toLowerCase())].some(
|
|
45690
|
+
(extension) => named.endsWith(extension)
|
|
45691
|
+
) ? [""] : extensions;
|
|
45612
45692
|
}
|
|
45613
45693
|
async function resolveCommandOnPath(command, env, platform) {
|
|
45614
|
-
const directories = envValue(env, "PATH").split(pathDelimiter(platform)).
|
|
45694
|
+
const directories = envValue(env, "PATH").split(pathDelimiter(platform)).map(
|
|
45695
|
+
(directory) => platform === "win32" ? directory.trim().replace(/^"(.*)"$/, "$1") : directory
|
|
45696
|
+
).filter(
|
|
45697
|
+
(directory) => platform === "win32" ? import_node_path8.win32.isAbsolute(directory) : directory.length > 0
|
|
45698
|
+
);
|
|
45615
45699
|
const extensions = platform === "win32" ? windowsExtensions(command, env) : [""];
|
|
45616
45700
|
for (const directory of directories) {
|
|
45617
45701
|
for (const extension of extensions) {
|
|
@@ -45649,7 +45733,6 @@ function resolveProviderExecutable(provider4, env, platform) {
|
|
|
45649
45733
|
}
|
|
45650
45734
|
|
|
45651
45735
|
// src/capabilities/providers/managed.ts
|
|
45652
|
-
var import_node_child_process6 = require("child_process");
|
|
45653
45736
|
var import_node_crypto7 = require("crypto");
|
|
45654
45737
|
var import_promises17 = require("fs/promises");
|
|
45655
45738
|
var import_node_path9 = require("path");
|
|
@@ -46194,6 +46277,38 @@ async function resolveSkillInvocations(layout, invocations) {
|
|
|
46194
46277
|
}
|
|
46195
46278
|
return missing.length === 0 ? { kind: "resolved", skills: resolved } : { kind: "missing", names: missing };
|
|
46196
46279
|
}
|
|
46280
|
+
async function availableSkillIndex(layout) {
|
|
46281
|
+
const found = /* @__PURE__ */ new Map();
|
|
46282
|
+
const candidates2 = [];
|
|
46283
|
+
for (const skill of await readInstalledSkills(layout)) {
|
|
46284
|
+
candidates2.push({
|
|
46285
|
+
directory: packageDirectory(layout, skill.versionId),
|
|
46286
|
+
contentHash: skill.contentHash
|
|
46287
|
+
});
|
|
46288
|
+
}
|
|
46289
|
+
if (layout.nativeDir !== null) {
|
|
46290
|
+
const entries = await (0, import_promises19.readdir)(layout.nativeDir, { withFileTypes: true }).catch(() => []);
|
|
46291
|
+
for (const entry of entries) {
|
|
46292
|
+
if (entry.isDirectory() || entry.isSymbolicLink())
|
|
46293
|
+
candidates2.push({ directory: (0, import_node_path11.join)(layout.nativeDir, entry.name) });
|
|
46294
|
+
}
|
|
46295
|
+
}
|
|
46296
|
+
for (const candidate of candidates2.slice(0, 2e3)) {
|
|
46297
|
+
const skill = await inspectIndexedSkill(candidate.directory, candidate.contentHash);
|
|
46298
|
+
if (skill !== null && !found.has(skill.name)) found.set(skill.name, skill);
|
|
46299
|
+
}
|
|
46300
|
+
return [...found.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
46301
|
+
}
|
|
46302
|
+
async function inspectIndexedSkill(directory, contentHash) {
|
|
46303
|
+
try {
|
|
46304
|
+
const inspected = await inspectSkillPackage(directory, { expectedName: null });
|
|
46305
|
+
if (contentHash && inspected.contentHash !== contentHash) return null;
|
|
46306
|
+
const { name, description } = inspected.metadata;
|
|
46307
|
+
return { name, description, packageDirectory: directory };
|
|
46308
|
+
} catch {
|
|
46309
|
+
return null;
|
|
46310
|
+
}
|
|
46311
|
+
}
|
|
46197
46312
|
|
|
46198
46313
|
// src/capabilities/workspace/index.ts
|
|
46199
46314
|
var import_node_path14 = require("path");
|
|
@@ -46442,7 +46557,7 @@ function openRepositoryLocks(options) {
|
|
|
46442
46557
|
|
|
46443
46558
|
// src/cli/config.ts
|
|
46444
46559
|
var import_node_os7 = require("os");
|
|
46445
|
-
var
|
|
46560
|
+
var import_node_path28 = require("path");
|
|
46446
46561
|
init_zod();
|
|
46447
46562
|
|
|
46448
46563
|
// src/client/locate.ts
|
|
@@ -46463,9 +46578,9 @@ function defaultInstallDir({ platform, home, env }) {
|
|
|
46463
46578
|
|
|
46464
46579
|
// src/sessions/index.ts
|
|
46465
46580
|
var import_node_crypto15 = require("crypto");
|
|
46466
|
-
var
|
|
46581
|
+
var import_promises37 = require("fs/promises");
|
|
46467
46582
|
var import_node_os6 = require("os");
|
|
46468
|
-
var
|
|
46583
|
+
var import_node_path27 = require("path");
|
|
46469
46584
|
|
|
46470
46585
|
// src/holder/control-client.ts
|
|
46471
46586
|
var import_node_crypto11 = require("crypto");
|
|
@@ -46696,8 +46811,33 @@ function createConversationMcpAuthorization(options) {
|
|
|
46696
46811
|
};
|
|
46697
46812
|
}
|
|
46698
46813
|
|
|
46699
|
-
// src/holder/
|
|
46814
|
+
// src/holder/mcp-helper-access.ts
|
|
46700
46815
|
var import_promises28 = require("fs/promises");
|
|
46816
|
+
function createHelperMcpAccess(options) {
|
|
46817
|
+
return {
|
|
46818
|
+
[Symbol.asyncDispose]: async () => {
|
|
46819
|
+
await (0, import_promises28.rm)(options.credentialPath, { force: true });
|
|
46820
|
+
},
|
|
46821
|
+
url: options.managedMcp.url,
|
|
46822
|
+
authorization: async (signal) => {
|
|
46823
|
+
const authorization = await options.managedMcp.authorization(signal);
|
|
46824
|
+
if (authorization === void 0 || signal.aborted) {
|
|
46825
|
+
await (0, import_promises28.rm)(options.credentialPath, { force: true });
|
|
46826
|
+
return void 0;
|
|
46827
|
+
}
|
|
46828
|
+
const credential = {
|
|
46829
|
+
url: options.managedMcp.url,
|
|
46830
|
+
authorization,
|
|
46831
|
+
conversationId: options.conversationId
|
|
46832
|
+
};
|
|
46833
|
+
await writeJsonFileAtomic(options.credentialPath, credential);
|
|
46834
|
+
return authorization;
|
|
46835
|
+
}
|
|
46836
|
+
};
|
|
46837
|
+
}
|
|
46838
|
+
|
|
46839
|
+
// src/holder/run-inputs.ts
|
|
46840
|
+
var import_promises29 = require("fs/promises");
|
|
46701
46841
|
var import_node_path17 = require("path");
|
|
46702
46842
|
var NO_RUN_INPUTS = {
|
|
46703
46843
|
attachments: [],
|
|
@@ -46713,16 +46853,16 @@ function safeFilename(filename) {
|
|
|
46713
46853
|
async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [] }) {
|
|
46714
46854
|
const dir = (0, import_node_path17.join)(tmpDir, "runs", spec.runId);
|
|
46715
46855
|
const cleanup = async () => {
|
|
46716
|
-
await (0,
|
|
46856
|
+
await (0, import_promises29.rm)(dir, { recursive: true, force: true });
|
|
46717
46857
|
};
|
|
46718
46858
|
try {
|
|
46719
46859
|
const credential = await source.fetchProviderCredential(spec.runId, signal);
|
|
46720
46860
|
const attachments = [];
|
|
46721
|
-
if (spec.attachments?.length) await (0,
|
|
46861
|
+
if (spec.attachments?.length) await (0, import_promises29.mkdir)(dir, { recursive: true, mode: 448 });
|
|
46722
46862
|
for (const [index, attachment] of (spec.attachments ?? []).entries()) {
|
|
46723
46863
|
const bytes = await source.downloadAttachment(spec.runId, attachment.id, signal);
|
|
46724
46864
|
const path = (0, import_node_path17.join)(dir, `${index}-${safeFilename(attachment.filename)}`);
|
|
46725
|
-
await (0,
|
|
46865
|
+
await (0, import_promises29.writeFile)(path, bytes, { mode: 384 });
|
|
46726
46866
|
attachments.push({
|
|
46727
46867
|
id: attachment.id,
|
|
46728
46868
|
kind: attachment.kind,
|
|
@@ -46752,12 +46892,12 @@ async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [] }) {
|
|
|
46752
46892
|
var import_node_crypto14 = require("crypto");
|
|
46753
46893
|
var import_node_fs10 = require("fs");
|
|
46754
46894
|
var import_node_net2 = require("net");
|
|
46755
|
-
var
|
|
46895
|
+
var import_node_path26 = require("path");
|
|
46756
46896
|
init_runtime_v2();
|
|
46757
46897
|
|
|
46758
46898
|
// src/holder/admission.ts
|
|
46759
46899
|
var import_node_fs8 = require("fs");
|
|
46760
|
-
var
|
|
46900
|
+
var import_promises33 = require("fs/promises");
|
|
46761
46901
|
var import_node_os5 = require("os");
|
|
46762
46902
|
var import_node_path22 = require("path");
|
|
46763
46903
|
init_constants();
|
|
@@ -46771,7 +46911,7 @@ function resolveAlanDefaultWorkspacePath(homeDirectory = (0, import_node_os4.hom
|
|
|
46771
46911
|
}
|
|
46772
46912
|
|
|
46773
46913
|
// src/holder/admission-relocation.ts
|
|
46774
|
-
var
|
|
46914
|
+
var import_promises30 = require("fs/promises");
|
|
46775
46915
|
var import_node_path19 = require("path");
|
|
46776
46916
|
var MAX_RELOCATION_CANDIDATES = 200;
|
|
46777
46917
|
var RELOCATION_BUDGET_MS = 2e4;
|
|
@@ -46807,7 +46947,7 @@ async function originIdentity(git, path, signal) {
|
|
|
46807
46947
|
}
|
|
46808
46948
|
async function childDirectories(parent, limit) {
|
|
46809
46949
|
try {
|
|
46810
|
-
const entries = await (0,
|
|
46950
|
+
const entries = await (0, import_promises30.readdir)(parent, { withFileTypes: true });
|
|
46811
46951
|
return entries.filter((entry) => entry.isDirectory()).slice(0, limit).map((entry) => (0, import_node_path19.join)(parent, entry.name));
|
|
46812
46952
|
} catch {
|
|
46813
46953
|
return [];
|
|
@@ -46844,7 +46984,7 @@ async function discoverRelocatedWorkspace(search) {
|
|
|
46844
46984
|
|
|
46845
46985
|
// src/holder/checkout-refresh.ts
|
|
46846
46986
|
var import_node_crypto13 = require("crypto");
|
|
46847
|
-
var
|
|
46987
|
+
var import_promises31 = require("fs/promises");
|
|
46848
46988
|
var import_node_path20 = require("path");
|
|
46849
46989
|
function short(sha) {
|
|
46850
46990
|
return sha.slice(0, 12);
|
|
@@ -46857,8 +46997,8 @@ function staleLine(path, snapshot2, tip) {
|
|
|
46857
46997
|
}
|
|
46858
46998
|
async function claimOnce(dir, name) {
|
|
46859
46999
|
try {
|
|
46860
|
-
await (0,
|
|
46861
|
-
await (await (0,
|
|
47000
|
+
await (0, import_promises31.mkdir)(dir, { recursive: true, mode: 448 });
|
|
47001
|
+
await (await (0, import_promises31.open)((0, import_node_path20.join)(dir, name), "wx")).close();
|
|
46862
47002
|
return true;
|
|
46863
47003
|
} catch {
|
|
46864
47004
|
return false;
|
|
@@ -46941,7 +47081,7 @@ function createCheckoutRefresh(deps) {
|
|
|
46941
47081
|
}
|
|
46942
47082
|
|
|
46943
47083
|
// src/holder/lease.ts
|
|
46944
|
-
var
|
|
47084
|
+
var import_promises32 = require("fs/promises");
|
|
46945
47085
|
var import_node_path21 = require("path");
|
|
46946
47086
|
var LEASE_CHECK_EVERY_MS = 5e3;
|
|
46947
47087
|
var MAX_TRANSIENT_FAILURES = 3;
|
|
@@ -46956,8 +47096,8 @@ function identityFailure(code, workspacePath) {
|
|
|
46956
47096
|
return { code, problemCode: "app.workspace.missing", message: MESSAGES[code], workspacePath };
|
|
46957
47097
|
}
|
|
46958
47098
|
async function fileIdentity(path) {
|
|
46959
|
-
const canonical = await (0,
|
|
46960
|
-
const info = await (0,
|
|
47099
|
+
const canonical = await (0, import_promises32.realpath)(path);
|
|
47100
|
+
const info = await (0, import_promises32.stat)(canonical, { bigint: true });
|
|
46961
47101
|
return `${canonical}:${info.dev}:${info.ino}`;
|
|
46962
47102
|
}
|
|
46963
47103
|
async function snapshot(git, path, signal) {
|
|
@@ -46976,7 +47116,7 @@ async function snapshot(git, path, signal) {
|
|
|
46976
47116
|
workspace: await fileIdentity(path),
|
|
46977
47117
|
repository: await fileIdentity(commonDir),
|
|
46978
47118
|
worktree: await fileIdentity(gitDir),
|
|
46979
|
-
commonDir: await (0,
|
|
47119
|
+
commonDir: await (0, import_promises32.realpath)(commonDir)
|
|
46980
47120
|
};
|
|
46981
47121
|
} catch {
|
|
46982
47122
|
return null;
|
|
@@ -46989,7 +47129,7 @@ async function gitValue(git, path, args, signal) {
|
|
|
46989
47129
|
}
|
|
46990
47130
|
async function pathExists(path) {
|
|
46991
47131
|
try {
|
|
46992
|
-
await (0,
|
|
47132
|
+
await (0, import_promises32.stat)(path);
|
|
46993
47133
|
return true;
|
|
46994
47134
|
} catch (error61) {
|
|
46995
47135
|
return errnoCode(error61) !== "ENOENT" && errnoCode(error61) !== "ENOTDIR";
|
|
@@ -46998,13 +47138,13 @@ async function pathExists(path) {
|
|
|
46998
47138
|
async function hasGitMarker(path) {
|
|
46999
47139
|
let directory;
|
|
47000
47140
|
try {
|
|
47001
|
-
directory = await (0,
|
|
47141
|
+
directory = await (0, import_promises32.realpath)(path);
|
|
47002
47142
|
} catch {
|
|
47003
47143
|
return true;
|
|
47004
47144
|
}
|
|
47005
47145
|
for (; ; ) {
|
|
47006
47146
|
try {
|
|
47007
|
-
await (0,
|
|
47147
|
+
await (0, import_promises32.stat)((0, import_node_path21.join)(directory, ".git"));
|
|
47008
47148
|
return true;
|
|
47009
47149
|
} catch (error61) {
|
|
47010
47150
|
const code = errnoCode(error61);
|
|
@@ -47174,7 +47314,7 @@ function volumeRoot(path) {
|
|
|
47174
47314
|
}
|
|
47175
47315
|
async function exists(path) {
|
|
47176
47316
|
try {
|
|
47177
|
-
await (0,
|
|
47317
|
+
await (0, import_promises33.stat)(path);
|
|
47178
47318
|
return true;
|
|
47179
47319
|
} catch {
|
|
47180
47320
|
return false;
|
|
@@ -47182,10 +47322,10 @@ async function exists(path) {
|
|
|
47182
47322
|
}
|
|
47183
47323
|
async function inspectReadiness(path) {
|
|
47184
47324
|
try {
|
|
47185
|
-
if (!(await (0,
|
|
47325
|
+
if (!(await (0, import_promises33.stat)(path)).isDirectory()) {
|
|
47186
47326
|
return { ready: false, missing: true, message: MESSAGES2.missing };
|
|
47187
47327
|
}
|
|
47188
|
-
await (0,
|
|
47328
|
+
await (0, import_promises33.access)(path, import_node_fs8.constants.R_OK | import_node_fs8.constants.W_OK | import_node_fs8.constants.X_OK);
|
|
47189
47329
|
return { ready: true };
|
|
47190
47330
|
} catch (error61) {
|
|
47191
47331
|
const code = errnoCode(error61) ?? "";
|
|
@@ -47263,8 +47403,8 @@ async function admitDefaultWorkspace(spec, context, skills) {
|
|
|
47263
47403
|
const { env } = context;
|
|
47264
47404
|
const path = resolveAlanDefaultWorkspacePath(env.HOME || env.USERPROFILE || (0, import_node_os5.homedir)());
|
|
47265
47405
|
try {
|
|
47266
|
-
await (0,
|
|
47267
|
-
await (0,
|
|
47406
|
+
await (0, import_promises33.mkdir)(path, { recursive: true, mode: 448 });
|
|
47407
|
+
await (0, import_promises33.access)(path, import_node_fs8.constants.R_OK | import_node_fs8.constants.W_OK | import_node_fs8.constants.X_OK);
|
|
47268
47408
|
return {
|
|
47269
47409
|
kind: "admitted",
|
|
47270
47410
|
spec: { ...spec, projectPath: path },
|
|
@@ -47280,6 +47420,16 @@ async function admitDefaultWorkspace(spec, context, skills) {
|
|
|
47280
47420
|
);
|
|
47281
47421
|
}
|
|
47282
47422
|
}
|
|
47423
|
+
async function withInstalledCloudSkills(spec, context) {
|
|
47424
|
+
if (!spec.sandboxId && !spec.cloudEnvironmentId || context.skills === void 0) return spec;
|
|
47425
|
+
return {
|
|
47426
|
+
...spec,
|
|
47427
|
+
promptContext: {
|
|
47428
|
+
...spec.promptContext,
|
|
47429
|
+
availableSkills: await availableSkillIndex(context.skills)
|
|
47430
|
+
}
|
|
47431
|
+
};
|
|
47432
|
+
}
|
|
47283
47433
|
async function admitRun(spec, context, signal) {
|
|
47284
47434
|
const provider4 = await checkProvider(spec, context);
|
|
47285
47435
|
if (provider4 !== null) return provider4;
|
|
@@ -47291,6 +47441,7 @@ async function admitRun(spec, context, signal) {
|
|
|
47291
47441
|
);
|
|
47292
47442
|
}
|
|
47293
47443
|
const skills = selected.skills;
|
|
47444
|
+
spec = await withInstalledCloudSkills(spec, context);
|
|
47294
47445
|
const projectPath = spec.projectPath;
|
|
47295
47446
|
if (projectPath === void 0) {
|
|
47296
47447
|
return { kind: "admitted", spec, relocated: null, leaseTargets: [], skills };
|
|
@@ -47382,7 +47533,7 @@ async function respondToTurn(runningRunId, gate, driver, request2) {
|
|
|
47382
47533
|
}
|
|
47383
47534
|
|
|
47384
47535
|
// src/holder/session-facts.ts
|
|
47385
|
-
var
|
|
47536
|
+
var import_promises34 = require("fs/promises");
|
|
47386
47537
|
var CLI_RSS_CACHE_MS = 1e4;
|
|
47387
47538
|
var LOGIN_PROBLEM_PREFIX = "cli.auth.";
|
|
47388
47539
|
function isLoginFailure(result) {
|
|
@@ -47408,8 +47559,8 @@ function createSessionFacts(options) {
|
|
|
47408
47559
|
const path = await resolveCommandOnPath(command, env, platform);
|
|
47409
47560
|
if (path === null) return null;
|
|
47410
47561
|
try {
|
|
47411
|
-
const real = await (0,
|
|
47412
|
-
const info = await (0,
|
|
47562
|
+
const real = await (0, import_promises34.realpath)(path);
|
|
47563
|
+
const info = await (0, import_promises34.stat)(real);
|
|
47413
47564
|
return { command, key: `${real}:${info.ino}:${info.size}:${info.mtimeMs}` };
|
|
47414
47565
|
} catch {
|
|
47415
47566
|
return null;
|
|
@@ -47496,11 +47647,28 @@ function createSessionFacts(options) {
|
|
|
47496
47647
|
init_acp2();
|
|
47497
47648
|
|
|
47498
47649
|
// src/run-log/directory.ts
|
|
47499
|
-
var
|
|
47650
|
+
var import_promises35 = require("fs/promises");
|
|
47500
47651
|
var import_node_path23 = require("path");
|
|
47501
47652
|
init_runtime_v2();
|
|
47502
47653
|
init_zod();
|
|
47503
|
-
var runMetaSchema = external_exports.object({
|
|
47654
|
+
var runMetaSchema = external_exports.object({
|
|
47655
|
+
runId: runIdSchema,
|
|
47656
|
+
conversationId: conversationIdSchema,
|
|
47657
|
+
agentMode: external_exports.string().optional(),
|
|
47658
|
+
userMessage: external_exports.object({
|
|
47659
|
+
id: external_exports.string(),
|
|
47660
|
+
content: external_exports.string(),
|
|
47661
|
+
turnOrdinal: external_exports.number().int().nullable(),
|
|
47662
|
+
createdAt: external_exports.string(),
|
|
47663
|
+
clientMessageId: external_exports.string().optional(),
|
|
47664
|
+
attachmentIds: external_exports.array(external_exports.string()).optional()
|
|
47665
|
+
}).optional(),
|
|
47666
|
+
assistantMessage: external_exports.object({
|
|
47667
|
+
id: external_exports.string(),
|
|
47668
|
+
turnOrdinal: external_exports.number().int().nullable(),
|
|
47669
|
+
createdAt: external_exports.string()
|
|
47670
|
+
}).optional()
|
|
47671
|
+
});
|
|
47504
47672
|
function runDirectory(runsDir, runId) {
|
|
47505
47673
|
const dir = (0, import_node_path23.join)(runsDir, runId);
|
|
47506
47674
|
return {
|
|
@@ -47512,13 +47680,54 @@ function runDirectory(runsDir, runId) {
|
|
|
47512
47680
|
}
|
|
47513
47681
|
async function isRunClaimed(runsDir, runId) {
|
|
47514
47682
|
try {
|
|
47515
|
-
return (await (0,
|
|
47683
|
+
return (await (0, import_promises35.stat)(runDirectory(runsDir, runId).log)).size > 0;
|
|
47516
47684
|
} catch (error61) {
|
|
47517
47685
|
if (errnoCode(error61) === "ENOENT") return false;
|
|
47518
47686
|
throw error61;
|
|
47519
47687
|
}
|
|
47520
47688
|
}
|
|
47521
47689
|
|
|
47690
|
+
// src/run-log/conversation-index.ts
|
|
47691
|
+
var import_promises36 = require("fs/promises");
|
|
47692
|
+
var import_node_path24 = require("path");
|
|
47693
|
+
init_runtime_v2();
|
|
47694
|
+
init_zod();
|
|
47695
|
+
var ORDINALS_PER_SHARD = 1e3;
|
|
47696
|
+
var indexRecordSchema = external_exports.object({
|
|
47697
|
+
ordinal: external_exports.number().int().nonnegative(),
|
|
47698
|
+
nextOrdinal: external_exports.number().int().positive(),
|
|
47699
|
+
runId: runIdSchema
|
|
47700
|
+
});
|
|
47701
|
+
var coverageSchema = external_exports.object({
|
|
47702
|
+
highestOrdinal: external_exports.number().int().nonnegative(),
|
|
47703
|
+
nextExpectedOrdinal: external_exports.number().int().positive()
|
|
47704
|
+
});
|
|
47705
|
+
function indexDirectory(runsDir, conversationId) {
|
|
47706
|
+
return (0, import_node_path24.join)((0, import_node_path24.dirname)(runsDir), "sessions", conversationId, "turn-index");
|
|
47707
|
+
}
|
|
47708
|
+
function shardPath(runsDir, conversationId, ordinal) {
|
|
47709
|
+
return (0, import_node_path24.join)(
|
|
47710
|
+
indexDirectory(runsDir, conversationId),
|
|
47711
|
+
`${Math.floor(ordinal / ORDINALS_PER_SHARD)}.jsonl`
|
|
47712
|
+
);
|
|
47713
|
+
}
|
|
47714
|
+
async function indexConversationRun(runsDir, conversationId, ordinal, assistantOrdinal, runId) {
|
|
47715
|
+
const nextOrdinal = assistantOrdinal + 1;
|
|
47716
|
+
if (nextOrdinal <= ordinal) throw new Error("Assistant order must follow the prompt");
|
|
47717
|
+
const path = shardPath(runsDir, conversationId, ordinal);
|
|
47718
|
+
await (0, import_promises36.mkdir)((0, import_node_path24.dirname)(path), { recursive: true, mode: 448 });
|
|
47719
|
+
await (0, import_promises36.appendFile)(path, `${JSON.stringify({ ordinal, nextOrdinal, runId })}
|
|
47720
|
+
`, { mode: 384 });
|
|
47721
|
+
const coveragePath = (0, import_node_path24.join)((0, import_node_path24.dirname)((0, import_node_path24.dirname)(path)), "coverage.json");
|
|
47722
|
+
const coverage = await readJsonFile(coveragePath, coverageSchema);
|
|
47723
|
+
const current = coverage.kind === "ok" ? coverage.value : null;
|
|
47724
|
+
if (ordinal === 0 && current === null || current?.nextExpectedOrdinal === ordinal)
|
|
47725
|
+
await writeJsonFileAtomic(coveragePath, {
|
|
47726
|
+
highestOrdinal: ordinal,
|
|
47727
|
+
nextExpectedOrdinal: nextOrdinal
|
|
47728
|
+
});
|
|
47729
|
+
}
|
|
47730
|
+
|
|
47522
47731
|
// src/run-log/tail.ts
|
|
47523
47732
|
init_runtime_v2();
|
|
47524
47733
|
var TAIL_BYTES = 64 * 1024;
|
|
@@ -47548,7 +47757,7 @@ var decoder = new TextDecoder();
|
|
|
47548
47757
|
|
|
47549
47758
|
// src/run-log/writer.ts
|
|
47550
47759
|
var import_node_fs9 = require("fs");
|
|
47551
|
-
var
|
|
47760
|
+
var import_node_path25 = require("path");
|
|
47552
47761
|
init_runtime_v2();
|
|
47553
47762
|
function lastSeq(fd, size) {
|
|
47554
47763
|
for (const length of tailWindows(size)) {
|
|
@@ -47564,7 +47773,7 @@ function lastSeq(fd, size) {
|
|
|
47564
47773
|
throw new RuntimeFault("record_too_large", "Run log tail record is larger than any record");
|
|
47565
47774
|
}
|
|
47566
47775
|
function openRunLog(path, clock) {
|
|
47567
|
-
(0, import_node_fs9.mkdirSync)((0,
|
|
47776
|
+
(0, import_node_fs9.mkdirSync)((0, import_node_path25.dirname)(path), { recursive: true, mode: 448 });
|
|
47568
47777
|
const fd = (0, import_node_fs9.openSync)(path, "a+", 384);
|
|
47569
47778
|
let size = (0, import_node_fs9.fstatSync)(fd).size;
|
|
47570
47779
|
let seq = lastSeq(fd, size);
|
|
@@ -47796,10 +48005,30 @@ async function admitAndRun(spec, context, append, sink, signal) {
|
|
|
47796
48005
|
async function claimRun(spec, context) {
|
|
47797
48006
|
if (await isRunClaimed(context.runsDir, spec.runId)) return null;
|
|
47798
48007
|
const paths = runDirectory(context.runsDir, spec.runId);
|
|
47799
|
-
await writeJsonFileAtomic(paths.meta, {
|
|
48008
|
+
await writeJsonFileAtomic(paths.meta, {
|
|
48009
|
+
runId: spec.runId,
|
|
48010
|
+
conversationId: spec.conversationId,
|
|
48011
|
+
...spec.mode ? { agentMode: spec.mode } : {},
|
|
48012
|
+
...spec.userMessage ? { userMessage: spec.userMessage } : {},
|
|
48013
|
+
...spec.assistantMessage ? { assistantMessage: spec.assistantMessage } : {}
|
|
48014
|
+
});
|
|
47800
48015
|
const log = openRunLog(paths.log, context.clock);
|
|
47801
48016
|
const offset = log.append(runAccepted(context.machineId, context.clock.now()));
|
|
47802
48017
|
context.onAppended(spec.runId, offset);
|
|
48018
|
+
if (spec.userMessage?.turnOrdinal !== null && spec.userMessage?.turnOrdinal !== void 0 && spec.assistantMessage?.turnOrdinal !== null && spec.assistantMessage?.turnOrdinal !== void 0) {
|
|
48019
|
+
try {
|
|
48020
|
+
await indexConversationRun(
|
|
48021
|
+
context.runsDir,
|
|
48022
|
+
spec.conversationId,
|
|
48023
|
+
spec.userMessage.turnOrdinal,
|
|
48024
|
+
spec.assistantMessage.turnOrdinal,
|
|
48025
|
+
spec.runId
|
|
48026
|
+
);
|
|
48027
|
+
context.onAppended(spec.runId, offset);
|
|
48028
|
+
} catch (error61) {
|
|
48029
|
+
context.log.warn("holder.conversation_index_failed", { runId: spec.runId, error: error61 });
|
|
48030
|
+
}
|
|
48031
|
+
}
|
|
47803
48032
|
return log;
|
|
47804
48033
|
}
|
|
47805
48034
|
async function runClaimedTurn(spec, claimed, context, signal) {
|
|
@@ -47880,7 +48109,7 @@ async function runHolder({
|
|
|
47880
48109
|
try {
|
|
47881
48110
|
const identity = await readProcessIdentity(process.pid);
|
|
47882
48111
|
if (identity === null) throw new RuntimeFault("internal", "Cannot read own process identity");
|
|
47883
|
-
const _engines = __using(_stack, recordSpawnedEngines(engineRecordsPath((0,
|
|
48112
|
+
const _engines = __using(_stack, recordSpawnedEngines(engineRecordsPath((0, import_node_path26.dirname)(launch.statusPath)), clock, log));
|
|
47884
48113
|
const holder = {
|
|
47885
48114
|
state: "idle",
|
|
47886
48115
|
runId: null,
|
|
@@ -48223,7 +48452,7 @@ function loadRuntimeConfig(env = process.env, totalMemoryBytes = (0, import_node
|
|
|
48223
48452
|
providerProbes: ALAN_RUNTIME_PROVIDER_PROBES === "on",
|
|
48224
48453
|
providerToolchain: ALAN_RUNTIME_PROVIDER_NODE !== void 0 && ALAN_RUNTIME_PROVIDER_NPM_CLI !== void 0 ? { node: ALAN_RUNTIME_PROVIDER_NODE, npmCli: ALAN_RUNTIME_PROVIDER_NPM_CLI } : null,
|
|
48225
48454
|
home,
|
|
48226
|
-
configHome: XDG_CONFIG_HOME ?? (0,
|
|
48455
|
+
configHome: XDG_CONFIG_HOME ?? (0, import_node_path28.join)(home, ".config"),
|
|
48227
48456
|
...githubProxyConfig({ ALAN_RUNTIME_GITHUB_PROXY, XDG_CONFIG_HOME, GH_CONFIG_DIR }, home),
|
|
48228
48457
|
gitGatewayUrl: ALAN_RUNTIME_GIT_GATEWAY_URL ?? null,
|
|
48229
48458
|
workspaceRoot: ALAN_RUNTIME_WORKSPACE_ROOT ?? null,
|
|
@@ -48232,10 +48461,10 @@ function loadRuntimeConfig(env = process.env, totalMemoryBytes = (0, import_node
|
|
|
48232
48461
|
};
|
|
48233
48462
|
}
|
|
48234
48463
|
function githubProxyConfig(env, home) {
|
|
48235
|
-
const configHome = env.XDG_CONFIG_HOME ?? (0,
|
|
48464
|
+
const configHome = env.XDG_CONFIG_HOME ?? (0, import_node_path28.join)(home, ".config");
|
|
48236
48465
|
return {
|
|
48237
48466
|
githubProxy: env.ALAN_RUNTIME_GITHUB_PROXY === "on",
|
|
48238
|
-
ghConfigDir: env.GH_CONFIG_DIR ?? (0,
|
|
48467
|
+
ghConfigDir: env.GH_CONFIG_DIR ?? (0, import_node_path28.join)(configHome, "gh")
|
|
48239
48468
|
};
|
|
48240
48469
|
}
|
|
48241
48470
|
function serviceEnvironment(env, profile) {
|
|
@@ -48334,7 +48563,8 @@ async function loadStoredAccess(paths, access3 = { exec: systemExec }) {
|
|
|
48334
48563
|
}
|
|
48335
48564
|
|
|
48336
48565
|
// src/cli/commands/hold.ts
|
|
48337
|
-
var
|
|
48566
|
+
var import_node_path29 = require("path");
|
|
48567
|
+
init_agent2();
|
|
48338
48568
|
init_runtime_v2();
|
|
48339
48569
|
async function machineAccess(paths, log, conversationId, transport) {
|
|
48340
48570
|
const initial = await loadStoredAccess(paths).catch(
|
|
@@ -48391,7 +48621,7 @@ async function runHold(argv) {
|
|
|
48391
48621
|
const config2 = loadRuntimeConfig();
|
|
48392
48622
|
const paths = runtimePaths(config2.stateDir);
|
|
48393
48623
|
const log = __using(_stack, openFileLog(
|
|
48394
|
-
(0,
|
|
48624
|
+
(0, import_node_path29.join)(paths.logs, `holder-${launch.value.conversationId}.jsonl`),
|
|
48395
48625
|
config2.logLevel,
|
|
48396
48626
|
systemClock
|
|
48397
48627
|
));
|
|
@@ -48402,15 +48632,26 @@ async function runHold(argv) {
|
|
|
48402
48632
|
);
|
|
48403
48633
|
const transport = __using(_stack, createHttpTransport());
|
|
48404
48634
|
const access3 = await machineAccess(paths, log, launch.value.conversationId, transport);
|
|
48635
|
+
const credentialPath = (0, import_node_path29.join)(paths.tmp, "mcp", `${launch.value.conversationId}.json`);
|
|
48636
|
+
const managedMcp = __using(_stack, access3.managedMcp === void 0 ? void 0 : createHelperMcpAccess({
|
|
48637
|
+
managedMcp: access3.managedMcp,
|
|
48638
|
+
conversationId: launch.value.conversationId,
|
|
48639
|
+
credentialPath
|
|
48640
|
+
}), true);
|
|
48641
|
+
const providerEnvironment2 = access3.managedMcp === void 0 ? cliEnvironment : {
|
|
48642
|
+
...cliEnvironment,
|
|
48643
|
+
[ALAN_MCP_URL_ENV]: access3.managedMcp.url,
|
|
48644
|
+
[ALAN_MCP_CREDENTIAL_FILE_ENV]: credentialPath
|
|
48645
|
+
};
|
|
48405
48646
|
await runHolder({
|
|
48406
48647
|
launch: launch.value,
|
|
48407
48648
|
driver: createProviderDrivers({
|
|
48408
|
-
cliEnvironment,
|
|
48649
|
+
cliEnvironment: providerEnvironment2,
|
|
48409
48650
|
defaultCwd: process.cwd(),
|
|
48410
48651
|
timings: config2.sessionTimings,
|
|
48411
48652
|
log,
|
|
48412
|
-
|
|
48413
|
-
|
|
48653
|
+
...managedMcp === void 0 ? {} : { managedMcp },
|
|
48654
|
+
codexCredentials: access3.codexCredentials
|
|
48414
48655
|
}),
|
|
48415
48656
|
clock: systemClock,
|
|
48416
48657
|
log,
|
|
@@ -48425,7 +48666,8 @@ async function runHold(argv) {
|
|
|
48425
48666
|
} catch (_) {
|
|
48426
48667
|
var _error = _, _hasError = true;
|
|
48427
48668
|
} finally {
|
|
48428
|
-
__callDispose(_stack, _error, _hasError);
|
|
48669
|
+
var _promise2 = __callDispose(_stack, _error, _hasError);
|
|
48670
|
+
_promise2 && await _promise2;
|
|
48429
48671
|
}
|
|
48430
48672
|
}
|
|
48431
48673
|
|