@alan-ai-hq/agent-manager-linux-arm64 0.1.174 → 0.1.175

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/alan-holder.cjs CHANGED
@@ -20644,6 +20644,11 @@ var init_activity_lease = __esm({
20644
20644
  mainThreadLagMs: external_exports.number().int().nonnegative(),
20645
20645
  runs: external_exports.array(leasedRunSchema),
20646
20646
  holders: external_exports.array(leasedHolderSchema),
20647
+ /**
20648
+ * Desired runs not started because their conversation is still running an earlier turn.
20649
+ * Absent from older runtimes.
20650
+ */
20651
+ busyRunIds: external_exports.array(runIdSchema).max(200).optional(),
20647
20652
  vm: leasedVmPressureSchema.nullable()
20648
20653
  });
20649
20654
  activityLeaseAckSchema = external_exports.object({
@@ -21533,6 +21538,104 @@ var init_contracts = __esm({
21533
21538
  }
21534
21539
  });
21535
21540
 
21541
+ // ../shared/src/constants/branding.ts
21542
+ var ALAN_GIT_BOT_EMAIL;
21543
+ var init_branding = __esm({
21544
+ "../shared/src/constants/branding.ts"() {
21545
+ "use strict";
21546
+ ALAN_GIT_BOT_EMAIL = "agent@tryalan.ai";
21547
+ }
21548
+ });
21549
+
21550
+ // ../shared/src/runtime-v2/commit-attribution.ts
21551
+ function coAuthorTrailer(coAuthor) {
21552
+ return `Co-Authored-By: ${coAuthor.name} <${coAuthor.email}>`;
21553
+ }
21554
+ function commitAttributionScript() {
21555
+ const pattern = FOREIGN_ATTRIBUTION_PATTERN.replaceAll("[ ]", "[[:blank:]]");
21556
+ return `#!/bin/sh
21557
+ # Managed by Alan; rewritten whenever the runtime starts.
21558
+ name=$(basename "$0")
21559
+ dir=$(cd "$(dirname "$0")" && pwd -P)
21560
+ [ "$name" = ${COMMIT_ATTRIBUTION_SCRIPT} ] || dir=$(dirname "$dir")
21561
+ pattern='${pattern}'
21562
+ coauthor=$(cat "$dir/${COMMIT_ATTRIBUTION_COAUTHOR_FILE}" 2>/dev/null)
21563
+ author_email=$(git var GIT_AUTHOR_IDENT 2>/dev/null | sed -n 's/.*<\\(.*\\)>.*/\\1/p')
21564
+
21565
+ normalize() {
21566
+ if [ -n "$coauthor" ] && [ "$author_email" != '${ALAN_GIT_BOT_EMAIL}' ] &&
21567
+ ! printf '%s' "$coauthor" | grep -qiF "<$author_email>"; then
21568
+ grep -viE "$pattern" | git interpret-trailers --trailer "Co-Authored-By: $coauthor"
21569
+ else
21570
+ grep -viE "$pattern"
21571
+ fi
21572
+ }
21573
+
21574
+ if [ "$name" = ${COMMIT_ATTRIBUTION_SCRIPT} ]; then
21575
+ normalize
21576
+ exit 0
21577
+ fi
21578
+
21579
+ if [ "$name" = prepare-commit-msg ] && [ -f "$1" ]; then
21580
+ case "$2" in
21581
+ merge|squash) ;;
21582
+ *) normalize < "$1" > "$1.alan" && mv "$1.alan" "$1" || rm -f "$1.alan" ;;
21583
+ esac
21584
+ fi
21585
+
21586
+ own=$(git config --local --get core.hooksPath || git config --global --get core.hooksPath || git config --system --get core.hooksPath)
21587
+ if [ -z "$own" ]; then
21588
+ own="$(git rev-parse --git-common-dir)/hooks"
21589
+ else
21590
+ case "$own" in
21591
+ "~/"*) own="$HOME/\${own#\\~/}" ;;
21592
+ /*) ;;
21593
+ *) own="$(git rev-parse --show-toplevel)/$own" ;;
21594
+ esac
21595
+ fi
21596
+ # Skips this script and the per-repo hook older sandboxes installed; both carry the marker.
21597
+ [ -x "$own/$name" ] && ! grep -qs '^# Managed by Alan' "$own/$name" && exec "$own/$name" "$@"
21598
+ exit 0
21599
+ `;
21600
+ }
21601
+ var TRAILER_VALUE, gitCoAuthorSchema, FOREIGN_ATTRIBUTION_PATTERN, FOREIGN_ATTRIBUTION, COMMIT_ATTRIBUTION_HOOKS, COMMIT_ATTRIBUTION_SCRIPT, COMMIT_ATTRIBUTION_COAUTHOR_FILE;
21602
+ var init_commit_attribution = __esm({
21603
+ "../shared/src/runtime-v2/commit-attribution.ts"() {
21604
+ "use strict";
21605
+ init_zod();
21606
+ init_branding();
21607
+ TRAILER_VALUE = /^[^\r\n<>]+$/;
21608
+ gitCoAuthorSchema = external_exports.object({
21609
+ name: external_exports.string().min(1).max(256).regex(TRAILER_VALUE),
21610
+ email: external_exports.string().min(3).max(320).regex(/^[^\s<>]+@[^\s<>]+$/)
21611
+ });
21612
+ FOREIGN_ATTRIBUTION_PATTERN = "^[ ]*((co-authored-by|assisted-by|generated-by|made-with):|(\u{1F916}[ ]*)?generated (with|by) )";
21613
+ FOREIGN_ATTRIBUTION = new RegExp(FOREIGN_ATTRIBUTION_PATTERN, "iu");
21614
+ COMMIT_ATTRIBUTION_HOOKS = [
21615
+ "applypatch-msg",
21616
+ "pre-applypatch",
21617
+ "post-applypatch",
21618
+ "pre-commit",
21619
+ "pre-merge-commit",
21620
+ "prepare-commit-msg",
21621
+ "commit-msg",
21622
+ "post-commit",
21623
+ "pre-rebase",
21624
+ "post-checkout",
21625
+ "post-merge",
21626
+ "pre-push",
21627
+ "pre-auto-gc",
21628
+ "post-rewrite",
21629
+ "post-index-change",
21630
+ "reference-transaction",
21631
+ "push-to-checkout",
21632
+ "sendemail-validate"
21633
+ ];
21634
+ COMMIT_ATTRIBUTION_SCRIPT = "alan-trailers";
21635
+ COMMIT_ATTRIBUTION_COAUTHOR_FILE = "coauthor";
21636
+ }
21637
+ });
21638
+
21536
21639
  // ../shared/src/runtime-v2/run-context.ts
21537
21640
  function wire() {
21538
21641
  return (schema) => schema;
@@ -21694,6 +21797,7 @@ var init_desired_state = __esm({
21694
21797
  init_cloud_repositories();
21695
21798
  init_contracts();
21696
21799
  init_agent_context();
21800
+ init_commit_attribution();
21697
21801
  init_ids();
21698
21802
  init_run_context();
21699
21803
  init_workspace();
@@ -21748,7 +21852,9 @@ var init_desired_state = __esm({
21748
21852
  contextGraphEnabled: external_exports.boolean().optional(),
21749
21853
  cloudEnvironmentId: external_exports.guid().optional(),
21750
21854
  sandboxId: external_exports.string().min(1).optional(),
21751
- localRepoUrls: external_exports.array(external_exports.string().min(1)).optional()
21855
+ localRepoUrls: external_exports.array(external_exports.string().min(1)).optional(),
21856
+ /** The deployed GitHub App's bot, credited on every commit the turn makes; absent from older servers. */
21857
+ gitCoAuthor: gitCoAuthorSchema.optional()
21752
21858
  // Never here: the provider API key. The holder fetches it per run (RUN_PROVIDER_CREDENTIAL_PATH).
21753
21859
  });
21754
21860
  desiredRunSchema = external_exports.object({
@@ -22840,6 +22946,7 @@ var init_runtime_v2 = __esm({
22840
22946
  init_activity_lease();
22841
22947
  init_agent_context();
22842
22948
  init_capabilities();
22949
+ init_commit_attribution();
22843
22950
  init_desired_state();
22844
22951
  init_files();
22845
22952
  init_git_capability();
@@ -25811,13 +25918,6 @@ var init_agent_package = __esm({
25811
25918
  }
25812
25919
  });
25813
25920
 
25814
- // ../shared/src/constants/branding.ts
25815
- var init_branding = __esm({
25816
- "../shared/src/constants/branding.ts"() {
25817
- "use strict";
25818
- }
25819
- });
25820
-
25821
25921
  // ../shared/src/constants/colors.ts
25822
25922
  var CATEGORICAL_COLORS, CATEGORICAL_COLOR_VALUES, CATEGORICAL_COLOR_VALUE_SET;
25823
25923
  var init_colors = __esm({
@@ -34288,13 +34388,20 @@ function modelArgs(input2) {
34288
34388
  effort: option("--effort", effort)
34289
34389
  };
34290
34390
  }
34291
- function skillListingArgs(input2) {
34292
- const chars = input2.skillListingMaxDescChars;
34391
+ function settingsArgs(input2) {
34293
34392
  const ownSettings = (input2.extraArgs ?? []).some(
34294
34393
  (arg) => arg === "--settings" || arg.startsWith("--settings=")
34295
34394
  );
34296
- if (chars === void 0 || !input2.capabilities.supportsPluginDir || ownSettings) return [];
34297
- return ["--settings", JSON.stringify({ skillListingMaxDescChars: chars })];
34395
+ if (!input2.capabilities.supportsPluginDir || ownSettings) return [];
34396
+ const chars = input2.skillListingMaxDescChars;
34397
+ return [
34398
+ "--settings",
34399
+ JSON.stringify({
34400
+ attribution: { commit: "", pr: "" },
34401
+ includeCoAuthoredBy: false,
34402
+ ...chars === void 0 ? {} : { skillListingMaxDescChars: chars }
34403
+ })
34404
+ ];
34298
34405
  }
34299
34406
  function buildClaudeArgs(input2) {
34300
34407
  const { capabilities } = input2;
@@ -34320,7 +34427,7 @@ function buildClaudeArgs(input2) {
34320
34427
  // Without it the whole answer lands in one frame at turn end.
34321
34428
  ...capabilities.supportsPartialMessages ? ["--include-partial-messages"] : [],
34322
34429
  ...capabilities.supportsPluginDir ? (input2.pluginDirs ?? []).flatMap((dir) => ["--plugin-dir", dir]) : [],
34323
- ...skillListingArgs(input2),
34430
+ ...settingsArgs(input2),
34324
34431
  ...option("--resume", input2.resumeId),
34325
34432
  "--chrome",
34326
34433
  ...input2.extraArgs ?? []
@@ -51413,8 +51520,11 @@ async function readCheckoutFreshness(dir, path) {
51413
51520
  }
51414
51521
  }
51415
51522
 
51416
- // src/capabilities/providers/alan-code.ts
51417
- init_alan_code();
51523
+ // src/capabilities/git/commit-attribution.ts
51524
+ var import_node_crypto29 = require("crypto");
51525
+ var import_promises26 = require("fs/promises");
51526
+ var import_node_path30 = require("path");
51527
+ init_runtime_v2();
51418
51528
 
51419
51529
  // src/capabilities/providers/commands.ts
51420
51530
  var import_node_fs17 = require("fs");
@@ -51484,7 +51594,58 @@ async function resolveCommandOnPath(command, env, platform) {
51484
51594
  return null;
51485
51595
  }
51486
51596
 
51597
+ // src/capabilities/git/commit-attribution.ts
51598
+ function shellQuote(value) {
51599
+ return `'${value.replace(/'/g, "'\\''")}'`;
51600
+ }
51601
+ async function replaceFile(path, content, mode) {
51602
+ const temp = `${path}.${(0, import_node_crypto29.randomUUID)()}.tmp`;
51603
+ await (0, import_promises26.writeFile)(temp, content, { mode });
51604
+ await (0, import_promises26.rename)(temp, path);
51605
+ }
51606
+ async function replaceSymlink(path, target) {
51607
+ const temp = `${path}.${(0, import_node_crypto29.randomUUID)()}.tmp`;
51608
+ await (0, import_promises26.symlink)(target, temp);
51609
+ await (0, import_promises26.rename)(temp, path);
51610
+ }
51611
+ async function installCommitAttribution(input2) {
51612
+ if (input2.platform === "win32") return null;
51613
+ const binDir = (0, import_node_path30.join)(input2.dir, "bin");
51614
+ const hooksDir = (0, import_node_path30.join)(input2.dir, "hooks");
51615
+ const delimiter2 = pathDelimiter(input2.platform);
51616
+ const path = envValue(input2.env, "PATH").split(delimiter2).filter((entry) => entry.length > 0 && entry !== binDir).join(delimiter2);
51617
+ const realGit = await resolveCommandOnPath("git", { ...input2.env, PATH: path }, input2.platform);
51618
+ if (realGit === null) return null;
51619
+ await (0, import_promises26.mkdir)(binDir, { recursive: true, mode: 493 });
51620
+ await (0, import_promises26.mkdir)(hooksDir, { recursive: true, mode: 493 });
51621
+ await replaceFile((0, import_node_path30.join)(input2.dir, COMMIT_ATTRIBUTION_SCRIPT), commitAttributionScript(), 493);
51622
+ for (const hook of COMMIT_ATTRIBUTION_HOOKS) {
51623
+ await replaceSymlink((0, import_node_path30.join)(hooksDir, hook), (0, import_node_path30.join)("..", COMMIT_ATTRIBUTION_SCRIPT));
51624
+ }
51625
+ await replaceFile(
51626
+ (0, import_node_path30.join)(binDir, "git"),
51627
+ `#!/bin/sh
51628
+ exec ${shellQuote(realGit)} -c core.hooksPath=${shellQuote(hooksDir)} "$@"
51629
+ `,
51630
+ 493
51631
+ );
51632
+ const coAuthorPath = (0, import_node_path30.join)(input2.dir, COMMIT_ATTRIBUTION_COAUTHOR_FILE);
51633
+ return {
51634
+ env: { ...input2.env, PATH: path === "" ? binDir : `${binDir}${delimiter2}${path}` },
51635
+ setCoAuthor: async (coAuthor) => {
51636
+ if (coAuthor === void 0) {
51637
+ await (0, import_promises26.rm)(coAuthorPath, { force: true });
51638
+ return;
51639
+ }
51640
+ const value = coAuthorTrailer(coAuthor).replace(/^Co-Authored-By: /, "");
51641
+ await replaceFile(coAuthorPath, `${value}
51642
+ `, 420);
51643
+ }
51644
+ };
51645
+ }
51646
+
51487
51647
  // src/capabilities/providers/alan-code.ts
51648
+ init_alan_code();
51488
51649
  var ALAN_CODE_BACKEND = "alan_code";
51489
51650
  function withPackagedAlanCodeEngine(env, bundle, platform) {
51490
51651
  if (bundle === void 0) return { ...env };
@@ -51511,16 +51672,16 @@ function resolveProviderExecutable(provider4, env, platform) {
51511
51672
  }
51512
51673
 
51513
51674
  // src/capabilities/providers/managed.ts
51514
- var import_node_crypto29 = require("crypto");
51515
- var import_promises26 = require("fs/promises");
51516
- var import_node_path30 = require("path");
51675
+ var import_node_crypto30 = require("crypto");
51676
+ var import_promises27 = require("fs/promises");
51677
+ var import_node_path31 = require("path");
51517
51678
  init_process();
51518
51679
  init_zod();
51519
51680
  var VERSION = /^[0-9]+\.[0-9]+\.[0-9]+(?:[-+][0-9A-Za-z.-]+)?$/;
51520
51681
  var selectedSchema = external_exports.record(external_exports.string(), external_exports.string());
51521
51682
  async function readManagedProviderVersion(file2, backendKind) {
51522
51683
  try {
51523
- const selected = selectedSchema.parse(JSON.parse(await (0, import_promises26.readFile)(file2, "utf8")));
51684
+ const selected = selectedSchema.parse(JSON.parse(await (0, import_promises27.readFile)(file2, "utf8")));
51524
51685
  const version2 = selected[backendKind];
51525
51686
  return version2 !== void 0 && VERSION.test(version2) ? version2 : null;
51526
51687
  } catch {
@@ -51530,9 +51691,9 @@ async function readManagedProviderVersion(file2, backendKind) {
51530
51691
 
51531
51692
  // ../shared/src/node/skill-package.ts
51532
51693
  var import_node_buffer = require("buffer");
51533
- var import_node_crypto30 = require("crypto");
51534
- var import_promises27 = require("fs/promises");
51535
- var import_node_path31 = require("path");
51694
+ var import_node_crypto31 = require("crypto");
51695
+ var import_promises28 = require("fs/promises");
51696
+ var import_node_path32 = require("path");
51536
51697
  var import_yaml = __toESM(require_dist(), 1);
51537
51698
  init_contracts();
51538
51699
  init_domain();
@@ -51609,7 +51770,7 @@ async function inspectSkillPackage(packageRoot, options = {}) {
51609
51770
  inspectedFiles.sort(comparePackageFiles);
51610
51771
  const parsedMetadata = parseSkillMetadata(
51611
51772
  inspectedFiles.find((file2) => file2.manifest.path === "SKILL.md")?.bytes,
51612
- options.expectedName === void 0 ? (0, import_node_path31.basename)(root) : options.expectedName
51773
+ options.expectedName === void 0 ? (0, import_node_path32.basename)(root) : options.expectedName
51613
51774
  );
51614
51775
  const manifestFiles = inspectedFiles.map((file2) => file2.manifest);
51615
51776
  const diagnostics = [
@@ -51632,11 +51793,11 @@ async function inspectSkillPackage(packageRoot, options = {}) {
51632
51793
  };
51633
51794
  }
51634
51795
  async function requirePackageRoot(packageRoot) {
51635
- const root = await (0, import_promises27.realpath)((0, import_node_path31.resolve)(packageRoot)).catch(() => null);
51796
+ const root = await (0, import_promises28.realpath)((0, import_node_path32.resolve)(packageRoot)).catch(() => null);
51636
51797
  if (!root) {
51637
51798
  throw new SkillPackageError("INVALID_PACKAGE_ROOT", "Skill package directory does not exist");
51638
51799
  }
51639
- const rootStat = await (0, import_promises27.lstat)(root);
51800
+ const rootStat = await (0, import_promises28.lstat)(root);
51640
51801
  if (!rootStat.isDirectory()) {
51641
51802
  throw new SkillPackageError("INVALID_PACKAGE_ROOT", "Skill package root must be a directory");
51642
51803
  }
@@ -51662,12 +51823,12 @@ async function walkPackage(root, ignoredPaths) {
51662
51823
  }
51663
51824
  return files;
51664
51825
  async function walkDirectory(directory) {
51665
- const entries = await (0, import_promises27.readdir)(directory, { withFileTypes: true });
51826
+ const entries = await (0, import_promises28.readdir)(directory, { withFileTypes: true });
51666
51827
  for (const entry of entries) {
51667
- const absolutePath = (0, import_node_path31.resolve)(directory, entry.name);
51828
+ const absolutePath = (0, import_node_path32.resolve)(directory, entry.name);
51668
51829
  const normalizedPath = normalizeRelativePath(root, absolutePath);
51669
51830
  if (isIgnored(normalizedPath, entry.name, entry.isDirectory(), ignored2)) continue;
51670
- const entryStat = await (0, import_promises27.lstat)(absolutePath);
51831
+ const entryStat = await (0, import_promises28.lstat)(absolutePath);
51671
51832
  if (entryStat.isSymbolicLink()) {
51672
51833
  throw new SkillPackageError(
51673
51834
  "SYMLINK_BLOCKED",
@@ -51736,12 +51897,12 @@ function globToRegExp(pattern) {
51736
51897
  return new RegExp(`${source}(?:/.*)?$`);
51737
51898
  }
51738
51899
  function normalizeRelativePath(root, absolutePath) {
51739
- const nativeRelativePath = (0, import_node_path31.relative)(root, absolutePath);
51740
- if (!nativeRelativePath || nativeRelativePath.startsWith(`..${import_node_path31.sep}`) || nativeRelativePath === "..") {
51900
+ const nativeRelativePath = (0, import_node_path32.relative)(root, absolutePath);
51901
+ if (!nativeRelativePath || nativeRelativePath.startsWith(`..${import_node_path32.sep}`) || nativeRelativePath === "..") {
51741
51902
  throw new SkillPackageError("INVALID_PATH", "Skill package path escapes its root");
51742
51903
  }
51743
- const normalized2 = nativeRelativePath.split(import_node_path31.sep).join("/").normalize("NFC");
51744
- if (normalized2.includes("\0") || normalized2.includes("\uFFFD") || import_node_path31.posix.isAbsolute(normalized2)) {
51904
+ const normalized2 = nativeRelativePath.split(import_node_path32.sep).join("/").normalize("NFC");
51905
+ if (normalized2.includes("\0") || normalized2.includes("\uFFFD") || import_node_path32.posix.isAbsolute(normalized2)) {
51745
51906
  throw new SkillPackageError("INVALID_PATH", `Invalid Skill package path: ${normalized2}`);
51746
51907
  }
51747
51908
  return normalized2;
@@ -51788,12 +51949,12 @@ function requireSafeFile(path, size, normalizedPaths) {
51788
51949
  }
51789
51950
  }
51790
51951
  function isSecretPath(path) {
51791
- const name = import_node_path31.posix.basename(path).toLowerCase();
51952
+ const name = import_node_path32.posix.basename(path).toLowerCase();
51792
51953
  if (SECRET_BASENAMES.has(name) || name.startsWith(".env.")) return true;
51793
51954
  return name.endsWith(".private-key.pem") || name.endsWith(".private-key.key");
51794
51955
  }
51795
51956
  async function readPackageFile(file2) {
51796
- const bytes = await (0, import_promises27.readFile)(file2.absolutePath);
51957
+ const bytes = await (0, import_promises28.readFile)(file2.absolutePath);
51797
51958
  return {
51798
51959
  bytes,
51799
51960
  manifest: {
@@ -51811,11 +51972,11 @@ function classifyFileKind(path) {
51811
51972
  if (path.startsWith("scripts/")) return "script";
51812
51973
  if (path.startsWith("references/")) return "reference";
51813
51974
  if (path.startsWith("assets/")) return "asset";
51814
- if (/^(?:licen[cs]e|copying|notice)(?:\.|$)/i.test(import_node_path31.posix.basename(path))) return "license";
51975
+ if (/^(?:licen[cs]e|copying|notice)(?:\.|$)/i.test(import_node_path32.posix.basename(path))) return "license";
51815
51976
  return "other";
51816
51977
  }
51817
51978
  function classifyPreview(path, bytes) {
51818
- const extension = import_node_path31.posix.extname(path).toLowerCase();
51979
+ const extension = import_node_path32.posix.extname(path).toLowerCase();
51819
51980
  if (IMAGE_EXTENSIONS2.has(extension)) return "image";
51820
51981
  if (bytes.includes(0)) return "binary";
51821
51982
  if (MARKDOWN_EXTENSIONS.has(extension)) return "markdown";
@@ -51936,7 +52097,7 @@ function normalizePackageReference(value) {
51936
52097
  }
51937
52098
  const withoutSuffix = trimmed4.split(/[?#]/, 1)[0];
51938
52099
  if (!withoutSuffix) return null;
51939
- const normalized2 = import_node_path31.posix.normalize(withoutSuffix).replace(/^\.\//, "").normalize("NFC");
52100
+ const normalized2 = import_node_path32.posix.normalize(withoutSuffix).replace(/^\.\//, "").normalize("NFC");
51940
52101
  if (normalized2 === ".." || normalized2.startsWith("../")) return null;
51941
52102
  return normalized2;
51942
52103
  }
@@ -51950,7 +52111,7 @@ function comparePackageFiles(left, right) {
51950
52111
  );
51951
52112
  }
51952
52113
  function hashPackageTree(files) {
51953
- const hash2 = (0, import_node_crypto30.createHash)("sha256");
52114
+ const hash2 = (0, import_node_crypto31.createHash)("sha256");
51954
52115
  hash2.update(TREE_HASH_PREFIX);
51955
52116
  for (const file2 of files) {
51956
52117
  const path = import_node_buffer.Buffer.from(file2.path, "utf8");
@@ -51963,7 +52124,7 @@ function hashPackageTree(files) {
51963
52124
  return `sha256:${hash2.digest("hex")}`;
51964
52125
  }
51965
52126
  function sha2562(bytes) {
51966
- return `sha256:${(0, import_node_crypto30.createHash)("sha256").update(bytes).digest("hex")}`;
52127
+ return `sha256:${(0, import_node_crypto31.createHash)("sha256").update(bytes).digest("hex")}`;
51967
52128
  }
51968
52129
  function uint322(value) {
51969
52130
  const buffer = import_node_buffer.Buffer.allocUnsafe(4);
@@ -51977,14 +52138,14 @@ function uint642(value) {
51977
52138
  }
51978
52139
 
51979
52140
  // src/capabilities/skills/store.ts
51980
- var import_promises28 = require("fs/promises");
51981
- var import_node_path32 = require("path");
52141
+ var import_promises29 = require("fs/promises");
52142
+ var import_node_path33 = require("path");
51982
52143
 
51983
52144
  // ../shared/src/node/alan-skill-identity.ts
51984
- var import_node_crypto31 = require("crypto");
52145
+ var import_node_crypto32 = require("crypto");
51985
52146
  var ALAN_SKILL_NAMESPACE = "ec71d99b-d207-4ca2-a9eb-3a7bed4a73fd";
51986
52147
  function uuidV5(name, namespace) {
51987
- const bytes = (0, import_node_crypto31.createHash)("sha1").update(Buffer.from(namespace.replaceAll("-", ""), "hex")).update(name, "utf8").digest().subarray(0, 16);
52148
+ const bytes = (0, import_node_crypto32.createHash)("sha1").update(Buffer.from(namespace.replaceAll("-", ""), "hex")).update(name, "utf8").digest().subarray(0, 16);
51988
52149
  bytes[6] = bytes[6] & 15 | 80;
51989
52150
  bytes[8] = bytes[8] & 63 | 128;
51990
52151
  const hex3 = bytes.toString("hex");
@@ -52001,21 +52162,21 @@ function alanSkillVersionId(slug, contentHash) {
52001
52162
  init_runtime_v2();
52002
52163
  init_zod();
52003
52164
  function skillsLayout(stateDir, home) {
52004
- const root = (0, import_node_path32.join)(stateDir, "skills");
52165
+ const root = (0, import_node_path33.join)(stateDir, "skills");
52005
52166
  return {
52006
52167
  root,
52007
- installedFile: (0, import_node_path32.join)(root, "installed.json"),
52008
- retiredFile: (0, import_node_path32.join)(root, "retired.json"),
52009
- localFile: (0, import_node_path32.join)(root, "local.json"),
52010
- versionsDir: (0, import_node_path32.join)(root, "versions"),
52011
- tmpDir: (0, import_node_path32.join)(root, "tmp"),
52012
- pluginDir: (0, import_node_path32.join)(root, "alan-plugin"),
52013
- pluginSkillsDir: (0, import_node_path32.join)(root, "alan-plugin", "skills"),
52014
- nativeDir: home === void 0 || home === "" ? null : (0, import_node_path32.join)(home, ".agents", "skills")
52168
+ installedFile: (0, import_node_path33.join)(root, "installed.json"),
52169
+ retiredFile: (0, import_node_path33.join)(root, "retired.json"),
52170
+ localFile: (0, import_node_path33.join)(root, "local.json"),
52171
+ versionsDir: (0, import_node_path33.join)(root, "versions"),
52172
+ tmpDir: (0, import_node_path33.join)(root, "tmp"),
52173
+ pluginDir: (0, import_node_path33.join)(root, "alan-plugin"),
52174
+ pluginSkillsDir: (0, import_node_path33.join)(root, "alan-plugin", "skills"),
52175
+ nativeDir: home === void 0 || home === "" ? null : (0, import_node_path33.join)(home, ".agents", "skills")
52015
52176
  };
52016
52177
  }
52017
52178
  function packageDirectory(layout, versionId) {
52018
- return (0, import_node_path32.join)(layout.versionsDir, versionId);
52179
+ return (0, import_node_path33.join)(layout.versionsDir, versionId);
52019
52180
  }
52020
52181
  var installedFileSchema = external_exports.object({ skills: external_exports.array(desiredMachineSkillSchema) });
52021
52182
  async function readInstalledSkills(layout) {
@@ -52042,7 +52203,7 @@ async function readLocalSkills(layout) {
52042
52203
  async function isLocalSkillCurrent(entry, contentHash, ignoredPaths) {
52043
52204
  if (entry.contentHash !== contentHash) return false;
52044
52205
  try {
52045
- if (await (0, import_promises28.realpath)(entry.path) !== entry.path) return false;
52206
+ if (await (0, import_promises29.realpath)(entry.path) !== entry.path) return false;
52046
52207
  const inspected = await inspectSkillPackage(entry.path, { expectedName: null, ignoredPaths });
52047
52208
  return inspected.contentHash === contentHash;
52048
52209
  } catch {
@@ -52057,7 +52218,7 @@ async function resolveLocalSkill(local, invocation) {
52057
52218
  }
52058
52219
  async function hasSkillFile(directory) {
52059
52220
  try {
52060
- return (await (0, import_promises28.stat)((0, import_node_path32.join)(directory, "SKILL.md"))).isFile();
52221
+ return (await (0, import_promises29.stat)((0, import_node_path33.join)(directory, "SKILL.md"))).isFile();
52061
52222
  } catch {
52062
52223
  return false;
52063
52224
  }
@@ -52075,7 +52236,7 @@ async function isIntact(layout, skill) {
52075
52236
  async function resolveNativeBuiltIn(layout, invocation, baked) {
52076
52237
  const slug = invocation.displayName;
52077
52238
  if (layout.nativeDir === null || invocation.skillId !== alanSkillId(slug)) return null;
52078
- const directory = (0, import_node_path32.join)(layout.nativeDir, slug);
52239
+ const directory = (0, import_node_path33.join)(layout.nativeDir, slug);
52079
52240
  try {
52080
52241
  const inspected = await inspectSkillPackage(directory, { expectedName: slug });
52081
52242
  if (baked === "exact" && alanSkillVersionId(slug, inspected.contentHash) !== invocation.versionId)
@@ -52114,8 +52275,8 @@ async function resolveSkillInvocations(layout, invocations, baked = "any") {
52114
52275
  async function nativeCandidates(layout) {
52115
52276
  const nativeDir = layout.nativeDir;
52116
52277
  if (nativeDir === null) return [];
52117
- const entries = await (0, import_promises28.readdir)(nativeDir, { withFileTypes: true }).catch(() => []);
52118
- return entries.filter((entry) => entry.isDirectory() || entry.isSymbolicLink()).map((entry) => ({ directory: (0, import_node_path32.join)(nativeDir, entry.name) }));
52278
+ const entries = await (0, import_promises29.readdir)(nativeDir, { withFileTypes: true }).catch(() => []);
52279
+ return entries.filter((entry) => entry.isDirectory() || entry.isSymbolicLink()).map((entry) => ({ directory: (0, import_node_path33.join)(nativeDir, entry.name) }));
52119
52280
  }
52120
52281
  async function availableSkillIndex(layout, sources = { synced: true, native: true }) {
52121
52282
  const found = /* @__PURE__ */ new Map();
@@ -52152,10 +52313,10 @@ async function inspectIndexedSkill(directory, contentHash) {
52152
52313
  }
52153
52314
 
52154
52315
  // src/capabilities/skills/native-index.ts
52155
- var import_node_crypto32 = require("crypto");
52316
+ var import_node_crypto33 = require("crypto");
52156
52317
  var import_node_fs18 = require("fs");
52157
- var import_promises29 = require("fs/promises");
52158
- var import_node_path33 = require("path");
52318
+ var import_promises30 = require("fs/promises");
52319
+ var import_node_path34 = require("path");
52159
52320
  var ALAN_SKILLS_PLUGIN_NAME = "alan";
52160
52321
  var PLUGIN_MANIFEST = `${JSON.stringify(
52161
52322
  {
@@ -52167,18 +52328,18 @@ var PLUGIN_MANIFEST = `${JSON.stringify(
52167
52328
  )}
52168
52329
  `;
52169
52330
  function installedSkillFolders(layout) {
52170
- return (0, import_node_fs18.existsSync)((0, import_node_path33.join)(layout.pluginDir, ".claude-plugin", "plugin.json")) ? { pluginDir: layout.pluginDir, skillsDir: layout.pluginSkillsDir } : null;
52331
+ return (0, import_node_fs18.existsSync)((0, import_node_path34.join)(layout.pluginDir, ".claude-plugin", "plugin.json")) ? { pluginDir: layout.pluginDir, skillsDir: layout.pluginSkillsDir } : null;
52171
52332
  }
52172
52333
 
52173
52334
  // src/capabilities/workspace/index.ts
52174
- var import_node_path36 = require("path");
52335
+ var import_node_path37 = require("path");
52175
52336
 
52176
52337
  // src/capabilities/workspace/approved-paths.ts
52177
- var import_promises30 = require("fs/promises");
52338
+ var import_promises31 = require("fs/promises");
52178
52339
  init_zod();
52179
52340
 
52180
52341
  // src/capabilities/workspace/paths.ts
52181
- var import_node_path34 = require("path");
52342
+ var import_node_path35 = require("path");
52182
52343
  function stripWin32Namespace(path) {
52183
52344
  if (/^\\\\\?\\UNC\\/i.test(path)) return `\\\\${path.slice(8)}`;
52184
52345
  if (path.startsWith("\\\\?\\")) return path.slice(4);
@@ -52186,15 +52347,15 @@ function stripWin32Namespace(path) {
52186
52347
  }
52187
52348
  function comparablePath(path, platform) {
52188
52349
  if (platform === "win32") {
52189
- const normalized3 = import_node_path34.win32.normalize(stripWin32Namespace(path).replaceAll("/", "\\"));
52350
+ const normalized3 = import_node_path35.win32.normalize(stripWin32Namespace(path).replaceAll("/", "\\"));
52190
52351
  const trimmed4 = normalized3.length > 3 || !/^[a-z]:\\$/i.test(normalized3) ? normalized3.replace(/\\+$/, "") : normalized3;
52191
52352
  return trimmed4.toLowerCase();
52192
52353
  }
52193
- const normalized2 = import_node_path34.posix.normalize(path);
52354
+ const normalized2 = import_node_path35.posix.normalize(path);
52194
52355
  return normalized2.length > 1 ? normalized2.replace(/\/+$/, "") : normalized2;
52195
52356
  }
52196
52357
  function isAbsoluteFor(path, platform) {
52197
- return platform === "win32" ? import_node_path34.win32.isAbsolute(path) : import_node_path34.posix.isAbsolute(path);
52358
+ return platform === "win32" ? import_node_path35.win32.isAbsolute(path) : import_node_path35.posix.isAbsolute(path);
52198
52359
  }
52199
52360
  function isWithin(root, candidate, platform) {
52200
52361
  const separator = platform === "win32" ? "\\" : "/";
@@ -52212,7 +52373,7 @@ var storeSchema = external_exports.object({
52212
52373
  });
52213
52374
  async function realpathOrNull(path) {
52214
52375
  try {
52215
- return await (0, import_promises30.realpath)(path);
52376
+ return await (0, import_promises31.realpath)(path);
52216
52377
  } catch (error62) {
52217
52378
  const code = errnoCode(error62);
52218
52379
  if (code === "ENOENT" || code === "ENOTDIR" || code === "EACCES" || code === "EPERM") {
@@ -52271,9 +52432,9 @@ async function openApprovedPaths(options) {
52271
52432
  }
52272
52433
 
52273
52434
  // src/capabilities/workspace/locks.ts
52274
- var import_node_crypto33 = require("crypto");
52275
- var import_promises31 = require("fs/promises");
52276
- var import_node_path35 = require("path");
52435
+ var import_node_crypto34 = require("crypto");
52436
+ var import_promises32 = require("fs/promises");
52437
+ var import_node_path36 = require("path");
52277
52438
  init_zod();
52278
52439
  var LOCK_FORMAT = 1;
52279
52440
  var EXCLUSIVE_FILE = "exclusive.json";
@@ -52288,12 +52449,12 @@ var ownerSchema = external_exports.object({
52288
52449
  since: external_exports.number().int().nonnegative()
52289
52450
  });
52290
52451
  function repositoryLockKey(commonDir, platform) {
52291
- return (0, import_node_crypto33.createHash)("sha256").update(comparablePath(commonDir, platform)).digest("hex").slice(0, 32);
52452
+ return (0, import_node_crypto34.createHash)("sha256").update(comparablePath(commonDir, platform)).digest("hex").slice(0, 32);
52292
52453
  }
52293
52454
  async function readOwner(path) {
52294
52455
  let text2;
52295
52456
  try {
52296
- text2 = await (0, import_promises31.readFile)(path, "utf8");
52457
+ text2 = await (0, import_promises32.readFile)(path, "utf8");
52297
52458
  } catch (error62) {
52298
52459
  if (errnoCode(error62) === "ENOENT") return { kind: "missing" };
52299
52460
  return { kind: "unreadable" };
@@ -52314,7 +52475,7 @@ async function removeIfSame(path, expected) {
52314
52475
  if (current.kind !== "owner" || current.owner.since !== expected.since) return;
52315
52476
  if (current.owner.pid !== expected.pid || current.owner.holder !== expected.holder) return;
52316
52477
  }
52317
- await (0, import_promises31.unlink)(path).catch((error62) => {
52478
+ await (0, import_promises32.unlink)(path).catch((error62) => {
52318
52479
  if (errnoCode(error62) !== "ENOENT") throw error62;
52319
52480
  });
52320
52481
  }
@@ -52339,7 +52500,7 @@ function openRepositoryLocks(options) {
52339
52500
  await removeIfSame(path, read.owner);
52340
52501
  return null;
52341
52502
  }
52342
- const age = await (0, import_promises31.stat)(path).then(
52503
+ const age = await (0, import_promises32.stat)(path).then(
52343
52504
  (info) => clock.now() - info.mtimeMs,
52344
52505
  () => 0
52345
52506
  );
@@ -52353,13 +52514,13 @@ function openRepositoryLocks(options) {
52353
52514
  });
52354
52515
  const folder = async (commonDir) => {
52355
52516
  const key = repositoryLockKey(commonDir, platform);
52356
- const dir = (0, import_node_path35.join)(options.dir, key);
52357
- await (0, import_promises31.mkdir)(dir, { recursive: true, mode: 448 });
52517
+ const dir = (0, import_node_path36.join)(options.dir, key);
52518
+ await (0, import_promises32.mkdir)(dir, { recursive: true, mode: 448 });
52358
52519
  return { key, dir };
52359
52520
  };
52360
52521
  const createExclusive = async (path, owner) => {
52361
52522
  try {
52362
- const handle = await (0, import_promises31.open)(path, "wx", 384);
52523
+ const handle = await (0, import_promises32.open)(path, "wx", 384);
52363
52524
  try {
52364
52525
  await handle.writeFile(JSON.stringify(owner));
52365
52526
  } finally {
@@ -52372,10 +52533,10 @@ function openRepositoryLocks(options) {
52372
52533
  }
52373
52534
  };
52374
52535
  const liveRun = async (dir) => {
52375
- const entries = await (0, import_promises31.readdir)(dir);
52536
+ const entries = await (0, import_promises32.readdir)(dir);
52376
52537
  for (const entry of entries) {
52377
52538
  if (!entry.startsWith(RUN_FILE_PREFIX)) continue;
52378
- const holder = await heldBy((0, import_node_path35.join)(dir, entry));
52539
+ const holder = await heldBy((0, import_node_path36.join)(dir, entry));
52379
52540
  if (holder !== null) return holder;
52380
52541
  }
52381
52542
  return null;
@@ -52383,7 +52544,7 @@ function openRepositoryLocks(options) {
52383
52544
  return {
52384
52545
  tryExclusive: async (commonDir, operationId) => {
52385
52546
  const { key, dir } = await folder(commonDir);
52386
- const path = (0, import_node_path35.join)(dir, EXCLUSIVE_FILE);
52547
+ const path = (0, import_node_path36.join)(dir, EXCLUSIVE_FILE);
52387
52548
  const owner = await self(operationId);
52388
52549
  if (!await createExclusive(path, owner)) {
52389
52550
  const holder = await heldBy(path);
@@ -52401,11 +52562,11 @@ function openRepositoryLocks(options) {
52401
52562
  },
52402
52563
  tryShared: async (commonDir, runId) => {
52403
52564
  const { key, dir } = await folder(commonDir);
52404
- const file2 = `${RUN_FILE_PREFIX}${(0, import_node_crypto33.createHash)("sha256").update(runId).digest("hex").slice(0, 32)}.json`;
52405
- const path = (0, import_node_path35.join)(dir, file2);
52565
+ const file2 = `${RUN_FILE_PREFIX}${(0, import_node_crypto34.createHash)("sha256").update(runId).digest("hex").slice(0, 32)}.json`;
52566
+ const path = (0, import_node_path36.join)(dir, file2);
52406
52567
  const owner = await self(runId);
52407
52568
  await writeJsonFileAtomic(path, owner);
52408
- const operation = await heldBy((0, import_node_path35.join)(dir, EXCLUSIVE_FILE));
52569
+ const operation = await heldBy((0, import_node_path36.join)(dir, EXCLUSIVE_FILE));
52409
52570
  if (operation !== null) {
52410
52571
  await removeIfSame(path, owner);
52411
52572
  return { kind: "busy", holder: operation };
@@ -52564,7 +52725,7 @@ function createProviderDrivers(options) {
52564
52725
  }
52565
52726
 
52566
52727
  // src/holder/engine-records.ts
52567
- var import_node_path37 = require("path");
52728
+ var import_node_path38 = require("path");
52568
52729
  init_process();
52569
52730
  init_zod();
52570
52731
  var ENGINES_FILE = "engines.json";
@@ -52575,7 +52736,7 @@ var engineRecordSchema = external_exports.object({
52575
52736
  });
52576
52737
  var engineRecordsSchema = external_exports.object({ engines: external_exports.array(engineRecordSchema) });
52577
52738
  function engineRecordsPath(sessionDir) {
52578
- return (0, import_node_path37.join)(sessionDir, ENGINES_FILE);
52739
+ return (0, import_node_path38.join)(sessionDir, ENGINES_FILE);
52579
52740
  }
52580
52741
  function recordSpawnedEngines(path, clock, log) {
52581
52742
  const live = /* @__PURE__ */ new Map();
@@ -52630,17 +52791,17 @@ function createConversationMcpAuthorization(options) {
52630
52791
  }
52631
52792
 
52632
52793
  // src/holder/mcp-helper-access.ts
52633
- var import_promises32 = require("fs/promises");
52794
+ var import_promises33 = require("fs/promises");
52634
52795
  function createHelperMcpAccess(options) {
52635
52796
  return {
52636
52797
  [Symbol.asyncDispose]: async () => {
52637
- await (0, import_promises32.rm)(options.credentialPath, { force: true });
52798
+ await (0, import_promises33.rm)(options.credentialPath, { force: true });
52638
52799
  },
52639
52800
  url: options.managedMcp.url,
52640
52801
  authorization: async (signal) => {
52641
52802
  const authorization = await options.managedMcp.authorization(signal);
52642
52803
  if (authorization === void 0 || signal.aborted) {
52643
- await (0, import_promises32.rm)(options.credentialPath, { force: true });
52804
+ await (0, import_promises33.rm)(options.credentialPath, { force: true });
52644
52805
  return void 0;
52645
52806
  }
52646
52807
  const credential = {
@@ -52655,8 +52816,8 @@ function createHelperMcpAccess(options) {
52655
52816
  }
52656
52817
 
52657
52818
  // src/holder/run-inputs.ts
52658
- var import_promises33 = require("fs/promises");
52659
- var import_node_path38 = require("path");
52819
+ var import_promises34 = require("fs/promises");
52820
+ var import_node_path39 = require("path");
52660
52821
  init_src();
52661
52822
  var NO_RUN_INPUTS = {
52662
52823
  attachments: [],
@@ -52670,17 +52831,17 @@ function safeFilename(filename) {
52670
52831
  return safe || "attachment";
52671
52832
  }
52672
52833
  function persistentAttachmentDir(workspaceRoot2) {
52673
- return (0, import_node_path38.join)(workspaceRoot2, ".alan", "attachments");
52834
+ return (0, import_node_path39.join)(workspaceRoot2, ".alan", "attachments");
52674
52835
  }
52675
52836
  function attachmentPath(spec, attachment, index, runDir) {
52676
52837
  const workspaceRoot2 = spec.approvedWorkspacePaths?.[0];
52677
52838
  if (attachment.persist && workspaceRoot2) {
52678
- return (0, import_node_path38.join)(
52839
+ return (0, import_node_path39.join)(
52679
52840
  persistentAttachmentDir(workspaceRoot2),
52680
52841
  `${attachment.id.slice(0, 8)}-${safeFilename(attachment.filename)}`
52681
52842
  );
52682
52843
  }
52683
- return (0, import_node_path38.join)(runDir, `${index}-${safeFilename(attachment.filename)}`);
52844
+ return (0, import_node_path39.join)(runDir, `${index}-${safeFilename(attachment.filename)}`);
52684
52845
  }
52685
52846
  function runMediaUploader(source, runId) {
52686
52847
  const upload = source.uploadMedia?.bind(source);
@@ -52689,10 +52850,11 @@ function runMediaUploader(source, runId) {
52689
52850
  upload: ({ data, ...media }, signal) => upload(runId, { ...media, bytes: data.byteLength }, data, signal)
52690
52851
  };
52691
52852
  }
52692
- async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [] }) {
52693
- const dir = (0, import_node_path38.join)(tmpDir, "runs", spec.runId);
52853
+ async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [], commitAttribution }) {
52854
+ await commitAttribution?.setCoAuthor(spec.gitCoAuthor);
52855
+ const dir = (0, import_node_path39.join)(tmpDir, "runs", spec.runId);
52694
52856
  const cleanup = async () => {
52695
- await (0, import_promises33.rm)(dir, { recursive: true, force: true });
52857
+ await (0, import_promises34.rm)(dir, { recursive: true, force: true });
52696
52858
  };
52697
52859
  try {
52698
52860
  const credential = await source.fetchProviderCredential(spec.runId, signal);
@@ -52700,8 +52862,8 @@ async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [] }) {
52700
52862
  for (const [index, attachment] of (spec.attachments ?? []).entries()) {
52701
52863
  const bytes = await source.downloadAttachment(spec.runId, attachment.id, signal);
52702
52864
  const path = attachmentPath(spec, attachment, index, dir);
52703
- await (0, import_promises33.mkdir)((0, import_node_path38.dirname)(path), { recursive: true, mode: 448 });
52704
- await (0, import_promises33.writeFile)(path, bytes, { mode: 384 });
52865
+ await (0, import_promises34.mkdir)((0, import_node_path39.dirname)(path), { recursive: true, mode: 448 });
52866
+ await (0, import_promises34.writeFile)(path, bytes, { mode: 384 });
52705
52867
  const imageMimeType = attachment.kind === "image" ? detectImageMimeType(Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength)) : null;
52706
52868
  attachments.push({
52707
52869
  id: attachment.id,
@@ -52731,33 +52893,33 @@ async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [] }) {
52731
52893
  }
52732
52894
 
52733
52895
  // src/holder/serve.ts
52734
- var import_node_crypto35 = require("crypto");
52896
+ var import_node_crypto36 = require("crypto");
52735
52897
  var import_node_fs22 = require("fs");
52736
52898
  var import_node_net2 = require("net");
52737
- var import_node_path48 = require("path");
52899
+ var import_node_path49 = require("path");
52738
52900
  init_runtime_v2();
52739
52901
 
52740
52902
  // src/holder/admission.ts
52741
52903
  var import_node_fs20 = require("fs");
52742
- var import_promises37 = require("fs/promises");
52904
+ var import_promises38 = require("fs/promises");
52743
52905
  var import_node_os7 = require("os");
52744
- var import_node_path44 = require("path");
52906
+ var import_node_path45 = require("path");
52745
52907
  init_constants();
52746
52908
 
52747
52909
  // ../shared/src/node/local-workspace.ts
52748
52910
  var import_node_fs19 = require("fs");
52749
52911
  var import_node_os6 = require("os");
52750
- var import_node_path39 = require("path");
52912
+ var import_node_path40 = require("path");
52751
52913
  function resolveAlanDefaultWorkspacePath(homeDirectory = (0, import_node_os6.homedir)()) {
52752
- return (0, import_node_path39.join)(homeDirectory, ".alan", "workspace");
52914
+ return (0, import_node_path40.join)(homeDirectory, ".alan", "workspace");
52753
52915
  }
52754
52916
 
52755
52917
  // src/holder/agent-context.ts
52756
- var import_promises34 = require("fs/promises");
52757
- var import_node_path40 = require("path");
52918
+ var import_promises35 = require("fs/promises");
52919
+ var import_node_path41 = require("path");
52758
52920
  init_prompt();
52759
52921
  async function readText2(path) {
52760
- return (0, import_promises34.readFile)(path, "utf8").then(
52922
+ return (0, import_promises35.readFile)(path, "utf8").then(
52761
52923
  (text2) => text2.trim(),
52762
52924
  () => null
52763
52925
  );
@@ -52772,10 +52934,10 @@ async function startCommandState(statusPath) {
52772
52934
  return code === 0 ? { state: "exited_ok" } : { state: "failed", exitCode: code };
52773
52935
  }
52774
52936
  function createAgentContext(deps) {
52775
- const statusPath = (0, import_node_path40.join)(deps.homeDir, ".alan", "start-commands.status");
52776
- const logPath = (0, import_node_path40.join)(deps.homeDir, ".alan", "start-commands.log");
52937
+ const statusPath = (0, import_node_path41.join)(deps.homeDir, ".alan", "start-commands.status");
52938
+ const logPath = (0, import_node_path41.join)(deps.homeDir, ".alan", "start-commands.log");
52777
52939
  return async (spec, problems) => {
52778
- const file2 = (0, import_node_path40.join)(deps.dir, `${spec.conversationId}.json`);
52940
+ const file2 = (0, import_node_path41.join)(deps.dir, `${spec.conversationId}.json`);
52779
52941
  const saved = await readJsonFile(file2, agentContextSnapshotSchema);
52780
52942
  const known = saved.kind === "ok" ? saved.value : void 0;
52781
52943
  const hasEnvironment = (spec.agentContext ?? known)?.environment !== void 0;
@@ -52799,28 +52961,28 @@ function createAgentContext(deps) {
52799
52961
  }
52800
52962
 
52801
52963
  // src/holder/checkout-refresh.ts
52802
- var import_node_path43 = require("path");
52964
+ var import_node_path44 = require("path");
52803
52965
 
52804
52966
  // src/holder/claim-once.ts
52805
- var import_node_crypto34 = require("crypto");
52806
- var import_promises35 = require("fs/promises");
52807
- var import_node_path41 = require("path");
52967
+ var import_node_crypto35 = require("crypto");
52968
+ var import_promises36 = require("fs/promises");
52969
+ var import_node_path42 = require("path");
52808
52970
  async function claimOnce(dir, name) {
52809
52971
  try {
52810
- await (0, import_promises35.mkdir)(dir, { recursive: true, mode: 448 });
52811
- await (await (0, import_promises35.open)((0, import_node_path41.join)(dir, name), "wx")).close();
52972
+ await (0, import_promises36.mkdir)(dir, { recursive: true, mode: 448 });
52973
+ await (await (0, import_promises36.open)((0, import_node_path42.join)(dir, name), "wx")).close();
52812
52974
  return true;
52813
52975
  } catch {
52814
52976
  return false;
52815
52977
  }
52816
52978
  }
52817
52979
  function claimFirstLease(freshnessDir, path) {
52818
- return claimOnce((0, import_node_path41.join)(freshnessDir, "leased"), (0, import_node_crypto34.createHash)("sha256").update(path).digest("hex"));
52980
+ return claimOnce((0, import_node_path42.join)(freshnessDir, "leased"), (0, import_node_crypto35.createHash)("sha256").update(path).digest("hex"));
52819
52981
  }
52820
52982
 
52821
52983
  // src/holder/requested-checkout.ts
52822
- var import_promises36 = require("fs/promises");
52823
- var import_node_path42 = require("path");
52984
+ var import_promises37 = require("fs/promises");
52985
+ var import_node_path43 = require("path");
52824
52986
  var REMOTE2 = "origin";
52825
52987
  var REASON_MAX_CHARS = 200;
52826
52988
  function firstLine2(text2) {
@@ -52841,8 +53003,8 @@ function notSwitched(checkout, current, reason) {
52841
53003
  );
52842
53004
  }
52843
53005
  async function clone2(checkout, deps, signal) {
52844
- const parent = (0, import_node_path42.dirname)(checkout.path);
52845
- await (0, import_promises36.mkdir)(parent, { recursive: true });
53006
+ const parent = (0, import_node_path43.dirname)(checkout.path);
53007
+ await (0, import_promises37.mkdir)(parent, { recursive: true });
52846
53008
  await assertValidBranch(deps.git, parent, checkout.branch, signal);
52847
53009
  const output2 = await deps.git.run(
52848
53010
  {
@@ -53077,7 +53239,7 @@ async function applyRequestedCheckouts(spec, deps, signal) {
53077
53239
  ms: Date.now() - startedAt
53078
53240
  });
53079
53241
  if (outcome2.kind === "on_branch") continue;
53080
- settled2.add((0, import_node_path43.resolve)(checkout.path));
53242
+ settled2.add((0, import_node_path44.resolve)(checkout.path));
53081
53243
  if (outcome2.kind === "noted") {
53082
53244
  problems.push({ path: checkout.path, problem: outcome2.problem, action: outcome2.action });
53083
53245
  }
@@ -53087,7 +53249,7 @@ async function applyRequestedCheckouts(spec, deps, signal) {
53087
53249
  async function refreshSnapshotCheckouts(spec, targets, settled2, deps, signal) {
53088
53250
  const problems = [];
53089
53251
  for (const target of targets) {
53090
- if (settled2.has((0, import_node_path43.resolve)(target))) continue;
53252
+ if (settled2.has((0, import_node_path44.resolve)(target))) continue;
53091
53253
  const freshness = await readCheckoutFreshness(deps.dir, target);
53092
53254
  if (freshness === null) continue;
53093
53255
  const startedAt = Date.now();
@@ -53108,7 +53270,7 @@ async function refreshSnapshotCheckouts(spec, targets, settled2, deps, signal) {
53108
53270
  function createCheckoutRefresh(deps) {
53109
53271
  return async (spec, signal) => {
53110
53272
  if (spec.providerSessionId !== void 0) return [];
53111
- if (!await claimOnce((0, import_node_path43.join)(deps.dir, "conversations"), spec.conversationId)) return [];
53273
+ if (!await claimOnce((0, import_node_path44.join)(deps.dir, "conversations"), spec.conversationId)) return [];
53112
53274
  const requested = await applyRequestedCheckouts(spec, deps, signal);
53113
53275
  const targets = await checkoutsOf(spec);
53114
53276
  return [
@@ -53150,7 +53312,7 @@ function volumeRoot(path) {
53150
53312
  }
53151
53313
  async function exists(path) {
53152
53314
  try {
53153
- await (0, import_promises37.stat)(path);
53315
+ await (0, import_promises38.stat)(path);
53154
53316
  return true;
53155
53317
  } catch {
53156
53318
  return false;
@@ -53158,10 +53320,10 @@ async function exists(path) {
53158
53320
  }
53159
53321
  async function inspectReadiness(path) {
53160
53322
  try {
53161
- if (!(await (0, import_promises37.stat)(path)).isDirectory()) {
53323
+ if (!(await (0, import_promises38.stat)(path)).isDirectory()) {
53162
53324
  return { ready: false, missing: true, message: MESSAGES.missing };
53163
53325
  }
53164
- await (0, import_promises37.access)(path, import_node_fs20.constants.R_OK | import_node_fs20.constants.W_OK | import_node_fs20.constants.X_OK);
53326
+ await (0, import_promises38.access)(path, import_node_fs20.constants.R_OK | import_node_fs20.constants.W_OK | import_node_fs20.constants.X_OK);
53165
53327
  return { ready: true };
53166
53328
  } catch (error62) {
53167
53329
  const code = errnoCode(error62) ?? "";
@@ -53205,8 +53367,8 @@ async function admitDefaultWorkspace(spec, context, skills) {
53205
53367
  const { env } = context;
53206
53368
  const path = resolveAlanDefaultWorkspacePath(env.HOME || env.USERPROFILE || (0, import_node_os7.homedir)());
53207
53369
  try {
53208
- await (0, import_promises37.mkdir)(path, { recursive: true, mode: 448 });
53209
- await (0, import_promises37.access)(path, import_node_fs20.constants.R_OK | import_node_fs20.constants.W_OK | import_node_fs20.constants.X_OK);
53370
+ await (0, import_promises38.mkdir)(path, { recursive: true, mode: 448 });
53371
+ await (0, import_promises38.access)(path, import_node_fs20.constants.R_OK | import_node_fs20.constants.W_OK | import_node_fs20.constants.X_OK);
53210
53372
  return { kind: "admitted", spec: { ...spec, projectPath: path }, skills };
53211
53373
  } catch (error62) {
53212
53374
  const code = errnoCode(error62);
@@ -53295,7 +53457,7 @@ function createHolderWorkspace(machine, clock, log) {
53295
53457
  ),
53296
53458
  approvedRoots: async () => {
53297
53459
  const approved = await openApprovedPaths({
53298
- file: (0, import_node_path44.join)(machine.stateDir, "workspaces.json"),
53460
+ file: (0, import_node_path45.join)(machine.stateDir, "workspaces.json"),
53299
53461
  log,
53300
53462
  platform
53301
53463
  });
@@ -53311,12 +53473,12 @@ function createHolderWorkspace(machine, clock, log) {
53311
53473
  localTimeoutMs: CHECKOUT_LOCAL_TIMEOUT_MS,
53312
53474
  networkTimeoutMs: CHECKOUT_NETWORK_TIMEOUT_MS
53313
53475
  }),
53314
- locks: openRepositoryLocks({ dir: (0, import_node_path44.join)(machine.stateDir, "locks"), clock, platform }),
53476
+ locks: openRepositoryLocks({ dir: (0, import_node_path45.join)(machine.stateDir, "locks"), clock, platform }),
53315
53477
  log,
53316
- dir: (0, import_node_path44.join)(machine.stateDir, "checkout-freshness")
53478
+ dir: (0, import_node_path45.join)(machine.stateDir, "checkout-freshness")
53317
53479
  }),
53318
53480
  prepareAgentContext: createAgentContext({
53319
- dir: (0, import_node_path44.join)(machine.stateDir, "agent-context"),
53481
+ dir: (0, import_node_path45.join)(machine.stateDir, "agent-context"),
53320
53482
  homeDir: machine.env.HOME || (0, import_node_os7.homedir)()
53321
53483
  })
53322
53484
  } : {}
@@ -53334,7 +53496,7 @@ async function respondToTurn(runningRunId, driver, request2) {
53334
53496
  }
53335
53497
 
53336
53498
  // src/holder/session-facts.ts
53337
- var import_promises38 = require("fs/promises");
53499
+ var import_promises39 = require("fs/promises");
53338
53500
  var CLI_RSS_CACHE_MS = 1e4;
53339
53501
  var LOGIN_PROBLEM_PREFIX = "cli.auth.";
53340
53502
  function isLoginFailure(result) {
@@ -53360,8 +53522,8 @@ function createSessionFacts(options) {
53360
53522
  const path = await resolveCommandOnPath(command, env, platform);
53361
53523
  if (path === null) return null;
53362
53524
  try {
53363
- const real = await (0, import_promises38.realpath)(path);
53364
- const info = await (0, import_promises38.stat)(real);
53525
+ const real = await (0, import_promises39.realpath)(path);
53526
+ const info = await (0, import_promises39.stat)(real);
53365
53527
  return { command, key: `${real}:${info.ino}:${info.size}:${info.mtimeMs}` };
53366
53528
  } catch {
53367
53529
  return null;
@@ -53455,8 +53617,8 @@ async function steerTurn(runningRunId, driver, request2) {
53455
53617
  init_acp2();
53456
53618
 
53457
53619
  // src/run-log/directory.ts
53458
- var import_promises39 = require("fs/promises");
53459
- var import_node_path45 = require("path");
53620
+ var import_promises40 = require("fs/promises");
53621
+ var import_node_path46 = require("path");
53460
53622
  init_runtime_v2();
53461
53623
  init_zod();
53462
53624
  var runMetaSchema = external_exports.object({
@@ -53478,17 +53640,17 @@ var runMetaSchema = external_exports.object({
53478
53640
  }).optional()
53479
53641
  });
53480
53642
  function runDirectory(runsDir, runId) {
53481
- const dir = (0, import_node_path45.join)(runsDir, runId);
53643
+ const dir = (0, import_node_path46.join)(runsDir, runId);
53482
53644
  return {
53483
53645
  dir,
53484
- log: (0, import_node_path45.join)(dir, "log.jsonl"),
53485
- upload: (0, import_node_path45.join)(dir, "upload.json"),
53486
- meta: (0, import_node_path45.join)(dir, "run.json")
53646
+ log: (0, import_node_path46.join)(dir, "log.jsonl"),
53647
+ upload: (0, import_node_path46.join)(dir, "upload.json"),
53648
+ meta: (0, import_node_path46.join)(dir, "run.json")
53487
53649
  };
53488
53650
  }
53489
53651
  async function isRunClaimed(runsDir, runId) {
53490
53652
  try {
53491
- return (await (0, import_promises39.stat)(runDirectory(runsDir, runId).log)).size > 0;
53653
+ return (await (0, import_promises40.stat)(runDirectory(runsDir, runId).log)).size > 0;
53492
53654
  } catch (error62) {
53493
53655
  if (errnoCode(error62) === "ENOENT") return false;
53494
53656
  throw error62;
@@ -53496,8 +53658,8 @@ async function isRunClaimed(runsDir, runId) {
53496
53658
  }
53497
53659
 
53498
53660
  // src/run-log/conversation-index.ts
53499
- var import_promises40 = require("fs/promises");
53500
- var import_node_path46 = require("path");
53661
+ var import_promises41 = require("fs/promises");
53662
+ var import_node_path47 = require("path");
53501
53663
  init_runtime_v2();
53502
53664
  init_zod();
53503
53665
  var ORDINALS_PER_SHARD = 1e3;
@@ -53513,13 +53675,13 @@ var coverageSchema = external_exports.object({
53513
53675
  nextExpectedOrdinal: external_exports.number().int().positive()
53514
53676
  });
53515
53677
  function conversationsDirectory(runsDir) {
53516
- return (0, import_node_path46.join)((0, import_node_path46.dirname)(runsDir), "conversations");
53678
+ return (0, import_node_path47.join)((0, import_node_path47.dirname)(runsDir), "conversations");
53517
53679
  }
53518
53680
  function indexDirectory(runsDir, conversationId) {
53519
- return (0, import_node_path46.join)(conversationsDirectory(runsDir), conversationId, "turn-index");
53681
+ return (0, import_node_path47.join)(conversationsDirectory(runsDir), conversationId, "turn-index");
53520
53682
  }
53521
53683
  function shardPath(runsDir, conversationId, ordinal) {
53522
- return (0, import_node_path46.join)(
53684
+ return (0, import_node_path47.join)(
53523
53685
  indexDirectory(runsDir, conversationId),
53524
53686
  `${Math.floor(ordinal / ORDINALS_PER_SHARD)}.jsonl`
53525
53687
  );
@@ -53528,10 +53690,10 @@ async function indexConversationRun(runsDir, conversationId, ordinal, assistantO
53528
53690
  const nextOrdinal = assistantOrdinal + 1;
53529
53691
  if (nextOrdinal <= ordinal) throw new Error("Assistant order must follow the prompt");
53530
53692
  const path = shardPath(runsDir, conversationId, ordinal);
53531
- await (0, import_promises40.mkdir)((0, import_node_path46.dirname)(path), { recursive: true, mode: 448 });
53532
- await (0, import_promises40.appendFile)(path, `${JSON.stringify({ ordinal, nextOrdinal, runId })}
53693
+ await (0, import_promises41.mkdir)((0, import_node_path47.dirname)(path), { recursive: true, mode: 448 });
53694
+ await (0, import_promises41.appendFile)(path, `${JSON.stringify({ ordinal, nextOrdinal, runId })}
53533
53695
  `, { mode: 384 });
53534
- const coveragePath = (0, import_node_path46.join)((0, import_node_path46.dirname)((0, import_node_path46.dirname)(path)), "coverage.json");
53696
+ const coveragePath = (0, import_node_path47.join)((0, import_node_path47.dirname)((0, import_node_path47.dirname)(path)), "coverage.json");
53535
53697
  const coverage = await readJsonFile(coveragePath, coverageSchema);
53536
53698
  const current = coverage.kind === "ok" ? coverage.value : null;
53537
53699
  const next = nextCoverage(current, ordinal, nextOrdinal);
@@ -53590,7 +53752,7 @@ var decoder = new TextDecoder();
53590
53752
 
53591
53753
  // src/run-log/writer.ts
53592
53754
  var import_node_fs21 = require("fs");
53593
- var import_node_path47 = require("path");
53755
+ var import_node_path48 = require("path");
53594
53756
  init_runtime_v2();
53595
53757
  function readTail(fd, size) {
53596
53758
  for (const length of tailWindows(size)) {
@@ -53609,7 +53771,7 @@ function writeAt(fd, bytes, position) {
53609
53771
  }
53610
53772
  }
53611
53773
  function openRunLog(path, clock) {
53612
- (0, import_node_fs21.mkdirSync)((0, import_node_path47.dirname)(path), { recursive: true, mode: 448 });
53774
+ (0, import_node_fs21.mkdirSync)((0, import_node_path48.dirname)(path), { recursive: true, mode: 448 });
53613
53775
  const fd = (0, import_node_fs21.openSync)(path, import_node_fs21.constants.O_RDWR | import_node_fs21.constants.O_CREAT, 384);
53614
53776
  const fileSize = (0, import_node_fs21.fstatSync)(fd).size;
53615
53777
  const tail = readTail(fd, fileSize);
@@ -53890,12 +54052,12 @@ var TASK_UNSUPPORTED = {
53890
54052
  message: "This agent cannot stop one background task."
53891
54053
  };
53892
54054
  function sha2563(value) {
53893
- return (0, import_node_crypto35.createHash)("sha256").update(value).digest("hex");
54055
+ return (0, import_node_crypto36.createHash)("sha256").update(value).digest("hex");
53894
54056
  }
53895
54057
  function tokenMatches(expected, presented) {
53896
54058
  const a = Buffer.from(sha2563(expected), "hex");
53897
54059
  const b = Buffer.from(sha2563(presented), "hex");
53898
- return (0, import_node_crypto35.timingSafeEqual)(a, b);
54060
+ return (0, import_node_crypto36.timingSafeEqual)(a, b);
53899
54061
  }
53900
54062
  async function runHolder({
53901
54063
  launch,
@@ -53909,7 +54071,7 @@ async function runHolder({
53909
54071
  try {
53910
54072
  const identity = await readProcessIdentity(process.pid);
53911
54073
  if (identity === null) throw new RuntimeFault("internal", "Cannot read own process identity");
53912
- const _engines = __using(_stack, recordSpawnedEngines(engineRecordsPath((0, import_node_path48.dirname)(launch.statusPath)), clock, log));
54074
+ const _engines = __using(_stack, recordSpawnedEngines(engineRecordsPath((0, import_node_path49.dirname)(launch.statusPath)), clock, log));
53913
54075
  const holder = {
53914
54076
  state: "idle",
53915
54077
  runId: null,
@@ -53917,7 +54079,7 @@ async function runHolder({
53917
54079
  clients: /* @__PURE__ */ new Set()
53918
54080
  };
53919
54081
  const activity = __using(_stack, startActivityFile({
53920
- path: sessionActivityPath((0, import_node_path48.dirname)(launch.statusPath)),
54082
+ path: sessionActivityPath((0, import_node_path49.dirname)(launch.statusPath)),
53921
54083
  read: () => ({
53922
54084
  runId: holder.runId,
53923
54085
  ...driver.activity?.() ?? IDLE_DRIVER_ACTIVITY
@@ -54161,29 +54323,29 @@ async function runHolder({
54161
54323
 
54162
54324
  // src/cli/config.ts
54163
54325
  var import_node_os8 = require("os");
54164
- var import_node_path51 = require("path");
54326
+ var import_node_path52 = require("path");
54165
54327
  init_zod();
54166
54328
 
54167
54329
  // src/client/locate.ts
54168
- var import_node_path49 = require("path");
54330
+ var import_node_path50 = require("path");
54169
54331
  var RUNTIME_PROFILES = ["production", "staging", "development", "local"];
54170
54332
  function defaultStateDir({ profile, platform, home, env }) {
54171
54333
  if (platform === "win32") {
54172
- return (0, import_node_path49.join)(env.LOCALAPPDATA ?? (0, import_node_path49.join)(home, "AppData", "Local"), "Alan", profile);
54334
+ return (0, import_node_path50.join)(env.LOCALAPPDATA ?? (0, import_node_path50.join)(home, "AppData", "Local"), "Alan", profile);
54173
54335
  }
54174
- return (0, import_node_path49.join)(env.XDG_STATE_HOME ?? (0, import_node_path49.join)(home, ".local", "state"), "alan", profile);
54336
+ return (0, import_node_path50.join)(env.XDG_STATE_HOME ?? (0, import_node_path50.join)(home, ".local", "state"), "alan", profile);
54175
54337
  }
54176
54338
  function defaultInstallDir({ platform, home, env }) {
54177
54339
  if (platform === "win32") {
54178
- return (0, import_node_path49.join)(env.LOCALAPPDATA ?? (0, import_node_path49.join)(home, "AppData", "Local"), "Alan", "runtime");
54340
+ return (0, import_node_path50.join)(env.LOCALAPPDATA ?? (0, import_node_path50.join)(home, "AppData", "Local"), "Alan", "runtime");
54179
54341
  }
54180
- return (0, import_node_path49.join)(env.XDG_DATA_HOME ?? (0, import_node_path49.join)(home, ".local", "share"), "alan", "runtime");
54342
+ return (0, import_node_path50.join)(env.XDG_DATA_HOME ?? (0, import_node_path50.join)(home, ".local", "share"), "alan", "runtime");
54181
54343
  }
54182
54344
 
54183
54345
  // src/sessions/index.ts
54184
- var import_node_crypto36 = require("crypto");
54185
- var import_promises41 = require("fs/promises");
54186
- var import_node_path50 = require("path");
54346
+ var import_node_crypto37 = require("crypto");
54347
+ var import_promises42 = require("fs/promises");
54348
+ var import_node_path51 = require("path");
54187
54349
 
54188
54350
  // src/sessions/suspend-policy.ts
54189
54351
  var DEFAULT_SUSPEND_POLICY = { idleMs: 30 * 6e4 };
@@ -54240,7 +54402,7 @@ var SECRET_VARIABLES = /* @__PURE__ */ new Set([
54240
54402
  ]);
54241
54403
  var ALAN_CODE_ENGINE_VARIABLE = "ALAN_CODE_ENGINE_PATH";
54242
54404
  function codexSkillsDir(config2) {
54243
- return config2.gitGatewayUrl === null ? null : (0, import_node_path51.join)(config2.codexHome, "skills");
54405
+ return config2.gitGatewayUrl === null ? null : (0, import_node_path52.join)(config2.codexHome, "skills");
54244
54406
  }
54245
54407
  function loadRuntimeConfig(env = process.env) {
54246
54408
  const parsed = envSchema.safeParse(env);
@@ -54301,7 +54463,7 @@ function loadRuntimeConfig(env = process.env) {
54301
54463
  providerProbes: ALAN_RUNTIME_PROVIDER_PROBES === "on",
54302
54464
  providerToolchain: ALAN_RUNTIME_PROVIDER_NODE !== void 0 && ALAN_RUNTIME_PROVIDER_NPM_CLI !== void 0 ? { node: ALAN_RUNTIME_PROVIDER_NODE, npmCli: ALAN_RUNTIME_PROVIDER_NPM_CLI } : null,
54303
54465
  home,
54304
- configHome: XDG_CONFIG_HOME ?? (0, import_node_path51.join)(home, ".config"),
54466
+ configHome: XDG_CONFIG_HOME ?? (0, import_node_path52.join)(home, ".config"),
54305
54467
  codexHome: resolveCodexHome(CODEX_HOME, home),
54306
54468
  ...githubProxyConfig({ ALAN_RUNTIME_GITHUB_PROXY, XDG_CONFIG_HOME, GH_CONFIG_DIR }, home),
54307
54469
  gitGatewayUrl: ALAN_RUNTIME_GIT_GATEWAY_URL ?? null,
@@ -54312,13 +54474,13 @@ function loadRuntimeConfig(env = process.env) {
54312
54474
  };
54313
54475
  }
54314
54476
  function resolveCodexHome(configuredHome, home) {
54315
- return configuredHome ?? (0, import_node_path51.join)(home, ".codex");
54477
+ return configuredHome ?? (0, import_node_path52.join)(home, ".codex");
54316
54478
  }
54317
54479
  function githubProxyConfig(env, home) {
54318
- const configHome = env.XDG_CONFIG_HOME ?? (0, import_node_path51.join)(home, ".config");
54480
+ const configHome = env.XDG_CONFIG_HOME ?? (0, import_node_path52.join)(home, ".config");
54319
54481
  return {
54320
54482
  githubProxy: env.ALAN_RUNTIME_GITHUB_PROXY === "on",
54321
- ghConfigDir: env.GH_CONFIG_DIR ?? (0, import_node_path51.join)(configHome, "gh")
54483
+ ghConfigDir: env.GH_CONFIG_DIR ?? (0, import_node_path52.join)(configHome, "gh")
54322
54484
  };
54323
54485
  }
54324
54486
  function serviceEnvironment(env, profile) {
@@ -54417,18 +54579,18 @@ async function loadStoredAccess(paths, access4 = { exec: systemExec }) {
54417
54579
  }
54418
54580
 
54419
54581
  // src/cli/commands/hold.ts
54420
- var import_node_path53 = require("path");
54582
+ var import_node_path54 = require("path");
54421
54583
  init_agent2();
54422
54584
  init_runtime_v2();
54423
54585
 
54424
54586
  // src/cli/commands/cli-flag-probes.ts
54425
- var import_node_path52 = require("path");
54587
+ var import_node_path53 = require("path");
54426
54588
  init_process();
54427
54589
  init_claude();
54428
54590
  var CLI_FLAG_PROBES_FILE = "cli-flag-probes.json";
54429
54591
  function openCliFlagProbe(stateDir) {
54430
54592
  return createFlagProbe({
54431
- store: createFileFlagProbeStore((0, import_node_path52.join)(stateDir, CLI_FLAG_PROBES_FILE))
54593
+ store: createFileFlagProbeStore((0, import_node_path53.join)(stateDir, CLI_FLAG_PROBES_FILE))
54432
54594
  });
54433
54595
  }
54434
54596
 
@@ -54489,7 +54651,7 @@ async function runHold(argv) {
54489
54651
  const config2 = loadRuntimeConfig();
54490
54652
  const paths = runtimePaths(config2.stateDir);
54491
54653
  const log = __using(_stack, openFileLog(
54492
- (0, import_node_path53.join)(paths.logs, `holder-${launch.value.conversationId}.jsonl`),
54654
+ (0, import_node_path54.join)(paths.logs, `holder-${launch.value.conversationId}.jsonl`),
54493
54655
  config2.logLevel,
54494
54656
  systemClock
54495
54657
  ));
@@ -54498,16 +54660,25 @@ async function runHold(argv) {
54498
54660
  process.argv[1],
54499
54661
  process.platform
54500
54662
  );
54663
+ const commitAttribution = await installCommitAttribution({
54664
+ dir: (0, import_node_path54.join)(paths.stateDir, "git-attribution"),
54665
+ env: cliEnvironment,
54666
+ platform: process.platform
54667
+ }).catch((error62) => {
54668
+ log.warn("holder.commit_attribution_unavailable", { error: error62 });
54669
+ return null;
54670
+ });
54671
+ const agentEnvironment = commitAttribution?.env ?? cliEnvironment;
54501
54672
  const transport = __using(_stack, createHttpTransport());
54502
54673
  const access4 = await machineAccess(paths, log, launch.value.conversationId, transport);
54503
- const credentialPath = (0, import_node_path53.join)(paths.tmp, "mcp", `${launch.value.conversationId}.json`);
54674
+ const credentialPath = (0, import_node_path54.join)(paths.tmp, "mcp", `${launch.value.conversationId}.json`);
54504
54675
  const managedMcp = __using(_stack, access4.managedMcp === void 0 ? void 0 : createHelperMcpAccess({
54505
54676
  managedMcp: access4.managedMcp,
54506
54677
  conversationId: launch.value.conversationId,
54507
54678
  credentialPath
54508
54679
  }), true);
54509
- const providerEnvironment2 = access4.managedMcp === void 0 ? cliEnvironment : {
54510
- ...cliEnvironment,
54680
+ const providerEnvironment2 = access4.managedMcp === void 0 ? agentEnvironment : {
54681
+ ...agentEnvironment,
54511
54682
  [ALAN_MCP_URL_ENV]: access4.managedMcp.url,
54512
54683
  [ALAN_MCP_CREDENTIAL_FILE_ENV]: credentialPath
54513
54684
  };
@@ -54526,7 +54697,11 @@ async function runHold(argv) {
54526
54697
  }),
54527
54698
  clock: systemClock,
54528
54699
  log,
54529
- inputs: { source: access4.source, tmpDir: paths.tmp },
54700
+ inputs: {
54701
+ source: access4.source,
54702
+ tmpDir: paths.tmp,
54703
+ ...commitAttribution === null ? {} : { commitAttribution }
54704
+ },
54530
54705
  machine: {
54531
54706
  env: cliEnvironment,
54532
54707
  stateDir: paths.stateDir,