@akagilnc/pi-workflow-roles 0.1.5406 → 0.1.5462

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.
Files changed (65) hide show
  1. package/README.md +2 -2
  2. package/README.zh-CN.md +2 -2
  3. package/dist/acp-host/production-host.js +8261 -9073
  4. package/dist/compliance-transport.js +2 -5
  5. package/dist/engine-detour-usage.js +3 -30
  6. package/dist/gatekeeper-role.js +4 -18
  7. package/dist/headless-host/description.js +0 -209
  8. package/dist/headless-host/production-host.js +6972 -8034
  9. package/dist/host-contracts.js +8 -0
  10. package/dist/migrate-book-topology.js +29 -26
  11. package/dist/packaged-role-registry.js +1 -9
  12. package/dist/pi/role-turn-host.js +37 -19
  13. package/dist/public-cli/auto-resume.js +29 -66
  14. package/dist/public-cli/countersign-run.js +4 -18
  15. package/dist/public-cli/instruction-seat-run.js +59 -76
  16. package/dist/public-cli/main.js +9844 -10720
  17. package/dist/public-cli/post-admission.js +204 -285
  18. package/dist/public-cli/process-cancel.js +8 -0
  19. package/dist/public-cli/run-lifecycle.js +24 -94
  20. package/dist/public-cli/settlement.js +614 -1524
  21. package/dist/public-cli/terminal.js +23 -53
  22. package/dist/public-role-summons.js +3 -8
  23. package/dist/receipt-delivery-policy.js +11 -12
  24. package/dist/run-terminal-artifacts.js +19 -14
  25. package/dist/serialize-thrown-value.js +7 -1
  26. package/dist/submission-ledger.js +21 -89
  27. package/package.json +1 -1
  28. package/scripts/build-package.mjs +0 -2
  29. package/src/acp-host/role-turn-host.ts +168 -75
  30. package/src/compliance-transport.ts +3 -6
  31. package/src/engine-detour-usage.ts +3 -33
  32. package/src/external-host-turn-loop.ts +81 -36
  33. package/src/gatekeeper-role.ts +5 -20
  34. package/src/headless-host/description.ts +4 -214
  35. package/src/headless-host/production-host.ts +2 -1
  36. package/src/headless-host/role-turn-host.ts +153 -186
  37. package/src/host-contracts.ts +13 -10
  38. package/src/navigator-public-session.ts +1 -1
  39. package/src/navigator-session-contracts.ts +1 -1
  40. package/src/packaged-role-registry.ts +2 -10
  41. package/src/pi/adapter.ts +0 -3
  42. package/src/pi/role-turn-host.ts +42 -28
  43. package/src/prepared-role-turn.ts +2 -0
  44. package/src/public-cli/auto-resume.ts +27 -66
  45. package/src/public-cli/countersign-run.ts +4 -22
  46. package/src/public-cli/instruction-seat-run.ts +79 -80
  47. package/src/public-cli/post-admission.ts +264 -340
  48. package/src/public-cli/process-cancel.ts +9 -0
  49. package/src/public-cli/run-lifecycle.ts +25 -126
  50. package/src/public-cli/settlement.ts +792 -1912
  51. package/src/public-cli/terminal.ts +29 -69
  52. package/src/public-role-summons.ts +3 -8
  53. package/src/receipt-delivery-policy.ts +11 -12
  54. package/src/role-envelope.ts +16 -9
  55. package/src/role-runtime.ts +14 -81
  56. package/src/run-terminal-artifacts.ts +21 -17
  57. package/src/serialize-thrown-value.ts +7 -1
  58. package/src/submission-ledger.ts +30 -116
  59. package/dist/audit-escalation.js +0 -7
  60. package/dist/pi/known-failure.js +0 -51
  61. package/dist/typed-provider-http.js +0 -57
  62. package/dist/upstream-error-testimony.js +0 -19
  63. package/src/pi/known-failure.ts +0 -76
  64. package/src/typed-provider-http.ts +0 -89
  65. package/src/upstream-error-testimony.ts +0 -45
package/README.md CHANGED
@@ -23,9 +23,9 @@ Publish routing (Actions, not local stamp): successful `ci` push on the reposito
23
23
  ak-role judge --model <provider/model[:thinking]> --attach ./plan.md "Review this plan." > result.txt
