@principles/core 1.286.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__/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/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
|
@@ -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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,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,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,EAAgJ,KAAK,aAAa,EAAqE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAQrS,OAAO,EAAmF,KAAK,yBAAyB,EAAE,KAAK,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAE3L,OAAO,KAAK,EAAE,gBAAgB,EAAqB,MAAM,wBAAwB,CAAC;AAClF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAwB,KAAK,sBAAsB,EAAE,KAAK,oBAAoB,EAAE,KAAK,WAAW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|
|
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}`;
|