@principles/core 1.285.0 → 1.286.1
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.
- package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.js +209 -0
- package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.js.map +1 -1
- package/dist/runtime-v2/__tests__/dreamer-source-pain-provenance.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/dreamer-source-pain-provenance.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/dreamer-source-pain-provenance.test.js +208 -0
- package/dist/runtime-v2/__tests__/dreamer-source-pain-provenance.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/pitask-metadata.test.js +28 -1
- package/dist/runtime-v2/__tests__/pitask-metadata.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/dreamer-prompt-builder.test.js +8 -0
- package/dist/runtime-v2/internalization/__tests__/dreamer-prompt-builder.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/evaluator-formation-context.test.js +2 -2
- package/dist/runtime-v2/internalization/__tests__/evaluator-pain-reason-echo.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-pain-reason-echo.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-pain-reason-echo.test.js +328 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-pain-reason-echo.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder.test.js +2 -2
- package/dist/runtime-v2/internalization/__tests__/evaluator-validator-refeed.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-validator-refeed.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-validator-refeed.test.js +433 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-validator-refeed.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/owner-decision-review.test.js +204 -3
- package/dist/runtime-v2/internalization/__tests__/owner-decision-review.test.js.map +1 -1
- package/dist/runtime-v2/internalization/artificer-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/artificer-runner.js +20 -41
- package/dist/runtime-v2/internalization/artificer-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/dreamer-prompt-builder.js +2 -2
- package/dist/runtime-v2/internalization/dreamer-runner.d.ts +19 -3
- package/dist/runtime-v2/internalization/dreamer-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/dreamer-runner.js +39 -10
- package/dist/runtime-v2/internalization/dreamer-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-prompt-builder.d.ts +33 -1
- package/dist/runtime-v2/internalization/evaluator-prompt-builder.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-prompt-builder.js +42 -2
- package/dist/runtime-v2/internalization/evaluator-prompt-builder.js.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-runner.d.ts +10 -1
- package/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-runner.js +65 -1
- package/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/formation-context.d.ts +24 -4
- package/dist/runtime-v2/internalization/formation-context.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/formation-context.js +5 -2
- package/dist/runtime-v2/internalization/formation-context.js.map +1 -1
- package/dist/runtime-v2/internalization/owner-decision-review.d.ts +33 -1
- package/dist/runtime-v2/internalization/owner-decision-review.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/owner-decision-review.js +93 -1
- package/dist/runtime-v2/internalization/owner-decision-review.js.map +1 -1
- package/dist/runtime-v2/internalization/pitask-metadata.d.ts +15 -0
- package/dist/runtime-v2/internalization/pitask-metadata.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/pitask-metadata.js +34 -0
- package/dist/runtime-v2/internalization/pitask-metadata.js.map +1 -1
- package/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.js +56 -0
- package/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.js.map +1 -1
- package/dist/runtime-v2/owner-decision/owner-decision-view-contract.d.ts +169 -0
- package/dist/runtime-v2/owner-decision/owner-decision-view-contract.d.ts.map +1 -1
- package/dist/runtime-v2/owner-decision/owner-decision-view-contract.js +4 -0
- package/dist/runtime-v2/owner-decision/owner-decision-view-contract.js.map +1 -1
- package/dist/runtime-v2/owner-decision/owner-decision-view.d.ts.map +1 -1
- package/dist/runtime-v2/owner-decision/owner-decision-view.js +26 -8
- package/dist/runtime-v2/owner-decision/owner-decision-view.js.map +1 -1
- package/dist/runtime-v2/pain-to-principle-service.d.ts +7 -0
- package/dist/runtime-v2/pain-to-principle-service.d.ts.map +1 -1
- package/dist/runtime-v2/pain-to-principle-service.js +1 -0
- package/dist/runtime-v2/pain-to-principle-service.js.map +1 -1
- package/dist/runtime-v2/runner/__tests__/base-peer-runner-agent-draft.test.js +34 -0
- package/dist/runtime-v2/runner/__tests__/base-peer-runner-agent-draft.test.js.map +1 -1
- package/dist/runtime-v2/runner/base-peer-runner.d.ts.map +1 -1
- package/dist/runtime-v2/runner/base-peer-runner.js +4 -47
- package/dist/runtime-v2/runner/base-peer-runner.js.map +1 -1
- package/dist/runtime-v2/store/task/__tests__/sqlite-task-store.failed-tasks.test.js +29 -2
- package/dist/runtime-v2/store/task/__tests__/sqlite-task-store.failed-tasks.test.js.map +1 -1
- package/dist/runtime-v2/store/task/sqlite-task-store.d.ts.map +1 -1
- package/dist/runtime-v2/store/task/sqlite-task-store.js +6 -37
- package/dist/runtime-v2/store/task/sqlite-task-store.js.map +1 -1
- package/dist/telemetry-event.d.ts +2 -2
- package/dist/telemetry-event.d.ts.map +1 -1
- package/dist/telemetry-event.js +8 -0
- package/dist/telemetry-event.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PDRuntimeError } from '../error-categories.js';
|
|
2
|
-
import { hydratePITaskRecord } from './pitask-metadata.js';
|
|
2
|
+
import { hydratePITaskRecord, parseSeedSourcePainId } from './pitask-metadata.js';
|
|
3
3
|
import { DreamerPromptBuilder } from './dreamer-prompt-builder.js';
|
|
4
4
|
import { reconcileLineageEcho } from './peer-runner-contracts.js';
|
|
5
5
|
import { stripFabricatedCorePrincipleIds } from '../core-principles/index.js';
|
|
@@ -92,7 +92,12 @@ export class DreamerRunner extends BasePeerRunner {
|
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
const contextHash = BasePeerRunner.hashContextRefs(contextRefs);
|
|
95
|
-
return {
|
|
95
|
+
return {
|
|
96
|
+
contextHash,
|
|
97
|
+
contextRefs,
|
|
98
|
+
predecessorOutput,
|
|
99
|
+
seedSourcePainId: parseSeedSourcePainId(task.diagnosticJson),
|
|
100
|
+
};
|
|
96
101
|
}
|
|
97
102
|
async invokeRuntime(taskId, context) {
|
|
98
103
|
const { coreGrounding, outputLanguage } = this.resolvedOptions;
|
|
@@ -218,24 +223,48 @@ export class DreamerRunner extends BasePeerRunner {
|
|
|
218
223
|
}
|
|
219
224
|
// ── Optional hooks ─────────────────────────────────────────────────────────
|
|
220
225
|
/**
|
|
221
|
-
*
|
|
222
|
-
* Only fill when absent via Object.hasOwn — present-but-falsy
|
|
226
|
+
* taskId: re-inject if stripped by stripLineageFields (PRI-272 / ERR-008).
|
|
227
|
+
* Only fill when absent via Object.hasOwn — present-but-falsy taskId
|
|
223
228
|
* must reach validation and fail loud (Runtime Contract Rule 3).
|
|
224
229
|
*
|
|
230
|
+
* PRI-862 (CIL-006): sourcePainId follows the same echo gate but with
|
|
231
|
+
* the task seed as authority — a seeded value overrides any LLM echo
|
|
232
|
+
* (fabrication arm), and when NO seed exists the LLM value is dropped
|
|
233
|
+
* (loss-of-trust arm: provenance degrades to null observably, the model
|
|
234
|
+
* string is never trusted). This holds on every runtime adapter,
|
|
235
|
+
* including the paths that do not strip lineage fields themselves.
|
|
236
|
+
* The correction event carries `seedPresent` so the two arms stay
|
|
237
|
+
* separately measurable (rc-9 structured reason).
|
|
238
|
+
*
|
|
225
239
|
* Also strips fabricated sourcePrincipleId values via the shared
|
|
226
240
|
* stripFabricatedCorePrincipleIds utility. The generatedAt override is
|
|
227
241
|
* handled by the base class via super.postFetchTransform().
|
|
228
242
|
*/
|
|
229
|
-
postFetchTransform(taskId, untrustedOutput,
|
|
230
|
-
super.postFetchTransform(taskId, untrustedOutput,
|
|
231
|
-
// Shared lineage echo gate (PRI-541)
|
|
232
|
-
// only runner-owned lineage is taskId. Emits telemetry on correction so
|
|
243
|
+
postFetchTransform(taskId, untrustedOutput, context) {
|
|
244
|
+
super.postFetchTransform(taskId, untrustedOutput, context);
|
|
245
|
+
// Shared lineage echo gate (PRI-541). Emits telemetry on correction so
|
|
233
246
|
// the LLM echo-corruption rate stays observable (rc-9).
|
|
247
|
+
const seed = context.seedSourcePainId;
|
|
234
248
|
const correctedFields = reconcileLineageEcho(untrustedOutput, {
|
|
235
|
-
topFields: [
|
|
249
|
+
topFields: [
|
|
250
|
+
{ field: 'taskId', authoritativeValue: taskId },
|
|
251
|
+
...(seed !== null ? [{ field: 'sourcePainId', authoritativeValue: seed }] : []),
|
|
252
|
+
],
|
|
236
253
|
});
|
|
254
|
+
if (seed === null
|
|
255
|
+
&& untrustedOutput !== null && typeof untrustedOutput === 'object' && !Array.isArray(untrustedOutput)
|
|
256
|
+
&& Object.hasOwn(untrustedOutput, 'sourcePainId')) {
|
|
257
|
+
// rc-5: hasOwn, not in. The LLM invented lineage with no canonical
|
|
258
|
+
// backing — drop it so formation-context provenance reads null
|
|
259
|
+
// (legitimate degraded state) instead of a fabricated id.
|
|
260
|
+
Reflect.deleteProperty(untrustedOutput, 'sourcePainId');
|
|
261
|
+
correctedFields.push('sourcePainId');
|
|
262
|
+
}
|
|
237
263
|
if (correctedFields.length > 0) {
|
|
238
|
-
|
|
264
|
+
// seedPresent is the arm discriminator: true ⇒ fabricated echo was
|
|
265
|
+
// overridden by the canonical seed; false ⇒ unbacked model string was
|
|
266
|
+
// dropped. Without it the two arms collapse into one unmeasurable rate.
|
|
267
|
+
this.emitEvent('lineage_echo_corrected', taskId, { correctedFields, seedPresent: seed !== null });
|
|
239
268
|
}
|
|
240
269
|
stripFabricatedCorePrincipleIds(untrustedOutput);
|
|
241
270
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dreamer-runner.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/dreamer-runner.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,cAAc,EAAwB,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"dreamer-runner.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/dreamer-runner.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,cAAc,EAAwB,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AA8D/D,MAAM,CAAC,MAAM,8BAA8B,GAA0E;IACnH,cAAc,EAAE,KAAK;IACrB,SAAS,EAAE,OAAO;IAClB,kBAAkB,EAAE,CAAC;IACrB,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,IAAI;CACX,CAAC;AAEX,MAAM,UAAU,2BAA2B,CAAC,OAA6B;IACvE,OAAO;QACL,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,8BAA8B,CAAC,cAAc;QACvF,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,8BAA8B,CAAC,SAAS;QACxE,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,IAAI,8BA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I,CAAC,SAAS,CAAC,wBAAwB,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,WAAW,EAAE,IAAI,KAAK,IAAI,EAAE,CAAC,CAAC;QACpG,CAAC;QACD,+BAA+B,CAAC,eAAe,CAAC,CAAC;IACnD,CAAC;IAEkB,oBAAoB,CAAC,MAAc,EAAE,MAAqB;QAC3E,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAC1C,IAAI,CAAC,SAAS,CAAC,qBAAqB,EAAE,MAAM,EAAE;gBAC5C,cAAc,EAAE,SAAS,CAAC,cAAc;gBACxC,UAAU,EAAE,SAAS,CAAC,UAAU;gBAChC,SAAS,EAAE,SAAS,CAAC,SAAS;aAC/B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IntentContractV1 } from './intent-contract.js';
|
|
2
2
|
import type { FormationContext } from './formation-context.js';
|
|
3
|
+
import type { LastValidatorErrors } from './pitask-metadata.js';
|
|
3
4
|
import type { OutputLanguage } from '../language-directive.js';
|
|
4
5
|
export interface EvaluatorPromptBuilderInput {
|
|
5
6
|
taskId: string;
|
|
@@ -51,6 +52,15 @@ export interface EvaluatorPromptBuilderInput {
|
|
|
51
52
|
* shape byte-for-byte and the system prompt stays unchanged.
|
|
52
53
|
*/
|
|
53
54
|
formationContext?: FormationContext;
|
|
55
|
+
/**
|
|
56
|
+
* PRI-644 (PRI-700 factor B wiring): verbatim validator rejection reasons
|
|
57
|
+
* from the immediately-preceding attempt, freshness-gated by the runner.
|
|
58
|
+
* Presence = the previous output was rejected by the business validator
|
|
59
|
+
* (e.g. a repair round missing requirementLedger) — attempt N+1 must not be
|
|
60
|
+
* a zero-information retry of the same prompt. Undefined on first attempt /
|
|
61
|
+
* when suppressed (payload and system prompt stay byte-identical).
|
|
62
|
+
*/
|
|
63
|
+
priorValidatorErrors?: LastValidatorErrors;
|
|
54
64
|
}
|
|
55
65
|
export interface PriorRequirement {
|
|
56
66
|
readonly id: string;
|
|
@@ -102,6 +112,8 @@ export interface EvaluatorPromptInput {
|
|
|
102
112
|
intentContract?: IntentContractV1;
|
|
103
113
|
/** Present only when the formation evidence resolved (PRI-843). */
|
|
104
114
|
formationContext?: FormationContext;
|
|
115
|
+
/** Present only when the prior attempt was rejected by the validator (PRI-644). */
|
|
116
|
+
priorValidatorErrors?: LastValidatorErrors;
|
|
105
117
|
promptContractVersion: string;
|
|
106
118
|
}
|
|
107
119
|
export interface EvaluatorPromptBuildResult {
|
|
@@ -139,6 +151,19 @@ export declare const PRINCIPLE_PAIN_MISMATCH_MARKER = "[principle_pain_mismatch]
|
|
|
139
151
|
* requiredChanges (the repair pipeline can only regenerate the Rule).
|
|
140
152
|
*/
|
|
141
153
|
export declare const EVALUATOR_FORMATION_EVIDENCE_ADDENDUM = "\n\nFORMATION EVIDENCE (when `input.formationContext` is present):\nYour input additionally carries `formationContext` \u2014 the ORIGINAL FORMATION EVIDENCE that started this formation chain. It is OBSERVATION DATA, not authority: it does not authorize you to modify, reject, or rewrite the Principle, and it never overrides the intentContract.\n- formationContext.sourceDiagnosis: the diagnostician output that started this formation (rootCause, summary, violatedPrinciples, evidence, recommendations) \u2014 the closest available carrier of the source pain's content.\n- formationContext.dreamerProposals: ALL alternative candidates the Dreamer proposed, not only the selected one. `priorityRank` is a derived reading aid over the Dreamer's own signals, not an authority.\n- formationContext.provenance: lineage ids linking this formation back to the source pain and diagnosis (sourcePainId when present).\n\nHOW TO USE IT:\n1. Judge faithfulness at TWO levels: (a) does the Rule faithfully implement the Principle \u2014 your existing intentConsistency / scopePrecision / traceCoverage duties; and (b) does the Principle actually address the pain described by sourceDiagnosis (rootCause and evidence)? Level (b) asks whether the principle answers the REAL root cause, or only a minor facet of it, or a mis-attributed one.\n2. When you conclude the Principle does NOT address the source pain, record it in evaluation.concerns as a concern whose text BEGINS with the exact token [principle_pain_mismatch], followed by the concrete evidence citation (a diagnosis evidence sourceRef, a rootCause excerpt, or a provenance id). The pipeline routes that finding to the Owner for a governance decision.\n3. NEVER express a Principle-level revision demand in evaluation.requiredChanges \u2014 requiredChanges may only demand changes to the RULE itself. The repair pipeline can only regenerate the rule; it can never satisfy a Principle-level demand.\n4. A [principle_pain_mismatch] finding is NOT a rule defect: by itself it must not flip codeReview dimensions, must not lower the score below what the rule itself merits, and must not appear in requiredChanges. If the rule is sound, judge the rule as sound and let the marked concern carry the principle-level question.\n5. The diagnosis is EVIDENCE, not truth: it is itself an upstream product of this chain and may mis-attribute. When sourceDiagnosis is absent or you find it untrustworthy, say so in risks, weaken your pain-faithfulness conclusion accordingly, and NEVER base a rejection or a [principle_pain_mismatch] finding on the ABSENCE of formation evidence alone.\n6. Do not re-litigate which dreamer proposal should have been selected (the Philosopher critique already decided that \u2014 do not revive a proposal the critique rejected); use the proposals only as evidence of what alternatives existed.";
|
|
154
|
+
/**
|
|
155
|
+
* PRI-644 (PRI-700 factor B wiring): system-channel addendum appended ONLY
|
|
156
|
+
* when `priorValidatorErrors` is present — the same conditional-placement
|
|
157
|
+
* discipline as the PRI-843 formation addendum, so a first attempt stays
|
|
158
|
+
* byte-identical to the pre-PRI-644 prompt. Its content is the evaluator
|
|
159
|
+
* variant of the artificer's "PRIOR OUTPUT-CONTRACT REJECTIONS" block —
|
|
160
|
+
* deliberately NOT a placement mirror: the artificer bakes that block
|
|
161
|
+
* unconditionally into its protocol string, this one is conditional. Phrased
|
|
162
|
+
* for the evaluator's failure mode (BUSINESS validator rejections such as a
|
|
163
|
+
* repair round missing `requirementLedger` — output captured but rejected,
|
|
164
|
+
* then retried with the identical prompt until max_attempts_exceeded).
|
|
165
|
+
*/
|
|
166
|
+
export declare const EVALUATOR_VALIDATOR_FEEDBACK_ADDENDUM = "\n\nPRIOR OUTPUT-CONTRACT REJECTIONS (when `priorValidatorErrors` is present):\n- Your previous attempt was REJECTED BY THE OUTPUT VALIDATOR before its evaluation was ever recorded \u2014 the pipeline never advanced. The `priorValidatorErrors.errors` list contains the exact, verbatim rejection reasons.\n- The highest-priority fix is to make your JSON satisfy EVERY listed rejection reason. Re-read each error, map it to the OUTPUT FORMAT and CONSTRAINTS blocks above, and correct the exact fields it names.\n- These errors describe YOUR output's shape and completeness, NOT the implementation plan you are evaluating. Fix the contract violation and do NOT re-judge or change the substance (decision, score, findings) of your previous evaluation unless a listed rejection reason explicitly forces it.\n- When a rejection names a missing field \u2014 e.g. `evaluation.requirementLedger` or `evaluation.priorRequirementStatuses` in a repair round \u2014 that field is REQUIRED by the CONVERGENCE CONTRACT: echo EVERY input requirement with its exact id and statement-as-given, plus the status you assigned. Omitting, renumbering, or restating ids is the most common rejection cause.\n- After addressing every listed error, re-check the full OUTPUT FORMAT and CONSTRAINTS blocks once more before emitting.\n";
|
|
142
167
|
/**
|
|
143
168
|
* PRI-843 (SPEC v1.1): bumped v4 → v5. The prompt input gains the optional
|
|
144
169
|
* `formationContext` block (dreamer proposals + source diagnosis + provenance)
|
|
@@ -149,8 +174,15 @@ export declare const EVALUATOR_FORMATION_EVIDENCE_ADDENDUM = "\n\nFORMATION EVID
|
|
|
149
174
|
* run without formation evidence emits exactly the v4 wire shape plus the new
|
|
150
175
|
* version string. Existing v4 evaluations stay immutable — the version bump
|
|
151
176
|
* changes replay/cache identity for future runs only.
|
|
177
|
+
*
|
|
178
|
+
* PRI-644: bumped v5 → v6. The prompt input gains the optional
|
|
179
|
+
* `priorValidatorErrors` block (verbatim validator rejection reasons from the
|
|
180
|
+
* immediately-preceding attempt, PRI-700 factor B) and the system prompt
|
|
181
|
+
* conditionally carries `EVALUATOR_VALIDATOR_FEEDBACK_ADDENDUM`. Additive:
|
|
182
|
+
* same discipline as v5 — a run without validator feedback emits exactly the
|
|
183
|
+
* v5 wire shape plus the new version string.
|
|
152
184
|
*/
|
|
153
|
-
export declare const EVALUATOR_PROMPT_CONTRACT_VERSION = "evaluator-output-v1.prompt.
|
|
185
|
+
export declare const EVALUATOR_PROMPT_CONTRACT_VERSION = "evaluator-output-v1.prompt.v6";
|
|
154
186
|
export declare class EvaluatorPromptBuilder {
|
|
155
187
|
buildPrompt(input: EvaluatorPromptBuilderInput): EvaluatorPromptBuildResult;
|
|
156
188
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluator-prompt-builder.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/evaluator-prompt-builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB,EAAE,MAAM,CAAC;IAClC,iBAAiB,EAAE,OAAO,CAAC;IAC3B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;IAC/C;;;;OAIG;IACH,eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"evaluator-prompt-builder.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/evaluator-prompt-builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,c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C;AAE3O;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qCAAqC,8xCAQjD,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iCAAiC,kCAAkC,CAAC;AAEjF,qBAAa,sBAAsB;IAEjC,WAAW,CAAC,KAAK,EAAE,2BAA2B,GAAG,0BAA0B,CA4C1E;CACF"}
|
|
@@ -143,6 +143,27 @@ HOW TO USE IT:
|
|
|
143
143
|
4. A ${PRINCIPLE_PAIN_MISMATCH_MARKER} finding is NOT a rule defect: by itself it must not flip codeReview dimensions, must not lower the score below what the rule itself merits, and must not appear in requiredChanges. If the rule is sound, judge the rule as sound and let the marked concern carry the principle-level question.
|
|
144
144
|
5. The diagnosis is EVIDENCE, not truth: it is itself an upstream product of this chain and may mis-attribute. When sourceDiagnosis is absent or you find it untrustworthy, say so in risks, weaken your pain-faithfulness conclusion accordingly, and NEVER base a rejection or a ${PRINCIPLE_PAIN_MISMATCH_MARKER} finding on the ABSENCE of formation evidence alone.
|
|
145
145
|
6. Do not re-litigate which dreamer proposal should have been selected (the Philosopher critique already decided that — do not revive a proposal the critique rejected); use the proposals only as evidence of what alternatives existed.`;
|
|
146
|
+
/**
|
|
147
|
+
* PRI-644 (PRI-700 factor B wiring): system-channel addendum appended ONLY
|
|
148
|
+
* when `priorValidatorErrors` is present — the same conditional-placement
|
|
149
|
+
* discipline as the PRI-843 formation addendum, so a first attempt stays
|
|
150
|
+
* byte-identical to the pre-PRI-644 prompt. Its content is the evaluator
|
|
151
|
+
* variant of the artificer's "PRIOR OUTPUT-CONTRACT REJECTIONS" block —
|
|
152
|
+
* deliberately NOT a placement mirror: the artificer bakes that block
|
|
153
|
+
* unconditionally into its protocol string, this one is conditional. Phrased
|
|
154
|
+
* for the evaluator's failure mode (BUSINESS validator rejections such as a
|
|
155
|
+
* repair round missing `requirementLedger` — output captured but rejected,
|
|
156
|
+
* then retried with the identical prompt until max_attempts_exceeded).
|
|
157
|
+
*/
|
|
158
|
+
export const EVALUATOR_VALIDATOR_FEEDBACK_ADDENDUM = `
|
|
159
|
+
|
|
160
|
+
PRIOR OUTPUT-CONTRACT REJECTIONS (when \`priorValidatorErrors\` is present):
|
|
161
|
+
- Your previous attempt was REJECTED BY THE OUTPUT VALIDATOR before its evaluation was ever recorded — the pipeline never advanced. The \`priorValidatorErrors.errors\` list contains the exact, verbatim rejection reasons.
|
|
162
|
+
- The highest-priority fix is to make your JSON satisfy EVERY listed rejection reason. Re-read each error, map it to the OUTPUT FORMAT and CONSTRAINTS blocks above, and correct the exact fields it names.
|
|
163
|
+
- These errors describe YOUR output's shape and completeness, NOT the implementation plan you are evaluating. Fix the contract violation and do NOT re-judge or change the substance (decision, score, findings) of your previous evaluation unless a listed rejection reason explicitly forces it.
|
|
164
|
+
- When a rejection names a missing field — e.g. \`evaluation.requirementLedger\` or \`evaluation.priorRequirementStatuses\` in a repair round — that field is REQUIRED by the CONVERGENCE CONTRACT: echo EVERY input requirement with its exact id and statement-as-given, plus the status you assigned. Omitting, renumbering, or restating ids is the most common rejection cause.
|
|
165
|
+
- After addressing every listed error, re-check the full OUTPUT FORMAT and CONSTRAINTS blocks once more before emitting.
|
|
166
|
+
`;
|
|
146
167
|
/**
|
|
147
168
|
* PRI-843 (SPEC v1.1): bumped v4 → v5. The prompt input gains the optional
|
|
148
169
|
* `formationContext` block (dreamer proposals + source diagnosis + provenance)
|
|
@@ -153,8 +174,15 @@ HOW TO USE IT:
|
|
|
153
174
|
* run without formation evidence emits exactly the v4 wire shape plus the new
|
|
154
175
|
* version string. Existing v4 evaluations stay immutable — the version bump
|
|
155
176
|
* changes replay/cache identity for future runs only.
|
|
177
|
+
*
|
|
178
|
+
* PRI-644: bumped v5 → v6. The prompt input gains the optional
|
|
179
|
+
* `priorValidatorErrors` block (verbatim validator rejection reasons from the
|
|
180
|
+
* immediately-preceding attempt, PRI-700 factor B) and the system prompt
|
|
181
|
+
* conditionally carries `EVALUATOR_VALIDATOR_FEEDBACK_ADDENDUM`. Additive:
|
|
182
|
+
* same discipline as v5 — a run without validator feedback emits exactly the
|
|
183
|
+
* v5 wire shape plus the new version string.
|
|
156
184
|
*/
|
|
157
|
-
export const EVALUATOR_PROMPT_CONTRACT_VERSION = 'evaluator-output-v1.prompt.
|
|
185
|
+
export const EVALUATOR_PROMPT_CONTRACT_VERSION = 'evaluator-output-v1.prompt.v6';
|
|
158
186
|
export class EvaluatorPromptBuilder {
|
|
159
187
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
160
188
|
buildPrompt(input) {
|
|
@@ -175,6 +203,9 @@ export class EvaluatorPromptBuilder {
|
|
|
175
203
|
// PRI-843: only include formationContext when it actually resolved, so
|
|
176
204
|
// a run without formation evidence keeps the exact pre-PRI-843 payload.
|
|
177
205
|
...(input.formationContext !== undefined ? { formationContext: input.formationContext } : {}),
|
|
206
|
+
// PRI-644: only include priorValidatorErrors when the runner carried a
|
|
207
|
+
// fresh record, so first-attempt prompts stay byte-identical.
|
|
208
|
+
...(input.priorValidatorErrors !== undefined ? { priorValidatorErrors: input.priorValidatorErrors } : {}),
|
|
178
209
|
promptContractVersion: EVALUATOR_PROMPT_CONTRACT_VERSION,
|
|
179
210
|
};
|
|
180
211
|
const message = serializePromptInput(promptInput);
|
|
@@ -183,10 +214,19 @@ export class EvaluatorPromptBuilder {
|
|
|
183
214
|
// PRI-843: the formation-evidence addendum rides the same system channel
|
|
184
215
|
// and is appended ONLY when formationContext is present (the scribe
|
|
185
216
|
// addendum placement discipline — no-formation runs stay byte-identical).
|
|
217
|
+
// PRI-644: the validator-feedback addendum follows the same discipline —
|
|
218
|
+
// appended ONLY when a fresh priorValidatorErrors record was carried.
|
|
186
219
|
const formationAddendum = input.formationContext !== undefined
|
|
187
220
|
? EVALUATOR_FORMATION_EVIDENCE_ADDENDUM
|
|
188
221
|
: '';
|
|
189
|
-
|
|
222
|
+
const validatorFeedbackAddendum = input.priorValidatorErrors !== undefined
|
|
223
|
+
? EVALUATOR_VALIDATOR_FEEDBACK_ADDENDUM
|
|
224
|
+
: '';
|
|
225
|
+
return {
|
|
226
|
+
message,
|
|
227
|
+
promptInput,
|
|
228
|
+
systemPrompt: EVALUATOR_PROTOCOL_INSTRUCTION + formationAddendum + validatorFeedbackAddendum + languageDirective,
|
|
229
|
+
};
|
|
190
230
|
}
|
|
191
231
|
}
|
|
192
232
|
//# sourceMappingURL=evaluator-prompt-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluator-prompt-builder.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/evaluator-prompt-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"evaluator-prompt-builder.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/evaluator-prompt-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAK9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AA+FlE,SAAS,kBAAkB,CAAC,CAAS;IACnC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,cAAwF,EACxF,eAAkC;IAElC,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnD,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5C,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE;YAClB,SAAS;YACT,MAAM,EAAE,KAAc;SACvB,CAAC,CAAC,CAAC;IACN,CAAC;IACD,MAAM,OAAO,GAAG,cAAc;SAC3B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KA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AC,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7F,uEAAuE;YACvE,8DAA8D;YAC9D,GAAG,CAAC,KAAK,CAAC,oBAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,KAAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzG,qBAAqB,EAAE,iCAAiC;SACzD,CAAC;QAEF,MAAM,OAAO,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;QAElD,sEAAsE;QACtE,iDAAiD;QACjD,yEAAyE;QACzE,oEAAoE;QACpE,0EAA0E;QAC1E,yEAAyE;QACzE,sEAAsE;QACtE,MAAM,iBAAiB,GAAG,KAAK,CAAC,gBAAgB,KAAK,SAAS;YAC5D,CAAC,CAAC,qCAAqC;YACvC,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,yBAAyB,GAAG,KAAK,CAAC,oBAAoB,KAAK,SAAS;YACxE,CAAC,CAAC,qCAAqC;YACvC,CAAC,CAAC,EAAE,CAAC;QACP,OAAO;YACL,OAAO;YACP,WAAW;YACX,YAAY,EAAE,8BAA8B,GAAG,iBAAiB,GAAG,yBAAyB,GAAG,iBAAiB;SACjH,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -28,7 +28,7 @@ import type { RunHandle } from '../runtime-protocol.js';
|
|
|
28
28
|
import type { EvaluatorOutputV1, EvaluatorValidator } from './evaluator-output.js';
|
|
29
29
|
import type { TaskRecord } from '../task-status.js';
|
|
30
30
|
import { type PDErrorCategory } from '../error-categories.js';
|
|
31
|
-
import { type RepairPayload } from './pitask-metadata.js';
|
|
31
|
+
import { type RepairPayload, type LastValidatorErrors } from './pitask-metadata.js';
|
|
32
32
|
import { type PreviousEvaluationContext, type HostToolCatalogFacts } from './evaluator-prompt-builder.js';
|
|
33
33
|
import type { FormationContext } from './formation-context.js';
|
|
34
34
|
import type { ArtificerHostSemanticContext } from './artificer-prompt-builder.js';
|
|
@@ -67,6 +67,15 @@ interface EvaluatorContext {
|
|
|
67
67
|
* pre-PRI-843 shape exactly (legacy / degraded compatibility).
|
|
68
68
|
*/
|
|
69
69
|
readonly formationContext?: FormationContext;
|
|
70
|
+
/**
|
|
71
|
+
* PRI-644 (PRI-700 factor B wiring): verbatim validator rejection reasons
|
|
72
|
+
* from the immediately-preceding attempt, re-fed only when fresh
|
|
73
|
+
* (sourceAttemptCount === leased attempt - 1). Undefined on first attempt
|
|
74
|
+
* and when suppressed — the prompt then keeps its pre-PRI-644 shape exactly.
|
|
75
|
+
* Ephemeral prompt context: NEVER part of contextHash (same posture as the
|
|
76
|
+
* artificer — cache identity covers evidence, not feedback).
|
|
77
|
+
*/
|
|
78
|
+
readonly priorValidatorErrors?: LastValidatorErrors;
|
|
70
79
|
}
|
|
71
80
|
export type EvaluatorRunnerResultStatus = 'succeeded' | 'failed' | 'retried';
|
|
72
81
|
export interface EvaluatorRunnerResult {
|
|
@@ -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,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EACV,iBAAiB,EAEjB,kBAAkB,EAInB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAkB,KAAK,eAAe,EAAqB,MAAM,wBAAwB,CAAC;AACjG,OAAO,
|
|
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,MAA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G;IACH,OAAO,CAAC,MAAM,CAAC,8BAA8B;IA8B7C;;;;;;OAMG;IAEH,OAAO,CAAC,oBAAoB;IAO5B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,qBAAqB;IA0D7B;;;;;;;;;;;;;;;OAeG;IAEH,OAAO,CAAC,4BAA4B;IAmFpC;;;;;;;;;OASG;IAEH,OAAO,CAAC,cAAc;IA0DtB;;;;;;;;;;OAUG;YAEW,oBAAoB;IA0PlC;;;;;;;;;;OAUG;YACW,8BAA8B;IAmE5C;;;OAGG;IAEH,OAAO,CAAC,wBAAwB;IAwBhC,OAAO,CAAC,MAAM,CAAC,QAAQ;IAIvB;;;;;;;;;;;OAWG;YACW,oCAAoC;CA+BnD"}
|
|
@@ -3,7 +3,7 @@ import { isEvaluatorOutputV2 } from './evaluator-output.js';
|
|
|
3
3
|
// Artificer artifact, not from optional LLM output shape.
|
|
4
4
|
import { assessArtificerCodeBearing } from './artificer-code-bearing.js';
|
|
5
5
|
import { PDRuntimeError, isPDErrorCategory } from '../error-categories.js';
|
|
6
|
-
import { hydratePITaskRecord, createPITaskDiagnosticJson, mergePITaskMetadata, artificerRepairTaskId } from './pitask-metadata.js';
|
|
6
|
+
import { hydratePITaskRecord, createPITaskDiagnosticJson, mergePITaskMetadata, artificerRepairTaskId, parseLastValidatorErrors, isFreshForNextAttempt } from './pitask-metadata.js';
|
|
7
7
|
import { HUMAN_REVIEW_REASON, planOwnerVerdictOverrideResume, markOwnerResolutionApplied, computeArtifactContentHash, } from './owner-review.js';
|
|
8
8
|
import { EvaluatorPromptBuilder, deriveRequirementLedger, PRINCIPLE_PAIN_MISMATCH_MARKER } from './evaluator-prompt-builder.js';
|
|
9
9
|
import { resolveFormationContext } from './formation-context.js';
|
|
@@ -251,6 +251,26 @@ export class EvaluatorRunner extends BasePeerRunner {
|
|
|
251
251
|
}
|
|
252
252
|
const piTask = hydratePITaskRecord(task);
|
|
253
253
|
const deps = piTask?.dependencyTaskIds ?? [];
|
|
254
|
+
// PRI-644 (PRI-700 factor B wiring, mirrors artificer-runner): the
|
|
255
|
+
// previous attempt's verbatim validator rejections are re-fed so attempt
|
|
256
|
+
// N+1 is not a zero-information retry of the same prompt (the repair-
|
|
257
|
+
// round requirementLedger death loop). Freshness comes from the
|
|
258
|
+
// persisted sourceAttemptCount, not runtime state — restart-safe, and
|
|
259
|
+
// suppression stays observable (rc-9).
|
|
260
|
+
const priorValidatorErrors = parseLastValidatorErrors(task.diagnosticJson);
|
|
261
|
+
const attemptIsFresh = priorValidatorErrors !== null
|
|
262
|
+
&& isFreshForNextAttempt(priorValidatorErrors, this.currentLeasedAttempt);
|
|
263
|
+
if (priorValidatorErrors !== null && !attemptIsFresh) {
|
|
264
|
+
this.emitEvent('prior_validator_errors_suppressed', taskId, {
|
|
265
|
+
recordedAt: priorValidatorErrors.recordedAt,
|
|
266
|
+
errorCount: priorValidatorErrors.errors.length,
|
|
267
|
+
sourceAttemptCount: priorValidatorErrors.sourceAttemptCount,
|
|
268
|
+
currentAttempt: this.currentLeasedAttempt,
|
|
269
|
+
reason: this.currentLeasedAttempt === undefined
|
|
270
|
+
? 'no_lease_context'
|
|
271
|
+
: 'stale_source_attempt',
|
|
272
|
+
});
|
|
273
|
+
}
|
|
254
274
|
if (deps.length === 0) {
|
|
255
275
|
this.emitEvent('no_dependencies', taskId, {});
|
|
256
276
|
throw new PDRuntimeError('input_invalid', 'Artificer dependency artifact ID not resolved');
|
|
@@ -342,6 +362,7 @@ export class EvaluatorRunner extends BasePeerRunner {
|
|
|
342
362
|
...(dependencyRepairPayload !== undefined ? { dependencyRepairPayload } : {}),
|
|
343
363
|
...(previousEvaluation !== undefined ? { previousEvaluation } : {}),
|
|
344
364
|
...(formationContext !== undefined ? { formationContext } : {}),
|
|
365
|
+
...(priorValidatorErrors !== null && attemptIsFresh ? { priorValidatorErrors } : {}),
|
|
345
366
|
};
|
|
346
367
|
}
|
|
347
368
|
}
|
|
@@ -529,6 +550,9 @@ export class EvaluatorRunner extends BasePeerRunner {
|
|
|
529
550
|
// PRI-843: bounded formation evidence (undefined keeps the prompt payload
|
|
530
551
|
// byte-identical to its pre-PRI-843 shape).
|
|
531
552
|
formationContext: context.formationContext,
|
|
553
|
+
// PRI-644: fresh validator rejections from the previous attempt
|
|
554
|
+
// (undefined = first attempt / suppressed → prompt unchanged).
|
|
555
|
+
priorValidatorErrors: context.priorValidatorErrors,
|
|
532
556
|
});
|
|
533
557
|
return { message, systemPrompt };
|
|
534
558
|
}
|
|
@@ -2702,11 +2726,13 @@ export class EvaluatorRunner extends BasePeerRunner {
|
|
|
2702
2726
|
// ruleContent build so the contract rides in the same contentJson write.
|
|
2703
2727
|
let resolvedSourcePrincipleId;
|
|
2704
2728
|
let forwardedIntentContract;
|
|
2729
|
+
let bearerPrincipleContentJson;
|
|
2705
2730
|
try {
|
|
2706
2731
|
const principleBearerId = await this.resolvePrincipleBearerArtifact(output, taskId);
|
|
2707
2732
|
if (principleBearerId) {
|
|
2708
2733
|
const principleArtifact = await this.artifactStore.getArtifactById(principleBearerId);
|
|
2709
2734
|
if (principleArtifact) {
|
|
2735
|
+
bearerPrincipleContentJson = principleArtifact.contentJson;
|
|
2710
2736
|
resolvedSourcePrincipleId = EvaluatorRunner.extractPrincipleIdFromArtifact(principleArtifact);
|
|
2711
2737
|
let parsedPrincipleContent;
|
|
2712
2738
|
try {
|
|
@@ -2745,6 +2771,39 @@ export class EvaluatorRunner extends BasePeerRunner {
|
|
|
2745
2771
|
});
|
|
2746
2772
|
return null;
|
|
2747
2773
|
}
|
|
2774
|
+
// PRI-861 (CIL-003 option B): echo the bounded pain-source summary onto the
|
|
2775
|
+
// rule artifact so the RuleHostWriter approval card can show WHY this rule
|
|
2776
|
+
// exists. Connection, not creation: the value is the SAME
|
|
2777
|
+
// resolveFormationContext().sourceDiagnosis.summary projection the PRI-843
|
|
2778
|
+
// prompt path uses (clamp included) — the diagnosis artifact remains the
|
|
2779
|
+
// single source of truth (P4); this layer never re-summarizes and never
|
|
2780
|
+
// fabricates. Resolution is durable (bearer contentJson captured above,
|
|
2781
|
+
// store-backed walk), so fresh/resume/override assemblies are identical.
|
|
2782
|
+
// The resolver's NEVER-throws contract (PRI-838: store failures become
|
|
2783
|
+
// observable events + undefined) is trusted exactly like the prompt-path
|
|
2784
|
+
// caller — a defensive try here would be unreachable dead code. Absence is
|
|
2785
|
+
// design-legal (PRI-530 receipt contract): readers keep their tested
|
|
2786
|
+
// fallback — but it must be observable (rc-9).
|
|
2787
|
+
let painReasonSummary;
|
|
2788
|
+
const dreamerRef = readDreamerArtifactIdFromScribeArtifact(bearerPrincipleContentJson ?? null);
|
|
2789
|
+
const formationContext = await resolveFormationContext({
|
|
2790
|
+
sourceDreamerArtifactId: dreamerRef,
|
|
2791
|
+
artifactStore: this.artifactStore,
|
|
2792
|
+
lookupTask: (id) => this.lookupFormationTask(id),
|
|
2793
|
+
emitEvent: (eventName, eventTaskId, payload) => this.emitEvent(eventName, eventTaskId, payload),
|
|
2794
|
+
taskId,
|
|
2795
|
+
});
|
|
2796
|
+
const projected = formationContext?.sourceDiagnosis?.summary;
|
|
2797
|
+
if (typeof projected === 'string' && projected.trim() !== '') {
|
|
2798
|
+
painReasonSummary = projected.trim();
|
|
2799
|
+
}
|
|
2800
|
+
else {
|
|
2801
|
+
this.emitEvent('pain_reason_summary_skipped', taskId, {
|
|
2802
|
+
runId,
|
|
2803
|
+
reason: dreamerRef === undefined ? 'no_dreamer_lineage_on_scribe' : 'diagnosis_summary_unavailable',
|
|
2804
|
+
nextAction: 'approval_card_keeps_generic_trigger_reason',
|
|
2805
|
+
});
|
|
2806
|
+
}
|
|
2748
2807
|
const ruleContent = {
|
|
2749
2808
|
implementationCode,
|
|
2750
2809
|
goldenTrace: traceBuild.trace,
|
|
@@ -2765,6 +2824,11 @@ export class EvaluatorRunner extends BasePeerRunner {
|
|
|
2765
2824
|
// the rule artifact self-carries the intent anchor it was validated
|
|
2766
2825
|
// against (echo of the scribe single source, never a re-derivation).
|
|
2767
2826
|
...(forwardedIntentContract !== undefined ? { intentContract: forwardedIntentContract } : {}),
|
|
2827
|
+
// PRI-861: bounded echo of the formation diagnosis summary (presentation
|
|
2828
|
+
// evidence only — no governance authority reads it). Absent when the
|
|
2829
|
+
// chain carries no resolvable diagnosis; readers then keep their
|
|
2830
|
+
// tested fallback wording.
|
|
2831
|
+
...(painReasonSummary !== undefined ? { painReasonSummary } : {}),
|
|
2768
2832
|
};
|
|
2769
2833
|
const ruleArtifactId = `pi-rule-${taskId}-${runId}`;
|
|
2770
2834
|
const ruleId = `rule-${taskId}`;
|