@akagilnc/pi-workflow-roles 0.1.5235 → 0.1.5241

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.
@@ -17672,10 +17672,10 @@ __export(session_assistant_usage_exports, {
17672
17672
  });
17673
17673
  import { join as join13 } from "node:path";
17674
17674
  async function readAssistantUsageFromSessionFile(sessionFile) {
17675
- const { readFile: readFile23 } = await import("node:fs/promises");
17675
+ const { readFile: readFile22 } = await import("node:fs/promises");
17676
17676
  let text;
17677
17677
  try {
17678
- text = await readFile23(sessionFile, "utf8");
17678
+ text = await readFile22(sessionFile, "utf8");
17679
17679
  } catch (error) {
17680
17680
  if (error?.code === "ENOENT") return void 0;
17681
17681
  throw error;
@@ -17934,14 +17934,6 @@ function resolveSitianRecordPathInLedger(input, ledgerHome) {
17934
17934
  }
17935
17935
  return { sessionDir, recordFile, ledgerHome };
17936
17936
  }
17937
- function projectTicketRecordsPathShape() {
17938
- const { recordFile } = ticketProvenanceUnderBookPaths(
17939
- join14("~", ".ak-roles"),
17940
- "<\u7C3F>",
17941
- "<\u7968\u53F7>"
17942
- );
17943
- return recordFile.replace(/\\/g, "/");
17944
- }
17945
17937
  function resolveSitianRecordPath(input) {
17946
17938
  const ledgerHome = input.home !== void 0 && input.home.length > 0 ? resolveActivationLedgerHome(input.home) : resolveActivationLedgerHomeForPath(input.runDirectory ?? input.sessionParent);
17947
17939
  return resolveSitianRecordPathInLedger(input, ledgerHome);
@@ -19102,12 +19094,6 @@ function ticketProvenanceRecordInput(ticketNumber, cwd, home, runDirectory) {
19102
19094
  ...home === void 0 ? {} : { home }
19103
19095
  };
19104
19096
  }
19105
- function resolveTicketProvenanceVolume(ticketNumber, cwd, home) {
19106
- const path = resolveSitianRecordPath(
19107
- ticketProvenanceRecordInput(ticketNumber, cwd, home)
19108
- );
19109
- return { recordFile: path.recordFile, volumeDir: path.sessionDir };
19110
- }
19111
19097
  async function rehomeUnboundTicketProvenance(runDirectory, ticketNumber, cwd, home) {
19112
19098
  const source = join16(runDirectory, "records.jsonl");
19113
19099
  let content;
@@ -22402,10 +22388,10 @@ function pairGateRounds(volumes) {
22402
22388
  return rounds.sort((a, b) => a.officerStartedAt.localeCompare(b.officerStartedAt)).map((round, index) => ({ ...round, roundIndex: index + 1 }));
22403
22389
  }
22404
22390
  async function resolveOfficerSessionFromPointerFile(pointerPath) {
22405
- const { readFile: readFile23 } = await import("node:fs/promises");
22391
+ const { readFile: readFile22 } = await import("node:fs/promises");
22406
22392
  let raw;
22407
22393
  try {
22408
- raw = JSON.parse(await readFile23(pointerPath, "utf8"));
22394
+ raw = JSON.parse(await readFile22(pointerPath, "utf8"));
22409
22395
  } catch (error) {
22410
22396
  throw new Error(
22411
22397
  `direct officer run pointer unreadable in ${pointerPath}: ${error instanceof Error ? error.message : String(error)}`,
@@ -28927,64 +28913,6 @@ var init_session_identity = __esm({
28927
28913
  }
28928
28914
  });
28929
28915
 
28930
- // src/public-cli/case-dossier-delivery.ts
28931
- import { mkdtemp as mkdtemp2, readFile as readFile18, rm as rm3, writeFile as writeFile7 } from "node:fs/promises";
28932
- import { tmpdir as tmpdir2 } from "node:os";
28933
- import { join as join32 } from "node:path";
28934
- async function projectCaseDossierPointerSection(input) {
28935
- if (input.ticketNumber === void 0) {
28936
- return [
28937
- UNBOUND_DOSSIER_PATH_HEADING,
28938
- "",
28939
- `\u8BB0\u5F55\u5377\u5B97\uFF1A${projectTicketRecordsPathShape()}`
28940
- ].join("\n");
28941
- }
28942
- const volume = resolveTicketProvenanceVolume(
28943
- input.ticketNumber,
28944
- input.projectRoot,
28945
- input.home
28946
- );
28947
- return [
28948
- CASE_DOSSIER_SECTION_HEADING,
28949
- "",
28950
- `\u7968\u53F7\uFF1A#${input.ticketNumber}`,
28951
- `\u8BB0\u5F55\u5377\u5B97\uFF1A${volume.recordFile}`
28952
- ].join("\n");
28953
- }
28954
- async function deliverCaseDossierAsAttachment(input) {
28955
- const section = await projectCaseDossierPointerSection({
28956
- ticketNumber: input.ticketNumber,
28957
- projectRoot: input.projectRoot,
28958
- home: input.home
28959
- });
28960
- const stagingDir = await mkdtemp2(join32(tmpdir2(), "ak-case-dossier-"));
28961
- try {
28962
- const stagingPath = join32(stagingDir, CASE_DOSSIER_ATTACH_FILE);
28963
- await writeFile7(stagingPath, `${section}
28964
- `, "utf8");
28965
- return await freezeAttachmentsIntoRun(
28966
- [stagingPath],
28967
- input.runDirectory,
28968
- CASE_DOSSIER_ATTACH_KEY
28969
- );
28970
- } finally {
28971
- await rm3(stagingDir, { recursive: true, force: true });
28972
- }
28973
- }
28974
- var CASE_DOSSIER_SECTION_HEADING, UNBOUND_DOSSIER_PATH_HEADING, CASE_DOSSIER_ATTACH_KEY, CASE_DOSSIER_ATTACH_FILE;
28975
- var init_case_dossier_delivery = __esm({
28976
- "src/public-cli/case-dossier-delivery.ts"() {
28977
- "use strict";
28978
- init_sitian_facade();
28979
- init_ticket_provenance();
28980
- init_invocation();
28981
- CASE_DOSSIER_SECTION_HEADING = "## \u672C\u7968\u8D77\u5C45\u5F55\uFF08\u7CFB\u7EDF\u968F\u6848\u63D0\u4F9B\uFF09";
28982
- UNBOUND_DOSSIER_PATH_HEADING = "## \u8D77\u5C45\u5F55\u8DEF\u5F84\uFF08\u7CFB\u7EDF\u968F\u6848\u63D0\u4F9B\uFF09";
28983
- CASE_DOSSIER_ATTACH_KEY = "case-dossier";
28984
- CASE_DOSSIER_ATTACH_FILE = "case-dossier-pointer.md";
28985
- }
28986
- });
28987
-
28988
28916
  // src/public-cli/process-cancel.ts
28989
28917
  var process_cancel_exports = {};
28990
28918
  __export(process_cancel_exports, {
@@ -29051,7 +28979,7 @@ import {
29051
28979
  rmSync as rmSync2,
29052
28980
  statSync as statSync4
29053
28981
  } from "node:fs";
29054
- import { dirname as dirname19, join as join33 } from "node:path";
28982
+ import { dirname as dirname19, join as join32 } from "node:path";
29055
28983
  function declareHostSessionFailure(error) {
29056
28984
  const message = error instanceof Error ? error.stack || error.message : String(error);
29057
28985
  process.stderr.write(`[host-session] Dossier record failure: ${message}
@@ -29059,7 +28987,7 @@ function declareHostSessionFailure(error) {
29059
28987
  }
29060
28988
  function recordRunStart(runDirectory) {
29061
28989
  try {
29062
- appendFileSync2(join33(runDirectory, ".run-starts"), "\n");
28990
+ appendFileSync2(join32(runDirectory, ".run-starts"), "\n");
29063
28991
  } catch (error) {
29064
28992
  declareHostSessionFailure(error);
29065
28993
  }
@@ -29075,7 +29003,7 @@ var init_host_session_record = __esm({
29075
29003
  import { constants as fsConstants2 } from "node:fs";
29076
29004
  import { randomUUID as randomUUID5 } from "node:crypto";
29077
29005
  import { lstat as lstat7, mkdir as mkdir4, open as open2 } from "node:fs/promises";
29078
- import { join as join34 } from "node:path";
29006
+ import { join as join33 } from "node:path";
29079
29007
  async function persistReturnedRunState(admitted, authority, options) {
29080
29008
  if (options?.lawful === true) {
29081
29009
  await markRunTerminal(admitted.runDirectory);
@@ -29146,7 +29074,7 @@ function jsonSafeReplacer() {
29146
29074
  };
29147
29075
  }
29148
29076
  async function writeHardenedArtifactFile(artifactsDir, namePrefix, payload) {
29149
- const filePath = join34(artifactsDir, `${namePrefix}-${randomUUID5()}.json`);
29077
+ const filePath = join33(artifactsDir, `${namePrefix}-${randomUUID5()}.json`);
29150
29078
  const body = `${JSON.stringify(payload, jsonSafeReplacer(), 2)}
29151
29079
  `;
29152
29080
  const noFollowFlag = typeof fsConstants2.O_NOFOLLOW === "number" ? fsConstants2.O_NOFOLLOW : 0;
@@ -29434,8 +29362,8 @@ var init_auto_resume = __esm({
29434
29362
 
29435
29363
  // src/public-cli/post-admission.ts
29436
29364
  import { randomUUID as randomUUID6 } from "node:crypto";
29437
- import { writeFile as writeFile8 } from "node:fs/promises";
29438
- import { isAbsolute as isAbsolute8, join as join35, resolve as resolve12 } from "node:path";
29365
+ import { writeFile as writeFile7 } from "node:fs/promises";
29366
+ import { isAbsolute as isAbsolute8, join as join34, resolve as resolve12 } from "node:path";
29439
29367
  function describeCaughtError(error) {
29440
29368
  if (error instanceof Error) {
29441
29369
  const code = error.code;
@@ -29530,8 +29458,8 @@ async function recordBestEffortPostDispatchDiagnostic(admitted, env, diagnostic,
29530
29458
  } catch (appendError) {
29531
29459
  try {
29532
29460
  const artifactsDir = await ensureRealArtifactsDirectory(admitted.runDirectory);
29533
- await writeFile8(
29534
- join35(artifactsDir, `post-admission-diagnostic-${randomUUID6()}.json`),
29461
+ await writeFile7(
29462
+ join34(artifactsDir, `post-admission-diagnostic-${randomUUID6()}.json`),
29535
29463
  `${JSON.stringify({ version: 1, ...payload }, null, 2)}
29536
29464
  `,
29537
29465
  { encoding: "utf8", flag: "wx" }
@@ -29677,7 +29605,7 @@ async function dispatchPostAdmissionTurn(input) {
29677
29605
  const rows = await readRecordedSubmissionRows(
29678
29606
  admitted.projectRoot,
29679
29607
  admitted.runId,
29680
- { home: homeFromRunDirectory(admitted.runDirectory), sessionParent: join35(admitted.runDirectory, "session", "session.jsonl") }
29608
+ { home: homeFromRunDirectory(admitted.runDirectory), sessionParent: join34(admitted.runDirectory, "session", "session.jsonl") }
29681
29609
  );
29682
29610
  let ticketNumber;
29683
29611
  for (const row of rows) {
@@ -29771,12 +29699,6 @@ async function dispatchPostAdmissionTurn(input) {
29771
29699
  if (typeof env.host === "string" && env.host.trim() !== "") {
29772
29700
  turnRequest = { ...turnRequest, host: env.host.trim() };
29773
29701
  }
29774
- await deliverCaseDossierAsAttachment({
29775
- ticketNumber: admitted.ticketNumber,
29776
- projectRoot: admitted.projectRoot,
29777
- home: env.home,
29778
- runDirectory: admitted.runDirectory
29779
- });
29780
29702
  await markRunRunning(
29781
29703
  admitted.runDirectory,
29782
29704
  env.model,
@@ -29812,8 +29734,8 @@ async function dispatchPostAdmissionTurn(input) {
29812
29734
  }
29813
29735
  let stderrLogWriteFailure;
29814
29736
  try {
29815
- await writeFile8(
29816
- join35(admitted.runDirectory, "stderr.log"),
29737
+ await writeFile7(
29738
+ join34(admitted.runDirectory, "stderr.log"),
29817
29739
  result.stderr,
29818
29740
  "utf8"
29819
29741
  );
@@ -30092,7 +30014,7 @@ async function dispatchAfterWriterLease(input) {
30092
30014
  }
30093
30015
  function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
30094
30016
  const absolute = isAbsolute8(attachmentPath) ? attachmentPath : resolve12(attachmentPath);
30095
- return pathContainedIn(join35(runDirectory, "attachments"), absolute);
30017
+ return pathContainedIn(join34(runDirectory, "attachments"), absolute);
30096
30018
  }
30097
30019
  async function prepareSummonsResumeMaterials(runDirectory, summons) {
30098
30020
  if (summons === void 0) return void 0;
@@ -30351,8 +30273,8 @@ async function presentResumeFailurePointer(io, thrown, publish) {
30351
30273
  }
30352
30274
  async function writeResumeDiagnosticFile(runDirectory, runId, failure, role) {
30353
30275
  const dir = await ensureRealArtifactsDirectory(runDirectory);
30354
- const path = join35(dir, `resume-diagnostic-${randomUUID6()}.json`);
30355
- await writeFile8(
30276
+ const path = join34(dir, `resume-diagnostic-${randomUUID6()}.json`);
30277
+ await writeFile7(
30356
30278
  path,
30357
30279
  `${JSON.stringify({
30358
30280
  runId,
@@ -30484,7 +30406,6 @@ var init_post_admission = __esm({
30484
30406
  init_session_identity();
30485
30407
  init_role_run_relocation();
30486
30408
  init_packaged_role_registry();
30487
- init_case_dossier_delivery();
30488
30409
  init_engine_detour_usage();
30489
30410
  init_run_lifecycle();
30490
30411
  init_process_cancel();
@@ -30536,16 +30457,16 @@ var init_analyst_book_key = __esm({
30536
30457
 
30537
30458
  // src/atomic-write.ts
30538
30459
  import { randomUUID as randomUUID7 } from "node:crypto";
30539
- import { rename as rename3, rm as rm4, writeFile as writeFile9 } from "node:fs/promises";
30540
- import { dirname as dirname20, join as join36 } from "node:path";
30460
+ import { rename as rename3, rm as rm3, writeFile as writeFile8 } from "node:fs/promises";
30461
+ import { dirname as dirname20, join as join35 } from "node:path";
30541
30462
  async function writeFileAtomically(destination, contents) {
30542
30463
  const parent = dirname20(destination);
30543
- const temporary = join36(parent, `.atomic-write-${randomUUID7()}.tmp`);
30464
+ const temporary = join35(parent, `.atomic-write-${randomUUID7()}.tmp`);
30544
30465
  try {
30545
- await writeFile9(temporary, contents);
30466
+ await writeFile8(temporary, contents);
30546
30467
  await rename3(temporary, destination);
30547
30468
  } catch (error) {
30548
- await rm4(temporary, { force: true }).catch(() => void 0);
30469
+ await rm3(temporary, { force: true }).catch(() => void 0);
30549
30470
  throw error;
30550
30471
  }
30551
30472
  }
@@ -30556,8 +30477,8 @@ var init_atomic_write = __esm({
30556
30477
  });
30557
30478
 
30558
30479
  // src/analyst-index.ts
30559
- import { open as open3, readFile as readFile19, unlink as unlink5 } from "node:fs/promises";
30560
- import { dirname as dirname21, join as join37 } from "node:path";
30480
+ import { open as open3, readFile as readFile18, unlink as unlink5 } from "node:fs/promises";
30481
+ import { dirname as dirname21, join as join36 } from "node:path";
30561
30482
  function sleep(ms) {
30562
30483
  return new Promise((resolve14) => {
30563
30484
  setTimeout(resolve14, ms);
@@ -30566,7 +30487,7 @@ function sleep(ms) {
30566
30487
  async function withAnalystLibraryIndexLock(ledgerHome, fn) {
30567
30488
  const indexPath = analystLibraryIndexPath(ledgerHome);
30568
30489
  ensureRealDirectoryTree(ledgerHome, dirname21(indexPath));
30569
- const lockPath = join37(dirname21(indexPath), LIBRARY_INDEX_LOCK_NAME);
30490
+ const lockPath = join36(dirname21(indexPath), LIBRARY_INDEX_LOCK_NAME);
30570
30491
  assertLedgerFileInsideHome(lockPath, ledgerHome);
30571
30492
  const startedAt = Date.now();
30572
30493
  while (true) {
@@ -30593,7 +30514,7 @@ async function withAnalystLibraryIndexLock(ledgerHome, fn) {
30593
30514
  }
30594
30515
  }
30595
30516
  function analystLibraryIndexPath(ledgerHome) {
30596
- return join37(ledgerHome, "analyst", "library-index.json");
30517
+ return join36(ledgerHome, "analyst", "library-index.json");
30597
30518
  }
30598
30519
  function rowFromIssueMetricsPage(page) {
30599
30520
  return {
@@ -30684,7 +30605,7 @@ async function readAnalystLibraryIndexPage(ledgerHome) {
30684
30605
  const path = analystLibraryIndexPath(ledgerHome);
30685
30606
  let raw;
30686
30607
  try {
30687
- raw = await readFile19(path, "utf8");
30608
+ raw = await readFile18(path, "utf8");
30688
30609
  } catch (error) {
30689
30610
  if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
30690
30611
  return void 0;
@@ -30888,8 +30809,8 @@ var init_analyst_cohort = __esm({
30888
30809
  });
30889
30810
 
30890
30811
  // src/analyst-ledger.ts
30891
- import { readdir as readdir7, readFile as readFile20 } from "node:fs/promises";
30892
- import { basename as basename9, join as join38 } from "node:path";
30812
+ import { readdir as readdir7, readFile as readFile19 } from "node:fs/promises";
30813
+ import { basename as basename9, join as join37 } from "node:path";
30893
30814
  function isMissingPathError6(error) {
30894
30815
  return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
30895
30816
  }
@@ -30918,7 +30839,7 @@ function ghostLeaseCheckFromAutopsy(autopsy) {
30918
30839
  }
30919
30840
  }
30920
30841
  async function classifyGhostCandidate(input) {
30921
- const autopsy = await autopsyWriterLock(join38(input.runDirectory, "writer.lock"));
30842
+ const autopsy = await autopsyWriterLock(join37(input.runDirectory, "writer.lock"));
30922
30843
  const leaseCheck = ghostLeaseCheckFromAutopsy(autopsy);
30923
30844
  if (leaseCheck === void 0) return { kind: "live" };
30924
30845
  return {
@@ -30947,7 +30868,7 @@ async function listLedgerBookNames(booksRoot) {
30947
30868
  async function readInvocationScopeFields(runDirectory) {
30948
30869
  let raw;
30949
30870
  try {
30950
- raw = await readFile20(join38(runDirectory, "invocation.json"), "utf8");
30871
+ raw = await readFile19(join37(runDirectory, "invocation.json"), "utf8");
30951
30872
  } catch (error) {
30952
30873
  if (isMissingPathError6(error)) return void 0;
30953
30874
  throw error;
@@ -30980,7 +30901,7 @@ function decideIssueScope(input) {
30980
30901
  }
30981
30902
  async function resolveSessionFile(runDirectory) {
30982
30903
  try {
30983
- const raw = await readFile20(join38(runDirectory, "invocation.json"), "utf8");
30904
+ const raw = await readFile19(join37(runDirectory, "invocation.json"), "utf8");
30984
30905
  const parsed = JSON.parse(raw);
30985
30906
  if (isRecord11(parsed) && typeof parsed.sessionFile === "string" && parsed.sessionFile.trim() !== "") {
30986
30907
  return parsed.sessionFile;
@@ -30988,7 +30909,7 @@ async function resolveSessionFile(runDirectory) {
30988
30909
  } catch (error) {
30989
30910
  if (!isMissingPathError6(error)) throw error;
30990
30911
  }
30991
- return join38(runDirectory, "session", "session.jsonl");
30912
+ return join37(runDirectory, "session", "session.jsonl");
30992
30913
  }
30993
30914
  function attributeSessionRowsForRun(input) {
30994
30915
  if (pathContainedIn(input.runDirectory, input.sessionFile)) {
@@ -31180,9 +31101,9 @@ async function classifyScopedRun(input) {
31180
31101
  }
31181
31102
  let gateCycles;
31182
31103
  try {
31183
- const parentSessionFile = join38(input.runDirectory, "session", "session.jsonl");
31104
+ const parentSessionFile = join37(input.runDirectory, "session", "session.jsonl");
31184
31105
  gateCycles = await readAnalystGateCyclesFromAuditorRoles(
31185
- join38(input.runDirectory, "session", "auditor-roles"),
31106
+ join37(input.runDirectory, "session", "auditor-roles"),
31186
31107
  { parentSessionFile }
31187
31108
  );
31188
31109
  } catch (error) {
@@ -31217,7 +31138,7 @@ async function classifyScopedRun(input) {
31217
31138
  async function scanAnalystIssueRuns(input) {
31218
31139
  const ledgerHome = resolveActivationLedgerHome(input.home);
31219
31140
  const scopeTicketNumber = input.ticketNumber;
31220
- const booksRoot = join38(ledgerHome, "books");
31141
+ const booksRoot = join37(ledgerHome, "books");
31221
31142
  let wholeBook = false;
31222
31143
  let scopeRootIdentity;
31223
31144
  let bookNames;
@@ -31250,7 +31171,7 @@ async function scanAnalystIssueRuns(input) {
31250
31171
  const ghostLegs = [];
31251
31172
  const scopeConflicts = [];
31252
31173
  for (const book of bookNames) {
31253
- const bookDir = join38(booksRoot, book);
31174
+ const bookDir = join37(booksRoot, book);
31254
31175
  let runDirectories;
31255
31176
  try {
31256
31177
  runDirectories = await listBookRunDirectories(bookDir);
@@ -32122,7 +32043,7 @@ var init_analyst_metric_family = __esm({
32122
32043
 
32123
32044
  // src/analyst-page.ts
32124
32045
  import { createHash as createHash3 } from "node:crypto";
32125
- import { dirname as dirname22, join as join39 } from "node:path";
32046
+ import { dirname as dirname22, join as join38 } from "node:path";
32126
32047
  function analystIssuePageKey(address) {
32127
32048
  const parts = ["book", address.bookKey];
32128
32049
  if (address.issueNumber !== void 0) {
@@ -32133,7 +32054,7 @@ function analystIssuePageKey(address) {
32133
32054
  return createHash3("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
32134
32055
  }
32135
32056
  function analystIssuePagePath(ledgerHome, address) {
32136
- return join39(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
32057
+ return join38(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
32137
32058
  }
32138
32059
  function analystIssuePageAddressFromPage(page) {
32139
32060
  return {
@@ -32269,7 +32190,7 @@ var init_analyst_page = __esm({
32269
32190
  });
32270
32191
 
32271
32192
  // src/analyst-entry.ts
32272
- import { readFile as readFile21 } from "node:fs/promises";
32193
+ import { readFile as readFile20 } from "node:fs/promises";
32273
32194
  function isMissingPathError7(error) {
32274
32195
  return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
32275
32196
  }
@@ -32299,7 +32220,7 @@ async function readOrComputeAnalystIssuePage(input, options) {
32299
32220
  ...issueNumber === void 0 && input.bookKey === void 0 ? { scopeRootIdentity: projectRoot } : {}
32300
32221
  });
32301
32222
  try {
32302
- const raw = await readFile21(pagePath, "utf8");
32223
+ const raw = await readFile20(pagePath, "utf8");
32303
32224
  const page = JSON.parse(raw);
32304
32225
  if (cachedPageMatchesRequestedScope(page, { bookKey, ...input })) {
32305
32226
  const ghostScan = await scanAnalystIssueRuns({
@@ -32400,7 +32321,7 @@ async function runAnalystModelGroupsMode(input, home) {
32400
32321
  scopeRootIdentity: projectRoot
32401
32322
  });
32402
32323
  try {
32403
- const raw = await readFile21(pagePath, "utf8");
32324
+ const raw = await readFile20(pagePath, "utf8");
32404
32325
  JSON.parse(raw);
32405
32326
  } catch (error) {
32406
32327
  if (!isMissingPathError7(error)) {
@@ -32499,7 +32420,7 @@ var init_analyst_entry = __esm({
32499
32420
  });
32500
32421
 
32501
32422
  // src/public-cli/analyst-run.ts
32502
- import { readFile as readFile22 } from "node:fs/promises";
32423
+ import { readFile as readFile21 } from "node:fs/promises";
32503
32424
  import { isAbsolute as isAbsolute10, resolve as resolve13 } from "node:path";
32504
32425
  function resolveAnalystIssueBookKeyFromCwd(cwd = process.cwd()) {
32505
32426
  try {
@@ -32552,7 +32473,7 @@ async function buildAnalystSweepModeInputFromAttachmentPaths(attachmentPaths) {
32552
32473
  const absolute = isAbsolute10(sourcePath) ? sourcePath : resolve13(sourcePath);
32553
32474
  let bytes;
32554
32475
  try {
32555
- bytes = await readFile22(absolute);
32476
+ bytes = await readFile21(absolute);
32556
32477
  } catch (error) {
32557
32478
  throw new CliUsageError(
32558
32479
  `analyst sweep attachment is not a readable regular file: ${sourcePath}`,
@@ -32673,7 +32594,7 @@ __export(cli_exports, {
32673
32594
  runAkRole: () => runAkRole
32674
32595
  });
32675
32596
  import { realpath as realpath6 } from "node:fs/promises";
32676
- import { join as join40 } from "node:path";
32597
+ import { join as join39 } from "node:path";
32677
32598
  function publicSeatArgv(owner) {
32678
32599
  return {
32679
32600
  parse: (args) => parsePublicSeatArgv(owner, args),
@@ -32812,7 +32733,7 @@ function resolveHome(env) {
32812
32733
  return env.home ?? packageMachineHome();
32813
32734
  }
32814
32735
  function resolveAgentDir(env, home) {
32815
- return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join40(home, ".pi", "agent");
32736
+ return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join39(home, ".pi", "agent");
32816
32737
  }
32817
32738
  function parseThinking(value) {
32818
32739
  return value;
@@ -33574,7 +33495,7 @@ var init_cli = __esm({
33574
33495
 
33575
33496
  // src/public-cli/main.ts
33576
33497
  import { existsSync as existsSync11 } from "node:fs";
33577
- import { dirname as dirname23, join as join41 } from "node:path";
33498
+ import { dirname as dirname23, join as join40 } from "node:path";
33578
33499
  import { fileURLToPath as fileURLToPath2 } from "node:url";
33579
33500
 
33580
33501
  // src/public-cli/host-pi-runtime.ts
@@ -33663,8 +33584,8 @@ function linkPackage(packageRoot2, name, targetDir) {
33663
33584
  // src/public-cli/main.ts
33664
33585
  var here = dirname23(fileURLToPath2(import.meta.url));
33665
33586
  function resolvePackageRoot(binDir) {
33666
- const canonical = join41(binDir, "..", "..");
33667
- if (existsSync11(join41(canonical, "package.json"))) {
33587
+ const canonical = join40(binDir, "..", "..");
33588
+ if (existsSync11(join40(canonical, "package.json"))) {
33668
33589
  return canonical;
33669
33590
  }
33670
33591
  return binDir;
@@ -18,7 +18,6 @@ import { pickEngineAxis } from "../package-resources/engine-material.js";
18
18
  import { readStoredHostSessionId, resolveHostAwareSessionAvailability, } from "../session-identity.js";
19
19
  import { rewriteRunDirectoryPathValue } from "../role-run-relocation.js";
20
20
  import { isOfficerReviewSeat } from "../packaged-role-registry.js";
21
- import { deliverCaseDossierAsAttachment } from "./case-dossier-delivery.js";
22
21
  /** Original error bytes, never relabeled — a secondary fact riding beside a classified cause. */
23
22
  function describeCaughtError(error) {
24
23
  if (error instanceof Error) {
@@ -29,8 +28,8 @@ function describeCaughtError(error) {
29
28
  }
30
29
  /**
31
30
  * Nested gate summons (station child) on an officer seat: dialogue content is
32
- * peer words only (#879). ADR 0081 case dossier still hangs via the existing
33
- * attachments freeze seam — never into the peer body, never RoleTurnRequest.materials.
31
+ * peer words only (#879). Never RoleTurnRequest.materials; #1092 drops code-side
32
+ * 起居录 path pointer freeze — roles locate records by ticket number.
34
33
  */
35
34
  function isStationChildOfficerDialogue(role, env) {
36
35
  return env.stationChild === true && isOfficerReviewSeat(role);
@@ -438,10 +437,8 @@ export async function dispatchPostAdmissionTurn(input) {
438
437
  }
439
438
  // Turn request is assembled after beforeDispatch so this turn sees whatever it
440
439
  // settled — the seat's ticket bind re-projection and any court diarist station
441
- // writes (#742). Case dossier delivery (ADR 0081 / #709 / #858) rides here once
442
- // for every public entry on the existing attachments → readingMaterial face
443
- // (station-child and ordinary share one seam). Dialogue continuation stays
444
- // caller/peer opaque — never splice system path sections into user dialogue.
440
+ // writes (#742). Dialogue continuation stays caller/peer opaque. #1092: no
441
+ // code-side 起居录 path freeze or readingMaterial inject — roles read by ticket.
445
442
  // No package-resume parallel face or typed resume identity.
446
443
  // #990: one-shot / auto-resume may freeze principal+runDirectory before
447
444
  // relocate; always take durable identity from the live admitted object.
@@ -458,16 +455,6 @@ export async function dispatchPostAdmissionTurn(input) {
458
455
  if (typeof env.host === "string" && env.host.trim() !== "") {
459
456
  turnRequest = { ...turnRequest, host: env.host.trim() };
460
457
  }
461
- // 0081 non-dialogue face: freeze pointer section under run/attachments/.
462
- // Seat consumes via loadCaseDossierReadingMaterial → existing agent-start
463
- // readingMaterial / systemPrompt.materials fold. Caller instruction, empty
464
- // request, and resume --message stay verbatim.
465
- await deliverCaseDossierAsAttachment({
466
- ticketNumber: admitted.ticketNumber,
467
- projectRoot: admitted.projectRoot,
468
- home: env.home,
469
- runDirectory: admitted.runDirectory,
470
- });
471
458
  // Authoritative host write happens here, at the real dispatch boundary —
472
459
  // immediately before the turn actually starts, after every retryable
473
460
  // pre-turn step above has succeeded on this attempt (#840 r9 判词 class 2).
@@ -73,14 +73,6 @@ function resolveSitianRecordPathInLedger(input, ledgerHome) {
73
73
  }
74
74
  return { sessionDir, recordFile, ledgerHome };
75
75
  }
76
- function projectTicketRecordsPathShape() {
77
- const { recordFile } = ticketProvenanceUnderBookPaths(
78
- join("~", ".ak-roles"),
79
- "<\u7C3F>",
80
- "<\u7968\u53F7>"
81
- );
82
- return recordFile.replace(/\\/g, "/");
83
- }
84
76
  function resolveSitianRecordPath(input) {
85
77
  const ledgerHome = input.home !== void 0 && input.home.length > 0 ? resolveActivationLedgerHome(input.home) : resolveActivationLedgerHomeForPath(input.runDirectory ?? input.sessionParent);
86
78
  return resolveSitianRecordPathInLedger(input, ledgerHome);
@@ -126,7 +118,6 @@ export {
126
118
  S4_SUBMISSION_LEDGER_KINDS,
127
119
  appendSitianRecord,
128
120
  appendSitianRecordBlock,
129
- projectTicketRecordsPathShape,
130
121
  resolveSitianRecordPath,
131
122
  resolveSitianRecordPathInLedger,
132
123
  resolveSitianVolumeCategory
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akagilnc/pi-workflow-roles",
3
- "version": "0.1.5235",
3
+ "version": "0.1.5241",
4
4
  "description": "Soul-bound workflow roles for Pi",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -177,7 +177,6 @@ export function createNotaryRoleRuntime(
177
177
  });
178
178
  // Evidence assembly only (ADR 0018): soul + bound projection.
179
179
  // Ticket value is envelope-admitted at activate — not re-read from flags here.
180
- // #879 case dossier freeze→readingMaterial is envelope-owned (shared before_agent_start).
181
180
  pi.on("before_agent_start", (event) => {
182
181
  if (activation === undefined) {
183
182
  throw new Error("符宝郎未激活");
@@ -8,9 +8,10 @@
8
8
  * mechanical layer only verifies; countersign reuses that typed identity for bind
9
9
  * (ADR 0075 / 0081). Code never matches instruction text against book-known
10
10
  * numbers. Who may call 起居郎 and in what order is not written into law
11
- * (ADR 0075 不规定谁调用起居郎、顺序归调用者). 起居录 path delivery is owned once by
12
- * post-admission (#709 / ADR 0081). Bound refresh hands the typed key to 起居郎
13
- * so freeze loads issue face (ADR 0075: 每次过庭都跑是调用者用法 / typed handoff).
11
+ * (ADR 0075 不规定谁调用起居郎、顺序归调用者). #1092: code no longer freezes or
12
+ * delivers 起居录 paths — roles locate records by ticket. Bound refresh hands the
13
+ * typed key to 起居郎 so freeze loads issue face (ADR 0075: 每次过庭都跑是调用者用法 /
14
+ * typed handoff).
14
15
  */
15
16
  import type { DurablePrincipalAuthority } from "../host-contracts.ts";
16
17
  import { projectCourtTicketNumbers } from "../diarist-contracts.ts";
@@ -45,8 +45,6 @@ import type {
45
45
  SessionCustomEntryAppender,
46
46
  } from "../host-contracts.ts";
47
47
  import { isOfficerReviewSeat } from "../packaged-role-registry.ts";
48
- import { deliverCaseDossierAsAttachment } from "./case-dossier-delivery.ts";
49
-
50
48
  /** Original error bytes, never relabeled — a secondary fact riding beside a classified cause. */
51
49
  function describeCaughtError(error: unknown): { name?: string; message: string; code?: string | number } {
52
50
  if (error instanceof Error) {
@@ -58,8 +56,8 @@ function describeCaughtError(error: unknown): { name?: string; message: string;
58
56
 
59
57
  /**
60
58
  * Nested gate summons (station child) on an officer seat: dialogue content is
61
- * peer words only (#879). ADR 0081 case dossier still hangs via the existing
62
- * attachments freeze seam — never into the peer body, never RoleTurnRequest.materials.
59
+ * peer words only (#879). Never RoleTurnRequest.materials; #1092 drops code-side
60
+ * 起居录 path pointer freeze — roles locate records by ticket number.
63
61
  */
64
62
  function isStationChildOfficerDialogue(
65
63
  role: string,
@@ -845,10 +843,8 @@ export async function dispatchPostAdmissionTurn<
845
843
 
846
844
  // Turn request is assembled after beforeDispatch so this turn sees whatever it
847
845
  // settled — the seat's ticket bind re-projection and any court diarist station
848
- // writes (#742). Case dossier delivery (ADR 0081 / #709 / #858) rides here once
849
- // for every public entry on the existing attachments → readingMaterial face
850
- // (station-child and ordinary share one seam). Dialogue continuation stays
851
- // caller/peer opaque — never splice system path sections into user dialogue.
846
+ // writes (#742). Dialogue continuation stays caller/peer opaque. #1092: no
847
+ // code-side 起居录 path freeze or readingMaterial inject — roles read by ticket.
852
848
  // No package-resume parallel face or typed resume identity.
853
849
  // #990: one-shot / auto-resume may freeze principal+runDirectory before
854
850
  // relocate; always take durable identity from the live admitted object.
@@ -865,16 +861,6 @@ export async function dispatchPostAdmissionTurn<
865
861
  if (typeof env.host === "string" && env.host.trim() !== "") {
866
862
  turnRequest = { ...turnRequest, host: env.host.trim() };
867
863
  }
868
- // 0081 non-dialogue face: freeze pointer section under run/attachments/.
869
- // Seat consumes via loadCaseDossierReadingMaterial → existing agent-start
870
- // readingMaterial / systemPrompt.materials fold. Caller instruction, empty
871
- // request, and resume --message stay verbatim.
872
- await deliverCaseDossierAsAttachment({
873
- ticketNumber: admitted.ticketNumber,
874
- projectRoot: admitted.projectRoot,
875
- home: env.home,
876
- runDirectory: admitted.runDirectory,
877
- });
878
864
 
879
865
  // Authoritative host write happens here, at the real dispatch boundary —
880
866
  // immediately before the turn actually starts, after every retryable
@@ -677,8 +677,8 @@ export async function prepareRoleEnvelope(options: {
677
677
  return [value.systemPrompt];
678
678
  });
679
679
  const systemPromptBody = systemPromptParts.join("\n\n");
680
- // Typed reading materials from agent-start handlers (incl. single shared
681
- // case-dossier owner). Folded into provider-visible systemPrompt at send.
680
+ // Typed reading materials from agent-start handlers. Folded into
681
+ // provider-visible systemPrompt at send.
682
682
  const readingMaterials: unknown[] = [];
683
683
  for (const value of promptResults) {
684
684
  if (typeof value !== "object" || value === null) continue;
@@ -1256,20 +1256,6 @@ export function createRoleRuntimeExtension(
1256
1256
  },
1257
1257
  };
1258
1258
  });
1259
- // #879: single shared owner of station-child 0081 case-dossier → readingMaterial fold.
1260
- // post-admission freezes under run/attachments/case-dossier/; this handler alone
1261
- // projects it onto the existing agent-start materials face (Pi + envelope collect).
1262
- // Role modules must not re-read the freeze (ADR 0018 lifecycle; no duplicate fold).
1263
- roleHost.on("before_agent_start", async (_event, ctx) => {
1264
- const runDir = runDirectoryFromHostContext(ctx);
1265
- if (runDir === undefined) return;
1266
- const { loadCaseDossierReadingMaterial } = await import(
1267
- "./public-cli/case-dossier-delivery.ts"
1268
- );
1269
- const caseDossier = await loadCaseDossierReadingMaterial(runDir);
1270
- if (caseDossier === undefined) return;
1271
- return { readingMaterial: caseDossier };
1272
- });
1273
1259
  roleHost.on("tool_result", async (event) => {
1274
1260
  const role = selectedRole;
1275
1261
  if (role === undefined) return;