@principles/core 1.271.0 → 1.272.0

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 (134) hide show
  1. package/dist/runtime-v2/__tests__/admission-gate.test.js +23 -6
  2. package/dist/runtime-v2/__tests__/admission-gate.test.js.map +1 -1
  3. package/dist/runtime-v2/__tests__/adversarial-loop.test.js +22 -0
  4. package/dist/runtime-v2/__tests__/adversarial-loop.test.js.map +1 -1
  5. package/dist/runtime-v2/__tests__/context-payload-validation.test.js +1 -1
  6. package/dist/runtime-v2/__tests__/context-payload-validation.test.js.map +1 -1
  7. package/dist/runtime-v2/__tests__/evidence-guards.test.js +2 -2
  8. package/dist/runtime-v2/__tests__/evidence-guards.test.js.map +1 -1
  9. package/dist/runtime-v2/__tests__/golden-path-diagnostician-e2e.test.js +1 -1
  10. package/dist/runtime-v2/__tests__/golden-path-diagnostician-e2e.test.js.map +1 -1
  11. package/dist/runtime-v2/__tests__/governance-experience.test.js +19 -0
  12. package/dist/runtime-v2/__tests__/governance-experience.test.js.map +1 -1
  13. package/dist/runtime-v2/__tests__/pain-evidence-contract.test.js +3 -3
  14. package/dist/runtime-v2/__tests__/pain-evidence-contract.test.js.map +1 -1
  15. package/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js +1 -1
  16. package/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js.map +1 -1
  17. package/dist/runtime-v2/__tests__/rollout-rule-candidate-contract.test.d.ts +2 -0
  18. package/dist/runtime-v2/__tests__/rollout-rule-candidate-contract.test.d.ts.map +1 -0
  19. package/dist/runtime-v2/__tests__/rollout-rule-candidate-contract.test.js +243 -0
  20. package/dist/runtime-v2/__tests__/rollout-rule-candidate-contract.test.js.map +1 -0
  21. package/dist/runtime-v2/admission-gate.d.ts +8 -1
  22. package/dist/runtime-v2/admission-gate.d.ts.map +1 -1
  23. package/dist/runtime-v2/admission-gate.js +14 -0
  24. package/dist/runtime-v2/admission-gate.js.map +1 -1
  25. package/dist/runtime-v2/context-payload.d.ts +9 -3
  26. package/dist/runtime-v2/context-payload.d.ts.map +1 -1
  27. package/dist/runtime-v2/context-payload.js +3 -1
  28. package/dist/runtime-v2/context-payload.js.map +1 -1
  29. package/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.js +2 -2
  30. package/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.js.map +1 -1
  31. package/dist/runtime-v2/evidence-triage/observation-resolver.d.ts +1 -1
  32. package/dist/runtime-v2/evidence-triage/observation-resolver.d.ts.map +1 -1
  33. package/dist/runtime-v2/evidence-triage/observation-resolver.js +2 -2
  34. package/dist/runtime-v2/evidence-triage/observation-resolver.js.map +1 -1
  35. package/dist/runtime-v2/evidence-triage/types.d.ts +1 -1
  36. package/dist/runtime-v2/evidence-triage/types.d.ts.map +1 -1
  37. package/dist/runtime-v2/evolution/evolution-types.d.ts +8 -4
  38. package/dist/runtime-v2/evolution/evolution-types.d.ts.map +1 -1
  39. package/dist/runtime-v2/evolution/evolution-types.js +3 -1
  40. package/dist/runtime-v2/evolution/evolution-types.js.map +1 -1
  41. package/dist/runtime-v2/governance-experience-contract.d.ts +16 -16
  42. package/dist/runtime-v2/governance-experience-contract.d.ts.map +1 -1
  43. package/dist/runtime-v2/governance-experience-contract.js +4 -1
  44. package/dist/runtime-v2/governance-experience-contract.js.map +1 -1
  45. package/dist/runtime-v2/governance-experience.d.ts.map +1 -1
  46. package/dist/runtime-v2/governance-experience.js +30 -8
  47. package/dist/runtime-v2/governance-experience.js.map +1 -1
  48. package/dist/runtime-v2/index.d.ts +5 -1
  49. package/dist/runtime-v2/index.d.ts.map +1 -1
  50. package/dist/runtime-v2/index.js +4 -1
  51. package/dist/runtime-v2/index.js.map +1 -1
  52. package/dist/runtime-v2/internalization/__tests__/artificer-code-bearing.test.d.ts +2 -0
  53. package/dist/runtime-v2/internalization/__tests__/artificer-code-bearing.test.d.ts.map +1 -0
  54. package/dist/runtime-v2/internalization/__tests__/artificer-code-bearing.test.js +114 -0
  55. package/dist/runtime-v2/internalization/__tests__/artificer-code-bearing.test.js.map +1 -0
  56. package/dist/runtime-v2/internalization/__tests__/evaluator-gate-authority.test.d.ts +2 -0
  57. package/dist/runtime-v2/internalization/__tests__/evaluator-gate-authority.test.d.ts.map +1 -0
  58. package/dist/runtime-v2/internalization/__tests__/evaluator-gate-authority.test.js +256 -0
  59. package/dist/runtime-v2/internalization/__tests__/evaluator-gate-authority.test.js.map +1 -0
  60. package/dist/runtime-v2/internalization/__tests__/owner-decision-review.test.d.ts +2 -0
  61. package/dist/runtime-v2/internalization/__tests__/owner-decision-review.test.d.ts.map +1 -0
  62. package/dist/runtime-v2/internalization/__tests__/owner-decision-review.test.js +229 -0
  63. package/dist/runtime-v2/internalization/__tests__/owner-decision-review.test.js.map +1 -0
  64. package/dist/runtime-v2/internalization/__tests__/owner-decision.test.js +172 -1
  65. package/dist/runtime-v2/internalization/__tests__/owner-decision.test.js.map +1 -1
  66. package/dist/runtime-v2/internalization/__tests__/rule-activation-contract.test.d.ts +2 -0
  67. package/dist/runtime-v2/internalization/__tests__/rule-activation-contract.test.d.ts.map +1 -0
  68. package/dist/runtime-v2/internalization/__tests__/rule-activation-contract.test.js +187 -0
  69. package/dist/runtime-v2/internalization/__tests__/rule-activation-contract.test.js.map +1 -0
  70. package/dist/runtime-v2/internalization/artificer-code-bearing.d.ts +39 -0
  71. package/dist/runtime-v2/internalization/artificer-code-bearing.d.ts.map +1 -0
  72. package/dist/runtime-v2/internalization/artificer-code-bearing.js +33 -0
  73. package/dist/runtime-v2/internalization/artificer-code-bearing.js.map +1 -0
  74. package/dist/runtime-v2/internalization/evaluator-runner.d.ts +11 -8
  75. package/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
  76. package/dist/runtime-v2/internalization/evaluator-runner.js +170 -31
  77. package/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
  78. package/dist/runtime-v2/internalization/index.d.ts +2 -0
  79. package/dist/runtime-v2/internalization/index.d.ts.map +1 -1
  80. package/dist/runtime-v2/internalization/index.js +1 -0
  81. package/dist/runtime-v2/internalization/index.js.map +1 -1
  82. package/dist/runtime-v2/internalization/owner-decision-review.d.ts +98 -0
  83. package/dist/runtime-v2/internalization/owner-decision-review.d.ts.map +1 -0
  84. package/dist/runtime-v2/internalization/owner-decision-review.js +287 -0
  85. package/dist/runtime-v2/internalization/owner-decision-review.js.map +1 -0
  86. package/dist/runtime-v2/internalization/owner-resolution-service.d.ts +11 -0
  87. package/dist/runtime-v2/internalization/owner-resolution-service.d.ts.map +1 -1
  88. package/dist/runtime-v2/internalization/owner-resolution-service.js +117 -4
  89. package/dist/runtime-v2/internalization/owner-resolution-service.js.map +1 -1
  90. package/dist/runtime-v2/internalization/owner-review.d.ts +4 -0
  91. package/dist/runtime-v2/internalization/owner-review.d.ts.map +1 -1
  92. package/dist/runtime-v2/internalization/owner-review.js.map +1 -1
  93. package/dist/runtime-v2/internalization/pitask-metadata.d.ts +16 -0
  94. package/dist/runtime-v2/internalization/pitask-metadata.d.ts.map +1 -1
  95. package/dist/runtime-v2/internalization/pitask-metadata.js +62 -0
  96. package/dist/runtime-v2/internalization/pitask-metadata.js.map +1 -1
  97. package/dist/runtime-v2/internalization/rollout-reviewer-runner.d.ts +13 -0
  98. package/dist/runtime-v2/internalization/rollout-reviewer-runner.d.ts.map +1 -1
  99. package/dist/runtime-v2/internalization/rollout-reviewer-runner.js +59 -11
  100. package/dist/runtime-v2/internalization/rollout-reviewer-runner.js.map +1 -1
  101. package/dist/runtime-v2/internalization/rule-activation-contract.d.ts +35 -0
  102. package/dist/runtime-v2/internalization/rule-activation-contract.d.ts.map +1 -0
  103. package/dist/runtime-v2/internalization/rule-activation-contract.js +36 -0
  104. package/dist/runtime-v2/internalization/rule-activation-contract.js.map +1 -0
  105. package/dist/runtime-v2/pain-signal-bridge.d.ts +2 -0
  106. package/dist/runtime-v2/pain-signal-bridge.d.ts.map +1 -1
  107. package/dist/runtime-v2/pain-signal-bridge.js +4 -3
  108. package/dist/runtime-v2/pain-signal-bridge.js.map +1 -1
  109. package/dist/runtime-v2/pain-to-principle-service.d.ts +1 -0
  110. package/dist/runtime-v2/pain-to-principle-service.d.ts.map +1 -1
  111. package/dist/runtime-v2/pain-to-principle-service.js +1 -0
  112. package/dist/runtime-v2/pain-to-principle-service.js.map +1 -1
  113. package/dist/runtime-v2/runner/__tests__/pain-signal-bridge-admission.test.js +6 -6
  114. package/dist/runtime-v2/runner/__tests__/pain-signal-bridge-admission.test.js.map +1 -1
  115. package/dist/runtime-v2/store/context/sqlite-context-assembler.d.ts.map +1 -1
  116. package/dist/runtime-v2/store/context/sqlite-context-assembler.js +25 -5
  117. package/dist/runtime-v2/store/context/sqlite-context-assembler.js.map +1 -1
  118. package/dist/runtime-v2/store/context/sqlite-context-assembler.test.js +38 -9
  119. package/dist/runtime-v2/store/context/sqlite-context-assembler.test.js.map +1 -1
  120. package/dist/runtime-v2/store/runtime-state-manager.d.ts +6 -0
  121. package/dist/runtime-v2/store/runtime-state-manager.d.ts.map +1 -1
  122. package/dist/runtime-v2/store/runtime-state-manager.js +8 -0
  123. package/dist/runtime-v2/store/runtime-state-manager.js.map +1 -1
  124. package/dist/runtime-v2/store/task/__tests__/sqlite-task-store-cas.test.js +36 -0
  125. package/dist/runtime-v2/store/task/__tests__/sqlite-task-store-cas.test.js.map +1 -1
  126. package/dist/runtime-v2/store/task/sqlite-task-store.d.ts +19 -0
  127. package/dist/runtime-v2/store/task/sqlite-task-store.d.ts.map +1 -1
  128. package/dist/runtime-v2/store/task/sqlite-task-store.js +30 -1
  129. package/dist/runtime-v2/store/task/sqlite-task-store.js.map +1 -1
  130. package/dist/runtime-v2/task-status.d.ts +2 -1
  131. package/dist/runtime-v2/task-status.d.ts.map +1 -1
  132. package/dist/runtime-v2/task-status.js +5 -1
  133. package/dist/runtime-v2/task-status.js.map +1 -1
  134. package/package.json +1 -1
