@alan-ai-hq/agent-manager-darwin-arm64 0.1.136 → 0.1.137
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 +209 -85
- package/alan-holder.cjs +168 -44
- package/package.json +1 -1
package/alan-agent.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
|
});
|
|
@@ -20358,6 +20363,7 @@ var init_desired_state = __esm({
|
|
|
20358
20363
|
/** Omitted by older servers; only an explicit entitlement enables context-search guidance. */
|
|
20359
20364
|
contextGraphEnabled: external_exports.boolean().optional(),
|
|
20360
20365
|
cloudEnvironmentId: external_exports.guid().optional(),
|
|
20366
|
+
sandboxId: external_exports.string().min(1).optional(),
|
|
20361
20367
|
localRepoUrls: external_exports.array(external_exports.string().min(1)).optional()
|
|
20362
20368
|
// Never here: the provider API key. The holder fetches it per run (RUN_PROVIDER_CREDENTIAL_PATH).
|
|
20363
20369
|
});
|
|
@@ -21372,6 +21378,7 @@ var init_workflow_tools_filter = __esm({
|
|
|
21372
21378
|
WORKFLOW_ALWAYS_ALLOWED_BUILTIN_TOOLS = [
|
|
21373
21379
|
"search_context",
|
|
21374
21380
|
"create_test_report",
|
|
21381
|
+
"publish_capture",
|
|
21375
21382
|
"create_plan",
|
|
21376
21383
|
"create_document_artifact",
|
|
21377
21384
|
"list_artifacts",
|
|
@@ -21853,12 +21860,14 @@ function isExternalMcpServerName(name) {
|
|
|
21853
21860
|
function isMcpConfigKey(name) {
|
|
21854
21861
|
return MCP_CONFIG_KEY.test(name);
|
|
21855
21862
|
}
|
|
21856
|
-
var ALAN_MCP_AUTHORIZATION_ENV, ALAN_RUN_ID_ENV, MCP_CONFIG_KEY;
|
|
21863
|
+
var ALAN_MCP_AUTHORIZATION_ENV, ALAN_RUN_ID_ENV, ALAN_MCP_URL_ENV, ALAN_MCP_CREDENTIAL_FILE_ENV, MCP_CONFIG_KEY;
|
|
21857
21864
|
var init_mcp_config = __esm({
|
|
21858
21865
|
"../shared/dist/agent/mcp-config.js"() {
|
|
21859
21866
|
"use strict";
|
|
21860
21867
|
ALAN_MCP_AUTHORIZATION_ENV = "ALAN_MCP_AUTHORIZATION";
|
|
21861
21868
|
ALAN_RUN_ID_ENV = "ALAN_RUN_ID";
|
|
21869
|
+
ALAN_MCP_URL_ENV = "ALAN_MCP_URL";
|
|
21870
|
+
ALAN_MCP_CREDENTIAL_FILE_ENV = "ALAN_MCP_CREDENTIAL_FILE";
|
|
21862
21871
|
MCP_CONFIG_KEY = /^[A-Za-z0-9_-]+$/;
|
|
21863
21872
|
}
|
|
21864
21873
|
});
|
|
@@ -25721,7 +25730,7 @@ var init_chunk_J2KTV5FP = __esm({
|
|
|
25721
25730
|
}
|
|
25722
25731
|
});
|
|
25723
25732
|
|
|
25724
|
-
// ../agent-core/dist/chunk-
|
|
25733
|
+
// ../agent-core/dist/chunk-ITTV3UIM.js
|
|
25725
25734
|
function truncate(value2, limit) {
|
|
25726
25735
|
const normalized2 = Array.from(value2, (character) => {
|
|
25727
25736
|
const code = character.charCodeAt(0);
|
|
@@ -25974,9 +25983,41 @@ function teamOverlay(spec) {
|
|
|
25974
25983
|
function present(values) {
|
|
25975
25984
|
return values.filter((value2) => Boolean(value2?.length));
|
|
25976
25985
|
}
|
|
25986
|
+
function cloudExecutionSection(spec) {
|
|
25987
|
+
if (!spec.sandboxId && !spec.cloudEnvironmentId) return void 0;
|
|
25988
|
+
const lines2 = ["## Cloud execution", "You are executing inside an Alan cloud sandbox."];
|
|
25989
|
+
if (spec.sandboxId) lines2.push(`Sandbox ID: ${spec.sandboxId}.`);
|
|
25990
|
+
if (spec.cloudEnvironmentId) lines2.push(`Cloud environment ID: ${spec.cloudEnvironmentId}.`);
|
|
25991
|
+
lines2.push(
|
|
25992
|
+
"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."
|
|
25993
|
+
);
|
|
25994
|
+
if (!isReadOnlyMode(spec.mode) && !isReadOnlyAgent(spec.agentId)) {
|
|
25995
|
+
lines2.push(
|
|
25996
|
+
"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."
|
|
25997
|
+
);
|
|
25998
|
+
}
|
|
25999
|
+
const skills = spec.promptContext?.availableSkills ?? [];
|
|
26000
|
+
lines2.push(
|
|
26001
|
+
"## Installed skills",
|
|
26002
|
+
"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."
|
|
26003
|
+
);
|
|
26004
|
+
if (skills.length === 0) {
|
|
26005
|
+
lines2.push(
|
|
26006
|
+
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."
|
|
26007
|
+
);
|
|
26008
|
+
} else {
|
|
26009
|
+
for (const skill of skills) {
|
|
26010
|
+
lines2.push(
|
|
26011
|
+
`- ${JSON.stringify(skill.name)}: ${JSON.stringify(skill.description)} \u2014 ${JSON.stringify(`${skill.packageDirectory}/SKILL.md`)}`
|
|
26012
|
+
);
|
|
26013
|
+
}
|
|
26014
|
+
}
|
|
26015
|
+
return lines2.join("\n");
|
|
26016
|
+
}
|
|
25977
26017
|
function promptParts(input2) {
|
|
25978
26018
|
const { spec } = input2;
|
|
25979
26019
|
const overlay = teamOverlay(spec);
|
|
26020
|
+
const cloud = cloudExecutionSection(spec);
|
|
25980
26021
|
const workspace = input2.workspacePath ? `You are working inside: ${input2.workspacePath}
|
|
25981
26022
|
Prefer relative paths and keep your work scoped to this project.` : void 0;
|
|
25982
26023
|
return {
|
|
@@ -25985,6 +26026,7 @@ Prefer relative paths and keep your work scoped to this project.` : void 0;
|
|
|
25985
26026
|
spec.agentPrompt?.trim() || getAlanAgentPrompt(spec.agentId),
|
|
25986
26027
|
getAlanModePrompt(agentModeOf(spec.mode)),
|
|
25987
26028
|
workspace,
|
|
26029
|
+
cloud,
|
|
25988
26030
|
taskLifecycleSection(spec),
|
|
25989
26031
|
overlay,
|
|
25990
26032
|
...contextSections(spec),
|
|
@@ -25992,6 +26034,7 @@ Prefer relative paths and keep your work scoped to this project.` : void 0;
|
|
|
25992
26034
|
]),
|
|
25993
26035
|
append: present([
|
|
25994
26036
|
ALAN_PLATFORM_TOOL_ROUTING_PROMPT,
|
|
26037
|
+
cloud,
|
|
25995
26038
|
spec.contextGraphEnabled === true ? ALAN_CONTEXT_SEARCH_PROMPT : void 0,
|
|
25996
26039
|
overlay
|
|
25997
26040
|
])
|
|
@@ -26048,8 +26091,8 @@ ${body}` : body;
|
|
|
26048
26091
|
return spec.mode === "plan" ? planModePrefix(prefixed) : prefixed;
|
|
26049
26092
|
}
|
|
26050
26093
|
var MAX_PARSED_ATTACHMENTS, MAX_PARSED_ATTACHMENT_CHARS, MAX_METADATA_CHARS, UNAVAILABLE, READ_ONLY_MODES, AGENT_MODES;
|
|
26051
|
-
var
|
|
26052
|
-
"../agent-core/dist/chunk-
|
|
26094
|
+
var init_chunk_ITTV3UIM = __esm({
|
|
26095
|
+
"../agent-core/dist/chunk-ITTV3UIM.js"() {
|
|
26053
26096
|
"use strict";
|
|
26054
26097
|
init_agent2();
|
|
26055
26098
|
MAX_PARSED_ATTACHMENTS = 3;
|
|
@@ -27321,7 +27364,7 @@ var init_claude = __esm({
|
|
|
27321
27364
|
init_chunk_54ZRJOQP();
|
|
27322
27365
|
init_chunk_J2KTV5FP();
|
|
27323
27366
|
init_chunk_J4T6L5LX();
|
|
27324
|
-
|
|
27367
|
+
init_chunk_ITTV3UIM();
|
|
27325
27368
|
init_chunk_YXWJW7I5();
|
|
27326
27369
|
init_effort();
|
|
27327
27370
|
import_crypto6 = require("crypto");
|
|
@@ -30098,7 +30141,7 @@ var init_codex = __esm({
|
|
|
30098
30141
|
init_chunk_54ZRJOQP();
|
|
30099
30142
|
init_chunk_J2KTV5FP();
|
|
30100
30143
|
init_chunk_J4T6L5LX();
|
|
30101
|
-
|
|
30144
|
+
init_chunk_ITTV3UIM();
|
|
30102
30145
|
init_chunk_YXWJW7I5();
|
|
30103
30146
|
import_fs6 = require("fs");
|
|
30104
30147
|
import_path6 = require("path");
|
|
@@ -42115,7 +42158,7 @@ var init_acp3 = __esm({
|
|
|
42115
42158
|
init_chunk_54ZRJOQP();
|
|
42116
42159
|
init_chunk_J2KTV5FP();
|
|
42117
42160
|
init_chunk_J4T6L5LX();
|
|
42118
|
-
|
|
42161
|
+
init_chunk_ITTV3UIM();
|
|
42119
42162
|
init_chunk_YXWJW7I5();
|
|
42120
42163
|
import_promises48 = require("fs/promises");
|
|
42121
42164
|
import_path9 = require("path");
|
|
@@ -43819,7 +43862,7 @@ var init_opencode = __esm({
|
|
|
43819
43862
|
init_chunk_54ZRJOQP();
|
|
43820
43863
|
init_chunk_J2KTV5FP();
|
|
43821
43864
|
init_chunk_J4T6L5LX();
|
|
43822
|
-
|
|
43865
|
+
init_chunk_ITTV3UIM();
|
|
43823
43866
|
init_chunk_YXWJW7I5();
|
|
43824
43867
|
import_http10 = require("http");
|
|
43825
43868
|
init_runtime_v2();
|
|
@@ -45627,7 +45670,7 @@ var init_droid = __esm({
|
|
|
45627
45670
|
init_chunk_54ZRJOQP();
|
|
45628
45671
|
init_chunk_J2KTV5FP();
|
|
45629
45672
|
init_chunk_J4T6L5LX();
|
|
45630
|
-
|
|
45673
|
+
init_chunk_ITTV3UIM();
|
|
45631
45674
|
init_chunk_YXWJW7I5();
|
|
45632
45675
|
init_runtime_v2();
|
|
45633
45676
|
import_crypto15 = require("crypto");
|
|
@@ -46729,7 +46772,7 @@ var init_antigravity = __esm({
|
|
|
46729
46772
|
init_chunk_UGRKZTAD();
|
|
46730
46773
|
init_chunk_54ZRJOQP();
|
|
46731
46774
|
init_chunk_J4T6L5LX();
|
|
46732
|
-
|
|
46775
|
+
init_chunk_ITTV3UIM();
|
|
46733
46776
|
init_chunk_YXWJW7I5();
|
|
46734
46777
|
import_promises52 = require("fs/promises");
|
|
46735
46778
|
import_path12 = require("path");
|
|
@@ -47434,7 +47477,7 @@ var init_command_code = __esm({
|
|
|
47434
47477
|
init_chunk_54ZRJOQP();
|
|
47435
47478
|
init_chunk_J2KTV5FP();
|
|
47436
47479
|
init_chunk_J4T6L5LX();
|
|
47437
|
-
|
|
47480
|
+
init_chunk_ITTV3UIM();
|
|
47438
47481
|
init_chunk_YXWJW7I5();
|
|
47439
47482
|
import_promises53 = require("fs/promises");
|
|
47440
47483
|
import_path15 = require("path");
|
|
@@ -52832,7 +52875,7 @@ var require_websocket_server = __commonJS({
|
|
|
52832
52875
|
// package.json
|
|
52833
52876
|
var package_default = {
|
|
52834
52877
|
name: "@alan-ai-hq/agent-manager",
|
|
52835
|
-
version: "0.1.
|
|
52878
|
+
version: "0.1.137",
|
|
52836
52879
|
private: true,
|
|
52837
52880
|
type: "module",
|
|
52838
52881
|
description: "Alan machine runtime (alan-agent): identity, link, reconciler, session holders, run log, uploader, local API",
|
|
@@ -52882,7 +52925,7 @@ var package_default = {
|
|
|
52882
52925
|
|
|
52883
52926
|
// src/cli/commands/compat.ts
|
|
52884
52927
|
var import_node_crypto30 = require("crypto");
|
|
52885
|
-
var
|
|
52928
|
+
var import_promises65 = require("fs/promises");
|
|
52886
52929
|
init_runtime_v2();
|
|
52887
52930
|
init_zod();
|
|
52888
52931
|
|
|
@@ -63341,6 +63384,38 @@ async function resolveSkillInvocations(layout, invocations) {
|
|
|
63341
63384
|
}
|
|
63342
63385
|
return missing.length === 0 ? { kind: "resolved", skills: resolved } : { kind: "missing", names: missing };
|
|
63343
63386
|
}
|
|
63387
|
+
async function availableSkillIndex(layout) {
|
|
63388
|
+
const found = /* @__PURE__ */ new Map();
|
|
63389
|
+
const candidates2 = [];
|
|
63390
|
+
for (const skill of await readInstalledSkills(layout)) {
|
|
63391
|
+
candidates2.push({
|
|
63392
|
+
directory: packageDirectory(layout, skill.versionId),
|
|
63393
|
+
contentHash: skill.contentHash
|
|
63394
|
+
});
|
|
63395
|
+
}
|
|
63396
|
+
if (layout.nativeDir !== null) {
|
|
63397
|
+
const entries = await (0, import_promises40.readdir)(layout.nativeDir, { withFileTypes: true }).catch(() => []);
|
|
63398
|
+
for (const entry of entries) {
|
|
63399
|
+
if (entry.isDirectory() || entry.isSymbolicLink())
|
|
63400
|
+
candidates2.push({ directory: (0, import_node_path42.join)(layout.nativeDir, entry.name) });
|
|
63401
|
+
}
|
|
63402
|
+
}
|
|
63403
|
+
for (const candidate of candidates2.slice(0, 2e3)) {
|
|
63404
|
+
const skill = await inspectIndexedSkill(candidate.directory, candidate.contentHash);
|
|
63405
|
+
if (skill !== null && !found.has(skill.name)) found.set(skill.name, skill);
|
|
63406
|
+
}
|
|
63407
|
+
return [...found.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
63408
|
+
}
|
|
63409
|
+
async function inspectIndexedSkill(directory, contentHash) {
|
|
63410
|
+
try {
|
|
63411
|
+
const inspected = await inspectSkillPackage(directory, { expectedName: null });
|
|
63412
|
+
if (contentHash && inspected.contentHash !== contentHash) return null;
|
|
63413
|
+
const { name, description } = inspected.metadata;
|
|
63414
|
+
return { name, description, packageDirectory: directory };
|
|
63415
|
+
} catch {
|
|
63416
|
+
return null;
|
|
63417
|
+
}
|
|
63418
|
+
}
|
|
63344
63419
|
|
|
63345
63420
|
// src/capabilities/skills/local-preview.ts
|
|
63346
63421
|
var MAX_INLINE_IMAGE_BYTES = 2 * 1024 * 1024;
|
|
@@ -65092,7 +65167,7 @@ async function sendNativeHookSignal(discoveryPath, hookSignal, signal) {
|
|
|
65092
65167
|
|
|
65093
65168
|
// src/sessions/index.ts
|
|
65094
65169
|
var import_node_crypto29 = require("crypto");
|
|
65095
|
-
var
|
|
65170
|
+
var import_promises63 = require("fs/promises");
|
|
65096
65171
|
var import_node_os10 = require("os");
|
|
65097
65172
|
var import_node_path63 = require("path");
|
|
65098
65173
|
init_runtime_v2();
|
|
@@ -65429,8 +65504,33 @@ function createConversationMcpAuthorization(options) {
|
|
|
65429
65504
|
};
|
|
65430
65505
|
}
|
|
65431
65506
|
|
|
65432
|
-
// src/holder/
|
|
65507
|
+
// src/holder/mcp-helper-access.ts
|
|
65433
65508
|
var import_promises54 = require("fs/promises");
|
|
65509
|
+
function createHelperMcpAccess(options) {
|
|
65510
|
+
return {
|
|
65511
|
+
[Symbol.asyncDispose]: async () => {
|
|
65512
|
+
await (0, import_promises54.rm)(options.credentialPath, { force: true });
|
|
65513
|
+
},
|
|
65514
|
+
url: options.managedMcp.url,
|
|
65515
|
+
authorization: async (signal) => {
|
|
65516
|
+
const authorization = await options.managedMcp.authorization(signal);
|
|
65517
|
+
if (authorization === void 0 || signal.aborted) {
|
|
65518
|
+
await (0, import_promises54.rm)(options.credentialPath, { force: true });
|
|
65519
|
+
return void 0;
|
|
65520
|
+
}
|
|
65521
|
+
const credential = {
|
|
65522
|
+
url: options.managedMcp.url,
|
|
65523
|
+
authorization,
|
|
65524
|
+
conversationId: options.conversationId
|
|
65525
|
+
};
|
|
65526
|
+
await writeJsonFileAtomic(options.credentialPath, credential);
|
|
65527
|
+
return authorization;
|
|
65528
|
+
}
|
|
65529
|
+
};
|
|
65530
|
+
}
|
|
65531
|
+
|
|
65532
|
+
// src/holder/run-inputs.ts
|
|
65533
|
+
var import_promises55 = require("fs/promises");
|
|
65434
65534
|
var import_node_path53 = require("path");
|
|
65435
65535
|
var NO_RUN_INPUTS = {
|
|
65436
65536
|
attachments: [],
|
|
@@ -65446,16 +65546,16 @@ function safeFilename(filename) {
|
|
|
65446
65546
|
async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [] }) {
|
|
65447
65547
|
const dir = (0, import_node_path53.join)(tmpDir, "runs", spec.runId);
|
|
65448
65548
|
const cleanup = async () => {
|
|
65449
|
-
await (0,
|
|
65549
|
+
await (0, import_promises55.rm)(dir, { recursive: true, force: true });
|
|
65450
65550
|
};
|
|
65451
65551
|
try {
|
|
65452
65552
|
const credential = await source.fetchProviderCredential(spec.runId, signal);
|
|
65453
65553
|
const attachments = [];
|
|
65454
|
-
if (spec.attachments?.length) await (0,
|
|
65554
|
+
if (spec.attachments?.length) await (0, import_promises55.mkdir)(dir, { recursive: true, mode: 448 });
|
|
65455
65555
|
for (const [index, attachment] of (spec.attachments ?? []).entries()) {
|
|
65456
65556
|
const bytes = await source.downloadAttachment(spec.runId, attachment.id, signal);
|
|
65457
65557
|
const path4 = (0, import_node_path53.join)(dir, `${index}-${safeFilename(attachment.filename)}`);
|
|
65458
|
-
await (0,
|
|
65558
|
+
await (0, import_promises55.writeFile)(path4, bytes, { mode: 384 });
|
|
65459
65559
|
attachments.push({
|
|
65460
65560
|
id: attachment.id,
|
|
65461
65561
|
kind: attachment.kind,
|
|
@@ -65490,7 +65590,7 @@ init_runtime_v2();
|
|
|
65490
65590
|
|
|
65491
65591
|
// src/holder/admission.ts
|
|
65492
65592
|
var import_node_fs18 = require("fs");
|
|
65493
|
-
var
|
|
65593
|
+
var import_promises59 = require("fs/promises");
|
|
65494
65594
|
var import_node_os9 = require("os");
|
|
65495
65595
|
var import_node_path58 = require("path");
|
|
65496
65596
|
init_constants();
|
|
@@ -65504,7 +65604,7 @@ function resolveAlanDefaultWorkspacePath(homeDirectory = (0, import_node_os8.hom
|
|
|
65504
65604
|
}
|
|
65505
65605
|
|
|
65506
65606
|
// src/holder/admission-relocation.ts
|
|
65507
|
-
var
|
|
65607
|
+
var import_promises56 = require("fs/promises");
|
|
65508
65608
|
var import_node_path55 = require("path");
|
|
65509
65609
|
var MAX_RELOCATION_CANDIDATES = 200;
|
|
65510
65610
|
var RELOCATION_BUDGET_MS = 2e4;
|
|
@@ -65540,7 +65640,7 @@ async function originIdentity(git, path4, signal) {
|
|
|
65540
65640
|
}
|
|
65541
65641
|
async function childDirectories(parent, limit) {
|
|
65542
65642
|
try {
|
|
65543
|
-
const entries = await (0,
|
|
65643
|
+
const entries = await (0, import_promises56.readdir)(parent, { withFileTypes: true });
|
|
65544
65644
|
return entries.filter((entry) => entry.isDirectory()).slice(0, limit).map((entry) => (0, import_node_path55.join)(parent, entry.name));
|
|
65545
65645
|
} catch {
|
|
65546
65646
|
return [];
|
|
@@ -65577,7 +65677,7 @@ async function discoverRelocatedWorkspace(search) {
|
|
|
65577
65677
|
|
|
65578
65678
|
// src/holder/checkout-refresh.ts
|
|
65579
65679
|
var import_node_crypto26 = require("crypto");
|
|
65580
|
-
var
|
|
65680
|
+
var import_promises57 = require("fs/promises");
|
|
65581
65681
|
var import_node_path56 = require("path");
|
|
65582
65682
|
function short(sha) {
|
|
65583
65683
|
return sha.slice(0, 12);
|
|
@@ -65590,8 +65690,8 @@ function staleLine(path4, snapshot2, tip) {
|
|
|
65590
65690
|
}
|
|
65591
65691
|
async function claimOnce(dir, name) {
|
|
65592
65692
|
try {
|
|
65593
|
-
await (0,
|
|
65594
|
-
await (await (0,
|
|
65693
|
+
await (0, import_promises57.mkdir)(dir, { recursive: true, mode: 448 });
|
|
65694
|
+
await (await (0, import_promises57.open)((0, import_node_path56.join)(dir, name), "wx")).close();
|
|
65595
65695
|
return true;
|
|
65596
65696
|
} catch {
|
|
65597
65697
|
return false;
|
|
@@ -65674,7 +65774,7 @@ function createCheckoutRefresh(deps) {
|
|
|
65674
65774
|
}
|
|
65675
65775
|
|
|
65676
65776
|
// src/holder/lease.ts
|
|
65677
|
-
var
|
|
65777
|
+
var import_promises58 = require("fs/promises");
|
|
65678
65778
|
var import_node_path57 = require("path");
|
|
65679
65779
|
var LEASE_CHECK_EVERY_MS = 5e3;
|
|
65680
65780
|
var MAX_TRANSIENT_FAILURES = 3;
|
|
@@ -65689,8 +65789,8 @@ function identityFailure(code, workspacePath) {
|
|
|
65689
65789
|
return { code, problemCode: "app.workspace.missing", message: MESSAGES[code], workspacePath };
|
|
65690
65790
|
}
|
|
65691
65791
|
async function fileIdentity(path4) {
|
|
65692
|
-
const canonical = await (0,
|
|
65693
|
-
const info = await (0,
|
|
65792
|
+
const canonical = await (0, import_promises58.realpath)(path4);
|
|
65793
|
+
const info = await (0, import_promises58.stat)(canonical, { bigint: true });
|
|
65694
65794
|
return `${canonical}:${info.dev}:${info.ino}`;
|
|
65695
65795
|
}
|
|
65696
65796
|
async function snapshot(git, path4, signal) {
|
|
@@ -65709,7 +65809,7 @@ async function snapshot(git, path4, signal) {
|
|
|
65709
65809
|
workspace: await fileIdentity(path4),
|
|
65710
65810
|
repository: await fileIdentity(commonDir),
|
|
65711
65811
|
worktree: await fileIdentity(gitDir),
|
|
65712
|
-
commonDir: await (0,
|
|
65812
|
+
commonDir: await (0, import_promises58.realpath)(commonDir)
|
|
65713
65813
|
};
|
|
65714
65814
|
} catch {
|
|
65715
65815
|
return null;
|
|
@@ -65722,7 +65822,7 @@ async function gitValue(git, path4, args, signal) {
|
|
|
65722
65822
|
}
|
|
65723
65823
|
async function pathExists(path4) {
|
|
65724
65824
|
try {
|
|
65725
|
-
await (0,
|
|
65825
|
+
await (0, import_promises58.stat)(path4);
|
|
65726
65826
|
return true;
|
|
65727
65827
|
} catch (error61) {
|
|
65728
65828
|
return errnoCode(error61) !== "ENOENT" && errnoCode(error61) !== "ENOTDIR";
|
|
@@ -65731,13 +65831,13 @@ async function pathExists(path4) {
|
|
|
65731
65831
|
async function hasGitMarker(path4) {
|
|
65732
65832
|
let directory;
|
|
65733
65833
|
try {
|
|
65734
|
-
directory = await (0,
|
|
65834
|
+
directory = await (0, import_promises58.realpath)(path4);
|
|
65735
65835
|
} catch {
|
|
65736
65836
|
return true;
|
|
65737
65837
|
}
|
|
65738
65838
|
for (; ; ) {
|
|
65739
65839
|
try {
|
|
65740
|
-
await (0,
|
|
65840
|
+
await (0, import_promises58.stat)((0, import_node_path57.join)(directory, ".git"));
|
|
65741
65841
|
return true;
|
|
65742
65842
|
} catch (error61) {
|
|
65743
65843
|
const code = errnoCode(error61);
|
|
@@ -65907,7 +66007,7 @@ function volumeRoot(path4) {
|
|
|
65907
66007
|
}
|
|
65908
66008
|
async function exists4(path4) {
|
|
65909
66009
|
try {
|
|
65910
|
-
await (0,
|
|
66010
|
+
await (0, import_promises59.stat)(path4);
|
|
65911
66011
|
return true;
|
|
65912
66012
|
} catch {
|
|
65913
66013
|
return false;
|
|
@@ -65915,10 +66015,10 @@ async function exists4(path4) {
|
|
|
65915
66015
|
}
|
|
65916
66016
|
async function inspectReadiness(path4) {
|
|
65917
66017
|
try {
|
|
65918
|
-
if (!(await (0,
|
|
66018
|
+
if (!(await (0, import_promises59.stat)(path4)).isDirectory()) {
|
|
65919
66019
|
return { ready: false, missing: true, message: MESSAGES2.missing };
|
|
65920
66020
|
}
|
|
65921
|
-
await (0,
|
|
66021
|
+
await (0, import_promises59.access)(path4, import_node_fs18.constants.R_OK | import_node_fs18.constants.W_OK | import_node_fs18.constants.X_OK);
|
|
65922
66022
|
return { ready: true };
|
|
65923
66023
|
} catch (error61) {
|
|
65924
66024
|
const code = errnoCode(error61) ?? "";
|
|
@@ -65996,8 +66096,8 @@ async function admitDefaultWorkspace(spec, context, skills) {
|
|
|
65996
66096
|
const { env } = context;
|
|
65997
66097
|
const path4 = resolveAlanDefaultWorkspacePath(env.HOME || env.USERPROFILE || (0, import_node_os9.homedir)());
|
|
65998
66098
|
try {
|
|
65999
|
-
await (0,
|
|
66000
|
-
await (0,
|
|
66099
|
+
await (0, import_promises59.mkdir)(path4, { recursive: true, mode: 448 });
|
|
66100
|
+
await (0, import_promises59.access)(path4, import_node_fs18.constants.R_OK | import_node_fs18.constants.W_OK | import_node_fs18.constants.X_OK);
|
|
66001
66101
|
return {
|
|
66002
66102
|
kind: "admitted",
|
|
66003
66103
|
spec: { ...spec, projectPath: path4 },
|
|
@@ -66013,6 +66113,16 @@ async function admitDefaultWorkspace(spec, context, skills) {
|
|
|
66013
66113
|
);
|
|
66014
66114
|
}
|
|
66015
66115
|
}
|
|
66116
|
+
async function withInstalledCloudSkills(spec, context) {
|
|
66117
|
+
if (!spec.sandboxId && !spec.cloudEnvironmentId || context.skills === void 0) return spec;
|
|
66118
|
+
return {
|
|
66119
|
+
...spec,
|
|
66120
|
+
promptContext: {
|
|
66121
|
+
...spec.promptContext,
|
|
66122
|
+
availableSkills: await availableSkillIndex(context.skills)
|
|
66123
|
+
}
|
|
66124
|
+
};
|
|
66125
|
+
}
|
|
66016
66126
|
async function admitRun(spec, context, signal) {
|
|
66017
66127
|
const provider4 = await checkProvider(spec, context);
|
|
66018
66128
|
if (provider4 !== null) return provider4;
|
|
@@ -66024,6 +66134,7 @@ async function admitRun(spec, context, signal) {
|
|
|
66024
66134
|
);
|
|
66025
66135
|
}
|
|
66026
66136
|
const skills = selected.skills;
|
|
66137
|
+
spec = await withInstalledCloudSkills(spec, context);
|
|
66027
66138
|
const projectPath = spec.projectPath;
|
|
66028
66139
|
if (projectPath === void 0) {
|
|
66029
66140
|
return { kind: "admitted", spec, relocated: null, leaseTargets: [], skills };
|
|
@@ -66115,7 +66226,7 @@ async function respondToTurn(runningRunId, gate, driver, request2) {
|
|
|
66115
66226
|
}
|
|
66116
66227
|
|
|
66117
66228
|
// src/holder/session-facts.ts
|
|
66118
|
-
var
|
|
66229
|
+
var import_promises60 = require("fs/promises");
|
|
66119
66230
|
var CLI_RSS_CACHE_MS = 1e4;
|
|
66120
66231
|
var LOGIN_PROBLEM_PREFIX = "cli.auth.";
|
|
66121
66232
|
function isLoginFailure(result) {
|
|
@@ -66141,8 +66252,8 @@ function createSessionFacts(options) {
|
|
|
66141
66252
|
const path4 = await resolveCommandOnPath(command, env, platform3);
|
|
66142
66253
|
if (path4 === null) return null;
|
|
66143
66254
|
try {
|
|
66144
|
-
const real = await (0,
|
|
66145
|
-
const info = await (0,
|
|
66255
|
+
const real = await (0, import_promises60.realpath)(path4);
|
|
66256
|
+
const info = await (0, import_promises60.stat)(real);
|
|
66146
66257
|
return { command, key: `${real}:${info.ino}:${info.size}:${info.mtimeMs}` };
|
|
66147
66258
|
} catch {
|
|
66148
66259
|
return null;
|
|
@@ -66234,7 +66345,7 @@ var import_node_fs19 = require("fs");
|
|
|
66234
66345
|
var import_node_path60 = require("path");
|
|
66235
66346
|
|
|
66236
66347
|
// src/run-log/directory.ts
|
|
66237
|
-
var
|
|
66348
|
+
var import_promises61 = require("fs/promises");
|
|
66238
66349
|
var import_node_path59 = require("path");
|
|
66239
66350
|
init_runtime_v2();
|
|
66240
66351
|
init_zod();
|
|
@@ -66254,7 +66365,7 @@ function runDirectory(runsDir, runId) {
|
|
|
66254
66365
|
}
|
|
66255
66366
|
async function isRunClaimed(runsDir, runId) {
|
|
66256
66367
|
try {
|
|
66257
|
-
return (await (0,
|
|
66368
|
+
return (await (0, import_promises61.stat)(runDirectory(runsDir, runId).log)).size > 0;
|
|
66258
66369
|
} catch (error61) {
|
|
66259
66370
|
if (errnoCode(error61) === "ENOENT") return false;
|
|
66260
66371
|
throw error61;
|
|
@@ -66292,7 +66403,7 @@ async function writeCompleteRunLog(runsDir, meta3, records) {
|
|
|
66292
66403
|
}
|
|
66293
66404
|
|
|
66294
66405
|
// src/run-log/reader.ts
|
|
66295
|
-
var
|
|
66406
|
+
var import_promises62 = require("fs/promises");
|
|
66296
66407
|
init_runtime_v2();
|
|
66297
66408
|
|
|
66298
66409
|
// src/run-log/tail.ts
|
|
@@ -66315,7 +66426,7 @@ function firstRecordLength(bytes) {
|
|
|
66315
66426
|
return bytes.indexOf(RUN_LOG_RECORD_SEPARATOR) + 1;
|
|
66316
66427
|
}
|
|
66317
66428
|
async function openRunLogReader(path4) {
|
|
66318
|
-
const handle = await (0,
|
|
66429
|
+
const handle = await (0, import_promises62.open)(path4, "r");
|
|
66319
66430
|
const readAt = async (position, length) => {
|
|
66320
66431
|
const buffer = Buffer.alloc(length);
|
|
66321
66432
|
const { bytesRead } = await handle.read(buffer, 0, length, position);
|
|
@@ -66349,7 +66460,7 @@ async function openRunLogReader(path4) {
|
|
|
66349
66460
|
};
|
|
66350
66461
|
}
|
|
66351
66462
|
async function readLastRecord(path4) {
|
|
66352
|
-
const handle = await (0,
|
|
66463
|
+
const handle = await (0, import_promises62.open)(path4, "r").catch(() => null);
|
|
66353
66464
|
if (handle === null) return null;
|
|
66354
66465
|
try {
|
|
66355
66466
|
const { size } = await handle.stat();
|
|
@@ -67009,7 +67120,7 @@ var DEFAULT_MAX_ACTIVE_RUNS = 32;
|
|
|
67009
67120
|
var HOLDER_BUSY = "busy";
|
|
67010
67121
|
async function listIds(dir, schema) {
|
|
67011
67122
|
const ids = [];
|
|
67012
|
-
for (const name of await (0,
|
|
67123
|
+
for (const name of await (0, import_promises63.readdir)(dir).catch(() => [])) {
|
|
67013
67124
|
const parsed = schema.safeParse(name);
|
|
67014
67125
|
if (parsed.success) ids.push(parsed.data);
|
|
67015
67126
|
}
|
|
@@ -67065,7 +67176,7 @@ async function openSessions(deps) {
|
|
|
67065
67176
|
await reapLeftoverEngines(engineRecordsPath(dir), { clock, log, conversationId }).catch(
|
|
67066
67177
|
(error61) => log.warn("sessions.engine_reap_failed", { conversationId, error: error61 })
|
|
67067
67178
|
);
|
|
67068
|
-
await (0,
|
|
67179
|
+
await (0, import_promises63.rm)(dir, { recursive: true, force: true });
|
|
67069
67180
|
};
|
|
67070
67181
|
const retireIfGone = async (conversationId) => {
|
|
67071
67182
|
const files = sessionFiles(paths, conversationId);
|
|
@@ -67153,7 +67264,7 @@ async function openSessions(deps) {
|
|
|
67153
67264
|
log.info("sessions.reattached", { conversationId });
|
|
67154
67265
|
return;
|
|
67155
67266
|
}
|
|
67156
|
-
if (alive) await (0,
|
|
67267
|
+
if (alive) await (0, import_promises63.rm)(files.dir, { recursive: true, force: true });
|
|
67157
67268
|
else await discardSession(conversationId);
|
|
67158
67269
|
};
|
|
67159
67270
|
const busyRunIds = async () => {
|
|
@@ -67211,7 +67322,7 @@ async function openSessions(deps) {
|
|
|
67211
67322
|
const meta3 = await readRunMeta(dir.meta);
|
|
67212
67323
|
const last = await readLastRecord(dir.log);
|
|
67213
67324
|
if (meta3 === null || last === null) return null;
|
|
67214
|
-
const logged = await (0,
|
|
67325
|
+
const logged = await (0, import_promises63.stat)(dir.log).catch((error61) => {
|
|
67215
67326
|
if (errnoCode(error61) === "ENOENT") return null;
|
|
67216
67327
|
throw error61;
|
|
67217
67328
|
});
|
|
@@ -67591,7 +67702,7 @@ function takeEnrollmentCodeFromEnv(env = process.env) {
|
|
|
67591
67702
|
}
|
|
67592
67703
|
|
|
67593
67704
|
// src/cli/context.ts
|
|
67594
|
-
var
|
|
67705
|
+
var import_promises64 = require("fs/promises");
|
|
67595
67706
|
var import_node_os12 = require("os");
|
|
67596
67707
|
var import_node_path65 = require("path");
|
|
67597
67708
|
var DESKTOP_BUNDLE_IDS = {
|
|
@@ -67641,7 +67752,7 @@ async function installedServiceSpec(ctx) {
|
|
|
67641
67752
|
const spec = serviceSpec(ctx);
|
|
67642
67753
|
if (ctx.config.host === "app") return spec;
|
|
67643
67754
|
const layout = installLayout(ctx.config.installDir, ctx.config.profile);
|
|
67644
|
-
const installed = await (0,
|
|
67755
|
+
const installed = await (0, import_promises64.access)(layout.launcher).then(
|
|
67645
67756
|
() => true,
|
|
67646
67757
|
() => false
|
|
67647
67758
|
);
|
|
@@ -67769,7 +67880,7 @@ var manifestRevisionSchema = external_exports.object({ revision: external_export
|
|
|
67769
67880
|
async function manifestRevision(path4) {
|
|
67770
67881
|
let raw;
|
|
67771
67882
|
try {
|
|
67772
|
-
raw = JSON.parse(await (0,
|
|
67883
|
+
raw = JSON.parse(await (0, import_promises65.readFile)(path4, "utf8"));
|
|
67773
67884
|
} catch (error61) {
|
|
67774
67885
|
throw new RuntimeFault("invalid_file", `Cannot read the skill manifest at ${path4}`, {
|
|
67775
67886
|
cause: error61
|
|
@@ -67823,7 +67934,7 @@ async function runSkills(argv) {
|
|
|
67823
67934
|
}
|
|
67824
67935
|
|
|
67825
67936
|
// src/cli/commands/doctor.ts
|
|
67826
|
-
var
|
|
67937
|
+
var import_promises68 = require("fs/promises");
|
|
67827
67938
|
var import_node_path69 = require("path");
|
|
67828
67939
|
init_runtime_v2();
|
|
67829
67940
|
|
|
@@ -68001,7 +68112,7 @@ async function authorizeDevice(input2) {
|
|
|
68001
68112
|
}
|
|
68002
68113
|
|
|
68003
68114
|
// src/identity/enroll.ts
|
|
68004
|
-
var
|
|
68115
|
+
var import_promises66 = require("fs/promises");
|
|
68005
68116
|
init_runtime_v2();
|
|
68006
68117
|
|
|
68007
68118
|
// src/identity/installation.ts
|
|
@@ -68105,12 +68216,12 @@ async function enrollFromGrantFile(input2) {
|
|
|
68105
68216
|
clock: input2.clock,
|
|
68106
68217
|
access: input2.access
|
|
68107
68218
|
});
|
|
68108
|
-
await (0,
|
|
68219
|
+
await (0, import_promises66.rm)(input2.grantPath, { force: true });
|
|
68109
68220
|
return machine;
|
|
68110
68221
|
}
|
|
68111
68222
|
|
|
68112
68223
|
// src/identity/migrate-v1.ts
|
|
68113
|
-
var
|
|
68224
|
+
var import_promises67 = require("fs/promises");
|
|
68114
68225
|
var import_node_path67 = require("path");
|
|
68115
68226
|
init_runtime_v2();
|
|
68116
68227
|
init_zod();
|
|
@@ -68161,8 +68272,8 @@ async function scrubLegacyInstall(install2) {
|
|
|
68161
68272
|
const scrubbed = { ...install2.config, migratedToRuntimeV2: true };
|
|
68162
68273
|
for (const key of SCRUBBED_KEYS) delete scrubbed[key];
|
|
68163
68274
|
await writeJsonFileAtomic(`${install2.configPath}.migrated-v1`, scrubbed);
|
|
68164
|
-
await (0,
|
|
68165
|
-
await (0,
|
|
68275
|
+
await (0, import_promises67.rm)(install2.configPath, { force: true });
|
|
68276
|
+
await (0, import_promises67.rm)(install2.ownerLeasePath, { force: true });
|
|
68166
68277
|
}
|
|
68167
68278
|
async function exchangeCredential(deps) {
|
|
68168
68279
|
const { config: config2 } = deps.install;
|
|
@@ -68571,7 +68682,7 @@ async function probeHolder(dir, conversationId) {
|
|
|
68571
68682
|
}
|
|
68572
68683
|
}
|
|
68573
68684
|
async function holdersCheck(ctx) {
|
|
68574
|
-
const names = await (0,
|
|
68685
|
+
const names = await (0, import_promises68.readdir)(ctx.paths.sessions).catch(() => []);
|
|
68575
68686
|
const holders = (await Promise.all(names.map((name) => probeHolder((0, import_node_path69.join)(ctx.paths.sessions, name), name)))).filter((facts) => facts !== null);
|
|
68576
68687
|
const dead = holders.filter((holder) => !holder.alive).length;
|
|
68577
68688
|
return check2(
|
|
@@ -68583,7 +68694,7 @@ async function holdersCheck(ctx) {
|
|
|
68583
68694
|
}
|
|
68584
68695
|
async function freeBytesAt(path4) {
|
|
68585
68696
|
try {
|
|
68586
|
-
const stats = await (0,
|
|
68697
|
+
const stats = await (0, import_promises68.statfs)(path4);
|
|
68587
68698
|
return { path: path4, freeBytes: stats.bavail * stats.bsize };
|
|
68588
68699
|
} catch (error61) {
|
|
68589
68700
|
const parent = (0, import_node_path69.dirname)(path4);
|
|
@@ -68722,7 +68833,7 @@ async function runDoctor(argv, context = cliContext) {
|
|
|
68722
68833
|
}
|
|
68723
68834
|
|
|
68724
68835
|
// src/cli/commands/git-credential.ts
|
|
68725
|
-
var
|
|
68836
|
+
var import_promises69 = require("fs/promises");
|
|
68726
68837
|
var import_node_net4 = require("net");
|
|
68727
68838
|
var MAX_RESPONSE_BYTES = 64 * 1024;
|
|
68728
68839
|
async function readAll(stream) {
|
|
@@ -68832,7 +68943,7 @@ async function configure(argv) {
|
|
|
68832
68943
|
}
|
|
68833
68944
|
async function configureGitGateway(config2, gatewayUrl, signal) {
|
|
68834
68945
|
const { launcher } = installLayout(config2.installDir, config2.profile);
|
|
68835
|
-
const installed = await (0,
|
|
68946
|
+
const installed = await (0, import_promises69.access)(launcher).then(
|
|
68836
68947
|
() => true,
|
|
68837
68948
|
() => false
|
|
68838
68949
|
);
|
|
@@ -68860,6 +68971,7 @@ async function runGitCredential(argv) {
|
|
|
68860
68971
|
|
|
68861
68972
|
// src/cli/commands/hold.ts
|
|
68862
68973
|
var import_node_path70 = require("path");
|
|
68974
|
+
init_agent2();
|
|
68863
68975
|
init_runtime_v2();
|
|
68864
68976
|
async function machineAccess(paths, log, conversationId, transport) {
|
|
68865
68977
|
const initial = await loadStoredAccess(paths).catch(
|
|
@@ -68927,15 +69039,26 @@ async function runHold(argv) {
|
|
|
68927
69039
|
);
|
|
68928
69040
|
const transport = __using(_stack, createHttpTransport());
|
|
68929
69041
|
const access7 = await machineAccess(paths, log, launch.value.conversationId, transport);
|
|
69042
|
+
const credentialPath = (0, import_node_path70.join)(paths.tmp, "mcp", `${launch.value.conversationId}.json`);
|
|
69043
|
+
const managedMcp = __using(_stack, access7.managedMcp === void 0 ? void 0 : createHelperMcpAccess({
|
|
69044
|
+
managedMcp: access7.managedMcp,
|
|
69045
|
+
conversationId: launch.value.conversationId,
|
|
69046
|
+
credentialPath
|
|
69047
|
+
}), true);
|
|
69048
|
+
const providerEnvironment2 = access7.managedMcp === void 0 ? cliEnvironment : {
|
|
69049
|
+
...cliEnvironment,
|
|
69050
|
+
[ALAN_MCP_URL_ENV]: access7.managedMcp.url,
|
|
69051
|
+
[ALAN_MCP_CREDENTIAL_FILE_ENV]: credentialPath
|
|
69052
|
+
};
|
|
68930
69053
|
await runHolder({
|
|
68931
69054
|
launch: launch.value,
|
|
68932
69055
|
driver: createProviderDrivers({
|
|
68933
|
-
cliEnvironment,
|
|
69056
|
+
cliEnvironment: providerEnvironment2,
|
|
68934
69057
|
defaultCwd: process.cwd(),
|
|
68935
69058
|
timings: config2.sessionTimings,
|
|
68936
69059
|
log,
|
|
68937
|
-
|
|
68938
|
-
|
|
69060
|
+
...managedMcp === void 0 ? {} : { managedMcp },
|
|
69061
|
+
codexCredentials: access7.codexCredentials
|
|
68939
69062
|
}),
|
|
68940
69063
|
clock: systemClock,
|
|
68941
69064
|
log,
|
|
@@ -68950,7 +69073,8 @@ async function runHold(argv) {
|
|
|
68950
69073
|
} catch (_) {
|
|
68951
69074
|
var _error = _, _hasError = true;
|
|
68952
69075
|
} finally {
|
|
68953
|
-
__callDispose(_stack, _error, _hasError);
|
|
69076
|
+
var _promise2 = __callDispose(_stack, _error, _hasError);
|
|
69077
|
+
_promise2 && await _promise2;
|
|
68954
69078
|
}
|
|
68955
69079
|
}
|
|
68956
69080
|
|
|
@@ -69023,7 +69147,7 @@ async function runHook(argv, overrides = {}) {
|
|
|
69023
69147
|
}
|
|
69024
69148
|
|
|
69025
69149
|
// src/cli/commands/ingestion-hooks.ts
|
|
69026
|
-
var
|
|
69150
|
+
var import_promises70 = require("fs/promises");
|
|
69027
69151
|
var CODEX_TRUST_NOTE = "Codex runs new hooks only after you review them: open /hooks in Codex.";
|
|
69028
69152
|
function isAction(value2) {
|
|
69029
69153
|
return value2 === "enable" || value2 === "disable" || value2 === "status";
|
|
@@ -69046,7 +69170,7 @@ function errorMessage2(error61) {
|
|
|
69046
69170
|
return error61 instanceof Error ? error61.message : String(error61);
|
|
69047
69171
|
}
|
|
69048
69172
|
async function exists5(path4) {
|
|
69049
|
-
return (0,
|
|
69173
|
+
return (0, import_promises70.access)(path4).then(
|
|
69050
69174
|
() => true,
|
|
69051
69175
|
() => false
|
|
69052
69176
|
);
|
|
@@ -69405,7 +69529,7 @@ async function runToken(argv, signal) {
|
|
|
69405
69529
|
}
|
|
69406
69530
|
|
|
69407
69531
|
// src/cli/commands/logout.ts
|
|
69408
|
-
var
|
|
69532
|
+
var import_promises71 = require("fs/promises");
|
|
69409
69533
|
var import_node_path74 = require("path");
|
|
69410
69534
|
init_runtime_v2();
|
|
69411
69535
|
var RUNTIME_EXIT_WAIT_MS = 35e3;
|
|
@@ -69465,7 +69589,7 @@ async function stopHolder(launch, deps, outcome2) {
|
|
|
69465
69589
|
}
|
|
69466
69590
|
async function stopHeldRuns(ctx, deps, outcome2 = "aborted") {
|
|
69467
69591
|
const stopped = [];
|
|
69468
|
-
for (const name of await (0,
|
|
69592
|
+
for (const name of await (0, import_promises71.readdir)(ctx.paths.sessions).catch(() => [])) {
|
|
69469
69593
|
const launch = await readJsonFile(
|
|
69470
69594
|
(0, import_node_path74.join)(ctx.paths.sessions, name, "launch.json"),
|
|
69471
69595
|
holderLaunchSchema
|
|
@@ -69504,7 +69628,7 @@ async function forgetMachineLocally(ctx) {
|
|
|
69504
69628
|
const machine = await readMachineFile(ctx.paths);
|
|
69505
69629
|
if (machine === null) return;
|
|
69506
69630
|
await credentialStoreFor(ctx.paths, machine.credentialStore, ctx.access).clear();
|
|
69507
|
-
await (0,
|
|
69631
|
+
await (0, import_promises71.rm)(ctx.paths.machine, { force: true });
|
|
69508
69632
|
}
|
|
69509
69633
|
async function runLogout(argv, signal) {
|
|
69510
69634
|
var _stack = [];
|
|
@@ -69593,7 +69717,7 @@ function createRunAppends() {
|
|
|
69593
69717
|
|
|
69594
69718
|
// src/local-api/server.ts
|
|
69595
69719
|
var import_node_crypto33 = require("crypto");
|
|
69596
|
-
var
|
|
69720
|
+
var import_promises72 = require("fs/promises");
|
|
69597
69721
|
var import_node_http4 = require("http");
|
|
69598
69722
|
var import_node_path75 = require("path");
|
|
69599
69723
|
|
|
@@ -70332,7 +70456,7 @@ async function serveLocalApi(deps) {
|
|
|
70332
70456
|
await watchedStatus[Symbol.asyncDispose]();
|
|
70333
70457
|
const current = await readJsonFile(discoveryPath, localApiDiscoverySchema);
|
|
70334
70458
|
if (current.kind === "ok" && current.value.token === token) {
|
|
70335
|
-
await (0,
|
|
70459
|
+
await (0, import_promises72.rm)(discoveryPath, { force: true });
|
|
70336
70460
|
}
|
|
70337
70461
|
await closeServer(server);
|
|
70338
70462
|
log.info("local_api.closed", {});
|
|
@@ -74085,7 +74209,7 @@ function refusalFailure(refusal2) {
|
|
|
74085
74209
|
}
|
|
74086
74210
|
|
|
74087
74211
|
// src/link/probe.ts
|
|
74088
|
-
var
|
|
74212
|
+
var import_promises73 = require("dns/promises");
|
|
74089
74213
|
var import_node_net5 = require("net");
|
|
74090
74214
|
var import_node_tls2 = require("tls");
|
|
74091
74215
|
var PROBE_TIMEOUT_MS4 = 5e3;
|
|
@@ -74121,7 +74245,7 @@ async function connectOnce(url3, clock) {
|
|
|
74121
74245
|
}
|
|
74122
74246
|
async function probeEndpoint(url3, clock) {
|
|
74123
74247
|
try {
|
|
74124
|
-
await (0,
|
|
74248
|
+
await (0, import_promises73.lookup)(url3.hostname);
|
|
74125
74249
|
} catch (error61) {
|
|
74126
74250
|
const reason = classifyTransportFailure(error61);
|
|
74127
74251
|
return reason === "other" ? "dns" : reason;
|
|
@@ -74562,7 +74686,7 @@ function createReconciler(host, lifecycle, log, signal) {
|
|
|
74562
74686
|
}
|
|
74563
74687
|
|
|
74564
74688
|
// src/uploader/index.ts
|
|
74565
|
-
var
|
|
74689
|
+
var import_promises74 = require("fs/promises");
|
|
74566
74690
|
init_runtime_v2();
|
|
74567
74691
|
init_zod();
|
|
74568
74692
|
var RETRY_DELAYS_MS = [250, 500, 1e3, 2e3, 5e3, 1e4, 3e4];
|
|
@@ -74703,7 +74827,7 @@ function startUploader({ api, runsDir, clock, log }) {
|
|
|
74703
74827
|
active.set(runId, task);
|
|
74704
74828
|
};
|
|
74705
74829
|
const sweep2 = async () => {
|
|
74706
|
-
for (const name of await (0,
|
|
74830
|
+
for (const name of await (0, import_promises74.readdir)(runsDir).catch(() => [])) {
|
|
74707
74831
|
const runId = runIdSchema.safeParse(name);
|
|
74708
74832
|
if (runId.success) run2(runId.data);
|
|
74709
74833
|
}
|
|
@@ -74713,18 +74837,18 @@ function startUploader({ api, runsDir, clock, log }) {
|
|
|
74713
74837
|
const dir = runDirectory(runsDir, runId);
|
|
74714
74838
|
const progress = await readJsonFile(dir.upload, uploadProgressSchema);
|
|
74715
74839
|
if (progress.kind !== "ok" || !progress.value.sealed) return false;
|
|
74716
|
-
const sealedAt = (await (0,
|
|
74840
|
+
const sealedAt = (await (0, import_promises74.stat)(dir.upload)).mtimeMs;
|
|
74717
74841
|
if (clock.now() - sealedAt < options.sealedForMs) return false;
|
|
74718
74842
|
return (await readLastRecord(dir.log))?.update.sessionUpdate === "_alan/run.ended";
|
|
74719
74843
|
};
|
|
74720
74844
|
const prune = async (options) => {
|
|
74721
74845
|
let removed = 0;
|
|
74722
|
-
for (const name of await (0,
|
|
74846
|
+
for (const name of await (0, import_promises74.readdir)(runsDir).catch(() => [])) {
|
|
74723
74847
|
const runId = runIdSchema.safeParse(name);
|
|
74724
74848
|
if (!runId.success) continue;
|
|
74725
74849
|
try {
|
|
74726
74850
|
if (!await isPrunable(runId.data, options)) continue;
|
|
74727
|
-
await (0,
|
|
74851
|
+
await (0, import_promises74.rm)(runDirectory(runsDir, runId.data).dir, { recursive: true, force: true });
|
|
74728
74852
|
removed += 1;
|
|
74729
74853
|
} catch (error61) {
|
|
74730
74854
|
log.warn("upload.prune_failed", { runId: runId.data, error: error61 });
|
|
@@ -76024,17 +76148,17 @@ async function runServiceCommand(argv, ctx = cliContext()) {
|
|
|
76024
76148
|
}
|
|
76025
76149
|
|
|
76026
76150
|
// src/cli/commands/upgrade.ts
|
|
76027
|
-
var
|
|
76151
|
+
var import_promises75 = require("fs/promises");
|
|
76028
76152
|
var import_node_path79 = require("path");
|
|
76029
76153
|
function isNotNewer(version2, installed) {
|
|
76030
76154
|
return installed !== null && isReleaseVersion(version2) && isReleaseVersion(installed) && compareVersions(version2, installed) <= 0;
|
|
76031
76155
|
}
|
|
76032
76156
|
async function installFromSource(source) {
|
|
76033
76157
|
const { layout, from, ifNewer } = source;
|
|
76034
|
-
const isTarball = (await (0,
|
|
76158
|
+
const isTarball = (await (0, import_promises75.stat)(from)).isFile();
|
|
76035
76159
|
const downloads = (0, import_node_path79.join)(layout.root, ".downloads");
|
|
76036
|
-
if (isTarball) await (0,
|
|
76037
|
-
const scratch = isTarball ? await (0,
|
|
76160
|
+
if (isTarball) await (0, import_promises75.mkdir)(downloads, { recursive: true, mode: 448 });
|
|
76161
|
+
const scratch = isTarball ? await (0, import_promises75.mkdtemp)((0, import_node_path79.join)(downloads, "upgrade-")) : null;
|
|
76038
76162
|
try {
|
|
76039
76163
|
const sourceDir = scratch === null ? from : await extractPackageTarball(from, scratch);
|
|
76040
76164
|
const version2 = await readPackageVersion(sourceDir);
|
|
@@ -76042,7 +76166,7 @@ async function installFromSource(source) {
|
|
|
76042
76166
|
if (ifNewer && isNotNewer(version2, installed)) return { kind: "skipped", version: version2, installed };
|
|
76043
76167
|
return { kind: "installed", ...await installVersion(layout, sourceDir) };
|
|
76044
76168
|
} finally {
|
|
76045
|
-
if (scratch !== null) await (0,
|
|
76169
|
+
if (scratch !== null) await (0, import_promises75.rm)(scratch, { recursive: true, force: true });
|
|
76046
76170
|
}
|
|
76047
76171
|
}
|
|
76048
76172
|
async function runUpgrade(argv) {
|