@alan-ai-hq/agent-manager-darwin-arm64 0.1.171 → 0.1.173
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 +153 -51
- package/alan-holder.cjs +128 -33
- package/alan-lease.cjs +5 -4
- package/package.json +1 -1
package/alan-agent.cjs
CHANGED
|
@@ -22043,7 +22043,8 @@ var init_github_proxy = __esm({
|
|
|
22043
22043
|
GITHUB_PROXY_REFUSAL_CODES = [
|
|
22044
22044
|
"host_not_proxied",
|
|
22045
22045
|
"machine_not_allowed",
|
|
22046
|
-
"github_not_connected"
|
|
22046
|
+
"github_not_connected",
|
|
22047
|
+
"github_installation_unavailable"
|
|
22047
22048
|
];
|
|
22048
22049
|
gitHubProxyErrorSchema = external_exports.object({
|
|
22049
22050
|
message: external_exports.string().min(1),
|
|
@@ -23453,7 +23454,7 @@ function getAlanModePrompt(mode) {
|
|
|
23453
23454
|
function getAlanAgentPrompt(agentId) {
|
|
23454
23455
|
return getAgentSystemPrompt(agentId);
|
|
23455
23456
|
}
|
|
23456
|
-
var ALAN_CONTEXT_SEARCH_PROMPT, ALAN_PLATFORM_TOOL_ROUTING_PROMPT, ALAN_OPENUI_COMPONENT_SIGNATURES, ALAN_VISUAL_PROMPT, ALAN_VISUAL_REMINDER_PROMPT, ALAN_IDENTITY_PROMPT, ALAN_CODE_CONTEXT_PROMPT, PLAN_MODE_PROMPT, ASK_MODE_PROMPT, REVIEW_MODE_PROMPT;
|
|
23457
|
+
var ALAN_CONTEXT_SEARCH_PROMPT, ALAN_PLATFORM_TOOL_ROUTING_PROMPT, ALAN_OPENUI_COMPONENT_SIGNATURES, ALAN_VISUAL_PROMPT, ALAN_VISUAL_REMINDER_PROMPT, ALAN_SUGGESTING_WORK_PROMPT, ALAN_IDENTITY_PROMPT, ALAN_CODE_CONTEXT_PROMPT, PLAN_MODE_PROMPT, ASK_MODE_PROMPT, REVIEW_MODE_PROMPT;
|
|
23457
23458
|
var init_system_prompt = __esm({
|
|
23458
23459
|
"../shared/dist/agent/system-prompt.js"() {
|
|
23459
23460
|
"use strict";
|
|
@@ -23532,6 +23533,12 @@ ${ALAN_OPENUI_COMPONENT_SIGNATURES.map((signature) => ` ${signature}`).join("\n
|
|
|
23532
23533
|
ALAN_VISUAL_REMINDER_PROMPT = `## Answer format
|
|
23533
23534
|
|
|
23534
23535
|
Before replying in the Alan chat, consider what the user is trying to do and whether a visual would serve it better than paragraphs: comparisons, trends, statuses, timelines, plans and options go in a \`\`\`chart, \`\`\`mermaid or \`\`\`openui block even when nobody asked for one. Trivial answers stay plain text.`;
|
|
23536
|
+
ALAN_SUGGESTING_WORK_PROMPT = `## Suggesting Work
|
|
23537
|
+
|
|
23538
|
+
When \`suggest_task\` is available, use it to put work in the session's side panel for the user to pick up; it creates nothing by itself.
|
|
23539
|
+
- \`convert_session\`: suggest once when a chat that is not linked to a task has turned into multi-step delivery work (code changes, a PR, several turns). Give the title and description the task should have.
|
|
23540
|
+
- \`follow_up\`: suggest real, separate work you found and did not do, such as a bug, risky debt or a missing test. Never the next step of the current request or work you are about to do. Include \`handoffContext\` with what a fresh session needs: verified findings, files, decisions.
|
|
23541
|
+
- Prefer none. At most three in a turn, never a duplicate (check \`list_task_suggestions\`), and withdraw one that stops applying. Do not mention suggestions in your reply.`;
|
|
23535
23542
|
ALAN_IDENTITY_PROMPT = `You are Alan, the software factory agent. Alan ships software end to end \u2014 plan, write, review, test, deploy.
|
|
23536
23543
|
|
|
23537
23544
|
## How Alan is structured
|
|
@@ -23574,7 +23581,9 @@ When the user refers to a specific task, document, or epic by human identifier (
|
|
|
23574
23581
|
|
|
23575
23582
|
## Task Logging
|
|
23576
23583
|
|
|
23577
|
-
For non-trivial tasks, log high-signal events as they happen: decisions, changed assumptions, validation results, known-good IDs, blockers, risks, direction changes, and session outcomes. Do not log routine commands or file reads. Before stopping, ensure the Agent Log and current session outcome are enough for a human to understand progress and for another agent to resume. If a prior event or decision is stale, supersede it instead of appending contradictory state
|
|
23584
|
+
For non-trivial tasks, log high-signal events as they happen: decisions, changed assumptions, validation results, known-good IDs, blockers, risks, direction changes, and session outcomes. Do not log routine commands or file reads. Before stopping, ensure the Agent Log and current session outcome are enough for a human to understand progress and for another agent to resume. If a prior event or decision is stale, supersede it instead of appending contradictory state.
|
|
23585
|
+
|
|
23586
|
+
${ALAN_SUGGESTING_WORK_PROMPT}`;
|
|
23578
23587
|
ALAN_CODE_CONTEXT_PROMPT = buildAlanCodeContextPrompt();
|
|
23579
23588
|
PLAN_MODE_PROMPT = [
|
|
23580
23589
|
"You are in Alan plan mode.",
|
|
@@ -23940,6 +23949,17 @@ var init_models = __esm({
|
|
|
23940
23949
|
contextWindow: 1048576,
|
|
23941
23950
|
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
23942
23951
|
},
|
|
23952
|
+
{
|
|
23953
|
+
id: "particle-ai/particle-1",
|
|
23954
|
+
name: "Particle-1",
|
|
23955
|
+
description: "Particle AI's token-efficient coding model via Alan",
|
|
23956
|
+
enabled: true,
|
|
23957
|
+
isDefault: false,
|
|
23958
|
+
sortOrder: 25,
|
|
23959
|
+
upstreamModelId: "particle-ai/particle-1",
|
|
23960
|
+
contextWindow: 1048576,
|
|
23961
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
23962
|
+
},
|
|
23943
23963
|
{
|
|
23944
23964
|
id: "z-ai/glm-5.3",
|
|
23945
23965
|
name: "GLM 5.3",
|
|
@@ -39316,9 +39336,9 @@ function tokenCount(payload, state) {
|
|
|
39316
39336
|
const totalRecord = asRecord(info?.total_token_usage);
|
|
39317
39337
|
if (!totalRecord) return [];
|
|
39318
39338
|
const total = rolloutTokens(totalRecord);
|
|
39319
|
-
const
|
|
39320
|
-
if (
|
|
39321
|
-
state.turnTokens.note(rolloutTokens(
|
|
39339
|
+
const lastRecord2 = asRecord(info?.last_token_usage);
|
|
39340
|
+
if (lastRecord2)
|
|
39341
|
+
state.turnTokens.note(rolloutTokens(lastRecord2), total, num(info?.model_context_window));
|
|
39322
39342
|
if (state.turnUsageSeen) return [];
|
|
39323
39343
|
return reportedUsage(state.turnTokens.spend(total), state);
|
|
39324
39344
|
}
|
|
@@ -40043,9 +40063,9 @@ var init_codex = __esm({
|
|
|
40043
40063
|
}
|
|
40044
40064
|
#usage(params) {
|
|
40045
40065
|
const usage = asRecord(params.tokenUsage);
|
|
40046
|
-
const
|
|
40047
|
-
if (!
|
|
40048
|
-
const last = appServerTokens(
|
|
40066
|
+
const lastRecord2 = asRecord(usage?.last);
|
|
40067
|
+
if (!lastRecord2) return [];
|
|
40068
|
+
const last = appServerTokens(lastRecord2);
|
|
40049
40069
|
const totalRecord = asRecord(usage?.total);
|
|
40050
40070
|
const total = totalRecord ? appServerTokens(totalRecord) : void 0;
|
|
40051
40071
|
this.#tokens.note(last, total, asFiniteNumber(usage?.modelContextWindow));
|
|
@@ -53329,7 +53349,7 @@ var require_extract = __commonJS({
|
|
|
53329
53349
|
var require_constants = __commonJS({
|
|
53330
53350
|
"../../node_modules/tar-stream/constants.js"(exports2, module2) {
|
|
53331
53351
|
"use strict";
|
|
53332
|
-
var
|
|
53352
|
+
var constants7 = {
|
|
53333
53353
|
// just for envs without fs
|
|
53334
53354
|
S_IFMT: 61440,
|
|
53335
53355
|
S_IFDIR: 16384,
|
|
@@ -53339,9 +53359,9 @@ var require_constants = __commonJS({
|
|
|
53339
53359
|
S_IFLNK: 40960
|
|
53340
53360
|
};
|
|
53341
53361
|
try {
|
|
53342
|
-
module2.exports = require("fs").constants ||
|
|
53362
|
+
module2.exports = require("fs").constants || constants7;
|
|
53343
53363
|
} catch {
|
|
53344
|
-
module2.exports =
|
|
53364
|
+
module2.exports = constants7;
|
|
53345
53365
|
}
|
|
53346
53366
|
}
|
|
53347
53367
|
});
|
|
@@ -53352,7 +53372,7 @@ var require_pack = __commonJS({
|
|
|
53352
53372
|
"use strict";
|
|
53353
53373
|
var { Readable: Readable2, Writable, getStreamError } = require_streamx();
|
|
53354
53374
|
var b4a = require_b4a();
|
|
53355
|
-
var
|
|
53375
|
+
var constants7 = require_constants();
|
|
53356
53376
|
var headers = require_headers();
|
|
53357
53377
|
var DMODE = 493;
|
|
53358
53378
|
var FMODE = 420;
|
|
@@ -53555,16 +53575,16 @@ var require_pack = __commonJS({
|
|
|
53555
53575
|
return new Pack(opts);
|
|
53556
53576
|
};
|
|
53557
53577
|
function modeToType(mode) {
|
|
53558
|
-
switch (mode &
|
|
53559
|
-
case
|
|
53578
|
+
switch (mode & constants7.S_IFMT) {
|
|
53579
|
+
case constants7.S_IFBLK:
|
|
53560
53580
|
return "block-device";
|
|
53561
|
-
case
|
|
53581
|
+
case constants7.S_IFCHR:
|
|
53562
53582
|
return "character-device";
|
|
53563
|
-
case
|
|
53583
|
+
case constants7.S_IFDIR:
|
|
53564
53584
|
return "directory";
|
|
53565
|
-
case
|
|
53585
|
+
case constants7.S_IFIFO:
|
|
53566
53586
|
return "fifo";
|
|
53567
|
-
case
|
|
53587
|
+
case constants7.S_IFLNK:
|
|
53568
53588
|
return "symlink";
|
|
53569
53589
|
}
|
|
53570
53590
|
return "file";
|
|
@@ -58376,7 +58396,7 @@ var import_node_worker_threads2 = require("worker_threads");
|
|
|
58376
58396
|
// package.json
|
|
58377
58397
|
var package_default = {
|
|
58378
58398
|
name: "@alan-ai-hq/agent-manager",
|
|
58379
|
-
version: "0.1.
|
|
58399
|
+
version: "0.1.173",
|
|
58380
58400
|
private: true,
|
|
58381
58401
|
type: "module",
|
|
58382
58402
|
description: "Alan machine runtime (alan-agent): identity, link, reconciler, session holders, run log, uploader, local API",
|
|
@@ -58832,8 +58852,8 @@ function readBody(incoming, url3, maxBytes) {
|
|
|
58832
58852
|
incoming.on("end", () => resolve14(Buffer.concat(chunks)));
|
|
58833
58853
|
});
|
|
58834
58854
|
}
|
|
58835
|
-
function
|
|
58836
|
-
return error62 instanceof Error && "code" in error62 && (error62.code === "ECONNRESET" || error62.code === "EPIPE");
|
|
58855
|
+
function isRetryableConnectionError(error62) {
|
|
58856
|
+
return error62 instanceof Error && "code" in error62 && (error62.code === "ECONNABORTED" || error62.code === "ECONNRESET" || error62.code === "EPIPE");
|
|
58837
58857
|
}
|
|
58838
58858
|
function exchange(request2, agents, attempt2 = 0) {
|
|
58839
58859
|
const { signal, url: url3 } = request2;
|
|
@@ -58861,7 +58881,7 @@ function exchange(request2, agents, attempt2 = 0) {
|
|
|
58861
58881
|
};
|
|
58862
58882
|
let responded = false;
|
|
58863
58883
|
const onError = (error62) => {
|
|
58864
|
-
const stale = outgoing.reusedSocket && !responded &&
|
|
58884
|
+
const stale = outgoing.reusedSocket && !responded && isRetryableConnectionError(error62);
|
|
58865
58885
|
if (stale && attempt2 < STALE_SOCKET_RETRIES && !signal.aborted) {
|
|
58866
58886
|
settle2();
|
|
58867
58887
|
resolve14(exchange(request2, agents, attempt2 + 1));
|
|
@@ -72645,9 +72665,24 @@ function tailWindows(size) {
|
|
|
72645
72665
|
if (length >= size || length > MAX_RUN_LOG_RECORD_BYTES) return windows;
|
|
72646
72666
|
}
|
|
72647
72667
|
}
|
|
72648
|
-
function
|
|
72649
|
-
|
|
72650
|
-
|
|
72668
|
+
function parseRecord2(line) {
|
|
72669
|
+
try {
|
|
72670
|
+
const parsed = runLogRecordSchema.safeParse(JSON.parse(Buffer.from(line).toString("utf8")));
|
|
72671
|
+
return parsed.success ? parsed.data : null;
|
|
72672
|
+
} catch {
|
|
72673
|
+
return null;
|
|
72674
|
+
}
|
|
72675
|
+
}
|
|
72676
|
+
function lastRecord(window2, wholeFile) {
|
|
72677
|
+
let end = window2.lastIndexOf(RUN_LOG_RECORD_SEPARATOR) + 1;
|
|
72678
|
+
while (end > 0) {
|
|
72679
|
+
const start2 = end >= 2 ? window2.lastIndexOf(RUN_LOG_RECORD_SEPARATOR, end - 2) + 1 : 0;
|
|
72680
|
+
if (start2 === 0 && !wholeFile) return void 0;
|
|
72681
|
+
const record2 = parseRecord2(window2.subarray(start2, end - 1));
|
|
72682
|
+
if (record2 !== null) return { record: record2, end };
|
|
72683
|
+
end = start2;
|
|
72684
|
+
}
|
|
72685
|
+
return wholeFile ? null : void 0;
|
|
72651
72686
|
}
|
|
72652
72687
|
|
|
72653
72688
|
// src/run-log/reader.ts
|
|
@@ -72696,12 +72731,9 @@ async function readLastRecord(path4) {
|
|
|
72696
72731
|
for (const length of tailWindows(size)) {
|
|
72697
72732
|
const buffer = Buffer.alloc(length);
|
|
72698
72733
|
await handle.read(buffer, 0, length, size - length);
|
|
72699
|
-
const
|
|
72700
|
-
const last = lastLine(aligned, length === size);
|
|
72734
|
+
const last = lastRecord(buffer, length === size);
|
|
72701
72735
|
if (last === void 0) continue;
|
|
72702
|
-
|
|
72703
|
-
const parsed = runLogRecordSchema.safeParse(JSON.parse(last));
|
|
72704
|
-
return parsed.success ? parsed.data : null;
|
|
72736
|
+
return last?.record ?? null;
|
|
72705
72737
|
}
|
|
72706
72738
|
return null;
|
|
72707
72739
|
} finally {
|
|
@@ -72725,24 +72757,33 @@ var decoder = new TextDecoder();
|
|
|
72725
72757
|
var import_node_fs22 = require("fs");
|
|
72726
72758
|
var import_node_path66 = require("path");
|
|
72727
72759
|
init_runtime_v2();
|
|
72728
|
-
function
|
|
72760
|
+
function readTail(fd, size) {
|
|
72729
72761
|
for (const length of tailWindows(size)) {
|
|
72730
72762
|
const buffer = Buffer.alloc(length);
|
|
72731
72763
|
(0, import_node_fs22.readSync)(fd, buffer, 0, length, size - length);
|
|
72732
|
-
const last =
|
|
72764
|
+
const last = lastRecord(buffer, length === size);
|
|
72733
72765
|
if (last === void 0) continue;
|
|
72734
|
-
if (last
|
|
72735
|
-
|
|
72736
|
-
if (!parsed.success) throw new RuntimeFault("invalid_file", "Run log tail is not a record");
|
|
72737
|
-
return parsed.data.seq;
|
|
72766
|
+
if (last === null) return { seq: 0, end: 0 };
|
|
72767
|
+
return { seq: last.record.seq, end: size - length + last.end };
|
|
72738
72768
|
}
|
|
72739
72769
|
throw new RuntimeFault("record_too_large", "Run log tail record is larger than any record");
|
|
72740
72770
|
}
|
|
72771
|
+
function writeAt(fd, bytes, position) {
|
|
72772
|
+
for (let written = 0; written < bytes.length; ) {
|
|
72773
|
+
written += (0, import_node_fs22.writeSync)(fd, bytes, written, bytes.length - written, position + written);
|
|
72774
|
+
}
|
|
72775
|
+
}
|
|
72741
72776
|
function openRunLog(path4, clock) {
|
|
72742
72777
|
(0, import_node_fs22.mkdirSync)((0, import_node_path66.dirname)(path4), { recursive: true, mode: 448 });
|
|
72743
|
-
const fd = (0, import_node_fs22.openSync)(path4,
|
|
72744
|
-
|
|
72745
|
-
|
|
72778
|
+
const fd = (0, import_node_fs22.openSync)(path4, import_node_fs22.constants.O_RDWR | import_node_fs22.constants.O_CREAT, 384);
|
|
72779
|
+
const fileSize = (0, import_node_fs22.fstatSync)(fd).size;
|
|
72780
|
+
const tail = readTail(fd, fileSize);
|
|
72781
|
+
let size = tail.end;
|
|
72782
|
+
let seq = tail.seq;
|
|
72783
|
+
if (fileSize > size) {
|
|
72784
|
+
(0, import_node_fs22.ftruncateSync)(fd, size);
|
|
72785
|
+
(0, import_node_fs22.fsyncSync)(fd);
|
|
72786
|
+
}
|
|
72746
72787
|
let dirty = false;
|
|
72747
72788
|
const sync = () => {
|
|
72748
72789
|
(0, import_node_fs22.fsyncSync)(fd);
|
|
@@ -72750,16 +72791,21 @@ function openRunLog(path4, clock) {
|
|
|
72750
72791
|
};
|
|
72751
72792
|
return {
|
|
72752
72793
|
append: (update, sessionId) => {
|
|
72753
|
-
seq += 1;
|
|
72754
72794
|
const record2 = {
|
|
72755
|
-
seq,
|
|
72795
|
+
seq: seq + 1,
|
|
72756
72796
|
at: clock.now(),
|
|
72757
72797
|
...sessionId === void 0 ? {} : { sessionId },
|
|
72758
72798
|
update
|
|
72759
72799
|
};
|
|
72760
72800
|
const line = Buffer.from(`${JSON.stringify(record2)}
|
|
72761
72801
|
`, "utf8");
|
|
72762
|
-
|
|
72802
|
+
try {
|
|
72803
|
+
writeAt(fd, line, size);
|
|
72804
|
+
} catch (error62) {
|
|
72805
|
+
(0, import_node_fs22.ftruncateSync)(fd, size);
|
|
72806
|
+
throw error62;
|
|
72807
|
+
}
|
|
72808
|
+
seq = record2.seq;
|
|
72763
72809
|
size += line.length;
|
|
72764
72810
|
dirty = true;
|
|
72765
72811
|
if (isRunLifecycleKind(update.sessionUpdate)) sync();
|
|
@@ -72905,16 +72951,58 @@ async function claimRun(spec, context) {
|
|
|
72905
72951
|
}
|
|
72906
72952
|
return log;
|
|
72907
72953
|
}
|
|
72954
|
+
var RUN_END_RETRY_MS = 5e3;
|
|
72955
|
+
var RUN_END_DEADLINE_MS = 10 * 6e4;
|
|
72908
72956
|
async function runClaimedTurn(spec, claimed, context, signal) {
|
|
72909
72957
|
var _stack = [];
|
|
72910
72958
|
try {
|
|
72911
72959
|
const log = __using(_stack, claimed);
|
|
72912
72960
|
const reported = { error: false };
|
|
72961
|
+
const writeFailed = new AbortController();
|
|
72962
|
+
let writeError;
|
|
72913
72963
|
const append = (update, sessionId) => {
|
|
72964
|
+
if (writeError !== void 0) return;
|
|
72914
72965
|
if (update.sessionUpdate === "notice" && update.severity === "error") reported.error = true;
|
|
72915
|
-
|
|
72966
|
+
let offset;
|
|
72967
|
+
try {
|
|
72968
|
+
offset = log.append(update, sessionId);
|
|
72969
|
+
} catch (error62) {
|
|
72970
|
+
writeError = error62;
|
|
72971
|
+
context.log.error("holder.run_log_write_failed", { runId: spec.runId, error: error62 });
|
|
72972
|
+
writeFailed.abort();
|
|
72973
|
+
return;
|
|
72974
|
+
}
|
|
72916
72975
|
context.onAppended(spec.runId, offset);
|
|
72917
72976
|
};
|
|
72977
|
+
const endRun = async (updates2) => {
|
|
72978
|
+
const deadline = context.clock.monotonic() + RUN_END_DEADLINE_MS;
|
|
72979
|
+
for (const update of updates2) {
|
|
72980
|
+
for (; ; ) {
|
|
72981
|
+
let offset;
|
|
72982
|
+
try {
|
|
72983
|
+
offset = log.append(update);
|
|
72984
|
+
} catch (error62) {
|
|
72985
|
+
context.log.warn("holder.run_end_write_failed", { runId: spec.runId, error: error62 });
|
|
72986
|
+
if (context.clock.monotonic() >= deadline) {
|
|
72987
|
+
throw new RuntimeFault("io_failed", `Run ${spec.runId} could not be ended`, {
|
|
72988
|
+
cause: error62
|
|
72989
|
+
});
|
|
72990
|
+
}
|
|
72991
|
+
await context.clock.sleep(RUN_END_RETRY_MS, new AbortController().signal);
|
|
72992
|
+
continue;
|
|
72993
|
+
}
|
|
72994
|
+
context.onAppended(spec.runId, offset);
|
|
72995
|
+
break;
|
|
72996
|
+
}
|
|
72997
|
+
}
|
|
72998
|
+
};
|
|
72999
|
+
const fail = async (message2) => {
|
|
73000
|
+
await endRun([
|
|
73001
|
+
noticeUpdate("error", "run_failed", message2),
|
|
73002
|
+
runEnded({ outcome: "failed", message: message2 })
|
|
73003
|
+
]);
|
|
73004
|
+
return "failed";
|
|
73005
|
+
};
|
|
72918
73006
|
let result;
|
|
72919
73007
|
try {
|
|
72920
73008
|
result = await admitAndRun(
|
|
@@ -72925,20 +73013,22 @@ async function runClaimedTurn(spec, claimed, context, signal) {
|
|
|
72925
73013
|
// Base64 media in provider payloads and tool output never reaches the log (main 13590db369).
|
|
72926
73014
|
onEvent: (event) => append(fitForRunLog(withoutInlineMedia(event.update)), event.sessionId)
|
|
72927
73015
|
},
|
|
72928
|
-
signal
|
|
73016
|
+
AbortSignal.any([signal, writeFailed.signal])
|
|
72929
73017
|
);
|
|
72930
73018
|
} catch (error62) {
|
|
72931
|
-
const message2 = error62 instanceof Error ? error62.message : String(error62);
|
|
72932
73019
|
context.log.error("holder.turn_threw", { runId: spec.runId, error: error62 });
|
|
72933
|
-
|
|
72934
|
-
|
|
72935
|
-
|
|
73020
|
+
return await fail(error62 instanceof Error ? error62.message : String(error62));
|
|
73021
|
+
}
|
|
73022
|
+
if (writeError !== void 0) {
|
|
73023
|
+
const reason = writeError instanceof Error ? writeError.message : String(writeError);
|
|
73024
|
+
return await fail(`This run's log could not be written: ${reason}`);
|
|
72936
73025
|
}
|
|
72937
73026
|
const outcome2 = result.outcome === "aborted" && signal.reason === "interrupted" ? "interrupted" : result.outcome;
|
|
73027
|
+
const updates = [];
|
|
72938
73028
|
if (outcome2 === "failed" && !reported.error && result.message !== void 0) {
|
|
72939
|
-
|
|
73029
|
+
updates.push(noticeUpdate("error", "run_failed", result.message));
|
|
72940
73030
|
}
|
|
72941
|
-
|
|
73031
|
+
updates.push(
|
|
72942
73032
|
runEnded({
|
|
72943
73033
|
outcome: outcome2,
|
|
72944
73034
|
...result.providerSessionId === void 0 ? {} : { providerSessionId: result.providerSessionId },
|
|
@@ -72948,6 +73038,7 @@ async function runClaimedTurn(spec, claimed, context, signal) {
|
|
|
72948
73038
|
...result.unansweredSteerIds === void 0 ? {} : { unansweredSteerIds: [...result.unansweredSteerIds] }
|
|
72949
73039
|
})
|
|
72950
73040
|
);
|
|
73041
|
+
await endRun(updates);
|
|
72951
73042
|
context.log.info("holder.turn_ended", { runId: spec.runId, outcome: outcome2 });
|
|
72952
73043
|
return outcome2;
|
|
72953
73044
|
} catch (_) {
|
|
@@ -82086,12 +82177,17 @@ var CAPABILITIES_ACK_TIMEOUT_MS = 1e4;
|
|
|
82086
82177
|
var REDIAL_BASE_MS = 1e3;
|
|
82087
82178
|
var REDIAL_MAX_MS = 1e4;
|
|
82088
82179
|
var MAX_CREDENTIAL_FAILURES = 3;
|
|
82180
|
+
var CREDENTIAL_RETRY_BASE_MS = 3e4;
|
|
82181
|
+
var CREDENTIAL_RETRY_MAX_MS = 5 * 6e4;
|
|
82089
82182
|
var DISABLED_RETRY_MS = 5 * 6e4;
|
|
82090
82183
|
var WAKE_PROBE_MS = 5e3;
|
|
82091
82184
|
var SERVER_DROPS_SILENT_SOCKET_MS = 55e3;
|
|
82092
82185
|
function redialDelayMs(attempt2) {
|
|
82093
82186
|
return Math.min(REDIAL_BASE_MS * 2 ** attempt2, REDIAL_MAX_MS) * (0.5 + 0.5 * Math.random());
|
|
82094
82187
|
}
|
|
82188
|
+
function credentialRetryDelayMs(slowAttempt) {
|
|
82189
|
+
return Math.min(CREDENTIAL_RETRY_BASE_MS * 2 ** slowAttempt, CREDENTIAL_RETRY_MAX_MS);
|
|
82190
|
+
}
|
|
82095
82191
|
async function answerWorkspaceQuery(raw, options, log) {
|
|
82096
82192
|
const parsed = workspaceQueryRequestSchema.safeParse(raw);
|
|
82097
82193
|
if (!parsed.success) {
|
|
@@ -82187,6 +82283,12 @@ function connectLink(options) {
|
|
|
82187
82283
|
redialAfter(redialDelayMs(retry.attempt++), options.refreshCredential);
|
|
82188
82284
|
return;
|
|
82189
82285
|
}
|
|
82286
|
+
stop(failure7);
|
|
82287
|
+
redialAfter(
|
|
82288
|
+
credentialRetryDelayMs(retry.credentialFailures - MAX_CREDENTIAL_FAILURES),
|
|
82289
|
+
options.refreshCredential
|
|
82290
|
+
);
|
|
82291
|
+
return;
|
|
82190
82292
|
}
|
|
82191
82293
|
stop(failure7);
|
|
82192
82294
|
if (refusal2.code === "machine_disabled") redialAfter(DISABLED_RETRY_MS);
|
package/alan-holder.cjs
CHANGED
|
@@ -22001,7 +22001,8 @@ var init_github_proxy = __esm({
|
|
|
22001
22001
|
GITHUB_PROXY_REFUSAL_CODES = [
|
|
22002
22002
|
"host_not_proxied",
|
|
22003
22003
|
"machine_not_allowed",
|
|
22004
|
-
"github_not_connected"
|
|
22004
|
+
"github_not_connected",
|
|
22005
|
+
"github_installation_unavailable"
|
|
22005
22006
|
];
|
|
22006
22007
|
gitHubProxyErrorSchema = external_exports.object({
|
|
22007
22008
|
message: external_exports.string().min(1),
|
|
@@ -22257,7 +22258,7 @@ var init_cli_usage = __esm({
|
|
|
22257
22258
|
function isRunLifecycleKind(sessionUpdate2) {
|
|
22258
22259
|
return RUN_LIFECYCLE_KINDS.has(sessionUpdate2);
|
|
22259
22260
|
}
|
|
22260
|
-
var RUN_STEERS_MAX, runAcceptedUpdateSchema, runStartedUpdateSchema, runCodexRateLimitsUpdateSchema, runWorkspaceRelocatedUpdateSchema, runOutcomeSchema, runRejectionCodeSchema, runEndedUpdateSchema, runLifecycleUpdateSchema, RUN_LIFECYCLE_KINDS, runLogRecordSchema;
|
|
22261
|
+
var RUN_LOG_RECORD_SEPARATOR, RUN_STEERS_MAX, runAcceptedUpdateSchema, runStartedUpdateSchema, runCodexRateLimitsUpdateSchema, runWorkspaceRelocatedUpdateSchema, runOutcomeSchema, runRejectionCodeSchema, runEndedUpdateSchema, runLifecycleUpdateSchema, RUN_LIFECYCLE_KINDS, runLogRecordSchema;
|
|
22261
22262
|
var init_run_log = __esm({
|
|
22262
22263
|
"../shared/dist/runtime-v2/run-log.js"() {
|
|
22263
22264
|
"use strict";
|
|
@@ -22265,6 +22266,7 @@ var init_run_log = __esm({
|
|
|
22265
22266
|
init_problem();
|
|
22266
22267
|
init_cli_usage();
|
|
22267
22268
|
init_ids();
|
|
22269
|
+
RUN_LOG_RECORD_SEPARATOR = 10;
|
|
22268
22270
|
RUN_STEERS_MAX = 100;
|
|
22269
22271
|
runAcceptedUpdateSchema = external_exports.object({
|
|
22270
22272
|
sessionUpdate: external_exports.literal("_alan/run.accepted"),
|
|
@@ -23334,7 +23336,7 @@ function getAlanModePrompt(mode) {
|
|
|
23334
23336
|
function getAlanAgentPrompt(agentId) {
|
|
23335
23337
|
return getAgentSystemPrompt(agentId);
|
|
23336
23338
|
}
|
|
23337
|
-
var ALAN_CONTEXT_SEARCH_PROMPT, ALAN_PLATFORM_TOOL_ROUTING_PROMPT, ALAN_OPENUI_COMPONENT_SIGNATURES, ALAN_VISUAL_PROMPT, ALAN_VISUAL_REMINDER_PROMPT, ALAN_IDENTITY_PROMPT, ALAN_CODE_CONTEXT_PROMPT, PLAN_MODE_PROMPT, ASK_MODE_PROMPT, REVIEW_MODE_PROMPT;
|
|
23339
|
+
var ALAN_CONTEXT_SEARCH_PROMPT, ALAN_PLATFORM_TOOL_ROUTING_PROMPT, ALAN_OPENUI_COMPONENT_SIGNATURES, ALAN_VISUAL_PROMPT, ALAN_VISUAL_REMINDER_PROMPT, ALAN_SUGGESTING_WORK_PROMPT, ALAN_IDENTITY_PROMPT, ALAN_CODE_CONTEXT_PROMPT, PLAN_MODE_PROMPT, ASK_MODE_PROMPT, REVIEW_MODE_PROMPT;
|
|
23338
23340
|
var init_system_prompt = __esm({
|
|
23339
23341
|
"../shared/dist/agent/system-prompt.js"() {
|
|
23340
23342
|
"use strict";
|
|
@@ -23413,6 +23415,12 @@ ${ALAN_OPENUI_COMPONENT_SIGNATURES.map((signature) => ` ${signature}`).join("\n
|
|
|
23413
23415
|
ALAN_VISUAL_REMINDER_PROMPT = `## Answer format
|
|
23414
23416
|
|
|
23415
23417
|
Before replying in the Alan chat, consider what the user is trying to do and whether a visual would serve it better than paragraphs: comparisons, trends, statuses, timelines, plans and options go in a \`\`\`chart, \`\`\`mermaid or \`\`\`openui block even when nobody asked for one. Trivial answers stay plain text.`;
|
|
23418
|
+
ALAN_SUGGESTING_WORK_PROMPT = `## Suggesting Work
|
|
23419
|
+
|
|
23420
|
+
When \`suggest_task\` is available, use it to put work in the session's side panel for the user to pick up; it creates nothing by itself.
|
|
23421
|
+
- \`convert_session\`: suggest once when a chat that is not linked to a task has turned into multi-step delivery work (code changes, a PR, several turns). Give the title and description the task should have.
|
|
23422
|
+
- \`follow_up\`: suggest real, separate work you found and did not do, such as a bug, risky debt or a missing test. Never the next step of the current request or work you are about to do. Include \`handoffContext\` with what a fresh session needs: verified findings, files, decisions.
|
|
23423
|
+
- Prefer none. At most three in a turn, never a duplicate (check \`list_task_suggestions\`), and withdraw one that stops applying. Do not mention suggestions in your reply.`;
|
|
23416
23424
|
ALAN_IDENTITY_PROMPT = `You are Alan, the software factory agent. Alan ships software end to end \u2014 plan, write, review, test, deploy.
|
|
23417
23425
|
|
|
23418
23426
|
## How Alan is structured
|
|
@@ -23455,7 +23463,9 @@ When the user refers to a specific task, document, or epic by human identifier (
|
|
|
23455
23463
|
|
|
23456
23464
|
## Task Logging
|
|
23457
23465
|
|
|
23458
|
-
For non-trivial tasks, log high-signal events as they happen: decisions, changed assumptions, validation results, known-good IDs, blockers, risks, direction changes, and session outcomes. Do not log routine commands or file reads. Before stopping, ensure the Agent Log and current session outcome are enough for a human to understand progress and for another agent to resume. If a prior event or decision is stale, supersede it instead of appending contradictory state
|
|
23466
|
+
For non-trivial tasks, log high-signal events as they happen: decisions, changed assumptions, validation results, known-good IDs, blockers, risks, direction changes, and session outcomes. Do not log routine commands or file reads. Before stopping, ensure the Agent Log and current session outcome are enough for a human to understand progress and for another agent to resume. If a prior event or decision is stale, supersede it instead of appending contradictory state.
|
|
23467
|
+
|
|
23468
|
+
${ALAN_SUGGESTING_WORK_PROMPT}`;
|
|
23459
23469
|
ALAN_CODE_CONTEXT_PROMPT = buildAlanCodeContextPrompt();
|
|
23460
23470
|
PLAN_MODE_PROMPT = [
|
|
23461
23471
|
"You are in Alan plan mode.",
|
|
@@ -23805,6 +23815,17 @@ var init_models = __esm({
|
|
|
23805
23815
|
contextWindow: 1048576,
|
|
23806
23816
|
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
23807
23817
|
},
|
|
23818
|
+
{
|
|
23819
|
+
id: "particle-ai/particle-1",
|
|
23820
|
+
name: "Particle-1",
|
|
23821
|
+
description: "Particle AI's token-efficient coding model via Alan",
|
|
23822
|
+
enabled: true,
|
|
23823
|
+
isDefault: false,
|
|
23824
|
+
sortOrder: 25,
|
|
23825
|
+
upstreamModelId: "particle-ai/particle-1",
|
|
23826
|
+
contextWindow: 1048576,
|
|
23827
|
+
maxOutputTokens: HARNESS_MAX_OUTPUT_TOKENS
|
|
23828
|
+
},
|
|
23808
23829
|
{
|
|
23809
23830
|
id: "z-ai/glm-5.3",
|
|
23810
23831
|
name: "GLM 5.3",
|
|
@@ -37126,9 +37147,9 @@ var init_codex = __esm({
|
|
|
37126
37147
|
}
|
|
37127
37148
|
#usage(params) {
|
|
37128
37149
|
const usage = asRecord(params.tokenUsage);
|
|
37129
|
-
const
|
|
37130
|
-
if (!
|
|
37131
|
-
const last = appServerTokens(
|
|
37150
|
+
const lastRecord2 = asRecord(usage?.last);
|
|
37151
|
+
if (!lastRecord2) return [];
|
|
37152
|
+
const last = appServerTokens(lastRecord2);
|
|
37132
37153
|
const totalRecord = asRecord(usage?.total);
|
|
37133
37154
|
const total = totalRecord ? appServerTokens(totalRecord) : void 0;
|
|
37134
37155
|
this.#tokens.note(last, total, asFiniteNumber(usage?.modelContextWindow));
|
|
@@ -48453,8 +48474,8 @@ function readBody(incoming, url2, maxBytes) {
|
|
|
48453
48474
|
incoming.on("end", () => resolve8(Buffer.concat(chunks)));
|
|
48454
48475
|
});
|
|
48455
48476
|
}
|
|
48456
|
-
function
|
|
48457
|
-
return error62 instanceof Error && "code" in error62 && (error62.code === "ECONNRESET" || error62.code === "EPIPE");
|
|
48477
|
+
function isRetryableConnectionError(error62) {
|
|
48478
|
+
return error62 instanceof Error && "code" in error62 && (error62.code === "ECONNABORTED" || error62.code === "ECONNRESET" || error62.code === "EPIPE");
|
|
48458
48479
|
}
|
|
48459
48480
|
function exchange(request2, agents, attempt = 0) {
|
|
48460
48481
|
const { signal, url: url2 } = request2;
|
|
@@ -48482,7 +48503,7 @@ function exchange(request2, agents, attempt = 0) {
|
|
|
48482
48503
|
};
|
|
48483
48504
|
let responded = false;
|
|
48484
48505
|
const onError = (error62) => {
|
|
48485
|
-
const stale = outgoing.reusedSocket && !responded &&
|
|
48506
|
+
const stale = outgoing.reusedSocket && !responded && isRetryableConnectionError(error62);
|
|
48486
48507
|
if (stale && attempt < STALE_SOCKET_RETRIES && !signal.aborted) {
|
|
48487
48508
|
settle2();
|
|
48488
48509
|
resolve8(exchange(request2, agents, attempt + 1));
|
|
@@ -51699,9 +51720,24 @@ function tailWindows(size) {
|
|
|
51699
51720
|
if (length >= size || length > MAX_RUN_LOG_RECORD_BYTES) return windows;
|
|
51700
51721
|
}
|
|
51701
51722
|
}
|
|
51702
|
-
function
|
|
51703
|
-
|
|
51704
|
-
|
|
51723
|
+
function parseRecord(line) {
|
|
51724
|
+
try {
|
|
51725
|
+
const parsed = runLogRecordSchema.safeParse(JSON.parse(Buffer.from(line).toString("utf8")));
|
|
51726
|
+
return parsed.success ? parsed.data : null;
|
|
51727
|
+
} catch {
|
|
51728
|
+
return null;
|
|
51729
|
+
}
|
|
51730
|
+
}
|
|
51731
|
+
function lastRecord(window, wholeFile) {
|
|
51732
|
+
let end = window.lastIndexOf(RUN_LOG_RECORD_SEPARATOR) + 1;
|
|
51733
|
+
while (end > 0) {
|
|
51734
|
+
const start = end >= 2 ? window.lastIndexOf(RUN_LOG_RECORD_SEPARATOR, end - 2) + 1 : 0;
|
|
51735
|
+
if (start === 0 && !wholeFile) return void 0;
|
|
51736
|
+
const record2 = parseRecord(window.subarray(start, end - 1));
|
|
51737
|
+
if (record2 !== null) return { record: record2, end };
|
|
51738
|
+
end = start;
|
|
51739
|
+
}
|
|
51740
|
+
return wholeFile ? null : void 0;
|
|
51705
51741
|
}
|
|
51706
51742
|
|
|
51707
51743
|
// src/run-log/records.ts
|
|
@@ -51720,24 +51756,33 @@ var decoder = new TextDecoder();
|
|
|
51720
51756
|
var import_node_fs10 = require("fs");
|
|
51721
51757
|
var import_node_path28 = require("path");
|
|
51722
51758
|
init_runtime_v2();
|
|
51723
|
-
function
|
|
51759
|
+
function readTail(fd, size) {
|
|
51724
51760
|
for (const length of tailWindows(size)) {
|
|
51725
51761
|
const buffer = Buffer.alloc(length);
|
|
51726
51762
|
(0, import_node_fs10.readSync)(fd, buffer, 0, length, size - length);
|
|
51727
|
-
const last =
|
|
51763
|
+
const last = lastRecord(buffer, length === size);
|
|
51728
51764
|
if (last === void 0) continue;
|
|
51729
|
-
if (last
|
|
51730
|
-
|
|
51731
|
-
if (!parsed.success) throw new RuntimeFault("invalid_file", "Run log tail is not a record");
|
|
51732
|
-
return parsed.data.seq;
|
|
51765
|
+
if (last === null) return { seq: 0, end: 0 };
|
|
51766
|
+
return { seq: last.record.seq, end: size - length + last.end };
|
|
51733
51767
|
}
|
|
51734
51768
|
throw new RuntimeFault("record_too_large", "Run log tail record is larger than any record");
|
|
51735
51769
|
}
|
|
51770
|
+
function writeAt(fd, bytes, position) {
|
|
51771
|
+
for (let written = 0; written < bytes.length; ) {
|
|
51772
|
+
written += (0, import_node_fs10.writeSync)(fd, bytes, written, bytes.length - written, position + written);
|
|
51773
|
+
}
|
|
51774
|
+
}
|
|
51736
51775
|
function openRunLog(path, clock) {
|
|
51737
51776
|
(0, import_node_fs10.mkdirSync)((0, import_node_path28.dirname)(path), { recursive: true, mode: 448 });
|
|
51738
|
-
const fd = (0, import_node_fs10.openSync)(path,
|
|
51739
|
-
|
|
51740
|
-
|
|
51777
|
+
const fd = (0, import_node_fs10.openSync)(path, import_node_fs10.constants.O_RDWR | import_node_fs10.constants.O_CREAT, 384);
|
|
51778
|
+
const fileSize = (0, import_node_fs10.fstatSync)(fd).size;
|
|
51779
|
+
const tail = readTail(fd, fileSize);
|
|
51780
|
+
let size = tail.end;
|
|
51781
|
+
let seq = tail.seq;
|
|
51782
|
+
if (fileSize > size) {
|
|
51783
|
+
(0, import_node_fs10.ftruncateSync)(fd, size);
|
|
51784
|
+
(0, import_node_fs10.fsyncSync)(fd);
|
|
51785
|
+
}
|
|
51741
51786
|
let dirty = false;
|
|
51742
51787
|
const sync = () => {
|
|
51743
51788
|
(0, import_node_fs10.fsyncSync)(fd);
|
|
@@ -51745,16 +51790,21 @@ function openRunLog(path, clock) {
|
|
|
51745
51790
|
};
|
|
51746
51791
|
return {
|
|
51747
51792
|
append: (update, sessionId) => {
|
|
51748
|
-
seq += 1;
|
|
51749
51793
|
const record2 = {
|
|
51750
|
-
seq,
|
|
51794
|
+
seq: seq + 1,
|
|
51751
51795
|
at: clock.now(),
|
|
51752
51796
|
...sessionId === void 0 ? {} : { sessionId },
|
|
51753
51797
|
update
|
|
51754
51798
|
};
|
|
51755
51799
|
const line = Buffer.from(`${JSON.stringify(record2)}
|
|
51756
51800
|
`, "utf8");
|
|
51757
|
-
|
|
51801
|
+
try {
|
|
51802
|
+
writeAt(fd, line, size);
|
|
51803
|
+
} catch (error62) {
|
|
51804
|
+
(0, import_node_fs10.ftruncateSync)(fd, size);
|
|
51805
|
+
throw error62;
|
|
51806
|
+
}
|
|
51807
|
+
seq = record2.seq;
|
|
51758
51808
|
size += line.length;
|
|
51759
51809
|
dirty = true;
|
|
51760
51810
|
if (isRunLifecycleKind(update.sessionUpdate)) sync();
|
|
@@ -51900,16 +51950,58 @@ async function claimRun(spec, context) {
|
|
|
51900
51950
|
}
|
|
51901
51951
|
return log;
|
|
51902
51952
|
}
|
|
51953
|
+
var RUN_END_RETRY_MS = 5e3;
|
|
51954
|
+
var RUN_END_DEADLINE_MS = 10 * 6e4;
|
|
51903
51955
|
async function runClaimedTurn(spec, claimed, context, signal) {
|
|
51904
51956
|
var _stack = [];
|
|
51905
51957
|
try {
|
|
51906
51958
|
const log = __using(_stack, claimed);
|
|
51907
51959
|
const reported = { error: false };
|
|
51960
|
+
const writeFailed = new AbortController();
|
|
51961
|
+
let writeError;
|
|
51908
51962
|
const append = (update, sessionId) => {
|
|
51963
|
+
if (writeError !== void 0) return;
|
|
51909
51964
|
if (update.sessionUpdate === "notice" && update.severity === "error") reported.error = true;
|
|
51910
|
-
|
|
51965
|
+
let offset;
|
|
51966
|
+
try {
|
|
51967
|
+
offset = log.append(update, sessionId);
|
|
51968
|
+
} catch (error62) {
|
|
51969
|
+
writeError = error62;
|
|
51970
|
+
context.log.error("holder.run_log_write_failed", { runId: spec.runId, error: error62 });
|
|
51971
|
+
writeFailed.abort();
|
|
51972
|
+
return;
|
|
51973
|
+
}
|
|
51911
51974
|
context.onAppended(spec.runId, offset);
|
|
51912
51975
|
};
|
|
51976
|
+
const endRun = async (updates2) => {
|
|
51977
|
+
const deadline = context.clock.monotonic() + RUN_END_DEADLINE_MS;
|
|
51978
|
+
for (const update of updates2) {
|
|
51979
|
+
for (; ; ) {
|
|
51980
|
+
let offset;
|
|
51981
|
+
try {
|
|
51982
|
+
offset = log.append(update);
|
|
51983
|
+
} catch (error62) {
|
|
51984
|
+
context.log.warn("holder.run_end_write_failed", { runId: spec.runId, error: error62 });
|
|
51985
|
+
if (context.clock.monotonic() >= deadline) {
|
|
51986
|
+
throw new RuntimeFault("io_failed", `Run ${spec.runId} could not be ended`, {
|
|
51987
|
+
cause: error62
|
|
51988
|
+
});
|
|
51989
|
+
}
|
|
51990
|
+
await context.clock.sleep(RUN_END_RETRY_MS, new AbortController().signal);
|
|
51991
|
+
continue;
|
|
51992
|
+
}
|
|
51993
|
+
context.onAppended(spec.runId, offset);
|
|
51994
|
+
break;
|
|
51995
|
+
}
|
|
51996
|
+
}
|
|
51997
|
+
};
|
|
51998
|
+
const fail = async (message) => {
|
|
51999
|
+
await endRun([
|
|
52000
|
+
noticeUpdate("error", "run_failed", message),
|
|
52001
|
+
runEnded({ outcome: "failed", message })
|
|
52002
|
+
]);
|
|
52003
|
+
return "failed";
|
|
52004
|
+
};
|
|
51913
52005
|
let result;
|
|
51914
52006
|
try {
|
|
51915
52007
|
result = await admitAndRun(
|
|
@@ -51920,20 +52012,22 @@ async function runClaimedTurn(spec, claimed, context, signal) {
|
|
|
51920
52012
|
// Base64 media in provider payloads and tool output never reaches the log (main 13590db369).
|
|
51921
52013
|
onEvent: (event) => append(fitForRunLog(withoutInlineMedia(event.update)), event.sessionId)
|
|
51922
52014
|
},
|
|
51923
|
-
signal
|
|
52015
|
+
AbortSignal.any([signal, writeFailed.signal])
|
|
51924
52016
|
);
|
|
51925
52017
|
} catch (error62) {
|
|
51926
|
-
const message = error62 instanceof Error ? error62.message : String(error62);
|
|
51927
52018
|
context.log.error("holder.turn_threw", { runId: spec.runId, error: error62 });
|
|
51928
|
-
|
|
51929
|
-
|
|
51930
|
-
|
|
52019
|
+
return await fail(error62 instanceof Error ? error62.message : String(error62));
|
|
52020
|
+
}
|
|
52021
|
+
if (writeError !== void 0) {
|
|
52022
|
+
const reason = writeError instanceof Error ? writeError.message : String(writeError);
|
|
52023
|
+
return await fail(`This run's log could not be written: ${reason}`);
|
|
51931
52024
|
}
|
|
51932
52025
|
const outcome2 = result.outcome === "aborted" && signal.reason === "interrupted" ? "interrupted" : result.outcome;
|
|
52026
|
+
const updates = [];
|
|
51933
52027
|
if (outcome2 === "failed" && !reported.error && result.message !== void 0) {
|
|
51934
|
-
|
|
52028
|
+
updates.push(noticeUpdate("error", "run_failed", result.message));
|
|
51935
52029
|
}
|
|
51936
|
-
|
|
52030
|
+
updates.push(
|
|
51937
52031
|
runEnded({
|
|
51938
52032
|
outcome: outcome2,
|
|
51939
52033
|
...result.providerSessionId === void 0 ? {} : { providerSessionId: result.providerSessionId },
|
|
@@ -51943,6 +52037,7 @@ async function runClaimedTurn(spec, claimed, context, signal) {
|
|
|
51943
52037
|
...result.unansweredSteerIds === void 0 ? {} : { unansweredSteerIds: [...result.unansweredSteerIds] }
|
|
51944
52038
|
})
|
|
51945
52039
|
);
|
|
52040
|
+
await endRun(updates);
|
|
51946
52041
|
context.log.info("holder.turn_ended", { runId: spec.runId, outcome: outcome2 });
|
|
51947
52042
|
return outcome2;
|
|
51948
52043
|
} catch (_) {
|
package/alan-lease.cjs
CHANGED
|
@@ -21867,7 +21867,8 @@ var init_github_proxy = __esm({
|
|
|
21867
21867
|
GITHUB_PROXY_REFUSAL_CODES = [
|
|
21868
21868
|
"host_not_proxied",
|
|
21869
21869
|
"machine_not_allowed",
|
|
21870
|
-
"github_not_connected"
|
|
21870
|
+
"github_not_connected",
|
|
21871
|
+
"github_installation_unavailable"
|
|
21871
21872
|
];
|
|
21872
21873
|
gitHubProxyErrorSchema = external_exports.object({
|
|
21873
21874
|
message: external_exports.string().min(1),
|
|
@@ -22748,8 +22749,8 @@ function readBody(incoming, url2, maxBytes) {
|
|
|
22748
22749
|
incoming.on("end", () => resolve(Buffer.concat(chunks)));
|
|
22749
22750
|
});
|
|
22750
22751
|
}
|
|
22751
|
-
function
|
|
22752
|
-
return error62 instanceof Error && "code" in error62 && (error62.code === "ECONNRESET" || error62.code === "EPIPE");
|
|
22752
|
+
function isRetryableConnectionError(error62) {
|
|
22753
|
+
return error62 instanceof Error && "code" in error62 && (error62.code === "ECONNABORTED" || error62.code === "ECONNRESET" || error62.code === "EPIPE");
|
|
22753
22754
|
}
|
|
22754
22755
|
function exchange(request, agents, attempt = 0) {
|
|
22755
22756
|
const { signal, url: url2 } = request;
|
|
@@ -22777,7 +22778,7 @@ function exchange(request, agents, attempt = 0) {
|
|
|
22777
22778
|
};
|
|
22778
22779
|
let responded = false;
|
|
22779
22780
|
const onError = (error62) => {
|
|
22780
|
-
const stale = outgoing.reusedSocket && !responded &&
|
|
22781
|
+
const stale = outgoing.reusedSocket && !responded && isRetryableConnectionError(error62);
|
|
22781
22782
|
if (stale && attempt < STALE_SOCKET_RETRIES && !signal.aborted) {
|
|
22782
22783
|
settle2();
|
|
22783
22784
|
resolve(exchange(request, agents, attempt + 1));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alan-ai-hq/agent-manager-darwin-arm64",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.173",
|
|
4
4
|
"description": "Alan machine runtime (alan-agent) for one platform: the official Node.js binary, the runtime bundle and its launcher. Installed by @alan-ai-hq/agent-manager.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"homepage": "https://tryalan.ai",
|