@akagilnc/pi-workflow-roles 0.1.4887 → 0.1.4905

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.
@@ -14649,13 +14649,16 @@ async function rewriteOfficerPointerFile(path7, rewrites) {
14649
14649
  const page = JSON.parse(await readFile2(path7, "utf8"));
14650
14650
  if (!isPlainObject(page)) return;
14651
14651
  if (page.kind !== "direct-officer-run-pointer") return;
14652
+ const before = JSON.stringify(page);
14652
14653
  rewriteRunDirectoryPathFieldsAgainstRewrites(
14653
14654
  page,
14654
14655
  OFFICER_POINTER_FIELDS,
14655
14656
  rewrites
14656
14657
  );
14657
- await writeFile(path7, `${JSON.stringify(page)}
14658
+ if (JSON.stringify(page) !== before) {
14659
+ await writeFile(path7, `${JSON.stringify(page)}
14658
14660
  `, "utf8");
14661
+ }
14659
14662
  }
14660
14663
  async function rewriteSitianRecordsJsonl(path7, rewrites) {
14661
14664
  if (!existsSync(path7)) return;
@@ -14802,28 +14805,27 @@ async function rewriteRoleRunDurablePages(input) {
14802
14805
  const admittedPath = join4(pagesDirectory, "admitted-request.json");
14803
14806
  if (existsSync(admittedPath)) {
14804
14807
  const page = JSON.parse(await readFile2(admittedPath, "utf8"));
14808
+ const before = JSON.stringify(page);
14805
14809
  rewriteAdmittedRoleRunPage(page, rewrites);
14806
- await writeFile(admittedPath, `${JSON.stringify(page, null, 2)}
14810
+ if (JSON.stringify(page) !== before) {
14811
+ await writeFile(admittedPath, `${JSON.stringify(page, null, 2)}
14807
14812
  `, "utf8");
14813
+ }
14808
14814
  }
14809
14815
  const invocationPath = join4(pagesDirectory, "invocation.json");
14810
14816
  if (existsSync(invocationPath)) {
14811
14817
  const page = JSON.parse(await readFile2(invocationPath, "utf8"));
14812
- rewriteRunDirectoryPathFieldsAgainstRewrites(
14813
- page,
14814
- INVOCATION_PAGE_FIELDS,
14815
- rewrites
14816
- );
14817
- await writeFile(
14818
- invocationPath,
14819
- `${JSON.stringify(page, null, 2)}
14820
- `,
14821
- "utf8"
14822
- );
14818
+ const before = JSON.stringify(page);
14819
+ rewriteRunDirectoryPathFieldsAgainstRewrites(page, INVOCATION_PAGE_FIELDS, rewrites);
14820
+ if (JSON.stringify(page) !== before) {
14821
+ await writeFile(invocationPath, `${JSON.stringify(page, null, 2)}
14822
+ `, "utf8");
14823
+ }
14823
14824
  }
14824
14825
  const statePath = join4(pagesDirectory, "run-state.json");
14825
14826
  if (existsSync(statePath)) {
14826
14827
  const page = JSON.parse(await readFile2(statePath, "utf8"));
14828
+ const before = JSON.stringify(page);
14827
14829
  rewriteRunDirectoryPathFieldsAgainstRewrites(
14828
14830
  page,
14829
14831
  RUN_STATE_PAGE_FIELDS,
@@ -14839,8 +14841,10 @@ async function rewriteRoleRunDurablePages(input) {
14839
14841
  if (isPlainObject(page.currentCourt)) {
14840
14842
  rewriteSummonsMaterials(page.currentCourt.summons, rewrites);
14841
14843
  }
14842
- await writeFile(statePath, `${JSON.stringify(page, null, 2)}
14844
+ if (JSON.stringify(page) !== before) {
14845
+ await writeFile(statePath, `${JSON.stringify(page, null, 2)}
14843
14846
  `, "utf8");
14847
+ }
14844
14848
  }
14845
14849
  await rewriteNestedMachinePathPages(pagesDirectory, rewrites);
14846
14850
  }
@@ -279872,8 +279876,7 @@ async function relocateBoardBoundUnboundRunsInBook(bookDirectory) {
279872
279876
  ticketNumber: move.ticketNumber
279873
279877
  }));
279874
279878
  }
279875
- async function relocateBoardBoundUnboundRunsInBooks(booksDirectory, env2 = process.env) {
279876
- await assertBookTopologyMigrationPrerequisites(booksDirectory, env2);
279879
+ async function relocateBoardBoundUnboundRunsInBooks(booksDirectory) {
279877
279880
  const relocated = [];
279878
279881
  for (const bookKey of await listMigrationBookKeys(booksDirectory)) {
279879
279882
  const batch = await relocateBoardBoundUnboundRunsInBook(
@@ -155,8 +155,11 @@ async function rewriteOfficerPointerFile(path, rewrites) {
155
155
  // Only the typed direct-officer pointer shape — never arbitrary .pointer.json.
156
156
  if (page.kind !== "direct-officer-run-pointer")
157
157
  return;
158
+ const before = JSON.stringify(page);
158
159
  rewriteRunDirectoryPathFieldsAgainstRewrites(page, OFFICER_POINTER_FIELDS, rewrites);
159
- await writeFile(path, `${JSON.stringify(page)}\n`, "utf8");
160
+ if (JSON.stringify(page) !== before) {
161
+ await writeFile(path, `${JSON.stringify(page)}\n`, "utf8");
162
+ }
160
163
  }
161
164
  async function rewriteSitianRecordsJsonl(path, rewrites) {
162
165
  if (!existsSync(path))
@@ -320,18 +323,25 @@ export async function rewriteRoleRunDurablePages(input) {
320
323
  const admittedPath = join(pagesDirectory, "admitted-request.json");
321
324
  if (existsSync(admittedPath)) {
322
325
  const page = JSON.parse(await readFile(admittedPath, "utf8"));
326
+ const before = JSON.stringify(page);
323
327
  rewriteAdmittedRoleRunPage(page, rewrites);
324
- await writeFile(admittedPath, `${JSON.stringify(page, null, 2)}\n`, "utf8");
328
+ if (JSON.stringify(page) !== before) {
329
+ await writeFile(admittedPath, `${JSON.stringify(page, null, 2)}\n`, "utf8");
330
+ }
325
331
  }
326
332
  const invocationPath = join(pagesDirectory, "invocation.json");
327
333
  if (existsSync(invocationPath)) {
328
334
  const page = JSON.parse(await readFile(invocationPath, "utf8"));
335
+ const before = JSON.stringify(page);
329
336
  rewriteRunDirectoryPathFieldsAgainstRewrites(page, INVOCATION_PAGE_FIELDS, rewrites);
330
- await writeFile(invocationPath, `${JSON.stringify(page, null, 2)}\n`, "utf8");
337
+ if (JSON.stringify(page) !== before) {
338
+ await writeFile(invocationPath, `${JSON.stringify(page, null, 2)}\n`, "utf8");
339
+ }
331
340
  }
332
341
  const statePath = join(pagesDirectory, "run-state.json");
333
342
  if (existsSync(statePath)) {
334
343
  const page = JSON.parse(await readFile(statePath, "utf8"));
344
+ const before = JSON.stringify(page);
335
345
  rewriteRunDirectoryPathFieldsAgainstRewrites(page, RUN_STATE_PAGE_FIELDS, rewrites);
336
346
  if (isPlainObject(page.principal)) {
337
347
  rewriteRunDirectoryPathFieldsAgainstRewrites(page.principal, ["sessionDirectory", "sessionFile"], rewrites);
@@ -340,7 +350,9 @@ export async function rewriteRoleRunDurablePages(input) {
340
350
  if (isPlainObject(page.currentCourt)) {
341
351
  rewriteSummonsMaterials(page.currentCourt.summons, rewrites);
342
352
  }
343
- await writeFile(statePath, `${JSON.stringify(page, null, 2)}\n`, "utf8");
353
+ if (JSON.stringify(page) !== before) {
354
+ await writeFile(statePath, `${JSON.stringify(page, null, 2)}\n`, "utf8");
355
+ }
344
356
  }
345
357
  await rewriteNestedMachinePathPages(pagesDirectory, rewrites);
346
358
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akagilnc/pi-workflow-roles",
3
- "version": "0.1.4887",
3
+ "version": "0.1.4905",
4
4
  "description": "Soul-bound workflow roles for Pi",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -17,7 +17,7 @@ finding 提**类别**;实例只作证据。一次找齐全,不逐轮抽样
17
17
 
18
18
  御批门槛:重大决策、设计、改变实际行为的机制与约束须合法。实现细节(字段名、内部形状、修法选择等)依现行法源成立即可,不因无逐字原话驳回。
19
19
 
20
- 判断不收敛(同类问题反复、修理只增不减)可上呈。修理 diff 自身按同尺复核。
20
+ 判断不收敛(同类问题反复、修理只增不减)可上呈;你的打回与上一轮相同、对方重交只换措辞,须上呈,不得再打回。修理 diff 自身按同尺复核。
21
21
 
22
22
  ## 取证边界(owner 2026-09-05)
23
23
 
@@ -1,26 +1,11 @@
1
1
  # 审刑院 Soul
2
2
 
3
- 你是审刑院。你的职责有三件:
3
+ 你是审刑院,审大理寺的判词,不审施工。判词里每一条承重事实、每一句「已核」,你都要亲自打开源头核一遍——核的是判词说的对不对,不是施工做完没有。一份判词只有三种错,按序查:
4
4
 
5
- 一、验权——大理寺收到的派单,有没有超出陛下的原话。
6
- 二、把关——该查的查了没有,结论写下来没有。
7
- 三、执法——大理寺的输入与输出与法源有没有冲突。
5
+ 一、错署——署了,但票面有要求未做到、有票面外之物未处置、或判词称「已核」「已真跑」而卷宗里没有命令与结果(尺是《质量法》:变异真跑、复杂度账)。
6
+ 二、错封——封驳或所加约束指不出法源,或超出票面与陛下的话。
7
+ 三、事实错——判词所引代码事实、法源引文与源头不符。
8
8
 
9
- 调卷宗:你的卷落在被审 run 的卷宗之内,工作树看 cwd,卷宗从自身落卷
10
- 位置向上取
9
+ 三者皆无即 pass,一轮了结。判词少写一句而事实立得住,不是错;施工没做完,是大理寺封驳的理由,不是你打回判词的理由。打回与上一轮相同、对方只换措辞重交,上呈。
11
10
 
12
- 大理寺的一切输入和输出必查违宪审查与票面范围检查:票面全部内容逐项对既裁法源(ADR、铁律)
13
- 对表;引用不等于适用,判词须以从法源和票面与一手证据独立重推的双向抽样(误删与该删未删
14
- 同查)为证。
15
-
16
- 大理寺是否核过**实现与需求相符——多与少都是缺陷**:票面要求而未做到的,以及票面未要求
17
- 而自作主张的(夹带的默认值、护栏、平行机制、仅测试用的生产钩子同论),二者在判词中均无
18
- 处置即为缺证。且处置必须符合事实且不违法!每一条你都要独立验证。
19
-
20
- 复杂度:判词是否核过本次计划与修改的复杂度账(删码/简化优先、三问);该核未核,或核的
21
- 结论有明确事实反证,均为缺证。
22
-
23
- 测试质量:核验判词是否完成测试质量亲审且证据成立;该核未核,或核的结论有明确事实反证,均为缺证。准绳唯 quality-law。
24
-
25
- 合规则 `pass`;缺证或明确违反 Soul 则 `bounce`,逐条指出违反的条目以及你查到的原因;
26
- 冲突导致无法判断合规时,提交 `escalate` 并写明问题和可选项。
11
+ 调卷宗与取证、纪律依《审刑院法典》。合规则 `pass`;有错则 `bounce`,逐条指出是哪一种错和你查到的原因;无法判断时 `escalate`。
@@ -17,7 +17,6 @@ import {
17
17
  resolveMigratingRunTicket,
18
18
  } from "./book-topology-migration-placement.ts";
19
19
  import {
20
- assertBookTopologyMigrationPrerequisites,
21
20
  reconcileMigrationPartition,
22
21
  type BookTopologyMigrationContext,
23
22
  type BookTopologyPartitionMigrator,
@@ -378,13 +377,11 @@ export async function relocateBoardBoundUnboundRunsInBook(
378
377
 
379
378
  /**
380
379
  * Walk every book under `booksDirectory` and relocate board-bound unbound
381
- * runs in place. Requires zero live writer locks (same gate as topology migrate).
380
+ * runs in place without the whole-books topology migration's in-flight gate.
382
381
  */
383
382
  export async function relocateBoardBoundUnboundRunsInBooks(
384
383
  booksDirectory: string,
385
- env: NodeJS.ProcessEnv = process.env,
386
384
  ): Promise<readonly BoardBoundUnboundRelocation[]> {
387
- await assertBookTopologyMigrationPrerequisites(booksDirectory, env);
388
385
  const relocated: BoardBoundUnboundRelocation[] = [];
389
386
  for (const bookKey of await listMigrationBookKeys(booksDirectory)) {
390
387
  const batch = await relocateBoardBoundUnboundRunsInBook(
@@ -227,12 +227,15 @@ async function rewriteOfficerPointerFile(
227
227
  if (!isPlainObject(page)) return;
228
228
  // Only the typed direct-officer pointer shape — never arbitrary .pointer.json.
229
229
  if (page.kind !== "direct-officer-run-pointer") return;
230
+ const before = JSON.stringify(page);
230
231
  rewriteRunDirectoryPathFieldsAgainstRewrites(
231
232
  page,
232
233
  OFFICER_POINTER_FIELDS,
233
234
  rewrites,
234
235
  );
235
- await writeFile(path, `${JSON.stringify(page)}\n`, "utf8");
236
+ if (JSON.stringify(page) !== before) {
237
+ await writeFile(path, `${JSON.stringify(page)}\n`, "utf8");
238
+ }
236
239
  }
237
240
 
238
241
  async function rewriteSitianRecordsJsonl(
@@ -422,26 +425,21 @@ export async function rewriteRoleRunDurablePages(input: {
422
425
  string,
423
426
  unknown
424
427
  >;
428
+ const before = JSON.stringify(page);
425
429
  rewriteAdmittedRoleRunPage(page, rewrites);
426
- await writeFile(admittedPath, `${JSON.stringify(page, null, 2)}\n`, "utf8");
430
+ if (JSON.stringify(page) !== before) {
431
+ await writeFile(admittedPath, `${JSON.stringify(page, null, 2)}\n`, "utf8");
432
+ }
427
433
  }
428
434
 
429
435
  const invocationPath = join(pagesDirectory, "invocation.json");
430
436
  if (existsSync(invocationPath)) {
431
- const page = JSON.parse(await readFile(invocationPath, "utf8")) as Record<
432
- string,
433
- unknown
434
- >;
435
- rewriteRunDirectoryPathFieldsAgainstRewrites(
436
- page,
437
- INVOCATION_PAGE_FIELDS,
438
- rewrites,
439
- );
440
- await writeFile(
441
- invocationPath,
442
- `${JSON.stringify(page, null, 2)}\n`,
443
- "utf8",
444
- );
437
+ const page = JSON.parse(await readFile(invocationPath, "utf8")) as Record<string, unknown>;
438
+ const before = JSON.stringify(page);
439
+ rewriteRunDirectoryPathFieldsAgainstRewrites(page, INVOCATION_PAGE_FIELDS, rewrites);
440
+ if (JSON.stringify(page) !== before) {
441
+ await writeFile(invocationPath, `${JSON.stringify(page, null, 2)}\n`, "utf8");
442
+ }
445
443
  }
446
444
 
447
445
  const statePath = join(pagesDirectory, "run-state.json");
@@ -450,6 +448,7 @@ export async function rewriteRoleRunDurablePages(input: {
450
448
  string,
451
449
  unknown
452
450
  >;
451
+ const before = JSON.stringify(page);
453
452
  rewriteRunDirectoryPathFieldsAgainstRewrites(
454
453
  page,
455
454
  RUN_STATE_PAGE_FIELDS,
@@ -466,7 +465,9 @@ export async function rewriteRoleRunDurablePages(input: {
466
465
  if (isPlainObject(page.currentCourt)) {
467
466
  rewriteSummonsMaterials(page.currentCourt.summons, rewrites);
468
467
  }
469
- await writeFile(statePath, `${JSON.stringify(page, null, 2)}\n`, "utf8");
468
+ if (JSON.stringify(page) !== before) {
469
+ await writeFile(statePath, `${JSON.stringify(page, null, 2)}\n`, "utf8");
470
+ }
470
471
  }
471
472
 
472
473
  await rewriteNestedMachinePathPages(pagesDirectory, rewrites);