24
24
  ```
25
25
 
26
- Exit status reports lifecycle honesty, not business success: every lawful typed result (including `audit_escalation`) exits zero; a failure without a lawful result exits nonzero, and its Terminal carries the Error Artifact ref and original cause instead of a fabricated receipt.
26
+ Exit status reports lifecycle honesty, not business success: every lawful typed result (including `audit_escalation`) exits zero; a failure without a lawful result exits nonzero, and its Terminal preserves the original cause instead of a fabricated receipt. An Error Artifact ref is included only when publication succeeds; publication failures are recorded separately and do not replace the original report.
27
27
 
28
- `ak-role resume <runId> [message]` reopens that run under the **current seat table** for model / host / engine — the same resolution as starting a new leg (model: `--model` → persistent seat → officer inherit; still none → error. host: `--host` → persistent seat host → package default `pi`). Configure seats first with `ak-role config set <seat> <provider/model[:thinking]>` or pass `--model` per invocation. Standard chain after a role `escalate`s: take the owner ruling and feed it back with `ak-role resume <runId> "<ruling>"` so the same run continues to a terminal. When an audit officer escalates, resume that officer's `runId`: escalation pauses only that seat, and the remaining gates continue after it. For every callable seat, including Notary/符宝郎, the optional `message` after `runId` is passed through unchanged as the continuation prompt (opaque: not parsed as flags); when omitted, the package adds no continuation text. Notary's separate explicit `new` command still accepts only its source-run locator, not a caller prompt. Global `--model` / `--thinking` / `--host` / `--engine` override the table for that resume only — place them before `<runId>` (either before `resume` or between `resume` and `<runId>`, e.g. `ak-role --model xai/grok-4.5 resume 01abc…` or `ak-role resume --model xai/grok-4.5 01abc…`); the one argv after `<runId>` is always the opaque message, never a flag (#471). On a host switch, the package does not inject prior record paths; the role reads earlier native copies under the run dossier via its ticket provenance (ADR 0086). Pi writes `session/session.jsonl`; Codex, Claude, and Grok CLI originals are copied into the run dossier after exit. 司天台 (Sitian) appends event records. Whether to resume is the caller's decision: the command does not require a typed HTTP 429 or a `resumable` state. Unknown run IDs are rejected. Any other resume failure prints one line pointing at that attempt's error record (`续跑失败,当次错误记录:<path>`); open the file for the cause. Every callable role accepts manual resume; Countersign and Gleaner-Left gained it in #599, Collector, Doctor, Notary, and Inspector in #633.
28
+ `ak-role resume <runId> [message]` reopens that run under the **current seat table** for model / host / engine — the same resolution as starting a new leg (model: `--model` → persistent seat → officer inherit; still none → error. host: `--host` → persistent seat host → package default `pi`). Configure seats first with `ak-role config set <seat> <provider/model[:thinking]>` or pass `--model` per invocation. Standard chain after a role `escalate`s: take the owner ruling and feed it back with `ak-role resume <runId> "<ruling>"` so the same run continues to a terminal. When an audit officer escalates, resume that officer's `runId`: escalation pauses only that seat, and the remaining gates continue after it. For every callable seat, including Notary/符宝郎, the optional `message` after `runId` is passed through unchanged as the continuation prompt (opaque: not parsed as flags); when omitted, the package adds no continuation text. Notary's separate explicit `new` command still accepts only its source-run locator, not a caller prompt. Global `--model` / `--thinking` / `--host` / `--engine` override the table for that resume only — place them before `<runId>` (either before `resume` or between `resume` and `<runId>`, e.g. `ak-role --model xai/grok-4.5 resume 01abc…` or `ak-role resume --model xai/grok-4.5 01abc…`); the one argv after `<runId>` is always the opaque message, never a flag (#471). On a host switch, the package does not inject prior record paths or dossier content; the role reads prior native copies through its ticket provenance. Native dossier copying and 司天台 (Sitian) logging follow [ADR 0086](docs/adr/0086-host-dossier-is-native-file-copy-sitian-append-only.md); copy failures are recorded separately and do not change the turn outcome. Whether to resume is the caller's decision: the command does not require a typed HTTP 429 or a `resumable` state. Unknown run IDs are rejected. When a resume failure has a published error record, stderr points to it (`续跑失败,当次错误记录:<path>`). If publication fails, the original failure and publication error are reported without claiming that a file was delivered. Every callable role accepts manual resume; Countersign and Gleaner-Left gained it in #599, Collector, Doctor, Notary, and Inspector in #633.
29
29
 
30
30
  All callable roles also retry a non-lawful LLM call in place (same `runId` and session) up to `autoResumeLimit` times. Unset defaults to 2; `ak-role config set-auto-resume-limit <N>` writes the ceiling (`0` disables). Lawful typed terminals (`accepted`, `audit_escalation`, `no_receipt`) stop immediately. Manual `ak-role resume` stays available.
31
31
 
package/README.zh-CN.md CHANGED
@@ -23,9 +23,9 @@ export PATH="$HOME/.pi/agent/npm/node_modules/.bin:$PATH"
23
23
  ak-role judge --model <provider/model[:thinking]> --attach ./plan.md "Review this plan." > result.txt
24
24
  ```
25
25
 
26
- 退出码报的是生命周期诚实,不是业务成败:一切合法 typed 终态(含 `audit_escalation`)退出零;无合法终态的失败退出非零,其 Terminal 携带 Error Artifact 引用与原始原因,不伪造回执。
26
+ 退出码报的是生命周期诚实,不是业务成败:一切合法 typed 终态(含 `audit_escalation`)退出零;无合法终态的失败退出非零,其 Terminal 保留原始原因,不伪造回执。Error Artifact 发布成功时才携带引用;发布失败独立留痕,不替换宿主原报。
27
27
 
