@akagilnc/pi-workflow-roles 0.1.5577 → 0.1.5593

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.
@@ -1565,8 +1565,6 @@ var init_durable_principal = __esm({
1565
1565
  });
1566
1566
 
1567
1567
  // src/package-resources/engine-material.ts
1568
- import { existsSync as existsSync2, readdirSync } from "node:fs";
1569
- import { join as join7 } from "node:path";
1570
1568
  function pickEngineAxis(source) {
1571
1569
  return {
1572
1570
  ...source.engine === void 0 ? {} : { engine: source.engine },
@@ -1586,59 +1584,15 @@ function isEngineNameSyntax(name) {
1586
1584
  if (name.includes("/") || name.includes("\\") || name.includes("\0")) return false;
1587
1585
  return true;
1588
1586
  }
1589
- function resolveEngineMaterialDirectory(packageRoot2) {
1590
- return join7(packageRoot2, ENGINE_MATERIAL_RELATIVE_ROOT);
1591
- }
1592
- function resolveEngineMaterialPath(packageRoot2, name) {
1593
- const legal = assertLegalEngineName(name);
1594
- return join7(resolveEngineMaterialDirectory(packageRoot2), `${legal}.md`);
1595
- }
1596
1587
  function assertLegalEngineName(name) {
1597
1588
  if (!isEngineNameSyntax(name)) {
1598
1589
  throw new Error(`illegal engine name: ${name}`);
1599
1590
  }
1600
1591
  return name;
1601
1592
  }
1602
- function engineSessionMaterialFromOptions(options) {
1603
- if (options.engine === void 0) return void 0;
1604
- if (options.packageRoot === void 0 || options.packageRoot.trim() === "") {
1605
- throw new Error("packageRoot is required when engine is configured");
1606
- }
1607
- const name = assertLegalEngineName(options.engine);
1608
- const model = options.engineModel === void 0 ? void 0 : assertLegalEngineModel(options.engineModel);
1609
- const materialPath = resolveEngineMaterialPath(options.packageRoot, name);
1610
- const modelField = model === void 0 ? {} : { model };
1611
- if (existsSync2(materialPath)) {
1612
- return Object.freeze({ name, materialPath, ...modelField });
1613
- }
1614
- return Object.freeze({ name, ...modelField });
1615
- }
1616
- function appendEngineSessionMaterial(lines, engineMaterial) {
1617
- if (engineMaterial === void 0) {
1618
- return [...lines];
1619
- }
1620
- const out = [...lines];
1621
- out.push("");
1622
- if (engineMaterial.materialPath !== void 0) {
1623
- out.push("\u672C\u6B21\u914D\u7F6E\u7684\u52B3\u52A1\u5F15\u64CE\u53CA\u5176\u624B\u518C\uFF1A");
1624
- out.push(`- engine: ${engineMaterial.name}`);
1625
- if (engineMaterial.model !== void 0) {
1626
- out.push(`- engineModel: ${engineMaterial.model}`);
1627
- }
1628
- out.push(`- ${engineMaterial.materialPath}`);
1629
- } else {
1630
- out.push(`- engine: ${engineMaterial.name}`);
1631
- if (engineMaterial.model !== void 0) {
1632
- out.push(`- engineModel: ${engineMaterial.model}`);
1633
- }
1634
- }
1635
- return out;
1636
- }
1637
- var ENGINE_MATERIAL_RELATIVE_ROOT;
1638
1593
  var init_engine_material = __esm({
1639
1594
  "src/package-resources/engine-material.ts"() {
1640
1595
  "use strict";
1641
- ENGINE_MATERIAL_RELATIVE_ROOT = "resources/engines";
1642
1596
  }
1643
1597
  });
1644
1598
 
@@ -16241,9 +16195,9 @@ var init_institutional_resolution = __esm({
16241
16195
  });
16242
16196
 
16243
16197
  // src/host-descriptions.ts
16244
- import { join as join8 } from "node:path";
16198
+ import { join as join7 } from "node:path";
16245
16199
  function resolveHostBinary(description, operatorHome) {
16246
- return join8(operatorHome, ...description.binaryFromHome);
16200
+ return join7(operatorHome, ...description.binaryFromHome);
16247
16201
  }
16248
16202
  function lookupHostDescription(host) {
16249
16203
  return Object.hasOwn(HOST_DESCRIPTIONS, host) ? HOST_DESCRIPTIONS[host] : void 0;
@@ -16375,7 +16329,7 @@ __export(config_exports, {
16375
16329
  validatePublicCliConfigAxes: () => validatePublicCliConfigAxes
16376
16330
  });
16377
16331
  import { mkdir, readFile as readFile3, writeFile } from "node:fs/promises";
16378
- import { dirname as dirname6, join as join9 } from "node:path";
16332
+ import { dirname as dirname6, join as join8 } from "node:path";
16379
16333
  function isGateOfficerSeat(value) {
16380
16334
  return packagedProvinceConfig(value);
16381
16335
  }
@@ -16383,7 +16337,7 @@ function publicCliConfigPath(home) {
16383
16337
  if (typeof home !== "string" || home.trim() === "") {
16384
16338
  throw new Error("home must be explicitly provided");
16385
16339
  }
16386
- return join9(home, ".ak-roles", "public-cli.json");
16340
+ return join8(home, ".ak-roles", "public-cli.json");
16387
16341
  }
16388
16342
  async function loadPublicCliConfig(home) {
16389
16343
  const path = publicCliConfigPath(home);
@@ -16843,11 +16797,11 @@ function credentialProvidersFromAuthData(data) {
16843
16797
  };
16844
16798
  }
16845
16799
  function resolvePublicAgentDir(explicit, home) {
16846
- return explicit ?? process.env.PI_CODING_AGENT_DIR ?? join9(home, ".pi", "agent");
16800
+ return explicit ?? process.env.PI_CODING_AGENT_DIR ?? join8(home, ".pi", "agent");
16847
16801
  }
16848
16802
  async function loadCredentialProviders(agentDir) {
16849
16803
  try {
16850
- const raw = await readFile3(join9(agentDir, "auth.json"), "utf8");
16804
+ const raw = await readFile3(join8(agentDir, "auth.json"), "utf8");
16851
16805
  return credentialProvidersFromAuthData(JSON.parse(raw));
16852
16806
  } catch (error) {
16853
16807
  if (isEnoent(error)) return { "openai-codex": false, xai: false };
@@ -16872,15 +16826,15 @@ var init_config2 = __esm({
16872
16826
 
16873
16827
  // src/public-cli/host-providers.ts
16874
16828
  import { readFileSync as readFileSync2 } from "node:fs";
16875
- import { join as join10 } from "node:path";
16829
+ import { join as join9 } from "node:path";
16876
16830
  function hostProvidersPath(home) {
16877
16831
  if (typeof home !== "string" || home.trim() === "") {
16878
16832
  throw new Error("home must be explicitly provided");
16879
16833
  }
16880
- return join10(home, ".ak-roles", "host-providers.json");
16834
+ return join9(home, ".ak-roles", "host-providers.json");
16881
16835
  }
16882
16836
  function hermesProviderModelsCachePath(home) {
16883
- return join10(home, ".hermes", "provider_models_cache.json");
16837
+ return join9(home, ".hermes", "provider_models_cache.json");
16884
16838
  }
16885
16839
  function parseHostProvidersTable(value) {
16886
16840
  if (!isRecord(value)) {
@@ -17054,16 +17008,16 @@ var init_cli_errors = __esm({
17054
17008
  // src/public-cli/machine-method-skills.ts
17055
17009
  import { accessSync, constants, statSync as statSync3 } from "node:fs";
17056
17010
  import { lstat, mkdir as mkdir2, symlink } from "node:fs/promises";
17057
- import { join as join11 } from "node:path";
17011
+ import { join as join10 } from "node:path";
17058
17012
  import { spawnSync } from "node:child_process";
17059
17013
  function skillRoot(home) {
17060
- return join11(home, ".agents/skills");
17014
+ return join10(home, ".agents/skills");
17061
17015
  }
17062
17016
  function installedMethodSkillPath(home, name) {
17063
17017
  return installedSkillPath(skillRoot(home), name);
17064
17018
  }
17065
17019
  function installedSkillPath(root, name) {
17066
- const path = join11(root, name, "SKILL.md");
17020
+ const path = join10(root, name, "SKILL.md");
17067
17021
  try {
17068
17022
  if (!statSync3(path).isFile()) return void 0;
17069
17023
  accessSync(path, constants.R_OK);
@@ -17076,9 +17030,9 @@ function installedSkillPath(root, name) {
17076
17030
  }
17077
17031
  function linkedSkillRoot(home, host) {
17078
17032
  if (host === "claude" || host === "claude-code") {
17079
- return join11(process.env.CLAUDE_CONFIG_DIR?.trim() || join11(home, ".claude"), "skills");
17033
+ return join10(process.env.CLAUDE_CONFIG_DIR?.trim() || join10(home, ".claude"), "skills");
17080
17034
  }
17081
- if (host === "hermes") return join11(home, ".hermes/skills");
17035
+ if (host === "hermes") return join10(home, ".hermes/skills");
17082
17036
  return void 0;
17083
17037
  }
17084
17038
  async function occupied(path) {
@@ -17135,7 +17089,7 @@ async function runMachineSkillSetup(home, stdout) {
17135
17089
  const missingBySource = /* @__PURE__ */ new Map();
17136
17090
  let unsourced = false;
17137
17091
  for (const name of packagedMethodSkillNames()) {
17138
- const path = join11(canonical, name);
17092
+ const path = join10(canonical, name);
17139
17093
  if (await occupied(path)) {
17140
17094
  warnOccupied(path, stdout);
17141
17095
  continue;
@@ -17165,9 +17119,9 @@ async function runMachineSkillSetup(home, stdout) {
17165
17119
  throw error;
17166
17120
  }
17167
17121
  for (const name of packagedMethodSkillNames()) {
17168
- const target = join11(canonical, name);
17122
+ const target = join10(canonical, name);
17169
17123
  if (installedMethodSkillPath(home, name) === void 0) continue;
17170
- const link = join11(root, name);
17124
+ const link = join10(root, name);
17171
17125
  if (await occupied(link)) {
17172
17126
  warnOccupied(link, stdout);
17173
17127
  continue;
@@ -17195,19 +17149,7 @@ var init_machine_method_skills = __esm({
17195
17149
  }
17196
17150
  });
17197
17151
 
17198
- // src/sha256.ts
17199
- import { createHash } from "node:crypto";
17200
- function sha256Hex(bytes) {
17201
- return createHash("sha256").update(bytes).digest("hex");
17202
- }
17203
- var init_sha256 = __esm({
17204
- "src/sha256.ts"() {
17205
- "use strict";
17206
- }
17207
- });
17208
-
17209
17152
  // src/collector-config.ts
17210
- import { readFile as readFile4 } from "node:fs/promises";
17211
17153
  function fail3(message, cause) {
17212
17154
  throw new Error(message, cause === void 0 ? void 0 : { cause });
17213
17155
  }
@@ -17235,47 +17177,10 @@ function parseCollectorPrNumber(raw) {
17235
17177
  if (value === void 0) fail3(typeof raw === "string" && !isTicketNumberString(raw) ? "Collector pull request number must be a positive safe integer string" : "Collector pull request number must be a positive safe integer");
17236
17178
  return value;
17237
17179
  }
17238
- function canonicalManifest(requests) {
17239
- return `${JSON.stringify({ requests: requests.map((request) => ({ id: request.id, body: request.requestBody })) })}
17240
- `;
17241
- }
17242
- function emptyCollectorManifest() {
17243
- const canonicalJson2 = canonicalManifest([]);
17244
- return { requests: [], canonicalJson: canonicalJson2, digest: sha256Hex(canonicalJson2) };
17245
- }
17246
- async function loadCollectorManifest(path) {
17247
- let bytes;
17248
- try {
17249
- bytes = await readFile4(path);
17250
- } catch (error) {
17251
- fail3(`Collector request manifest is unreadable at ${path}`, error);
17252
- }
17253
- let parsed;
17254
- try {
17255
- parsed = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
17256
- } catch (error) {
17257
- fail3("Collector request manifest must be UTF-8 JSON", error);
17258
- }
17259
- if (!isRecord(parsed)) fail3("Collector request manifest must be an object");
17260
- const rawRequests = parsed.requests ?? [];
17261
- if (!Array.isArray(rawRequests)) fail3("Collector request manifest requests must be an array");
17262
- const requests = [];
17263
- const ids = /* @__PURE__ */ new Set();
17264
- for (const [index, item] of rawRequests.entries()) {
17265
- if (!isRecord(item) || typeof item.id !== "string" || item.id.length === 0 || typeof item.body !== "string" || item.body.trim() === "") fail3(`Collector request manifest requests[${index}] is invalid`);
17266
- if (ids.has(item.id)) fail3(`Collector request manifest has duplicate request id "${item.id}"`);
17267
- ids.add(item.id);
17268
- requests.push({ id: item.id, requestBody: item.body });
17269
- }
17270
- const canonicalJson2 = canonicalManifest(requests);
17271
- return { requests, canonicalJson: canonicalJson2, digest: sha256Hex(canonicalJson2), sourcePath: path };
17272
- }
17273
17180
  var COLLECTOR_OWNER_PATTERN, COLLECTOR_REPO_PATTERN;
17274
17181
  var init_collector_config = __esm({
17275
17182
  "src/collector-config.ts"() {
17276
17183
  "use strict";
17277
- init_sha256();
17278
- init_unknown_value();
17279
17184
  init_run_ticket_number();
17280
17185
  COLLECTOR_OWNER_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/;
17281
17186
  COLLECTOR_REPO_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,98}[A-Za-z0-9])?$/;
@@ -17283,7 +17188,7 @@ var init_collector_config = __esm({
17283
17188
  });
17284
17189
 
17285
17190
  // src/auditor-dossier-tool.ts
17286
- import { join as join12, resolve as resolve3 } from "node:path";
17191
+ import { join as join11, resolve as resolve3 } from "node:path";
17287
17192
  function auditorRunDirectory(context) {
17288
17193
  const sessionFile = context.sessionManager?.getSessionFile?.();
17289
17194
  if (sessionFile === void 0) return void 0;
@@ -18096,13 +18001,13 @@ var init_receipt_delivery_policy = __esm({
18096
18001
  });
18097
18002
 
18098
18003
  // src/ledger-session-read.ts
18099
- import { readFile as readFile5 } from "node:fs/promises";
18004
+ import { readFile as readFile4 } from "node:fs/promises";
18100
18005
  async function readStrictPiSessionJsonl(path) {
18101
- const text = await readFile5(path, "utf8");
18006
+ const text = await readFile4(path, "utf8");
18102
18007
  return text.trim().split("\n").filter(Boolean).map((line2) => JSON.parse(line2));
18103
18008
  }
18104
18009
  async function readLedgerSessionJsonlLines(path) {
18105
- const text = await readFile5(path, "utf8");
18010
+ const text = await readFile4(path, "utf8");
18106
18011
  const lines = text.split("\n");
18107
18012
  const out = [];
18108
18013
  for (let index = 0; index < lines.length; index += 1) {
@@ -18520,15 +18425,15 @@ import { randomBytes } from "node:crypto";
18520
18425
  import { spawnSync as spawnSync2 } from "node:child_process";
18521
18426
  import {
18522
18427
  copyFileSync,
18523
- existsSync as existsSync3,
18428
+ existsSync as existsSync2,
18524
18429
  mkdirSync as mkdirSync3,
18525
- readdirSync as readdirSync2,
18430
+ readdirSync,
18526
18431
  renameSync as renameSync2,
18527
18432
  rmSync as rmSync3,
18528
18433
  statSync as statSync4
18529
18434
  } from "node:fs";
18530
18435
  import { homedir } from "node:os";
18531
- import { dirname as dirname7, join as join13 } from "node:path";
18436
+ import { dirname as dirname7, join as join12 } from "node:path";
18532
18437
  function declareHostSessionFailure(error) {
18533
18438
  const message = error instanceof Error ? error.stack || error.message : String(error);
18534
18439
  process.stderr.write(`[host-session] Dossier record failure: ${message}
@@ -18547,13 +18452,13 @@ function findCodexRollout(sessionsDir, sessionId) {
18547
18452
  if (depth > 6) return;
18548
18453
  let entries;
18549
18454
  try {
18550
- entries = readdirSync2(dir, { withFileTypes: true });
18455
+ entries = readdirSync(dir, { withFileTypes: true });
18551
18456
  } catch (error) {
18552
18457
  if (isEnoent(error)) return;
18553
18458
  throw error;
18554
18459
  }
18555
18460
  for (const entry of entries) {
18556
- const fullPath = join13(dir, entry.name);
18461
+ const fullPath = join12(dir, entry.name);
18557
18462
  if (entry.isDirectory()) {
18558
18463
  scan(fullPath, depth + 1);
18559
18464
  } else if (entry.isFile() && entry.name.endsWith(".jsonl") && entry.name.includes(sessionId)) {
@@ -18583,24 +18488,24 @@ function sanitizeClaudeCwd(cwd) {
18583
18488
  function resolveNativeSessionPath(options) {
18584
18489
  const home = options.home || homedir();
18585
18490
  if (options.host === "claude") {
18586
- const configDir = process.env.CLAUDE_CONFIG_DIR || join13(home, ".claude");
18491
+ const configDir = process.env.CLAUDE_CONFIG_DIR || join12(home, ".claude");
18587
18492
  const sanitizedCwd = sanitizeClaudeCwd(options.cwd);
18588
- return join13(configDir, "projects", sanitizedCwd, `${options.sessionId}.jsonl`);
18493
+ return join12(configDir, "projects", sanitizedCwd, `${options.sessionId}.jsonl`);
18589
18494
  }
18590
18495
  if (options.host === "codex") {
18591
18496
  return findCodexRollout(codexSessionsDirectory(home), options.sessionId);
18592
18497
  }
18593
18498
  if (options.host === "grok-build") {
18594
- const grokHome = process.env.GROK_HOME || join13(home, ".grok");
18595
- return join13(grokHome, "sessions", encodeURIComponent(options.cwd), options.sessionId);
18499
+ const grokHome = process.env.GROK_HOME || join12(home, ".grok");
18500
+ return join12(grokHome, "sessions", encodeURIComponent(options.cwd), options.sessionId);
18596
18501
  }
18597
18502
  return void 0;
18598
18503
  }
18599
18504
  function codexSessionsDirectory(home) {
18600
- return join13(process.env.CODEX_HOME || join13(home || homedir(), ".codex"), "sessions");
18505
+ return join12(process.env.CODEX_HOME || join12(home || homedir(), ".codex"), "sessions");
18601
18506
  }
18602
18507
  function resolveHostDossierLandingPath(options) {
18603
- return options.host === "grok-build" ? join13(options.sessionDirectory, options.host) : join13(options.sessionDirectory, `${options.host}.jsonl`);
18508
+ return options.host === "grok-build" ? join12(options.sessionDirectory, options.host) : join12(options.sessionDirectory, `${options.host}.jsonl`);
18604
18509
  }
18605
18510
  function copyFileCloneOrFallback(src, dest) {
18606
18511
  try {
@@ -18612,8 +18517,8 @@ function copyFileCloneOrFallback(src, dest) {
18612
18517
  }
18613
18518
  function copyGrokDossier(srcDir, destDir) {
18614
18519
  mkdirSync3(destDir, { recursive: true });
18615
- copyFileCloneOrFallback(join13(srcDir, "chat_history.jsonl"), join13(destDir, "chat_history.jsonl"));
18616
- copyFileCloneOrFallback(join13(srcDir, "usage.json"), join13(destDir, "usage.json"));
18520
+ copyFileCloneOrFallback(join12(srcDir, "chat_history.jsonl"), join12(destDir, "chat_history.jsonl"));
18521
+ copyFileCloneOrFallback(join12(srcDir, "usage.json"), join12(destDir, "usage.json"));
18617
18522
  }
18618
18523
  function copyAndRecordHostDossier(options) {
18619
18524
  if (options.host === "hermes") {
@@ -18668,7 +18573,7 @@ function copyAndRecordHostDossier(options) {
18668
18573
  }
18669
18574
  if (options.host === "grok-build") {
18670
18575
  const previous = `${landingPath}.previous.${attemptToken}`;
18671
- const hadPrevious = existsSync3(landingPath);
18576
+ const hadPrevious = existsSync2(landingPath);
18672
18577
  let parked = false;
18673
18578
  let keepUniquePrevious = false;
18674
18579
  let cleanupError;
@@ -18682,12 +18587,12 @@ function copyAndRecordHostDossier(options) {
18682
18587
  try {
18683
18588
  renameSync2(staging, landingPath);
18684
18589
  } catch (swapError) {
18685
- if (parked && existsSync3(previous) && !existsSync3(landingPath)) {
18590
+ if (parked && existsSync2(previous) && !existsSync2(landingPath)) {
18686
18591
  try {
18687
18592
  renameSync2(previous, landingPath);
18688
18593
  } catch (error) {
18689
18594
  restoreError = error;
18690
- if (existsSync3(previous) && !existsSync3(landingPath)) {
18595
+ if (existsSync2(previous) && !existsSync2(landingPath)) {
18691
18596
  keepUniquePrevious = true;
18692
18597
  }
18693
18598
  }
@@ -18695,7 +18600,7 @@ function copyAndRecordHostDossier(options) {
18695
18600
  swapFailure = swapError;
18696
18601
  }
18697
18602
  } finally {
18698
- if (parked && existsSync3(previous) && !keepUniquePrevious) {
18603
+ if (parked && existsSync2(previous) && !keepUniquePrevious) {
18699
18604
  try {
18700
18605
  rmSync3(previous, { recursive: true, force: true });
18701
18606
  } catch (error) {
@@ -19146,7 +19051,7 @@ var init_engine_detour_usage = __esm({
19146
19051
  });
19147
19052
 
19148
19053
  // src/dossier-resolution.ts
19149
- import { existsSync as existsSync4, statSync as statSync5 } from "node:fs";
19054
+ import { existsSync as existsSync3, statSync as statSync5 } from "node:fs";
19150
19055
  import { resolve as resolve4 } from "node:path";
19151
19056
  function isHostContext(value) {
19152
19057
  return "sessionManager" in value;
@@ -19166,7 +19071,7 @@ function resolveAuditDossier(source) {
19166
19071
  }
19167
19072
  const runDirectory = resolve4(raw);
19168
19073
  try {
19169
- if (!existsSync4(runDirectory) || !statSync5(runDirectory).isDirectory()) {
19074
+ if (!existsSync3(runDirectory) || !statSync5(runDirectory).isDirectory()) {
19170
19075
  return { status: "incomplete", observation: { kind: "missing-dossier" } };
19171
19076
  }
19172
19077
  } catch {
@@ -19210,6 +19115,17 @@ var init_dossier_resolution = __esm({
19210
19115
  }
19211
19116
  });
19212
19117
 
19118
+ // src/sha256.ts
19119
+ import { createHash } from "node:crypto";
19120
+ function sha256Hex(bytes) {
19121
+ return createHash("sha256").update(bytes).digest("hex");
19122
+ }
19123
+ var init_sha256 = __esm({
19124
+ "src/sha256.ts"() {
19125
+ "use strict";
19126
+ }
19127
+ });
19128
+
19213
19129
  // src/package-contracts/terminating-tools.ts
19214
19130
  function isTerminatingToolName(name) {
19215
19131
  return TERMINATING_TOOL_NAMES.includes(name);
@@ -19271,7 +19187,7 @@ var init_terminating_tools = __esm({
19271
19187
  });
19272
19188
 
19273
19189
  // src/doctor-evidence.ts
19274
- import { readdir as readdir2, readFile as readFile6, realpath, stat } from "node:fs/promises";
19190
+ import { readdir as readdir2, readFile as readFile5, realpath, stat } from "node:fs/promises";
19275
19191
  import { dirname as dirname8, relative as relative2, resolve as resolve5, sep as sep2 } from "node:path";
19276
19192
  async function discoverCaseFiles(root) {
19277
19193
  const found = [];
@@ -19384,7 +19300,7 @@ async function loadDoctorCase(runsPath, projectRoot) {
19384
19300
  const turns = { count: 0, sources: [] }, calls = { count: 0, sources: [] }, tokens = { count: 0, sources: [] };
19385
19301
  for (const path of await discoverCaseFiles(root)) {
19386
19302
  const id = relative2(root, path).split(sep2).join("/");
19387
- const bytes = await readFile6(path);
19303
+ const bytes = await readFile5(path);
19388
19304
  const content = bytes.toString("utf8");
19389
19305
  const kind = id.split("/").length === 2 && id.endsWith("/log.jsonl") ? "log" : "session";
19390
19306
  evidence.push({ id, kind, byteLength: bytes.byteLength, contentLength: content.length, sha256: sha256Hex(bytes), content });
@@ -19462,7 +19378,7 @@ var init_git_object_id = __esm({
19462
19378
 
19463
19379
  // src/merger-git-state.ts
19464
19380
  import { execFile } from "node:child_process";
19465
- import { access, readFile as readFile7 } from "node:fs/promises";
19381
+ import { access, readFile as readFile6 } from "node:fs/promises";
19466
19382
  import { constants as fsConstants } from "node:fs";
19467
19383
  import { isAbsolute as isAbsolute3, resolve as resolve6 } from "node:path";
19468
19384
  import { promisify } from "node:util";
@@ -19532,7 +19448,7 @@ function createProductionMergerGitState(repositoryRoot = process.cwd()) {
19532
19448
  const mergeHeadPath = isAbsolute3(mergeHeadReported) ? mergeHeadReported : resolve6(repositoryRoot, mergeHeadReported);
19533
19449
  let sourceObjectId = "";
19534
19450
  if (await pathExists(mergeHeadPath)) {
19535
- const raw = exactUtf8(await readFile7(mergeHeadPath), "Git MERGE_HEAD");
19451
+ const raw = exactUtf8(await readFile6(mergeHeadPath), "Git MERGE_HEAD");
19536
19452
  const mergeHeads = raw.trim().split(/\r?\n/).map((row) => row.trim()).filter(Boolean);
19537
19453
  if (mergeHeads.length === 0) throw new Error("Git MERGE_HEAD is empty");
19538
19454
  if (mergeHeads.length !== 1) throw new Error("Assigned repository does not have one ordinary in-progress merge");
@@ -19567,8 +19483,8 @@ var init_session_dialogue = __esm({
19567
19483
  });
19568
19484
 
19569
19485
  // src/ticket-provenance.ts
19570
- import { readFile as readFile8 } from "node:fs/promises";
19571
- import { join as join14, resolve as resolve7 } from "node:path";
19486
+ import { readFile as readFile7 } from "node:fs/promises";
19487
+ import { join as join13, resolve as resolve7 } from "node:path";
19572
19488
  function ticketProvenanceSubject(ticketNumber) {
19573
19489
  if (!isSafePositiveTicketNumber(ticketNumber)) {
19574
19490
  throw new Error(
@@ -19591,7 +19507,7 @@ async function rehomeUnboundTicketProvenance(runDirectory, ticketNumber, cwd, ho
19591
19507
  const ticketInput = ticketProvenanceRecordInput(ticketNumber, cwd, home);
19592
19508
  let history;
19593
19509
  try {
19594
- history = await readFile8(join14(runDirectory, RUN_HISTORY_FILE), "utf8");
19510
+ history = await readFile7(join13(runDirectory, RUN_HISTORY_FILE), "utf8");
19595
19511
  } catch (error) {
19596
19512
  if (errnoCode(error) === "ENOENT") return;
19597
19513
  throw error;
@@ -19647,7 +19563,7 @@ var init_uuidv7 = __esm({
19647
19563
  });
19648
19564
 
19649
19565
  // src/notary-source-run.ts
19650
- import { dirname as dirname9, isAbsolute as isAbsolute4, join as join15, resolve as resolve8, basename as basename7 } from "node:path";
19566
+ import { dirname as dirname9, isAbsolute as isAbsolute4, join as join14, resolve as resolve8, basename as basename7 } from "node:path";
19651
19567
  import { lstat as lstat2, realpath as realpath2 } from "node:fs/promises";
19652
19568
  async function readRetainedIdentity(runDirectory) {
19653
19569
  try {
@@ -19699,11 +19615,11 @@ async function resolveNotarySourceRunLocator(options) {
19699
19615
  const ledgerHome = resolveActivationLedgerHome(options.home);
19700
19616
  const bookKey = resolveBookKeyFromGit(options.projectRoot);
19701
19617
  const bookDirectory = activationBookDirectory(ledgerHome, bookKey);
19702
- const bookRunsRoot = join15(bookDirectory, "runs");
19618
+ const bookRunsRoot = join14(bookDirectory, "runs");
19703
19619
  let candidate;
19704
19620
  const bare = parseRunLeaf(raw);
19705
19621
  if (bare !== void 0 && !raw.includes("/") && !raw.includes("\\")) {
19706
- candidate = await findRunDirectoryById(options.home, bare.runId, bookKey, bare.role) ?? join15(bookRunsRoot, formatRunLeaf(bare.runId, bare.role));
19622
+ candidate = await findRunDirectoryById(options.home, bare.runId, bookKey, bare.role) ?? join14(bookRunsRoot, formatRunLeaf(bare.runId, bare.role));
19707
19623
  } else {
19708
19624
  candidate = isAbsolute4(raw) ? raw : resolve8(options.projectRoot, raw);
19709
19625
  const identity2 = parseRunLeaf(basename7(candidate));
@@ -20174,8 +20090,8 @@ var init_option_definitions = __esm({
20174
20090
  repeatable: true,
20175
20091
  form: "option",
20176
20092
  description: {
20177
- en: "Attach a regular file; frozen at admission (repeatable).",
20178
- zh: "\u9644\u52A0\u666E\u901A\u6587\u4EF6\uFF1B\u53D7\u7406\u5373\u51BB\u7ED3\uFF08\u53EF\u91CD\u590D\uFF09\u3002"
20093
+ en: "Caller file path passed as-is to the role (repeatable). Package does not read, copy, or validate; use an absolute path when cwd differs from --project.",
20094
+ zh: "\u8C03\u7528\u65B9\u6587\u4EF6\u8DEF\u5F84\u539F\u6837\u9012\u7ED9\u8859\u95E8\uFF08\u53EF\u91CD\u590D\uFF09\u3002\u5305\u4E0D\u8BFB\u3001\u4E0D\u590D\u5236\u3001\u4E0D\u6821\u9A8C\uFF1B\u8C03\u7528\u65B9\u5F53\u524D\u76EE\u5F55\u4E0E --project \u4E0D\u540C\u65F6\u8BF7\u7ED9\u7EDD\u5BF9\u8DEF\u5F84\u3002"
20179
20095
  }
20180
20096
  };
20181
20097
  SHARED_PHASE_SEMANTICS = {
@@ -20350,8 +20266,8 @@ var init_option_definitions = __esm({
20350
20266
  repeatable: false,
20351
20267
  form: "option",
20352
20268
  description: {
20353
- en: "Optional request manifest JSON path ({requests:[{id,body}]}). Parsed for semantics and passed to the Collector as materials \u2014 not a machine collection directive.",
20354
- zh: "\u53EF\u9009 request manifest JSON \u8DEF\u5F84\uFF08{requests:[{id,body}]}\uFF09\u3002\u6309\u8BED\u4E49\u89E3\u6790\u540E\u4F5C\u4E3A\u6750\u6599\u9012\u7ED9\u901A\u8FDB\u53F8\uFF0C\u4E0D\u662F\u673A\u5668\u4EE3\u6536 finding \u7684\u6307\u4EE4\u3002"
20269
+ en: "Caller path to a request manifest JSON file, passed as-is. Package does not read, copy, or validate; use an absolute path when cwd differs from --project.",
20270
+ zh: "\u8C03\u7528\u65B9 request manifest JSON \u8DEF\u5F84\uFF0C\u539F\u6837\u4F20\u9012\u3002\u5305\u4E0D\u8BFB\u3001\u4E0D\u590D\u5236\u3001\u4E0D\u6821\u9A8C\uFF1B\u8C03\u7528\u65B9\u5F53\u524D\u76EE\u5F55\u4E0E --project \u4E0D\u540C\u65F6\u8BF7\u7ED9\u7EDD\u5BF9\u8DEF\u5F84\u3002"
20355
20271
  }
20356
20272
  }
20357
20273
  ];
@@ -20808,18 +20724,24 @@ var init_option_definitions = __esm({
20808
20724
 
20809
20725
  // src/public-cli/invocation.ts
20810
20726
  import { execFileSync as execFileSync2 } from "node:child_process";
20811
- import { existsSync as existsSync5 } from "node:fs";
20727
+ import { existsSync as existsSync4 } from "node:fs";
20812
20728
  import {
20813
- lstat as lstat3,
20814
- mkdtemp,
20815
- readFile as readFile9,
20729
+ readFile as readFile8,
20816
20730
  realpath as realpath3,
20817
20731
  rename,
20818
- rm,
20819
20732
  writeFile as writeFile2
20820
20733
  } from "node:fs/promises";
20821
- import { tmpdir } from "node:os";
20822
- import { basename as basename8, dirname as dirname10, isAbsolute as isAbsolute5, join as join16, resolve as resolve9 } from "node:path";
20734
+ import { dirname as dirname10, isAbsolute as isAbsolute5, join as join15, resolve as resolve9 } from "node:path";
20735
+ function normalizeAdmittedAttachment(raw) {
20736
+ if (typeof raw !== "object" || raw === null) return void 0;
20737
+ const record = raw;
20738
+ const path = record.path;
20739
+ if (typeof path === "string") return { path };
20740
+ return void 0;
20741
+ }
20742
+ function admitCallerAttachments(attachmentPaths) {
20743
+ return attachmentPaths.map((path) => ({ path }));
20744
+ }
20823
20745
  function issueAdmissionPlacement(authority, request) {
20824
20746
  const ledgerHome = resolveActivationLedgerHome(request.home);
20825
20747
  const bookKey = resolveBookKeyFromGit(request.cwd);
@@ -20962,8 +20884,8 @@ async function relocateAdmittedRunToTicket(admitted, authority, heldLease) {
20962
20884
  const childRunIds = readPageSync(oldRunDirectory, "admitted")?.childDiaristRunIds;
20963
20885
  for (const childRunId of Array.isArray(childRunIds) ? childRunIds : []) {
20964
20886
  if (typeof childRunId !== "string") continue;
20965
- const childDirectory = join16(dirname10(oldRunDirectory), formatRunLeaf(childRunId, "diarist"));
20966
- if (!existsSync5(childDirectory)) continue;
20887
+ const childDirectory = join15(dirname10(oldRunDirectory), formatRunLeaf(childRunId, "diarist"));
20888
+ if (!existsSync4(childDirectory)) continue;
20967
20889
  const childTarget = roleRunPlacement(ledgerHome, {
20968
20890
  bookKey: admitted.bookKey,
20969
20891
  subject: { ticketNumber: admitted.ticketNumber },
@@ -20998,19 +20920,11 @@ async function relocateAdmittedRunToTicket(admitted, authority, heldLease) {
20998
20920
  "taskPath",
20999
20921
  "packetPath",
21000
20922
  "prerequisitesPath",
21001
- "requestManifestPath",
21002
20923
  "mergerInputPath"
21003
20924
  ],
21004
20925
  oldRunDirectory,
21005
20926
  target.runDirectory
21006
20927
  );
21007
- for (const attachment of admitted.attachments) {
21008
- attachment.frozenPath = rewriteRunDirectoryPathValue(
21009
- attachment.frozenPath,
21010
- oldRunDirectory,
21011
- target.runDirectory
21012
- );
21013
- }
21014
20928
  admitted.principal = principal;
21015
20929
  renderCurrentSync(target.runDirectory);
21016
20930
  return { oldRunDirectory, newRunDirectory: target.runDirectory };
@@ -21047,7 +20961,7 @@ async function recordLaunchedPiIdentity(runDirectory, identity) {
21047
20961
  async function observeLaunchedRolePackageIdentity(packageRoot2, selectedRoleEntry) {
21048
20962
  const rolePackageRoot = packageRoot2;
21049
20963
  const raw = JSON.parse(
21050
- await readFile9(join16(rolePackageRoot, "package.json"), "utf8")
20964
+ await readFile8(join15(rolePackageRoot, "package.json"), "utf8")
21051
20965
  );
21052
20966
  if (typeof raw.version !== "string" || raw.version.trim() === "") {
21053
20967
  throw new Error(
@@ -21103,7 +21017,7 @@ function assignPublicSeatOption(owner, taken, fields) {
21103
21017
  const value = taken.value;
21104
21018
  switch (taken.def.id) {
21105
21019
  case "attach":
21106
- fields.attachmentPaths.push(requireOptionPath(taken.def.canonical, value));
21020
+ fields.attachmentPaths.push(requireProvidedOptionValue(taken.def.canonical, value));
21107
21021
  return;
21108
21022
  case "project":
21109
21023
  fields.project = requireOptionPath(taken.def.canonical, value);
@@ -21147,7 +21061,7 @@ function assignPublicSeatOption(owner, taken, fields) {
21147
21061
  fields.repo = parseRepoOption(value);
21148
21062
  return;
21149
21063
  case "request-manifest":
21150
- fields.requestManifestPath = requireOptionPath(taken.def.canonical, value);
21064
+ fields.requestManifestPath = requireProvidedOptionValue(taken.def.canonical, value);
21151
21065
  return;
21152
21066
  case "issue": {
21153
21067
  if (value === void 0 || value.trim() === "") {
@@ -21262,6 +21176,12 @@ function requireOptionPath(flag, value) {
21262
21176
  }
21263
21177
  return value;
21264
21178
  }
21179
+ function requireProvidedOptionValue(flag, value) {
21180
+ if (value === void 0) {
21181
+ throw new CliUsageError(`${flag} requires a path`);
21182
+ }
21183
+ return value;
21184
+ }
21265
21185
  function skillArgTokenFault(value) {
21266
21186
  if (value === void 0 || value.trim() === "") return "empty";
21267
21187
  if (/\s/.test(value)) return "whitespace";
@@ -21314,124 +21234,6 @@ function requireAuthorityRef(value) {
21314
21234
  optionLike: "--authority-ref requires a durable reference, not inline Spec prose"
21315
21235
  });
21316
21236
  }
21317
- async function readRegularFileAttachment(sourcePath) {
21318
- const absolute = isAbsolute5(sourcePath) ? sourcePath : resolve9(sourcePath);
21319
- let st;
21320
- try {
21321
- st = await lstat3(absolute);
21322
- } catch (error) {
21323
- throw new CliUsageError(
21324
- `attachment is not a readable regular file: ${sourcePath}`,
21325
- { cause: error }
21326
- );
21327
- }
21328
- if (!st.isFile() || st.isSymbolicLink()) {
21329
- throw new CliUsageError(
21330
- `attachment must be a regular file (not a directory or symlink): ${sourcePath}`
21331
- );
21332
- }
21333
- try {
21334
- return { absolute, bytes: await readFile9(absolute) };
21335
- } catch (error) {
21336
- throw new CliUsageError(
21337
- `attachment is not a readable regular file: ${sourcePath}`,
21338
- { cause: error }
21339
- );
21340
- }
21341
- }
21342
- async function removePreparedAttachmentDirectory(stagingDirectory) {
21343
- await rm(stagingDirectory, { recursive: true, force: true });
21344
- }
21345
- async function withPreparedAttachments(attachmentPaths, use) {
21346
- if (attachmentPaths.length === 0) return await use([]);
21347
- const stagingDirectory = await mkdtemp(join16(tmpdir(), "ak-role-attachments-"));
21348
- const prepared = [];
21349
- let result;
21350
- try {
21351
- for (let index = 0; index < attachmentPaths.length; index += 1) {
21352
- const { absolute, bytes } = await readRegularFileAttachment(attachmentPaths[index]);
21353
- const snapshotPath = join16(stagingDirectory, String(index).padStart(6, "0"));
21354
- await writeFile2(snapshotPath, bytes);
21355
- prepared.push({ absolute, snapshotPath });
21356
- }
21357
- result = await use(prepared);
21358
- } catch (primary) {
21359
- try {
21360
- await removePreparedAttachmentDirectory(stagingDirectory);
21361
- } catch (cleanup) {
21362
- throw new AggregateError(
21363
- [primary, cleanup],
21364
- "attachment snapshot operation failed and cleanup also failed",
21365
- { cause: primary }
21366
- );
21367
- }
21368
- throw primary;
21369
- }
21370
- await removePreparedAttachmentDirectory(stagingDirectory);
21371
- return result;
21372
- }
21373
- async function freezeAttachmentBytes(provenancePath, bytes, destinationDir, index) {
21374
- const frozenPath = join16(
21375
- destinationDir,
21376
- `${String(index).padStart(2, "0")}-${basename8(provenancePath)}`
21377
- );
21378
- await writeFile2(frozenPath, bytes);
21379
- return {
21380
- provenancePath,
21381
- frozenPath,
21382
- byteLength: bytes.byteLength,
21383
- sha256: sha256Hex(bytes),
21384
- mediaKind: "regular-file"
21385
- };
21386
- }
21387
- async function freezePreparedAttachment(prepared, destinationDir, index) {
21388
- return freezeAttachmentBytes(
21389
- prepared.absolute,
21390
- await readFile9(prepared.snapshotPath),
21391
- destinationDir,
21392
- index
21393
- );
21394
- }
21395
- async function freezeRegularFileAttachment(sourcePath, destinationDir, index) {
21396
- const { absolute, bytes } = await readRegularFileAttachment(sourcePath);
21397
- return {
21398
- attachment: await freezeAttachmentBytes(absolute, bytes, destinationDir, index),
21399
- body: bytes
21400
- };
21401
- }
21402
- async function freezeAttachments(ledgerHome, attachmentPaths, attachmentsDirectory) {
21403
- const attachments = [];
21404
- if (attachmentPaths.length > 0) {
21405
- ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
21406
- }
21407
- for (let i = 0; i < attachmentPaths.length; i += 1) {
21408
- const frozen = await freezeRegularFileAttachment(
21409
- attachmentPaths[i],
21410
- attachmentsDirectory,
21411
- i
21412
- );
21413
- attachments.push(frozen.attachment);
21414
- }
21415
- return attachments;
21416
- }
21417
- async function freezeAttachmentsIntoRun(attachmentPaths, runDirectory, summonsKey = `s-${Date.now().toString(36)}`) {
21418
- if (attachmentPaths.length === 0) return [];
21419
- const ledgerHome = resolveActivationLedgerHome(homeFromRunDirectory(runDirectory));
21420
- const attachmentsDirectory = join16(runDirectory, "attachments", summonsKey);
21421
- ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
21422
- return freezeAttachments(ledgerHome, attachmentPaths, attachmentsDirectory);
21423
- }
21424
- async function freezePreparedAttachmentsIntoRun(prepared, runDirectory, summonsKey) {
21425
- if (prepared.length === 0) return [];
21426
- const ledgerHome = resolveActivationLedgerHome(homeFromRunDirectory(runDirectory));
21427
- const attachmentsDirectory = summonsKey === void 0 ? join16(runDirectory, "attachments") : join16(runDirectory, "attachments", summonsKey);
21428
- ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
21429
- const attachments = [];
21430
- for (let index = 0; index < prepared.length; index += 1) {
21431
- attachments.push(await freezePreparedAttachment(prepared[index], attachmentsDirectory, index));
21432
- }
21433
- return attachments;
21434
- }
21435
21237
  function ticketAdmissionFields(ticketNumber) {
21436
21238
  if (ticketNumber === void 0) return {};
21437
21239
  return {
@@ -21501,7 +21303,7 @@ async function admitPublicRole(role, parsed, env, override) {
21501
21303
  attachmentPaths,
21502
21304
  ...project,
21503
21305
  placedFields: async (placed) => {
21504
- const taskPath = join16(placed.runDirectory, "task.md");
21306
+ const taskPath = join15(placed.runDirectory, "task.md");
21505
21307
  await writeFile2(taskPath, instruction, "utf8");
21506
21308
  return { phase, taskPath };
21507
21309
  }
@@ -21520,7 +21322,7 @@ async function admitPublicRole(role, parsed, env, override) {
21520
21322
  if (parsed.prerequisitesPath !== void 0) {
21521
21323
  const absolutePrereq = isAbsolute5(parsed.prerequisitesPath) ? parsed.prerequisitesPath : resolve9(parsed.prerequisitesPath);
21522
21324
  try {
21523
- prerequisitesSource = await readFile9(absolutePrereq, "utf8");
21325
+ prerequisitesSource = await readFile8(absolutePrereq, "utf8");
21524
21326
  } catch (error) {
21525
21327
  throw new CliUsageError(
21526
21328
  `fixer prerequisites path is unreadable: ${parsed.prerequisitesPath}`,
@@ -21544,7 +21346,7 @@ async function admitPublicRole(role, parsed, env, override) {
21544
21346
  placedFields: async (placed) => {
21545
21347
  let prerequisitesPath;
21546
21348
  if (prerequisitesSource !== void 0) {
21547
- prerequisitesPath = join16(placed.runDirectory, "prerequisites.json");
21349
+ prerequisitesPath = join15(placed.runDirectory, "prerequisites.json");
21548
21350
  await writeFile2(
21549
21351
  prerequisitesPath,
21550
21352
  `${JSON.stringify(prerequisites, null, 2)}
@@ -21552,7 +21354,7 @@ async function admitPublicRole(role, parsed, env, override) {
21552
21354
  "utf8"
21553
21355
  );
21554
21356
  }
21555
- const packetPath = join16(placed.runDirectory, "fix-packet.md");
21357
+ const packetPath = join15(placed.runDirectory, "fix-packet.md");
21556
21358
  await writeFile2(packetPath, instruction, "utf8");
21557
21359
  return {
21558
21360
  phase,
@@ -21577,37 +21379,17 @@ async function admitPublicRole(role, parsed, env, override) {
21577
21379
  } else {
21578
21380
  repository = resolveGitHubRemoteRepository(projectRoot);
21579
21381
  }
21580
- let manifest = emptyCollectorManifest();
21581
- let manifestCanonicalJson;
21582
- if (parsed.requestManifestPath !== void 0) {
21583
- try {
21584
- manifest = await loadCollectorManifest(parsed.requestManifestPath);
21585
- manifestCanonicalJson = manifest.canonicalJson;
21586
- } catch (error) {
21587
- throw new CliUsageError(
21588
- errorText(error),
21589
- { cause: error }
21590
- );
21591
- }
21592
- }
21593
- const manifestDigest = manifest.digest;
21594
21382
  const admittedCollector = await admitStandardMaterialInvocation("collector", {
21595
21383
  ...shared,
21596
21384
  instruction,
21597
21385
  attachmentPaths,
21598
21386
  ...project,
21599
- placedFields: async (placed) => {
21600
- let requestManifestPath;
21601
- if (manifestCanonicalJson !== void 0) {
21602
- requestManifestPath = join16(placed.runDirectory, "request-manifest.json");
21603
- await writeFile2(requestManifestPath, manifestCanonicalJson, "utf8");
21604
- }
21387
+ placedFields: async () => {
21605
21388
  return {
21606
21389
  ...explicitPrNumber === void 0 ? {} : { prNumber: explicitPrNumber },
21607
21390
  repository: repository.canonical,
21608
21391
  repositoryDisplay: repository.display,
21609
- ...requestManifestPath === void 0 ? {} : { requestManifestPath },
21610
- manifestDigest
21392
+ ...parsed.requestManifestPath === void 0 ? {} : { requestManifestPath: parsed.requestManifestPath }
21611
21393
  };
21612
21394
  }
21613
21395
  });
@@ -21620,12 +21402,10 @@ async function admitPublicRole(role, parsed, env, override) {
21620
21402
  );
21621
21403
  }
21622
21404
  const issueNumber = parsed.issueNumber;
21623
- let frozenAttachments = [];
21624
- const admittedDoctor = await admitStandardMaterialInvocation("doctor", {
21405
+ return admitStandardMaterialInvocation("doctor", {
21625
21406
  ...shared,
21626
21407
  instruction,
21627
- attachmentPaths: [],
21628
- freezeAttachments: false,
21408
+ attachmentPaths,
21629
21409
  ...project,
21630
21410
  placedFields: async (placed) => {
21631
21411
  let caseRunsPath;
@@ -21666,16 +21446,13 @@ async function admitPublicRole(role, parsed, env, override) {
21666
21446
  { cause: error }
21667
21447
  );
21668
21448
  }
21669
- frozenAttachments = await freezeAttachments(placed.ledgerHome, attachmentPaths, placed.attachmentsDirectory);
21670
21449
  return {
21671
21450
  issueNumber,
21672
21451
  caseRunsPath,
21673
- caseIdentity,
21674
- attachments: persistedAttachmentRefs(frozenAttachments)
21452
+ caseIdentity
21675
21453
  };
21676
21454
  }
21677
21455
  });
21678
- return { ...admittedDoctor, attachments: frozenAttachments };
21679
21456
  }
21680
21457
  case "source-locator": {
21681
21458
  const projectRoot = resolve9(parsed.project ?? shared.cwd);
@@ -21702,7 +21479,7 @@ async function admitPublicRole(role, parsed, env, override) {
21702
21479
  instruction: "",
21703
21480
  attachmentPaths: [],
21704
21481
  ...project,
21705
- freezeAttachments: false,
21482
+ recordAttachments: false,
21706
21483
  admittedFields: {
21707
21484
  sourceRunPath: sourceRun.runDirectory,
21708
21485
  sourceRun
@@ -21719,7 +21496,7 @@ async function admitPublicRole(role, parsed, env, override) {
21719
21496
  instruction,
21720
21497
  attachmentPaths: [],
21721
21498
  ...project,
21722
- freezeAttachments: false,
21499
+ recordAttachments: false,
21723
21500
  admittedFields: { baseRevision }
21724
21501
  });
21725
21502
  }
@@ -21785,7 +21562,7 @@ async function admitPublicRole(role, parsed, env, override) {
21785
21562
  resolutionScope: [...derived.resolutionScope],
21786
21563
  authorizedChecks: []
21787
21564
  });
21788
- const mergerInputPath = join16(placed.runDirectory, "merger-input.json");
21565
+ const mergerInputPath = join15(placed.runDirectory, "merger-input.json");
21789
21566
  await writeFile2(
21790
21567
  mergerInputPath,
21791
21568
  `${JSON.stringify(mergerInput, null, 2)}
@@ -21831,7 +21608,7 @@ async function placeRoleAdmission(options) {
21831
21608
  home: options.home,
21832
21609
  ...options.materialize === void 0 ? {} : { materialize: options.materialize }
21833
21610
  });
21834
- const attachments = options.freezeAttachments === false ? [] : await freezeAttachments(ledgerHome, options.attachmentPaths, attachmentsDirectory);
21611
+ const attachments = options.recordAttachments === false ? [] : admitCallerAttachments(options.attachmentPaths);
21835
21612
  return {
21836
21613
  runId,
21837
21614
  bookKey,
@@ -21847,13 +21624,7 @@ async function placeRoleAdmission(options) {
21847
21624
  };
21848
21625
  }
21849
21626
  function persistedAttachmentRefs(attachments) {
21850
- return attachments.map((attachment) => ({
21851
- provenancePath: attachment.provenancePath,
21852
- frozenPath: attachment.frozenPath,
21853
- byteLength: attachment.byteLength,
21854
- sha256: attachment.sha256,
21855
- mediaKind: attachment.mediaKind
21856
- }));
21627
+ return attachments.map((attachment) => ({ path: attachment.path }));
21857
21628
  }
21858
21629
  async function persistPlacedAdmission(admitted, placed, model) {
21859
21630
  writeAdmittedRequestPersistence(placed.runDirectory, admitted, {
@@ -21872,14 +21643,14 @@ async function persistPlacedAdmission(admitted, placed, model) {
21872
21643
  }
21873
21644
  async function admitStandardMaterialInvocation(role, options) {
21874
21645
  const defer = options.deferPersistence === true;
21875
- const skipFreeze = defer || options.freezeAttachments === false;
21646
+ const skipAttachments = defer || options.recordAttachments === false;
21876
21647
  const placed = await placeRoleAdmission({
21877
21648
  role,
21878
21649
  home: options.home,
21879
21650
  principalAuthority: options.principalAuthority,
21880
21651
  cwd: options.cwd,
21881
21652
  attachmentPaths: options.attachmentPaths,
21882
- ...skipFreeze ? { freezeAttachments: false } : {},
21653
+ ...skipAttachments ? { recordAttachments: false } : {},
21883
21654
  ...defer ? { materialize: false } : {},
21884
21655
  ...options.project === void 0 ? {} : { project: options.project },
21885
21656
  ...options.createRunId === void 0 ? {} : { createRunId: options.createRunId },
@@ -21887,7 +21658,7 @@ async function admitStandardMaterialInvocation(role, options) {
21887
21658
  });
21888
21659
  const correlationFields = options.correlationId === void 0 ? {} : { correlationId: options.correlationId };
21889
21660
  const instruction = options.instruction;
21890
- const instructionEmpty = instruction.trim() === "";
21661
+ const instructionEmpty = instruction.length === 0;
21891
21662
  const placedExtra = options.placedFields === void 0 ? void 0 : await options.placedFields(placed);
21892
21663
  const admittedFields = {
21893
21664
  ...options.admittedFields ?? {},
@@ -21929,23 +21700,23 @@ function admittedTransportPromptKind(admitted) {
21929
21700
  if (record !== void 0 && "transportPrompt" in record) return record.transportPrompt;
21930
21701
  return "instruction";
21931
21702
  }
21932
- function buildInstructionTransportPrompt(admitted, engineMaterial) {
21703
+ function buildInstructionTransportPrompt(admitted) {
21933
21704
  const kind = admittedTransportPromptKind(admitted);
21934
21705
  if (kind === "fixed-kickoff") {
21935
21706
  if (admitted.sourceRunPath === void 0 || admitted.sourceRunPath.trim() === "") {
21936
21707
  throw new Error("fixed-kickoff transport prompt is missing the source run pointer");
21937
21708
  }
21938
- return appendEngineSessionMaterial([admitted.sourceRunPath], engineMaterial).join("\n");
21709
+ return admitted.sourceRunPath;
21939
21710
  }
21940
21711
  if (kind === "baseline") {
21941
21712
  if (admitted.baseRevision === void 0) {
21942
21713
  throw new Error("baseline transport prompt is missing the bound revision");
21943
21714
  }
21944
21715
  const lines2 = [admitted.baseRevision];
21945
- if (!admitted.instructionEmpty) {
21716
+ if (admitted.instruction.length > 0) {
21946
21717
  lines2.push("", admitted.instruction);
21947
21718
  }
21948
- return appendEngineSessionMaterial(lines2, engineMaterial).join("\n");
21719
+ return lines2.join("\n");
21949
21720
  }
21950
21721
  if (kind === "skill-args") {
21951
21722
  if (admitted.baseRevision === void 0 || admitted.lens === void 0 || admitted.authorityRefs === void 0) {
@@ -21956,20 +21727,24 @@ function buildInstructionTransportPrompt(admitted, engineMaterial) {
21956
21727
  lens: admitted.lens,
21957
21728
  authorityRefs: admitted.authorityRefs
21958
21729
  })];
21959
- if (!admitted.instructionEmpty && admitted.instruction.trim() !== "") {
21730
+ if (admitted.instruction.length > 0) {
21960
21731
  lines2.push("", admitted.instruction);
21961
21732
  }
21962
- return appendEngineSessionMaterial(lines2, engineMaterial).join("\n");
21733
+ return lines2.join("\n");
21963
21734
  }
21964
- const lines = [admitted.instructionEmpty ? "" : admitted.instruction];
21965
- if (admitted.attachments.length > 0) {
21735
+ const lines = [admitted.instruction];
21736
+ const flaggedPaths = [
21737
+ ...admitted.attachments.map((attachment) => `--attach ${attachment.path}`),
21738
+ ...admitted.requestManifestPath === void 0 ? [] : [`--request-manifest ${admitted.requestManifestPath}`]
21739
+ ];
21740
+ if (flaggedPaths.length > 0) {
21966
21741
  lines.push("");
21967
- lines.push("\u5DF2\u53D7\u7406\u9644\u4EF6\uFF08\u51BB\u7ED3\u5FEB\u7167\u8DEF\u5F84\uFF09\uFF1A");
21968
- for (const attachment of admitted.attachments) {
21969
- lines.push(`- ${attachment.frozenPath}`);
21742
+ lines.push("\u5DF2\u53D7\u7406\u9644\u4EF6\uFF1A");
21743
+ for (const entry of flaggedPaths) {
21744
+ lines.push(`- ${entry}`);
21970
21745
  }
21971
21746
  }
21972
- return appendEngineSessionMaterial(lines, engineMaterial).join("\n");
21747
+ return lines.join("\n");
21973
21748
  }
21974
21749
  async function materializeCountersignInvocation(admitted, options) {
21975
21750
  const placed = await placeRoleAdmission({
@@ -21977,8 +21752,7 @@ async function materializeCountersignInvocation(admitted, options) {
21977
21752
  home: options.home,
21978
21753
  principalAuthority: options.principalAuthority,
21979
21754
  cwd: admitted.projectRoot,
21980
- attachmentPaths: [],
21981
- freezeAttachments: false,
21755
+ attachmentPaths: options.attachmentPaths,
21982
21756
  runId: admitted.runId,
21983
21757
  ...options.ticketNumber === void 0 ? {} : { assertedTicketNumber: options.ticketNumber }
21984
21758
  });
@@ -21989,11 +21763,7 @@ async function materializeCountersignInvocation(admitted, options) {
21989
21763
  if (ticketFields.ticketNumber !== void 0) {
21990
21764
  admitted.ticketNumber = ticketFields.ticketNumber;
21991
21765
  }
21992
- const attachments = await freezePreparedAttachmentsIntoRun(
21993
- options.preparedAttachments,
21994
- admitted.runDirectory
21995
- );
21996
- admitted.attachments = attachments;
21766
+ admitted.attachments = placement.attachments;
21997
21767
  writeAdmittedRequestPersistence(admitted.runDirectory, admitted, {
21998
21768
  sessionDirectory: placement.sessionDirectory,
21999
21769
  sessionFile: placement.sessionFile
@@ -22066,7 +21836,7 @@ function parseDoctorIssueNumber(raw) {
22066
21836
  }
22067
21837
  async function resolveDoctorCaseRunsPath(options) {
22068
21838
  const ledgerHome = resolveActivationLedgerHome(options.home);
22069
- const defaultRuns = join16(
21839
+ const defaultRuns = join15(
22070
21840
  activationBookDirectory(ledgerHome, options.bookKey),
22071
21841
  String(options.issueNumber),
22072
21842
  "runs"
@@ -22233,7 +22003,7 @@ function parseAnalystArgv(args) {
22233
22003
  if (taken.def.id === "attach") {
22234
22004
  pushValue(
22235
22005
  "attach",
22236
- requireOptionPath(taken.def.canonical, taken.value)
22006
+ requireProvidedOptionValue(taken.def.canonical, taken.value)
22237
22007
  );
22238
22008
  return;
22239
22009
  }
@@ -22355,7 +22125,6 @@ var init_invocation = __esm({
22355
22125
  init_uuidv7();
22356
22126
  init_notary_contracts();
22357
22127
  init_notary_source_run();
22358
- init_engine_material();
22359
22128
  init_cli_errors();
22360
22129
  init_option_definitions();
22361
22130
  init_unknown_value();
@@ -23524,10 +23293,10 @@ function presentFailureTerminal(terminal, io) {
23524
23293
  }
23525
23294
  function defaultNavigatorGraceSleep() {
23526
23295
  let timer;
23527
- const sleep2 = ((ms) => new Promise((resolve14) => {
23296
+ const sleep2 = ((ms) => new Promise((resolve13) => {
23528
23297
  timer = setTimeout(() => {
23529
23298
  timer = void 0;
23530
- resolve14();
23299
+ resolve13();
23531
23300
  }, ms);
23532
23301
  }));
23533
23302
  sleep2.cancel = () => {
@@ -23539,7 +23308,7 @@ function defaultNavigatorGraceSleep() {
23539
23308
  return sleep2;
23540
23309
  }
23541
23310
  function raceNavigatorGrace(work, graceMs = NAVIGATOR_POST_ROLE_GRACE_MS, sleep2 = defaultNavigatorGraceSleep()) {
23542
- return new Promise((resolve14, reject) => {
23311
+ return new Promise((resolve13, reject) => {
23543
23312
  let settled = false;
23544
23313
  const finish = (action) => {
23545
23314
  if (settled) return;
@@ -23548,11 +23317,11 @@ function raceNavigatorGrace(work, graceMs = NAVIGATOR_POST_ROLE_GRACE_MS, sleep2
23548
23317
  action();
23549
23318
  };
23550
23319
  void work.then(
23551
- (value) => finish(() => resolve14({ status: "done", value })),
23320
+ (value) => finish(() => resolve13({ status: "done", value })),
23552
23321
  (error) => finish(() => reject(error))
23553
23322
  );
23554
23323
  void sleep2(graceMs).then(() => {
23555
- finish(() => resolve14({ status: "timeout" }));
23324
+ finish(() => resolve13({ status: "timeout" }));
23556
23325
  });
23557
23326
  });
23558
23327
  }
@@ -23596,7 +23365,7 @@ var init_settlement = __esm({
23596
23365
  });
23597
23366
 
23598
23367
  // src/session-identity.ts
23599
- import { dirname as dirname11, join as join17 } from "node:path";
23368
+ import { dirname as dirname11, join as join16 } from "node:path";
23600
23369
  function createSessionIdentityAuthority(authority, hostName) {
23601
23370
  const runDirectoryOf = (principal) => dirname11(authority.decode(principal).sessionDirectory);
23602
23371
  return {
@@ -23605,7 +23374,7 @@ function createSessionIdentityAuthority(authority, hostName) {
23605
23374
  },
23606
23375
  async load(principal) {
23607
23376
  const runDirectory = runDirectoryOf(principal);
23608
- const { records, diagnostics } = await readSitianRecords(join17(runDirectory, RUN_STATE_FILE));
23377
+ const { records, diagnostics } = await readSitianRecords(join16(runDirectory, RUN_STATE_FILE));
23609
23378
  if (diagnostics.length > 0) {
23610
23379
  throw new Error(
23611
23380
  `${RUN_STATE_FILE} has ${diagnostics.length} malformed row(s); refusing stale session binding: ${runDirectory}`
@@ -23675,12 +23444,12 @@ __export(role_turn_host_exports, {
23675
23444
  import { execFile as execFile2, spawn } from "node:child_process";
23676
23445
  import { constants as constants2 } from "node:fs";
23677
23446
  import { access as access2, appendFile, realpath as realpath4 } from "node:fs/promises";
23678
- import { delimiter as delimiter2, dirname as dirname12, isAbsolute as isAbsolute6, join as join18, resolve as resolve10 } from "node:path";
23447
+ import { delimiter as delimiter2, dirname as dirname12, isAbsolute as isAbsolute6, join as join17, resolve as resolve10 } from "node:path";
23679
23448
  import { platform } from "node:process";
23680
23449
  import { promisify as promisify2 } from "node:util";
23681
23450
  import { randomUUID as randomUUID4 } from "node:crypto";
23682
23451
  function resolveInternalRoleEntrypoint(packageRoot2) {
23683
- return join18(packageRoot2, INTERNAL_ROLE_ENTRYPOINT_RELATIVE2);
23452
+ return join17(packageRoot2, INTERNAL_ROLE_ENTRYPOINT_RELATIVE2);
23684
23453
  }
23685
23454
  function buildExplicitInternalActivationArgs(selectedRoleEntry, extraArgs = []) {
23686
23455
  return ["--no-extensions", "-e", selectedRoleEntry, ...extraArgs];
@@ -24042,17 +23811,17 @@ var init_role_turn_host = __esm({
24042
23811
  });
24043
23812
 
24044
23813
  // src/public-cli/load-production-acp-host.ts
24045
- import { existsSync as existsSync6 } from "node:fs";
24046
- import { join as join19 } from "node:path";
23814
+ import { existsSync as existsSync5 } from "node:fs";
23815
+ import { join as join18 } from "node:path";
24047
23816
  import { pathToFileURL } from "node:url";
24048
23817
  async function loadProductionAcpHostFactory(packageRoot2, host) {
24049
23818
  const description = lookupHostDescription(host);
24050
23819
  if (description === void 0) {
24051
23820
  throw new Error(`unregistered host: ${host}`);
24052
23821
  }
24053
- const built = join19(packageRoot2, "dist/acp-host/production-host.js");
24054
- const source = join19(packageRoot2, "src/acp-host/production-host.ts");
24055
- const target = existsSync6(built) ? built : source;
23822
+ const built = join18(packageRoot2, "dist/acp-host/production-host.js");
23823
+ const source = join18(packageRoot2, "src/acp-host/production-host.ts");
23824
+ const target = existsSync5(built) ? built : source;
24056
23825
  const href = pathToFileURL(target).href;
24057
23826
  const mod = await import(href);
24058
23827
  const create = mod.createProductionAcpRoleTurnHost;
@@ -24066,17 +23835,17 @@ var init_load_production_acp_host = __esm({
24066
23835
  });
24067
23836
 
24068
23837
  // src/public-cli/load-production-headless-host.ts
24069
- import { existsSync as existsSync7 } from "node:fs";
24070
- import { join as join20 } from "node:path";
23838
+ import { existsSync as existsSync6 } from "node:fs";
23839
+ import { join as join19 } from "node:path";
24071
23840
  import { pathToFileURL as pathToFileURL2 } from "node:url";
24072
23841
  async function loadProductionHeadlessHostFactory(packageRoot2, host) {
24073
23842
  const description = lookupHeadlessHostDescription(host);
24074
23843
  if (description === void 0) {
24075
23844
  throw new Error(`unregistered headless host: ${host}`);
24076
23845
  }
24077
- const built = join20(packageRoot2, "dist/headless-host/production-host.js");
24078
- const source = join20(packageRoot2, "src/headless-host/production-host.ts");
24079
- const target = existsSync7(built) ? built : source;
23846
+ const built = join19(packageRoot2, "dist/headless-host/production-host.js");
23847
+ const source = join19(packageRoot2, "src/headless-host/production-host.ts");
23848
+ const target = existsSync6(built) ? built : source;
24080
23849
  const href = pathToFileURL2(target).href;
24081
23850
  const mod = await import(href);
24082
23851
  const create = mod.createProductionHeadlessRoleTurnHost;
@@ -24243,7 +24012,7 @@ var init_role_seat_runtime = __esm({
24243
24012
  });
24244
24013
 
24245
24014
  // src/archivist-record-pointer.ts
24246
- import { basename as basename9, join as join21 } from "node:path";
24015
+ import { basename as basename8, join as join20 } from "node:path";
24247
24016
  function bookDirectOfficerRunPointer(options) {
24248
24017
  const submissionToolCallId = options.submissionToolCallId?.trim() ?? "";
24249
24018
  const pointer = {
@@ -24269,7 +24038,7 @@ async function resolveOfficerPointer(raw, parentRunDirectory) {
24269
24038
  let runDirectory = typeof raw.runDirectory === "string" && raw.runDirectory.trim() !== "" ? raw.runDirectory : void 0;
24270
24039
  let sessionFile = raw.sessionFile;
24271
24040
  const recordedRunDirectory = runDirectory ?? runDirectoryOfSessionFile(sessionFile);
24272
- const leaf = parseRunLeaf(basename9(recordedRunDirectory));
24041
+ const leaf = parseRunLeaf(basename8(recordedRunDirectory));
24273
24042
  const parentIdentity = await readRoleRunIdentity(parentRunDirectory);
24274
24043
  if (leaf !== void 0 && parentIdentity !== void 0) {
24275
24044
  const currentRunDirectory = await findRunDirectoryById(
@@ -24292,7 +24061,7 @@ async function resolveOfficerPointer(raw, parentRunDirectory) {
24292
24061
  };
24293
24062
  }
24294
24063
  async function readBookedOfficerPointers(parentRunDirectory) {
24295
- const { records, diagnostics } = await readSitianRecords(join21(parentRunDirectory, RUN_HISTORY_FILE));
24064
+ const { records, diagnostics } = await readSitianRecords(join20(parentRunDirectory, RUN_HISTORY_FILE));
24296
24065
  if (diagnostics.length > 0) {
24297
24066
  throw new Error(
24298
24067
  `${RUN_HISTORY_FILE} has ${diagnostics.length} malformed row(s); officer pointers unreadable: ${parentRunDirectory}`
@@ -24584,14 +24353,14 @@ var init_submission_gate = __esm({
24584
24353
  });
24585
24354
 
24586
24355
  // src/session-opening-materials.ts
24587
- import { existsSync as existsSync8 } from "node:fs";
24588
- import { readFile as readFile10 } from "node:fs/promises";
24589
- import { dirname as dirname13, join as join22 } from "node:path";
24356
+ import { existsSync as existsSync7 } from "node:fs";
24357
+ import { readFile as readFile9 } from "node:fs/promises";
24358
+ import { dirname as dirname13, join as join21 } from "node:path";
24590
24359
  import { fileURLToPath, pathToFileURL as pathToFileURL3 } from "node:url";
24591
24360
  function resolvePackageRootDir(moduleUrl = import.meta.url) {
24592
24361
  let dir = dirname13(fileURLToPath(moduleUrl));
24593
24362
  for (let i = 0; i < 8; i += 1) {
24594
- if (existsSync8(join22(dir, "package.json")) && existsSync8(join22(dir, "souls"))) {
24363
+ if (existsSync7(join21(dir, "package.json")) && existsSync7(join21(dir, "souls"))) {
24595
24364
  return dir;
24596
24365
  }
24597
24366
  const parent = dirname13(dir);
@@ -24601,7 +24370,7 @@ function resolvePackageRootDir(moduleUrl = import.meta.url) {
24601
24370
  return fileURLToPath(new URL("..", moduleUrl));
24602
24371
  }
24603
24372
  async function readPackageMaterial(relativePath) {
24604
- return readFile10(fileURLToPath(new URL(relativePath, packageRootUrl)), "utf8");
24373
+ return readFile9(fileURLToPath(new URL(relativePath, packageRootUrl)), "utf8");
24605
24374
  }
24606
24375
  async function joinPackageMaterials(relativePaths) {
24607
24376
  const chunks = [];
@@ -24643,7 +24412,7 @@ __export(auditor_soul_exports, {
24643
24412
  readAuditorResumeBinding: () => readAuditorResumeBinding,
24644
24413
  resolveAuditorSubject: () => resolveAuditorSubject
24645
24414
  });
24646
- import { basename as basename10 } from "node:path";
24415
+ import { basename as basename9 } from "node:path";
24647
24416
  function auditorSoulRelativePath(role) {
24648
24417
  return `souls/${role}-auditor.md`;
24649
24418
  }
@@ -24679,7 +24448,7 @@ function loadAuditorReferenceMaterialsFromSubjectInput(raw) {
24679
24448
  return loadAuditorReferenceMaterials(resolveAuditorSubject(raw));
24680
24449
  }
24681
24450
  function subjectFromSourceDirectory(sourceRunDirectory) {
24682
- const role = parseRunLeaf(basename10(sourceRunDirectory))?.role;
24451
+ const role = parseRunLeaf(basename9(sourceRunDirectory))?.role;
24683
24452
  return isAuditorSoulRole(role) ? role : void 0;
24684
24453
  }
24685
24454
  async function readAuditorResumeBinding(runDirectory) {
@@ -25313,13 +25082,7 @@ function initialPrompt(admitted, env) {
25313
25082
  if (reask !== void 0 && "reaskPrompt" in record && record.reaskPrompt === true) {
25314
25083
  return reask;
25315
25084
  }
25316
- return buildInstructionTransportPrompt(
25317
- admitted,
25318
- engineSessionMaterialFromOptions({
25319
- ...pickEngineAxis(env),
25320
- packageRoot: env.packageRoot
25321
- })
25322
- );
25085
+ return buildInstructionTransportPrompt(admitted);
25323
25086
  }
25324
25087
  function isBoardTicketSeat(seat) {
25325
25088
  return packagedBindsBoardTicket(seat.role);
@@ -25413,10 +25176,7 @@ async function dispatchAdmitted(admitted, env, io) {
25413
25176
  admitted,
25414
25177
  roleTurnOptions(activeEnv, admitted, {
25415
25178
  kind: "resume",
25416
- prompt: buildAutoResumeContinuationPrompt({
25417
- packageRoot: activeEnv.packageRoot,
25418
- ...pickEngineAxis(activeEnv)
25419
- })
25179
+ prompt: buildAutoResumeContinuationPrompt()
25420
25180
  })
25421
25181
  ),
25422
25182
  adapters,
@@ -25548,7 +25308,7 @@ async function runCountersignBody(parsed, env, io) {
25548
25308
  summons: {
25549
25309
  sourceRunPath: gateParentRunPath,
25550
25310
  instruction: resumeInstruction,
25551
- instructionEmpty: resumeInstruction.trim() === ""
25311
+ instructionEmpty: resumeInstruction.length === 0
25552
25312
  }
25553
25313
  });
25554
25314
  if (resumed != null) return resumed;
@@ -25562,12 +25322,12 @@ async function runCountersignBody(parsed, env, io) {
25562
25322
  throw error;
25563
25323
  }
25564
25324
  try {
25565
- return await withPreparedAttachments(parsed.attachmentPaths ?? [], async (preparedAttachments) => {
25325
+ {
25566
25326
  const materializeAdmission = async (ticketNumber) => {
25567
25327
  await materializeCountersignInvocation(admitted, {
25568
25328
  home: env.home,
25569
25329
  principalAuthority: env.principalAuthority,
25570
- preparedAttachments,
25330
+ attachmentPaths: parsed.attachmentPaths ?? [],
25571
25331
  ...env.model === void 0 ? {} : { model: env.model },
25572
25332
  ...ticketNumber === void 0 ? {} : { ticketNumber }
25573
25333
  });
@@ -25582,13 +25342,7 @@ async function runCountersignBody(parsed, env, io) {
25582
25342
  }
25583
25343
  const turnProjection = roleTurnOptions(env, admitted, {
25584
25344
  kind: "initial",
25585
- prompt: env.reviewReask ?? env.gateReviewInstruction ?? buildInstructionTransportPrompt(
25586
- admitted,
25587
- engineSessionMaterialFromOptions({
25588
- ...pickEngineAxis(env),
25589
- packageRoot: env.packageRoot
25590
- })
25591
- )
25345
+ prompt: env.reviewReask ?? env.gateReviewInstruction ?? buildInstructionTransportPrompt(admitted)
25592
25346
  });
25593
25347
  const turnRequest = buildInstructionSeatTurnRequest(admitted, turnProjection);
25594
25348
  const result = await runPostAdmissionOneShot({
@@ -25608,7 +25362,7 @@ async function runCountersignBody(parsed, env, io) {
25608
25362
  });
25609
25363
  await relocateAdmittedRunToTicket(admitted, env.principalAuthority);
25610
25364
  return result;
25611
- });
25365
+ }
25612
25366
  } catch (error) {
25613
25367
  const rejected = usageExit(error, io);
25614
25368
  if (rejected !== void 0) return rejected;
@@ -25673,7 +25427,7 @@ async function runPublicInstructionSeat(argv2, env, io, role, parseArgv2) {
25673
25427
  const summons = {
25674
25428
  ...sameParentInstruction(env, {
25675
25429
  instruction: parsed.instruction ?? "",
25676
- instructionEmpty: (parsed.instruction ?? "").trim() === ""
25430
+ instructionEmpty: (parsed.instruction ?? "").length === 0
25677
25431
  }),
25678
25432
  attachmentPaths: parsed.attachmentPaths ?? []
25679
25433
  };
@@ -25698,7 +25452,7 @@ async function runPublicInstructionSeat(argv2, env, io, role, parseArgv2) {
25698
25452
  sourceRunPath: parentRunPath,
25699
25453
  ...sameParentInstruction(env, {
25700
25454
  instruction: parsed.instruction ?? "",
25701
- instructionEmpty: (parsed.instruction ?? "").trim() === ""
25455
+ instructionEmpty: (parsed.instruction ?? "").length === 0
25702
25456
  }),
25703
25457
  attachmentPaths: parsed.attachmentPaths ?? []
25704
25458
  };
@@ -25782,7 +25536,7 @@ async function runPublicInstructionSeat(argv2, env, io, role, parseArgv2) {
25782
25536
  instruction: parsed.instruction ?? "",
25783
25537
  projectRoot: admitted.projectRoot,
25784
25538
  failureLabel: "secretariat unbound summons",
25785
- attachmentPaths: admitted.attachments.map((attachment) => attachment.frozenPath),
25539
+ attachmentPaths: admitted.attachments.map((attachment) => attachment.path),
25786
25540
  correlationId: admitted.runId
25787
25541
  }, env, io);
25788
25542
  } catch (error) {
@@ -26285,7 +26039,6 @@ var init_instruction_seat_run = __esm({
26285
26039
  init_submission_gate();
26286
26040
  init_run_ticket_number();
26287
26041
  init_notary_source_run();
26288
- init_engine_material();
26289
26042
  init_packaged_role_registry();
26290
26043
  init_auditor_soul();
26291
26044
  init_cli_errors();
@@ -26350,9 +26103,9 @@ __export(public_role_summons_exports, {
26350
26103
  summonPublicRole: () => summonPublicRole
26351
26104
  });
26352
26105
  import { execFile as execFile3 } from "node:child_process";
26353
- import { existsSync as existsSync9 } from "node:fs";
26106
+ import { existsSync as existsSync8 } from "node:fs";
26354
26107
  import { realpath as realpath5 } from "node:fs/promises";
26355
- import { join as join24 } from "node:path";
26108
+ import { join as join23 } from "node:path";
26356
26109
  import { promisify as promisify3 } from "node:util";
26357
26110
  function createCapturingIo() {
26358
26111
  const chunks = [];
@@ -26376,7 +26129,7 @@ function parentDir(path) {
26376
26129
  function walkPackageRoot(start) {
26377
26130
  let dir = start;
26378
26131
  for (let i = 0; i < 12; i += 1) {
26379
- if (existsSync9(join24(dir, "package.json")) && existsSync9(join24(dir, "souls"))) {
26132
+ if (existsSync8(join23(dir, "package.json")) && existsSync8(join23(dir, "souls"))) {
26380
26133
  return dir;
26381
26134
  }
26382
26135
  const parent = parentDir(dir);
@@ -26596,7 +26349,7 @@ async function summonPublicRole(options) {
26596
26349
  runId: resumeRunId,
26597
26350
  summons: {
26598
26351
  instruction,
26599
- instructionEmpty: instruction.trim() === ""
26352
+ instructionEmpty: instruction.length === 0
26600
26353
  }
26601
26354
  },
26602
26355
  env,
@@ -26979,7 +26732,7 @@ var init_compliance_transport = __esm({
26979
26732
  });
26980
26733
 
26981
26734
  // src/role-run-relocation.ts
26982
- import { dirname as dirname15, join as join25, sep as sep4 } from "node:path";
26735
+ import { dirname as dirname15, join as join24, sep as sep4 } from "node:path";
26983
26736
  function rewriteRunDirectoryPathValue(value, oldRunDirectory, newRunDirectory) {
26984
26737
  if (typeof value !== "string") return value;
26985
26738
  if (value === oldRunDirectory) return newRunDirectory;
@@ -27059,13 +26812,6 @@ function rewriteSourceRunLocator(value, rewrites) {
27059
26812
  function rewriteAdmittedRoleRunPage(page, rewrites) {
27060
26813
  rewriteRunDirectoryPathFieldsAgainstRewrites(page, ADMITTED_PAGE_FIELDS, rewrites);
27061
26814
  rewriteSourceRunLocator(page.sourceRun, rewrites);
27062
- if (Array.isArray(page.attachments)) {
27063
- for (const attachment of page.attachments) {
27064
- if (isRecord(attachment)) {
27065
- rewriteRunDirectoryPathFieldsAgainstRewrites(attachment, ["frozenPath"], rewrites);
27066
- }
27067
- }
27068
- }
27069
26815
  if (isRecord(page.principal)) {
27070
26816
  rewriteRunDirectoryPathFieldsAgainstRewrites(
27071
26817
  page.principal,
@@ -27093,7 +26839,7 @@ var init_role_run_relocation = __esm({
27093
26839
  "taskPath",
27094
26840
  "packetPath",
27095
26841
  "prerequisitesPath",
27096
- "requestManifestPath",
26842
+ // #1165: requestManifestPath is a caller path — never rewrite.
27097
26843
  "mergerInputPath",
27098
26844
  "sourceRunPath"
27099
26845
  ];
@@ -27128,16 +26874,10 @@ __export(run_lifecycle_exports, {
27128
26874
  recordCurrentCourt: () => recordCurrentCourt,
27129
26875
  writeRoleRunState: () => writeRoleRunState
27130
26876
  });
27131
- import { chmod, lstat as lstat4, open, readdir as readdir3, readFile as readFile11, unlink } from "node:fs/promises";
27132
- import { basename as basename11, join as join26 } from "node:path";
27133
- function buildAutoResumeContinuationPrompt(options) {
27134
- return appendEngineSessionMaterial(
27135
- [RESUME_TRANSPORT_ENVELOPE],
27136
- engineSessionMaterialFromOptions({
27137
- packageRoot: options.packageRoot,
27138
- ...pickEngineAxis(options)
27139
- })
27140
- ).join("\n");
26877
+ import { chmod, lstat as lstat3, open, readdir as readdir3, readFile as readFile10, unlink } from "node:fs/promises";
26878
+ import { basename as basename10, join as join25 } from "node:path";
26879
+ function buildAutoResumeContinuationPrompt() {
26880
+ return RESUME_TRANSPORT_ENVELOPE;
27141
26881
  }
27142
26882
  async function writeRoleRunState(runDirectory, record) {
27143
26883
  const payload = { ...record, runDirectory };
@@ -27148,7 +26888,7 @@ function parseSameTicketSummonsMaterials(raw) {
27148
26888
  const record = raw;
27149
26889
  const instruction = typeof record.instruction === "string" ? record.instruction : void 0;
27150
26890
  const instructionEmpty = typeof record.instructionEmpty === "boolean" ? record.instructionEmpty : void 0;
27151
- const attachmentPaths = Array.isArray(record.attachmentPaths) ? record.attachmentPaths.filter((p) => typeof p === "string" && p.length > 0) : void 0;
26891
+ const attachmentPaths = Array.isArray(record.attachmentPaths) ? record.attachmentPaths.filter((p) => typeof p === "string") : void 0;
27152
26892
  const sourceRunPath = typeof record.sourceRunPath === "string" && record.sourceRunPath.trim() !== "" ? record.sourceRunPath : void 0;
27153
26893
  let sourceRun;
27154
26894
  if (isRecord(record.sourceRun)) {
@@ -27373,7 +27113,7 @@ function isProcessAlive(pid) {
27373
27113
  async function autopsyWriterLock(lockPath) {
27374
27114
  let content;
27375
27115
  try {
27376
- content = await readFile11(lockPath, "utf8");
27116
+ content = await readFile10(lockPath, "utf8");
27377
27117
  } catch (error) {
27378
27118
  if (errorCodeOf(error) === "ENOENT") return { verdict: "absent" };
27379
27119
  return { verdict: "unknown", reason: "unreadable", readFailure: error };
@@ -27432,7 +27172,7 @@ async function createWriterLease(lockPath, runDirectory, reportCleanupFailure) {
27432
27172
  },
27433
27173
  relocate(nextRunDirectory) {
27434
27174
  currentRunDirectory = nextRunDirectory;
27435
- currentLockPath = join26(nextRunDirectory, WRITER_LOCK_FILE);
27175
+ currentLockPath = join25(nextRunDirectory, WRITER_LOCK_FILE);
27436
27176
  },
27437
27177
  async release() {
27438
27178
  if (released) return;
@@ -27471,10 +27211,10 @@ async function acquireRunWriterLease(runDirectory, onCleanupFailure) {
27471
27211
  };
27472
27212
  const reportReadFailure = (error) => {
27473
27213
  reportDiagnostic(
27474
- `writer lease lock read failed (holder liveness unverifiable; lock left in place) at ${join26(runDirectory, WRITER_LOCK_FILE)}: ${describeErrorIdentity(error)}`
27214
+ `writer lease lock read failed (holder liveness unverifiable; lock left in place) at ${join25(runDirectory, WRITER_LOCK_FILE)}: ${describeErrorIdentity(error)}`
27475
27215
  );
27476
27216
  };
27477
- const lockPath = join26(runDirectory, WRITER_LOCK_FILE);
27217
+ const lockPath = join25(runDirectory, WRITER_LOCK_FILE);
27478
27218
  let lastAutopsy = { verdict: "absent" };
27479
27219
  let lastReclaimFailure;
27480
27220
  for (let reclaimsLeft = WRITER_LEASE_RECLAIM_ROUNDS; ; reclaimsLeft -= 1) {
@@ -27531,7 +27271,7 @@ async function acquireRunWriterLease(runDirectory, onCleanupFailure) {
27531
27271
  async function findRunDirectoryById(home, runId, onlyBookKey, onlyRole) {
27532
27272
  if (runId.trim() === "") return void 0;
27533
27273
  const ledgerHome = resolveActivationLedgerHome(home);
27534
- const booksRoot = join26(ledgerHome, "books");
27274
+ const booksRoot = join25(ledgerHome, "books");
27535
27275
  let bookKeys;
27536
27276
  try {
27537
27277
  bookKeys = await readdir3(booksRoot);
@@ -27566,7 +27306,7 @@ async function runHasFormedSessionPrincipal(runDirectory) {
27566
27306
  if (disk === void 0) return false;
27567
27307
  const sessionFile = typeof disk.principalWire.sessionFile === "string" && disk.principalWire.sessionFile.trim() !== "" ? disk.principalWire.sessionFile : sessionFileIn(disk.principalWire.sessionDirectory);
27568
27308
  try {
27569
- const stat2 = await lstat4(sessionFile);
27309
+ const stat2 = await lstat3(sessionFile);
27570
27310
  return stat2.isFile() && !stat2.isSymbolicLink();
27571
27311
  } catch (error) {
27572
27312
  if (errorCodeOf(error) === "ENOENT") return false;
@@ -27582,7 +27322,7 @@ async function findLatestRunIdForSeatTicket(input) {
27582
27322
  let runDirectories;
27583
27323
  try {
27584
27324
  runDirectories = await listBookRunDirectories(
27585
- input.ticketNumber === void 0 ? bookDir : join26(bookDir, String(input.ticketNumber))
27325
+ input.ticketNumber === void 0 ? bookDir : join25(bookDir, String(input.ticketNumber))
27586
27326
  );
27587
27327
  } catch (error) {
27588
27328
  if (errorCodeOf(error) === "ENOENT") return void 0;
@@ -27590,7 +27330,7 @@ async function findLatestRunIdForSeatTicket(input) {
27590
27330
  }
27591
27331
  let best;
27592
27332
  for (const runDirectory of runDirectories) {
27593
- const parsed = parseRunLeaf(basename11(runDirectory));
27333
+ const parsed = parseRunLeaf(basename10(runDirectory));
27594
27334
  if (parsed === void 0 || parsed.role !== input.role) continue;
27595
27335
  const runId = parsed.runId;
27596
27336
  const parentPath = await readRunParentPath(runDirectory);
@@ -27647,7 +27387,6 @@ async function loadResumableRunRecord(home, runId, authority) {
27647
27387
  let repository;
27648
27388
  let repositoryDisplay;
27649
27389
  let requestManifestPath;
27650
- let manifestDigest;
27651
27390
  let waitWindowMs;
27652
27391
  let issueNumber;
27653
27392
  let caseRunsPath;
@@ -27670,7 +27409,7 @@ async function loadResumableRunRecord(home, runId, authority) {
27670
27409
  instructionEmpty = record.instructionEmpty;
27671
27410
  }
27672
27411
  if (Array.isArray(record.attachments)) {
27673
- attachments = record.attachments;
27412
+ attachments = record.attachments.map((item) => normalizeAdmittedAttachment(item)).filter((item) => item !== void 0);
27674
27413
  }
27675
27414
  if (record.phase === "plan" || record.phase === "apply") {
27676
27415
  phase = record.phase;
@@ -27702,12 +27441,9 @@ async function loadResumableRunRecord(home, runId, authority) {
27702
27441
  if (typeof record.repositoryDisplay === "string" && record.repositoryDisplay.trim() !== "") {
27703
27442
  repositoryDisplay = record.repositoryDisplay;
27704
27443
  }
27705
- if (typeof record.requestManifestPath === "string" && record.requestManifestPath.trim() !== "") {
27444
+ if (typeof record.requestManifestPath === "string") {
27706
27445
  requestManifestPath = record.requestManifestPath;
27707
27446
  }
27708
- if (typeof record.manifestDigest === "string" && record.manifestDigest.trim() !== "") {
27709
- manifestDigest = record.manifestDigest;
27710
- }
27711
27447
  if (typeof record.waitWindowMs === "number" && Number.isSafeInteger(record.waitWindowMs) && record.waitWindowMs >= 1) {
27712
27448
  waitWindowMs = record.waitWindowMs;
27713
27449
  }
@@ -27801,7 +27537,7 @@ async function loadResumableRunRecord(home, runId, authority) {
27801
27537
  );
27802
27538
  }
27803
27539
  }
27804
- const sourceRunLeaf = parseRunLeaf(basename11(sourceRunPath ?? ""));
27540
+ const sourceRunLeaf = parseRunLeaf(basename10(sourceRunPath ?? ""));
27805
27541
  const referencedRunId = sourceRun?.runId ?? sourceRunLeaf?.runId;
27806
27542
  const referencedRole = sourceRun?.role ?? sourceRunLeaf?.role;
27807
27543
  if (referencedRunId !== void 0 && referencedRunId !== "") {
@@ -27841,7 +27577,6 @@ async function loadResumableRunRecord(home, runId, authority) {
27841
27577
  ...repository === void 0 ? {} : { repository },
27842
27578
  ...repositoryDisplay === void 0 ? {} : { repositoryDisplay },
27843
27579
  ...requestManifestPath === void 0 ? {} : { requestManifestPath },
27844
- ...manifestDigest === void 0 ? {} : { manifestDigest },
27845
27580
  ...waitWindowMs === void 0 ? {} : { waitWindowMs },
27846
27581
  ...issueNumber === void 0 ? {} : { issueNumber },
27847
27582
  ...caseRunsPath === void 0 ? {} : { caseRunsPath },
@@ -28031,8 +27766,8 @@ function admitResumedRole(loaded) {
28031
27766
  return admitted;
28032
27767
  }
28033
27768
  case "collect-target": {
28034
- const { prNumber, repository, repositoryDisplay, manifestDigest } = fields;
28035
- if (repository === void 0 || repositoryDisplay === void 0 || manifestDigest === void 0) {
27769
+ const { prNumber, repository, repositoryDisplay } = fields;
27770
+ if (repository === void 0 || repositoryDisplay === void 0) {
28036
27771
  throw new CliUsageError(
28037
27772
  `role run admitted collector repository identity is missing: ${runId}`
28038
27773
  );
@@ -28055,8 +27790,7 @@ function admitResumedRole(loaded) {
28055
27790
  ...prNumber === void 0 ? {} : { prNumber },
28056
27791
  repository: parsedRepository,
28057
27792
  ...fields.requestManifestPath === void 0 ? {} : { requestManifestPath: fields.requestManifestPath },
28058
- ...fields.waitWindowMs === void 0 ? {} : { waitWindowMs: fields.waitWindowMs },
28059
- manifestDigest
27793
+ ...fields.waitWindowMs === void 0 ? {} : { waitWindowMs: fields.waitWindowMs }
28060
27794
  };
28061
27795
  return admitted;
28062
27796
  }
@@ -28111,7 +27845,6 @@ var init_run_lifecycle = __esm({
28111
27845
  init_cli_errors();
28112
27846
  init_collector_config();
28113
27847
  init_role_run_relocation();
28114
- init_engine_material();
28115
27848
  init_packaged_role_registry();
28116
27849
  init_invocation();
28117
27850
  init_run_dossier();
@@ -28141,7 +27874,6 @@ var init_run_lifecycle = __esm({
28141
27874
 
28142
27875
  // src/public-cli/post-admission.ts
28143
27876
  import { randomUUID as randomUUID5 } from "node:crypto";
28144
- import { isAbsolute as isAbsolute8, join as join27, resolve as resolve12 } from "node:path";
28145
27877
  function describeCaughtError(error) {
28146
27878
  if (error instanceof Error) {
28147
27879
  const code = error.code;
@@ -28163,7 +27895,7 @@ function projectRelocatedTurnIdentity(request, result, admitted, relocation) {
28163
27895
  mutableRequest.principal = admitted.principal;
28164
27896
  const activation = mutableRequest.activation;
28165
27897
  if (isRecord(activation)) {
28166
- for (const field of ["taskPath", "packetPath", "prerequisitesPath", "inputPath", "requestManifestPath"]) {
27898
+ for (const field of ["taskPath", "packetPath", "prerequisitesPath", "inputPath"]) {
28167
27899
  const record = activation;
28168
27900
  if (field in record) record[field] = rewrite(record[field]);
28169
27901
  }
@@ -28896,7 +28628,7 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
28896
28628
  prompt = request.message;
28897
28629
  }
28898
28630
  } else if (summonsPrepared !== void 0) {
28899
- prompt = officerDialogue ? summonsPrepared.instructionEmpty ? "" : summonsPrepared.instruction : buildInstructionTransportPrompt(summonsPrepared);
28631
+ prompt = officerDialogue ? summonsPrepared.instruction : buildInstructionTransportPrompt(summonsPrepared);
28900
28632
  } else if (request.summons !== void 0) {
28901
28633
  prompt = "";
28902
28634
  } else {
@@ -28977,24 +28709,14 @@ async function runSettledAutoResumeLoop(input) {
28977
28709
  })
28978
28710
  });
28979
28711
  }
28980
- function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
28981
- const absolute = isAbsolute8(attachmentPath) ? attachmentPath : resolve12(attachmentPath);
28982
- return pathContainedIn(join27(runDirectory, "attachments"), absolute);
28983
- }
28984
- async function prepareSummonsResumeMaterials(runDirectory, summons) {
28712
+ async function prepareSummonsResumeMaterials(_runDirectory, summons) {
28985
28713
  if (summons === void 0) return void 0;
28986
28714
  if (summons.instruction === void 0 && (summons.attachmentPaths?.length ?? 0) === 0) {
28987
28715
  return void 0;
28988
28716
  }
28989
28717
  const instruction = summons.instruction ?? "";
28990
- const instructionEmpty = summons.instructionEmpty ?? instruction.trim() === "";
28991
- let attachments = [];
28992
- if (summons.attachmentPaths !== void 0 && summons.attachmentPaths.length > 0) {
28993
- const alreadyFrozen = summons.attachmentPaths.every(
28994
- (path) => isAlreadyFrozenSummonsAttachment(runDirectory, path)
28995
- );
28996
- attachments = alreadyFrozen ? summons.attachmentPaths.map((frozenPath) => ({ frozenPath })) : await freezeAttachmentsIntoRun(summons.attachmentPaths, runDirectory);
28997
- }
28718
+ const instructionEmpty = summons.instructionEmpty ?? instruction.length === 0;
28719
+ const attachments = (summons.attachmentPaths ?? []).map((path) => ({ path }));
28998
28720
  return { instruction, instructionEmpty, attachments };
28999
28721
  }
29000
28722
  async function runPostAdmissionSeatResume(input) {
@@ -29043,23 +28765,6 @@ async function runPostAdmissionSeatResume(input) {
29043
28765
  openCourtAttemptId = openCourt.courtAttemptId;
29044
28766
  }
29045
28767
  }
29046
- if (request.summons !== void 0) {
29047
- const prepared = await prepareSummonsResumeMaterials(
29048
- admittedForBuild.runDirectory,
29049
- request.summons
29050
- );
29051
- if (prepared !== void 0 && (request.summons.attachmentPaths?.length ?? 0) > 0) {
29052
- request = {
29053
- ...request,
29054
- summons: {
29055
- ...request.summons,
29056
- attachmentPaths: prepared.attachments.map(
29057
- (attachment) => attachment.frozenPath
29058
- )
29059
- }
29060
- };
29061
- }
29062
- }
29063
28768
  let turnRequest = await input.buildTurnRequest(admittedForBuild, request);
29064
28769
  if (turnRequest.continuation.kind === "resume" && turnRequest.continuation.hostSessionId === void 0) {
29065
28770
  const hostSessionId = await readStoredHostSessionId(
@@ -29226,13 +28931,7 @@ async function runPostAdmissionOneShot(input) {
29226
28931
  ...input.request,
29227
28932
  continuation: {
29228
28933
  kind: "resume",
29229
- prompt: buildAutoResumeContinuationPrompt({
29230
- packageRoot: input.env.packageRoot,
29231
- ...pickEngineAxis({
29232
- engine: input.effectiveEngine ?? input.env.engine,
29233
- engineModel: input.env.engineModel
29234
- })
29235
- })
28934
+ prompt: buildAutoResumeContinuationPrompt()
29236
28935
  }
29237
28936
  }),
29238
28937
  adapters: input.adapters,
@@ -29315,8 +29014,6 @@ var init_post_admission = __esm({
29315
29014
  init_invocation();
29316
29015
  init_submission_ledger();
29317
29016
  init_run_ticket_number();
29318
- init_activation_ledger_topology();
29319
- init_engine_material();
29320
29017
  init_session_identity();
29321
29018
  init_sitian_facade();
29322
29019
  init_receipt_delivery_policy();
@@ -29336,7 +29033,7 @@ var init_post_admission = __esm({
29336
29033
 
29337
29034
  // src/analyst-book-key.ts
29338
29035
  import { statSync as statSync6 } from "node:fs";
29339
- import { isAbsolute as isAbsolute9 } from "node:path";
29036
+ import { isAbsolute as isAbsolute8 } from "node:path";
29340
29037
  function resolveAnalystBookKey(projectRoot) {
29341
29038
  const identity = physicalPathIdentity(projectRoot);
29342
29039
  let stats;
@@ -29358,7 +29055,7 @@ function resolveAnalystBookKey(projectRoot) {
29358
29055
  }
29359
29056
  }
29360
29057
  function isSyntheticAnalystBookKey(bookKey) {
29361
- return bookKey.startsWith("root:") && isAbsolute9(bookKey.slice("root:".length));
29058
+ return bookKey.startsWith("root:") && isAbsolute8(bookKey.slice("root:".length));
29362
29059
  }
29363
29060
  var init_analyst_book_key = __esm({
29364
29061
  "src/analyst-book-key.ts"() {
@@ -29370,16 +29067,16 @@ var init_analyst_book_key = __esm({
29370
29067
 
29371
29068
  // src/atomic-write.ts
29372
29069
  import { randomUUID as randomUUID6 } from "node:crypto";
29373
- import { rename as rename2, rm as rm2, writeFile as writeFile4 } from "node:fs/promises";
29374
- import { dirname as dirname16, join as join28 } from "node:path";
29070
+ import { rename as rename2, rm, writeFile as writeFile4 } from "node:fs/promises";
29071
+ import { dirname as dirname16, join as join26 } from "node:path";
29375
29072
  async function writeFileAtomically(destination, contents, options) {
29376
29073
  const parent = dirname16(destination);
29377
- const temporary = join28(parent, `.atomic-write-${randomUUID6()}.tmp`);
29074
+ const temporary = join26(parent, `.atomic-write-${randomUUID6()}.tmp`);
29378
29075
  try {
29379
29076
  await writeFile4(temporary, contents, options);
29380
29077
  await rename2(temporary, destination);
29381
29078
  } catch (error) {
29382
- await rm2(temporary, { force: true }).catch(() => void 0);
29079
+ await rm(temporary, { force: true }).catch(() => void 0);
29383
29080
  throw error;
29384
29081
  }
29385
29082
  }
@@ -29390,13 +29087,13 @@ var init_atomic_write = __esm({
29390
29087
  });
29391
29088
 
29392
29089
  // src/analyst-index.ts
29393
- import { open as open2, readFile as readFile12, unlink as unlink2 } from "node:fs/promises";
29394
- import { dirname as dirname17, join as join29 } from "node:path";
29090
+ import { open as open2, readFile as readFile11, unlink as unlink2 } from "node:fs/promises";
29091
+ import { dirname as dirname17, join as join27 } from "node:path";
29395
29092
  import { setTimeout as sleep } from "node:timers/promises";
29396
29093
  async function withAnalystLibraryIndexLock(ledgerHome, fn) {
29397
29094
  const indexPath = analystLibraryIndexPath(ledgerHome);
29398
29095
  ensureRealDirectoryTree(ledgerHome, dirname17(indexPath));
29399
- const lockPath = join29(dirname17(indexPath), LIBRARY_INDEX_LOCK_NAME);
29096
+ const lockPath = join27(dirname17(indexPath), LIBRARY_INDEX_LOCK_NAME);
29400
29097
  assertLedgerFileInsideHome(lockPath, ledgerHome);
29401
29098
  const startedAt = Date.now();
29402
29099
  while (true) {
@@ -29423,7 +29120,7 @@ async function withAnalystLibraryIndexLock(ledgerHome, fn) {
29423
29120
  }
29424
29121
  }
29425
29122
  function analystLibraryIndexPath(ledgerHome) {
29426
- return join29(ledgerHome, "analyst", "library-index.json");
29123
+ return join27(ledgerHome, "analyst", "library-index.json");
29427
29124
  }
29428
29125
  function rowFromIssueMetricsPage(page) {
29429
29126
  return {
@@ -29514,7 +29211,7 @@ async function readAnalystLibraryIndexPage(ledgerHome) {
29514
29211
  const path = analystLibraryIndexPath(ledgerHome);
29515
29212
  let raw;
29516
29213
  try {
29517
- raw = await readFile12(path, "utf8");
29214
+ raw = await readFile11(path, "utf8");
29518
29215
  } catch (error) {
29519
29216
  if (isMissingPathError(error)) return void 0;
29520
29217
  throw error;
@@ -29969,7 +29666,7 @@ var init_analyst_gate_cycles_read = __esm({
29969
29666
 
29970
29667
  // src/analyst-ledger.ts
29971
29668
  import { readdir as readdir4 } from "node:fs/promises";
29972
- import { basename as basename12, join as join30 } from "node:path";
29669
+ import { basename as basename11, join as join28 } from "node:path";
29973
29670
  async function readExistingRunLifecycleState(runDirectory) {
29974
29671
  return (await readRoleRunIdentity(runDirectory))?.state;
29975
29672
  }
@@ -29989,7 +29686,7 @@ function ghostLeaseCheckFromAutopsy(autopsy) {
29989
29686
  }
29990
29687
  }
29991
29688
  async function classifyGhostCandidate(input) {
29992
- const autopsy = await autopsyWriterLock(join30(input.runDirectory, "writer.lock"));
29689
+ const autopsy = await autopsyWriterLock(join28(input.runDirectory, "writer.lock"));
29993
29690
  const leaseCheck = ghostLeaseCheckFromAutopsy(autopsy);
29994
29691
  if (leaseCheck === void 0) return { kind: "live" };
29995
29692
  return {
@@ -30279,7 +29976,7 @@ async function classifyScopedRun(input) {
30279
29976
  async function scanAnalystIssueRuns(input) {
30280
29977
  const ledgerHome = resolveActivationLedgerHome(input.home);
30281
29978
  const scopeTicketNumber = input.ticketNumber;
30282
- const booksRoot = join30(ledgerHome, "books");
29979
+ const booksRoot = join28(ledgerHome, "books");
30283
29980
  let wholeBook = false;
30284
29981
  let scopeRootIdentity;
30285
29982
  let bookNames;
@@ -30312,7 +30009,7 @@ async function scanAnalystIssueRuns(input) {
30312
30009
  const ghostLegs = [];
30313
30010
  const scopeConflicts = [];
30314
30011
  for (const book of bookNames) {
30315
- const bookDir = join30(booksRoot, book);
30012
+ const bookDir = join28(booksRoot, book);
30316
30013
  let runDirectories;
30317
30014
  try {
30318
30015
  runDirectories = await listBookRunDirectories(bookDir);
@@ -30321,7 +30018,7 @@ async function scanAnalystIssueRuns(input) {
30321
30018
  throw error;
30322
30019
  }
30323
30020
  for (const runDirectory of runDirectories) {
30324
- const runName = basename12(runDirectory);
30021
+ const runName = basename11(runDirectory);
30325
30022
  const parsed = parseRunLeaf(runName);
30326
30023
  if (parsed === void 0) continue;
30327
30024
  let scopeFields;
@@ -31058,7 +30755,7 @@ var init_analyst_metric_family = __esm({
31058
30755
  });
31059
30756
 
31060
30757
  // src/analyst-page.ts
31061
- import { dirname as dirname18, join as join31 } from "node:path";
30758
+ import { dirname as dirname18, join as join29 } from "node:path";
31062
30759
  function analystIssuePageKey(address) {
31063
30760
  const parts = ["book", address.bookKey];
31064
30761
  if (address.issueNumber !== void 0) {
@@ -31069,7 +30766,7 @@ function analystIssuePageKey(address) {
31069
30766
  return sha256Hex(parts.join("\0")).slice(0, 32);
31070
30767
  }
31071
30768
  function analystIssuePagePath(ledgerHome, address) {
31072
- return join31(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
30769
+ return join29(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
31073
30770
  }
31074
30771
  function analystIssuePageAddressFromPage(page) {
31075
30772
  return {
@@ -31305,7 +31002,7 @@ var init_analyst_model_groups = __esm({
31305
31002
  });
31306
31003
 
31307
31004
  // src/analyst-entry.ts
31308
- import { readFile as readFile14 } from "node:fs/promises";
31005
+ import { readFile as readFile13 } from "node:fs/promises";
31309
31006
  function cachedPageMatchesRequestedScope(page, input) {
31310
31007
  if (page.bookKey !== input.bookKey) return false;
31311
31008
  const requestedTicket = input.ticketNumber ?? input.issueNumber;
@@ -31332,7 +31029,7 @@ async function readOrComputeAnalystIssuePage(input, options) {
31332
31029
  ...issueNumber === void 0 && input.bookKey === void 0 ? { scopeRootIdentity: projectRoot } : {}
31333
31030
  });
31334
31031
  try {
31335
- const raw = await readFile14(pagePath, "utf8");
31032
+ const raw = await readFile13(pagePath, "utf8");
31336
31033
  const page = JSON.parse(raw);
31337
31034
  if (cachedPageMatchesRequestedScope(page, { bookKey, ...input })) {
31338
31035
  const ghostScan = await scanAnalystIssueRuns({
@@ -31433,7 +31130,7 @@ async function runAnalystModelGroupsMode(input, home) {
31433
31130
  scopeRootIdentity: projectRoot
31434
31131
  });
31435
31132
  try {
31436
- const raw = await readFile14(pagePath, "utf8");
31133
+ const raw = await readFile13(pagePath, "utf8");
31437
31134
  JSON.parse(raw);
31438
31135
  } catch (error) {
31439
31136
  if (!isMissingPathError(error)) {
@@ -31531,8 +31228,8 @@ var init_analyst_entry = __esm({
31531
31228
  });
31532
31229
 
31533
31230
  // src/public-cli/analyst-run.ts
31534
- import { readFile as readFile15 } from "node:fs/promises";
31535
- import { isAbsolute as isAbsolute10, resolve as resolve13 } from "node:path";
31231
+ import { readFile as readFile14 } from "node:fs/promises";
31232
+ import { isAbsolute as isAbsolute9, resolve as resolve12 } from "node:path";
31536
31233
  function resolveAnalystIssueBookKeyFromCwd(cwd = process.cwd()) {
31537
31234
  try {
31538
31235
  return resolveBookKeyFromGit(cwd);
@@ -31581,10 +31278,10 @@ async function buildAnalystSweepModeInputFromAttachmentPaths(attachmentPaths) {
31581
31278
  );
31582
31279
  }
31583
31280
  const sourcePath = attachmentPaths[0];
31584
- const absolute = isAbsolute10(sourcePath) ? sourcePath : resolve13(sourcePath);
31281
+ const absolute = isAbsolute9(sourcePath) ? sourcePath : resolve12(sourcePath);
31585
31282
  let bytes;
31586
31283
  try {
31587
- bytes = await readFile15(absolute);
31284
+ bytes = await readFile14(absolute);
31588
31285
  } catch (error) {
31589
31286
  throw new CliUsageError(
31590
31287
  `analyst sweep attachment is not a readable regular file: ${sourcePath}`,
@@ -32604,8 +32301,8 @@ var init_cli = __esm({
32604
32301
  });
32605
32302
 
32606
32303
  // src/public-cli/main.ts
32607
- import { existsSync as existsSync10 } from "node:fs";
32608
- import { dirname as dirname19, join as join32 } from "node:path";
32304
+ import { existsSync as existsSync9 } from "node:fs";
32305
+ import { dirname as dirname19, join as join30 } from "node:path";
32609
32306
  import { fileURLToPath as fileURLToPath2 } from "node:url";
32610
32307
 
32611
32308
  // src/public-cli/host-pi-runtime.ts
@@ -32694,8 +32391,8 @@ function linkPackage(packageRoot2, name, targetDir) {
32694
32391
  // src/public-cli/main.ts
32695
32392
  var here = dirname19(fileURLToPath2(import.meta.url));
32696
32393
  function resolvePackageRoot(binDir) {
32697
- const canonical = join32(binDir, "..", "..");
32698
- if (existsSync10(join32(canonical, "package.json"))) {
32394
+ const canonical = join30(binDir, "..", "..");
32395
+ if (existsSync9(join30(canonical, "package.json"))) {
32699
32396
  return canonical;
32700
32397
  }
32701
32398
  return binDir;