@alan-ai-hq/agent-manager-linux-arm64 0.1.129 → 0.1.131

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.
Files changed (3) hide show
  1. package/alan-agent.cjs +487 -551
  2. package/alan-holder.cjs +305 -390
  3. package/package.json +1 -1
package/alan-holder.cjs CHANGED
@@ -19993,7 +19993,7 @@ var init_ids = __esm({
19993
19993
  function wire() {
19994
19994
  return (schema) => schema;
19995
19995
  }
19996
- var canonicalUserMessageSchema, canonicalAssistantMessageSchema, externalMcpServerSchema, runAttachmentSchema, parsedAttachmentSchema, taskMetaSchema, pullRequestMetaSchema, agentUserIdentitySchema, workflowToolRefSchema, relevantContextRecallSchema, runPromptContextSchema;
19996
+ var canonicalUserMessageSchema, canonicalAssistantMessageSchema, externalMcpServerSchema, runAttachmentSchema, parsedAttachmentSchema, taskMetaSchema, pullRequestMetaSchema, agentUserIdentitySchema, workflowToolRefSchema, runPromptContextSchema;
19997
19997
  var init_run_context = __esm({
19998
19998
  "../shared/dist/runtime-v2/run-context.js"() {
19999
19999
  "use strict";
@@ -20099,7 +20099,6 @@ var init_run_context = __esm({
20099
20099
  }));
20100
20100
  agentUserIdentitySchema = wire()(external_exports.object({ id: external_exports.string().min(1), name: external_exports.string().nullable(), email: external_exports.string() }));
20101
20101
  workflowToolRefSchema = wire()(external_exports.object({ type: external_exports.string().min(1), id: external_exports.string().min(1) }));
20102
- relevantContextRecallSchema = wire()(external_exports.object({ query: external_exports.string(), envelope: external_exports.record(external_exports.string(), external_exports.unknown()) }));
20103
20102
  runPromptContextSchema = external_exports.object({
20104
20103
  taskMeta: taskMetaSchema.optional(),
20105
20104
  prMeta: pullRequestMetaSchema.optional(),
@@ -20353,10 +20352,8 @@ var init_desired_state = __esm({
20353
20352
  promptContext: runPromptContextSchema.optional(),
20354
20353
  /** Absent means entitled, so a spec from an older server keeps the code-index prompts. */
20355
20354
  codeIndexEnabled: external_exports.boolean().optional(),
20356
- /** Absent means entitled, so a spec from an older server keeps the context-search prompt. */
20355
+ /** Omitted by older servers; only an explicit entitlement enables context-search guidance. */
20357
20356
  contextGraphEnabled: external_exports.boolean().optional(),
20358
- /** Already appended to `content` as `<relevantContext>`; the holder records it as a recall. */
20359
- relevantContext: relevantContextRecallSchema.optional(),
20360
20357
  cloudEnvironmentId: external_exports.guid().optional(),
20361
20358
  localRepoUrls: external_exports.array(external_exports.string().min(1)).optional()
20362
20359
  // Never here: the provider API key. The holder fetches it per run (RUN_PROVIDER_CREDENTIAL_PATH).
@@ -21299,11 +21296,8 @@ var init_workflow_tools_filter = __esm({
21299
21296
  "create_test_report",
21300
21297
  "create_plan",
21301
21298
  "create_document_artifact",
21302
- "upsert_prototype_version",
21303
21299
  "list_artifacts",
21304
- "get_artifact",
21305
- "list_prototypes",
21306
- "get_prototype"
21300
+ "get_artifact"
21307
21301
  ];
21308
21302
  LEGACY_WORKFLOW_BUILTIN_TOOLS = {
21309
21303
  list_document_comments: "get_document",
@@ -21377,7 +21371,7 @@ Use these tools, in roughly this order of frequency:
21377
21371
  4. \`get_session_context\` \u2014 check what a worker accomplished
21378
21372
  5. \`update_task\` \u2014 keep status, priority, labels current
21379
21373
  6. \`send_session_message\` / \`start_task_session\` \u2014 continue a specific session or force a new session only when needed
21380
- 7. \`list_sessions\` / \`find_records\` / \`search_context\` / \`search_code_context\` / \`Read\` / \`Glob\` / \`Grep\` \u2014 situational awareness (\`find_records\` locates canonical records; \`search_context\` finds relevant non-code context whose exact source is unknown; \`search_code_context\` handles source-code discovery; read exact cited sources before claiming authoritative details)
21374
+ 7. \`list_sessions\` / \`find_records\` / \`search_code_context\` / \`Read\` / \`Glob\` / \`Grep\` \u2014 situational awareness (\`find_records\` locates canonical records; \`search_code_context\` handles source-code discovery; read exact cited sources before claiming authoritative details)
21381
21375
  8. \`create_plan\` \u2014 document implementation plans and durable specs as artifacts
21382
21376
  9. \`add_task_comment\` \u2014 human-facing collaboration: answer questions, post explicit status updates, escalate blockers, or leave comments the user asked you to post. Do not use comments as running notes or context storage.
21383
21377
 
@@ -21452,8 +21446,7 @@ You work on the Alan platform. The platform is where product truth lives: tasks,
21452
21446
  | Scope, status, priority, or history of work | \`get_task\`, \`list_subtasks\`, \`list_tasks\` | \`git log\`, commit messages |
21453
21447
  | What was decided and why | \`list_task_decisions\`, \`list_task_events\` | code comments, in-repo ADRs |
21454
21448
  | What an agent did or is doing | \`list_sessions\`, \`get_session_context\` | \`git log\`, diffing the worktree |
21455
- | Prior agent context | \`search_context\`, \`list_task_events\`, \`get_session_context\` | scratch files |
21456
- | Relevant non-code context with no exact source | \`search_context\` | guessing IDs, container tags, or provider filters |
21449
+ | Prior agent context | \`list_task_events\`, \`get_session_context\` | scratch files |
21457
21450
  | Outputs of completed work | \`list_artifacts\`, \`get_artifact\` | build output, generated files |
21458
21451
  | Where code lives or how it works | \`search_code_context\` first, then \`Read\` the cited files | \`Grep\`/\`Glob\` sweeps |
21459
21452
 
@@ -21482,8 +21475,7 @@ Use these tools, in roughly this order of frequency:
21482
21475
  4. \`get_session_context\` / \`list_sessions\` \u2014 track progress
21483
21476
  5. \`update_task\` \u2014 keep status and priority current
21484
21477
  6. \`list_task_events\` / \`add_task_event\` \u2014 persist only high-signal human-readable decisions, learnings, checkpoints, and outcomes in the Agent Log
21485
- 7. \`search_context\` \u2014 retrieve relevant non-code context when the exact source is unknown
21486
- 8. \`add_task_comment\` \u2014 human-facing collaboration: answer questions, post explicit status updates, escalate blockers, or leave comments the user asked you to post. Do not use comments as running notes or context storage.
21478
+ 7. \`add_task_comment\` \u2014 human-facing collaboration: answer questions, post explicit status updates, escalate blockers, or leave comments the user asked you to post. Do not use comments as running notes or context storage.
21487
21479
 
21488
21480
  ## How to think like a PM
21489
21481
 
@@ -21684,13 +21676,6 @@ var init_browser_surface = __esm({
21684
21676
  }
21685
21677
  });
21686
21678
 
21687
- // ../shared/dist/agent/context-intent.js
21688
- var init_context_intent = __esm({
21689
- "../shared/dist/agent/context-intent.js"() {
21690
- "use strict";
21691
- }
21692
- });
21693
-
21694
21679
  // ../shared/dist/agent/gated-mcp-tools.js
21695
21680
  var CODE_INDEX_MCP_TOOLS, CONTEXT_GRAPH_MCP_TOOLS, ENTITLEMENT_GATED_MCP_TOOLS;
21696
21681
  var init_gated_mcp_tools = __esm({
@@ -21954,13 +21939,13 @@ var init_system_prompt = __esm({
21954
21939
 
21955
21940
  The codebase records what the system does. It does not record why it is that way, what was ruled out, what an outside constraint forbids, or what someone was left owed. That record lives in \`search_context\` \u2014 this team's decisions, constraints, procedures, ownership, rejected approaches and unfinished work.
21956
21941
 
21942
+ Before answering or acting on a question about a past decision, ownership, history, or unfinished work whose exact source is unknown, call \`search_context\` first.
21943
+
21957
21944
  So when a turn depends on something the repository cannot tell you \u2014 a value chosen rather than tuned, an approach that may already have been tried, a boundary another team owns, work someone else left half-done \u2014 recover it before you answer or act. Reading the code, or the document someone named, does not settle it: those answer a different question, and one turn can need both.
21958
21945
 
21959
21946
  What comes back is the answer, not a step towards it. Carry its specifics into what you write or change \u2014 the value, the constraint, the reason, the person \u2014 and say plainly when the evidence contradicts what was asked for. Retrieving a decision and then producing work that ignores it is worse than never having searched, because it looks informed.
21960
21947
 
21961
- Skip it when nothing team-specific is at stake: source-code questions, general knowledge, mechanical work fully specified in the request, or an exact ID already in hand.
21962
-
21963
- A \`relevantContext\` block, when present, is evidence already retrieved. Use it, do not search again for what it answers, and do not mention that it was loaded.`;
21948
+ Skip it when nothing team-specific is at stake: source-code questions, general knowledge, mechanical work fully specified in the request, or an exact ID already in hand.`;
21964
21949
  ALAN_PLATFORM_TOOL_ROUTING_PROMPT = `## Alan platform tools
21965
21950
 
21966
21951
  When an action reads, creates, changes, links, sends, or controls Alan-owned state \u2014 or uses a provider identity connected through Alan \u2014 use the matching Alan MCP tool. This applies whether the agent runs locally or in the cloud. Do not substitute a shell CLI, browser automation, raw HTTP, or a local file; those paths bypass Alan's identity, authorization, audit trail, and task linkage.
@@ -22003,8 +21988,6 @@ Team
22003
21988
 
22004
21989
  ${ALAN_PLATFORM_TOOL_ROUTING_PROMPT}
22005
21990
 
22006
- ${ALAN_CONTEXT_SEARCH_PROMPT}
22007
-
22008
21991
  ## Record & Entity Resolution (Tasks, PRs, Docs, Epics)
22009
21992
 
22010
21993
  When the user refers to a specific task, pull request, document, or epic by human identifier (e.g. \`AL-2980\`, \`2980\`, \`#45\`), title, or topic phrase:
@@ -22147,7 +22130,6 @@ var init_agent2 = __esm({
22147
22130
  init_agent_definitions();
22148
22131
  init_attachment_mention();
22149
22132
  init_browser_surface();
22150
- init_context_intent();
22151
22133
  init_gated_mcp_tools();
22152
22134
  init_generated_images();
22153
22135
  init_iframe_embeddability();
@@ -22238,7 +22220,7 @@ var init_chunk_YXWJW7I5 = __esm({
22238
22220
  }
22239
22221
  });
22240
22222
 
22241
- // ../agent-core/dist/chunk-VZIZDY3T.js
22223
+ // ../agent-core/dist/chunk-NDAB5G24.js
22242
22224
  function windowsEnvValue(env, name) {
22243
22225
  const wanted = name.toLowerCase();
22244
22226
  for (const [key, value] of Object.entries(env)) {
@@ -22362,6 +22344,12 @@ function planSpawn({ command, args, env, platform, files }) {
22362
22344
  if (launch === void 0) {
22363
22345
  throw new CoreFault("spawn_failed", `Could not start ${command} (not found on PATH)`);
22364
22346
  }
22347
+ if (launch.kind === "batch") {
22348
+ throw new CoreFault(
22349
+ "spawn_failed",
22350
+ `${command} resolves to a batch file that cannot run as a managed Windows agent; install its native executable or supported npm shim`
22351
+ );
22352
+ }
22365
22353
  return { file: launch.file, args: launch.args, commandLine: windowsCommandLine(launch, env) };
22366
22354
  }
22367
22355
  function planDirectLaunch({
@@ -22693,45 +22681,90 @@ function createProcessTree(child, options = {}) {
22693
22681
  }
22694
22682
  };
22695
22683
  }
22696
- function bridgeScript(ownerPid) {
22697
- return [
22698
- "$ErrorActionPreference = 'Stop'",
22699
- "$ProgressPreference = 'SilentlyContinue'",
22700
- `Add-Type -TypeDefinition @'
22701
- ${BRIDGE_SOURCE}
22702
- '@`,
22703
- `exit [AlanProviderJob]::Run($env:${JOB_COMMAND_VARIABLE}, ${ownerPid})`
22704
- ].join("\n");
22684
+ function providerEnvironment(env) {
22685
+ const unique = /* @__PURE__ */ new Map();
22686
+ for (const [name, value] of Object.entries(env)) {
22687
+ if (/^ALAN_JOB_(FILE|COMMAND|STATUS)$/i.test(name) || /^ALAN_WINHELPER_PATH$/i.test(name))
22688
+ continue;
22689
+ unique.set(name.toLowerCase(), [name, value]);
22690
+ }
22691
+ return Object.fromEntries(unique.values());
22705
22692
  }
22706
- function windowsJobBridge(commandLine, options) {
22707
- const systemRoot = windowsEnvValue(options.env, "SystemRoot") ?? "C:\\Windows";
22708
- const script = bridgeScript(options.ownerPid ?? process.pid);
22709
- return {
22710
- file: import_path2.win32.join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
22711
- args: [
22712
- "-NoLogo",
22713
- "-NoProfile",
22714
- "-NonInteractive",
22715
- "-ExecutionPolicy",
22716
- "Bypass",
22717
- "-EncodedCommand",
22718
- Buffer.from(script, "utf16le").toString("base64")
22719
- ],
22720
- env: { ...options.env, [JOB_COMMAND_VARIABLE]: commandLine }
22721
- };
22693
+ function requireStartedProvider(response, command) {
22694
+ if (response.startsWith("error:")) {
22695
+ throw new CoreFault("spawn_failed", `Could not start ${command} (${response.slice(6)})`);
22696
+ }
22697
+ if (!/^\d+$/.test(response)) {
22698
+ throw new CoreFault("spawn_failed", `Could not start ${command} (invalid helper response)`);
22699
+ }
22700
+ }
22701
+ function isWindowsJob(child) {
22702
+ return statuses.has(child);
22703
+ }
22704
+ function helperFile(env) {
22705
+ const override = Object.entries(env).find(([name]) => /^ALAN_WINHELPER_PATH$/i.test(name))?.[1];
22706
+ if (override) return override;
22707
+ const entry = process.argv[1];
22708
+ if (!entry) throw new CoreFault("spawn_failed", "Cannot locate the Windows agent helper");
22709
+ return (0, import_path2.join)((0, import_path2.dirname)(entry), "alan-winhelper.exe");
22722
22710
  }
22723
22711
  function spawnInWindowsJob(plan2, options) {
22724
22712
  if (plan2.commandLine === null) {
22725
22713
  throw new CoreFault("internal", `No Windows command line was planned for ${plan2.file}`);
22726
22714
  }
22727
- const bridge = windowsJobBridge(plan2.commandLine, options);
22728
- return (0, import_child_process6.spawn)(bridge.file, [...bridge.args], {
22715
+ const file2 = helperFile(options.env);
22716
+ const directory = (0, import_fs2.mkdtempSync)((0, import_path2.join)((0, import_os.tmpdir)(), `alan-job-${(0, import_crypto.randomUUID)()}-`));
22717
+ const path = (0, import_path2.join)(directory, "started");
22718
+ const child = (0, import_child_process6.spawn)(file2, [String(process.pid)], {
22729
22719
  cwd: options.cwd,
22730
- env: { ...bridge.env },
22720
+ env: {
22721
+ ...providerEnvironment(options.env),
22722
+ ALAN_JOB_FILE: plan2.file,
22723
+ ALAN_JOB_COMMAND: plan2.commandLine,
22724
+ ALAN_JOB_STATUS: path
22725
+ },
22731
22726
  stdio: ["pipe", "pipe", "pipe"],
22732
22727
  shell: false,
22733
22728
  windowsHide: true
22734
22729
  });
22730
+ const status = { directory, path };
22731
+ child.once("error", (error61) => {
22732
+ status.error = error61;
22733
+ });
22734
+ statuses.set(child, status);
22735
+ return child;
22736
+ }
22737
+ async function waitForWindowsJob(child, command) {
22738
+ const status = statuses.get(child);
22739
+ if (!status) throw new CoreFault("internal", "Missing Windows helper startup state");
22740
+ const deadline = systemClock2.monotonic() + START_TIMEOUT_MS;
22741
+ try {
22742
+ while (systemClock2.monotonic() < deadline) {
22743
+ const providerPid = await (0, import_promises6.readFile)(status.path, "utf8").catch(() => void 0);
22744
+ if (providerPid !== void 0) {
22745
+ requireStartedProvider(providerPid, command);
22746
+ return;
22747
+ }
22748
+ if (status.error) {
22749
+ throw new CoreFault(
22750
+ "spawn_failed",
22751
+ `Could not start ${command} (${status.error.message})`,
22752
+ {
22753
+ cause: status.error
22754
+ }
22755
+ );
22756
+ }
22757
+ if (child.exitCode !== null || child.signalCode !== null) {
22758
+ throw new CoreFault("spawn_failed", `Could not start ${command} (Windows helper exited)`);
22759
+ }
22760
+ await systemClock2.sleep(25);
22761
+ }
22762
+ child.kill("SIGKILL");
22763
+ throw new CoreFault("spawn_failed", `Could not start ${command} (Windows helper timed out)`);
22764
+ } finally {
22765
+ statuses.delete(child);
22766
+ await (0, import_promises6.rm)(status.directory, { recursive: true, force: true });
22767
+ }
22735
22768
  }
22736
22769
  function spawnCli(options) {
22737
22770
  const platform = options.platform ?? process.platform;
@@ -22746,6 +22779,7 @@ function spawnCli(options) {
22746
22779
  });
22747
22780
  }
22748
22781
  function waitForSpawn(child, command) {
22782
+ if (isWindowsJob(child)) return waitForWindowsJob(child, command);
22749
22783
  if (child.pid !== void 0) return Promise.resolve();
22750
22784
  return new Promise((resolve4, reject) => {
22751
22785
  const onSpawn = () => {
@@ -22763,9 +22797,9 @@ function waitForSpawn(child, command) {
22763
22797
  child.once("error", onError);
22764
22798
  });
22765
22799
  }
22766
- var import_child_process, import_fs, import_path, import_child_process2, import_promises5, import_child_process3, import_child_process4, import_child_process5, import_child_process6, import_path2, SHIM_MAX_BYTES, CMD_MAX_COMMAND_LINE, MAX_COMMAND_LINE, DEFAULT_PATHEXT, nodeWindowsFiles, NODE_SHIM_ENTRY, CMD_META, NEVER_STARTED, HIDDEN_FLAG_PROBE_VALUE, NEWLINE, CARRIAGE_RETURN, EMPTY, MAX_LINE_BYTES, LineSplitter, PS_LINE, POLL_MS, DEFAULT_GRACE_MS, DEFAULT_KILL_WAIT_MS, DEFAULT_TASKKILL_TIMEOUT_MS, JOB_COMMAND_VARIABLE, BRIDGE_SOURCE;
22767
- var init_chunk_VZIZDY3T = __esm({
22768
- "../agent-core/dist/chunk-VZIZDY3T.js"() {
22800
+ var import_child_process, import_fs, import_path, import_child_process2, import_promises5, import_child_process3, import_child_process4, import_child_process5, import_child_process6, import_crypto, import_fs2, import_promises6, import_os, import_path2, SHIM_MAX_BYTES, CMD_MAX_COMMAND_LINE, MAX_COMMAND_LINE, DEFAULT_PATHEXT, nodeWindowsFiles, NODE_SHIM_ENTRY, CMD_META, NEVER_STARTED, HIDDEN_FLAG_PROBE_VALUE, NEWLINE, CARRIAGE_RETURN, EMPTY, MAX_LINE_BYTES, LineSplitter, PS_LINE, POLL_MS, DEFAULT_GRACE_MS, DEFAULT_KILL_WAIT_MS, DEFAULT_TASKKILL_TIMEOUT_MS, statuses, START_TIMEOUT_MS;
22801
+ var init_chunk_NDAB5G24 = __esm({
22802
+ "../agent-core/dist/chunk-NDAB5G24.js"() {
22769
22803
  "use strict";
22770
22804
  init_chunk_YXWJW7I5();
22771
22805
  import_child_process = require("child_process");
@@ -22777,6 +22811,10 @@ var init_chunk_VZIZDY3T = __esm({
22777
22811
  import_child_process4 = require("child_process");
22778
22812
  import_child_process5 = require("child_process");
22779
22813
  import_child_process6 = require("child_process");
22814
+ import_crypto = require("crypto");
22815
+ import_fs2 = require("fs");
22816
+ import_promises6 = require("fs/promises");
22817
+ import_os = require("os");
22780
22818
  import_path2 = require("path");
22781
22819
  SHIM_MAX_BYTES = 64 * 1024;
22782
22820
  CMD_MAX_COMMAND_LINE = 8191;
@@ -22848,87 +22886,8 @@ var init_chunk_VZIZDY3T = __esm({
22848
22886
  DEFAULT_GRACE_MS = 3e3;
22849
22887
  DEFAULT_KILL_WAIT_MS = 2e3;
22850
22888
  DEFAULT_TASKKILL_TIMEOUT_MS = 5e3;
22851
- JOB_COMMAND_VARIABLE = "ALAN_PROVIDER_JOB_COMMAND";
22852
- BRIDGE_SOURCE = `
22853
- using System;
22854
- using System.Text;
22855
- using System.Runtime.InteropServices;
22856
- using System.ComponentModel;
22857
- public static class AlanProviderJob {
22858
- [StructLayout(LayoutKind.Sequential)] struct IO { public ulong a,b,c,d,e,f; }
22859
- [StructLayout(LayoutKind.Sequential)] struct Limits {
22860
- public long perProcess, perJob; public uint flags;
22861
- public UIntPtr minWorkingSet, maxWorkingSet; public uint activeProcesses;
22862
- public UIntPtr affinity; public uint priority, scheduling;
22863
- }
22864
- [StructLayout(LayoutKind.Sequential)] struct ExtendedLimits {
22865
- public Limits basic; public IO io;
22866
- public UIntPtr processMemory, jobMemory, peakProcessMemory, peakJobMemory;
22867
- }
22868
- [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] struct Startup {
22869
- public uint cb; public string reserved, desktop, title;
22870
- public uint x,y,xSize,ySize,xChars,yChars,fill,flags;
22871
- public ushort show,reservedSize; public IntPtr reserved2, stdin, stdout, stderr;
22872
- }
22873
- [StructLayout(LayoutKind.Sequential)] struct ProcessInfo {
22874
- public IntPtr process, thread; public uint pid, tid;
22875
- }
22876
- [DllImport("kernel32.dll", SetLastError=true)] static extern IntPtr CreateJobObject(IntPtr security, string name);
22877
- [DllImport("kernel32.dll", SetLastError=true)] static extern bool SetInformationJobObject(IntPtr job, int kind, ref ExtendedLimits limits, uint size);
22878
- [DllImport("kernel32.dll", SetLastError=true)] static extern bool AssignProcessToJobObject(IntPtr job, IntPtr process);
22879
- [DllImport("kernel32.dll", SetLastError=true)] static extern bool TerminateJobObject(IntPtr job, uint code);
22880
- [DllImport("kernel32.dll", SetLastError=true)] static extern bool TerminateProcess(IntPtr process, uint code);
22881
- [DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] static extern bool CreateProcess(string app, StringBuilder command, IntPtr ps, IntPtr ts, bool inherit, uint flags, IntPtr env, string cwd, ref Startup si, out ProcessInfo pi);
22882
- [DllImport("kernel32.dll")] static extern IntPtr GetStdHandle(int id);
22883
- [DllImport("kernel32.dll")] static extern IntPtr GetCurrentProcess();
22884
- [DllImport("kernel32.dll", SetLastError=true)] static extern bool DuplicateHandle(IntPtr sourceProcess, IntPtr source, IntPtr targetProcess, out IntPtr target, uint access, bool inherit, uint options);
22885
- [DllImport("kernel32.dll", SetLastError=true)] static extern uint ResumeThread(IntPtr thread);
22886
- [DllImport("kernel32.dll", SetLastError=true)] static extern IntPtr OpenProcess(uint access, bool inherit, int pid);
22887
- [DllImport("kernel32.dll", SetLastError=true)] static extern uint WaitForMultipleObjects(uint count, IntPtr[] handles, bool all, uint ms);
22888
- [DllImport("kernel32.dll")] static extern bool GetExitCodeProcess(IntPtr process, out uint code);
22889
- [DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr handle);
22890
- static void Check(bool ok) { if (!ok) throw new Win32Exception(Marshal.GetLastWin32Error()); }
22891
- static IntPtr CopyStd(int id) {
22892
- IntPtr result; var self = GetCurrentProcess();
22893
- Check(DuplicateHandle(self, GetStdHandle(id), self, out result, 0, true, 2));
22894
- return result;
22895
- }
22896
- public static int Run(string command, int ownerPid) {
22897
- Environment.SetEnvironmentVariable("${JOB_COMMAND_VARIABLE}", null);
22898
- IntPtr owner = OpenProcess(0x100000, false, ownerPid);
22899
- if (owner == IntPtr.Zero) throw new Win32Exception(Marshal.GetLastWin32Error());
22900
- IntPtr job = CreateJobObject(IntPtr.Zero, null);
22901
- if (job == IntPtr.Zero) { CloseHandle(owner); throw new Win32Exception(Marshal.GetLastWin32Error()); }
22902
- ProcessInfo pi = new ProcessInfo(); Startup si = new Startup();
22903
- try {
22904
- var limits = new ExtendedLimits(); limits.basic.flags = 0x2000;
22905
- Check(SetInformationJobObject(job, 9, ref limits, (uint)Marshal.SizeOf(limits)));
22906
- si.cb = (uint)Marshal.SizeOf(si); si.flags = 0x100;
22907
- si.stdin = CopyStd(-10); si.stdout = CopyStd(-11); si.stderr = CopyStd(-12);
22908
- Check(CreateProcess(null, new StringBuilder(command), IntPtr.Zero, IntPtr.Zero, true, 0x08000004, IntPtr.Zero, null, ref si, out pi));
22909
- if (!AssignProcessToJobObject(job, pi.process)) {
22910
- int error = Marshal.GetLastWin32Error(); TerminateProcess(pi.process, 1);
22911
- throw new Win32Exception(error);
22912
- }
22913
- if (ResumeThread(pi.thread) == 0xffffffff) throw new Win32Exception(Marshal.GetLastWin32Error());
22914
- uint wait = WaitForMultipleObjects(2, new IntPtr[] { pi.process, owner }, false, 0xffffffff);
22915
- if (wait == 1) return 1;
22916
- if (wait != 0) throw new Win32Exception(Marshal.GetLastWin32Error());
22917
- uint code; Check(GetExitCodeProcess(pi.process, out code));
22918
- Check(TerminateJobObject(job, code));
22919
- return unchecked((int)code);
22920
- } finally {
22921
- CloseHandle(job);
22922
- CloseHandle(owner);
22923
- if (pi.thread != IntPtr.Zero) CloseHandle(pi.thread);
22924
- if (pi.process != IntPtr.Zero) CloseHandle(pi.process);
22925
- if (si.stdin != IntPtr.Zero) CloseHandle(si.stdin);
22926
- if (si.stdout != IntPtr.Zero) CloseHandle(si.stdout);
22927
- if (si.stderr != IntPtr.Zero) CloseHandle(si.stderr);
22928
- }
22929
- }
22930
- }
22931
- `;
22889
+ statuses = /* @__PURE__ */ new WeakMap();
22890
+ START_TIMEOUT_MS = 1e4;
22932
22891
  }
22933
22892
  });
22934
22893
 
@@ -23737,7 +23696,7 @@ var init_acp = __esm({
23737
23696
  }
23738
23697
  });
23739
23698
 
23740
- // ../agent-core/dist/chunk-OUQ7HMD3.js
23699
+ // ../agent-core/dist/chunk-UGRKZTAD.js
23741
23700
  function textBlock(text2) {
23742
23701
  return { type: "text", text: text2 };
23743
23702
  }
@@ -23765,18 +23724,6 @@ function noticeUpdate(severity, kind, title, description) {
23765
23724
  _meta: { [NOTICE_KIND_META]: kind }
23766
23725
  };
23767
23726
  }
23768
- function contextRecallUpdate(toolCallId, recall) {
23769
- return {
23770
- sessionUpdate: "tool_call_update",
23771
- toolCallId,
23772
- name: "search_context",
23773
- kind: "search",
23774
- status: "completed",
23775
- rawInput: { query: recall.query },
23776
- rawOutput: JSON.stringify(recall.envelope),
23777
- _meta: { [CONTEXT_RECALL_META]: "prefetch" }
23778
- };
23779
- }
23780
23727
  function usageUpdate(breakdown, fallbackModel = "") {
23781
23728
  const used = (breakdown.inputTokens ?? 0) + (breakdown.outputTokens ?? 0) + (breakdown.cacheReadTokens ?? 0) + (breakdown.cacheCreationTokens ?? 0);
23782
23729
  const model = breakdown.model || fallbackModel;
@@ -23979,9 +23926,9 @@ function withoutInlineMedia(update) {
23979
23926
  ...nextRawOutput === rawOutput ? {} : { rawOutput: nextRawOutput }
23980
23927
  };
23981
23928
  }
23982
- var PROVIDER_PAYLOAD_META, TOOL_RESULT_ONLY_META, PARENT_TOOL_CALL_META, SUBAGENT_LAUNCHER_META, SUBAGENT_TASK_ID_META, SUBAGENT_OUTPUT_FILE_META, USAGE_META, TODOS_META, NOTICE_KIND_META, CONTEXT_RECALL_META, ASK_USER_QUESTIONS_META, USER_ANSWER_META, AWAITING_TOOL_CALLS_META, EXIT_PLAN_MODE_INPUT_META, BACKGROUND_TASK_META, TASK_PROGRESS_META, RATE_LIMIT_META, MODEL_META, TOOLS_META, SLASH_COMMANDS_META, TOOL_KIND_RULES, ANSWER_PREFIX, ACCEPT_WORDS, MIN_INLINE_MEDIA_CHARS, DATA_URL_PREFIX, BASE64_BODY;
23983
- var init_chunk_OUQ7HMD3 = __esm({
23984
- "../agent-core/dist/chunk-OUQ7HMD3.js"() {
23929
+ var PROVIDER_PAYLOAD_META, TOOL_RESULT_ONLY_META, PARENT_TOOL_CALL_META, SUBAGENT_LAUNCHER_META, SUBAGENT_TASK_ID_META, SUBAGENT_OUTPUT_FILE_META, USAGE_META, TODOS_META, NOTICE_KIND_META, ASK_USER_QUESTIONS_META, USER_ANSWER_META, AWAITING_TOOL_CALLS_META, EXIT_PLAN_MODE_INPUT_META, BACKGROUND_TASK_META, TASK_PROGRESS_META, RATE_LIMIT_META, MODEL_META, TOOLS_META, SLASH_COMMANDS_META, TOOL_KIND_RULES, ANSWER_PREFIX, ACCEPT_WORDS, MIN_INLINE_MEDIA_CHARS, DATA_URL_PREFIX, BASE64_BODY;
23930
+ var init_chunk_UGRKZTAD = __esm({
23931
+ "../agent-core/dist/chunk-UGRKZTAD.js"() {
23985
23932
  "use strict";
23986
23933
  init_chunk_YXWJW7I5();
23987
23934
  init_constants();
@@ -23995,7 +23942,6 @@ var init_chunk_OUQ7HMD3 = __esm({
23995
23942
  USAGE_META = "alan.dev/usage";
23996
23943
  TODOS_META = "alan.dev/todos";
23997
23944
  NOTICE_KIND_META = "alan.dev/noticeKind";
23998
- CONTEXT_RECALL_META = "alan.dev/contextRecall";
23999
23945
  ASK_USER_QUESTIONS_META = "alan.dev/askUserQuestions";
24000
23946
  USER_ANSWER_META = "alan.dev/userAnswer";
24001
23947
  AWAITING_TOOL_CALLS_META = "alan.dev/awaitingToolCallIds";
@@ -24032,19 +23978,19 @@ var init_chunk_OUQ7HMD3 = __esm({
24032
23978
  var init_acp2 = __esm({
24033
23979
  "../agent-core/dist/acp.js"() {
24034
23980
  "use strict";
24035
- init_chunk_OUQ7HMD3();
23981
+ init_chunk_UGRKZTAD();
24036
23982
  init_chunk_YXWJW7I5();
24037
23983
  }
24038
23984
  });
24039
23985
 
24040
- // ../agent-core/dist/chunk-LR52JUGL.js
24041
- var import_fs2, NEWLINE2, TranscriptCursor, TranscriptLineLookup;
24042
- var init_chunk_LR52JUGL = __esm({
24043
- "../agent-core/dist/chunk-LR52JUGL.js"() {
23986
+ // ../agent-core/dist/chunk-DALFHI4B.js
23987
+ var import_fs3, NEWLINE2, TranscriptCursor, TranscriptLineLookup;
23988
+ var init_chunk_DALFHI4B = __esm({
23989
+ "../agent-core/dist/chunk-DALFHI4B.js"() {
24044
23990
  "use strict";
24045
- init_chunk_OUQ7HMD3();
23991
+ init_chunk_UGRKZTAD();
24046
23992
  init_chunk_YXWJW7I5();
24047
- import_fs2 = require("fs");
23993
+ import_fs3 = require("fs");
24048
23994
  NEWLINE2 = 10;
24049
23995
  TranscriptCursor = class {
24050
23996
  #path;
@@ -24062,7 +24008,7 @@ var init_chunk_LR52JUGL = __esm({
24062
24008
  try {
24063
24009
  this.#offset = Math.max(
24064
24010
  this.#offset,
24065
- (0, import_fs2.statSync)(this.#path, { throwIfNoEntry: false })?.size ?? 0
24011
+ (0, import_fs3.statSync)(this.#path, { throwIfNoEntry: false })?.size ?? 0
24066
24012
  );
24067
24013
  } catch {
24068
24014
  }
@@ -24084,15 +24030,15 @@ var init_chunk_LR52JUGL = __esm({
24084
24030
  /** Runs on the CLI's stdout path, so an unreadable file reads as no new lines. */
24085
24031
  #unread() {
24086
24032
  try {
24087
- const size = (0, import_fs2.statSync)(this.#path, { throwIfNoEntry: false })?.size ?? 0;
24033
+ const size = (0, import_fs3.statSync)(this.#path, { throwIfNoEntry: false })?.size ?? 0;
24088
24034
  if (size <= this.#offset) return void 0;
24089
24035
  const buffer = Buffer.alloc(size - this.#offset);
24090
- const fd = (0, import_fs2.openSync)(this.#path, "r");
24036
+ const fd = (0, import_fs3.openSync)(this.#path, "r");
24091
24037
  try {
24092
- const read = (0, import_fs2.readSync)(fd, buffer, 0, buffer.length, this.#offset);
24038
+ const read = (0, import_fs3.readSync)(fd, buffer, 0, buffer.length, this.#offset);
24093
24039
  return buffer.subarray(0, read);
24094
24040
  } finally {
24095
- (0, import_fs2.closeSync)(fd);
24041
+ (0, import_fs3.closeSync)(fd);
24096
24042
  }
24097
24043
  } catch {
24098
24044
  return void 0;
@@ -24281,7 +24227,7 @@ function createCliProblem(classified, options) {
24281
24227
  return createAlanProblem({
24282
24228
  domain: "agent_cli",
24283
24229
  code: problemCodeFor(classified, options),
24284
- id: options.id ?? (0, import_crypto.randomUUID)(),
24230
+ id: options.id ?? (0, import_crypto2.randomUUID)(),
24285
24231
  title: terminal2 ? "Agent CLI run failed" : "Agent CLI problem observed",
24286
24232
  detail: classified.message,
24287
24233
  occurredAt: options.occurredAt,
@@ -24302,12 +24248,12 @@ function createCliProblem(classified, options) {
24302
24248
  ...classified.resetsAt ? { resetsAt: classified.resetsAt } : {}
24303
24249
  });
24304
24250
  }
24305
- var import_crypto, ERROR_SPECS, AGENT_ERROR_KINDS, STATUS_PREFIX, TEXT_RULES, CODEX_TIMEOUT_MESSAGE, CODEX_EXPIRED_MESSAGE, EPOCH_RESET, WORDED_RESET, COMMAND_NOT_FOUND, CODE_RULES, TEXT_REFINES, CLI_PROBLEM_CODE_BY_ERROR_KIND, KEY_REJECTION_KINDS;
24251
+ var import_crypto2, ERROR_SPECS, AGENT_ERROR_KINDS, STATUS_PREFIX, TEXT_RULES, CODEX_TIMEOUT_MESSAGE, CODEX_EXPIRED_MESSAGE, EPOCH_RESET, WORDED_RESET, COMMAND_NOT_FOUND, CODE_RULES, TEXT_REFINES, CLI_PROBLEM_CODE_BY_ERROR_KIND, KEY_REJECTION_KINDS;
24306
24252
  var init_chunk_R32NAS3B = __esm({
24307
24253
  "../agent-core/dist/chunk-R32NAS3B.js"() {
24308
24254
  "use strict";
24309
24255
  init_chunk_YXWJW7I5();
24310
- import_crypto = require("crypto");
24256
+ import_crypto2 = require("crypto");
24311
24257
  init_agent2();
24312
24258
  ERROR_SPECS = {
24313
24259
  model_mismatch: {
@@ -24542,7 +24488,7 @@ var init_chunk_R32NAS3B = __esm({
24542
24488
  }
24543
24489
  });
24544
24490
 
24545
- // ../agent-core/dist/chunk-2KE6BVIX.js
24491
+ // ../agent-core/dist/chunk-X5JKSBTB.js
24546
24492
  function collectStrings(value, out) {
24547
24493
  if (typeof value === "string") out.push(value);
24548
24494
  else if (Array.isArray(value)) for (const item of value) collectStrings(item, out);
@@ -24630,13 +24576,13 @@ function readMediaFiles(candidates2, cwd, mimeByExt, maxBytes) {
24630
24576
  const files = [];
24631
24577
  for (const candidate of candidates2) {
24632
24578
  const path = normalizePath(candidate, cwd);
24633
- if (!path || seen.has(path) || !(0, import_fs3.existsSync)(path)) continue;
24579
+ if (!path || seen.has(path) || !(0, import_fs4.existsSync)(path)) continue;
24634
24580
  seen.add(path);
24635
24581
  const mimeType = mimeByExt[(0, import_path3.extname)(path).toLowerCase()];
24636
24582
  if (!mimeType) continue;
24637
- const stat12 = (0, import_fs3.statSync)(path);
24583
+ const stat12 = (0, import_fs4.statSync)(path);
24638
24584
  if (!stat12.isFile() || stat12.size <= 0 || stat12.size > maxBytes) continue;
24639
- files.push({ path, mimeType, buffer: (0, import_fs3.readFileSync)(path) });
24585
+ files.push({ path, mimeType, buffer: (0, import_fs4.readFileSync)(path) });
24640
24586
  }
24641
24587
  return files;
24642
24588
  }
@@ -24911,16 +24857,16 @@ function silentStartError(name, timeoutMs) {
24911
24857
  message: `${name} printed nothing for ${seconds}s after it started and was stopped. Send your message again.`
24912
24858
  };
24913
24859
  }
24914
- var import_crypto2, import_fs3, 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;
24915
- var init_chunk_2KE6BVIX = __esm({
24916
- "../agent-core/dist/chunk-2KE6BVIX.js"() {
24860
+ 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;
24861
+ var init_chunk_X5JKSBTB = __esm({
24862
+ "../agent-core/dist/chunk-X5JKSBTB.js"() {
24917
24863
  "use strict";
24918
- init_chunk_OUQ7HMD3();
24864
+ init_chunk_UGRKZTAD();
24919
24865
  init_chunk_R32NAS3B();
24920
- init_chunk_VZIZDY3T();
24866
+ init_chunk_NDAB5G24();
24921
24867
  init_chunk_YXWJW7I5();
24922
- import_crypto2 = require("crypto");
24923
- import_fs3 = require("fs");
24868
+ import_crypto3 = require("crypto");
24869
+ import_fs4 = require("fs");
24924
24870
  import_path3 = require("path");
24925
24871
  init_agent2();
24926
24872
  init_acp();
@@ -24981,13 +24927,13 @@ var init_chunk_2KE6BVIX = __esm({
24981
24927
  }
24982
24928
  #payloadFields(file2, toolId) {
24983
24929
  return {
24984
- id: (0, import_crypto2.randomUUID)(),
24930
+ id: (0, import_crypto3.randomUUID)(),
24985
24931
  filename: (0, import_path3.basename)(file2.path),
24986
24932
  mimeType: file2.mimeType,
24987
24933
  size: file2.buffer.length,
24988
24934
  data: file2.buffer.toString("base64"),
24989
24935
  sourcePath: file2.path,
24990
- sourceHash: (0, import_crypto2.createHash)("sha256").update(file2.buffer).digest("hex"),
24936
+ sourceHash: (0, import_crypto3.createHash)("sha256").update(file2.buffer).digest("hex"),
24991
24937
  toolId,
24992
24938
  ts: this.#clock.now()
24993
24939
  };
@@ -25271,7 +25217,7 @@ function selectExternalMcpServers(spec) {
25271
25217
  return selected;
25272
25218
  }
25273
25219
  function headerEnvName(server, header) {
25274
- const fingerprint = (0, import_crypto3.createHash)("sha256").update(`${server}\0${header}`).digest("hex").slice(0, 12);
25220
+ const fingerprint = (0, import_crypto4.createHash)("sha256").update(`${server}\0${header}`).digest("hex").slice(0, 12);
25275
25221
  return `ALAN_MCP_HEADER_${fingerprint.toUpperCase()}`;
25276
25222
  }
25277
25223
  function deliverRemote(name, server, env) {
@@ -25335,7 +25281,7 @@ function managedMcpHeaders(identity) {
25335
25281
  }
25336
25282
  function credentialDigest(authorization) {
25337
25283
  if (authorization === void 0) return void 0;
25338
- return (0, import_crypto4.createHash)("sha256").update(authorization).digest("hex").slice(0, 16);
25284
+ return (0, import_crypto5.createHash)("sha256").update(authorization).digest("hex").slice(0, 16);
25339
25285
  }
25340
25286
  function canonicalizeManagedMcpServerName(serverName) {
25341
25287
  return RUN_SCOPED_SERVER.test(serverName) ? MANAGED_MCP_SERVER_NAME : serverName;
@@ -25347,30 +25293,30 @@ function canonicalizeManagedMcpToolName(toolName) {
25347
25293
  return flattened ? `mcp__${MANAGED_MCP_SERVER_NAME}__${flattened[1]}` : toolName;
25348
25294
  }
25349
25295
  async function writeSecretFile(name, contents) {
25350
- const dir = await (0, import_promises11.mkdtemp)((0, import_path4.join)((0, import_os.tmpdir)(), "alan-mcp-"));
25296
+ const dir = await (0, import_promises12.mkdtemp)((0, import_path4.join)((0, import_os2.tmpdir)(), "alan-mcp-"));
25351
25297
  const path = (0, import_path4.join)(dir, name);
25352
25298
  const remove = async () => {
25353
- await (0, import_promises11.rm)(dir, { recursive: true, force: true });
25299
+ await (0, import_promises12.rm)(dir, { recursive: true, force: true });
25354
25300
  };
25355
25301
  try {
25356
- await (0, import_promises11.writeFile)(path, contents, { mode: 384, flag: "wx" });
25302
+ await (0, import_promises12.writeFile)(path, contents, { mode: 384, flag: "wx" });
25357
25303
  } catch (error61) {
25358
25304
  await remove();
25359
25305
  throw error61;
25360
25306
  }
25361
25307
  return { path, remove, [Symbol.asyncDispose]: remove };
25362
25308
  }
25363
- var import_crypto3, import_crypto4, import_promises11, import_os, import_path4, MANAGED_MCP_SERVER_NAME, RUN_SCOPED_SERVER, NAMESPACED_RUN_TOOL, FLATTENED_RUN_TOOL;
25309
+ var import_crypto4, import_crypto5, import_promises12, import_os2, import_path4, MANAGED_MCP_SERVER_NAME, RUN_SCOPED_SERVER, NAMESPACED_RUN_TOOL, FLATTENED_RUN_TOOL;
25364
25310
  var init_chunk_J2KTV5FP = __esm({
25365
25311
  "../agent-core/dist/chunk-J2KTV5FP.js"() {
25366
25312
  "use strict";
25367
- import_crypto3 = require("crypto");
25368
- init_agent2();
25369
25313
  import_crypto4 = require("crypto");
25370
25314
  init_agent2();
25315
+ import_crypto5 = require("crypto");
25316
+ init_agent2();
25371
25317
  init_runtime_v2();
25372
- import_promises11 = require("fs/promises");
25373
- import_os = require("os");
25318
+ import_promises12 = require("fs/promises");
25319
+ import_os2 = require("os");
25374
25320
  import_path4 = require("path");
25375
25321
  MANAGED_MCP_SERVER_NAME = "alan";
25376
25322
  RUN_SCOPED_SERVER = /^alan-run-[a-f0-9]{16}$/;
@@ -25379,7 +25325,7 @@ var init_chunk_J2KTV5FP = __esm({
25379
25325
  }
25380
25326
  });
25381
25327
 
25382
- // ../agent-core/dist/chunk-NADPTUUJ.js
25328
+ // ../agent-core/dist/chunk-6WN2R725.js
25383
25329
  function truncate(value, limit) {
25384
25330
  const normalized2 = Array.from(value, (character) => {
25385
25331
  const code = character.charCodeAt(0);
@@ -25581,7 +25527,6 @@ function artifactIdsSection(owner) {
25581
25527
  const ids = artifactIds(owner);
25582
25528
  if (ids.length === 0) return void 0;
25583
25529
  const tools = ["create_plan", "create_document_artifact", "create_test_report"];
25584
- if (owner.taskId || owner.isWorkflowSession) tools.push("upsert_prototype_version");
25585
25530
  return [
25586
25531
  `When creating artifacts using MCP tools (${tools.join(", ")}), always pass these IDs:`,
25587
25532
  ...ids
@@ -25593,26 +25538,6 @@ function standaloneChatSection(owner) {
25593
25538
  }
25594
25539
  return "This is a standalone chat. For create_plan, create_document_artifact, and create_test_report, omit taskId and workflowId; conversationId is the artifact owner. Do not use create_document unless the user explicitly asks for a standalone team Document.";
25595
25540
  }
25596
- function prototypeScope(owner) {
25597
- if (owner.workflowId) {
25598
- return {
25599
- ids: "teamId, workflowId, workflowExecutionId, conversationId",
25600
- lookup: "list_prototypes (with workflowId) or get_prototype"
25601
- };
25602
- }
25603
- return owner.taskId ? { ids: "teamId, taskId, conversationId", lookup: "list_prototypes or get_prototype" } : void 0;
25604
- }
25605
- function prototypeSection(owner) {
25606
- if (!owner.conversationId || !owner.teamId) return void 0;
25607
- const scope = prototypeScope(owner);
25608
- if (!scope) return void 0;
25609
- return [
25610
- "## Prototype Artifacts",
25611
- "When the user asks to create, build, modify, or iterate on a prototype, do not create local prototype files such as prototype/index.html.",
25612
- `Instead, generate a Vite React TypeScript source snapshot and call the Alan MCP tool upsert_prototype_version with ${scope.ids}, title, sourceSnapshot, and packageJson.`,
25613
- `For follow-up changes to the same prototype, call ${scope.lookup} if needed, then call upsert_prototype_version again with the existing prototypeId and parentVersionId.`
25614
- ].join("\n");
25615
- }
25616
25541
  function contextSections(spec) {
25617
25542
  const owner = ownershipOf(spec);
25618
25543
  const context = spec.promptContext;
@@ -25621,8 +25546,7 @@ function contextSections(spec) {
25621
25546
  taskContextSection(context?.taskMeta),
25622
25547
  pullRequestSection(context?.prMeta),
25623
25548
  artifactIdsSection(owner),
25624
- standaloneChatSection(owner),
25625
- prototypeSection(owner)
25549
+ standaloneChatSection(owner)
25626
25550
  ].filter((section) => section !== void 0);
25627
25551
  }
25628
25552
  function taskLifecycleSection(spec) {
@@ -25672,7 +25596,7 @@ Prefer relative paths and keep your work scoped to this project.` : void 0;
25672
25596
  ]),
25673
25597
  append: present([
25674
25598
  ALAN_PLATFORM_TOOL_ROUTING_PROMPT,
25675
- spec.contextGraphEnabled === false ? void 0 : ALAN_CONTEXT_SEARCH_PROMPT,
25599
+ spec.contextGraphEnabled === true ? ALAN_CONTEXT_SEARCH_PROMPT : void 0,
25676
25600
  overlay
25677
25601
  ])
25678
25602
  };
@@ -25728,8 +25652,8 @@ ${body}` : body;
25728
25652
  return spec.mode === "plan" ? planModePrefix(prefixed) : prefixed;
25729
25653
  }
25730
25654
  var MAX_PARSED_ATTACHMENTS, MAX_PARSED_ATTACHMENT_CHARS, MAX_METADATA_CHARS, UNAVAILABLE, READ_ONLY_MODES, AGENT_MODES;
25731
- var init_chunk_NADPTUUJ = __esm({
25732
- "../agent-core/dist/chunk-NADPTUUJ.js"() {
25655
+ var init_chunk_6WN2R725 = __esm({
25656
+ "../agent-core/dist/chunk-6WN2R725.js"() {
25733
25657
  "use strict";
25734
25658
  init_agent2();
25735
25659
  MAX_PARSED_ATTACHMENTS = 3;
@@ -26707,7 +26631,7 @@ function encodeProjectDir(cwd) {
26707
26631
  }
26708
26632
  function realCwd(cwd) {
26709
26633
  try {
26710
- return (0, import_fs4.realpathSync)(cwd);
26634
+ return (0, import_fs5.realpathSync)(cwd);
26711
26635
  } catch {
26712
26636
  return cwd;
26713
26637
  }
@@ -26721,12 +26645,12 @@ function claudeSessionLogExists(query) {
26721
26645
  encodeProjectDir(cwd),
26722
26646
  `${query.sessionId}.jsonl`
26723
26647
  );
26724
- if ((0, import_fs4.existsSync)(log)) return true;
26648
+ if ((0, import_fs5.existsSync)(log)) return true;
26725
26649
  }
26726
26650
  return false;
26727
26651
  }
26728
26652
  function envDigest(env) {
26729
- const hash2 = (0, import_crypto6.createHash)("sha256");
26653
+ const hash2 = (0, import_crypto7.createHash)("sha256");
26730
26654
  for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
26731
26655
  return hash2.digest("hex");
26732
26656
  }
@@ -26789,35 +26713,35 @@ async function claudeTurnInput(run, context) {
26789
26713
  const encoded = await Promise.all(
26790
26714
  images.map(async (image) => ({
26791
26715
  mimeType: image.mimeType,
26792
- data: (await (0, import_promises12.readFile)(image.path)).toString("base64")
26716
+ data: (await (0, import_promises13.readFile)(image.path)).toString("base64")
26793
26717
  }))
26794
26718
  );
26795
26719
  return { turnId: run.runId, text: text2, ...encoded.length ? { images: encoded } : {} };
26796
26720
  }
26797
- var import_crypto5, import_fs4, import_path5, import_crypto6, import_promises12, EDIT_TOOLS, ThoughtBlocks, UNDERSTOOD_SYSTEM_SUBTYPES, RATE_LIMIT_WARN_AT, CLAUDE_GRAMMAR_NAME, SUBAGENT_TOOL_NAMES, PLAN_ENTRY_STATUSES, controlResponseSchema, STOPPED_STATUSES, TaskRecords, TERMINAL_BACKGROUND_STATUSES, NON_TERMINAL_BACKGROUND_STATUSES, ASYNC_LAUNCH_ACK, BackgroundTasks, FAILED_STATUSES, STOPPED_BY_USER_TEXT, ClaudeTurn, STDERR_TAIL_LINES2, MAX_EARLY_LINES, UNSUPPORTED_STOP, OUTPUT_CLOSED_REASON, ClaudeSession, DEFAULTS, READ_ONLY_DISALLOWED_TOOLS, DEFAULT_MCP_TIMEOUT_MS;
26721
+ var import_crypto6, import_fs5, import_path5, import_crypto7, import_promises13, EDIT_TOOLS, ThoughtBlocks, UNDERSTOOD_SYSTEM_SUBTYPES, RATE_LIMIT_WARN_AT, CLAUDE_GRAMMAR_NAME, SUBAGENT_TOOL_NAMES, PLAN_ENTRY_STATUSES, controlResponseSchema, STOPPED_STATUSES, TaskRecords, TERMINAL_BACKGROUND_STATUSES, NON_TERMINAL_BACKGROUND_STATUSES, ASYNC_LAUNCH_ACK, BackgroundTasks, FAILED_STATUSES, STOPPED_BY_USER_TEXT, ClaudeTurn, STDERR_TAIL_LINES2, MAX_EARLY_LINES, UNSUPPORTED_STOP, OUTPUT_CLOSED_REASON, ClaudeSession, DEFAULTS, READ_ONLY_DISALLOWED_TOOLS, DEFAULT_MCP_TIMEOUT_MS;
26798
26722
  var init_claude = __esm({
26799
26723
  "../agent-core/dist/providers/claude.js"() {
26800
26724
  "use strict";
26801
- init_chunk_LR52JUGL();
26802
- init_chunk_2KE6BVIX();
26803
- init_chunk_OUQ7HMD3();
26725
+ init_chunk_DALFHI4B();
26726
+ init_chunk_X5JKSBTB();
26727
+ init_chunk_UGRKZTAD();
26804
26728
  init_chunk_R32NAS3B();
26805
26729
  init_chunk_J2KTV5FP();
26806
- init_chunk_VZIZDY3T();
26807
- init_chunk_NADPTUUJ();
26730
+ init_chunk_NDAB5G24();
26731
+ init_chunk_6WN2R725();
26808
26732
  init_chunk_YXWJW7I5();
26809
26733
  init_effort();
26810
- import_crypto5 = require("crypto");
26734
+ import_crypto6 = require("crypto");
26811
26735
  init_constants();
26812
26736
  init_zod();
26813
26737
  init_acp();
26814
26738
  init_acp();
26815
26739
  init_constants();
26816
26740
  init_agent2();
26817
- import_fs4 = require("fs");
26741
+ import_fs5 = require("fs");
26818
26742
  import_path5 = require("path");
26819
- import_crypto6 = require("crypto");
26820
- import_promises12 = require("fs/promises");
26743
+ import_crypto7 = require("crypto");
26744
+ import_promises13 = require("fs/promises");
26821
26745
  init_agent2();
26822
26746
  EDIT_TOOLS = /* @__PURE__ */ new Set([
26823
26747
  "Edit",
@@ -27459,7 +27383,7 @@ var init_claude = __esm({
27459
27383
  sessionId: this.#lastTurn.grammar.sessionId,
27460
27384
  taskRecords: this.#taskRecords
27461
27385
  });
27462
- const messageId = this.#replaysUserMessages ? (0, import_crypto5.randomUUID)() : void 0;
27386
+ const messageId = this.#replaysUserMessages ? (0, import_crypto6.randomUUID)() : void 0;
27463
27387
  const active = this.#startTurn(input2.turnId, turn, messageId);
27464
27388
  this.#host.writer.write(claudeUserMessage(input2, messageId)).catch((error61) => {
27465
27389
  this.#options.log.warn("claude.stdin_write_failed", { turnId: input2.turnId, error: error61 });
@@ -27854,7 +27778,7 @@ function codexHomeOf(env) {
27854
27778
  }
27855
27779
  function namesNewestFirst(dir, isDir) {
27856
27780
  try {
27857
- return (0, import_fs5.readdirSync)(dir, { withFileTypes: true }).filter((entry) => isDir ? entry.isDirectory() : entry.isFile()).map((entry) => entry.name).sort().reverse();
27781
+ return (0, import_fs6.readdirSync)(dir, { withFileTypes: true }).filter((entry) => isDir ? entry.isDirectory() : entry.isFile()).map((entry) => entry.name).sort().reverse();
27858
27782
  } catch {
27859
27783
  return [];
27860
27784
  }
@@ -28034,7 +27958,7 @@ function codexGeneratedImage(payload, ts) {
28034
27958
  const declared = asString(payload.mimeType) || asString(payload.mime_type);
28035
27959
  const mimeType = declared.startsWith("image/") ? declared : inferImageMimeType(buffer);
28036
27960
  if (!mimeType) return null;
28037
- const sourceHash = (0, import_crypto7.createHash)("sha256").update(buffer).digest("hex");
27961
+ const sourceHash = (0, import_crypto8.createHash)("sha256").update(buffer).digest("hex");
28038
27962
  const toolId = asString(payload.call_id);
28039
27963
  const id = asString(payload.id) || toolId || sourceHash;
28040
27964
  const sourcePath = asString(payload.sourcePath);
@@ -28085,7 +28009,7 @@ function basenameOf(path) {
28085
28009
  return path.split(/[\\/]/).at(-1) ?? "";
28086
28010
  }
28087
28011
  function mayMatter(line) {
28088
- return line.includes("image_gen") || line.includes('"task_complete"') || line.includes('"turn_aborted"');
28012
+ return line.includes("image_gen");
28089
28013
  }
28090
28014
  function imageKey(update) {
28091
28015
  if (update.sessionUpdate !== "_alan/generated_image") return void 0;
@@ -28816,7 +28740,7 @@ function createCodexExecDriver(options = {}) {
28816
28740
  };
28817
28741
  }
28818
28742
  function envDigest2(env) {
28819
- const hash2 = (0, import_crypto8.createHash)("sha256");
28743
+ const hash2 = (0, import_crypto9.createHash)("sha256");
28820
28744
  for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
28821
28745
  return hash2.digest("hex");
28822
28746
  }
@@ -28857,7 +28781,7 @@ function planCodexExecSession(run, context) {
28857
28781
  };
28858
28782
  }
28859
28783
  function envDigest22(env) {
28860
- const hash2 = (0, import_crypto9.createHash)("sha256");
28784
+ const hash2 = (0, import_crypto10.createHash)("sha256");
28861
28785
  for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
28862
28786
  return hash2.digest("hex");
28863
28787
  }
@@ -28926,26 +28850,26 @@ function codexTurnInput(run, context) {
28926
28850
  ...images.length ? { imagePaths: images.map((image) => image.path) } : {}
28927
28851
  };
28928
28852
  }
28929
- var import_fs5, import_path6, import_crypto7, import_crypto8, import_crypto9, TokenRefresher, MCP_STARTUP_TIMEOUT_SEC, FIELD_TYPES, YES_NO, ACCEPT_DECLINE, MAX_INLINE_GENERATED_IMAGE_BYTES, PNG_SIGNATURE, JPEG_NON_FRAME_MARKERS, IMAGE_GEN_CALL, PROMPT_LITERAL, TURN_END_EVENTS, RELOCATE_EVERY_MS, CodexImageGenerationFold, CodexRolloutImages, 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;
28853
+ 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, PNG_SIGNATURE, JPEG_NON_FRAME_MARKERS, IMAGE_GEN_CALL, PROMPT_LITERAL, RELOCATE_EVERY_MS, CodexImageGenerationFold, CodexRolloutImages, 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;
28930
28854
  var init_codex = __esm({
28931
28855
  "../agent-core/dist/providers/codex.js"() {
28932
28856
  "use strict";
28933
- init_chunk_LR52JUGL();
28934
- init_chunk_2KE6BVIX();
28935
- init_chunk_OUQ7HMD3();
28857
+ init_chunk_DALFHI4B();
28858
+ init_chunk_X5JKSBTB();
28859
+ init_chunk_UGRKZTAD();
28936
28860
  init_chunk_R32NAS3B();
28937
28861
  init_chunk_J2KTV5FP();
28938
- init_chunk_VZIZDY3T();
28939
- init_chunk_NADPTUUJ();
28862
+ init_chunk_NDAB5G24();
28863
+ init_chunk_6WN2R725();
28940
28864
  init_chunk_YXWJW7I5();
28941
- import_fs5 = require("fs");
28865
+ import_fs6 = require("fs");
28942
28866
  import_path6 = require("path");
28943
28867
  init_effort();
28944
- import_crypto7 = require("crypto");
28945
- init_agent2();
28946
28868
  import_crypto8 = require("crypto");
28947
28869
  init_agent2();
28948
28870
  import_crypto9 = require("crypto");
28871
+ init_agent2();
28872
+ import_crypto10 = require("crypto");
28949
28873
  init_effort();
28950
28874
  TokenRefresher = class {
28951
28875
  #auth;
@@ -28990,19 +28914,17 @@ var init_codex = __esm({
28990
28914
  JPEG_NON_FRAME_MARKERS = /* @__PURE__ */ new Set([196, 200, 204]);
28991
28915
  IMAGE_GEN_CALL = /\bimage_gen\w*\s*\(/;
28992
28916
  PROMPT_LITERAL = /\bprompt\s*:\s*("(?:[^"\\]|\\.)*")/;
28993
- TURN_END_EVENTS = /* @__PURE__ */ new Set(["task_complete", "turn_aborted"]);
28994
28917
  RELOCATE_EVERY_MS = 1e3;
28995
28918
  CodexImageGenerationFold = class {
28996
28919
  #clock;
28997
28920
  #pending = [];
28998
28921
  #updates = [];
28999
- #turnEnded = false;
29000
28922
  constructor(clock) {
29001
28923
  this.#clock = clock;
29002
28924
  }
29003
- /** A call is still waiting for its image and the rollout has not recorded the turn's end. */
28925
+ /** A call is still waiting for its image. */
29004
28926
  get waiting() {
29005
- return this.#pending.length > 0 && !this.#turnEnded;
28927
+ return this.#pending.length > 0;
29006
28928
  }
29007
28929
  foldLine(text2) {
29008
28930
  if (!mayMatter(text2)) return;
@@ -29025,7 +28947,6 @@ var init_codex = __esm({
29025
28947
  }
29026
28948
  if (entryType !== "event_msg") return;
29027
28949
  const type = asString(payload.type);
29028
- if (TURN_END_EVENTS.has(type)) this.#turnEnded = true;
29029
28950
  if (type === "image_generation_end") {
29030
28951
  this.#finish(payload, ts);
29031
28952
  return;
@@ -29109,7 +29030,7 @@ var init_codex = __esm({
29109
29030
  settle() {
29110
29031
  return [...this.drain(), ...this.#fold.settlePending()];
29111
29032
  }
29112
- /** Waits, up to `ms`, for the rollout to record a pending call's image or the turn's end. */
29033
+ /** Waits, up to `ms`, for pending images. A prior turn's end can trail this turn's start. */
29113
29034
  async catchUp(ms, pollMs) {
29114
29035
  const updates = this.drain();
29115
29036
  const deadline = this.#clock.monotonic() + ms;
@@ -30102,9 +30023,9 @@ function packagedAlanCodeEnginePath(bundle, platform) {
30102
30023
  }
30103
30024
  function isRunnableFile(path, platform) {
30104
30025
  try {
30105
- if (!(0, import_fs6.statSync)(path).isFile()) return false;
30026
+ if (!(0, import_fs7.statSync)(path).isFile()) return false;
30106
30027
  if (platform === "win32") return WINDOWS_RUNNABLE_EXTENSION.test(path);
30107
- (0, import_fs6.accessSync)(path, import_fs6.constants.X_OK);
30028
+ (0, import_fs7.accessSync)(path, import_fs7.constants.X_OK);
30108
30029
  return true;
30109
30030
  } catch {
30110
30031
  return false;
@@ -30273,18 +30194,18 @@ function alanCodeEngineEnv(input2) {
30273
30194
  };
30274
30195
  }
30275
30196
  async function writePlugin(directory, apiOrigin) {
30276
- const origin = (0, import_crypto10.createHash)("sha256").update(apiOrigin).digest("hex").slice(0, 12);
30197
+ const origin = (0, import_crypto11.createHash)("sha256").update(apiOrigin).digest("hex").slice(0, 12);
30277
30198
  const target = (0, import_path8.join)(directory, `engine-plugin-v${ALAN_CODE_ENGINE_PLUGIN_VERSION}-${origin}.mjs`);
30278
- const temporary = `${target}.${(0, import_crypto10.randomUUID)()}.tmp`;
30279
- await (0, import_promises13.mkdir)(directory, { recursive: true, mode: 448 });
30280
- await (0, import_promises13.writeFile)(temporary, alanCodeEnginePluginSource(apiOrigin), { mode: 384 });
30281
- await (0, import_promises13.rename)(temporary, target);
30199
+ const temporary = `${target}.${(0, import_crypto11.randomUUID)()}.tmp`;
30200
+ await (0, import_promises14.mkdir)(directory, { recursive: true, mode: 448 });
30201
+ await (0, import_promises14.writeFile)(temporary, alanCodeEnginePluginSource(apiOrigin), { mode: 384 });
30202
+ await (0, import_promises14.rename)(temporary, target);
30282
30203
  return (0, import_url.pathToFileURL)(target).href;
30283
30204
  }
30284
30205
  async function prepareAlanCodeProfile(input2) {
30285
30206
  const directories = Object.values(alanCodeEngineDirectories(input2.engineRoot));
30286
30207
  await Promise.all(
30287
- directories.map((directory) => (0, import_promises13.mkdir)(directory, { recursive: true, mode: 448 }))
30208
+ directories.map((directory) => (0, import_promises14.mkdir)(directory, { recursive: true, mode: 448 }))
30288
30209
  );
30289
30210
  const [pluginUrl, models] = await Promise.all([
30290
30211
  writePlugin((0, import_path8.join)(input2.engineRoot, "plugin"), input2.access.apiOrigin),
@@ -30307,7 +30228,7 @@ function alanCodeSystemPrompt(alanSystemPrompt) {
30307
30228
 
30308
30229
  ${instructions}` : ALAN_CODE_TOOL_NAMING_PROMPT;
30309
30230
  }
30310
- var import_http3, import_https, import_fs6, import_path7, import_crypto10, import_promises13, 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, 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;
30231
+ var import_http3, import_https, import_fs7, import_path7, import_crypto11, import_promises14, 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, 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;
30311
30232
  var init_alan_code = __esm({
30312
30233
  "../agent-core/dist/providers/alan-code.js"() {
30313
30234
  "use strict";
@@ -30317,11 +30238,11 @@ var init_alan_code = __esm({
30317
30238
  init_runtime_v2();
30318
30239
  init_runtime_v2();
30319
30240
  init_models();
30320
- import_fs6 = require("fs");
30241
+ import_fs7 = require("fs");
30321
30242
  import_path7 = require("path");
30322
30243
  init_runtime_v2();
30323
- import_crypto10 = require("crypto");
30324
- import_promises13 = require("fs/promises");
30244
+ import_crypto11 = require("crypto");
30245
+ import_promises14 = require("fs/promises");
30325
30246
  import_path8 = require("path");
30326
30247
  import_url = require("url");
30327
30248
  ALAN_CODE_BASELINE_PROMPT = "You are alan-code, an interactive CLI coding agent that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\n\nIMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.\n\nIf the user asks for help or wants to give feedback, inform them of the following:\n- `--harness-help` / harness help: learn how to run alan-code\n- For product feedback or bugs, report through the Alan / Supatest issue channels used by this repository\n\nWhen the user directly asks about alan-code capabilities (for example \"can alan-code\u2026\", \"does the harness have\u2026\") or asks in second person about your abilities, answer from the tools and instructions available in this session. If a docs/fetch tool is available and project docs URLs are known, use them; otherwise inspect local README / AGENTS.md rather than inventing product claims.\n\n# Personality\n\nYour default personality and tone is concise, direct, and friendly. You communicate efficiently, always keeping the user clearly informed about ongoing actions without unnecessary detail. You always prioritize actionable guidance, clearly stating assumptions, environment prerequisites, and next steps. Unless explicitly asked, you avoid excessively verbose explanations about your work.\n\n# Tone and style\n\nYou should be concise, direct, and to the point. When you run a non-trivial bash command, you should explain what the command does and why you are running it, so the user understands what you are doing (especially important for commands that change their system).\nRemember that your output will be displayed on a command line interface. Your responses can use GitHub-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.\nOutput text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.\nIf you cannot or will not help the user with something, do not lecture about why. Offer helpful alternatives if possible; otherwise keep the response to 1-2 sentences.\nOnly use emojis if the user explicitly requests it. Avoid emojis in all communication unless asked.\nIMPORTANT: Minimize output tokens while staying helpful, correct, and accurate. Only address the specific query or task. Avoid tangential information unless it is critical to completing the request. If you can answer in 1-3 sentences or a short paragraph, do that.\nAnswer the user's question directly. One-word answers are best when they suffice. Avoid text before/after your response such as \"The answer is <answer>.\", \"Here is the content of the file\u2026\", \"Based on the information provided\u2026\", or \"Here is what I will do next\u2026\". Examples of appropriate verbosity:\n<example>\nuser: what is 2+2?\nassistant: 4\n</example>\n\n<example>\nuser: is 11 a prime number?\nassistant: Yes\n</example>\n\n<example>\nuser: what command should I run to list files in the current directory?\nassistant: ls\n</example>\n\n<example>\nuser: what command should I run to watch files in the current directory?\nassistant: [use tools to inspect the project, then answer]\nnpm run dev\n</example>\n\n<example>\nuser: what files are in the directory src/?\nassistant: [lists files and sees foo.c, bar.c, baz.c]\nuser: which file contains the implementation of foo?\nassistant: src/foo.c\n</example>\n\n<example>\nuser: write tests for new feature\nassistant: [searches for similar tests, reads relevant files concurrently, edits/writes tests]\n</example>\n\n# Responsiveness\n\n## Preamble messages\n\nBefore making tool calls, send a brief preamble to the user explaining what you're about to do. When sending preamble messages, follow these principles and examples:\n\n- **Logically group related actions**: if you're about to run several related commands, describe them together in one preamble rather than sending a separate note for each.\n- **Keep it concise**: be no more than 1-2 sentences, focused on immediate, tangible next steps. (8\u201312 words for quick updates).\n- **Build on prior context**: if this is not your first tool call, use the preamble message to connect the dots with what's been done so far and create a sense of momentum and clarity for the user to understand your next actions.\n- **Keep your tone light, friendly and curious**: add small touches of personality in preambles feel collaborative and engaging.\n- **Exception**: Avoid adding a preamble for every trivial read (e.g., `cat` a single file) unless it's part of a larger grouped action.\n\nExamples:\n\n- \"I've explored the repo; now checking the API route definitions.\"\n- \"Next, I'll patch the config and update the related tests.\"\n- \"I'm about to scaffold the CLI commands and helper functions.\"\n- \"Ok cool, so I've wrapped my head around the repo. Now digging into the API routes.\"\n- \"Config's looking tidy. Next up is patching helpers to keep things in sync.\"\n- \"Finished poking at the DB gateway. I will now chase down error handling.\"\n- \"Alright, build pipeline order is interesting. Checking how it reports failures.\"\n- \"Spotted a clever caching util; now hunting where it gets used.\"\n\n# Planning\n\nYou have access to a `todowrite` tool which tracks steps and progress and renders them to the user. Using the tool helps demonstrate that you've understood the task and convey how you're approaching it. Plans can help to make complex, ambiguous, or multi-phase work clearer and more collaborative for the user. A good plan should break the task into meaningful, logically ordered steps that are easy to verify as you go.\n\nNote that plans are not for padding out simple work with filler steps or stating the obvious. The content of your plan should not involve doing anything that you aren't capable of doing (i.e. don't try to test things that you can't test). Do not use plans for simple or single-step queries that you can just do or answer immediately.\n\nDo not repeat the full contents of the plan after a `todowrite` call \u2014 the harness already displays it. Instead, summarize the change made and highlight any important context or next step.\n\nBefore running a command, consider whether or not you have completed the previous step, and make sure to mark it as completed before moving on to the next step. It may be the case that you complete all steps in your plan after a single pass of implementation. If this is the case, you can simply mark all the planned steps as completed. Sometimes, you may need to change plans in the middle of a task: call `todowrite` with the updated plan and make sure to explain the rationale when doing so.\n\nUse a plan when:\n\n- The task is non-trivial and will require multiple actions over a long time horizon.\n- There are logical phases or dependencies where sequencing matters.\n- The work has ambiguity that benefits from outlining high-level goals.\n- You want intermediate checkpoints for feedback and validation.\n- When the user asked you to do more than one thing in a single prompt\n- The user has asked you to use the plan tool (aka \"TODOs\")\n- You generate additional steps while working, and plan to do them before yielding to the user\n\n## Examples\n\n**High-quality plans**\n\nExample 1:\n\n1. Add CLI entry with file args\n2. Parse Markdown via CommonMark library\n3. Apply semantic HTML template\n4. Handle code blocks, images, links\n5. Add error handling for invalid files\n\nExample 2:\n\n1. Define CSS variables for colors\n2. Add toggle with localStorage state\n3. Refactor components to use variables\n4. Verify all views for readability\n5. Add smooth theme-change transition\n\nExample 3:\n\n1. Set up Node.js + WebSocket server\n2. Add join/leave broadcast events\n3. Implement messaging with timestamps\n4. Add usernames + mention highlighting\n5. Persist messages in lightweight DB\n6. Add typing indicators + unread count\n\n**Low-quality plans**\n\nExample 1:\n\n1. Create CLI tool\n2. Add Markdown parser\n3. Convert to HTML\n\nExample 2:\n\n1. Add dark mode toggle\n2. Save preference\n3. Make styles look good\n\nExample 3:\n\n1. Create single-file HTML game\n2. Run quick sanity check\n3. Summarize usage instructions\n\nIf you need to write a plan, only write high quality plans, not low quality ones.\n\n## Plan mode and clarification (harness specifics)\n\n- For multi-step or risky work, enter plan mode (`/plan` or `--plan`) before editing. Explore read-only, then call `plan_write` with a decision-complete markdown plan (approach, rejected alternatives, verification, assumptions). Wait for user approval before implementing.\n- Prefer the durable plan file path over relying on chat memory after compaction.\n- When requirements are ambiguous, use the `question` tool with concrete options instead of guessing.\n- `todowrite` tracks execution steps (see its Tool Guidelines entry); it is not a substitute for a durable plan file.\n\n# Task execution\n\nYou are a coding agent. Please keep going until the query is completely resolved, before ending your turn and yielding back to the user. Only terminate your turn when you are sure that the problem is solved. Autonomously resolve the query to the best of your ability, using the tools available to you, before coming back to the user. Do NOT guess or make up an answer.\n\nYou MUST adhere to the following criteria when solving queries:\n\n- Working on the repo(s) in the current environment is allowed, even if they are proprietary.\n- Analyzing code for vulnerabilities is allowed.\n- Showing user code and tool call details is allowed.\n- Use the `edit` tool to modify existing files and the `write` tool to create new ones. This harness has no structured-patch tool \u2014 never try `apply_patch`, `applypatch`, or `apply-patch`.\n\nIf completing the user's task requires writing or modifying files, your code and final answer should follow these coding guidelines, though user instructions (i.e. AGENTS.md) may override these guidelines:\n\n- Fix the problem at the root cause rather than applying surface-level patches, when possible.\n- Avoid unneeded complexity in your solution.\n- Do not attempt to fix unrelated bugs or broken tests. It is not your responsibility to fix them. (You may mention them to the user in your final message though.)\n- Update documentation as necessary.\n- Keep changes consistent with the style of the existing codebase. Changes should be minimal and focused on the task.\n- Use `git log` and `git blame` to search the history of the codebase if additional context is required.\n- NEVER add copyright or license headers unless specifically requested.\n- Do not waste tokens by re-reading files after editing them. The tool call will fail if it didn't work. The same goes for making folders, deleting folders, etc.\n- Do not `git commit` your changes or create new git branches unless explicitly requested.\n- Do not add inline comments within code unless explicitly requested.\n- Do not use one-letter variable names unless explicitly requested.\n- NEVER output inline citations like \"\u3010F:README.md\u2020L5-L14\u3011\" in your outputs. The CLI is not able to render these so they will just be broken in the UI. Instead, if you output valid filepaths, users will be able to click on them to open the files in their editor.\n\n# Validating your work\n\nIf the codebase has tests or the ability to build or run, consider using them to verify that your work is complete.\n\nWhen testing, your philosophy should be to start as specific as possible to the code you changed so that you can catch issues efficiently, then make your way to broader tests as you build confidence. If there's no test for the code you changed, and if the adjacent patterns in the codebases show that there's a logical place for you to add a test, you may do so. However, do not add tests to codebases with no tests.\n\nSimilarly, once you're confident in correctness, you can suggest or use formatting commands to ensure that your code is well formatted. If there are issues you can iterate up to 3 times to get formatting right, but if you still can't manage it's better to save the user time and present them a correct solution where you call out the formatting in your final message. If the codebase does not have a formatter configured, do not add one.\n\nFor all of testing, running, building, and formatting, do not attempt to fix unrelated bugs. It is not your responsibility to fix them. (You may mention them to the user in your final message though.)\n\nBe mindful of whether to run validation commands proactively. In the absence of behavioral guidance:\n\n- When running in a non-interactive mode where edits are auto-approved (print/headless, or the `allow edits` permission mode), proactively run tests, lint and do whatever you need to ensure you've completed the task.\n- When working in interactive permission modes like `ask before edits` or `plan`, hold off on running tests or lint commands until the user is ready for you to finalize your output, because these commands take time to run and slow down iteration. Instead suggest what you want to do next, and let the user confirm first.\n- When working on test-related tasks, such as adding tests, fixing tests, or reproducing a bug to verify behavior, you may proactively run tests regardless of permission mode. Use your judgement to decide whether this is a test-related task.\n\n# Ambition vs. precision\n\nFor tasks that have no prior context (i.e. the user is starting something brand new), you should feel free to be ambitious and demonstrate creativity with your implementation.\n\nIf you're operating in an existing codebase, you should make sure you do exactly what the user asks with surgical precision. Treat the surrounding codebase with respect, and don't overstep (i.e. changing filenames or variables unnecessarily). You should balance being sufficiently ambitious and proactive when completing tasks of this nature.\n\nYou should use judicious initiative to decide on the right level of detail and complexity to deliver based on the user's needs. This means showing good judgment that you're capable of doing the right extras without gold-plating. This might be demonstrated by high-value, creative touches when scope of the task is vague; while being surgical and targeted when scope is tightly specified.\n\n# Sharing progress updates\n\nFor especially longer tasks that you work on (i.e. requiring many tool calls, or a plan with multiple steps), you should provide progress updates back to the user at reasonable intervals. These updates should be structured as a concise sentence or two (no more than 8-10 words long) recapping progress so far in plain language: this update demonstrates your understanding of what needs to be done, progress so far (i.e. files explores, subtasks complete), and where you're going next.\n\nBefore doing large chunks of work that may incur latency as experienced by the user (i.e. writing a new file), you should send a concise message to the user with an update indicating what you're about to do to ensure they know what you're spending time on. Don't start editing or writing large files before informing the user what you are doing and why.\n\nThe messages you send before tool calls should describe what is immediately about to be done next in very concise language. If there was previous work done, this preamble message should also include a note about the work done so far to bring the user along.\n\n# Presenting your work and final message\n\nYour final message should read naturally, like an update from a concise teammate. For casual conversation, brainstorming tasks, or quick questions from the user, respond in a friendly, conversational tone. You should ask questions, suggest ideas, and adapt to the user's style. If you've finished a large amount of work, when describing what you've done to the user, you should follow the final answer formatting guidelines to communicate substantive changes. You don't need to add structured formatting for one-word answers, greetings, or purely conversational exchanges.\n\nYou can skip heavy formatting for single, simple actions or confirmations. In these cases, respond in plain sentences with any relevant next step or quick option. Reserve multi-section structured responses for results that need grouping or explanation.\n\nThe user is working on the same computer as you, and has access to your work. As such there's no need to show the full contents of large files you have already written unless the user explicitly asks for them. Similarly, if you've created or modified files, there's no need to tell users to \"save the file\" or \"copy the code into a file\"\u2014just reference the file path.\n\nIf there's something that you think you could help with as a logical next step, concisely ask the user if they want you to do so. Good examples of this are running tests, committing changes, or building out the next logical component. If there's something that you couldn't do (even with approval) but that the user might want to do (such as verifying changes by running the app), include those instructions succinctly.\n\nBrevity is very important as a default. You should be very concise (i.e. no more than 10 lines), but can relax this requirement for tasks where additional detail and comprehensiveness is important for the user's understanding.\n\n## Final answer structure and style guidelines\n\nYou are producing plain text that will later be styled by the CLI. Follow these rules exactly. Formatting should make results easy to scan, but not feel mechanical. Use judgment to decide how much structure adds value.\n\n**Section Headers**\n\n- Use only when they improve clarity \u2014 they are not mandatory for every answer.\n- Choose descriptive names that fit the content\n- Keep headers short (1\u20133 words) and in `**Title Case**`. Always start headers with `**` and end with `**`\n- Leave no blank line before the first bullet under a header.\n- Section headers should only be used where they genuinely improve scanability; avoid fragmenting the answer.\n\n**Bullets**\n\n- Use `-` followed by a space for every bullet.\n- Merge related points when possible; avoid a bullet for every trivial detail.\n- Keep bullets to one line unless breaking for clarity is unavoidable.\n- Group into short lists (4\u20136 bullets) ordered by importance.\n- Use consistent keyword phrasing and formatting across sections.\n\n**Monospace**\n\n- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``).\n- Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command.\n- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``).\n\n**File References**\n\nWhen referencing files in your response, make sure to include the relevant start line and always follow the below rules:\n\n- Use inline code to make file paths clickable.\n- Each reference should have a stand alone path. Even if it's the same file.\n- Accepted: absolute, workspace\u2011relative, a/ or b/ diff prefixes, or bare filename/suffix.\n- Line/column (1\u2011based, optional): :line[:column] or #Lline[Ccolumn] (column defaults to 1).\n- Do not use URIs like file://, vscode://, or https://.\n- Do not provide range of lines\n- Examples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\\repo\\project\\main.rs:12:5\n\n**Structure**\n\n- Place related bullets together; don't mix unrelated concepts in the same section.\n- Order sections from general \u2192 specific \u2192 supporting info.\n- For subsections (e.g., \"Binaries\" under \"Rust Workspace\"), introduce with a bolded keyword bullet, then list items under it.\n- Match structure to complexity:\n - Multi-part or detailed results \u2192 use clear headers and grouped bullets.\n - Simple results \u2192 minimal headers, possibly just a short list or paragraph.\n\n**Tone**\n\n- Keep the voice collaborative and natural, like a coding partner handing off work.\n- Be concise and factual \u2014 no filler or conversational commentary and avoid unnecessary repetition\n- Use present tense and active voice (e.g., \"Runs tests\" not \"This will run tests\").\n- Keep descriptions self-contained; don't refer to \"above\" or \"below\".\n- Use parallel structure in lists for consistency.\n\n**Don't**\n\n- Don't use literal words \"bold\" or \"monospace\" in the content.\n- Don't nest bullets or create deep hierarchies.\n- Don't output ANSI escape codes directly \u2014 the CLI renderer applies them.\n- Don't cram unrelated keywords into a single bullet; split for clarity.\n- Don't let keyword lists run long \u2014 wrap or reformat for scanability.\n\nGenerally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what's needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable.\n\nFor casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting.\n\n# Professional objectivity\n\nPrioritize technical accuracy and truthfulness over validating the user's beliefs. Focus on facts and problem-solving. Be direct and objective without unnecessary praise or emotional validation. Disagree when needed. When uncertain, investigate before confirming the user's assumptions.\n\n# Proactiveness\n\nYou may be proactive, but only when the user asks you to do something. Strike a balance between:\n\n1. Doing the right thing when asked, including follow-up actions\n2. Not surprising the user with unrequested actions\n For example, if the user asks how to approach something, answer first; do not immediately jump into edits.\n\n# Following conventions\n\nWhen changing files, first understand the file's conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.\n\n- NEVER assume a library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses it (neighboring files, package.json, cargo.toml, go.mod, etc.).\n- When creating a new component, first look at existing components for framework choice, naming, typing, and other conventions.\n- When editing code, first look at surrounding context (especially imports) to understand chosen frameworks/libraries, then make the change idiomatically.\n- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.\n\n# Doing tasks\n\nThe user will primarily request software engineering tasks: bugs, features, refactors, explanations, and more. Recommended steps:\n\n- Use available search/read tools extensively to understand the codebase and the query (in parallel when independent).\n- Implement the solution with the tools available to you.\n- Prefer editing existing files over creating new ones. Do not create documentation or markdown files unless asked.\n- Verify when possible with tests. NEVER assume a specific test framework or script \u2014 check README / AGENTS.md or search the repo.\n- Run lint and typecheck commands (for example npm run lint, npm run typecheck, ruff, pnpm lint) if they were provided to you \u2014 see Validating your work for when to run them proactively vs. when to hold off. If you cannot find the correct command, ask the user, and if they supply it, proactively suggest writing it to AGENTS.md so you know next time.\n\n- Tool results and user messages may include <system-reminder> tags. Those tags contain useful reminders. They are NOT part of the user's provided input or the tool result.\n\n# Tool usage policy\n\n- Prefer specialized file tools over shell for reading, editing, writing, listing, and searching when those tools are available. Use the `grep`, `glob`, and `list` tools instead of bash for search and listing \u2014 they are ripgrep-backed and return structured, length-capped results. Use shell for real system commands (git, package managers, builds, tests, process control).\n- When doing broad codebase exploration, prefer a task/subagent tool if one is available to reduce context usage; otherwise use the available search tools.\n- You can call multiple tools in one response. When multiple independent pieces of information are needed, batch tool calls for performance. When making multiple bash tool calls, send a single message with multiple tool calls so they can run in parallel (for example git status and git diff together).\n- Match edit old-text exactly, including whitespace.\n- If a tool call is denied by policy, adapt: use an allowed approach or ask the user. Do not retry the same blocked call in a loop.\n\n## Shell commands\n\nWhen using the shell, you must adhere to the following guidelines:\n\n- When searching for text or files, prefer using `rg` or `rg --files` respectively because `rg` is much faster than alternatives like `grep` and `find`. (If the `rg` command is not found, then use alternatives.) Reach for the shell only when the `grep`/`glob` tools cannot express the query \u2014 for example counting matches, or piping results into another command.\n- Search narrow first: use `rg -l` or `rg -c` to find which files match, then read only those files. Do not dump full match bodies across a repo into context.\n- Never pipe a large file into your context. Do not `cat` a big file; use the `read` tool with an offset/limit, or `sed -n 'START,ENDp'` for a specific range.\n- Do not use python scripts to attempt to output larger chunks of a file.\n\n## `todowrite`\n\nA tool named `todowrite` is available to you. You can use it to keep an up-to-date, step-by-step plan for the task.\n\nTo create a new plan, call `todowrite` with a short list of 1-sentence steps (no more than 5-7 words each) with a `status` for each step (`pending`, `in_progress`, `completed`, or `cancelled`). The call is a full replace \u2014 always send the complete list, not a delta.\n\nWhen steps have been completed, use `todowrite` to mark each finished step as `completed` and the next step you are working on as `in_progress`. There should always be exactly one `in_progress` step until everything is done. You can mark multiple items as complete in a single `todowrite` call.\n\nIf all steps are complete, ensure you call `todowrite` to mark all steps as `completed`.\n\nIMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames and directory structure.\n\n# AGENTS.md spec\n\n- Repos often contain AGENTS.md files. These files can appear anywhere within the repository.\n- These files are a way for humans to give you (the agent) instructions or tips for working within the container.\n- Some examples might be: coding conventions, info about how code is organized, or instructions for how to run or test code.\n- Instructions in AGENTS.md files:\n - The scope of an AGENTS.md file is the entire directory tree rooted at the folder that contains it.\n - For every file you touch in the final change, you must obey instructions in any AGENTS.md file whose scope includes that file.\n - Instructions about code style, structure, naming, etc. apply only to code within the AGENTS.md file's scope, unless the file states otherwise.\n - More-deeply-nested AGENTS.md files take precedence in the case of conflicting instructions.\n - Direct system/developer/user instructions (as part of a prompt) take precedence over AGENTS.md instructions.\n- The contents of the AGENTS.md file at the root of the repo and the project directory are loaded into your context automatically and don't need to be re-read. AGENTS.md files in subdirectories are NOT loaded automatically: when working in a subdirectory, or a directory outside the CWD, check for any AGENTS.md files that may be applicable.\n\n# Permissions and safety\n\n- Never commit secrets or keys.\n- Never create a git commit unless the user explicitly asks.\n- Do not run destructive commands (mass delete, force-push, hard reset) unless the user clearly requested them.\n";
@@ -37680,10 +37601,10 @@ var require_dist = __commonJS({
37680
37601
  var init_dist = __esm({
37681
37602
  "../agent-core/dist/index.js"() {
37682
37603
  "use strict";
37683
- init_chunk_2KE6BVIX();
37684
- init_chunk_OUQ7HMD3();
37604
+ init_chunk_X5JKSBTB();
37605
+ init_chunk_UGRKZTAD();
37685
37606
  init_chunk_R32NAS3B();
37686
- init_chunk_VZIZDY3T();
37607
+ init_chunk_NDAB5G24();
37687
37608
  init_chunk_YXWJW7I5();
37688
37609
  }
37689
37610
  });
@@ -37775,7 +37696,7 @@ function within(root, path) {
37775
37696
  }
37776
37697
  async function resolveReal(path) {
37777
37698
  try {
37778
- return await (0, import_promises19.realpath)(path);
37699
+ return await (0, import_promises20.realpath)(path);
37779
37700
  } catch {
37780
37701
  const parent = (0, import_path9.dirname)(path);
37781
37702
  if (parent === path) return path;
@@ -37804,14 +37725,14 @@ function createWorkspaceFs(roots, writable) {
37804
37725
  return {
37805
37726
  read: async (params) => {
37806
37727
  const path = await confined(params);
37807
- const bytes = await (0, import_promises19.readFile)(path);
37728
+ const bytes = await (0, import_promises20.readFile)(path);
37808
37729
  if (bytes.byteLength > MAX_READ_BYTES) throw new FsDenied(`${path} is too large to read`);
37809
37730
  return { content: sliceLines(bytes.toString("utf8"), params) };
37810
37731
  },
37811
37732
  write: async (params) => {
37812
37733
  if (!writable) throw new FsDenied("This session is read-only");
37813
37734
  const path = await confined(params);
37814
- await (0, import_promises19.writeFile)(path, asString(params.content));
37735
+ await (0, import_promises20.writeFile)(path, asString(params.content));
37815
37736
  return {};
37816
37737
  }
37817
37738
  };
@@ -38356,7 +38277,7 @@ function isAcpBackendKind(value) {
38356
38277
  return Object.hasOwn(ACP_PROFILES, value);
38357
38278
  }
38358
38279
  function envDigest3(env) {
38359
- const hash2 = (0, import_crypto11.createHash)("sha256");
38280
+ const hash2 = (0, import_crypto12.createHash)("sha256");
38360
38281
  for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
38361
38282
  return hash2.digest("hex");
38362
38283
  }
@@ -38414,7 +38335,7 @@ async function acpTurnInput(run, context) {
38414
38335
  const encoded = await Promise.all(
38415
38336
  images.map(async (image) => ({
38416
38337
  mimeType: image.mimeType,
38417
- data: (await (0, import_promises20.readFile)(image.path)).toString("base64")
38338
+ data: (await (0, import_promises21.readFile)(image.path)).toString("base64")
38418
38339
  }))
38419
38340
  );
38420
38341
  return {
@@ -38423,23 +38344,23 @@ async function acpTurnInput(run, context) {
38423
38344
  ...encoded.length ? { images: encoded, imagePaths: images.map((image) => image.path) } : {}
38424
38345
  };
38425
38346
  }
38426
- var import_promises19, import_path9, import_crypto11, import_promises20, 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;
38347
+ var import_promises20, import_path9, import_crypto12, import_promises21, 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;
38427
38348
  var init_acp3 = __esm({
38428
38349
  "../agent-core/dist/providers/acp.js"() {
38429
38350
  "use strict";
38430
- init_chunk_2KE6BVIX();
38431
- init_chunk_OUQ7HMD3();
38351
+ init_chunk_X5JKSBTB();
38352
+ init_chunk_UGRKZTAD();
38432
38353
  init_chunk_R32NAS3B();
38433
38354
  init_chunk_J2KTV5FP();
38434
- init_chunk_VZIZDY3T();
38435
- init_chunk_NADPTUUJ();
38355
+ init_chunk_NDAB5G24();
38356
+ init_chunk_6WN2R725();
38436
38357
  init_chunk_YXWJW7I5();
38437
- import_promises19 = require("fs/promises");
38358
+ import_promises20 = require("fs/promises");
38438
38359
  import_path9 = require("path");
38439
38360
  init_effort();
38440
38361
  init_acp();
38441
- import_crypto11 = require("crypto");
38442
- import_promises20 = require("fs/promises");
38362
+ import_crypto12 = require("crypto");
38363
+ import_promises21 = require("fs/promises");
38443
38364
  init_agent2();
38444
38365
  CURSOR_ASK_QUESTION = "cursor/ask_question";
38445
38366
  copilotAcpProfile = {
@@ -39963,7 +39884,7 @@ function createOpenCodeDriver(options = {}) {
39963
39884
  await authorization?.remove();
39964
39885
  };
39965
39886
  const spec = { ...planned, env: launchEnv(planned, authorization) };
39966
- const password = options.password?.() ?? (0, import_crypto12.randomBytes)(24).toString("base64url");
39887
+ const password = options.password?.() ?? (0, import_crypto13.randomBytes)(24).toString("base64url");
39967
39888
  const attempt = { abandoned: false };
39968
39889
  const { session, url: url2 } = await withDeadline3(
39969
39890
  startServer(spec, password, resolved, attempt),
@@ -40007,7 +39928,7 @@ function createOpenCodeDriver(options = {}) {
40007
39928
  };
40008
39929
  }
40009
39930
  function envDigest4(env) {
40010
- const hash2 = (0, import_crypto13.createHash)("sha256");
39931
+ const hash2 = (0, import_crypto14.createHash)("sha256");
40011
39932
  for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
40012
39933
  return hash2.digest("hex");
40013
39934
  }
@@ -40087,25 +40008,25 @@ function openCodeTurnInput(run, context) {
40087
40008
  ...images.length ? { imagePaths: images.map((image) => image.path) } : {}
40088
40009
  };
40089
40010
  }
40090
- var import_http4, import_crypto12, import_path10, import_url2, import_crypto13, 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;
40011
+ var import_http4, import_crypto13, import_path10, import_url2, import_crypto14, 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;
40091
40012
  var init_opencode = __esm({
40092
40013
  "../agent-core/dist/providers/opencode.js"() {
40093
40014
  "use strict";
40094
- init_chunk_2KE6BVIX();
40095
- init_chunk_OUQ7HMD3();
40015
+ init_chunk_X5JKSBTB();
40016
+ init_chunk_UGRKZTAD();
40096
40017
  init_chunk_R32NAS3B();
40097
40018
  init_chunk_J2KTV5FP();
40098
- init_chunk_VZIZDY3T();
40099
- init_chunk_NADPTUUJ();
40019
+ init_chunk_NDAB5G24();
40020
+ init_chunk_6WN2R725();
40100
40021
  init_chunk_YXWJW7I5();
40101
40022
  import_http4 = require("http");
40102
40023
  init_runtime_v2();
40103
- import_crypto12 = require("crypto");
40024
+ import_crypto13 = require("crypto");
40104
40025
  init_agent2();
40105
40026
  import_path10 = require("path");
40106
40027
  import_url2 = require("url");
40107
40028
  init_acp();
40108
- import_crypto13 = require("crypto");
40029
+ import_crypto14 = require("crypto");
40109
40030
  init_agent2();
40110
40031
  IDLE_SOCKET_MS2 = 4e3;
40111
40032
  OpenCodeHttpError = class extends Error {
@@ -41786,7 +41707,7 @@ function createDroidDriver(options = {}) {
41786
41707
  };
41787
41708
  }
41788
41709
  function envDigest5(env) {
41789
- const hash2 = (0, import_crypto14.createHash)("sha256");
41710
+ const hash2 = (0, import_crypto15.createHash)("sha256");
41790
41711
  for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
41791
41712
  return hash2.digest("hex");
41792
41713
  }
@@ -41841,25 +41762,25 @@ async function droidTurnInput(run, context) {
41841
41762
  const encoded = await Promise.all(
41842
41763
  images.map(async (image) => ({
41843
41764
  mimeType: image.mimeType,
41844
- data: (await (0, import_promises21.readFile)(image.path)).toString("base64")
41765
+ data: (await (0, import_promises22.readFile)(image.path)).toString("base64")
41845
41766
  }))
41846
41767
  );
41847
41768
  return { turnId: run.runId, text: text2, ...encoded.length ? { images: encoded } : {} };
41848
41769
  }
41849
- var import_crypto14, import_promises21, 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;
41770
+ var import_crypto15, import_promises22, 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;
41850
41771
  var init_droid = __esm({
41851
41772
  "../agent-core/dist/providers/droid.js"() {
41852
41773
  "use strict";
41853
- init_chunk_2KE6BVIX();
41854
- init_chunk_OUQ7HMD3();
41774
+ init_chunk_X5JKSBTB();
41775
+ init_chunk_UGRKZTAD();
41855
41776
  init_chunk_R32NAS3B();
41856
41777
  init_chunk_J2KTV5FP();
41857
- init_chunk_VZIZDY3T();
41858
- init_chunk_NADPTUUJ();
41778
+ init_chunk_NDAB5G24();
41779
+ init_chunk_6WN2R725();
41859
41780
  init_chunk_YXWJW7I5();
41860
41781
  init_runtime_v2();
41861
- import_crypto14 = require("crypto");
41862
- import_promises21 = require("fs/promises");
41782
+ import_crypto15 = require("crypto");
41783
+ import_promises22 = require("fs/promises");
41863
41784
  init_agent2();
41864
41785
  FACTORY_API_VERSION = "1.0.0";
41865
41786
  FACTORY_PROTOCOL_VERSION = "1.187.0";
@@ -42364,7 +42285,7 @@ function antigravityArgs(input2, capabilities, prompt) {
42364
42285
  }
42365
42286
  function workspaceRoot(cwd) {
42366
42287
  for (let current = (0, import_path11.resolve)(cwd); ; current = (0, import_path11.dirname)(current)) {
42367
- if ((0, import_fs7.existsSync)((0, import_path11.join)(current, ".git"))) return current;
42288
+ if ((0, import_fs8.existsSync)((0, import_path11.join)(current, ".git"))) return current;
42368
42289
  if ((0, import_path11.dirname)(current) === current) return (0, import_path11.resolve)(cwd);
42369
42290
  }
42370
42291
  }
@@ -42374,7 +42295,7 @@ function instructionPaths(cwd) {
42374
42295
  for (let current = (0, import_path11.resolve)(cwd); ; current = (0, import_path11.dirname)(current)) {
42375
42296
  const path = (0, import_path11.join)(current, INSTRUCTIONS_FILE);
42376
42297
  try {
42377
- if ((0, import_fs7.existsSync)(path) && (0, import_fs7.statSync)(path).isFile()) paths.unshift(path);
42298
+ if ((0, import_fs8.existsSync)(path) && (0, import_fs8.statSync)(path).isFile()) paths.unshift(path);
42378
42299
  } catch {
42379
42300
  }
42380
42301
  if (current === root || (0, import_path11.dirname)(current) === current) return paths;
@@ -42388,7 +42309,7 @@ function antigravityWorkspaceInstructions(cwd, maxChars = MAX_INSTRUCTION_CHARS)
42388
42309
  if (remaining <= 0) break;
42389
42310
  let content;
42390
42311
  try {
42391
- content = (0, import_fs7.readFileSync)(path, "utf8").trim();
42312
+ content = (0, import_fs8.readFileSync)(path, "utf8").trim();
42392
42313
  } catch {
42393
42314
  continue;
42394
42315
  }
@@ -42869,7 +42790,7 @@ ${output2.stderr}`).join("\n")
42869
42790
  };
42870
42791
  }
42871
42792
  function envDigest6(env) {
42872
- const hash2 = (0, import_crypto15.createHash)("sha256");
42793
+ const hash2 = (0, import_crypto16.createHash)("sha256");
42873
42794
  for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
42874
42795
  return hash2.digest("hex");
42875
42796
  }
@@ -42915,23 +42836,23 @@ function antigravityTurnInput(run, context) {
42915
42836
  });
42916
42837
  return { turnId: run.runId, text: appendImagePathReferences(text2, images) };
42917
42838
  }
42918
- var import_fs7, import_path11, import_path12, import_url3, import_crypto15, 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, AntigravityTurn, DEFAULTS6, AntigravitySession, WINDOWS_LINE_MARGIN;
42839
+ var import_fs8, import_path11, import_path12, import_url3, import_crypto16, 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, AntigravityTurn, DEFAULTS6, AntigravitySession, WINDOWS_LINE_MARGIN;
42919
42840
  var init_antigravity = __esm({
42920
42841
  "../agent-core/dist/providers/antigravity.js"() {
42921
42842
  "use strict";
42922
- init_chunk_LR52JUGL();
42923
- init_chunk_2KE6BVIX();
42924
- init_chunk_OUQ7HMD3();
42843
+ init_chunk_DALFHI4B();
42844
+ init_chunk_X5JKSBTB();
42845
+ init_chunk_UGRKZTAD();
42925
42846
  init_chunk_R32NAS3B();
42926
- init_chunk_VZIZDY3T();
42927
- init_chunk_NADPTUUJ();
42847
+ init_chunk_NDAB5G24();
42848
+ init_chunk_6WN2R725();
42928
42849
  init_chunk_YXWJW7I5();
42929
- import_fs7 = require("fs");
42850
+ import_fs8 = require("fs");
42930
42851
  import_path11 = require("path");
42931
42852
  init_effort();
42932
42853
  import_path12 = require("path");
42933
42854
  import_url3 = require("url");
42934
- import_crypto15 = require("crypto");
42855
+ import_crypto16 = require("crypto");
42935
42856
  init_agent2();
42936
42857
  NO_ANTIGRAVITY_CAPABILITIES = {
42937
42858
  structuredPrint: false,
@@ -43417,7 +43338,7 @@ function parseConfig(raw) {
43417
43338
  }
43418
43339
  async function writeCommandCodeProjectMcp(cwd, mcp) {
43419
43340
  const path = (0, import_path13.join)(cwd, ".mcp.json");
43420
- const original = await (0, import_promises22.readFile)(path, "utf8").catch(() => null);
43341
+ const original = await (0, import_promises23.readFile)(path, "utf8").catch(() => null);
43421
43342
  const config2 = parseConfig(original);
43422
43343
  const next = {
43423
43344
  ...config2,
@@ -43434,12 +43355,12 @@ async function writeCommandCodeProjectMcp(cwd, mcp) {
43434
43355
  }
43435
43356
  }
43436
43357
  };
43437
- await (0, import_promises22.mkdir)(cwd, { recursive: true });
43438
- await (0, import_promises22.writeFile)(path, `${JSON.stringify(next, null, 2)}
43358
+ await (0, import_promises23.mkdir)(cwd, { recursive: true });
43359
+ await (0, import_promises23.writeFile)(path, `${JSON.stringify(next, null, 2)}
43439
43360
  `);
43440
43361
  return async () => {
43441
- if (original === null) await (0, import_promises22.rm)(path, { force: true });
43442
- else await (0, import_promises22.writeFile)(path, original);
43362
+ if (original === null) await (0, import_promises23.rm)(path, { force: true });
43363
+ else await (0, import_promises23.writeFile)(path, original);
43443
43364
  };
43444
43365
  }
43445
43366
  function commandCodeString(value) {
@@ -43548,7 +43469,7 @@ function createCommandCodeDriver(options = {}) {
43548
43469
  };
43549
43470
  }
43550
43471
  function envDigest7(env) {
43551
- const hash2 = (0, import_crypto16.createHash)("sha256");
43472
+ const hash2 = (0, import_crypto17.createHash)("sha256");
43552
43473
  for (const key of Object.keys(env).sort()) hash2.update(`${key}\0${env[key]}\0`);
43553
43474
  return hash2.digest("hex");
43554
43475
  }
@@ -43600,22 +43521,22 @@ function commandCodeTurnInput(run, context) {
43600
43521
  });
43601
43522
  return { turnId: run.runId, text: appendImagePathReferences(text2, images) };
43602
43523
  }
43603
- var import_promises22, import_path13, import_crypto16, COMMAND_CODE_GRAMMAR_NAME, SILENT3, CommandCodeGrammar, CommandCodeTurn, COMMAND_CODE_MAX_TURNS, DEFAULTS7, CommandCodeSession;
43524
+ var import_promises23, import_path13, import_crypto17, COMMAND_CODE_GRAMMAR_NAME, SILENT3, CommandCodeGrammar, CommandCodeTurn, COMMAND_CODE_MAX_TURNS, DEFAULTS7, CommandCodeSession;
43604
43525
  var init_command_code = __esm({
43605
43526
  "../agent-core/dist/providers/command-code.js"() {
43606
43527
  "use strict";
43607
- init_chunk_2KE6BVIX();
43608
- init_chunk_OUQ7HMD3();
43528
+ init_chunk_X5JKSBTB();
43529
+ init_chunk_UGRKZTAD();
43609
43530
  init_chunk_R32NAS3B();
43610
43531
  init_chunk_J2KTV5FP();
43611
- init_chunk_VZIZDY3T();
43612
- init_chunk_NADPTUUJ();
43532
+ init_chunk_NDAB5G24();
43533
+ init_chunk_6WN2R725();
43613
43534
  init_chunk_YXWJW7I5();
43614
- import_promises22 = require("fs/promises");
43535
+ import_promises23 = require("fs/promises");
43615
43536
  import_path13 = require("path");
43616
43537
  init_agent2();
43617
43538
  init_runtime_v2();
43618
- import_crypto16 = require("crypto");
43539
+ import_crypto17 = require("crypto");
43619
43540
  init_agent2();
43620
43541
  COMMAND_CODE_GRAMMAR_NAME = "command_code_cli";
43621
43542
  SILENT3 = /* @__PURE__ */ new Set([
@@ -44487,7 +44408,7 @@ var GitFault = class extends Error {
44487
44408
  var import_node_child_process = require("child_process");
44488
44409
 
44489
44410
  // ../agent-core/dist/process.js
44490
- init_chunk_VZIZDY3T();
44411
+ init_chunk_NDAB5G24();
44491
44412
  init_chunk_YXWJW7I5();
44492
44413
 
44493
44414
  // src/capabilities/git/run-git.ts
@@ -44668,7 +44589,7 @@ function createGitRunner(options) {
44668
44589
 
44669
44590
  // src/platform/credential-store/credential-store.ts
44670
44591
  var import_node_crypto3 = require("crypto");
44671
- var import_promises6 = require("fs/promises");
44592
+ var import_promises7 = require("fs/promises");
44672
44593
 
44673
44594
  // src/platform/credential-store/parse.ts
44674
44595
  function parseStoredJson(text2, schema) {
@@ -44817,7 +44738,7 @@ function createFileCredentialStore(path) {
44817
44738
  kind: "file",
44818
44739
  read: (schema) => readJsonFile(path, schema),
44819
44740
  write: (value) => writeJsonFileAtomic(path, value),
44820
- clear: () => (0, import_promises6.rm)(path, { force: true })
44741
+ clear: () => (0, import_promises7.rm)(path, { force: true })
44821
44742
  };
44822
44743
  }
44823
44744
  var KEYCHAIN_SERVICE = "ai.tryalan.runtime";
@@ -44912,14 +44833,14 @@ function defaultCredentialStoreKind(platform) {
44912
44833
  var import_node_child_process3 = require("child_process");
44913
44834
  var import_node_crypto4 = require("crypto");
44914
44835
  var import_node_fs3 = require("fs");
44915
- var import_promises8 = require("fs/promises");
44836
+ var import_promises9 = require("fs/promises");
44916
44837
  var import_node_path3 = require("path");
44917
44838
  var import_node_util2 = require("util");
44918
44839
  init_zod();
44919
44840
 
44920
44841
  // src/platform/process-identity.ts
44921
44842
  var import_node_child_process2 = require("child_process");
44922
- var import_promises7 = require("fs/promises");
44843
+ var import_promises8 = require("fs/promises");
44923
44844
  var import_node_util = require("util");
44924
44845
  var execFileAsync = (0, import_node_util.promisify)(import_node_child_process2.execFile);
44925
44846
  function isProcessAlive(pid) {
@@ -44931,13 +44852,13 @@ function isProcessAlive(pid) {
44931
44852
  }
44932
44853
  }
44933
44854
  async function linuxStartTime(pid) {
44934
- const stat12 = await (0, import_promises7.readFile)(`/proc/${pid}/stat`, "utf8").catch(() => null);
44855
+ const stat12 = await (0, import_promises8.readFile)(`/proc/${pid}/stat`, "utf8").catch(() => null);
44935
44856
  if (stat12 === null) return null;
44936
44857
  const fields = stat12.slice(stat12.lastIndexOf(")") + 2).split(" ");
44937
44858
  return fields[19] ?? null;
44938
44859
  }
44939
44860
  async function linuxCommand(pid) {
44940
- const raw = await (0, import_promises7.readFile)(`/proc/${pid}/cmdline`, "utf8").catch(() => null);
44861
+ const raw = await (0, import_promises8.readFile)(`/proc/${pid}/cmdline`, "utf8").catch(() => null);
44941
44862
  return raw === null ? null : normalizeCommand(raw.replaceAll("\0", " "));
44942
44863
  }
44943
44864
  async function darwinCommand(pid) {
@@ -45110,13 +45031,13 @@ function runtimePaths(stateDir) {
45110
45031
 
45111
45032
  // src/platform/process-memory.ts
45112
45033
  var import_node_child_process4 = require("child_process");
45113
- var import_promises9 = require("fs/promises");
45034
+ var import_promises10 = require("fs/promises");
45114
45035
  var import_node_util3 = require("util");
45115
45036
  var execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process4.execFile);
45116
45037
  var PROBE_TIMEOUT_MS = 2e3;
45117
45038
  async function readProcessRss(pid) {
45118
45039
  if (process.platform === "linux") {
45119
- const status = await (0, import_promises9.readFile)(`/proc/${pid}/status`, "utf8").catch(() => null);
45040
+ const status = await (0, import_promises10.readFile)(`/proc/${pid}/status`, "utf8").catch(() => null);
45120
45041
  const kilobytes = status === null ? void 0 : /^VmRSS:\s+(\d+)\s+kB$/m.exec(status)?.[1];
45121
45042
  return kilobytes === void 0 ? null : Number(kilobytes) * 1024;
45122
45043
  }
@@ -45133,7 +45054,7 @@ async function readProcessRss(pid) {
45133
45054
  }
45134
45055
 
45135
45056
  // src/platform/runtime-host.ts
45136
- var import_promises10 = require("fs/promises");
45057
+ var import_promises11 = require("fs/promises");
45137
45058
  var RUNTIME_HOST_KINDS = ["app", "standalone"];
45138
45059
 
45139
45060
  // src/platform/service/exec.ts
@@ -45172,7 +45093,7 @@ init_alan_code();
45172
45093
 
45173
45094
  // src/capabilities/providers/commands.ts
45174
45095
  var import_node_fs5 = require("fs");
45175
- var import_promises14 = require("fs/promises");
45096
+ var import_promises15 = require("fs/promises");
45176
45097
  var import_node_path6 = require("path");
45177
45098
  var PROVIDER_COMMANDS = [
45178
45099
  // The engine, not a CLI of its own: `resolveProviderExecutable` finds the bundled one first.
@@ -45206,8 +45127,8 @@ function pathDelimiter(platform) {
45206
45127
  }
45207
45128
  async function isRunnable(path, platform) {
45208
45129
  try {
45209
- if (!(await (0, import_promises14.stat)(path)).isFile()) return false;
45210
- if (platform !== "win32") await (0, import_promises14.access)(path, import_node_fs5.constants.X_OK);
45130
+ if (!(await (0, import_promises15.stat)(path)).isFile()) return false;
45131
+ if (platform !== "win32") await (0, import_promises15.access)(path, import_node_fs5.constants.X_OK);
45211
45132
  return true;
45212
45133
  } catch {
45213
45134
  return false;
@@ -45252,7 +45173,7 @@ function resolveProviderExecutable(provider4, env, platform) {
45252
45173
  // ../shared/dist/node/skill-package.js
45253
45174
  var import_node_buffer = require("buffer");
45254
45175
  var import_node_crypto6 = require("crypto");
45255
- var import_promises15 = require("fs/promises");
45176
+ var import_promises16 = require("fs/promises");
45256
45177
  var import_node_path7 = require("path");
45257
45178
  var import_yaml = __toESM(require_dist(), 1);
45258
45179
  init_contracts();
@@ -45342,11 +45263,11 @@ async function inspectSkillPackage(packageRoot, options = {}) {
45342
45263
  };
45343
45264
  }
45344
45265
  async function requirePackageRoot(packageRoot) {
45345
- const root = await (0, import_promises15.realpath)((0, import_node_path7.resolve)(packageRoot)).catch(() => null);
45266
+ const root = await (0, import_promises16.realpath)((0, import_node_path7.resolve)(packageRoot)).catch(() => null);
45346
45267
  if (!root) {
45347
45268
  throw new SkillPackageError("INVALID_PACKAGE_ROOT", "Skill package directory does not exist");
45348
45269
  }
45349
- const rootStat = await (0, import_promises15.lstat)(root);
45270
+ const rootStat = await (0, import_promises16.lstat)(root);
45350
45271
  if (!rootStat.isDirectory()) {
45351
45272
  throw new SkillPackageError("INVALID_PACKAGE_ROOT", "Skill package root must be a directory");
45352
45273
  }
@@ -45366,13 +45287,13 @@ async function walkPackage(root, ignoredPaths) {
45366
45287
  }
45367
45288
  return files;
45368
45289
  async function walkDirectory(directory) {
45369
- const entries = await (0, import_promises15.readdir)(directory, { withFileTypes: true });
45290
+ const entries = await (0, import_promises16.readdir)(directory, { withFileTypes: true });
45370
45291
  for (const entry of entries) {
45371
45292
  const absolutePath = (0, import_node_path7.resolve)(directory, entry.name);
45372
45293
  const normalizedPath = normalizeRelativePath(root, absolutePath);
45373
45294
  if (isIgnored(normalizedPath, entry.name, entry.isDirectory(), ignored2))
45374
45295
  continue;
45375
- const entryStat = await (0, import_promises15.lstat)(absolutePath);
45296
+ const entryStat = await (0, import_promises16.lstat)(absolutePath);
45376
45297
  if (entryStat.isSymbolicLink()) {
45377
45298
  throw new SkillPackageError("SYMLINK_BLOCKED", `Nested symbolic links are not allowed in Skill packages: ${normalizedPath}`, normalizedPath);
45378
45299
  }
@@ -45481,7 +45402,7 @@ function isSecretPath(path) {
45481
45402
  return name.endsWith(".private-key.pem") || name.endsWith(".private-key.key");
45482
45403
  }
45483
45404
  async function readPackageFile(file2) {
45484
- const bytes = await (0, import_promises15.readFile)(file2.absolutePath);
45405
+ const bytes = await (0, import_promises16.readFile)(file2.absolutePath);
45485
45406
  return {
45486
45407
  bytes,
45487
45408
  manifest: {
@@ -45651,7 +45572,7 @@ function uint642(value) {
45651
45572
  }
45652
45573
 
45653
45574
  // src/capabilities/skills/store.ts
45654
- var import_promises16 = require("fs/promises");
45575
+ var import_promises17 = require("fs/promises");
45655
45576
  var import_node_path8 = require("path");
45656
45577
  init_runtime_v2();
45657
45578
  init_zod();
@@ -45693,7 +45614,7 @@ async function readLocalSkills(layout) {
45693
45614
  async function isLocalSkillCurrent(entry, contentHash, ignoredPaths) {
45694
45615
  if (entry.contentHash !== contentHash) return false;
45695
45616
  try {
45696
- if (await (0, import_promises16.realpath)(entry.path) !== entry.path) return false;
45617
+ if (await (0, import_promises17.realpath)(entry.path) !== entry.path) return false;
45697
45618
  const inspected = await inspectSkillPackage(entry.path, { expectedName: null, ignoredPaths });
45698
45619
  return inspected.contentHash === contentHash;
45699
45620
  } catch {
@@ -45708,7 +45629,7 @@ async function resolveLocalSkill(local, invocation) {
45708
45629
  }
45709
45630
  async function hasSkillFile(directory) {
45710
45631
  try {
45711
- return (await (0, import_promises16.stat)((0, import_node_path8.join)(directory, "SKILL.md"))).isFile();
45632
+ return (await (0, import_promises17.stat)((0, import_node_path8.join)(directory, "SKILL.md"))).isFile();
45712
45633
  } catch {
45713
45634
  return false;
45714
45635
  }
@@ -45752,7 +45673,7 @@ async function resolveSkillInvocations(layout, invocations) {
45752
45673
  var import_node_path11 = require("path");
45753
45674
 
45754
45675
  // src/capabilities/workspace/approved-paths.ts
45755
- var import_promises17 = require("fs/promises");
45676
+ var import_promises18 = require("fs/promises");
45756
45677
  init_zod();
45757
45678
 
45758
45679
  // src/capabilities/workspace/paths.ts
@@ -45790,7 +45711,7 @@ var storeSchema = external_exports.object({
45790
45711
  });
45791
45712
  async function realpathOrNull(path) {
45792
45713
  try {
45793
- return await (0, import_promises17.realpath)(path);
45714
+ return await (0, import_promises18.realpath)(path);
45794
45715
  } catch (error61) {
45795
45716
  const code = errnoCode(error61);
45796
45717
  if (code === "ENOENT" || code === "ENOTDIR" || code === "EACCES" || code === "EPERM") {
@@ -45850,7 +45771,7 @@ async function openApprovedPaths(options) {
45850
45771
 
45851
45772
  // src/capabilities/workspace/locks.ts
45852
45773
  var import_node_crypto7 = require("crypto");
45853
- var import_promises18 = require("fs/promises");
45774
+ var import_promises19 = require("fs/promises");
45854
45775
  var import_node_path10 = require("path");
45855
45776
  init_zod();
45856
45777
  var LOCK_FORMAT = 1;
@@ -45871,7 +45792,7 @@ function repositoryLockKey(commonDir, platform) {
45871
45792
  async function readOwner(path) {
45872
45793
  let text2;
45873
45794
  try {
45874
- text2 = await (0, import_promises18.readFile)(path, "utf8");
45795
+ text2 = await (0, import_promises19.readFile)(path, "utf8");
45875
45796
  } catch (error61) {
45876
45797
  if (errnoCode(error61) === "ENOENT") return { kind: "missing" };
45877
45798
  return { kind: "unreadable" };
@@ -45892,7 +45813,7 @@ async function removeIfSame(path, expected) {
45892
45813
  if (current.kind !== "owner" || current.owner.since !== expected.since) return;
45893
45814
  if (current.owner.pid !== expected.pid || current.owner.holder !== expected.holder) return;
45894
45815
  }
45895
- await (0, import_promises18.unlink)(path).catch((error61) => {
45816
+ await (0, import_promises19.unlink)(path).catch((error61) => {
45896
45817
  if (errnoCode(error61) !== "ENOENT") throw error61;
45897
45818
  });
45898
45819
  }
@@ -45917,7 +45838,7 @@ function openRepositoryLocks(options) {
45917
45838
  await removeIfSame(path, read.owner);
45918
45839
  return null;
45919
45840
  }
45920
- const age = await (0, import_promises18.stat)(path).then(
45841
+ const age = await (0, import_promises19.stat)(path).then(
45921
45842
  (info) => clock.now() - info.mtimeMs,
45922
45843
  () => 0
45923
45844
  );
@@ -45932,12 +45853,12 @@ function openRepositoryLocks(options) {
45932
45853
  const folder = async (commonDir) => {
45933
45854
  const key = repositoryLockKey(commonDir, platform);
45934
45855
  const dir = (0, import_node_path10.join)(options.dir, key);
45935
- await (0, import_promises18.mkdir)(dir, { recursive: true, mode: 448 });
45856
+ await (0, import_promises19.mkdir)(dir, { recursive: true, mode: 448 });
45936
45857
  return { key, dir };
45937
45858
  };
45938
45859
  const createExclusive = async (path, owner) => {
45939
45860
  try {
45940
- const handle = await (0, import_promises18.open)(path, "wx", 384);
45861
+ const handle = await (0, import_promises19.open)(path, "wx", 384);
45941
45862
  try {
45942
45863
  await handle.writeFile(JSON.stringify(owner));
45943
45864
  } finally {
@@ -45950,7 +45871,7 @@ function openRepositoryLocks(options) {
45950
45871
  }
45951
45872
  };
45952
45873
  const liveRun = async (dir) => {
45953
- const entries = await (0, import_promises18.readdir)(dir);
45874
+ const entries = await (0, import_promises19.readdir)(dir);
45954
45875
  for (const entry of entries) {
45955
45876
  if (!entry.startsWith(RUN_FILE_PREFIX)) continue;
45956
45877
  const holder = await heldBy((0, import_node_path10.join)(dir, entry));
@@ -46016,7 +45937,7 @@ function defaultInstallDir({ platform, home, env }) {
46016
45937
 
46017
45938
  // src/sessions/index.ts
46018
45939
  var import_node_crypto10 = require("crypto");
46019
- var import_promises29 = require("fs/promises");
45940
+ var import_promises30 = require("fs/promises");
46020
45941
  var import_node_os6 = require("os");
46021
45942
  var import_node_path20 = require("path");
46022
45943
 
@@ -46202,7 +46123,7 @@ function createConversationMcpAuthorization(options) {
46202
46123
  }
46203
46124
 
46204
46125
  // src/holder/run-inputs.ts
46205
- var import_promises23 = require("fs/promises");
46126
+ var import_promises24 = require("fs/promises");
46206
46127
  var import_node_path13 = require("path");
46207
46128
  var NO_RUN_INPUTS = {
46208
46129
  attachments: [],
@@ -46218,16 +46139,16 @@ function safeFilename(filename) {
46218
46139
  async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [] }) {
46219
46140
  const dir = (0, import_node_path13.join)(tmpDir, "runs", spec.runId);
46220
46141
  const cleanup = async () => {
46221
- await (0, import_promises23.rm)(dir, { recursive: true, force: true });
46142
+ await (0, import_promises24.rm)(dir, { recursive: true, force: true });
46222
46143
  };
46223
46144
  try {
46224
46145
  const credential = await source.fetchProviderCredential(spec.runId, signal);
46225
46146
  const attachments = [];
46226
- if (spec.attachments?.length) await (0, import_promises23.mkdir)(dir, { recursive: true, mode: 448 });
46147
+ if (spec.attachments?.length) await (0, import_promises24.mkdir)(dir, { recursive: true, mode: 448 });
46227
46148
  for (const [index, attachment] of (spec.attachments ?? []).entries()) {
46228
46149
  const bytes = await source.downloadAttachment(spec.runId, attachment.id, signal);
46229
46150
  const path = (0, import_node_path13.join)(dir, `${index}-${safeFilename(attachment.filename)}`);
46230
- await (0, import_promises23.writeFile)(path, bytes, { mode: 384 });
46151
+ await (0, import_promises24.writeFile)(path, bytes, { mode: 384 });
46231
46152
  attachments.push({
46232
46153
  id: attachment.id,
46233
46154
  kind: attachment.kind,
@@ -46255,7 +46176,7 @@ init_runtime_v2();
46255
46176
 
46256
46177
  // src/holder/admission.ts
46257
46178
  var import_node_fs7 = require("fs");
46258
- var import_promises26 = require("fs/promises");
46179
+ var import_promises27 = require("fs/promises");
46259
46180
  var import_node_os5 = require("os");
46260
46181
  var import_node_path17 = require("path");
46261
46182
  init_constants();
@@ -46269,7 +46190,7 @@ function resolveAlanDefaultWorkspacePath(homeDirectory = (0, import_node_os4.hom
46269
46190
  }
46270
46191
 
46271
46192
  // src/holder/admission-relocation.ts
46272
- var import_promises24 = require("fs/promises");
46193
+ var import_promises25 = require("fs/promises");
46273
46194
  var import_node_path15 = require("path");
46274
46195
  var MAX_RELOCATION_CANDIDATES = 200;
46275
46196
  var RELOCATION_BUDGET_MS = 2e4;
@@ -46305,7 +46226,7 @@ async function originIdentity(git, path, signal) {
46305
46226
  }
46306
46227
  async function childDirectories(parent, limit) {
46307
46228
  try {
46308
- const entries = await (0, import_promises24.readdir)(parent, { withFileTypes: true });
46229
+ const entries = await (0, import_promises25.readdir)(parent, { withFileTypes: true });
46309
46230
  return entries.filter((entry) => entry.isDirectory()).slice(0, limit).map((entry) => (0, import_node_path15.join)(parent, entry.name));
46310
46231
  } catch {
46311
46232
  return [];
@@ -46341,7 +46262,7 @@ async function discoverRelocatedWorkspace(search) {
46341
46262
  }
46342
46263
 
46343
46264
  // src/holder/lease.ts
46344
- var import_promises25 = require("fs/promises");
46265
+ var import_promises26 = require("fs/promises");
46345
46266
  var import_node_path16 = require("path");
46346
46267
  var LEASE_CHECK_EVERY_MS = 5e3;
46347
46268
  var MAX_TRANSIENT_FAILURES = 3;
@@ -46356,8 +46277,8 @@ function identityFailure(code, workspacePath) {
46356
46277
  return { code, problemCode: "app.workspace.missing", message: MESSAGES[code], workspacePath };
46357
46278
  }
46358
46279
  async function fileIdentity(path) {
46359
- const canonical = await (0, import_promises25.realpath)(path);
46360
- const info = await (0, import_promises25.stat)(canonical, { bigint: true });
46280
+ const canonical = await (0, import_promises26.realpath)(path);
46281
+ const info = await (0, import_promises26.stat)(canonical, { bigint: true });
46361
46282
  return `${canonical}:${info.dev}:${info.ino}`;
46362
46283
  }
46363
46284
  async function snapshot(git, path, signal) {
@@ -46376,7 +46297,7 @@ async function snapshot(git, path, signal) {
46376
46297
  workspace: await fileIdentity(path),
46377
46298
  repository: await fileIdentity(commonDir),
46378
46299
  worktree: await fileIdentity(gitDir),
46379
- commonDir: await (0, import_promises25.realpath)(commonDir)
46300
+ commonDir: await (0, import_promises26.realpath)(commonDir)
46380
46301
  };
46381
46302
  } catch {
46382
46303
  return null;
@@ -46389,7 +46310,7 @@ async function gitValue(git, path, args, signal) {
46389
46310
  }
46390
46311
  async function pathExists(path) {
46391
46312
  try {
46392
- await (0, import_promises25.stat)(path);
46313
+ await (0, import_promises26.stat)(path);
46393
46314
  return true;
46394
46315
  } catch (error61) {
46395
46316
  return errnoCode(error61) !== "ENOENT" && errnoCode(error61) !== "ENOTDIR";
@@ -46398,13 +46319,13 @@ async function pathExists(path) {
46398
46319
  async function hasGitMarker(path) {
46399
46320
  let directory;
46400
46321
  try {
46401
- directory = await (0, import_promises25.realpath)(path);
46322
+ directory = await (0, import_promises26.realpath)(path);
46402
46323
  } catch {
46403
46324
  return true;
46404
46325
  }
46405
46326
  for (; ; ) {
46406
46327
  try {
46407
- await (0, import_promises25.stat)((0, import_node_path16.join)(directory, ".git"));
46328
+ await (0, import_promises26.stat)((0, import_node_path16.join)(directory, ".git"));
46408
46329
  return true;
46409
46330
  } catch (error61) {
46410
46331
  const code = errnoCode(error61);
@@ -46574,7 +46495,7 @@ function volumeRoot(path) {
46574
46495
  }
46575
46496
  async function exists(path) {
46576
46497
  try {
46577
- await (0, import_promises26.stat)(path);
46498
+ await (0, import_promises27.stat)(path);
46578
46499
  return true;
46579
46500
  } catch {
46580
46501
  return false;
@@ -46582,10 +46503,10 @@ async function exists(path) {
46582
46503
  }
46583
46504
  async function inspectReadiness(path) {
46584
46505
  try {
46585
- if (!(await (0, import_promises26.stat)(path)).isDirectory()) {
46506
+ if (!(await (0, import_promises27.stat)(path)).isDirectory()) {
46586
46507
  return { ready: false, missing: true, message: MESSAGES2.missing };
46587
46508
  }
46588
- await (0, import_promises26.access)(path, import_node_fs7.constants.R_OK | import_node_fs7.constants.W_OK | import_node_fs7.constants.X_OK);
46509
+ await (0, import_promises27.access)(path, import_node_fs7.constants.R_OK | import_node_fs7.constants.W_OK | import_node_fs7.constants.X_OK);
46589
46510
  return { ready: true };
46590
46511
  } catch (error61) {
46591
46512
  const code = errnoCode(error61) ?? "";
@@ -46663,8 +46584,8 @@ async function admitDefaultWorkspace(spec, context, skills) {
46663
46584
  const { env } = context;
46664
46585
  const path = resolveAlanDefaultWorkspacePath(env.HOME || env.USERPROFILE || (0, import_node_os5.homedir)());
46665
46586
  try {
46666
- await (0, import_promises26.mkdir)(path, { recursive: true, mode: 448 });
46667
- await (0, import_promises26.access)(path, import_node_fs7.constants.R_OK | import_node_fs7.constants.W_OK | import_node_fs7.constants.X_OK);
46587
+ await (0, import_promises27.mkdir)(path, { recursive: true, mode: 448 });
46588
+ await (0, import_promises27.access)(path, import_node_fs7.constants.R_OK | import_node_fs7.constants.W_OK | import_node_fs7.constants.X_OK);
46668
46589
  return {
46669
46590
  kind: "admitted",
46670
46591
  spec: { ...spec, projectPath: path },
@@ -46776,7 +46697,7 @@ async function respondToTurn(runningRunId, gate, driver, request2) {
46776
46697
  }
46777
46698
 
46778
46699
  // src/holder/session-facts.ts
46779
- var import_promises27 = require("fs/promises");
46700
+ var import_promises28 = require("fs/promises");
46780
46701
  var CLI_RSS_CACHE_MS = 1e4;
46781
46702
  var LOGIN_PROBLEM_PREFIX = "cli.auth.";
46782
46703
  function isLoginFailure(result) {
@@ -46800,8 +46721,8 @@ function createSessionFacts(options) {
46800
46721
  const path = await resolveCommandOnPath(command, env, platform);
46801
46722
  if (path === null) return null;
46802
46723
  try {
46803
- const real = await (0, import_promises27.realpath)(path);
46804
- const info = await (0, import_promises27.stat)(real);
46724
+ const real = await (0, import_promises28.realpath)(path);
46725
+ const info = await (0, import_promises28.stat)(real);
46805
46726
  return { command, key: `${real}:${info.ino}:${info.size}:${info.mtimeMs}` };
46806
46727
  } catch {
46807
46728
  return null;
@@ -46877,7 +46798,7 @@ function createSessionFacts(options) {
46877
46798
  init_acp2();
46878
46799
 
46879
46800
  // src/run-log/directory.ts
46880
- var import_promises28 = require("fs/promises");
46801
+ var import_promises29 = require("fs/promises");
46881
46802
  var import_node_path18 = require("path");
46882
46803
  init_runtime_v2();
46883
46804
  init_zod();
@@ -46893,7 +46814,7 @@ function runDirectory(runsDir, runId) {
46893
46814
  }
46894
46815
  async function isRunClaimed(runsDir, runId) {
46895
46816
  try {
46896
- return (await (0, import_promises28.stat)(runDirectory(runsDir, runId).log)).size > 0;
46817
+ return (await (0, import_promises29.stat)(runDirectory(runsDir, runId).log)).size > 0;
46897
46818
  } catch (error61) {
46898
46819
  if (errnoCode(error61) === "ENOENT") return false;
46899
46820
  throw error61;
@@ -47145,10 +47066,6 @@ async function runWithInputs({ spec, leaseTargets, skills }, context, sink, sign
47145
47066
  _promise2 && await _promise2;
47146
47067
  }
47147
47068
  }
47148
- function recordRelevantContext(spec, append) {
47149
- if (spec.relevantContext === void 0) return;
47150
- append(fitForRunLog(contextRecallUpdate(`relevant-context-${spec.runId}`, spec.relevantContext)));
47151
- }
47152
47069
  async function admitAndRun(spec, context, append, sink, signal) {
47153
47070
  if (context.workspace === void 0) {
47154
47071
  if (spec.skillInvocations?.length) {
@@ -47158,7 +47075,6 @@ async function admitAndRun(spec, context, append, sink, signal) {
47158
47075
  message: "Selected skills need this computer's skill sync, which this holder does not have."
47159
47076
  };
47160
47077
  }
47161
- recordRelevantContext(spec, append);
47162
47078
  return runWithInputs({ spec, leaseTargets: [], skills: [] }, context, sink, signal);
47163
47079
  }
47164
47080
  const admission = await admitRun(spec, context.workspace.admission, signal);
@@ -47167,7 +47083,6 @@ async function admitAndRun(spec, context, append, sink, signal) {
47167
47083
  return { outcome: "rejected", rejection: admission.rejection, message: admission.message };
47168
47084
  }
47169
47085
  if (admission.relocated !== null) append(admission.relocated);
47170
- recordRelevantContext(spec, append);
47171
47086
  return runWithInputs(admission, context, sink, signal);
47172
47087
  }
47173
47088
  async function claimRun(spec, context) {