28
- `ak-role resume <runId> [message]` 按**现行席位表**的 model / host / engine 续跑该次运行——与新起角色腿同一解析(model:`--model` → 席位持久 → 官席继承;仍无则报错。host:`--host` → 席位持久 host → 包默认 `pi`)。先 `ak-role config set <seat> <provider/model[:thinking]>` 配席,或逐次带 `--model`。角色 `escalate`(直通御前)后拿到 owner 裁定,标准续跑是 `ak-role resume <runId> "<裁定>"`——把裁定喂回同一 run,角色继续走到终局。上呈的是审核官时,resume 该官的 runId:上呈只暂停这一席,其后的闸照常接着走。所有可调用席位(包括 Notary/符宝郎)都会将 `runId` 后可选的 `message` 原样作为续跑 prompt(opaque:不进全局旗标语法);省略时包不会添加续跑文本。Notary 另行的显式 `new` 命令仍只接受 source-run locator,不接受 caller prompt。全局 `--model` / `--thinking` / `--host` / `--engine` 仅覆盖本次 resume——须置于 `<runId>` 之前(放 `resume` 之前或 `resume` 与 `<runId>` 之间均可,例如 `ak-role --model xai/grok-4.5 resume 01abc…` 或 `ak-role resume --model xai/grok-4.5 01abc…`);`<runId>` 之后的那一个 argv 恒为原样透传的 message,绝非旗位(#471)。真实换宿主时(现行席位 host 与上一次 invocation host 不同),将前序宿主原生卷宗一次性作为 context 交付目标宿主;同宿主续跑不重复注入。各宿主仅直写自身原生卷宗(Pi:`session/session.jsonl`;Grok CLI 原始会话留在操作员 grok 家,工厂卷宗为该 run 的司天台记录),统一账目归入司天台。要不要续跑由调用者决定:不再要求 typed HTTP 429,也不要求 `resumable` 状态。未知 run ID 则拒绝;其余续跑失败只输出一行指向当次错误记录的指针(`续跑失败,当次错误记录:<path>`),原因看该文件。所有可调用角色均可手动 resume:给事中、左拾遗始于 #599,通进司、太医署、符宝郎、台院始于 #633。
28
+ `ak-role resume <runId> [message]` 按**现行席位表**的 model / host / engine 续跑该次运行——与新起角色腿同一解析(model:`--model` → 席位持久 → 官席继承;仍无则报错。host:`--host` → 席位持久 host → 包默认 `pi`)。先 `ak-role config set <seat> <provider/model[:thinking]>` 配席,或逐次带 `--model`。角色 `escalate`(直通御前)后拿到 owner 裁定,标准续跑是 `ak-role resume <runId> "<裁定>"`——把裁定喂回同一 run,角色继续走到终局。上呈的是审核官时,resume 该官的 runId:上呈只暂停这一席,其后的闸照常接着走。所有可调用席位(包括 Notary/符宝郎)都会将 `runId` 后可选的 `message` 原样作为续跑 prompt(opaque:不进全局旗标语法);省略时包不会添加续跑文本。Notary 另行的显式 `new` 命令仍只接受 source-run locator,不接受 caller prompt。全局 `--model` / `--thinking` / `--host` / `--engine` 仅覆盖本次 resume——须置于 `<runId>` 之前(放 `resume` 之前或 `resume` 与 `<runId>` 之间均可,例如 `ak-role --model xai/grok-4.5 resume 01abc…` 或 `ak-role resume --model xai/grok-4.5 01abc…`);`<runId>` 之后的那一个 argv 恒为原样透传的 message,绝非旗位(#471)。换宿主时,包不注入前序记录路径或卷宗正文;角色凭票号沿起居录自行读取前序原生副本。原生卷宗复制与司天台日志遵循 [ADR 0086](docs/adr/0086-host-dossier-is-native-file-copy-sitian-append-only.md);复制失败独立记录,不改变腿的终局。要不要续跑由调用者决定:不再要求 typed HTTP 429,也不要求 `resumable` 状态。未知 run ID 则拒绝;续跑失败有已发布错误记录时,stderr 给出指针(`续跑失败,当次错误记录:<path>`);发布失败则如实呈现原始失败与发布异常,不冒称文件已交付。所有可调用角色均可手动 resume:给事中、左拾遗始于 #599,通进司、太医署、符宝郎、台院始于 #633。
29
29
 
30
30
  全部可调用角色在单次调用内对非 lawful LLM 终态原地续跑(同一 `runId` 与 session),次数上限为 `autoResumeLimit`。缺键默认 2;`ak-role config set-auto-resume-limit <N>` 写入(`0` 关闭自动续)。lawful typed 终态(`accepted` / `audit_escalation` / `no_receipt`)立即停止。手动 `ak-role resume` 仍可用。
31
31