@alan-ai-hq/agent-manager-linux-arm64 0.1.144 → 0.1.146
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 +859 -516
- package/alan-holder.cjs +283 -93
- package/package.json +7 -2
package/alan-holder.cjs
CHANGED
|
@@ -20506,7 +20506,9 @@ var init_machine_identity = __esm({
|
|
|
20506
20506
|
runCodexCredentialSchema = external_exports.object({
|
|
20507
20507
|
accessToken: external_exports.string().min(1),
|
|
20508
20508
|
chatgptAccountId: external_exports.string().min(1),
|
|
20509
|
-
chatgptPlanType: external_exports.string().nullable()
|
|
20509
|
+
chatgptPlanType: external_exports.string().nullable(),
|
|
20510
|
+
credentialId: external_exports.uuid().optional(),
|
|
20511
|
+
providerUserId: external_exports.string().min(1).optional()
|
|
20510
20512
|
});
|
|
20511
20513
|
runCodexCredentialRefreshRequestSchema = external_exports.object({
|
|
20512
20514
|
/** sha256 hex of the access token Codex was refused with; a newer stored token is returned instead of rotating. */
|
|
@@ -20515,7 +20517,7 @@ var init_machine_identity = __esm({
|
|
|
20515
20517
|
runProviderCredentialSchema = external_exports.object({
|
|
20516
20518
|
/** Environment variables for the agent CLI, e.g. ANTHROPIC_API_KEY; empty when the CLI's own login is used. */
|
|
20517
20519
|
env: external_exports.record(external_exports.string(), external_exports.string()),
|
|
20518
|
-
/** The
|
|
20520
|
+
/** The bound Codex login for a cloud sandbox; absent where the CLI's own login is used. */
|
|
20519
20521
|
codex: runCodexCredentialSchema.optional()
|
|
20520
20522
|
});
|
|
20521
20523
|
}
|
|
@@ -20930,16 +20932,50 @@ var init_problem = __esm({
|
|
|
20930
20932
|
}
|
|
20931
20933
|
});
|
|
20932
20934
|
|
|
20935
|
+
// ../shared/dist/cli-usage.js
|
|
20936
|
+
var usagePercentSchema, usageTimestampSchema, cliUsageWindowPatchSchema, cliUsageWindowSchema, cliUsageBucketSchema, cliUsageSnapshotSchema;
|
|
20937
|
+
var init_cli_usage = __esm({
|
|
20938
|
+
"../shared/dist/cli-usage.js"() {
|
|
20939
|
+
"use strict";
|
|
20940
|
+
init_zod();
|
|
20941
|
+
usagePercentSchema = external_exports.number().min(0).max(100);
|
|
20942
|
+
usageTimestampSchema = external_exports.iso.datetime();
|
|
20943
|
+
cliUsageWindowPatchSchema = external_exports.object({
|
|
20944
|
+
usedPercent: usagePercentSchema.nullable().optional(),
|
|
20945
|
+
windowMinutes: external_exports.number().positive().nullable().optional(),
|
|
20946
|
+
resetsAt: usageTimestampSchema.nullable().optional()
|
|
20947
|
+
});
|
|
20948
|
+
cliUsageWindowSchema = external_exports.object({
|
|
20949
|
+
usedPercent: usagePercentSchema.optional(),
|
|
20950
|
+
windowMinutes: external_exports.number().positive().optional(),
|
|
20951
|
+
resetsAt: usageTimestampSchema.optional(),
|
|
20952
|
+
observedAt: usageTimestampSchema,
|
|
20953
|
+
receivedAt: usageTimestampSchema,
|
|
20954
|
+
sourceId: external_exports.string().min(1),
|
|
20955
|
+
sequence: external_exports.number().int().nonnegative()
|
|
20956
|
+
});
|
|
20957
|
+
cliUsageBucketSchema = external_exports.object({
|
|
20958
|
+
primary: cliUsageWindowSchema.optional(),
|
|
20959
|
+
secondary: cliUsageWindowSchema.optional(),
|
|
20960
|
+
planType: external_exports.string().min(1).nullable().optional()
|
|
20961
|
+
});
|
|
20962
|
+
cliUsageSnapshotSchema = external_exports.object({
|
|
20963
|
+
buckets: external_exports.record(external_exports.string().min(1), cliUsageBucketSchema)
|
|
20964
|
+
});
|
|
20965
|
+
}
|
|
20966
|
+
});
|
|
20967
|
+
|
|
20933
20968
|
// ../shared/dist/runtime-v2/run-log.js
|
|
20934
20969
|
function isRunLifecycleKind(sessionUpdate) {
|
|
20935
20970
|
return RUN_LIFECYCLE_KINDS.has(sessionUpdate);
|
|
20936
20971
|
}
|
|
20937
|
-
var runAcceptedUpdateSchema, runStartedUpdateSchema, runWorkspaceRelocatedUpdateSchema, runOutcomeSchema, runRejectionCodeSchema, runEndedUpdateSchema, runLifecycleUpdateSchema, RUN_LIFECYCLE_KINDS, runLogRecordSchema;
|
|
20972
|
+
var runAcceptedUpdateSchema, runStartedUpdateSchema, runCodexRateLimitsUpdateSchema, runWorkspaceRelocatedUpdateSchema, runOutcomeSchema, runRejectionCodeSchema, runEndedUpdateSchema, runLifecycleUpdateSchema, RUN_LIFECYCLE_KINDS, runLogRecordSchema;
|
|
20938
20973
|
var init_run_log = __esm({
|
|
20939
20974
|
"../shared/dist/runtime-v2/run-log.js"() {
|
|
20940
20975
|
"use strict";
|
|
20941
20976
|
init_zod();
|
|
20942
20977
|
init_problem();
|
|
20978
|
+
init_cli_usage();
|
|
20943
20979
|
init_ids();
|
|
20944
20980
|
runAcceptedUpdateSchema = external_exports.object({
|
|
20945
20981
|
sessionUpdate: external_exports.literal("_alan/run.accepted"),
|
|
@@ -20951,6 +20987,16 @@ var init_run_log = __esm({
|
|
|
20951
20987
|
providerSessionId: external_exports.string().min(1).optional(),
|
|
20952
20988
|
pid: external_exports.number().int().positive().optional()
|
|
20953
20989
|
});
|
|
20990
|
+
runCodexRateLimitsUpdateSchema = external_exports.object({
|
|
20991
|
+
sessionUpdate: external_exports.literal("_alan/codex.rate_limits"),
|
|
20992
|
+
limitId: external_exports.string().min(1),
|
|
20993
|
+
primary: cliUsageWindowPatchSchema.nullable().optional(),
|
|
20994
|
+
secondary: cliUsageWindowPatchSchema.nullable().optional(),
|
|
20995
|
+
planType: external_exports.string().min(1).nullable().optional(),
|
|
20996
|
+
observedAt: external_exports.iso.datetime(),
|
|
20997
|
+
sourceId: external_exports.string().min(1),
|
|
20998
|
+
sequence: external_exports.number().int().nonnegative()
|
|
20999
|
+
});
|
|
20954
21000
|
runWorkspaceRelocatedUpdateSchema = external_exports.object({
|
|
20955
21001
|
sessionUpdate: external_exports.literal("_alan/run.workspace_relocated"),
|
|
20956
21002
|
previousPath: external_exports.string().min(1).max(4096),
|
|
@@ -21013,7 +21059,7 @@ var init_holder_protocol = __esm({
|
|
|
21013
21059
|
init_ids();
|
|
21014
21060
|
init_link();
|
|
21015
21061
|
init_run_log();
|
|
21016
|
-
HOLDER_PROTOCOL =
|
|
21062
|
+
HOLDER_PROTOCOL = 2;
|
|
21017
21063
|
holderAbortOutcomeSchema = external_exports.enum(["aborted", "interrupted"]);
|
|
21018
21064
|
holderRequestSchema = external_exports.discriminatedUnion("type", [
|
|
21019
21065
|
external_exports.object({ type: external_exports.literal("auth"), token: external_exports.string().min(1) }),
|
|
@@ -23663,6 +23709,13 @@ var init_notice_visibility = __esm({
|
|
|
23663
23709
|
}
|
|
23664
23710
|
});
|
|
23665
23711
|
|
|
23712
|
+
// ../shared/dist/agent/acp/presentation/turn-artifacts.js
|
|
23713
|
+
var init_turn_artifacts = __esm({
|
|
23714
|
+
"../shared/dist/agent/acp/presentation/turn-artifacts.js"() {
|
|
23715
|
+
"use strict";
|
|
23716
|
+
}
|
|
23717
|
+
});
|
|
23718
|
+
|
|
23666
23719
|
// ../shared/dist/agent/acp/presentation/prepare-conversation-turns.js
|
|
23667
23720
|
var init_prepare_conversation_turns = __esm({
|
|
23668
23721
|
"../shared/dist/agent/acp/presentation/prepare-conversation-turns.js"() {
|
|
@@ -23753,6 +23806,7 @@ var init_acp = __esm({
|
|
|
23753
23806
|
init_notice_visibility();
|
|
23754
23807
|
init_prepare_conversation_turns();
|
|
23755
23808
|
init_terminal_events();
|
|
23809
|
+
init_turn_artifacts();
|
|
23756
23810
|
init_types3();
|
|
23757
23811
|
init_read();
|
|
23758
23812
|
init_reduce();
|
|
@@ -24133,7 +24187,18 @@ var init_chunk_SBT5W7L4 = __esm({
|
|
|
24133
24187
|
}
|
|
24134
24188
|
});
|
|
24135
24189
|
|
|
24136
|
-
// ../agent-core/dist/chunk-
|
|
24190
|
+
// ../agent-core/dist/chunk-HBIPWAUI.js
|
|
24191
|
+
function readCapReset(text2) {
|
|
24192
|
+
const epoch = EPOCH_RESET.exec(text2);
|
|
24193
|
+
if (epoch) return { resetsAt: new Date(Number(epoch[1]) * 1e3).toISOString() };
|
|
24194
|
+
const codex = CODEX_RESET.exec(text2);
|
|
24195
|
+
if (codex) {
|
|
24196
|
+
const milliseconds = Date.parse(codex[1].replace(/(\d)(?:st|nd|rd|th)\b/gi, "$1"));
|
|
24197
|
+
if (Number.isFinite(milliseconds)) return { resetsAt: new Date(milliseconds).toISOString() };
|
|
24198
|
+
}
|
|
24199
|
+
const worded = WORDED_RESET.exec(text2);
|
|
24200
|
+
return worded ? { resetHint: worded[1].trim() } : {};
|
|
24201
|
+
}
|
|
24137
24202
|
function specForErrorKind(errorKind) {
|
|
24138
24203
|
const spec = ERROR_SPECS[errorKind];
|
|
24139
24204
|
return { message: spec.message, errorKind, recoveryClass: spec.recoveryClass };
|
|
@@ -24194,15 +24259,6 @@ function normalizeCodexCliErrorMessage(message) {
|
|
|
24194
24259
|
}
|
|
24195
24260
|
return message;
|
|
24196
24261
|
}
|
|
24197
|
-
function readCapReset(text2) {
|
|
24198
|
-
const epoch = EPOCH_RESET.exec(text2);
|
|
24199
|
-
if (epoch) {
|
|
24200
|
-
const seconds = Number(epoch[1]);
|
|
24201
|
-
return { resetsAt: new Date(seconds * 1e3).toISOString() };
|
|
24202
|
-
}
|
|
24203
|
-
const worded = WORDED_RESET.exec(text2);
|
|
24204
|
-
return worded ? { resetHint: worded[1].trim() } : {};
|
|
24205
|
-
}
|
|
24206
24262
|
function lineMatching(text2, pattern) {
|
|
24207
24263
|
return text2.split("\n").map((line) => line.trim()).find((line) => pattern.test(line));
|
|
24208
24264
|
}
|
|
@@ -24214,10 +24270,11 @@ function withCapReset(classified, text2) {
|
|
|
24214
24270
|
if (classified.errorKind !== "usage_limit") return classified;
|
|
24215
24271
|
const reset = readCapReset(text2);
|
|
24216
24272
|
if (reset.resetsAt) {
|
|
24273
|
+
const own22 = lineMatching(text2, /\btry again at\b/i);
|
|
24217
24274
|
return {
|
|
24218
24275
|
...classified,
|
|
24219
24276
|
...reset,
|
|
24220
|
-
message: `Provider usage limit reached. It resets at ${reset.resetsAt}; switch model or wait, then retry.`
|
|
24277
|
+
message: own22 ?? `Provider usage limit reached. It resets at ${reset.resetsAt}; switch model or wait, then retry.`
|
|
24221
24278
|
};
|
|
24222
24279
|
}
|
|
24223
24280
|
const own2 = lineMatching(text2, /usage limit/i);
|
|
@@ -24336,13 +24393,16 @@ function createCliProblem(observed, options) {
|
|
|
24336
24393
|
...classified.resetsAt ? { resetsAt: classified.resetsAt } : {}
|
|
24337
24394
|
});
|
|
24338
24395
|
}
|
|
24339
|
-
var import_crypto2, ERROR_SPECS, AGENT_ERROR_KINDS, AGENT_SIGN_IN_BY_HARNESS, STATUS_PREFIX, TEXT_RULES, CODEX_TIMEOUT_MESSAGE, CODEX_EXPIRED_MESSAGE,
|
|
24340
|
-
var
|
|
24341
|
-
"../agent-core/dist/chunk-
|
|
24396
|
+
var import_crypto2, EPOCH_RESET, WORDED_RESET, CODEX_RESET, ERROR_SPECS, AGENT_ERROR_KINDS, AGENT_SIGN_IN_BY_HARNESS, STATUS_PREFIX, TEXT_RULES, CODEX_TIMEOUT_MESSAGE, CODEX_EXPIRED_MESSAGE, COMMAND_NOT_FOUND, CODE_RULES, TEXT_REFINES, STATUS_LEAD, CLI_PROBLEM_CODE_BY_ERROR_KIND, KEY_REJECTION_KINDS;
|
|
24397
|
+
var init_chunk_HBIPWAUI = __esm({
|
|
24398
|
+
"../agent-core/dist/chunk-HBIPWAUI.js"() {
|
|
24342
24399
|
"use strict";
|
|
24343
24400
|
init_chunk_YXWJW7I5();
|
|
24344
24401
|
import_crypto2 = require("crypto");
|
|
24345
24402
|
init_agent2();
|
|
24403
|
+
EPOCH_RESET = /\|\s*(\d{10})\b/;
|
|
24404
|
+
WORDED_RESET = /\bresets?\s+(?:at\s+)?([^.\n]{1,60}?)\s*(?:$|[.\n])/i;
|
|
24405
|
+
CODEX_RESET = /\btry again at\s+([A-Za-z]{3,9}\s+\d{1,2}(?:st|nd|rd|th)?,?\s+\d{4}\s+\d{1,2}:\d{2}\s*[AP]M(?:\s+(?:UTC|GMT)(?:[+-]\d{1,2}(?::?\d{2})?)?)?)/i;
|
|
24346
24406
|
ERROR_SPECS = {
|
|
24347
24407
|
model_mismatch: {
|
|
24348
24408
|
message: "The selected model isn't available, or you don't have access to it. Pick a different model, then send your message again.",
|
|
@@ -24496,7 +24556,7 @@ var init_chunk_54ZRJOQP = __esm({
|
|
|
24496
24556
|
// #44604), or a trailing assistant message (opencode #19517).
|
|
24497
24557
|
{
|
|
24498
24558
|
kind: "history_rejected",
|
|
24499
|
-
pattern: /\btext content blocks must be non-empty\b|\bcontent field in the message object\b|\bids were found without `?tool_result`? blocks\b|\bunexpected `?tool_use_id`?|\btool use concurrency issues\b|\bno tool output found for\b|\bdoes not support assistant message prefill\b/
|
|
24559
|
+
pattern: /\btext content blocks must be non-empty\b|\bcontent field in the message object\b|\bids were found without `?tool_result`? blocks\b|\bunexpected `?tool_use_id`?|\btool use concurrency issues\b|\bno tool output found for\b|\bdoes not support assistant message prefill\b|\binvalid_encrypted_content\b|organization_id did not match the target organization/
|
|
24500
24560
|
},
|
|
24501
24561
|
// Claude: "No conversation found with session ID"; Codex: "no rollout found for thread id";
|
|
24502
24562
|
// Copilot: "No session, task, or name matched"; Kimi/Cursor ACP: `Session "<id>" not found`.
|
|
@@ -24545,8 +24605,6 @@ var init_chunk_54ZRJOQP = __esm({
|
|
|
24545
24605
|
];
|
|
24546
24606
|
CODEX_TIMEOUT_MESSAGE = "Codex connection to OpenAI timed out while waiting for the turn to continue. Retry the message; if it repeats, check network/API latency or reduce slow MCP/tool calls in the turn.";
|
|
24547
24607
|
CODEX_EXPIRED_MESSAGE = "Codex CLI connection expired. Re-authenticate the Codex CLI on this computer (run `codex login`) or reconnect it in Cloud settings, then retry.";
|
|
24548
|
-
EPOCH_RESET = /\|\s*(\d{10})\b/;
|
|
24549
|
-
WORDED_RESET = /\bresets?\s+(?:at\s+)?([^.\n]{1,60}?)\s*(?:$|[.\n])/i;
|
|
24550
24608
|
COMMAND_NOT_FOUND = /\bcommand not found\b|\bno such file or directory\b/i;
|
|
24551
24609
|
CODE_RULES = [
|
|
24552
24610
|
{ pattern: /model_not_found|model_not_available/, kind: "model_mismatch" },
|
|
@@ -24601,7 +24659,21 @@ var init_chunk_54ZRJOQP = __esm({
|
|
|
24601
24659
|
}
|
|
24602
24660
|
});
|
|
24603
24661
|
|
|
24604
|
-
// ../agent-core/dist/chunk-
|
|
24662
|
+
// ../agent-core/dist/chunk-4G77APXN.js
|
|
24663
|
+
function detectImageMimeType(buffer) {
|
|
24664
|
+
if (buffer.length >= 8 && buffer.subarray(0, 8).equals(PNG_SIGNATURE)) return "image/png";
|
|
24665
|
+
if (buffer.length >= 3 && buffer[0] === 255 && buffer[1] === 216 && buffer[2] === 255) {
|
|
24666
|
+
return "image/jpeg";
|
|
24667
|
+
}
|
|
24668
|
+
if (buffer.length >= 6) {
|
|
24669
|
+
const signature = buffer.subarray(0, 6).toString("ascii");
|
|
24670
|
+
if (signature === "GIF87a" || signature === "GIF89a") return "image/gif";
|
|
24671
|
+
}
|
|
24672
|
+
if (buffer.length >= 12 && buffer.subarray(0, 4).toString("ascii") === "RIFF" && buffer.subarray(8, 12).toString("ascii") === "WEBP") {
|
|
24673
|
+
return "image/webp";
|
|
24674
|
+
}
|
|
24675
|
+
return null;
|
|
24676
|
+
}
|
|
24605
24677
|
function collectStrings(value, out) {
|
|
24606
24678
|
if (typeof value === "string") out.push(value);
|
|
24607
24679
|
else if (Array.isArray(value)) for (const item of value) collectStrings(item, out);
|
|
@@ -24970,12 +25042,12 @@ function silentStartError(name, timeoutMs) {
|
|
|
24970
25042
|
message: `${name} printed nothing for ${seconds}s after it started and was stopped. Send your message again.`
|
|
24971
25043
|
};
|
|
24972
25044
|
}
|
|
24973
|
-
var import_crypto3, import_fs4, import_path3, IMAGE_MIME_BY_EXT, VIDEO_MIME_BY_EXT, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, MAX_IMAGE_BYTES, MAX_VIDEO_BYTES, AGENT_BROWSER_MENTION, LocalMediaReader, SessionOpenRefusal, JsonRpcError, ACP_PROTOCOL_VERSION, ACP_ERROR, STDERR_TAIL_LINES, RESULT_EXIT_GRACE_MS, PerTurnSession;
|
|
24974
|
-
var
|
|
24975
|
-
"../agent-core/dist/chunk-
|
|
25045
|
+
var import_crypto3, import_fs4, import_path3, PNG_SIGNATURE, IMAGE_MIME_BY_EXT, VIDEO_MIME_BY_EXT, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, MAX_IMAGE_BYTES, MAX_VIDEO_BYTES, AGENT_BROWSER_MENTION, LocalMediaReader, SessionOpenRefusal, JsonRpcError, ACP_PROTOCOL_VERSION, ACP_ERROR, STDERR_TAIL_LINES, RESULT_EXIT_GRACE_MS, PerTurnSession;
|
|
25046
|
+
var init_chunk_4G77APXN = __esm({
|
|
25047
|
+
"../agent-core/dist/chunk-4G77APXN.js"() {
|
|
24976
25048
|
"use strict";
|
|
24977
25049
|
init_chunk_XC5676SG();
|
|
24978
|
-
|
|
25050
|
+
init_chunk_HBIPWAUI();
|
|
24979
25051
|
init_chunk_M6YHY2EZ();
|
|
24980
25052
|
init_chunk_YXWJW7I5();
|
|
24981
25053
|
import_crypto3 = require("crypto");
|
|
@@ -24983,6 +25055,7 @@ var init_chunk_VMGVHPBB = __esm({
|
|
|
24983
25055
|
import_path3 = require("path");
|
|
24984
25056
|
init_agent2();
|
|
24985
25057
|
init_acp();
|
|
25058
|
+
PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
24986
25059
|
IMAGE_MIME_BY_EXT = {
|
|
24987
25060
|
".gif": "image/gif",
|
|
24988
25061
|
".jpeg": "image/jpeg",
|
|
@@ -25438,7 +25511,7 @@ var init_chunk_J2KTV5FP = __esm({
|
|
|
25438
25511
|
}
|
|
25439
25512
|
});
|
|
25440
25513
|
|
|
25441
|
-
// ../agent-core/dist/chunk-
|
|
25514
|
+
// ../agent-core/dist/chunk-FPGAN4XO.js
|
|
25442
25515
|
function truncate(value, limit) {
|
|
25443
25516
|
const normalized2 = Array.from(value, (character) => {
|
|
25444
25517
|
const code = character.charCodeAt(0);
|
|
@@ -25701,7 +25774,7 @@ function cloudExecutionSection(spec) {
|
|
|
25701
25774
|
);
|
|
25702
25775
|
if (!isReadOnlyMode(spec.mode) && !isReadOnlyAgent(spec.agentId)) {
|
|
25703
25776
|
lines.push(
|
|
25704
|
-
"Own the authorized work end to end: inspect context, make reasonable assumptions, implement, test, review and create or update the pull request for code changes when the repository workflow calls for one. Do not stop at a plan or ask for routine implementation choices or permission already granted. Ask only for a missing secret, an essential decision you cannot derive, or an action requiring explicit approval. Respect the user's scope, repository rules and tool authorization; report
|
|
25777
|
+
"Own the authorized work end to end: inspect context, make reasonable assumptions, implement, test, review and create or update the pull request for code changes when the repository workflow calls for one. Do not stop at a plan or ask for routine implementation choices or permission already granted. For application changes, check the repository's setup instructions and configured start commands, start the app if needed, and verify it is reachable before testing. For user-facing flows, use alan-test-feature when installed to test the running app, capture a video, and create a test report. Ask only for a missing secret, an essential decision you cannot derive, or an action requiring explicit approval. Respect the user's scope, repository rules and tool authorization; report blocked capabilities and validation gaps while continuing independent work."
|
|
25705
25778
|
);
|
|
25706
25779
|
}
|
|
25707
25780
|
const skills = spec.promptContext?.availableSkills ?? [];
|
|
@@ -25799,8 +25872,8 @@ ${body}` : body;
|
|
|
25799
25872
|
return spec.mode === "plan" ? planModePrefix(prefixed) : prefixed;
|
|
25800
25873
|
}
|
|
25801
25874
|
var MAX_PARSED_ATTACHMENTS, MAX_PARSED_ATTACHMENT_CHARS, MAX_METADATA_CHARS, UNAVAILABLE, READ_ONLY_MODES, AGENT_MODES;
|
|
25802
|
-
var
|
|
25803
|
-
"../agent-core/dist/chunk-
|
|
25875
|
+
var init_chunk_FPGAN4XO = __esm({
|
|
25876
|
+
"../agent-core/dist/chunk-FPGAN4XO.js"() {
|
|
25804
25877
|
"use strict";
|
|
25805
25878
|
init_agent2();
|
|
25806
25879
|
MAX_PARSED_ATTACHMENTS = 3;
|
|
@@ -26881,12 +26954,12 @@ var init_claude = __esm({
|
|
|
26881
26954
|
"../agent-core/dist/providers/claude.js"() {
|
|
26882
26955
|
"use strict";
|
|
26883
26956
|
init_chunk_SBT5W7L4();
|
|
26884
|
-
|
|
26957
|
+
init_chunk_4G77APXN();
|
|
26885
26958
|
init_chunk_XC5676SG();
|
|
26886
|
-
|
|
26959
|
+
init_chunk_HBIPWAUI();
|
|
26887
26960
|
init_chunk_J2KTV5FP();
|
|
26888
26961
|
init_chunk_M6YHY2EZ();
|
|
26889
|
-
|
|
26962
|
+
init_chunk_FPGAN4XO();
|
|
26890
26963
|
init_chunk_YXWJW7I5();
|
|
26891
26964
|
init_effort();
|
|
26892
26965
|
import_crypto6 = require("crypto");
|
|
@@ -28066,7 +28139,7 @@ function elicitationAnswer(elicitation, answer) {
|
|
|
28066
28139
|
return { action: "accept", content };
|
|
28067
28140
|
}
|
|
28068
28141
|
function inferImageMimeType(buffer) {
|
|
28069
|
-
if (buffer.length >= 8 && buffer.subarray(0, 8).equals(
|
|
28142
|
+
if (buffer.length >= 8 && buffer.subarray(0, 8).equals(PNG_SIGNATURE2)) return "image/png";
|
|
28070
28143
|
if (buffer.length >= 3 && buffer[0] === 255 && buffer[1] === 216 && buffer[2] === 255) {
|
|
28071
28144
|
return "image/jpeg";
|
|
28072
28145
|
}
|
|
@@ -28185,6 +28258,29 @@ function imageKey(update) {
|
|
|
28185
28258
|
const image = asRecord(update.image);
|
|
28186
28259
|
return asString(image?.sourceHash) || asString(image?.id) || void 0;
|
|
28187
28260
|
}
|
|
28261
|
+
function windowPatch(value) {
|
|
28262
|
+
if (value === null) return null;
|
|
28263
|
+
const record2 = asRecord(value);
|
|
28264
|
+
if (!record2) return void 0;
|
|
28265
|
+
const patch = {};
|
|
28266
|
+
const usedPercent = asFiniteNumber(record2.usedPercent);
|
|
28267
|
+
if (usedPercent !== void 0 && usedPercent >= 0 && usedPercent <= 100) {
|
|
28268
|
+
patch.usedPercent = usedPercent;
|
|
28269
|
+
} else if (record2.usedPercent === null) {
|
|
28270
|
+
patch.usedPercent = null;
|
|
28271
|
+
}
|
|
28272
|
+
const duration3 = asFiniteNumber(record2.windowDurationMins);
|
|
28273
|
+
if (duration3 !== void 0 && duration3 > 0) patch.windowMinutes = duration3;
|
|
28274
|
+
else if (record2.windowDurationMins === null) patch.windowMinutes = null;
|
|
28275
|
+
const seconds = asFiniteNumber(record2.resetsAt);
|
|
28276
|
+
if (seconds !== void 0 && seconds >= 0) {
|
|
28277
|
+
const reset = new Date(seconds * 1e3);
|
|
28278
|
+
if (Number.isFinite(reset.getTime())) patch.resetsAt = reset.toISOString();
|
|
28279
|
+
} else if (record2.resetsAt === null) {
|
|
28280
|
+
patch.resetsAt = null;
|
|
28281
|
+
}
|
|
28282
|
+
return patch;
|
|
28283
|
+
}
|
|
28188
28284
|
function isApprovalRequest(method) {
|
|
28189
28285
|
return COMMAND_OR_FILE.has(method) || LEGACY.has(method);
|
|
28190
28286
|
}
|
|
@@ -28596,7 +28692,10 @@ function classifyCodexError(error61) {
|
|
|
28596
28692
|
const message = asString(error61?.message);
|
|
28597
28693
|
const known = typeof info === "string" ? INFO_KINDS.get(info) : void 0;
|
|
28598
28694
|
const own2 = normalizeCodexCliErrorMessage(message.trim());
|
|
28599
|
-
if (known)
|
|
28695
|
+
if (known) {
|
|
28696
|
+
const classified = own2 ? { ...specForErrorKind(known), message: own2 } : specForErrorKind(known);
|
|
28697
|
+
return known === "usage_limit" ? { ...classified, ...readCapReset(message) } : classified;
|
|
28698
|
+
}
|
|
28600
28699
|
const status = httpStatusOf(info);
|
|
28601
28700
|
return classifyProviderError(message, status === void 0 ? {} : { status });
|
|
28602
28701
|
}
|
|
@@ -28680,7 +28779,7 @@ async function handshake(session, spec, log) {
|
|
|
28680
28779
|
}
|
|
28681
28780
|
await session.rpc.notify("initialized");
|
|
28682
28781
|
}
|
|
28683
|
-
async function preflight(session, spec) {
|
|
28782
|
+
async function preflight(session, spec, log) {
|
|
28684
28783
|
if (spec.externalAuth) {
|
|
28685
28784
|
const tokens2 = await spec.externalAuth.current();
|
|
28686
28785
|
await session.rpc.request("account/login/start", {
|
|
@@ -28698,6 +28797,13 @@ async function preflight(session, spec) {
|
|
|
28698
28797
|
specForErrorKind("not_logged_in")
|
|
28699
28798
|
);
|
|
28700
28799
|
}
|
|
28800
|
+
if (spec.externalAuth) {
|
|
28801
|
+
try {
|
|
28802
|
+
session.observeRateLimits(await session.rpc.request("account/rateLimits/read", {}));
|
|
28803
|
+
} catch {
|
|
28804
|
+
log.warn("codex.rate_limits_unavailable", {});
|
|
28805
|
+
}
|
|
28806
|
+
}
|
|
28701
28807
|
}
|
|
28702
28808
|
function threadOf(result) {
|
|
28703
28809
|
const thread = asRecord(asRecord(result)?.thread);
|
|
@@ -28759,7 +28865,7 @@ function createCodexDriver(options = {}) {
|
|
|
28759
28865
|
try {
|
|
28760
28866
|
const opening = (async () => {
|
|
28761
28867
|
await handshake(session, spec, resolved.log);
|
|
28762
|
-
await preflight(session, spec);
|
|
28868
|
+
await preflight(session, spec, resolved.log);
|
|
28763
28869
|
return openThread(session, spec, resolved.log);
|
|
28764
28870
|
})();
|
|
28765
28871
|
const thread = await withDeadline(
|
|
@@ -28910,7 +29016,7 @@ function createCodexExecDriver(options = {}) {
|
|
|
28910
29016
|
};
|
|
28911
29017
|
}
|
|
28912
29018
|
function envDigest2(env) {
|
|
28913
|
-
const hash2 = (0,
|
|
29019
|
+
const hash2 = (0, import_crypto10.createHash)("sha256");
|
|
28914
29020
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
28915
29021
|
return hash2.digest("hex");
|
|
28916
29022
|
}
|
|
@@ -28951,7 +29057,7 @@ function planCodexExecSession(run, context) {
|
|
|
28951
29057
|
};
|
|
28952
29058
|
}
|
|
28953
29059
|
function envDigest22(env) {
|
|
28954
|
-
const hash2 = (0,
|
|
29060
|
+
const hash2 = (0, import_crypto11.createHash)("sha256");
|
|
28955
29061
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
28956
29062
|
return hash2.digest("hex");
|
|
28957
29063
|
}
|
|
@@ -29020,26 +29126,28 @@ function codexTurnInput(run, context) {
|
|
|
29020
29126
|
...images.length ? { imagePaths: images.map((image) => image.path) } : {}
|
|
29021
29127
|
};
|
|
29022
29128
|
}
|
|
29023
|
-
var import_fs6, import_path6, import_crypto8, import_crypto9, import_crypto10, TokenRefresher, MCP_STARTUP_TIMEOUT_SEC, FIELD_TYPES, YES_NO, ACCEPT_DECLINE, MAX_INLINE_GENERATED_IMAGE_BYTES,
|
|
29129
|
+
var import_fs6, import_path6, import_crypto8, import_crypto9, import_crypto10, import_crypto11, TokenRefresher, MCP_STARTUP_TIMEOUT_SEC, FIELD_TYPES, YES_NO, ACCEPT_DECLINE, MAX_INLINE_GENERATED_IMAGE_BYTES, PNG_SIGNATURE2, JPEG_NON_FRAME_MARKERS, IMAGE_GEN_CALL, PROMPT_LITERAL, RELOCATE_EVERY_MS, CodexImageGenerationFold, CodexRolloutImages, CodexRateLimits, USER_INPUT_METHOD, PERMISSIONS_METHOD, ELICITATION_METHOD, COMMAND_OR_FILE, LEGACY, DECISIONS, COORDINATION_TOOLS, SETTLED_AGENT, STATUS, CHANGE_OPERATIONS, SILENT_ON_START, IGNORED_ITEMS, PLAN_STATUS, WORKER_LIFECYCLE, INFO_KINDS, SILENT, CodexTurn, STDERR_TAIL_LINES3, MAX_BETWEEN_UPDATES, UNSUPPORTED_REQUEST, DECLINED_ELICITATION, IMAGE_CATCH_UP_MS, IMAGE_POLL_MS, CodexSession, CODEX_MIN_VERSION, CODEX_REQUIREMENT, CODEX_TESTED_LINE, DEFAULTS2, CLIENT_INFO, STATUS2, EXITED_WITHOUT_RESPONSE, CodexExecTurn, DEFAULTS22, CodexExecSession;
|
|
29024
29130
|
var init_codex = __esm({
|
|
29025
29131
|
"../agent-core/dist/providers/codex.js"() {
|
|
29026
29132
|
"use strict";
|
|
29027
29133
|
init_chunk_SBT5W7L4();
|
|
29028
|
-
|
|
29134
|
+
init_chunk_4G77APXN();
|
|
29029
29135
|
init_chunk_XC5676SG();
|
|
29030
|
-
|
|
29136
|
+
init_chunk_HBIPWAUI();
|
|
29031
29137
|
init_chunk_J2KTV5FP();
|
|
29032
29138
|
init_chunk_M6YHY2EZ();
|
|
29033
|
-
|
|
29139
|
+
init_chunk_FPGAN4XO();
|
|
29034
29140
|
init_chunk_YXWJW7I5();
|
|
29035
29141
|
import_fs6 = require("fs");
|
|
29036
29142
|
import_path6 = require("path");
|
|
29037
29143
|
init_effort();
|
|
29038
29144
|
import_crypto8 = require("crypto");
|
|
29039
|
-
init_agent2();
|
|
29040
29145
|
import_crypto9 = require("crypto");
|
|
29146
|
+
init_runtime_v2();
|
|
29041
29147
|
init_agent2();
|
|
29042
29148
|
import_crypto10 = require("crypto");
|
|
29149
|
+
init_agent2();
|
|
29150
|
+
import_crypto11 = require("crypto");
|
|
29043
29151
|
init_effort();
|
|
29044
29152
|
TokenRefresher = class {
|
|
29045
29153
|
#auth;
|
|
@@ -29080,7 +29188,7 @@ var init_codex = __esm({
|
|
|
29080
29188
|
];
|
|
29081
29189
|
ACCEPT_DECLINE = [{ label: "Accept" }, { label: "Decline" }];
|
|
29082
29190
|
MAX_INLINE_GENERATED_IMAGE_BYTES = 20 * 1024 * 1024;
|
|
29083
|
-
|
|
29191
|
+
PNG_SIGNATURE2 = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
29084
29192
|
JPEG_NON_FRAME_MARKERS = /* @__PURE__ */ new Set([196, 200, 204]);
|
|
29085
29193
|
IMAGE_GEN_CALL = /\bimage_gen\w*\s*\(/;
|
|
29086
29194
|
PROMPT_LITERAL = /\bprompt\s*:\s*("(?:[^"\\]|\\.)*")/;
|
|
@@ -29223,6 +29331,46 @@ var init_codex = __esm({
|
|
|
29223
29331
|
return this.#cursor;
|
|
29224
29332
|
}
|
|
29225
29333
|
};
|
|
29334
|
+
CodexRateLimits = class {
|
|
29335
|
+
#clock;
|
|
29336
|
+
#sourceId;
|
|
29337
|
+
#sequence = 0;
|
|
29338
|
+
constructor(clock, sourceId = (0, import_crypto9.randomUUID)()) {
|
|
29339
|
+
this.#clock = clock;
|
|
29340
|
+
this.#sourceId = sourceId;
|
|
29341
|
+
}
|
|
29342
|
+
read(value) {
|
|
29343
|
+
const response = asRecord(value);
|
|
29344
|
+
const buckets = asRecord(response?.rateLimitsByLimitId);
|
|
29345
|
+
if (buckets) {
|
|
29346
|
+
return Object.entries(buckets).flatMap(
|
|
29347
|
+
([limitId, snapshot2]) => this.#update(snapshot2, limitId)
|
|
29348
|
+
);
|
|
29349
|
+
}
|
|
29350
|
+
return this.#update(response?.rateLimits);
|
|
29351
|
+
}
|
|
29352
|
+
notification(params) {
|
|
29353
|
+
return this.#update(params.rateLimits);
|
|
29354
|
+
}
|
|
29355
|
+
#update(value, bucketId) {
|
|
29356
|
+
const snapshot2 = asRecord(value);
|
|
29357
|
+
if (!snapshot2) return [];
|
|
29358
|
+
const primary = windowPatch(snapshot2.primary);
|
|
29359
|
+
const secondary = windowPatch(snapshot2.secondary);
|
|
29360
|
+
const planType = snapshot2.planType === null ? null : asString(snapshot2.planType) || void 0;
|
|
29361
|
+
const parsed = runCodexRateLimitsUpdateSchema.safeParse({
|
|
29362
|
+
sessionUpdate: "_alan/codex.rate_limits",
|
|
29363
|
+
limitId: bucketId ?? (asString(snapshot2.limitId) || "codex"),
|
|
29364
|
+
...primary === void 0 ? {} : { primary },
|
|
29365
|
+
...secondary === void 0 ? {} : { secondary },
|
|
29366
|
+
...planType === void 0 ? {} : { planType },
|
|
29367
|
+
observedAt: new Date(this.#clock.now()).toISOString(),
|
|
29368
|
+
sourceId: this.#sourceId,
|
|
29369
|
+
sequence: this.#sequence++
|
|
29370
|
+
});
|
|
29371
|
+
return parsed.success ? [parsed.data] : [];
|
|
29372
|
+
}
|
|
29373
|
+
};
|
|
29226
29374
|
USER_INPUT_METHOD = "item/tool/requestUserInput";
|
|
29227
29375
|
PERMISSIONS_METHOD = "item/permissions/requestApproval";
|
|
29228
29376
|
ELICITATION_METHOD = "mcpServer/elicitation/request";
|
|
@@ -29292,7 +29440,6 @@ var init_codex = __esm({
|
|
|
29292
29440
|
"thread/closed",
|
|
29293
29441
|
"hook/started",
|
|
29294
29442
|
"hook/completed",
|
|
29295
|
-
"account/rateLimits/updated",
|
|
29296
29443
|
"account/updated",
|
|
29297
29444
|
"account/login/completed",
|
|
29298
29445
|
"remoteControl/status/changed",
|
|
@@ -29487,6 +29634,7 @@ var init_codex = __esm({
|
|
|
29487
29634
|
#listeners = createListeners();
|
|
29488
29635
|
#options;
|
|
29489
29636
|
#memory;
|
|
29637
|
+
#rateLimits;
|
|
29490
29638
|
#stderr = [];
|
|
29491
29639
|
#approvals = /* @__PURE__ */ new Map();
|
|
29492
29640
|
/** Session-level updates (thread start warnings, MCP startup) that open the next turn's log. */
|
|
@@ -29503,6 +29651,7 @@ var init_codex = __esm({
|
|
|
29503
29651
|
constructor(child, tree, memory, options) {
|
|
29504
29652
|
this.#options = options;
|
|
29505
29653
|
this.#memory = memory;
|
|
29654
|
+
this.#rateLimits = new CodexRateLimits(options.clock);
|
|
29506
29655
|
this.#lastTurn = new CodexTurn(memory, options.clock);
|
|
29507
29656
|
this.#host = hostProcess(
|
|
29508
29657
|
child,
|
|
@@ -29537,6 +29686,9 @@ var init_codex = __esm({
|
|
|
29537
29686
|
configure(config2) {
|
|
29538
29687
|
this.#config = config2;
|
|
29539
29688
|
}
|
|
29689
|
+
observeRateLimits(response) {
|
|
29690
|
+
this.#recordRateLimits(this.#rateLimits.read(response));
|
|
29691
|
+
}
|
|
29540
29692
|
attachThread(threadId, rolloutPath) {
|
|
29541
29693
|
if (threadId === this.#threadId) return;
|
|
29542
29694
|
this.#threadId = threadId;
|
|
@@ -29703,6 +29855,10 @@ var init_codex = __esm({
|
|
|
29703
29855
|
return known === void 0 || known === turnId ? active : void 0;
|
|
29704
29856
|
}
|
|
29705
29857
|
#onNotification(notification) {
|
|
29858
|
+
if (notification.method === "account/rateLimits/updated") {
|
|
29859
|
+
this.#recordRateLimits(this.#rateLimits.notification(notification.params));
|
|
29860
|
+
return;
|
|
29861
|
+
}
|
|
29706
29862
|
if (notification.method === "serverRequest/resolved") this.#dropResolved(notification);
|
|
29707
29863
|
const active = this.#ownerOf(notification);
|
|
29708
29864
|
const reader = active?.turn ?? this.#lastTurn;
|
|
@@ -29729,6 +29885,14 @@ var init_codex = __esm({
|
|
|
29729
29885
|
void this.#stopTurn(active);
|
|
29730
29886
|
}
|
|
29731
29887
|
}
|
|
29888
|
+
#recordRateLimits(updates) {
|
|
29889
|
+
const active = this.#current;
|
|
29890
|
+
if (active) this.#emitUpdates(active, updates);
|
|
29891
|
+
else {
|
|
29892
|
+
this.#between.push(...updates);
|
|
29893
|
+
this.#between.splice(0, Math.max(0, this.#between.length - MAX_BETWEEN_UPDATES));
|
|
29894
|
+
}
|
|
29895
|
+
}
|
|
29732
29896
|
#emitUpdates(active, updates) {
|
|
29733
29897
|
for (const update of updates) this.#emit({ type: "update", turnId: active.id, update });
|
|
29734
29898
|
}
|
|
@@ -30382,9 +30546,9 @@ function alanCodeEngineEnv(input2) {
|
|
|
30382
30546
|
};
|
|
30383
30547
|
}
|
|
30384
30548
|
async function writePlugin(directory, apiOrigin) {
|
|
30385
|
-
const origin = (0,
|
|
30549
|
+
const origin = (0, import_crypto12.createHash)("sha256").update(apiOrigin).digest("hex").slice(0, 12);
|
|
30386
30550
|
const target = (0, import_path8.join)(directory, `engine-plugin-v${ALAN_CODE_ENGINE_PLUGIN_VERSION}-${origin}.mjs`);
|
|
30387
|
-
const temporary = `${target}.${(0,
|
|
30551
|
+
const temporary = `${target}.${(0, import_crypto12.randomUUID)()}.tmp`;
|
|
30388
30552
|
await (0, import_promises15.mkdir)(directory, { recursive: true, mode: 448 });
|
|
30389
30553
|
await (0, import_promises15.writeFile)(temporary, alanCodeEnginePluginSource(apiOrigin), { mode: 384 });
|
|
30390
30554
|
await (0, import_promises15.rename)(temporary, target);
|
|
@@ -30416,7 +30580,7 @@ function alanCodeSystemPrompt(alanSystemPrompt) {
|
|
|
30416
30580
|
|
|
30417
30581
|
${instructions}` : ALAN_CODE_TOOL_NAMING_PROMPT;
|
|
30418
30582
|
}
|
|
30419
|
-
var import_http3, import_https, import_fs7, import_path7,
|
|
30583
|
+
var import_http3, import_https, import_fs7, import_path7, import_crypto12, import_promises15, import_path8, import_url, ALAN_CODE_BASELINE_PROMPT, ALAN_CODE_ENGINE_PROVIDER_ID, DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_OUTPUT_TOKENS, ALAN_CODE_API_KEY_ENV, ALAN_CODE_CONVERSATION_ID_ENV, ALAN_CODE_PROXY_PATH, ALAN_CODE_WEBSEARCH_PATH, ALAN_CODE_CATALOG_PATH, CATALOG_TIMEOUT_MS, MAX_CATALOG_BYTES, ACTIVATION_WAIT_MS, ACTIVATION_POLL_MS, CatalogResponseError, ALAN_CODE_ENGINE_PATH_ENV, ALAN_CODE_ENGINE_COMMAND, ALAN_CODE_ENGINE_NAME, WINDOWS_RUNNABLE_EXTENSION, ALAN_CODE_ENGINE_PLUGIN_VERSION, ALAN_CODE_TOOL_NAMING_PROMPT;
|
|
30420
30584
|
var init_alan_code = __esm({
|
|
30421
30585
|
"../agent-core/dist/providers/alan-code.js"() {
|
|
30422
30586
|
"use strict";
|
|
@@ -30429,7 +30593,7 @@ var init_alan_code = __esm({
|
|
|
30429
30593
|
import_fs7 = require("fs");
|
|
30430
30594
|
import_path7 = require("path");
|
|
30431
30595
|
init_runtime_v2();
|
|
30432
|
-
|
|
30596
|
+
import_crypto12 = require("crypto");
|
|
30433
30597
|
import_promises15 = require("fs/promises");
|
|
30434
30598
|
import_path8 = require("path");
|
|
30435
30599
|
import_url = require("url");
|
|
@@ -37799,9 +37963,9 @@ var require_dist = __commonJS({
|
|
|
37799
37963
|
var init_dist = __esm({
|
|
37800
37964
|
"../agent-core/dist/index.js"() {
|
|
37801
37965
|
"use strict";
|
|
37802
|
-
|
|
37966
|
+
init_chunk_4G77APXN();
|
|
37803
37967
|
init_chunk_XC5676SG();
|
|
37804
|
-
|
|
37968
|
+
init_chunk_HBIPWAUI();
|
|
37805
37969
|
init_chunk_M6YHY2EZ();
|
|
37806
37970
|
init_chunk_YXWJW7I5();
|
|
37807
37971
|
}
|
|
@@ -38475,7 +38639,7 @@ function isAcpBackendKind(value) {
|
|
|
38475
38639
|
return Object.hasOwn(ACP_PROFILES, value);
|
|
38476
38640
|
}
|
|
38477
38641
|
function envDigest3(env) {
|
|
38478
|
-
const hash2 = (0,
|
|
38642
|
+
const hash2 = (0, import_crypto13.createHash)("sha256");
|
|
38479
38643
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
38480
38644
|
return hash2.digest("hex");
|
|
38481
38645
|
}
|
|
@@ -38542,22 +38706,22 @@ async function acpTurnInput(run, context) {
|
|
|
38542
38706
|
...encoded.length ? { images: encoded, imagePaths: images.map((image) => image.path) } : {}
|
|
38543
38707
|
};
|
|
38544
38708
|
}
|
|
38545
|
-
var import_promises23, import_path9,
|
|
38709
|
+
var import_promises23, import_path9, import_crypto13, import_promises24, CURSOR_ASK_QUESTION, copilotAcpProfile, cursorAcpProfile, MODEL_REJECTED, MAX_READ_BYTES, FsDenied, ENV_REFERENCE, AcpBackgroundTasks, CURSOR_CREATE_PLAN, STATUSES, READ_KINDS, ALLOW_KINDS, REJECT_KINDS, CANCELLED_PERMISSION, STOP_REASONS, CHUNKS, ECHOES, AcpTurn, STDERR_TAIL_LINES4, MAX_BETWEEN_UPDATES2, AcpSession, DEFAULTS3, CLIENT_INFO2, TASK_BACKGROUNDED, TASK_COMPLETED, SESSION_NOTIFICATION, KILLED_STATUSES, SUCCESS_STATUSES, SUBAGENT_ID, grokTaskDialect, grokAcpProfile, kimiAcpProfile, ACP_PROFILES, ACP_MODES;
|
|
38546
38710
|
var init_acp3 = __esm({
|
|
38547
38711
|
"../agent-core/dist/providers/acp.js"() {
|
|
38548
38712
|
"use strict";
|
|
38549
|
-
|
|
38713
|
+
init_chunk_4G77APXN();
|
|
38550
38714
|
init_chunk_XC5676SG();
|
|
38551
|
-
|
|
38715
|
+
init_chunk_HBIPWAUI();
|
|
38552
38716
|
init_chunk_J2KTV5FP();
|
|
38553
38717
|
init_chunk_M6YHY2EZ();
|
|
38554
|
-
|
|
38718
|
+
init_chunk_FPGAN4XO();
|
|
38555
38719
|
init_chunk_YXWJW7I5();
|
|
38556
38720
|
import_promises23 = require("fs/promises");
|
|
38557
38721
|
import_path9 = require("path");
|
|
38558
38722
|
init_effort();
|
|
38559
38723
|
init_acp();
|
|
38560
|
-
|
|
38724
|
+
import_crypto13 = require("crypto");
|
|
38561
38725
|
import_promises24 = require("fs/promises");
|
|
38562
38726
|
init_agent2();
|
|
38563
38727
|
CURSOR_ASK_QUESTION = "cursor/ask_question";
|
|
@@ -39363,7 +39527,7 @@ var init_acp3 = __esm({
|
|
|
39363
39527
|
var init_classify = __esm({
|
|
39364
39528
|
"../agent-core/dist/classify.js"() {
|
|
39365
39529
|
"use strict";
|
|
39366
|
-
|
|
39530
|
+
init_chunk_HBIPWAUI();
|
|
39367
39531
|
init_chunk_YXWJW7I5();
|
|
39368
39532
|
}
|
|
39369
39533
|
});
|
|
@@ -39573,7 +39737,10 @@ function createPersistentDriver(provider4, options) {
|
|
|
39573
39737
|
return "delivered";
|
|
39574
39738
|
};
|
|
39575
39739
|
const openFailed = (error61, spec, sink, signal, inputs) => {
|
|
39576
|
-
if (error61 instanceof SessionOpenRefusal && error61.reason === "unsupported_version" &&
|
|
39740
|
+
if (error61 instanceof SessionOpenRefusal && error61.reason === "unsupported_version" && inputs.codex !== void 0) {
|
|
39741
|
+
return { outcome: "failed", message: error61.message };
|
|
39742
|
+
}
|
|
39743
|
+
if (error61 instanceof SessionOpenRefusal && error61.reason === "unsupported_version" && options.fallback && inputs.codex === void 0) {
|
|
39577
39744
|
log.warn("holder.persistent_unsupported", {
|
|
39578
39745
|
harness: provider4.harness,
|
|
39579
39746
|
message: error61.message
|
|
@@ -39590,7 +39757,7 @@ function createPersistentDriver(provider4, options) {
|
|
|
39590
39757
|
};
|
|
39591
39758
|
return {
|
|
39592
39759
|
runTurn: async (spec, sink, signal, inputs) => {
|
|
39593
|
-
if (live.fallbackOnly && options.fallback)
|
|
39760
|
+
if (live.fallbackOnly && options.fallback && inputs.codex === void 0)
|
|
39594
39761
|
return options.fallback.runTurn(spec, sink, signal, inputs);
|
|
39595
39762
|
if (signal.aborted) return { outcome: "aborted" };
|
|
39596
39763
|
const managedMcp = await managedMcpAccess(signal);
|
|
@@ -40180,7 +40347,7 @@ function createOpenCodeDriver(options = {}) {
|
|
|
40180
40347
|
await authorization?.remove();
|
|
40181
40348
|
};
|
|
40182
40349
|
const spec = { ...planned, env: launchEnv(planned, authorization) };
|
|
40183
|
-
const password = options.password?.() ?? (0,
|
|
40350
|
+
const password = options.password?.() ?? (0, import_crypto14.randomBytes)(24).toString("base64url");
|
|
40184
40351
|
try {
|
|
40185
40352
|
const session = await openWithRetries(spec, password, resolved);
|
|
40186
40353
|
void session.exited.then(removeAuthorization).catch((error61) => {
|
|
@@ -40195,7 +40362,7 @@ function createOpenCodeDriver(options = {}) {
|
|
|
40195
40362
|
};
|
|
40196
40363
|
}
|
|
40197
40364
|
function envDigest4(env) {
|
|
40198
|
-
const hash2 = (0,
|
|
40365
|
+
const hash2 = (0, import_crypto15.createHash)("sha256");
|
|
40199
40366
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
40200
40367
|
return hash2.digest("hex");
|
|
40201
40368
|
}
|
|
@@ -40276,20 +40443,20 @@ function openCodeTurnInput(run, context) {
|
|
|
40276
40443
|
...images.length ? { imagePaths: images.map((image) => image.path) } : {}
|
|
40277
40444
|
};
|
|
40278
40445
|
}
|
|
40279
|
-
var import_http4,
|
|
40446
|
+
var import_http4, import_crypto14, import_promises25, import_path10, import_path11, import_url2, import_crypto15, IDLE_SOCKET_MS2, OpenCodeHttpError, OpenCodeClient, OPENCODE_CONFIG_ENV, OPENCODE_ENGINE, TEXT_PARTS, STEP_PARTS, STOPPED_BY_USER, OpenCodeSubagents, NAMED_KINDS, OPENCODE_ABORTED_ERROR, PROVIDER_EVENT_META, TASK_TOOL_NAME, TASK_RESULT_TAG, TASK_ERROR_TAG, PERMISSION_DENIED, FILE_OPERATIONS, PartReader, NOTHING, NON_INTERACTIVE_PERMISSIONS, CONTENT_FILTER_FINISHES, OUTPUT_PARTS, OpenCodeTurn, LISTENING, OUTPUT_TAIL_LINES, IMAGE_TYPES, OpenCodeSession, OPENCODE_MIN_VERSION, OPENCODE_REQUIREMENT, OPENCODE_TESTED_LINE, OPENCODE_SUPPORTED_MAJOR, DEFAULTS4, STORE_LOCKED, NON_INTERACTIVE_RULES, TITLE_LENGTH, MAX_VARIANT_LENGTH;
|
|
40280
40447
|
var init_opencode = __esm({
|
|
40281
40448
|
"../agent-core/dist/providers/opencode.js"() {
|
|
40282
40449
|
"use strict";
|
|
40283
|
-
|
|
40450
|
+
init_chunk_4G77APXN();
|
|
40284
40451
|
init_chunk_XC5676SG();
|
|
40285
|
-
|
|
40452
|
+
init_chunk_HBIPWAUI();
|
|
40286
40453
|
init_chunk_J2KTV5FP();
|
|
40287
40454
|
init_chunk_M6YHY2EZ();
|
|
40288
|
-
|
|
40455
|
+
init_chunk_FPGAN4XO();
|
|
40289
40456
|
init_chunk_YXWJW7I5();
|
|
40290
40457
|
import_http4 = require("http");
|
|
40291
40458
|
init_runtime_v2();
|
|
40292
|
-
|
|
40459
|
+
import_crypto14 = require("crypto");
|
|
40293
40460
|
import_promises25 = require("fs/promises");
|
|
40294
40461
|
import_path10 = require("path");
|
|
40295
40462
|
init_agent2();
|
|
@@ -40297,7 +40464,7 @@ var init_opencode = __esm({
|
|
|
40297
40464
|
import_url2 = require("url");
|
|
40298
40465
|
init_acp();
|
|
40299
40466
|
init_acp();
|
|
40300
|
-
|
|
40467
|
+
import_crypto15 = require("crypto");
|
|
40301
40468
|
init_agent2();
|
|
40302
40469
|
IDLE_SOCKET_MS2 = 4e3;
|
|
40303
40470
|
OpenCodeHttpError = class extends Error {
|
|
@@ -41593,11 +41760,11 @@ function createCodexLogin(broker) {
|
|
|
41593
41760
|
}
|
|
41594
41761
|
};
|
|
41595
41762
|
}
|
|
41596
|
-
function withLogin(planned, externalAuth,
|
|
41763
|
+
function withLogin(planned, externalAuth, credentialKey) {
|
|
41597
41764
|
return {
|
|
41598
41765
|
...planned,
|
|
41599
41766
|
spec: { ...planned.spec, externalAuth },
|
|
41600
|
-
key: JSON.stringify([planned.key,
|
|
41767
|
+
key: JSON.stringify([planned.key, credentialKey])
|
|
41601
41768
|
};
|
|
41602
41769
|
}
|
|
41603
41770
|
function createCodexHolderDriver(options) {
|
|
@@ -41619,7 +41786,11 @@ function createCodexHolderDriver(options) {
|
|
|
41619
41786
|
});
|
|
41620
41787
|
if (inputs.codex === void 0) return planned;
|
|
41621
41788
|
login.forTurn(spec.runId, inputs.codex);
|
|
41622
|
-
return withLogin(
|
|
41789
|
+
return withLogin(
|
|
41790
|
+
planned,
|
|
41791
|
+
login.externalAuth,
|
|
41792
|
+
inputs.codex.credentialId ?? inputs.codex.chatgptAccountId
|
|
41793
|
+
);
|
|
41623
41794
|
},
|
|
41624
41795
|
canResume: () => true,
|
|
41625
41796
|
open: async (spec) => {
|
|
@@ -42032,7 +42203,7 @@ function createDroidDriver(options = {}) {
|
|
|
42032
42203
|
};
|
|
42033
42204
|
}
|
|
42034
42205
|
function envDigest5(env) {
|
|
42035
|
-
const hash2 = (0,
|
|
42206
|
+
const hash2 = (0, import_crypto16.createHash)("sha256");
|
|
42036
42207
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
42037
42208
|
return hash2.digest("hex");
|
|
42038
42209
|
}
|
|
@@ -42092,19 +42263,19 @@ async function droidTurnInput(run, context) {
|
|
|
42092
42263
|
);
|
|
42093
42264
|
return { turnId: run.runId, text: text2, ...encoded.length ? { images: encoded } : {} };
|
|
42094
42265
|
}
|
|
42095
|
-
var
|
|
42266
|
+
var import_crypto16, import_promises26, FACTORY_API_VERSION, FACTORY_PROTOCOL_VERSION, SUBAGENT_TOOLS, TASK_OUTPUT_TOOLS, TASK_STOP_TOOLS, SILENT2, DroidTurn, STDERR_TAIL_LINES5, UNSUPPORTED_REQUEST2, DroidSession, DEFAULTS5, DROID_REQUIREMENT, DROID_JSONRPC_ARGS;
|
|
42096
42267
|
var init_droid = __esm({
|
|
42097
42268
|
"../agent-core/dist/providers/droid.js"() {
|
|
42098
42269
|
"use strict";
|
|
42099
|
-
|
|
42270
|
+
init_chunk_4G77APXN();
|
|
42100
42271
|
init_chunk_XC5676SG();
|
|
42101
|
-
|
|
42272
|
+
init_chunk_HBIPWAUI();
|
|
42102
42273
|
init_chunk_J2KTV5FP();
|
|
42103
42274
|
init_chunk_M6YHY2EZ();
|
|
42104
|
-
|
|
42275
|
+
init_chunk_FPGAN4XO();
|
|
42105
42276
|
init_chunk_YXWJW7I5();
|
|
42106
42277
|
init_runtime_v2();
|
|
42107
|
-
|
|
42278
|
+
import_crypto16 = require("crypto");
|
|
42108
42279
|
import_promises26 = require("fs/promises");
|
|
42109
42280
|
init_agent2();
|
|
42110
42281
|
FACTORY_API_VERSION = "1.0.0";
|
|
@@ -43152,7 +43323,7 @@ ${output2.stderr}`).join("\n")
|
|
|
43152
43323
|
};
|
|
43153
43324
|
}
|
|
43154
43325
|
function envDigest6(env) {
|
|
43155
|
-
const hash2 = (0,
|
|
43326
|
+
const hash2 = (0, import_crypto17.createHash)("sha256");
|
|
43156
43327
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
43157
43328
|
return hash2.digest("hex");
|
|
43158
43329
|
}
|
|
@@ -43198,16 +43369,16 @@ function antigravityTurnInput(run, context) {
|
|
|
43198
43369
|
});
|
|
43199
43370
|
return { turnId: run.runId, text: appendImagePathReferences(text2, images) };
|
|
43200
43371
|
}
|
|
43201
|
-
var import_promises27, import_path12, import_fs8, import_path13, import_path14, import_url3,
|
|
43372
|
+
var import_promises27, import_path12, import_fs8, import_path13, import_path14, import_url3, import_crypto17, NO_ANTIGRAVITY_CAPABILITIES, INSTRUCTIONS_FILE, MAX_INSTRUCTION_CHARS, SHORTENED_NOTE, DIFF_BLOCK_START, DIFF_BLOCK_END, HUNK_HEADER, TRANSCRIPT_FILE, FULL_TRANSCRIPT_FILE, LOG_DIRS, TOOL_RESULT_TYPES, BrainTranscript, AntigravityTranscripts, ANTIGRAVITY_GRAMMAR_NAME, AntigravityGrammar, ignored, HANDLERS, SUCCESSFUL_STATUSES, SESSION_START_TYPES, RESULT_TYPES, SUBAGENT_START_TYPES, RESUME_FORKED, EXITED_WITHOUT_RESULT, AntigravityTurn, DEFAULTS6, AntigravitySession, WINDOWS_LINE_MARGIN;
|
|
43202
43373
|
var init_antigravity = __esm({
|
|
43203
43374
|
"../agent-core/dist/providers/antigravity.js"() {
|
|
43204
43375
|
"use strict";
|
|
43205
43376
|
init_chunk_SBT5W7L4();
|
|
43206
|
-
|
|
43377
|
+
init_chunk_4G77APXN();
|
|
43207
43378
|
init_chunk_XC5676SG();
|
|
43208
|
-
|
|
43379
|
+
init_chunk_HBIPWAUI();
|
|
43209
43380
|
init_chunk_M6YHY2EZ();
|
|
43210
|
-
|
|
43381
|
+
init_chunk_FPGAN4XO();
|
|
43211
43382
|
init_chunk_YXWJW7I5();
|
|
43212
43383
|
import_promises27 = require("fs/promises");
|
|
43213
43384
|
import_path12 = require("path");
|
|
@@ -43217,7 +43388,7 @@ var init_antigravity = __esm({
|
|
|
43217
43388
|
init_effort();
|
|
43218
43389
|
import_path14 = require("path");
|
|
43219
43390
|
import_url3 = require("url");
|
|
43220
|
-
|
|
43391
|
+
import_crypto17 = require("crypto");
|
|
43221
43392
|
init_agent2();
|
|
43222
43393
|
NO_ANTIGRAVITY_CAPABILITIES = {
|
|
43223
43394
|
structuredPrint: false,
|
|
@@ -43851,7 +44022,7 @@ function createCommandCodeDriver(options = {}) {
|
|
|
43851
44022
|
};
|
|
43852
44023
|
}
|
|
43853
44024
|
function envDigest7(env) {
|
|
43854
|
-
const hash2 = (0,
|
|
44025
|
+
const hash2 = (0, import_crypto18.createHash)("sha256");
|
|
43855
44026
|
for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
|
|
43856
44027
|
return hash2.digest("hex");
|
|
43857
44028
|
}
|
|
@@ -43903,23 +44074,23 @@ function commandCodeTurnInput(run, context) {
|
|
|
43903
44074
|
});
|
|
43904
44075
|
return { turnId: run.runId, text: appendImagePathReferences(text2, images) };
|
|
43905
44076
|
}
|
|
43906
|
-
var import_promises28, import_path15,
|
|
44077
|
+
var import_promises28, import_path15, import_crypto18, COMMAND_CODE_GRAMMAR_NAME, SILENT3, CommandCodeGrammar, SHELL_TOOL, STOP_TOOLS, REPORTED_STATUS, SHELL_STATUS, SWEEP_INTERVAL_MS, CommandCodeBackgroundTasks, EXITED_WITHOUT_RESULT2, CommandCodeTurn, COMMAND_CODE_MAX_TURNS, DEFAULTS7, CommandCodeSession;
|
|
43907
44078
|
var init_command_code = __esm({
|
|
43908
44079
|
"../agent-core/dist/providers/command-code.js"() {
|
|
43909
44080
|
"use strict";
|
|
43910
|
-
|
|
44081
|
+
init_chunk_4G77APXN();
|
|
43911
44082
|
init_chunk_XC5676SG();
|
|
43912
|
-
|
|
44083
|
+
init_chunk_HBIPWAUI();
|
|
43913
44084
|
init_chunk_J2KTV5FP();
|
|
43914
44085
|
init_chunk_M6YHY2EZ();
|
|
43915
|
-
|
|
44086
|
+
init_chunk_FPGAN4XO();
|
|
43916
44087
|
init_chunk_YXWJW7I5();
|
|
43917
44088
|
import_promises28 = require("fs/promises");
|
|
43918
44089
|
import_path15 = require("path");
|
|
43919
44090
|
init_agent2();
|
|
43920
44091
|
init_runtime_v2();
|
|
43921
44092
|
init_acp();
|
|
43922
|
-
|
|
44093
|
+
import_crypto18 = require("crypto");
|
|
43923
44094
|
init_agent2();
|
|
43924
44095
|
COMMAND_CODE_GRAMMAR_NAME = "command_code_cli";
|
|
43925
44096
|
SILENT3 = /* @__PURE__ */ new Set([
|
|
@@ -44910,7 +45081,18 @@ function createHttpTransport() {
|
|
|
44910
45081
|
|
|
44911
45082
|
// src/api-client/holder-client.ts
|
|
44912
45083
|
init_runtime_v2();
|
|
45084
|
+
init_zod();
|
|
44913
45085
|
var REQUEST_TIMEOUT_MS = 3e4;
|
|
45086
|
+
var credentialRefusalSchema = external_exports.object({ message: external_exports.string().trim().min(1) });
|
|
45087
|
+
function credentialFailureMessage(response, fallback) {
|
|
45088
|
+
if (response.status !== 409) return fallback;
|
|
45089
|
+
try {
|
|
45090
|
+
const parsed = credentialRefusalSchema.safeParse(jsonBody(response));
|
|
45091
|
+
return parsed.success ? parsed.data.message : fallback;
|
|
45092
|
+
} catch {
|
|
45093
|
+
return fallback;
|
|
45094
|
+
}
|
|
45095
|
+
}
|
|
44914
45096
|
function createHolderApiClient({
|
|
44915
45097
|
apiUrl,
|
|
44916
45098
|
accessToken,
|
|
@@ -44943,7 +45125,10 @@ function createHolderApiClient({
|
|
|
44943
45125
|
if (!isOk(response)) {
|
|
44944
45126
|
throw new RuntimeFault(
|
|
44945
45127
|
"io_failed",
|
|
44946
|
-
|
|
45128
|
+
credentialFailureMessage(
|
|
45129
|
+
response,
|
|
45130
|
+
`Provider credential request failed: ${response.status}`
|
|
45131
|
+
)
|
|
44947
45132
|
);
|
|
44948
45133
|
}
|
|
44949
45134
|
return runProviderCredentialSchema.parse(jsonBody(response));
|
|
@@ -44951,7 +45136,10 @@ function createHolderApiClient({
|
|
|
44951
45136
|
refreshCodexCredential: async (runId, body, signal) => {
|
|
44952
45137
|
const response = await request2("POST", runCodexCredentialRefreshPath(runId), signal, body);
|
|
44953
45138
|
if (!isOk(response)) {
|
|
44954
|
-
throw new RuntimeFault(
|
|
45139
|
+
throw new RuntimeFault(
|
|
45140
|
+
"io_failed",
|
|
45141
|
+
credentialFailureMessage(response, `Codex sign-in refresh failed: ${response.status}`)
|
|
45142
|
+
);
|
|
44955
45143
|
}
|
|
44956
45144
|
return runCodexCredentialSchema.parse(jsonBody(response));
|
|
44957
45145
|
},
|
|
@@ -46914,6 +47102,7 @@ function createHelperMcpAccess(options) {
|
|
|
46914
47102
|
// src/holder/run-inputs.ts
|
|
46915
47103
|
var import_promises30 = require("fs/promises");
|
|
46916
47104
|
var import_node_path18 = require("path");
|
|
47105
|
+
init_dist();
|
|
46917
47106
|
var NO_RUN_INPUTS = {
|
|
46918
47107
|
attachments: [],
|
|
46919
47108
|
providerEnv: {},
|
|
@@ -46938,11 +47127,12 @@ async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [] }) {
|
|
|
46938
47127
|
const bytes = await source.downloadAttachment(spec.runId, attachment.id, signal);
|
|
46939
47128
|
const path = (0, import_node_path18.join)(dir, `${index}-${safeFilename(attachment.filename)}`);
|
|
46940
47129
|
await (0, import_promises30.writeFile)(path, bytes, { mode: 384 });
|
|
47130
|
+
const imageMimeType = attachment.kind === "image" ? detectImageMimeType(Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength)) : null;
|
|
46941
47131
|
attachments.push({
|
|
46942
47132
|
id: attachment.id,
|
|
46943
47133
|
kind: attachment.kind,
|
|
46944
47134
|
filename: attachment.filename,
|
|
46945
|
-
mimeType: attachment.mimeType,
|
|
47135
|
+
mimeType: imageMimeType ?? attachment.mimeType,
|
|
46946
47136
|
size: bytes.byteLength,
|
|
46947
47137
|
path,
|
|
46948
47138
|
...attachment.label === void 0 ? {} : { label: attachment.label },
|