@alan-ai-hq/agent-manager-linux-x64 0.1.175 → 0.1.177
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 +1469 -1013
- package/alan-holder.cjs +472 -195
- package/alan-lease.cjs +18 -7
- package/package.json +1 -1
package/alan-holder.cjs
CHANGED
|
@@ -22353,6 +22353,7 @@ var init_problem = __esm({
|
|
|
22353
22353
|
"cli.process.not_found",
|
|
22354
22354
|
"cli.process.nonzero_exit",
|
|
22355
22355
|
"cli.process.signal",
|
|
22356
|
+
"cli.process.out_of_memory",
|
|
22356
22357
|
"cli.process.timeout",
|
|
22357
22358
|
"cli.tool.failed",
|
|
22358
22359
|
"cli.unknown"
|
|
@@ -22527,6 +22528,21 @@ var init_cli_usage = __esm({
|
|
|
22527
22528
|
}
|
|
22528
22529
|
});
|
|
22529
22530
|
|
|
22531
|
+
// ../shared/src/schema/conversations/agent-runs-contracts.ts
|
|
22532
|
+
var agentRunOutcomeEnum;
|
|
22533
|
+
var init_agent_runs_contracts = __esm({
|
|
22534
|
+
"../shared/src/schema/conversations/agent-runs-contracts.ts"() {
|
|
22535
|
+
"use strict";
|
|
22536
|
+
agentRunOutcomeEnum = [
|
|
22537
|
+
"completed",
|
|
22538
|
+
"aborted",
|
|
22539
|
+
"interrupted",
|
|
22540
|
+
"rejected",
|
|
22541
|
+
"failed"
|
|
22542
|
+
];
|
|
22543
|
+
}
|
|
22544
|
+
});
|
|
22545
|
+
|
|
22530
22546
|
// ../shared/src/runtime-v2/run-log.ts
|
|
22531
22547
|
function isRunLifecycleKind(sessionUpdate2) {
|
|
22532
22548
|
return RUN_LIFECYCLE_KINDS.has(sessionUpdate2);
|
|
@@ -22538,6 +22554,7 @@ var init_run_log = __esm({
|
|
|
22538
22554
|
init_zod();
|
|
22539
22555
|
init_problem();
|
|
22540
22556
|
init_cli_usage();
|
|
22557
|
+
init_agent_runs_contracts();
|
|
22541
22558
|
init_ids();
|
|
22542
22559
|
RUN_LOG_RECORD_SEPARATOR = 10;
|
|
22543
22560
|
RUN_STEERS_MAX = 100;
|
|
@@ -22568,13 +22585,7 @@ var init_run_log = __esm({
|
|
|
22568
22585
|
previousPath: external_exports.string().min(1).max(4096),
|
|
22569
22586
|
canonicalPath: external_exports.string().min(1).max(4096)
|
|
22570
22587
|
});
|
|
22571
|
-
runOutcomeSchema = external_exports.enum(
|
|
22572
|
-
"completed",
|
|
22573
|
-
"failed",
|
|
22574
|
-
"aborted",
|
|
22575
|
-
"interrupted",
|
|
22576
|
-
"rejected"
|
|
22577
|
-
]);
|
|
22588
|
+
runOutcomeSchema = external_exports.enum(agentRunOutcomeEnum);
|
|
22578
22589
|
runRejectionCodeSchema = external_exports.enum([
|
|
22579
22590
|
"capacity",
|
|
22580
22591
|
"maintenance",
|
|
@@ -23996,7 +24007,7 @@ var init_kinds = __esm({
|
|
|
23996
24007
|
recoveryClass: "needs_env"
|
|
23997
24008
|
},
|
|
23998
24009
|
out_of_memory: {
|
|
23999
|
-
message: "
|
|
24010
|
+
message: "The agent ran out of memory on this machine and was stopped. Free memory or use a larger machine, then send Continue.",
|
|
24000
24011
|
recoveryClass: "needs_env"
|
|
24001
24012
|
},
|
|
24002
24013
|
provider_error: {
|
|
@@ -24513,7 +24524,7 @@ var init_problem2 = __esm({
|
|
|
24513
24524
|
history_rejected: "cli.resume_failed",
|
|
24514
24525
|
permission_denied: "cli.tool.failed",
|
|
24515
24526
|
interpreter_missing: "cli.process.not_found",
|
|
24516
|
-
out_of_memory: "cli.process.
|
|
24527
|
+
out_of_memory: "cli.process.out_of_memory",
|
|
24517
24528
|
provider_error: "cli.unknown",
|
|
24518
24529
|
subagent_parent_exited: "cli.process.nonzero_exit",
|
|
24519
24530
|
tool_call_invalid: "cli.tool.failed",
|
|
@@ -25102,10 +25113,33 @@ var init_line_splitter = __esm({
|
|
|
25102
25113
|
}
|
|
25103
25114
|
});
|
|
25104
25115
|
|
|
25116
|
+
// ../agent-core/src/process/oom-kills.ts
|
|
25117
|
+
function parseOomKills(vmstat) {
|
|
25118
|
+
const match = /^oom_kill\s+(\d+)$/m.exec(vmstat);
|
|
25119
|
+
return match?.[1] === void 0 ? null : Number(match[1]);
|
|
25120
|
+
}
|
|
25121
|
+
function systemOomKillCounter(platform = process.platform) {
|
|
25122
|
+
if (platform !== "linux") return () => Promise.resolve(null);
|
|
25123
|
+
return async () => {
|
|
25124
|
+
try {
|
|
25125
|
+
return parseOomKills(await (0, import_promises12.readFile)("/proc/vmstat", "utf8"));
|
|
25126
|
+
} catch {
|
|
25127
|
+
return null;
|
|
25128
|
+
}
|
|
25129
|
+
};
|
|
25130
|
+
}
|
|
25131
|
+
var import_promises12;
|
|
25132
|
+
var init_oom_kills = __esm({
|
|
25133
|
+
"../agent-core/src/process/oom-kills.ts"() {
|
|
25134
|
+
"use strict";
|
|
25135
|
+
import_promises12 = require("fs/promises");
|
|
25136
|
+
}
|
|
25137
|
+
});
|
|
25138
|
+
|
|
25105
25139
|
// ../agent-core/src/process/process-identity.ts
|
|
25106
25140
|
async function linuxStartTicks(pid) {
|
|
25107
25141
|
try {
|
|
25108
|
-
const stat16 = await (0,
|
|
25142
|
+
const stat16 = await (0, import_promises13.readFile)(`/proc/${pid}/stat`, "utf8");
|
|
25109
25143
|
const fields = stat16.slice(stat16.lastIndexOf(")") + 2).split(" ");
|
|
25110
25144
|
return fields[19];
|
|
25111
25145
|
} catch {
|
|
@@ -25129,12 +25163,12 @@ async function captureProcessIdentity(pid, platform = process.platform) {
|
|
|
25129
25163
|
const startedAt = await readProcessStartTime(pid, platform);
|
|
25130
25164
|
return startedAt === void 0 ? void 0 : { pid, startedAt };
|
|
25131
25165
|
}
|
|
25132
|
-
var import_node_child_process6,
|
|
25166
|
+
var import_node_child_process6, import_promises13;
|
|
25133
25167
|
var init_process_identity = __esm({
|
|
25134
25168
|
"../agent-core/src/process/process-identity.ts"() {
|
|
25135
25169
|
"use strict";
|
|
25136
25170
|
import_node_child_process6 = require("child_process");
|
|
25137
|
-
|
|
25171
|
+
import_promises13 = require("fs/promises");
|
|
25138
25172
|
}
|
|
25139
25173
|
});
|
|
25140
25174
|
|
|
@@ -25435,7 +25469,7 @@ async function waitForWindowsJob(child, command, options = {}) {
|
|
|
25435
25469
|
try {
|
|
25436
25470
|
while (systemClock2.monotonic() < deadline) {
|
|
25437
25471
|
options.signal?.throwIfAborted();
|
|
25438
|
-
const providerPid = await (0,
|
|
25472
|
+
const providerPid = await (0, import_promises14.readFile)(status.path, "utf8").catch(() => void 0);
|
|
25439
25473
|
if (providerPid !== void 0) {
|
|
25440
25474
|
requireStartedProvider(providerPid, command);
|
|
25441
25475
|
return;
|
|
@@ -25458,17 +25492,17 @@ async function waitForWindowsJob(child, command, options = {}) {
|
|
|
25458
25492
|
throw new CoreFault("spawn_failed", `Could not start ${command} (Windows helper timed out)`);
|
|
25459
25493
|
} finally {
|
|
25460
25494
|
statuses.delete(child);
|
|
25461
|
-
await (0,
|
|
25495
|
+
await (0, import_promises14.rm)(status.directory, { recursive: true, force: true });
|
|
25462
25496
|
}
|
|
25463
25497
|
}
|
|
25464
|
-
var import_node_child_process9, import_node_crypto8, import_node_fs8,
|
|
25498
|
+
var import_node_child_process9, import_node_crypto8, import_node_fs8, import_promises14, import_node_os2, import_node_path10, statuses, START_TIMEOUT_MS;
|
|
25465
25499
|
var init_windows_helper = __esm({
|
|
25466
25500
|
"../agent-core/src/process/windows-helper.ts"() {
|
|
25467
25501
|
"use strict";
|
|
25468
25502
|
import_node_child_process9 = require("child_process");
|
|
25469
25503
|
import_node_crypto8 = require("crypto");
|
|
25470
25504
|
import_node_fs8 = require("fs");
|
|
25471
|
-
|
|
25505
|
+
import_promises14 = require("fs/promises");
|
|
25472
25506
|
import_node_os2 = require("os");
|
|
25473
25507
|
import_node_path10 = require("path");
|
|
25474
25508
|
init_kernel();
|
|
@@ -25627,6 +25661,7 @@ var init_process = __esm({
|
|
|
25627
25661
|
init_flag_probe();
|
|
25628
25662
|
init_flag_probe_store();
|
|
25629
25663
|
init_line_splitter();
|
|
25664
|
+
init_oom_kills();
|
|
25630
25665
|
init_process_identity();
|
|
25631
25666
|
init_process_list();
|
|
25632
25667
|
init_process_tree();
|
|
@@ -26017,7 +26052,11 @@ var init_models = __esm({
|
|
|
26017
26052
|
sortOrder: 10,
|
|
26018
26053
|
upstreamModelId: "deepseek/deepseek-v4.1-flash-1017",
|
|
26019
26054
|
contextWindow: 1048576,
|
|
26020
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26055
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26056
|
+
inputPriceMicroUsdPerMtok: 15e4,
|
|
26057
|
+
outputPriceMicroUsdPerMtok: 6e5,
|
|
26058
|
+
cacheReadPriceMicroUsdPerMtok: 3e3,
|
|
26059
|
+
routing: { tier: "workhorse", priority: 10, strengths: ["speed", "cost", "general"] }
|
|
26021
26060
|
},
|
|
26022
26061
|
{
|
|
26023
26062
|
id: "deepseek/deepseek-v4-pro",
|
|
@@ -26028,7 +26067,10 @@ var init_models = __esm({
|
|
|
26028
26067
|
sortOrder: 20,
|
|
26029
26068
|
upstreamModelId: "deepseek/deepseek-v4-pro",
|
|
26030
26069
|
contextWindow: 1048576,
|
|
26031
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26070
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26071
|
+
inputPriceMicroUsdPerMtok: 816234,
|
|
26072
|
+
outputPriceMicroUsdPerMtok: 1632468,
|
|
26073
|
+
cacheReadPriceMicroUsdPerMtok: 68020
|
|
26032
26074
|
},
|
|
26033
26075
|
{
|
|
26034
26076
|
id: "particle-ai/particle-1",
|
|
@@ -26039,7 +26081,10 @@ var init_models = __esm({
|
|
|
26039
26081
|
sortOrder: 25,
|
|
26040
26082
|
upstreamModelId: "particle-ai/particle-1",
|
|
26041
26083
|
contextWindow: 1048576,
|
|
26042
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26084
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26085
|
+
inputPriceMicroUsdPerMtok: 25e4,
|
|
26086
|
+
outputPriceMicroUsdPerMtok: 1e6,
|
|
26087
|
+
cacheReadPriceMicroUsdPerMtok: 3e3
|
|
26043
26088
|
},
|
|
26044
26089
|
{
|
|
26045
26090
|
id: "z-ai/glm-5.3",
|
|
@@ -26050,7 +26095,15 @@ var init_models = __esm({
|
|
|
26050
26095
|
sortOrder: 30,
|
|
26051
26096
|
upstreamModelId: "z-ai/glm-5.3",
|
|
26052
26097
|
contextWindow: 1048576,
|
|
26053
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26098
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26099
|
+
inputPriceMicroUsdPerMtok: 8e4,
|
|
26100
|
+
outputPriceMicroUsdPerMtok: 36e5,
|
|
26101
|
+
cacheReadPriceMicroUsdPerMtok: 76e3,
|
|
26102
|
+
routing: {
|
|
26103
|
+
tier: "strong",
|
|
26104
|
+
priority: 20,
|
|
26105
|
+
strengths: ["architecture", "refactoring", "debugging"]
|
|
26106
|
+
}
|
|
26054
26107
|
},
|
|
26055
26108
|
{
|
|
26056
26109
|
id: "z-ai/glm-5.3-flash",
|
|
@@ -26061,7 +26114,39 @@ var init_models = __esm({
|
|
|
26061
26114
|
sortOrder: 40,
|
|
26062
26115
|
upstreamModelId: "z-ai/glm-5.3-flash",
|
|
26063
26116
|
contextWindow: 1048576,
|
|
26064
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26117
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26118
|
+
inputPriceMicroUsdPerMtok: 15e4,
|
|
26119
|
+
outputPriceMicroUsdPerMtok: 5e5,
|
|
26120
|
+
cacheReadPriceMicroUsdPerMtok: 3e4,
|
|
26121
|
+
routing: { tier: "workhorse", priority: 20, strengths: ["ui_design", "speed"] }
|
|
26122
|
+
},
|
|
26123
|
+
{
|
|
26124
|
+
id: "z-ai/glm-5.3-flashx",
|
|
26125
|
+
name: "GLM 5.3 FlashX",
|
|
26126
|
+
description: "Mid-tier multimodal GLM between Flash and Prime",
|
|
26127
|
+
enabled: true,
|
|
26128
|
+
isDefault: false,
|
|
26129
|
+
sortOrder: 50,
|
|
26130
|
+
upstreamModelId: "z-ai/glm-5.3-flashx",
|
|
26131
|
+
contextWindow: 1048576,
|
|
26132
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26133
|
+
inputPriceMicroUsdPerMtok: 37e4,
|
|
26134
|
+
outputPriceMicroUsdPerMtok: 125e4,
|
|
26135
|
+
cacheReadPriceMicroUsdPerMtok: 9e4
|
|
26136
|
+
},
|
|
26137
|
+
{
|
|
26138
|
+
id: "z-ai/glm-5.3-prime",
|
|
26139
|
+
name: "GLM 5.3 Prime",
|
|
26140
|
+
description: "Z.ai's premium GLM tier for demanding work",
|
|
26141
|
+
enabled: true,
|
|
26142
|
+
isDefault: false,
|
|
26143
|
+
sortOrder: 60,
|
|
26144
|
+
upstreamModelId: "z-ai/glm-5.3-prime",
|
|
26145
|
+
contextWindow: 1e6,
|
|
26146
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26147
|
+
inputPriceMicroUsdPerMtok: 28e5,
|
|
26148
|
+
outputPriceMicroUsdPerMtok: 88e5,
|
|
26149
|
+
cacheReadPriceMicroUsdPerMtok: 56e4
|
|
26065
26150
|
},
|
|
26066
26151
|
{
|
|
26067
26152
|
id: "qwen/qwen3.8-27b",
|
|
@@ -26069,10 +26154,27 @@ var init_models = __esm({
|
|
|
26069
26154
|
description: "Qwen3.8 open-weight coding and agentic work",
|
|
26070
26155
|
enabled: true,
|
|
26071
26156
|
isDefault: false,
|
|
26072
|
-
sortOrder:
|
|
26157
|
+
sortOrder: 70,
|
|
26073
26158
|
upstreamModelId: "qwen/qwen3.8-27b",
|
|
26074
26159
|
contextWindow: 1e6,
|
|
26075
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26160
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26161
|
+
inputPriceMicroUsdPerMtok: 15e4,
|
|
26162
|
+
outputPriceMicroUsdPerMtok: 1875e3,
|
|
26163
|
+
cacheReadPriceMicroUsdPerMtok: 37500
|
|
26164
|
+
},
|
|
26165
|
+
{
|
|
26166
|
+
id: "qwen/qwen3.8-max-prime",
|
|
26167
|
+
name: "Qwen3.8 Max Prime",
|
|
26168
|
+
description: "Qwen's flagship tier for complex agentic work",
|
|
26169
|
+
enabled: true,
|
|
26170
|
+
isDefault: false,
|
|
26171
|
+
sortOrder: 80,
|
|
26172
|
+
upstreamModelId: "qwen/qwen3.8-max-prime",
|
|
26173
|
+
contextWindow: 1e6,
|
|
26174
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26175
|
+
inputPriceMicroUsdPerMtok: 4e6,
|
|
26176
|
+
outputPriceMicroUsdPerMtok: 12e6,
|
|
26177
|
+
cacheReadPriceMicroUsdPerMtok: 5e5
|
|
26076
26178
|
},
|
|
26077
26179
|
{
|
|
26078
26180
|
id: "moonshotai/kimi-k3",
|
|
@@ -26080,10 +26182,85 @@ var init_models = __esm({
|
|
|
26080
26182
|
description: "Moonshot's 2.8T open-weight flagship",
|
|
26081
26183
|
enabled: true,
|
|
26082
26184
|
isDefault: false,
|
|
26083
|
-
sortOrder:
|
|
26185
|
+
sortOrder: 90,
|
|
26084
26186
|
upstreamModelId: "moonshotai/kimi-k3",
|
|
26085
26187
|
contextWindow: 1048576,
|
|
26086
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26188
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26189
|
+
inputPriceMicroUsdPerMtok: 192e3,
|
|
26190
|
+
outputPriceMicroUsdPerMtok: 15e6,
|
|
26191
|
+
cacheReadPriceMicroUsdPerMtok: 182e3,
|
|
26192
|
+
routing: { tier: "strong", priority: 10, strengths: ["architecture", "long_context"] }
|
|
26193
|
+
},
|
|
26194
|
+
{
|
|
26195
|
+
id: "moonshotai/kimi-k3.1-pro",
|
|
26196
|
+
name: "Kimi K3.1 Pro",
|
|
26197
|
+
description: "Moonshot's updated K3 flagship",
|
|
26198
|
+
enabled: true,
|
|
26199
|
+
isDefault: false,
|
|
26200
|
+
sortOrder: 100,
|
|
26201
|
+
upstreamModelId: "moonshotai/kimi-k3.1-pro",
|
|
26202
|
+
contextWindow: 1048576,
|
|
26203
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26204
|
+
inputPriceMicroUsdPerMtok: 2e6,
|
|
26205
|
+
outputPriceMicroUsdPerMtok: 1e7,
|
|
26206
|
+
cacheReadPriceMicroUsdPerMtok: 2e5
|
|
26207
|
+
},
|
|
26208
|
+
{
|
|
26209
|
+
id: "minimax/minimax-m3.1-flash",
|
|
26210
|
+
name: "MiniMax M3.1 Flash",
|
|
26211
|
+
description: "Fast multimodal MiniMax for high-volume work",
|
|
26212
|
+
enabled: true,
|
|
26213
|
+
isDefault: false,
|
|
26214
|
+
sortOrder: 110,
|
|
26215
|
+
upstreamModelId: "minimax/minimax-m3.1-flash",
|
|
26216
|
+
contextWindow: 1048576,
|
|
26217
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26218
|
+
inputPriceMicroUsdPerMtok: 15e4,
|
|
26219
|
+
outputPriceMicroUsdPerMtok: 6e5,
|
|
26220
|
+
cacheReadPriceMicroUsdPerMtok: 15e3,
|
|
26221
|
+
routing: { tier: "workhorse", priority: 30, strengths: ["ui_design", "speed"] }
|
|
26222
|
+
},
|
|
26223
|
+
{
|
|
26224
|
+
id: "minimax/minimax-m3",
|
|
26225
|
+
name: "MiniMax M3",
|
|
26226
|
+
description: "MiniMax's full-size multimodal agentic model",
|
|
26227
|
+
enabled: true,
|
|
26228
|
+
isDefault: false,
|
|
26229
|
+
sortOrder: 120,
|
|
26230
|
+
upstreamModelId: "minimax/minimax-m3",
|
|
26231
|
+
contextWindow: 1048576,
|
|
26232
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26233
|
+
inputPriceMicroUsdPerMtok: 3e5,
|
|
26234
|
+
outputPriceMicroUsdPerMtok: 12e5,
|
|
26235
|
+
cacheReadPriceMicroUsdPerMtok: 6e4
|
|
26236
|
+
},
|
|
26237
|
+
{
|
|
26238
|
+
id: "nvidia/nemotron-3.5-lightning",
|
|
26239
|
+
name: "Nemotron 3.5 Lightning",
|
|
26240
|
+
description: "Small, fast Nemotron for high-volume work",
|
|
26241
|
+
enabled: true,
|
|
26242
|
+
isDefault: false,
|
|
26243
|
+
sortOrder: 130,
|
|
26244
|
+
upstreamModelId: "nvidia/nemotron-3.5-lightning",
|
|
26245
|
+
contextWindow: 262144,
|
|
26246
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26247
|
+
inputPriceMicroUsdPerMtok: 7e4,
|
|
26248
|
+
outputPriceMicroUsdPerMtok: 2e5,
|
|
26249
|
+
cacheReadPriceMicroUsdPerMtok: 4e4
|
|
26250
|
+
},
|
|
26251
|
+
{
|
|
26252
|
+
id: "nvidia/nemotron-3.5-super-vl",
|
|
26253
|
+
name: "Nemotron 3.5 Super VL",
|
|
26254
|
+
description: "Vision-language Nemotron with a 1M-token window",
|
|
26255
|
+
enabled: true,
|
|
26256
|
+
isDefault: false,
|
|
26257
|
+
sortOrder: 140,
|
|
26258
|
+
upstreamModelId: "nvidia/nemotron-3.5-super-vl",
|
|
26259
|
+
contextWindow: 1048576,
|
|
26260
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26261
|
+
inputPriceMicroUsdPerMtok: 15e4,
|
|
26262
|
+
outputPriceMicroUsdPerMtok: 5e5,
|
|
26263
|
+
cacheReadPriceMicroUsdPerMtok: 2e4
|
|
26087
26264
|
},
|
|
26088
26265
|
{
|
|
26089
26266
|
id: "nvidia/nemotron-3-nano-30b-a3b",
|
|
@@ -26091,10 +26268,13 @@ var init_models = __esm({
|
|
|
26091
26268
|
description: "Fast Nemotron via Alan",
|
|
26092
26269
|
enabled: true,
|
|
26093
26270
|
isDefault: false,
|
|
26094
|
-
sortOrder:
|
|
26271
|
+
sortOrder: 150,
|
|
26095
26272
|
upstreamModelId: "nvidia/nemotron-3-nano-30b-a3b",
|
|
26096
26273
|
contextWindow: 262144,
|
|
26097
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26274
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26275
|
+
inputPriceMicroUsdPerMtok: 6e4,
|
|
26276
|
+
outputPriceMicroUsdPerMtok: 24e4,
|
|
26277
|
+
cacheReadPriceMicroUsdPerMtok: 12e3
|
|
26098
26278
|
},
|
|
26099
26279
|
{
|
|
26100
26280
|
id: "nvidia/nemotron-3-super-120b-a12b",
|
|
@@ -26102,10 +26282,13 @@ var init_models = __esm({
|
|
|
26102
26282
|
description: "Mid-tier Nemotron via Alan",
|
|
26103
26283
|
enabled: true,
|
|
26104
26284
|
isDefault: false,
|
|
26105
|
-
sortOrder:
|
|
26285
|
+
sortOrder: 160,
|
|
26106
26286
|
upstreamModelId: "nvidia/nemotron-3-super-120b-a12b",
|
|
26107
|
-
contextWindow:
|
|
26108
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26287
|
+
contextWindow: 1048576,
|
|
26288
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26289
|
+
inputPriceMicroUsdPerMtok: 3e5,
|
|
26290
|
+
outputPriceMicroUsdPerMtok: 24e5,
|
|
26291
|
+
cacheReadPriceMicroUsdPerMtok: 15e4
|
|
26109
26292
|
},
|
|
26110
26293
|
{
|
|
26111
26294
|
id: "nvidia/nemotron-3-ultra-550b-a55b",
|
|
@@ -26113,21 +26296,13 @@ var init_models = __esm({
|
|
|
26113
26296
|
description: "Largest Nemotron via Alan",
|
|
26114
26297
|
enabled: true,
|
|
26115
26298
|
isDefault: false,
|
|
26116
|
-
sortOrder:
|
|
26299
|
+
sortOrder: 170,
|
|
26117
26300
|
upstreamModelId: "nvidia/nemotron-3-ultra-550b-a55b",
|
|
26118
26301
|
contextWindow: 262144,
|
|
26119
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26120
|
-
|
|
26121
|
-
|
|
26122
|
-
|
|
26123
|
-
name: "Nemotron 3.5 Lightning",
|
|
26124
|
-
description: "Small, fast Nemotron for high-volume work",
|
|
26125
|
-
enabled: true,
|
|
26126
|
-
isDefault: false,
|
|
26127
|
-
sortOrder: 100,
|
|
26128
|
-
upstreamModelId: "nvidia/nemotron-3.5-lightning",
|
|
26129
|
-
contextWindow: 262144,
|
|
26130
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26302
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26303
|
+
inputPriceMicroUsdPerMtok: 6e5,
|
|
26304
|
+
outputPriceMicroUsdPerMtok: 24e5,
|
|
26305
|
+
cacheReadPriceMicroUsdPerMtok: 12e4
|
|
26131
26306
|
},
|
|
26132
26307
|
{
|
|
26133
26308
|
id: "meta/muse-spark-1.3-contributor",
|
|
@@ -26135,10 +26310,13 @@ var init_models = __esm({
|
|
|
26135
26310
|
description: "Cost-efficient Muse Spark (contributor tier)",
|
|
26136
26311
|
enabled: true,
|
|
26137
26312
|
isDefault: false,
|
|
26138
|
-
sortOrder:
|
|
26313
|
+
sortOrder: 180,
|
|
26139
26314
|
upstreamModelId: "meta/muse-spark-1.3-contributor",
|
|
26140
26315
|
contextWindow: 1048576,
|
|
26141
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26316
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26317
|
+
inputPriceMicroUsdPerMtok: 1e5,
|
|
26318
|
+
outputPriceMicroUsdPerMtok: 2e5,
|
|
26319
|
+
cacheReadPriceMicroUsdPerMtok: 2e3
|
|
26142
26320
|
},
|
|
26143
26321
|
{
|
|
26144
26322
|
id: "meta/muse-spark-1.3",
|
|
@@ -26146,10 +26324,41 @@ var init_models = __esm({
|
|
|
26146
26324
|
description: "Meta Muse Spark multimodal agentic coding",
|
|
26147
26325
|
enabled: true,
|
|
26148
26326
|
isDefault: false,
|
|
26149
|
-
sortOrder:
|
|
26327
|
+
sortOrder: 190,
|
|
26150
26328
|
upstreamModelId: "meta/muse-spark-1.3",
|
|
26151
26329
|
contextWindow: 1048576,
|
|
26152
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26330
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26331
|
+
inputPriceMicroUsdPerMtok: 125e4,
|
|
26332
|
+
outputPriceMicroUsdPerMtok: 425e4,
|
|
26333
|
+
cacheReadPriceMicroUsdPerMtok: 15e4
|
|
26334
|
+
},
|
|
26335
|
+
{
|
|
26336
|
+
id: "meta/muse-spark-open",
|
|
26337
|
+
name: "Muse Spark Open",
|
|
26338
|
+
description: "Open-weight Muse Spark with audio and video input",
|
|
26339
|
+
enabled: true,
|
|
26340
|
+
isDefault: false,
|
|
26341
|
+
sortOrder: 200,
|
|
26342
|
+
upstreamModelId: "meta/muse-spark-open",
|
|
26343
|
+
contextWindow: 1048576,
|
|
26344
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26345
|
+
inputPriceMicroUsdPerMtok: 125e4,
|
|
26346
|
+
outputPriceMicroUsdPerMtok: 425e4,
|
|
26347
|
+
cacheReadPriceMicroUsdPerMtok: 15e4
|
|
26348
|
+
},
|
|
26349
|
+
{
|
|
26350
|
+
id: "meta/muse-wonder",
|
|
26351
|
+
name: "Muse Wonder",
|
|
26352
|
+
description: "Meta's premium Muse tier",
|
|
26353
|
+
enabled: true,
|
|
26354
|
+
isDefault: false,
|
|
26355
|
+
sortOrder: 210,
|
|
26356
|
+
upstreamModelId: "meta/muse-wonder",
|
|
26357
|
+
contextWindow: 1048576,
|
|
26358
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26359
|
+
inputPriceMicroUsdPerMtok: 4e6,
|
|
26360
|
+
outputPriceMicroUsdPerMtok: 2e7,
|
|
26361
|
+
cacheReadPriceMicroUsdPerMtok: 2e5
|
|
26153
26362
|
},
|
|
26154
26363
|
{
|
|
26155
26364
|
id: "meta/muse-spark-1.2-contributor",
|
|
@@ -26157,32 +26366,41 @@ var init_models = __esm({
|
|
|
26157
26366
|
description: "Prior Muse Spark contributor tier",
|
|
26158
26367
|
enabled: true,
|
|
26159
26368
|
isDefault: false,
|
|
26160
|
-
sortOrder:
|
|
26369
|
+
sortOrder: 220,
|
|
26161
26370
|
upstreamModelId: "meta/muse-spark-1.2-contributor",
|
|
26162
26371
|
contextWindow: 1048576,
|
|
26163
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26372
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26373
|
+
inputPriceMicroUsdPerMtok: 1e5,
|
|
26374
|
+
outputPriceMicroUsdPerMtok: 2e5,
|
|
26375
|
+
cacheReadPriceMicroUsdPerMtok: 2e3
|
|
26164
26376
|
},
|
|
26165
26377
|
{
|
|
26166
|
-
id: "
|
|
26167
|
-
name: "
|
|
26168
|
-
description: "
|
|
26378
|
+
id: "x-ai/grok-4.7",
|
|
26379
|
+
name: "Grok 4.7",
|
|
26380
|
+
description: "xAI's current Grok for agentic coding",
|
|
26169
26381
|
enabled: true,
|
|
26170
26382
|
isDefault: false,
|
|
26171
|
-
sortOrder:
|
|
26172
|
-
upstreamModelId: "
|
|
26173
|
-
contextWindow:
|
|
26174
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26383
|
+
sortOrder: 230,
|
|
26384
|
+
upstreamModelId: "x-ai/grok-4.7",
|
|
26385
|
+
contextWindow: 5e5,
|
|
26386
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26387
|
+
inputPriceMicroUsdPerMtok: 2e6,
|
|
26388
|
+
outputPriceMicroUsdPerMtok: 6e6,
|
|
26389
|
+
cacheReadPriceMicroUsdPerMtok: 5e5
|
|
26175
26390
|
},
|
|
26176
26391
|
{
|
|
26177
|
-
id: "
|
|
26178
|
-
name: "
|
|
26179
|
-
description: "
|
|
26392
|
+
id: "google/gemini-4-argon",
|
|
26393
|
+
name: "Gemini 4 Argon",
|
|
26394
|
+
description: "Google's flagship reasoning model for complex software work",
|
|
26180
26395
|
enabled: true,
|
|
26181
26396
|
isDefault: false,
|
|
26182
|
-
sortOrder:
|
|
26183
|
-
upstreamModelId: "
|
|
26397
|
+
sortOrder: 240,
|
|
26398
|
+
upstreamModelId: "google/gemini-4-argon",
|
|
26184
26399
|
contextWindow: 1048576,
|
|
26185
|
-
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
26400
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS,
|
|
26401
|
+
inputPriceMicroUsdPerMtok: 2e6,
|
|
26402
|
+
outputPriceMicroUsdPerMtok: 1e7,
|
|
26403
|
+
cacheReadPriceMicroUsdPerMtok: 1e5
|
|
26186
26404
|
}
|
|
26187
26405
|
];
|
|
26188
26406
|
DEFAULT_HARNESS_MODEL_ID = HARNESS_MODEL_SEEDS.find((model) => model.isDefault)?.id ?? HARNESS_MODEL_SEEDS[0].id;
|
|
@@ -27363,15 +27581,24 @@ var init_protocol = __esm({
|
|
|
27363
27581
|
});
|
|
27364
27582
|
|
|
27365
27583
|
// ../agent-core/src/session/process-host.ts
|
|
27584
|
+
function outOfMemoryOutcome() {
|
|
27585
|
+
return { status: "failed", error: specForErrorKind("out_of_memory") };
|
|
27586
|
+
}
|
|
27366
27587
|
function hostProcess(child, tree, options, handlers) {
|
|
27367
27588
|
const writer = createNdjsonWriter(child.stdin);
|
|
27589
|
+
const oomKills = options.oomKills ?? systemOomKillCounter();
|
|
27590
|
+
const oomKillsAtStart = oomKills();
|
|
27368
27591
|
const flags = {
|
|
27592
|
+
terminated: false,
|
|
27369
27593
|
closing: false,
|
|
27370
27594
|
outputClosedEarly: false,
|
|
27371
27595
|
lastScan: Number.NEGATIVE_INFINITY,
|
|
27372
27596
|
lastOutputAt: void 0
|
|
27373
27597
|
};
|
|
27374
|
-
const terminate = () =>
|
|
27598
|
+
const terminate = () => {
|
|
27599
|
+
flags.terminated = true;
|
|
27600
|
+
return tree.terminate({ graceMs: options.terminateGraceMs });
|
|
27601
|
+
};
|
|
27375
27602
|
const heard = () => {
|
|
27376
27603
|
flags.lastOutputAt = options.clock.monotonic();
|
|
27377
27604
|
};
|
|
@@ -27388,8 +27615,16 @@ function hostProcess(child, tree, options, handlers) {
|
|
|
27388
27615
|
child.stderr.on("data", (chunk) => stderr.push(chunk));
|
|
27389
27616
|
child.stderr.once("end", () => stderr.flush());
|
|
27390
27617
|
const processExit = new Promise((resolve10) => {
|
|
27391
|
-
child.once(
|
|
27618
|
+
child.once(
|
|
27619
|
+
"exit",
|
|
27620
|
+
(code, signal) => resolve10({ code, signal, signalledByHost: flags.terminated })
|
|
27621
|
+
);
|
|
27392
27622
|
});
|
|
27623
|
+
const killedForMemory = async ({ signal, signalledByHost }) => {
|
|
27624
|
+
if (signal !== "SIGKILL" || signalledByHost) return false;
|
|
27625
|
+
const [before, after] = await Promise.all([oomKillsAtStart, oomKills()]);
|
|
27626
|
+
return before !== null && after !== null && after > before;
|
|
27627
|
+
};
|
|
27393
27628
|
const outputEnded = new Promise((resolve10) => {
|
|
27394
27629
|
child.stdout.once("close", () => resolve10());
|
|
27395
27630
|
});
|
|
@@ -27408,12 +27643,14 @@ function hostProcess(child, tree, options, handlers) {
|
|
|
27408
27643
|
log.warn(`${name}.stdout_held_after_exit`, { pid: child.pid });
|
|
27409
27644
|
await terminate();
|
|
27410
27645
|
}
|
|
27411
|
-
const
|
|
27646
|
+
const raw = await processExit;
|
|
27647
|
+
const oomKilled = await killedForMemory(raw);
|
|
27412
27648
|
await terminate();
|
|
27413
27649
|
child.stdout.destroy();
|
|
27414
27650
|
child.stderr.destroy();
|
|
27415
27651
|
child.stdin.destroy();
|
|
27416
|
-
|
|
27652
|
+
if (oomKilled) log.warn(`${name}.oom_killed`, { pid: child.pid });
|
|
27653
|
+
handlers.onExit({ code: raw.code, signal: raw.signal, oomKilled }, flags.outputClosedEarly);
|
|
27417
27654
|
};
|
|
27418
27655
|
return {
|
|
27419
27656
|
pid: child.pid,
|
|
@@ -27437,6 +27674,7 @@ function hostProcess(child, tree, options, handlers) {
|
|
|
27437
27674
|
var init_process_host = __esm({
|
|
27438
27675
|
"../agent-core/src/session/process-host.ts"() {
|
|
27439
27676
|
"use strict";
|
|
27677
|
+
init_classify2();
|
|
27440
27678
|
init_process();
|
|
27441
27679
|
init_protocol();
|
|
27442
27680
|
init_ladder();
|
|
@@ -27632,7 +27870,10 @@ var init_per_turn = __esm({
|
|
|
27632
27870
|
}
|
|
27633
27871
|
this.#latchSessionId(reader.providerSessionId);
|
|
27634
27872
|
log.info(`${name}.exited`, { code: exit.code, signal: exit.signal });
|
|
27635
|
-
const outcome2 = active.cancelRequested ? { status: "cancelled" } :
|
|
27873
|
+
const outcome2 = active.cancelRequested ? { status: "cancelled" } : exit.oomKilled ? outOfMemoryOutcome() : startupTimedOut ? {
|
|
27874
|
+
status: "failed",
|
|
27875
|
+
error: silentStartError(name, this.#options.startupTimeoutMs)
|
|
27876
|
+
} : reader.finish({ ...exit, stderrTail: stderr.join("\n") });
|
|
27636
27877
|
void (launch.cleanup?.() ?? Promise.resolve()).catch((error62) => log.warn(`${name}.cleanup_failed`, { error: error62 })).finally(() => finish(outcome2));
|
|
27637
27878
|
}
|
|
27638
27879
|
}
|
|
@@ -27886,7 +28127,7 @@ function within(root, path) {
|
|
|
27886
28127
|
}
|
|
27887
28128
|
async function resolveReal(path) {
|
|
27888
28129
|
try {
|
|
27889
|
-
return await (0,
|
|
28130
|
+
return await (0, import_promises15.realpath)(path);
|
|
27890
28131
|
} catch {
|
|
27891
28132
|
const parent = (0, import_node_path13.dirname)(path);
|
|
27892
28133
|
if (parent === path) return path;
|
|
@@ -27915,23 +28156,23 @@ function createWorkspaceFs(roots, writable) {
|
|
|
27915
28156
|
return {
|
|
27916
28157
|
read: async (params) => {
|
|
27917
28158
|
const path = await confined(params);
|
|
27918
|
-
const bytes = await (0,
|
|
28159
|
+
const bytes = await (0, import_promises15.readFile)(path);
|
|
27919
28160
|
if (bytes.byteLength > MAX_READ_BYTES) throw new FsDenied(`${path} is too large to read`);
|
|
27920
28161
|
return { content: sliceLines(bytes.toString("utf8"), params) };
|
|
27921
28162
|
},
|
|
27922
28163
|
write: async (params) => {
|
|
27923
28164
|
if (!writable) throw new FsDenied("This session is read-only");
|
|
27924
28165
|
const path = await confined(params);
|
|
27925
|
-
await (0,
|
|
28166
|
+
await (0, import_promises15.writeFile)(path, asString(params.content));
|
|
27926
28167
|
return {};
|
|
27927
28168
|
}
|
|
27928
28169
|
};
|
|
27929
28170
|
}
|
|
27930
|
-
var
|
|
28171
|
+
var import_promises15, import_node_path13, MAX_READ_BYTES, FsDenied;
|
|
27931
28172
|
var init_fs = __esm({
|
|
27932
28173
|
"../agent-core/src/providers/acp/fs.ts"() {
|
|
27933
28174
|
"use strict";
|
|
27934
|
-
|
|
28175
|
+
import_promises15 = require("fs/promises");
|
|
27935
28176
|
import_node_path13 = require("path");
|
|
27936
28177
|
init_kernel();
|
|
27937
28178
|
MAX_READ_BYTES = 10 * 1024 * 1024;
|
|
@@ -28078,24 +28319,24 @@ var init_names = __esm({
|
|
|
28078
28319
|
|
|
28079
28320
|
// ../agent-core/src/mcp/secret-file.ts
|
|
28080
28321
|
async function writeSecretFile(name, contents) {
|
|
28081
|
-
const dir = await (0,
|
|
28322
|
+
const dir = await (0, import_promises16.mkdtemp)((0, import_node_path14.join)((0, import_node_os3.tmpdir)(), "alan-mcp-"));
|
|
28082
28323
|
const path = (0, import_node_path14.join)(dir, name);
|
|
28083
28324
|
const remove = async () => {
|
|
28084
|
-
await (0,
|
|
28325
|
+
await (0, import_promises16.rm)(dir, { recursive: true, force: true });
|
|
28085
28326
|
};
|
|
28086
28327
|
try {
|
|
28087
|
-
await (0,
|
|
28328
|
+
await (0, import_promises16.writeFile)(path, contents, { mode: 384, flag: "wx" });
|
|
28088
28329
|
} catch (error62) {
|
|
28089
28330
|
await remove();
|
|
28090
28331
|
throw error62;
|
|
28091
28332
|
}
|
|
28092
28333
|
return { path, remove, [Symbol.asyncDispose]: remove };
|
|
28093
28334
|
}
|
|
28094
|
-
var
|
|
28335
|
+
var import_promises16, import_node_os3, import_node_path14;
|
|
28095
28336
|
var init_secret_file = __esm({
|
|
28096
28337
|
"../agent-core/src/mcp/secret-file.ts"() {
|
|
28097
28338
|
"use strict";
|
|
28098
|
-
|
|
28339
|
+
import_promises16 = require("fs/promises");
|
|
28099
28340
|
import_node_os3 = require("os");
|
|
28100
28341
|
import_node_path14 = require("path");
|
|
28101
28342
|
}
|
|
@@ -29300,8 +29541,9 @@ var init_session2 = __esm({
|
|
|
29300
29541
|
reason: this.#closing ? { kind: "suspended" } : { kind: "exited", exitCode: code, signal }
|
|
29301
29542
|
});
|
|
29302
29543
|
}
|
|
29303
|
-
#exitOutcome(active, { code, signal }) {
|
|
29544
|
+
#exitOutcome(active, { code, signal, oomKilled }) {
|
|
29304
29545
|
if (active.cancelRequested) return { status: "cancelled" };
|
|
29546
|
+
if (oomKilled) return outOfMemoryOutcome();
|
|
29305
29547
|
const cause = active.turn.failure ?? this.stderrTail;
|
|
29306
29548
|
const recognised = cause ? recogniseAcpText(cause) : void 0;
|
|
29307
29549
|
if (recognised) return { status: "failed", error: recognised };
|
|
@@ -30477,6 +30719,10 @@ function cloudExecutionSection(spec) {
|
|
|
30477
30719
|
"The user may explicitly override this delivery workflow, including requesting local-only work or a direct push to main. Do not infer an override from urgency, simplicity, or change size. Creating a PR does not itself authorize merging, deployment, destructive actions, or scope expansion; active mode, role restrictions, and tool permissions still apply.",
|
|
30478
30720
|
"If a required delivery step is blocked, complete remaining independent work and report the precise blocker and what remains unfinished. Never describe local-only work as fully delivered."
|
|
30479
30721
|
);
|
|
30722
|
+
if (spec.agentId !== SETUP_AGENT_ID)
|
|
30723
|
+
lines.push(
|
|
30724
|
+
"Persist task-discovered system requirements so future cloud sessions can reproduce the work: a system package, OS library, toolchain or runtime service the repository does not already provide. Use the alan-environment-setup skill's maintenance path when installed; keep the session's working branch and existing PR, follow its validation requirements, and report any tool or authorization blocker. A package added to a manifest and lockfile is not a system requirement; the existing install already consumes it, so leave environment scripts and the image build alone."
|
|
30725
|
+
);
|
|
30480
30726
|
}
|
|
30481
30727
|
lines.push(
|
|
30482
30728
|
"## Installed skills",
|
|
@@ -30694,7 +30940,7 @@ async function acpTurnInput(run, context) {
|
|
|
30694
30940
|
const encoded = await Promise.all(
|
|
30695
30941
|
images.map(async (image) => ({
|
|
30696
30942
|
mimeType: image.mimeType,
|
|
30697
|
-
data: (await (0,
|
|
30943
|
+
data: (await (0, import_promises17.readFile)(image.path)).toString("base64")
|
|
30698
30944
|
}))
|
|
30699
30945
|
);
|
|
30700
30946
|
return {
|
|
@@ -30703,12 +30949,12 @@ async function acpTurnInput(run, context) {
|
|
|
30703
30949
|
...encoded.length ? { images: encoded, imagePaths: images.map((image) => image.path) } : {}
|
|
30704
30950
|
};
|
|
30705
30951
|
}
|
|
30706
|
-
var import_node_crypto13,
|
|
30952
|
+
var import_node_crypto13, import_promises17, ACP_MODES;
|
|
30707
30953
|
var init_run = __esm({
|
|
30708
30954
|
"../agent-core/src/providers/acp/run.ts"() {
|
|
30709
30955
|
"use strict";
|
|
30710
30956
|
import_node_crypto13 = require("crypto");
|
|
30711
|
-
|
|
30957
|
+
import_promises17 = require("fs/promises");
|
|
30712
30958
|
init_agent2();
|
|
30713
30959
|
init_mcp2();
|
|
30714
30960
|
init_prompt();
|
|
@@ -31829,7 +32075,7 @@ function parseJsonc(text2) {
|
|
|
31829
32075
|
async function inheritedMcpServerNames(configDirectory) {
|
|
31830
32076
|
const names = /* @__PURE__ */ new Set();
|
|
31831
32077
|
for (const file2 of ["config.json", "opencode.json", "opencode.jsonc"]) {
|
|
31832
|
-
const text2 = await (0,
|
|
32078
|
+
const text2 = await (0, import_promises18.readFile)((0, import_node_path17.join)(configDirectory, file2), "utf8").catch(() => null);
|
|
31833
32079
|
if (text2 === null) continue;
|
|
31834
32080
|
const parsed = parseJsonc(text2);
|
|
31835
32081
|
const mcp = parsed !== null && typeof parsed === "object" ? parsed.mcp : void 0;
|
|
@@ -31843,15 +32089,15 @@ async function writePlugin(directory, apiOrigin) {
|
|
|
31843
32089
|
const origin = (0, import_node_crypto14.createHash)("sha256").update(apiOrigin).digest("hex").slice(0, 12);
|
|
31844
32090
|
const target = (0, import_node_path17.join)(directory, `engine-plugin-v${ALAN_CODE_ENGINE_PLUGIN_VERSION}-${origin}.mjs`);
|
|
31845
32091
|
const temporary = `${target}.${(0, import_node_crypto14.randomUUID)()}.tmp`;
|
|
31846
|
-
await (0,
|
|
31847
|
-
await (0,
|
|
31848
|
-
await (0,
|
|
32092
|
+
await (0, import_promises18.mkdir)(directory, { recursive: true, mode: 448 });
|
|
32093
|
+
await (0, import_promises18.writeFile)(temporary, alanCodeEnginePluginSource(apiOrigin), { mode: 384 });
|
|
32094
|
+
await (0, import_promises18.rename)(temporary, target);
|
|
31849
32095
|
return (0, import_node_url2.pathToFileURL)(target).href;
|
|
31850
32096
|
}
|
|
31851
32097
|
async function prepareAlanCodeProfile(input2) {
|
|
31852
32098
|
const directories = Object.values(alanCodeEngineDirectories(input2.engineRoot));
|
|
31853
32099
|
await Promise.all(
|
|
31854
|
-
directories.map((directory) => (0,
|
|
32100
|
+
directories.map((directory) => (0, import_promises18.mkdir)(directory, { recursive: true, mode: 448 }))
|
|
31855
32101
|
);
|
|
31856
32102
|
const [pluginUrl, models, inheritedMcpServers] = await Promise.all([
|
|
31857
32103
|
writePlugin((0, import_node_path17.join)(input2.engineRoot, "plugin"), input2.access.apiOrigin),
|
|
@@ -31870,12 +32116,12 @@ async function prepareAlanCodeProfile(input2) {
|
|
|
31870
32116
|
model: { providerID: ALAN_CODE_ENGINE_PROVIDER_ID, modelID: modelId }
|
|
31871
32117
|
};
|
|
31872
32118
|
}
|
|
31873
|
-
var import_node_crypto14,
|
|
32119
|
+
var import_node_crypto14, import_promises18, import_node_path17, import_node_url2;
|
|
31874
32120
|
var init_prepare = __esm({
|
|
31875
32121
|
"../agent-core/src/providers/alan-code/prepare.ts"() {
|
|
31876
32122
|
"use strict";
|
|
31877
32123
|
import_node_crypto14 = require("crypto");
|
|
31878
|
-
|
|
32124
|
+
import_promises18 = require("fs/promises");
|
|
31879
32125
|
import_node_path17 = require("path");
|
|
31880
32126
|
import_node_url2 = require("url");
|
|
31881
32127
|
init_mcp2();
|
|
@@ -31961,7 +32207,7 @@ function readText(incoming, maxBytes) {
|
|
|
31961
32207
|
incoming.on("error", reject);
|
|
31962
32208
|
});
|
|
31963
32209
|
}
|
|
31964
|
-
var import_node_crypto15, import_node_http3, IDLE_SOCKET_MS2, OpenCodeHttpError, BASE62, messageIdClock, OpenCodeClient;
|
|
32210
|
+
var import_node_crypto15, import_node_http3, IDLE_SOCKET_MS2, OpenCodeHttpError, OpenCodeTimeoutError, BASE62, messageIdClock, OpenCodeClient;
|
|
31965
32211
|
var init_client = __esm({
|
|
31966
32212
|
"../agent-core/src/providers/opencode/client.ts"() {
|
|
31967
32213
|
"use strict";
|
|
@@ -31979,6 +32225,12 @@ var init_client = __esm({
|
|
|
31979
32225
|
this.body = body;
|
|
31980
32226
|
}
|
|
31981
32227
|
};
|
|
32228
|
+
OpenCodeTimeoutError = class extends Error {
|
|
32229
|
+
constructor(what, ms, engine = "OpenCode") {
|
|
32230
|
+
super(`${engine} ${what} request timed out after ${ms} ms`);
|
|
32231
|
+
this.name = "OpenCodeTimeoutError";
|
|
32232
|
+
}
|
|
32233
|
+
};
|
|
31982
32234
|
BASE62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
31983
32235
|
messageIdClock = { at: 0, counter: 0 };
|
|
31984
32236
|
OpenCodeClient = class {
|
|
@@ -32006,6 +32258,7 @@ var init_client = __esm({
|
|
|
32006
32258
|
}
|
|
32007
32259
|
#open(call) {
|
|
32008
32260
|
return new Promise((resolve10, reject) => {
|
|
32261
|
+
const deadline = AbortSignal.timeout(this.#limits.requestTimeoutMs);
|
|
32009
32262
|
const outgoing = (0, import_node_http3.request)(
|
|
32010
32263
|
`${this.baseUrl}${call.path}`,
|
|
32011
32264
|
{
|
|
@@ -32013,20 +32266,26 @@ var init_client = __esm({
|
|
|
32013
32266
|
headers: call.headers,
|
|
32014
32267
|
agent: this.#agent,
|
|
32015
32268
|
timeout: call.stream ? this.#limits.streamIdleMs : this.#limits.requestTimeoutMs,
|
|
32016
|
-
signal: call.stream ? this.#lifetime.signal : AbortSignal.any([
|
|
32017
|
-
this.#lifetime.signal,
|
|
32018
|
-
AbortSignal.timeout(this.#limits.requestTimeoutMs)
|
|
32019
|
-
])
|
|
32269
|
+
signal: call.stream ? this.#lifetime.signal : AbortSignal.any([this.#lifetime.signal, deadline])
|
|
32020
32270
|
},
|
|
32021
32271
|
resolve10
|
|
32022
32272
|
);
|
|
32023
|
-
outgoing.on("timeout", () => outgoing.destroy(
|
|
32024
|
-
outgoing.on("error",
|
|
32273
|
+
outgoing.on("timeout", () => outgoing.destroy(this.#timedOut(call)));
|
|
32274
|
+
outgoing.on("error", (error62) => {
|
|
32275
|
+
const expired = !call.stream && deadline.aborted && !this.#lifetime.signal.aborted;
|
|
32276
|
+
reject(expired ? this.#timedOut(call) : error62);
|
|
32277
|
+
});
|
|
32025
32278
|
outgoing.end(call.body);
|
|
32026
32279
|
});
|
|
32027
32280
|
}
|
|
32281
|
+
/** A quiet event stream stays a plain Error: a first start may still be installing, so it is not retried. */
|
|
32282
|
+
#timedOut(call) {
|
|
32283
|
+
if (call.stream) return new Error("OpenCode request timed out");
|
|
32284
|
+
return new OpenCodeTimeoutError(call.what, this.#limits.requestTimeoutMs, this.#engine);
|
|
32285
|
+
}
|
|
32028
32286
|
async #call(what, method, path, body) {
|
|
32029
32287
|
const response = await this.#open({
|
|
32288
|
+
what,
|
|
32030
32289
|
method,
|
|
32031
32290
|
path,
|
|
32032
32291
|
headers: {
|
|
@@ -32165,6 +32424,7 @@ var init_client = __esm({
|
|
|
32165
32424
|
/** Subscribes to the server-wide bus. */
|
|
32166
32425
|
async events(handlers) {
|
|
32167
32426
|
const response = await this.#open({
|
|
32427
|
+
what: "event stream",
|
|
32168
32428
|
method: "GET",
|
|
32169
32429
|
path: "/event",
|
|
32170
32430
|
stream: true,
|
|
@@ -33721,7 +33981,7 @@ var init_session3 = __esm({
|
|
|
33721
33981
|
if (active) {
|
|
33722
33982
|
const how = signal ? `signal ${signal}` : `exit code ${code}`;
|
|
33723
33983
|
active.finish(
|
|
33724
|
-
active.cancelRequested ? { status: "cancelled" } : {
|
|
33984
|
+
active.cancelRequested ? { status: "cancelled" } : exit.oomKilled ? outOfMemoryOutcome() : {
|
|
33725
33985
|
status: "interrupted",
|
|
33726
33986
|
reason: `The ${this.#options.engine.label} server stopped mid-turn (${how}).`
|
|
33727
33987
|
}
|
|
@@ -33873,7 +34133,7 @@ async function sameDirectory(left, right) {
|
|
|
33873
34133
|
}
|
|
33874
34134
|
async function canonicalDirectory(directory) {
|
|
33875
34135
|
try {
|
|
33876
|
-
return await (0,
|
|
34136
|
+
return await (0, import_promises19.realpath)(directory);
|
|
33877
34137
|
} catch {
|
|
33878
34138
|
return (0, import_node_path20.resolve)(directory);
|
|
33879
34139
|
}
|
|
@@ -33926,6 +34186,7 @@ async function openSession(client, session, spec, log) {
|
|
|
33926
34186
|
return { id, resumed: false };
|
|
33927
34187
|
}
|
|
33928
34188
|
function isOpenTimeout(error62) {
|
|
34189
|
+
if (error62 instanceof OpenCodeTimeoutError) return true;
|
|
33929
34190
|
return error62 instanceof CoreFault && error62.code === "protocol_violation";
|
|
33930
34191
|
}
|
|
33931
34192
|
async function openOnce(spec, password, options) {
|
|
@@ -33941,7 +34202,9 @@ async function openOnce(spec, password, options) {
|
|
|
33941
34202
|
throw error62;
|
|
33942
34203
|
});
|
|
33943
34204
|
try {
|
|
33944
|
-
const client = new OpenCodeClient(url2, password, options.engine.label
|
|
34205
|
+
const client = new OpenCodeClient(url2, password, options.engine.label, {
|
|
34206
|
+
requestTimeoutMs: options.requestTimeoutMs
|
|
34207
|
+
});
|
|
33945
34208
|
const alive = (work) => whileAlive(session, options, work);
|
|
33946
34209
|
await withDeadline2(
|
|
33947
34210
|
alive(checkHealth(client, options.log)),
|
|
@@ -33990,24 +34253,33 @@ async function openWithRetries(spec, password, options) {
|
|
|
33990
34253
|
}
|
|
33991
34254
|
}
|
|
33992
34255
|
}
|
|
33993
|
-
function
|
|
33994
|
-
|
|
34256
|
+
function resolveOpenLimits(options) {
|
|
34257
|
+
return {
|
|
34258
|
+
openTimeoutMs: options.openTimeoutMs ?? DEFAULTS2.openTimeoutMs,
|
|
34259
|
+
requestTimeoutMs: options.requestTimeoutMs ?? DEFAULTS2.requestTimeoutMs,
|
|
34260
|
+
bootstrapTimeoutMs: options.bootstrapTimeoutMs ?? DEFAULTS2.bootstrapTimeoutMs,
|
|
34261
|
+
slowBootstrapMs: options.slowBootstrapMs ?? DEFAULTS2.slowBootstrapMs,
|
|
34262
|
+
openAttempts: options.openAttempts ?? DEFAULTS2.openAttempts,
|
|
34263
|
+
startAttempts: options.startAttempts ?? DEFAULTS2.startAttempts
|
|
34264
|
+
};
|
|
34265
|
+
}
|
|
34266
|
+
function resolveOptions(options) {
|
|
34267
|
+
return {
|
|
33995
34268
|
clock: options.clock ?? systemClock2,
|
|
33996
34269
|
log: options.log ?? silentLog,
|
|
33997
34270
|
interruptGraceMs: options.interruptGraceMs ?? DEFAULTS2.interruptGraceMs,
|
|
33998
34271
|
terminateGraceMs: options.terminateGraceMs ?? DEFAULTS2.terminateGraceMs,
|
|
33999
34272
|
stdoutDrainMs: options.stdoutDrainMs ?? DEFAULTS2.stdoutDrainMs,
|
|
34000
34273
|
descendantScanMs: options.descendantScanMs ?? DEFAULTS2.descendantScanMs,
|
|
34001
|
-
openTimeoutMs: options.openTimeoutMs ?? DEFAULTS2.openTimeoutMs,
|
|
34002
|
-
bootstrapTimeoutMs: options.bootstrapTimeoutMs ?? DEFAULTS2.bootstrapTimeoutMs,
|
|
34003
|
-
slowBootstrapMs: options.slowBootstrapMs ?? DEFAULTS2.slowBootstrapMs,
|
|
34004
|
-
openAttempts: options.openAttempts ?? DEFAULTS2.openAttempts,
|
|
34005
|
-
startAttempts: options.startAttempts ?? DEFAULTS2.startAttempts,
|
|
34006
34274
|
reconnectAttempts: options.reconnectAttempts ?? DEFAULTS2.reconnectAttempts,
|
|
34007
34275
|
reconnectDelayMs: options.reconnectDelayMs ?? DEFAULTS2.reconnectDelayMs,
|
|
34008
34276
|
engine: options.engine ?? OPENCODE_ENGINE,
|
|
34009
|
-
stopTaskTimeoutMs: options.stopTaskTimeoutMs ?? DEFAULTS2.stopTaskTimeoutMs
|
|
34277
|
+
stopTaskTimeoutMs: options.stopTaskTimeoutMs ?? DEFAULTS2.stopTaskTimeoutMs,
|
|
34278
|
+
...resolveOpenLimits(options)
|
|
34010
34279
|
};
|
|
34280
|
+
}
|
|
34281
|
+
function createOpenCodeDriver(options = {}) {
|
|
34282
|
+
const resolved = resolveOptions(options);
|
|
34011
34283
|
return {
|
|
34012
34284
|
name: "opencode_serve",
|
|
34013
34285
|
open: async (planned) => {
|
|
@@ -34035,12 +34307,12 @@ function createOpenCodeDriver(options = {}) {
|
|
|
34035
34307
|
}
|
|
34036
34308
|
};
|
|
34037
34309
|
}
|
|
34038
|
-
var import_node_crypto16,
|
|
34310
|
+
var import_node_crypto16, import_promises19, import_node_path20, DEFAULTS2, STORE_LOCKED, NON_INTERACTIVE_RULES;
|
|
34039
34311
|
var init_driver3 = __esm({
|
|
34040
34312
|
"../agent-core/src/providers/opencode/driver.ts"() {
|
|
34041
34313
|
"use strict";
|
|
34042
34314
|
import_node_crypto16 = require("crypto");
|
|
34043
|
-
|
|
34315
|
+
import_promises19 = require("fs/promises");
|
|
34044
34316
|
import_node_path20 = require("path");
|
|
34045
34317
|
init_agent2();
|
|
34046
34318
|
init_acp2();
|
|
@@ -34060,6 +34332,7 @@ var init_driver3 = __esm({
|
|
|
34060
34332
|
stdoutDrainMs: 2e3,
|
|
34061
34333
|
descendantScanMs: 5e3,
|
|
34062
34334
|
openTimeoutMs: 6e4,
|
|
34335
|
+
requestTimeoutMs: 3e4,
|
|
34063
34336
|
bootstrapTimeoutMs: 6e5,
|
|
34064
34337
|
slowBootstrapMs: 5e3,
|
|
34065
34338
|
openAttempts: 2,
|
|
@@ -36018,8 +36291,10 @@ function stopTaskResult(response) {
|
|
|
36018
36291
|
const message = response.error ?? "Claude Code could not stop the task.";
|
|
36019
36292
|
return { ok: false, reason: UNSUPPORTED_STOP.test(message) ? "unsupported" : "failed", message };
|
|
36020
36293
|
}
|
|
36021
|
-
function exitOutcome2(turn, stderrTail,
|
|
36294
|
+
function exitOutcome2(turn, stderrTail, exit, outputClosedEarly) {
|
|
36295
|
+
const { code, signal } = exit;
|
|
36022
36296
|
if (turn.cancelRequested) return { status: "cancelled" };
|
|
36297
|
+
if (exit.oomKilled) return outOfMemoryOutcome();
|
|
36023
36298
|
if (outputClosedEarly) return { status: "interrupted", reason: OUTPUT_CLOSED_REASON };
|
|
36024
36299
|
const recognised = stderrTail ? classifyProviderTerminalText(stderrTail) : void 0;
|
|
36025
36300
|
if (recognised && !turn.turn.resultSeen) return { status: "failed", error: recognised };
|
|
@@ -36555,17 +36830,17 @@ async function claudeTurnInput(run, context) {
|
|
|
36555
36830
|
const encoded = await Promise.all(
|
|
36556
36831
|
images.map(async (image) => ({
|
|
36557
36832
|
mimeType: image.mimeType,
|
|
36558
|
-
data: (await (0,
|
|
36833
|
+
data: (await (0, import_promises20.readFile)(image.path)).toString("base64")
|
|
36559
36834
|
}))
|
|
36560
36835
|
);
|
|
36561
36836
|
return { turnId: run.runId, text: text2, ...encoded.length ? { images: encoded } : {} };
|
|
36562
36837
|
}
|
|
36563
|
-
var import_node_crypto19,
|
|
36838
|
+
var import_node_crypto19, import_promises20, READ_ONLY_DISALLOWED_TOOLS, DEFAULT_MCP_TIMEOUT_MS, CLOUD_SKILL_LISTING_MAX_DESCRIPTION_CHARS;
|
|
36564
36839
|
var init_run3 = __esm({
|
|
36565
36840
|
"../agent-core/src/providers/claude/run.ts"() {
|
|
36566
36841
|
"use strict";
|
|
36567
36842
|
import_node_crypto19 = require("crypto");
|
|
36568
|
-
|
|
36843
|
+
import_promises20 = require("fs/promises");
|
|
36569
36844
|
init_agent2();
|
|
36570
36845
|
init_mcp2();
|
|
36571
36846
|
init_prompt();
|
|
@@ -38778,7 +39053,7 @@ var init_session4 = __esm({
|
|
|
38778
39053
|
this.#emitUpdates(active, active.images.settle());
|
|
38779
39054
|
const how = signal ? `signal ${signal}` : `exit code ${code}`;
|
|
38780
39055
|
active.finish(
|
|
38781
|
-
active.failFast ? { status: "failed", error: active.failFast } : active.cancelRequested ? { status: "cancelled" } : { status: "interrupted", reason: `The Codex app-server stopped mid-turn (${how}).` }
|
|
39056
|
+
active.failFast ? { status: "failed", error: active.failFast } : active.cancelRequested ? { status: "cancelled" } : exit.oomKilled ? outOfMemoryOutcome() : { status: "interrupted", reason: `The Codex app-server stopped mid-turn (${how}).` }
|
|
38782
39057
|
);
|
|
38783
39058
|
}
|
|
38784
39059
|
this.#options.log.info("codex.exited", { code, signal, suspended: this.#closing });
|
|
@@ -40237,7 +40512,7 @@ var init_session5 = __esm({
|
|
|
40237
40512
|
if (active) {
|
|
40238
40513
|
const how = signal ? `signal ${signal}` : `exit code ${code}`;
|
|
40239
40514
|
active.finish(
|
|
40240
|
-
active.cancelRequested ? { status: "cancelled" } : { status: "interrupted", reason: `Droid stopped mid-turn (${how}).` }
|
|
40515
|
+
active.cancelRequested ? { status: "cancelled" } : exit.oomKilled ? outOfMemoryOutcome() : { status: "interrupted", reason: `Droid stopped mid-turn (${how}).` }
|
|
40241
40516
|
);
|
|
40242
40517
|
}
|
|
40243
40518
|
this.#options.log.info("droid.exited", { code, signal, suspended: this.#closing });
|
|
@@ -40467,17 +40742,17 @@ async function droidTurnInput(run, context) {
|
|
|
40467
40742
|
const encoded = await Promise.all(
|
|
40468
40743
|
images.map(async (image) => ({
|
|
40469
40744
|
mimeType: image.mimeType,
|
|
40470
|
-
data: (await (0,
|
|
40745
|
+
data: (await (0, import_promises21.readFile)(image.path)).toString("base64")
|
|
40471
40746
|
}))
|
|
40472
40747
|
);
|
|
40473
40748
|
return { turnId: run.runId, text: text2, ...encoded.length ? { images: encoded } : {} };
|
|
40474
40749
|
}
|
|
40475
|
-
var import_node_crypto25,
|
|
40750
|
+
var import_node_crypto25, import_promises21;
|
|
40476
40751
|
var init_run5 = __esm({
|
|
40477
40752
|
"../agent-core/src/providers/droid/run.ts"() {
|
|
40478
40753
|
"use strict";
|
|
40479
40754
|
import_node_crypto25 = require("crypto");
|
|
40480
|
-
|
|
40755
|
+
import_promises21 = require("fs/promises");
|
|
40481
40756
|
init_agent2();
|
|
40482
40757
|
init_mcp2();
|
|
40483
40758
|
init_prompt();
|
|
@@ -40607,7 +40882,7 @@ function settingsPath(env) {
|
|
|
40607
40882
|
async function readSettings(path) {
|
|
40608
40883
|
let raw;
|
|
40609
40884
|
try {
|
|
40610
|
-
raw = (await (0,
|
|
40885
|
+
raw = (await (0, import_promises22.readFile)(path, "utf8")).trim();
|
|
40611
40886
|
} catch {
|
|
40612
40887
|
return {};
|
|
40613
40888
|
}
|
|
@@ -40625,15 +40900,15 @@ async function selectAntigravityApiKeyMode(env) {
|
|
|
40625
40900
|
const settings2 = await readSettings(path);
|
|
40626
40901
|
if (settings2 === "malformed") return "malformed";
|
|
40627
40902
|
if (settings2.modelProvider === "gemini") return "already_selected";
|
|
40628
|
-
await (0,
|
|
40629
|
-
await (0,
|
|
40903
|
+
await (0, import_promises22.mkdir)((0, import_node_path23.dirname)(path), { recursive: true });
|
|
40904
|
+
await (0, import_promises22.writeFile)(path, JSON.stringify({ ...settings2, modelProvider: "gemini" }), { mode: 384 });
|
|
40630
40905
|
return "selected";
|
|
40631
40906
|
}
|
|
40632
|
-
var
|
|
40907
|
+
var import_promises22, import_node_path23;
|
|
40633
40908
|
var init_api_key_mode = __esm({
|
|
40634
40909
|
"../agent-core/src/providers/antigravity/api-key-mode.ts"() {
|
|
40635
40910
|
"use strict";
|
|
40636
|
-
|
|
40911
|
+
import_promises22 = require("fs/promises");
|
|
40637
40912
|
import_node_path23 = require("path");
|
|
40638
40913
|
init_type_guards();
|
|
40639
40914
|
}
|
|
@@ -41876,7 +42151,7 @@ function parseConfig(raw) {
|
|
|
41876
42151
|
}
|
|
41877
42152
|
async function writeCommandCodeProjectMcp(cwd, mcp) {
|
|
41878
42153
|
const path = (0, import_node_path26.join)(cwd, ".mcp.json");
|
|
41879
|
-
const original = await (0,
|
|
42154
|
+
const original = await (0, import_promises23.readFile)(path, "utf8").catch(() => null);
|
|
41880
42155
|
const config2 = parseConfig(original);
|
|
41881
42156
|
const next = {
|
|
41882
42157
|
...config2,
|
|
@@ -41893,19 +42168,19 @@ async function writeCommandCodeProjectMcp(cwd, mcp) {
|
|
|
41893
42168
|
}
|
|
41894
42169
|
}
|
|
41895
42170
|
};
|
|
41896
|
-
await (0,
|
|
41897
|
-
await (0,
|
|
42171
|
+
await (0, import_promises23.mkdir)(cwd, { recursive: true });
|
|
42172
|
+
await (0, import_promises23.writeFile)(path, `${JSON.stringify(next, null, 2)}
|
|
41898
42173
|
`);
|
|
41899
42174
|
return async () => {
|
|
41900
|
-
if (original === null) await (0,
|
|
41901
|
-
else await (0,
|
|
42175
|
+
if (original === null) await (0, import_promises23.rm)(path, { force: true });
|
|
42176
|
+
else await (0, import_promises23.writeFile)(path, original);
|
|
41902
42177
|
};
|
|
41903
42178
|
}
|
|
41904
|
-
var
|
|
42179
|
+
var import_promises23, import_node_path26;
|
|
41905
42180
|
var init_project_mcp = __esm({
|
|
41906
42181
|
"../agent-core/src/providers/command-code/project-mcp.ts"() {
|
|
41907
42182
|
"use strict";
|
|
41908
|
-
|
|
42183
|
+
import_promises23 = require("fs/promises");
|
|
41909
42184
|
import_node_path26 = require("path");
|
|
41910
42185
|
init_agent2();
|
|
41911
42186
|
init_runtime_v2();
|
|
@@ -51225,7 +51500,7 @@ var GitFault = class extends Error {
|
|
|
51225
51500
|
};
|
|
51226
51501
|
|
|
51227
51502
|
// src/capabilities/git/repository.ts
|
|
51228
|
-
var
|
|
51503
|
+
var import_promises24 = require("fs/promises");
|
|
51229
51504
|
var import_node_path27 = require("path");
|
|
51230
51505
|
async function assertValidBranch(git, repoRoot, branch, signal) {
|
|
51231
51506
|
const output2 = await git.run(
|
|
@@ -51417,7 +51692,7 @@ function createGitRunner(options) {
|
|
|
51417
51692
|
|
|
51418
51693
|
// src/capabilities/git/checkout-freshness.ts
|
|
51419
51694
|
var import_node_crypto28 = require("crypto");
|
|
51420
|
-
var
|
|
51695
|
+
var import_promises25 = require("fs/promises");
|
|
51421
51696
|
var import_node_path28 = require("path");
|
|
51422
51697
|
init_zod();
|
|
51423
51698
|
var REMOTE = "origin";
|
|
@@ -51494,14 +51769,14 @@ async function moveSnapshotTo(git, cwd, snapshot, tip, signal) {
|
|
|
51494
51769
|
return moved.exitCode === 0 && back.exitCode === 0;
|
|
51495
51770
|
}
|
|
51496
51771
|
async function isCheckout(path) {
|
|
51497
|
-
return (0,
|
|
51772
|
+
return (0, import_promises25.stat)((0, import_node_path28.join)(path, ".git")).then(
|
|
51498
51773
|
() => true,
|
|
51499
51774
|
() => false
|
|
51500
51775
|
);
|
|
51501
51776
|
}
|
|
51502
51777
|
async function checkoutsUnder(root) {
|
|
51503
51778
|
if (await isCheckout(root)) return [root];
|
|
51504
|
-
const entries = await (0,
|
|
51779
|
+
const entries = await (0, import_promises25.readdir)(root, { withFileTypes: true }).catch(() => []);
|
|
51505
51780
|
const found = await Promise.all(
|
|
51506
51781
|
entries.filter((entry) => entry.isDirectory()).map(
|
|
51507
51782
|
async (entry) => await isCheckout((0, import_node_path28.join)(root, entry.name)) ? (0, import_node_path28.join)(root, entry.name) : null
|
|
@@ -51522,13 +51797,13 @@ async function readCheckoutFreshness(dir, path) {
|
|
|
51522
51797
|
|
|
51523
51798
|
// src/capabilities/git/commit-attribution.ts
|
|
51524
51799
|
var import_node_crypto29 = require("crypto");
|
|
51525
|
-
var
|
|
51800
|
+
var import_promises27 = require("fs/promises");
|
|
51526
51801
|
var import_node_path30 = require("path");
|
|
51527
51802
|
init_runtime_v2();
|
|
51528
51803
|
|
|
51529
51804
|
// src/capabilities/providers/commands.ts
|
|
51530
51805
|
var import_node_fs17 = require("fs");
|
|
51531
|
-
var
|
|
51806
|
+
var import_promises26 = require("fs/promises");
|
|
51532
51807
|
var import_node_path29 = require("path");
|
|
51533
51808
|
var PROVIDER_COMMANDS = [
|
|
51534
51809
|
// The engine, not a CLI of its own: `resolveProviderExecutable` finds the bundled one first.
|
|
@@ -51564,8 +51839,8 @@ function pathDelimiter(platform) {
|
|
|
51564
51839
|
}
|
|
51565
51840
|
async function isRunnable(path, platform) {
|
|
51566
51841
|
try {
|
|
51567
|
-
if (!(await (0,
|
|
51568
|
-
if (platform !== "win32") await (0,
|
|
51842
|
+
if (!(await (0, import_promises26.stat)(path)).isFile()) return false;
|
|
51843
|
+
if (platform !== "win32") await (0, import_promises26.access)(path, import_node_fs17.constants.X_OK);
|
|
51569
51844
|
return true;
|
|
51570
51845
|
} catch {
|
|
51571
51846
|
return false;
|
|
@@ -51600,13 +51875,13 @@ function shellQuote(value) {
|
|
|
51600
51875
|
}
|
|
51601
51876
|
async function replaceFile(path, content, mode) {
|
|
51602
51877
|
const temp = `${path}.${(0, import_node_crypto29.randomUUID)()}.tmp`;
|
|
51603
|
-
await (0,
|
|
51604
|
-
await (0,
|
|
51878
|
+
await (0, import_promises27.writeFile)(temp, content, { mode });
|
|
51879
|
+
await (0, import_promises27.rename)(temp, path);
|
|
51605
51880
|
}
|
|
51606
51881
|
async function replaceSymlink(path, target) {
|
|
51607
51882
|
const temp = `${path}.${(0, import_node_crypto29.randomUUID)()}.tmp`;
|
|
51608
|
-
await (0,
|
|
51609
|
-
await (0,
|
|
51883
|
+
await (0, import_promises27.symlink)(target, temp);
|
|
51884
|
+
await (0, import_promises27.rename)(temp, path);
|
|
51610
51885
|
}
|
|
51611
51886
|
async function installCommitAttribution(input2) {
|
|
51612
51887
|
if (input2.platform === "win32") return null;
|
|
@@ -51616,8 +51891,8 @@ async function installCommitAttribution(input2) {
|
|
|
51616
51891
|
const path = envValue(input2.env, "PATH").split(delimiter2).filter((entry) => entry.length > 0 && entry !== binDir).join(delimiter2);
|
|
51617
51892
|
const realGit = await resolveCommandOnPath("git", { ...input2.env, PATH: path }, input2.platform);
|
|
51618
51893
|
if (realGit === null) return null;
|
|
51619
|
-
await (0,
|
|
51620
|
-
await (0,
|
|
51894
|
+
await (0, import_promises27.mkdir)(binDir, { recursive: true, mode: 493 });
|
|
51895
|
+
await (0, import_promises27.mkdir)(hooksDir, { recursive: true, mode: 493 });
|
|
51621
51896
|
await replaceFile((0, import_node_path30.join)(input2.dir, COMMIT_ATTRIBUTION_SCRIPT), commitAttributionScript(), 493);
|
|
51622
51897
|
for (const hook of COMMIT_ATTRIBUTION_HOOKS) {
|
|
51623
51898
|
await replaceSymlink((0, import_node_path30.join)(hooksDir, hook), (0, import_node_path30.join)("..", COMMIT_ATTRIBUTION_SCRIPT));
|
|
@@ -51634,7 +51909,7 @@ exec ${shellQuote(realGit)} -c core.hooksPath=${shellQuote(hooksDir)} "$@"
|
|
|
51634
51909
|
env: { ...input2.env, PATH: path === "" ? binDir : `${binDir}${delimiter2}${path}` },
|
|
51635
51910
|
setCoAuthor: async (coAuthor) => {
|
|
51636
51911
|
if (coAuthor === void 0) {
|
|
51637
|
-
await (0,
|
|
51912
|
+
await (0, import_promises27.rm)(coAuthorPath, { force: true });
|
|
51638
51913
|
return;
|
|
51639
51914
|
}
|
|
51640
51915
|
const value = coAuthorTrailer(coAuthor).replace(/^Co-Authored-By: /, "");
|
|
@@ -51673,7 +51948,7 @@ function resolveProviderExecutable(provider4, env, platform) {
|
|
|
51673
51948
|
|
|
51674
51949
|
// src/capabilities/providers/managed.ts
|
|
51675
51950
|
var import_node_crypto30 = require("crypto");
|
|
51676
|
-
var
|
|
51951
|
+
var import_promises28 = require("fs/promises");
|
|
51677
51952
|
var import_node_path31 = require("path");
|
|
51678
51953
|
init_process();
|
|
51679
51954
|
init_zod();
|
|
@@ -51681,7 +51956,7 @@ var VERSION = /^[0-9]+\.[0-9]+\.[0-9]+(?:[-+][0-9A-Za-z.-]+)?$/;
|
|
|
51681
51956
|
var selectedSchema = external_exports.record(external_exports.string(), external_exports.string());
|
|
51682
51957
|
async function readManagedProviderVersion(file2, backendKind) {
|
|
51683
51958
|
try {
|
|
51684
|
-
const selected = selectedSchema.parse(JSON.parse(await (0,
|
|
51959
|
+
const selected = selectedSchema.parse(JSON.parse(await (0, import_promises28.readFile)(file2, "utf8")));
|
|
51685
51960
|
const version2 = selected[backendKind];
|
|
51686
51961
|
return version2 !== void 0 && VERSION.test(version2) ? version2 : null;
|
|
51687
51962
|
} catch {
|
|
@@ -51692,7 +51967,7 @@ async function readManagedProviderVersion(file2, backendKind) {
|
|
|
51692
51967
|
// ../shared/src/node/skill-package.ts
|
|
51693
51968
|
var import_node_buffer = require("buffer");
|
|
51694
51969
|
var import_node_crypto31 = require("crypto");
|
|
51695
|
-
var
|
|
51970
|
+
var import_promises29 = require("fs/promises");
|
|
51696
51971
|
var import_node_path32 = require("path");
|
|
51697
51972
|
var import_yaml = __toESM(require_dist(), 1);
|
|
51698
51973
|
init_contracts();
|
|
@@ -51793,11 +52068,11 @@ async function inspectSkillPackage(packageRoot, options = {}) {
|
|
|
51793
52068
|
};
|
|
51794
52069
|
}
|
|
51795
52070
|
async function requirePackageRoot(packageRoot) {
|
|
51796
|
-
const root = await (0,
|
|
52071
|
+
const root = await (0, import_promises29.realpath)((0, import_node_path32.resolve)(packageRoot)).catch(() => null);
|
|
51797
52072
|
if (!root) {
|
|
51798
52073
|
throw new SkillPackageError("INVALID_PACKAGE_ROOT", "Skill package directory does not exist");
|
|
51799
52074
|
}
|
|
51800
|
-
const rootStat = await (0,
|
|
52075
|
+
const rootStat = await (0, import_promises29.lstat)(root);
|
|
51801
52076
|
if (!rootStat.isDirectory()) {
|
|
51802
52077
|
throw new SkillPackageError("INVALID_PACKAGE_ROOT", "Skill package root must be a directory");
|
|
51803
52078
|
}
|
|
@@ -51823,12 +52098,12 @@ async function walkPackage(root, ignoredPaths) {
|
|
|
51823
52098
|
}
|
|
51824
52099
|
return files;
|
|
51825
52100
|
async function walkDirectory(directory) {
|
|
51826
|
-
const entries = await (0,
|
|
52101
|
+
const entries = await (0, import_promises29.readdir)(directory, { withFileTypes: true });
|
|
51827
52102
|
for (const entry of entries) {
|
|
51828
52103
|
const absolutePath = (0, import_node_path32.resolve)(directory, entry.name);
|
|
51829
52104
|
const normalizedPath = normalizeRelativePath(root, absolutePath);
|
|
51830
52105
|
if (isIgnored(normalizedPath, entry.name, entry.isDirectory(), ignored2)) continue;
|
|
51831
|
-
const entryStat = await (0,
|
|
52106
|
+
const entryStat = await (0, import_promises29.lstat)(absolutePath);
|
|
51832
52107
|
if (entryStat.isSymbolicLink()) {
|
|
51833
52108
|
throw new SkillPackageError(
|
|
51834
52109
|
"SYMLINK_BLOCKED",
|
|
@@ -51954,7 +52229,7 @@ function isSecretPath(path) {
|
|
|
51954
52229
|
return name.endsWith(".private-key.pem") || name.endsWith(".private-key.key");
|
|
51955
52230
|
}
|
|
51956
52231
|
async function readPackageFile(file2) {
|
|
51957
|
-
const bytes = await (0,
|
|
52232
|
+
const bytes = await (0, import_promises29.readFile)(file2.absolutePath);
|
|
51958
52233
|
return {
|
|
51959
52234
|
bytes,
|
|
51960
52235
|
manifest: {
|
|
@@ -52138,7 +52413,7 @@ function uint642(value) {
|
|
|
52138
52413
|
}
|
|
52139
52414
|
|
|
52140
52415
|
// src/capabilities/skills/store.ts
|
|
52141
|
-
var
|
|
52416
|
+
var import_promises30 = require("fs/promises");
|
|
52142
52417
|
var import_node_path33 = require("path");
|
|
52143
52418
|
|
|
52144
52419
|
// ../shared/src/node/alan-skill-identity.ts
|
|
@@ -52203,7 +52478,7 @@ async function readLocalSkills(layout) {
|
|
|
52203
52478
|
async function isLocalSkillCurrent(entry, contentHash, ignoredPaths) {
|
|
52204
52479
|
if (entry.contentHash !== contentHash) return false;
|
|
52205
52480
|
try {
|
|
52206
|
-
if (await (0,
|
|
52481
|
+
if (await (0, import_promises30.realpath)(entry.path) !== entry.path) return false;
|
|
52207
52482
|
const inspected = await inspectSkillPackage(entry.path, { expectedName: null, ignoredPaths });
|
|
52208
52483
|
return inspected.contentHash === contentHash;
|
|
52209
52484
|
} catch {
|
|
@@ -52218,7 +52493,7 @@ async function resolveLocalSkill(local, invocation) {
|
|
|
52218
52493
|
}
|
|
52219
52494
|
async function hasSkillFile(directory) {
|
|
52220
52495
|
try {
|
|
52221
|
-
return (await (0,
|
|
52496
|
+
return (await (0, import_promises30.stat)((0, import_node_path33.join)(directory, "SKILL.md"))).isFile();
|
|
52222
52497
|
} catch {
|
|
52223
52498
|
return false;
|
|
52224
52499
|
}
|
|
@@ -52275,7 +52550,7 @@ async function resolveSkillInvocations(layout, invocations, baked = "any") {
|
|
|
52275
52550
|
async function nativeCandidates(layout) {
|
|
52276
52551
|
const nativeDir = layout.nativeDir;
|
|
52277
52552
|
if (nativeDir === null) return [];
|
|
52278
|
-
const entries = await (0,
|
|
52553
|
+
const entries = await (0, import_promises30.readdir)(nativeDir, { withFileTypes: true }).catch(() => []);
|
|
52279
52554
|
return entries.filter((entry) => entry.isDirectory() || entry.isSymbolicLink()).map((entry) => ({ directory: (0, import_node_path33.join)(nativeDir, entry.name) }));
|
|
52280
52555
|
}
|
|
52281
52556
|
async function availableSkillIndex(layout, sources = { synced: true, native: true }) {
|
|
@@ -52315,7 +52590,7 @@ async function inspectIndexedSkill(directory, contentHash) {
|
|
|
52315
52590
|
// src/capabilities/skills/native-index.ts
|
|
52316
52591
|
var import_node_crypto33 = require("crypto");
|
|
52317
52592
|
var import_node_fs18 = require("fs");
|
|
52318
|
-
var
|
|
52593
|
+
var import_promises31 = require("fs/promises");
|
|
52319
52594
|
var import_node_path34 = require("path");
|
|
52320
52595
|
var ALAN_SKILLS_PLUGIN_NAME = "alan";
|
|
52321
52596
|
var PLUGIN_MANIFEST = `${JSON.stringify(
|
|
@@ -52335,7 +52610,7 @@ function installedSkillFolders(layout) {
|
|
|
52335
52610
|
var import_node_path37 = require("path");
|
|
52336
52611
|
|
|
52337
52612
|
// src/capabilities/workspace/approved-paths.ts
|
|
52338
|
-
var
|
|
52613
|
+
var import_promises32 = require("fs/promises");
|
|
52339
52614
|
init_zod();
|
|
52340
52615
|
|
|
52341
52616
|
// src/capabilities/workspace/paths.ts
|
|
@@ -52373,7 +52648,7 @@ var storeSchema = external_exports.object({
|
|
|
52373
52648
|
});
|
|
52374
52649
|
async function realpathOrNull(path) {
|
|
52375
52650
|
try {
|
|
52376
|
-
return await (0,
|
|
52651
|
+
return await (0, import_promises32.realpath)(path);
|
|
52377
52652
|
} catch (error62) {
|
|
52378
52653
|
const code = errnoCode(error62);
|
|
52379
52654
|
if (code === "ENOENT" || code === "ENOTDIR" || code === "EACCES" || code === "EPERM") {
|
|
@@ -52433,7 +52708,7 @@ async function openApprovedPaths(options) {
|
|
|
52433
52708
|
|
|
52434
52709
|
// src/capabilities/workspace/locks.ts
|
|
52435
52710
|
var import_node_crypto34 = require("crypto");
|
|
52436
|
-
var
|
|
52711
|
+
var import_promises33 = require("fs/promises");
|
|
52437
52712
|
var import_node_path36 = require("path");
|
|
52438
52713
|
init_zod();
|
|
52439
52714
|
var LOCK_FORMAT = 1;
|
|
@@ -52454,7 +52729,7 @@ function repositoryLockKey(commonDir, platform) {
|
|
|
52454
52729
|
async function readOwner(path) {
|
|
52455
52730
|
let text2;
|
|
52456
52731
|
try {
|
|
52457
|
-
text2 = await (0,
|
|
52732
|
+
text2 = await (0, import_promises33.readFile)(path, "utf8");
|
|
52458
52733
|
} catch (error62) {
|
|
52459
52734
|
if (errnoCode(error62) === "ENOENT") return { kind: "missing" };
|
|
52460
52735
|
return { kind: "unreadable" };
|
|
@@ -52475,7 +52750,7 @@ async function removeIfSame(path, expected) {
|
|
|
52475
52750
|
if (current.kind !== "owner" || current.owner.since !== expected.since) return;
|
|
52476
52751
|
if (current.owner.pid !== expected.pid || current.owner.holder !== expected.holder) return;
|
|
52477
52752
|
}
|
|
52478
|
-
await (0,
|
|
52753
|
+
await (0, import_promises33.unlink)(path).catch((error62) => {
|
|
52479
52754
|
if (errnoCode(error62) !== "ENOENT") throw error62;
|
|
52480
52755
|
});
|
|
52481
52756
|
}
|
|
@@ -52500,7 +52775,7 @@ function openRepositoryLocks(options) {
|
|
|
52500
52775
|
await removeIfSame(path, read.owner);
|
|
52501
52776
|
return null;
|
|
52502
52777
|
}
|
|
52503
|
-
const age = await (0,
|
|
52778
|
+
const age = await (0, import_promises33.stat)(path).then(
|
|
52504
52779
|
(info) => clock.now() - info.mtimeMs,
|
|
52505
52780
|
() => 0
|
|
52506
52781
|
);
|
|
@@ -52515,12 +52790,12 @@ function openRepositoryLocks(options) {
|
|
|
52515
52790
|
const folder = async (commonDir) => {
|
|
52516
52791
|
const key = repositoryLockKey(commonDir, platform);
|
|
52517
52792
|
const dir = (0, import_node_path36.join)(options.dir, key);
|
|
52518
|
-
await (0,
|
|
52793
|
+
await (0, import_promises33.mkdir)(dir, { recursive: true, mode: 448 });
|
|
52519
52794
|
return { key, dir };
|
|
52520
52795
|
};
|
|
52521
52796
|
const createExclusive = async (path, owner) => {
|
|
52522
52797
|
try {
|
|
52523
|
-
const handle = await (0,
|
|
52798
|
+
const handle = await (0, import_promises33.open)(path, "wx", 384);
|
|
52524
52799
|
try {
|
|
52525
52800
|
await handle.writeFile(JSON.stringify(owner));
|
|
52526
52801
|
} finally {
|
|
@@ -52533,7 +52808,7 @@ function openRepositoryLocks(options) {
|
|
|
52533
52808
|
}
|
|
52534
52809
|
};
|
|
52535
52810
|
const liveRun = async (dir) => {
|
|
52536
|
-
const entries = await (0,
|
|
52811
|
+
const entries = await (0, import_promises33.readdir)(dir);
|
|
52537
52812
|
for (const entry of entries) {
|
|
52538
52813
|
if (!entry.startsWith(RUN_FILE_PREFIX)) continue;
|
|
52539
52814
|
const holder = await heldBy((0, import_node_path36.join)(dir, entry));
|
|
@@ -52791,17 +53066,17 @@ function createConversationMcpAuthorization(options) {
|
|
|
52791
53066
|
}
|
|
52792
53067
|
|
|
52793
53068
|
// src/holder/mcp-helper-access.ts
|
|
52794
|
-
var
|
|
53069
|
+
var import_promises34 = require("fs/promises");
|
|
52795
53070
|
function createHelperMcpAccess(options) {
|
|
52796
53071
|
return {
|
|
52797
53072
|
[Symbol.asyncDispose]: async () => {
|
|
52798
|
-
await (0,
|
|
53073
|
+
await (0, import_promises34.rm)(options.credentialPath, { force: true });
|
|
52799
53074
|
},
|
|
52800
53075
|
url: options.managedMcp.url,
|
|
52801
53076
|
authorization: async (signal) => {
|
|
52802
53077
|
const authorization = await options.managedMcp.authorization(signal);
|
|
52803
53078
|
if (authorization === void 0 || signal.aborted) {
|
|
52804
|
-
await (0,
|
|
53079
|
+
await (0, import_promises34.rm)(options.credentialPath, { force: true });
|
|
52805
53080
|
return void 0;
|
|
52806
53081
|
}
|
|
52807
53082
|
const credential = {
|
|
@@ -52816,7 +53091,7 @@ function createHelperMcpAccess(options) {
|
|
|
52816
53091
|
}
|
|
52817
53092
|
|
|
52818
53093
|
// src/holder/run-inputs.ts
|
|
52819
|
-
var
|
|
53094
|
+
var import_promises35 = require("fs/promises");
|
|
52820
53095
|
var import_node_path39 = require("path");
|
|
52821
53096
|
init_src();
|
|
52822
53097
|
var NO_RUN_INPUTS = {
|
|
@@ -52854,7 +53129,7 @@ async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [], com
|
|
|
52854
53129
|
await commitAttribution?.setCoAuthor(spec.gitCoAuthor);
|
|
52855
53130
|
const dir = (0, import_node_path39.join)(tmpDir, "runs", spec.runId);
|
|
52856
53131
|
const cleanup = async () => {
|
|
52857
|
-
await (0,
|
|
53132
|
+
await (0, import_promises35.rm)(dir, { recursive: true, force: true });
|
|
52858
53133
|
};
|
|
52859
53134
|
try {
|
|
52860
53135
|
const credential = await source.fetchProviderCredential(spec.runId, signal);
|
|
@@ -52862,8 +53137,8 @@ async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [], com
|
|
|
52862
53137
|
for (const [index, attachment] of (spec.attachments ?? []).entries()) {
|
|
52863
53138
|
const bytes = await source.downloadAttachment(spec.runId, attachment.id, signal);
|
|
52864
53139
|
const path = attachmentPath(spec, attachment, index, dir);
|
|
52865
|
-
await (0,
|
|
52866
|
-
await (0,
|
|
53140
|
+
await (0, import_promises35.mkdir)((0, import_node_path39.dirname)(path), { recursive: true, mode: 448 });
|
|
53141
|
+
await (0, import_promises35.writeFile)(path, bytes, { mode: 384 });
|
|
52867
53142
|
const imageMimeType = attachment.kind === "image" ? detectImageMimeType(Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength)) : null;
|
|
52868
53143
|
attachments.push({
|
|
52869
53144
|
id: attachment.id,
|
|
@@ -52901,7 +53176,7 @@ init_runtime_v2();
|
|
|
52901
53176
|
|
|
52902
53177
|
// src/holder/admission.ts
|
|
52903
53178
|
var import_node_fs20 = require("fs");
|
|
52904
|
-
var
|
|
53179
|
+
var import_promises39 = require("fs/promises");
|
|
52905
53180
|
var import_node_os7 = require("os");
|
|
52906
53181
|
var import_node_path45 = require("path");
|
|
52907
53182
|
init_constants();
|
|
@@ -52915,11 +53190,11 @@ function resolveAlanDefaultWorkspacePath(homeDirectory = (0, import_node_os6.hom
|
|
|
52915
53190
|
}
|
|
52916
53191
|
|
|
52917
53192
|
// src/holder/agent-context.ts
|
|
52918
|
-
var
|
|
53193
|
+
var import_promises36 = require("fs/promises");
|
|
52919
53194
|
var import_node_path41 = require("path");
|
|
52920
53195
|
init_prompt();
|
|
52921
53196
|
async function readText2(path) {
|
|
52922
|
-
return (0,
|
|
53197
|
+
return (0, import_promises36.readFile)(path, "utf8").then(
|
|
52923
53198
|
(text2) => text2.trim(),
|
|
52924
53199
|
() => null
|
|
52925
53200
|
);
|
|
@@ -52965,12 +53240,12 @@ var import_node_path44 = require("path");
|
|
|
52965
53240
|
|
|
52966
53241
|
// src/holder/claim-once.ts
|
|
52967
53242
|
var import_node_crypto35 = require("crypto");
|
|
52968
|
-
var
|
|
53243
|
+
var import_promises37 = require("fs/promises");
|
|
52969
53244
|
var import_node_path42 = require("path");
|
|
52970
53245
|
async function claimOnce(dir, name) {
|
|
52971
53246
|
try {
|
|
52972
|
-
await (0,
|
|
52973
|
-
await (await (0,
|
|
53247
|
+
await (0, import_promises37.mkdir)(dir, { recursive: true, mode: 448 });
|
|
53248
|
+
await (await (0, import_promises37.open)((0, import_node_path42.join)(dir, name), "wx")).close();
|
|
52974
53249
|
return true;
|
|
52975
53250
|
} catch {
|
|
52976
53251
|
return false;
|
|
@@ -52981,7 +53256,7 @@ function claimFirstLease(freshnessDir, path) {
|
|
|
52981
53256
|
}
|
|
52982
53257
|
|
|
52983
53258
|
// src/holder/requested-checkout.ts
|
|
52984
|
-
var
|
|
53259
|
+
var import_promises38 = require("fs/promises");
|
|
52985
53260
|
var import_node_path43 = require("path");
|
|
52986
53261
|
var REMOTE2 = "origin";
|
|
52987
53262
|
var REASON_MAX_CHARS = 200;
|
|
@@ -53004,7 +53279,7 @@ function notSwitched(checkout, current, reason) {
|
|
|
53004
53279
|
}
|
|
53005
53280
|
async function clone2(checkout, deps, signal) {
|
|
53006
53281
|
const parent = (0, import_node_path43.dirname)(checkout.path);
|
|
53007
|
-
await (0,
|
|
53282
|
+
await (0, import_promises38.mkdir)(parent, { recursive: true });
|
|
53008
53283
|
await assertValidBranch(deps.git, parent, checkout.branch, signal);
|
|
53009
53284
|
const output2 = await deps.git.run(
|
|
53010
53285
|
{
|
|
@@ -53312,7 +53587,7 @@ function volumeRoot(path) {
|
|
|
53312
53587
|
}
|
|
53313
53588
|
async function exists(path) {
|
|
53314
53589
|
try {
|
|
53315
|
-
await (0,
|
|
53590
|
+
await (0, import_promises39.stat)(path);
|
|
53316
53591
|
return true;
|
|
53317
53592
|
} catch {
|
|
53318
53593
|
return false;
|
|
@@ -53320,10 +53595,10 @@ async function exists(path) {
|
|
|
53320
53595
|
}
|
|
53321
53596
|
async function inspectReadiness(path) {
|
|
53322
53597
|
try {
|
|
53323
|
-
if (!(await (0,
|
|
53598
|
+
if (!(await (0, import_promises39.stat)(path)).isDirectory()) {
|
|
53324
53599
|
return { ready: false, missing: true, message: MESSAGES.missing };
|
|
53325
53600
|
}
|
|
53326
|
-
await (0,
|
|
53601
|
+
await (0, import_promises39.access)(path, import_node_fs20.constants.R_OK | import_node_fs20.constants.W_OK | import_node_fs20.constants.X_OK);
|
|
53327
53602
|
return { ready: true };
|
|
53328
53603
|
} catch (error62) {
|
|
53329
53604
|
const code = errnoCode(error62) ?? "";
|
|
@@ -53367,8 +53642,8 @@ async function admitDefaultWorkspace(spec, context, skills) {
|
|
|
53367
53642
|
const { env } = context;
|
|
53368
53643
|
const path = resolveAlanDefaultWorkspacePath(env.HOME || env.USERPROFILE || (0, import_node_os7.homedir)());
|
|
53369
53644
|
try {
|
|
53370
|
-
await (0,
|
|
53371
|
-
await (0,
|
|
53645
|
+
await (0, import_promises39.mkdir)(path, { recursive: true, mode: 448 });
|
|
53646
|
+
await (0, import_promises39.access)(path, import_node_fs20.constants.R_OK | import_node_fs20.constants.W_OK | import_node_fs20.constants.X_OK);
|
|
53372
53647
|
return { kind: "admitted", spec: { ...spec, projectPath: path }, skills };
|
|
53373
53648
|
} catch (error62) {
|
|
53374
53649
|
const code = errnoCode(error62);
|
|
@@ -53496,7 +53771,7 @@ async function respondToTurn(runningRunId, driver, request2) {
|
|
|
53496
53771
|
}
|
|
53497
53772
|
|
|
53498
53773
|
// src/holder/session-facts.ts
|
|
53499
|
-
var
|
|
53774
|
+
var import_promises40 = require("fs/promises");
|
|
53500
53775
|
var CLI_RSS_CACHE_MS = 1e4;
|
|
53501
53776
|
var LOGIN_PROBLEM_PREFIX = "cli.auth.";
|
|
53502
53777
|
function isLoginFailure(result) {
|
|
@@ -53522,8 +53797,8 @@ function createSessionFacts(options) {
|
|
|
53522
53797
|
const path = await resolveCommandOnPath(command, env, platform);
|
|
53523
53798
|
if (path === null) return null;
|
|
53524
53799
|
try {
|
|
53525
|
-
const real = await (0,
|
|
53526
|
-
const info = await (0,
|
|
53800
|
+
const real = await (0, import_promises40.realpath)(path);
|
|
53801
|
+
const info = await (0, import_promises40.stat)(real);
|
|
53527
53802
|
return { command, key: `${real}:${info.ino}:${info.size}:${info.mtimeMs}` };
|
|
53528
53803
|
} catch {
|
|
53529
53804
|
return null;
|
|
@@ -53617,7 +53892,7 @@ async function steerTurn(runningRunId, driver, request2) {
|
|
|
53617
53892
|
init_acp2();
|
|
53618
53893
|
|
|
53619
53894
|
// src/run-log/directory.ts
|
|
53620
|
-
var
|
|
53895
|
+
var import_promises41 = require("fs/promises");
|
|
53621
53896
|
var import_node_path46 = require("path");
|
|
53622
53897
|
init_runtime_v2();
|
|
53623
53898
|
init_zod();
|
|
@@ -53650,7 +53925,7 @@ function runDirectory(runsDir, runId) {
|
|
|
53650
53925
|
}
|
|
53651
53926
|
async function isRunClaimed(runsDir, runId) {
|
|
53652
53927
|
try {
|
|
53653
|
-
return (await (0,
|
|
53928
|
+
return (await (0, import_promises41.stat)(runDirectory(runsDir, runId).log)).size > 0;
|
|
53654
53929
|
} catch (error62) {
|
|
53655
53930
|
if (errnoCode(error62) === "ENOENT") return false;
|
|
53656
53931
|
throw error62;
|
|
@@ -53658,7 +53933,7 @@ async function isRunClaimed(runsDir, runId) {
|
|
|
53658
53933
|
}
|
|
53659
53934
|
|
|
53660
53935
|
// src/run-log/conversation-index.ts
|
|
53661
|
-
var
|
|
53936
|
+
var import_promises42 = require("fs/promises");
|
|
53662
53937
|
var import_node_path47 = require("path");
|
|
53663
53938
|
init_runtime_v2();
|
|
53664
53939
|
init_zod();
|
|
@@ -53690,8 +53965,8 @@ async function indexConversationRun(runsDir, conversationId, ordinal, assistantO
|
|
|
53690
53965
|
const nextOrdinal = assistantOrdinal + 1;
|
|
53691
53966
|
if (nextOrdinal <= ordinal) throw new Error("Assistant order must follow the prompt");
|
|
53692
53967
|
const path = shardPath(runsDir, conversationId, ordinal);
|
|
53693
|
-
await (0,
|
|
53694
|
-
await (0,
|
|
53968
|
+
await (0, import_promises42.mkdir)((0, import_node_path47.dirname)(path), { recursive: true, mode: 448 });
|
|
53969
|
+
await (0, import_promises42.appendFile)(path, `${JSON.stringify({ ordinal, nextOrdinal, runId })}
|
|
53695
53970
|
`, { mode: 384 });
|
|
53696
53971
|
const coveragePath = (0, import_node_path47.join)((0, import_node_path47.dirname)((0, import_node_path47.dirname)(path)), "coverage.json");
|
|
53697
53972
|
const coverage = await readJsonFile(coveragePath, coverageSchema);
|
|
@@ -53781,6 +54056,7 @@ function openRunLog(path, clock) {
|
|
|
53781
54056
|
(0, import_node_fs21.ftruncateSync)(fd, size);
|
|
53782
54057
|
(0, import_node_fs21.fsyncSync)(fd);
|
|
53783
54058
|
}
|
|
54059
|
+
const droppedTailBytes = fileSize - size;
|
|
53784
54060
|
let dirty = false;
|
|
53785
54061
|
const sync = () => {
|
|
53786
54062
|
(0, import_node_fs21.fsyncSync)(fd);
|
|
@@ -53809,6 +54085,7 @@ function openRunLog(path, clock) {
|
|
|
53809
54085
|
return toByteOffset(size);
|
|
53810
54086
|
},
|
|
53811
54087
|
size: () => toByteOffset(size),
|
|
54088
|
+
droppedTailBytes,
|
|
53812
54089
|
syncIfDirty: () => {
|
|
53813
54090
|
if (dirty) sync();
|
|
53814
54091
|
},
|
|
@@ -54344,7 +54621,7 @@ function defaultInstallDir({ platform, home, env }) {
|
|
|
54344
54621
|
|
|
54345
54622
|
// src/sessions/index.ts
|
|
54346
54623
|
var import_node_crypto37 = require("crypto");
|
|
54347
|
-
var
|
|
54624
|
+
var import_promises43 = require("fs/promises");
|
|
54348
54625
|
var import_node_path51 = require("path");
|
|
54349
54626
|
|
|
54350
54627
|
// src/sessions/suspend-policy.ts
|