@akagilnc/pi-workflow-roles 0.1.3661 → 0.1.3669

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.
@@ -4102,6 +4102,13 @@ function instructResumeHandbookRead(prompt, engineMaterial) {
4102
4102
  return line2;
4103
4103
  }).join("\n");
4104
4104
  }
4105
+ function appendResumeMaterialReread(prompt, materialPath) {
4106
+ const instruction = resumeRereadInstruction(materialPath, false);
4107
+ const lines = prompt.split("\n");
4108
+ if (lines.includes(instruction)) return prompt;
4109
+ return prompt.length === 0 ? instruction : `${prompt}
4110
+ ${instruction}`;
4111
+ }
4105
4112
  function selectResumeContinuationPrompt(message, engineMaterial) {
4106
4113
  const base = message !== void 0 ? message : RESUME_TRANSPORT_ENVELOPE;
4107
4114
  return instructResumeHandbookRead(
@@ -15886,16 +15893,24 @@ async function dispatchPostAdmissionTurn(input) {
15886
15893
  }
15887
15894
  }
15888
15895
  function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepared) {
15896
+ const engineMaterial = engineSessionMaterialFromOptions({
15897
+ ...env.engine === void 0 ? {} : { engine: env.engine },
15898
+ packageRoot: env.packageRoot
15899
+ });
15889
15900
  let prompt;
15890
15901
  if (request.message !== void 0) {
15891
- if (summonsPrepared !== void 0) {
15892
- prompt = buildInstructionTransportPrompt({
15893
- instruction: request.message,
15894
- instructionEmpty: false,
15895
- attachments: summonsPrepared.attachments
15896
- });
15897
- } else if (request.summons !== void 0) {
15898
- prompt = request.message;
15902
+ if (summonsPrepared !== void 0 && summonsPrepared.attachments.length > 0) {
15903
+ prompt = instructResumeHandbookRead(
15904
+ buildInstructionTransportPrompt(
15905
+ {
15906
+ instruction: request.message,
15907
+ instructionEmpty: false,
15908
+ attachments: summonsPrepared.attachments
15909
+ },
15910
+ engineMaterial
15911
+ ),
15912
+ engineMaterial
15913
+ );
15899
15914
  } else {
15900
15915
  prompt = buildResumeContinuationPrompt({
15901
15916
  packageRoot: env.packageRoot,
@@ -15904,9 +15919,10 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
15904
15919
  });
15905
15920
  }
15906
15921
  } else if (summonsPrepared !== void 0) {
15907
- prompt = buildInstructionTransportPrompt(summonsPrepared);
15908
- } else if (request.summons !== void 0) {
15909
- prompt = RESUME_TRANSPORT_ENVELOPE;
15922
+ prompt = instructResumeHandbookRead(
15923
+ buildInstructionTransportPrompt(summonsPrepared, engineMaterial),
15924
+ engineMaterial
15925
+ );
15910
15926
  } else {
15911
15927
  prompt = buildResumeContinuationPrompt({
15912
15928
  packageRoot: env.packageRoot,
@@ -16221,6 +16237,7 @@ var init_post_admission = __esm({
16221
16237
  init_cli_errors();
16222
16238
  init_invocation();
16223
16239
  init_activation_ledger_topology();
16240
+ init_engine_material();
16224
16241
  init_case_dossier_delivery();
16225
16242
  init_host_transition_prior_native();
16226
16243
  init_public_run_credentials();
@@ -16266,6 +16283,7 @@ __export(notary_run_exports, {
16266
16283
  runPublicNotary: () => runPublicNotary,
16267
16284
  runPublicNotaryResume: () => runPublicNotaryResume
16268
16285
  });
16286
+ import { existsSync as existsSync9 } from "node:fs";
16269
16287
  function buildNotaryTurnRequest(admitted, options) {
16270
16288
  return projectRoleTurnRequest(
16271
16289
  admitted,
@@ -16407,14 +16425,19 @@ async function runPublicNotaryResume(request, env, io) {
16407
16425
  }
16408
16426
  return loaded;
16409
16427
  },
16410
- buildTurnRequest: (admitted, effective) => (
16411
- // #755: review continuation is plain dialogue / resume envelope — no
16412
- //「重新读」candidate line, no engine handbook packaging.
16413
- buildNotaryTurnRequest(
16428
+ buildTurnRequest: (admitted, effective) => {
16429
+ const projection = resumeTurnRequestProjectionOptions(
16414
16430
  admitted,
16415
- resumeTurnRequestProjectionOptions(admitted, effective, env)
16416
- )
16417
- ),
16431
+ effective,
16432
+ env
16433
+ );
16434
+ const candidatePath = gateSubmissionCandidatePath(admitted.sourceRunPath);
16435
+ const prompt = existsSync9(candidatePath) ? appendResumeMaterialReread(projection.continuation.prompt, candidatePath) : projection.continuation.prompt;
16436
+ return buildNotaryTurnRequest(admitted, {
16437
+ ...projection,
16438
+ continuation: { kind: "resume", prompt }
16439
+ });
16440
+ },
16418
16441
  adapters: notaryAdapters(),
16419
16442
  ...env.engine === void 0 ? {} : { effectiveEngine: env.engine }
16420
16443
  });
@@ -16422,6 +16445,7 @@ async function runPublicNotaryResume(request, env, io) {
16422
16445
  var init_notary_run = __esm({
16423
16446
  "src/public-cli/notary-run.ts"() {
16424
16447
  "use strict";
16448
+ init_auditor_dossier_tool();
16425
16449
  init_notary_source_run();
16426
16450
  init_engine_material();
16427
16451
  init_cli_errors();
@@ -17111,7 +17135,7 @@ __export(public_role_summons_exports, {
17111
17135
  summonGateOfficer: () => summonGateOfficer,
17112
17136
  summonPublicRole: () => summonPublicRole
17113
17137
  });
17114
- import { existsSync as existsSync9 } from "node:fs";
17138
+ import { existsSync as existsSync10 } from "node:fs";
17115
17139
  import { join as join26 } from "node:path";
17116
17140
  function createCapturingIo() {
17117
17141
  const chunks = [];
@@ -17135,7 +17159,7 @@ function parentDir(path) {
17135
17159
  function walkPackageRoot(start) {
17136
17160
  let dir = start;
17137
17161
  for (let i = 0; i < 12; i += 1) {
17138
- if (existsSync9(join26(dir, "package.json")) && existsSync9(join26(dir, "souls"))) {
17162
+ if (existsSync10(join26(dir, "package.json")) && existsSync10(join26(dir, "souls"))) {
17139
17163
  return dir;
17140
17164
  }
17141
17165
  const parent = parentDir(dir);
@@ -17745,7 +17769,7 @@ __export(archivist_record_entry_exports, {
17745
17769
  createRecordSessionOpen: () => createRecordSessionOpen,
17746
17770
  subjectKeyedRecordDirectory: () => subjectKeyedRecordDirectory
17747
17771
  });
17748
- import { existsSync as existsSync10, mkdirSync as mkdirSync4, readFileSync as readFileSync3, realpathSync as realpathSync2, writeFileSync as writeFileSync5 } from "node:fs";
17772
+ import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync3, realpathSync as realpathSync2, writeFileSync as writeFileSync5 } from "node:fs";
17749
17773
  import { dirname as dirname13, resolve as resolve13, join as join28 } from "node:path";
17750
17774
  import { SessionManager } from "@earendil-works/pi-coding-agent";
17751
17775
  function readCurrentSession(sessionDir) {
@@ -17828,7 +17852,7 @@ function createRecordSessionOpen(options) {
17828
17852
  sessionDir = physicallyContainedIn(ledgerHome, parentResolved) ? join28(dirname13(parentResolved), options.kind) : join28(activationBookDirectory(ledgerHome, resolveBookKeyFromGit(cwd)), options.kind);
17829
17853
  parentSession = parentFile;
17830
17854
  }
17831
- const nestAlreadyExists = existsSync10(sessionDir);
17855
+ const nestAlreadyExists = existsSync11(sessionDir);
17832
17856
  ensureRealDirectoryTree(ledgerHome, sessionDir);
17833
17857
  const mayResumeSameNest = options.subject !== void 0 || options.kind === WORKER_SUBMISSION_GATE_KIND;
17834
17858
  if (mayResumeSameNest && nestAlreadyExists) {
@@ -17846,7 +17870,7 @@ function createRecordSessionOpen(options) {
17846
17870
  );
17847
17871
  if (session.isPersisted()) {
17848
17872
  const file = session.getSessionFile();
17849
- if (file !== void 0 && !existsSync10(file)) {
17873
+ if (file !== void 0 && !existsSync11(file)) {
17850
17874
  const header = session.getHeader();
17851
17875
  if (header !== null && header.type === "session") {
17852
17876
  writeFileSync5(file, `${JSON.stringify(header)}
@@ -21165,7 +21189,7 @@ var init_reviewer_role = __esm({
21165
21189
 
21166
21190
  // src/worker-submission-gates.ts
21167
21191
  import { execFileSync as execFileSync3 } from "node:child_process";
21168
- import { existsSync as existsSync11, lstatSync as lstatSync3, readdirSync as readdirSync2, readFileSync as readFileSync5, rmdirSync, rmSync } from "node:fs";
21192
+ import { existsSync as existsSync12, lstatSync as lstatSync3, readdirSync as readdirSync2, readFileSync as readFileSync5, rmdirSync, rmSync } from "node:fs";
21169
21193
  import { resolve as resolve18 } from "node:path";
21170
21194
  function git2(cwd, args) {
21171
21195
  return execFileSync3("git", args, {
@@ -21186,7 +21210,7 @@ function statusOf(error) {
21186
21210
  return typeof error === "object" && error !== null && "status" in error ? error.status : void 0;
21187
21211
  }
21188
21212
  function tryGetAll(file, key) {
21189
- if (!existsSync11(file)) return [];
21213
+ if (!existsSync12(file)) return [];
21190
21214
  try {
21191
21215
  const out = gitFile(file, ["--get-all", key]);
21192
21216
  return out.length === 0 ? [] : out.split("\n");
@@ -21196,7 +21220,7 @@ function tryGetAll(file, key) {
21196
21220
  }
21197
21221
  }
21198
21222
  function ownedHook(path) {
21199
- if (!existsSync11(path)) return false;
21223
+ if (!existsSync12(path)) return false;
21200
21224
  return readFileSync5(path, "utf8").includes(HOOK_MARKER);
21201
21225
  }
21202
21226
  function escapeGitConfigValueRegex(value) {
@@ -21223,11 +21247,11 @@ function rmOwnedDir(dir) {
21223
21247
  const hookPath = resolve18(dir, HOOK_FILE);
21224
21248
  if (!ownedHook(hookPath)) return;
21225
21249
  rmSync(hookPath, { force: true });
21226
- if (existsSync11(dir) && readdirSync2(dir).length === 0) rmdirSync(dir);
21250
+ if (existsSync12(dir) && readdirSync2(dir).length === 0) rmdirSync(dir);
21227
21251
  }
21228
21252
  function linkedGitDirs(commonDir) {
21229
21253
  const root = resolve18(commonDir, "worktrees");
21230
- if (!existsSync11(root)) return [];
21254
+ if (!existsSync12(root)) return [];
21231
21255
  return readdirSync2(root).map((name) => resolve18(root, name)).filter((dir) => lstatSync3(dir).isDirectory());
21232
21256
  }
21233
21257
  function uninstallPackageWorkerHooks(cwd) {
@@ -1,13 +1,16 @@
1
1
  /**
2
2
  * 系统随案递送本票起居录的中立指针段(ADR 0081 `automatic-case-material`;
3
+ * #709 公共入口通用递送与 #742 给事中受理链路同源;
3
4
  * 指针输入沿 ADR 0079 `summons-pointer-input`,不把卷宗正文塞进提示词)。
4
5
  * 只读已有案卷:不刷新、不生成、不校验内容、不新增拒收或停工条件。
5
6
  * 机器文本仅中立标识材料(ADR 0073),用途说明归角色材料所有。
7
+ *
8
+ * 递送挂载点唯一:`post-admission` 在 beforeDispatch 之后为每个公共入口追加本段。
6
9
  */
7
10
  import { stat } from "node:fs/promises";
8
11
  import { resolveTicketProvenanceVolume } from "../ticket-provenance.js";
9
- /** Section heading of the system-delivered dossier pointer. */
10
- export const CASE_DOSSIER_SECTION_HEADING = "## 本票起居录(系统随案提供)";
12
+ /** Section heading of the system-delivered dossier pointer (presentation only). */
13
+ const CASE_DOSSIER_SECTION_HEADING = "## 本票起居录(系统随案提供)";
11
14
  /** Honest one-line state of one dossier file: present, absent, or unreadable. */
12
15
  async function describeDossierFile(path) {
13
16
  try {