@@ -0,0 +1,39 @@
1
+ /**
2
+ * PRI-634 A2(authority migration)— code-bearing Artificer artifact 判定。
3
+ *
4
+ * 设计裁决(Owner 评审 2026-08-31 冻结):`这条链是否需要 deterministic
5
+ * RuleHost gate` 的 authority 是 **durable Artificer artifact 是否
6
+ * code-bearing**,而不是 evaluator LLM 是否恰好输出了 optional 的 V2 字段
7
+ * (`isEvaluatorOutputV2()`)。原控制流把 optional LLM output shape 当作
8
+ * gate 前置 —— V2 字段全部 optional 且 validator 明确允许 V1 缺失
9
+ * (evaluator-output.ts),导致一个完整 code-bearing 的 Artificer 产物可以在
10
+ * evaluator 只返回 V1 shape 时结构性跳过安全门(48371236 链 attempt 17)。
11
+ *
12
+ * 评审实现约束:**不得**把「字段碰巧存在」当成新的弱 heuristic authority。
13
+ * 本函数逐项镜像 `assembleRuleArtifact()`(evaluator-runner.ts)的静态前置
14
+ * 验证 —— 返回 codeBearing=true 严格等价于「rule assembly 的全部静态检查
15
+ * 将通过」。这样 authority 定义收敛到唯一的、机器可验证的语义:
16
+ * 经 runtime validation 的 durable Artificer capability。
17
+ *
18
+ * 验证序列(与 assemble 的 rule_assembly_failed reasons 一一对应):
19
+ * 1. contentJson 缺失 → no_artificer_artifact
20
+ * 2. JSON 解析失败 / 非 object → artificer_artifact_unparseable
21
+ * 3. implementationCode 非空串 → artificer_artifact_has_no_implementation_code
22
+ * 4. goldenTraceCases 非数组 → artificer_golden_trace_cases_not_array
23
+ * 5. buildGoldenTraceFromArtificer 失败(结构非法 / 无 positive+negative)
24
+ * → golden_trace_build_failed:<reason>
25
+ *
26
+ * affectedTools 刻意**不**作为硬条件:assemble 的真实语义是 tolerant
27
+ * (optional 数组、元素 filter string、缺省 [])。把它收紧成硬失败会造出
28
+ * 比 assemble 更严的假 authority,违反 One Source of Truth。
29
+ *
30
+ * 纯函数:无 I/O、无注入依赖,可直接单测。
31
+ */
32
+ export type ArtificerCodeBearingAssessment = {
33
+ readonly codeBearing: true;
34
+ } | {
35
+ readonly codeBearing: false;
36
+ readonly reason: string;
37
+ };
38
+ export declare function assessArtificerCodeBearing(contentJson: string | null | undefined): ArtificerCodeBearingAssessment;
39
+ //# sourceMappingURL=artificer-code-bearing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artificer-code-bearing.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/artificer-code-bearing.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,MAAM,8BAA8B,GACtC;IAAE,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAA;CAAE,GAC9B;IAAE,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,8BAA8B,CAqCjH"}
@@ -0,0 +1,33 @@
1
+ import { buildGoldenTraceFromArtificer } from '../golden-trace.js';
2
+ export function assessArtificerCodeBearing(contentJson) {
3
+ if (typeof contentJson !== 'string' || contentJson.trim() === '') {
4
+ return { codeBearing: false, reason: 'no_artificer_artifact' };
5
+ }
6
+ let parsed;
7
+ try {
8
+ parsed = JSON.parse(contentJson);
9
+ }
10
+ catch {
11
+ return { codeBearing: false, reason: 'artificer_artifact_unparseable' };
12
+ }
13
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
14
+ return { codeBearing: false, reason: 'artificer_artifact_unparseable' };
15
+ }
16
+ // runtime-contract-exempt: ERR-001 object-guarded unknown property extraction;
17
+ // values are typeof-checked / structurally validated immediately below.
18
+ const { implementationCode, goldenTraceCases } = parsed;
19
+ if (typeof implementationCode !== 'string' || implementationCode.trim() === '') {
20
+ return { codeBearing: false, reason: 'artificer_artifact_has_no_implementation_code' };
21
+ }
22
+ if (!Array.isArray(goldenTraceCases)) {
23
+ return { codeBearing: false, reason: 'artificer_golden_trace_cases_not_array' };
24
+ }
25
+ // assemble 要求 ≥1 positive + ≥1 negative 且逐 case 结构合法
26
+ // (buildGoldenTraceFromArtificer 内部对每项做 validateGoldenTraceCase)。
27
+ const traceBuild = buildGoldenTraceFromArtificer({ cases: goldenTraceCases });
28
+ if (!traceBuild.ok) {
29
+ return { codeBearing: false, reason: `golden_trace_build_failed: ${traceBuild.reason}` };
30
+ }
31
+ return { codeBearing: true };
32
+ }
33
+ //# sourceMappingURL=artificer-code-bearing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artificer-code-bearing.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/artificer-code-bearing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAqCnE,MAAM,UAAU,0BAA0B,CAAC,WAAsC;IAC/E,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACjE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;IACjE,CAAC;IAED,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,gCAAgC,EAAE,CAAC;IAC1E,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3E,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,gCAAgC,EAAE,CAAC;IAC1E,CAAC;IAED,+EAA+E;IAC/E,wEAAwE;IACxE,MAAM,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,GAAG,MAGhD,CAAC;IAEF,IAAI,OAAO,kBAAkB,KAAK,QAAQ,IAAI,kBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC/E,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,+CAA+C,EAAE,CAAC;IACzF,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACrC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,wCAAwC,EAAE,CAAC;IAClF,CAAC;IAED,qDAAqD;IACrD,kEAAkE;IAClE,MAAM,UAAU,GAAG,6BAA6B,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC9E,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;QACnB,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,8BAA8B,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;IAC3F,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AAC/B,CAAC"}
@@ -311,17 +311,20 @@ export declare class EvaluatorRunner extends BasePeerRunner<EvaluatorContext, Ev
311
311
  */
312
312
  protected checkLineageIntegrity(taskId: string, output: EvaluatorOutputV1, _context: EvaluatorContext): void;
313
313
  /**
314
- * Run a single-round adversarial sandbox replay on the evaluator's V2 output
315
- * (PRD Decision 11d). Pure orchestration of pure functions:
314
+ * Run a single-round adversarial sandbox replay (PRD Decision 11d).
315
+ * PRI-634 A2/R1: the `output` is accepted in V1 shape too — a code-bearing
316
+ * Artificer artifact requires the gate regardless of whether the evaluator
317
+ * LLM emitted optional V2 fields. Only V2-shaped outputs can contribute
318
+ * LLM-supplied adversarialCases (checked via isEvaluatorOutputV2 below).
319
+ * Pure orchestration of pure functions:
316
320
  * 1. Skip if passive review failed (decision !== 'approved' is the LLM's
317
- * short-circuit signal — no code to defend).
318
- * 2. Skip if no adversarialCases present (V2 with codeReview only).
319
- * 3. Convert adversarialCases GoldenTrace (all negative, PRI-423).
320
- * 4. Merge ≥1 positive case from the Artificer golden trace. If the
321
+ * short-circuit signal — no code to defend). Now observable (R9).
322
+ * 2. Convert adversarialCases GoldenTrace (all negative, PRI-423).
323
+ * 3. Merge ≥1 positive case from the Artificer golden trace. If the
321
324
  * artificer artifact has no goldenTraceCases (V1 mismatch), degrade:
322
325
  * skip replay with telemetry — do NOT crash.
323
- * 5. Invoke evaluateRefinerRuleHostGate via injected gateDeps.
324
- * 6. Populate adversarialResult from the gate result.
326
+ * 4. Invoke evaluateRefinerRuleHostGate via injected gateDeps.
327
+ * 5. Populate adversarialResult from the gate result.
325
328
  *
326
329
  * Never throws — all failure modes degrade to a returned result with a
327
330
  * structured reason (ERR-018). The caller persists the updated output.
@@ -1 +1 @@
1
- {"version":3,"file":"evaluator-runner.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/evaluator-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EACV,iBAAiB,EAEjB,kBAAkB,EAInB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAkB,KAAK,eAAe,EAAqB,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAwE,KAAK,aAAa,EAAqE,MAAM,sBAAsB,CAAC;AAQnM,OAAO,EAAmD,KAAK,yBAAyB,EAAE,KAAK,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC3J,OAAO,EAAwB,KAAK,sBAAsB,EAAE,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACjH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,gCAAgC,CAAC;AAKxC,OAAO,EAA+B,KAA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OAAO,CAAC,oBAAoB;IAO5B;;;;;;;;;;;;;;;OAeG;IAEH,OAAO,CAAC,4BAA4B;IAmFpC;;;;;;;;;OASG;IAEH,OAAO,CAAC,cAAc;IAqBtB;;;;;;;;;;OAUG;YAEW,oBAAoB;IAwLlC;;;;;;;;;;OAUG;YACW,8BAA8B;IAmE5C;;;OAGG;IAEH,OAAO,CAAC,wBAAwB;IAwBhC,OAAO,CAAC,MAAM,CAAC,QAAQ;IAIvB;;;;;;;;;;;OAWG;YACW,oCAAoC;CA+BnD"}
@@ -1,4 +1,7 @@
1
1
  import { isEvaluatorOutputV2 } from './evaluator-output.js';
2
+ // PRI-634 A2 (authority migration): gate necessity derives from the durable
3
+ // Artificer artifact, not from optional LLM output shape.
4
+ import { assessArtificerCodeBearing } from './artificer-code-bearing.js';
2
5
  import { PDRuntimeError, isPDErrorCategory } from '../error-categories.js';
3
6
  import { hydratePITaskRecord, createPITaskDiagnosticJson, mergePITaskMetadata } from './pitask-metadata.js';
4
7
  import { HUMAN_REVIEW_REASON, planOwnerVerdictOverrideResume, markOwnerResolutionApplied, computeArtifactContentHash, } from './owner-review.js';
@@ -18,6 +21,31 @@ import { canonicalizeToolKind } from './rule-context-v2.js';
18
21
  function isRecordValue(value) {
19
22
  return value !== null && typeof value === 'object' && !Array.isArray(value);
20
23
  }
24
+ /**
25
+ * PRI-634: resolve a golden-trace case's target path across the host tool
26
+ * schemas actually observed on real chains.
27
+ *
28
+ * Golden-trace params are echoed verbatim from the host trajectory
29
+ * (behavior-example-pack-assembler `params: parsedParams`), so the field name
30
+ * follows whatever the host tool used — the dominant write-tool schema spells
31
+ * it `file_path` (OpenClaw / Claude Code), while PRI-485's v2 generator only
32
+ * read `path`. Reading a single spelling made v2 auto-generation structurally
33
+ * unreachable: the merged adversarial set stayed empty, the deterministic gate
34
+ * never ran, and an LLM-declared `adversarialResult.passed = true` silently
35
+ * stood in for a real replay (chain 48371236).
36
+ *
37
+ * Returns null when neither spelling yields a non-empty string.
38
+ */
39
+ function resolveCasePathParam(params) {
40
+ if (!isRecordValue(params))
41
+ return null;
42
+ for (const key of ['path', 'file_path']) {
43
+ const raw = params[key];
44
+ if (typeof raw === 'string' && raw.trim() !== '')
45
+ return raw;
46
+ }
47
+ return null;
48
+ }
21
49
  /**
22
50
  * Extract scribeArtifactId from an artificer artifact's contentJson (PRD Decision 12).
23
51
  * The contentJson is untrusted — parsed defensively with type guards, never as-cast
@@ -587,21 +615,64 @@ export class EvaluatorRunner extends BasePeerRunner {
587
615
  });
588
616
  }
589
617
  // ── PRI-426: single-round adversarial sandbox replay ──
590
- // Runs only when (a) the output is V2 (code-bearing), (b) gateDeps is
591
- // injected, and (c) passive review passed (LLM short-circuits to
592
- // needs_revision when any of the 3 dimensions fail, so by the time we get
593
- // here with decision='approved' the passive review already passed).
618
+ // PRI-634 A2 (authority migration): gate necessity is decided by the
619
+ // DURABLE Artificer artifact assessArtificerCodeBearing() mirrors
620
+ // assembleRuleArtifact()'s static preconditions exactly never by
621
+ // whether the LLM happened to emit optional V2 fields
622
+ // (isEvaluatorOutputV2). A V2-shaped output over a non-code-bearing
623
+ // Artificer keeps the legacy behavior (attempt replay, degrade with
624
+ // telemetry) so the old path stays observable.
594
625
  //
595
626
  // PRI-423 contract: adversarialCasesToGoldenTrace yields an all-negative
596
627
  // trace. We MUST merge ≥1 positive case from the Artificer golden trace
597
628
  // before replaying, otherwise the merged trace fails validateGoldenTrace.
598
629
  //
599
- // This block never throws into the caller — a sandbox/gate failure degrades
600
- // to adversarialResult.passed=false with a structured reason (ERR-018).
601
- // The principle artifact is already persisted, so prompt-channel fallback
602
- // remains available regardless of replay outcome (PRD Decision 11d §h).
630
+ // The replay itself never throws into the caller — a sandbox/gate failure
631
+ // degrades to adversarialResult.passed=false with a structured reason
632
+ // (ERR-018). The principle artifact is already persisted, so
633
+ // prompt-channel fallback remains available regardless of replay outcome
634
+ // (PRD Decision 11d §h). The ONE deliberate exception is the R2 wiring
635
+ // guard below: a code-bearing artifact without gateDeps fails loud
636
+ // (capability_missing, permanent) instead of succeeding un-gated.
603
637
  let finalOutput = output;
604
- if (isEvaluatorOutputV2(output) && this.gateDeps) {
638
+ const gateAssessment = assessArtificerCodeBearing(context.artificerArtifact);
639
+ const outputWantsGate = isEvaluatorOutputV2(output);
640
+ const evaluatorDecision = output.evaluation.decision;
641
+ if (evaluatorDecision !== 'approved') {
642
+ // Passive review short-circuit: the LLM emits needs_revision/rejected
643
+ // when its review fails — no gate needed. Previously silent inside
644
+ // runAdversarialReplay; now observable at the gate decision point
645
+ // (Runtime Contract Rule 9).
646
+ if (gateAssessment.codeBearing || outputWantsGate) {
647
+ this.emitEvent('adversarial_replay_skipped', taskId, {
648
+ runId,
649
+ reason: 'evaluation_not_approved',
650
+ nextAction: 'repair_loop_or_next_review_round',
651
+ });
652
+ }
653
+ }
654
+ else if (!this.gateDeps) {
655
+ this.emitEvent('adversarial_replay_skipped', taskId, {
656
+ runId,
657
+ reason: 'gate_deps_not_injected',
658
+ nextAction: 'wire_gateDeps_createProductionGateDeps_into_evaluator_runner_assembly',
659
+ });
660
+ if (gateAssessment.codeBearing) {
661
+ // PRI-634 R2 (wiring regression guard): a code-bearing Artificer
662
+ // artifact REQUIRES the deterministic gate. Proceeding would yield
663
+ // succeeded + adversarialResult=null — the exact state that broke
664
+ // chain 48371236. capability_missing is a permanent error: the task
665
+ // fails loud (markTaskFailed) instead of retry-burning LLM budget —
666
+ // a missing gateDeps is an assembly defect, not a transient fault.
667
+ return this.retryOrFail({
668
+ taskId,
669
+ task,
670
+ errorCategory: 'capability_missing',
671
+ failureReason: `PRI-634 R2: Artificer artifact ${context.sourceArtificerArtifactId ?? '(unknown)'} is code-bearing but EvaluatorRunner was assembled without gateDeps — deterministic adversarial replay cannot run. Fix: inject gateDeps: createProductionGateDeps() into the EvaluatorRunner assembly.`,
672
+ });
673
+ }
674
+ }
675
+ else if (gateAssessment.codeBearing || outputWantsGate) {
605
676
  const replayOutcome = await this.runAdversarialReplay(output, taskId, runId, context);
606
677
  if (replayOutcome.updatedOutput) {
607
678
  finalOutput = replayOutcome.updatedOutput;
@@ -633,6 +704,30 @@ export class EvaluatorRunner extends BasePeerRunner {
633
704
  });
634
705
  }
635
706
  }
707
+ else if (gateAssessment.codeBearing) {
708
+ // ── PRI-634 R3 (terminal-state invariant) ──
709
+ // A code-bearing Artificer artifact that reached `approved` MUST leave
710
+ // this block carrying an adversarialResult. Anything else reproduces
711
+ // the chain-48371236 terminal state — approved with the deterministic
712
+ // gate never executed, adversarialResult=null, and therefore no
713
+ // pi-rule-* downstream — regardless of WHICH cause prevented the
714
+ // replay (zero adversarial cases, no positive case, unparseable
715
+ // artifact, conversion drift…). Telemetry is not recovery: a task that
716
+ // ends `succeeded` here is indistinguishable from the original defect.
717
+ //
718
+ // errorCategory is `input_invalid` (already listed in
719
+ // permanentErrorCategories) rather than `capability_missing`: the gate
720
+ // IS wired correctly (R2 owns the wiring case) — the upstream
721
+ // Artificer content simply cannot be turned into gate input. Permanent
722
+ // because retrying the LLM cannot make the Artificer emit the missing
723
+ // affectedTools / positive-case path.
724
+ return this.retryOrFail({
725
+ taskId,
726
+ task,
727
+ errorCategory: 'input_invalid',
728
+ failureReason: `PRI-634 R3: Artificer artifact ${context.sourceArtificerArtifactId ?? '(unknown)'} is code-bearing and the evaluator approved it, but the deterministic adversarial replay did not run (reason: ${replayOutcome.skipReason ?? 'unknown'}). Refusing to report succeeded with adversarialResult=null — that is the chain-48371236 terminal state. Fix: have the Artificer emit affectedTools plus at least one positive golden-trace case carrying a path, or supply LLM adversarialCases.`,
729
+ });
730
+ }
636
731
  }
637
732
  // ── P0 (verdict drift): verdict + completion intent 原子落库 ──
638
733
  // 必须先于一切治理 side effect (validate bearer / seed repair / rule
@@ -1412,17 +1507,20 @@ export class EvaluatorRunner extends BasePeerRunner {
1412
1507
  }
1413
1508
  // ── PRI-426: adversarial sandbox replay ─────────────────────────────────────
1414
1509
  /**
1415
- * Run a single-round adversarial sandbox replay on the evaluator's V2 output
1416
- * (PRD Decision 11d). Pure orchestration of pure functions:
1510
+ * Run a single-round adversarial sandbox replay (PRD Decision 11d).
1511
+ * PRI-634 A2/R1: the `output` is accepted in V1 shape too — a code-bearing
1512
+ * Artificer artifact requires the gate regardless of whether the evaluator
1513
+ * LLM emitted optional V2 fields. Only V2-shaped outputs can contribute
1514
+ * LLM-supplied adversarialCases (checked via isEvaluatorOutputV2 below).
1515
+ * Pure orchestration of pure functions:
1417
1516
  * 1. Skip if passive review failed (decision !== 'approved' is the LLM's
1418
- * short-circuit signal — no code to defend).
1419
- * 2. Skip if no adversarialCases present (V2 with codeReview only).
1420
- * 3. Convert adversarialCases GoldenTrace (all negative, PRI-423).
1421
- * 4. Merge ≥1 positive case from the Artificer golden trace. If the
1517
+ * short-circuit signal — no code to defend). Now observable (R9).
1518
+ * 2. Convert adversarialCases GoldenTrace (all negative, PRI-423).
1519
+ * 3. Merge ≥1 positive case from the Artificer golden trace. If the
1422
1520
  * artificer artifact has no goldenTraceCases (V1 mismatch), degrade:
1423
1521
  * skip replay with telemetry — do NOT crash.
1424
- * 5. Invoke evaluateRefinerRuleHostGate via injected gateDeps.
1425
- * 6. Populate adversarialResult from the gate result.
1522
+ * 4. Invoke evaluateRefinerRuleHostGate via injected gateDeps.
1523
+ * 5. Populate adversarialResult from the gate result.
1426
1524
  *
1427
1525
  * Never throws — all failure modes degrade to a returned result with a
1428
1526
  * structured reason (ERR-018). The caller persists the updated output.
@@ -1434,15 +1532,29 @@ export class EvaluatorRunner extends BasePeerRunner {
1434
1532
  // eslint-disable-next-line @typescript-eslint/prefer-destructuring
1435
1533
  const gateDeps = this.gateDeps;
1436
1534
  if (!gateDeps) {
1437
- return { updatedOutput: null };
1535
+ // Defensive unreachable via the current caller (R2 fails loud before
1536
+ // this point). Kept observable so a future caller cannot silently
1537
+ // reintroduce the un-gated path (PRI-634 A3).
1538
+ this.emitEvent('adversarial_replay_skipped', taskId, {
1539
+ runId,
1540
+ reason: 'gate_deps_not_injected',
1541
+ nextAction: 'wire_gateDeps_createProductionGateDeps_into_evaluator_runner_assembly',
1542
+ });
1543
+ return { updatedOutput: null, skipReason: 'gate_deps_not_injected' };
1438
1544
  }
1439
1545
  // (1) Passive review short-circuit: the LLM emits decision='needs_revision'
1440
1546
  // when any of intentConsistency/scopePrecision/traceCoverage fails. Only
1441
1547
  // replay when the LLM judged the code worth defending. This check is
1442
- // defensive — by PRD contract the prompt instructs the LLM to short-circuit,
1443
- // but we don't trust the LLM to be the sole gate (Runtime Contract Rule 3).
1548
+ // defensive — the caller already gated on decision='approved' (PRI-634 A2
1549
+ // moved the check to the gate decision point); kept here so a future
1550
+ // caller cannot silently bypass it (Runtime Contract Rule 3).
1444
1551
  if (output.evaluation.decision !== 'approved') {
1445
- return { updatedOutput: null };
1552
+ this.emitEvent('adversarial_replay_skipped', taskId, {
1553
+ runId,
1554
+ reason: 'evaluation_not_approved',
1555
+ nextAction: 'repair_loop_or_next_review_round',
1556
+ });
1557
+ return { updatedOutput: null, skipReason: 'evaluation_not_approved' };
1446
1558
  }
1447
1559
  // (2) Resolve the Artificer artifact early — we need it both to derive
1448
1560
  // the v2 adversarial spec (PRI-485) and to merge positive cases (PRI-423).
@@ -1452,7 +1564,7 @@ export class EvaluatorRunner extends BasePeerRunner {
1452
1564
  reason: 'no_artificer_artifact_in_context',
1453
1565
  nextAction: 'verify_buildContext_resolves_artificer_artifact',
1454
1566
  });
1455
- return { updatedOutput: null };
1567
+ return { updatedOutput: null, skipReason: 'no_artificer_artifact_in_context' };
1456
1568
  }
1457
1569
  const artificerParsed = this.parseArtificerArtifact(context.artificerArtifact);
1458
1570
  if (!artificerParsed) {
@@ -1461,7 +1573,7 @@ export class EvaluatorRunner extends BasePeerRunner {
1461
1573
  reason: 'artificer_artifact_unparseable',
1462
1574
  nextAction: 'verify_artificer_artifact_contentJson',
1463
1575
  });
1464
- return { updatedOutput: null };
1576
+ return { updatedOutput: null, skipReason: 'artificer_artifact_unparseable' };
1465
1577
  }
1466
1578
  const { implementationCode, goldenTraceCases, affectedTools } = artificerParsed;
1467
1579
  if (typeof implementationCode !== 'string' || implementationCode.trim() === '') {
@@ -1472,7 +1584,7 @@ export class EvaluatorRunner extends BasePeerRunner {
1472
1584
  reason: 'artificer_artifact_has_no_implementation_code',
1473
1585
  nextAction: 'verify_artificer_l2_adapter_emitted_v2',
1474
1586
  });
1475
- return { updatedOutput: null };
1587
+ return { updatedOutput: null, skipReason: 'artificer_artifact_has_no_implementation_code' };
1476
1588
  }
1477
1589
  // Merge positive cases from the Artificer golden trace into the adversarial
1478
1590
  // trace. buildGoldenTraceFromArtificer validates each case structurally
@@ -1484,20 +1596,36 @@ export class EvaluatorRunner extends BasePeerRunner {
1484
1596
  reason: 'no_positive_case_in_artificer_golden_trace',
1485
1597
  nextAction: 'verify_artificer_emitted_at_least_one_positive_case',
1486
1598
  });
1487
- return { updatedOutput: null };
1599
+ return { updatedOutput: null, skipReason: 'no_positive_case_in_artificer_golden_trace' };
1488
1600
  }
1489
1601
  // (3) PRI-485 Phase 6: auto-generate 5 v2 adversarial cases from the
1490
1602
  // Artificer's affectedTools + first positive case's path. These defend
1491
1603
  // against the most common false-positive patterns (unavailable/truncation/
1492
1604
  // alias/path/combination). Degrade with telemetry (rc-9) if the spec
1493
1605
  // cannot be derived — LLM-supplied adversarialCases still replay.
1494
- const llmCases = output.adversarialCases ?? [];
1606
+ // PRI-634 R1: V1-shaped outputs carry no adversarialCases the merged
1607
+ // set below then relies entirely on the auto-generated v2 cases.
1608
+ const llmCases = isEvaluatorOutputV2(output) ? (output.adversarialCases ?? []) : [];
1495
1609
  const v2Cases = this.generateV2CasesFromArtificer(affectedTools, positiveCases, taskId, runId);
1496
1610
  const mergedAdversarialCases = [...v2Cases, ...llmCases];
1497
1611
  // (4) No adversarial cases (neither v2-generated nor LLM-supplied) →
1498
1612
  // nothing to replay. codeReview may still be present (passive review only).
1613
+ // Previously a silent return (PRI-634 A3 hole #3); now observable (R9).
1614
+ //
1615
+ // PRI-634 R3: for a code-bearing Artificer artifact this is NOT a benign
1616
+ // degradation — it reproduces the chain-48371236 terminal state (approved
1617
+ // with no gate executed, adversarialResult=null, no pi-rule-* ever
1618
+ // emitted). The caller fails loud on this skipReason instead of reporting
1619
+ // succeeded. Non-code-bearing artifacts keep the legacy degrade (R1's
1620
+ // authority is the durable Artificer content, and only code-bearing
1621
+ // content can reach rule assembly).
1499
1622
  if (mergedAdversarialCases.length === 0) {
1500
- return { updatedOutput: null };
1623
+ this.emitEvent('adversarial_replay_skipped', taskId, {
1624
+ runId,
1625
+ reason: 'no_adversarial_cases_after_merge',
1626
+ nextAction: 'verify_artificer_affectedTools_or_positive_case_path_derivable',
1627
+ });
1628
+ return { updatedOutput: null, skipReason: 'no_adversarial_cases_after_merge' };
1501
1629
  }
1502
1630
  // (5) Convert the merged adversarial cases to an all-negative GoldenTrace.
1503
1631
  const conversion = adversarialCasesToGoldenTrace(mergedAdversarialCases);
@@ -1509,7 +1637,7 @@ export class EvaluatorRunner extends BasePeerRunner {
1509
1637
  reason: `adversarial_conversion_failed: ${conversion.reason}`,
1510
1638
  nextAction: 'verify_adversarial_case_validator_alignment',
1511
1639
  });
1512
- return { updatedOutput: null };
1640
+ return { updatedOutput: null, skipReason: `adversarial_conversion_failed: ${conversion.reason}` };
1513
1641
  }
1514
1642
  const mergedTrace = {
1515
1643
  traceId: `golden-trace-evaluator-replay-${taskId}-${Date.now().toString(36)}`,
@@ -1538,6 +1666,7 @@ export class EvaluatorRunner extends BasePeerRunner {
1538
1666
  };
1539
1667
  return {
1540
1668
  updatedOutput: { ...output, adversarialResult: failedResult },
1669
+ skipReason: null,
1541
1670
  };
1542
1671
  }
1543
1672
  this.emitEvent('adversarial_replay', taskId, {
@@ -1557,6 +1686,7 @@ export class EvaluatorRunner extends BasePeerRunner {
1557
1686
  };
1558
1687
  return {
1559
1688
  updatedOutput: { ...output, adversarialResult },
1689
+ skipReason: null,
1560
1690
  };
1561
1691
  }
1562
1692
  /**
@@ -1691,12 +1821,21 @@ export class EvaluatorRunner extends BasePeerRunner {
1691
1821
  });
1692
1822
  return [];
1693
1823
  }
1694
- const pathParam = firstPositive.params?.path;
1695
- if (typeof pathParam !== 'string' || pathParam.trim() === '') {
1824
+ // PRI-634: golden-trace params are echoed verbatim from the host
1825
+ // trajectory, and the dominant write-tool schema names its target
1826
+ // `file_path` (OpenClaw / Claude Code), not `path`. Reading only `path`
1827
+ // made v2 auto-generation structurally unreachable on real chains: the
1828
+ // merged case set stayed empty, so the gate never ran and an
1829
+ // LLM-declared adversarialResult.passed=true could stand in for a real
1830
+ // replay (chain 48371236). Accept both spellings — this is the input that
1831
+ // makes the deterministic gate reachable at all.
1832
+ const { params } = firstPositive;
1833
+ const pathParam = resolveCasePathParam(params);
1834
+ if (pathParam === null) {
1696
1835
  this.emitEvent('v2_adversarial_cases_skipped', taskId, {
1697
1836
  runId,
1698
1837
  reason: 'no_path_param_for_v2_adversarial_cases',
1699
- nextAction: 'verify_positive_case_has_string_path_param',
1838
+ nextAction: 'verify_positive_case_has_string_path_or_file_path_param',
1700
1839
  });
1701
1840
  return [];
1702
1841
  }