create-principles-disciple 1.153.0 → 1.153.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.
Files changed (138) hide show
  1. package/_release/product-identity.json +1 -1
  2. package/console/dist/server/models/ActivationsConsoleModel.d.ts +8 -0
  3. package/console/dist/server/models/ActivationsConsoleModel.js +3 -2
  4. package/console/dist/server/models/ExaminerEvidenceModel.d.ts +6 -2
  5. package/console/dist/server/models/ExaminerEvidenceModel.js +13 -2
  6. package/console/dist/server/routes/examiner-executor.d.ts +33 -0
  7. package/console/dist/server/routes/examiner-executor.js +95 -0
  8. package/console/dist/server/routes/examiner.js +12 -9
  9. package/console/dist/web/assets/app.css +8 -10
  10. package/console/dist/web/assets/app.js +27 -27
  11. package/core/dist/ledger-file-lock.d.ts +38 -0
  12. package/core/dist/ledger-file-lock.d.ts.map +1 -0
  13. package/core/dist/ledger-file-lock.js +240 -0
  14. package/core/dist/ledger-file-lock.js.map +1 -0
  15. package/core/dist/principle-text-normalization.d.ts +32 -0
  16. package/core/dist/principle-text-normalization.d.ts.map +1 -0
  17. package/core/dist/principle-text-normalization.js +34 -0
  18. package/core/dist/principle-text-normalization.js.map +1 -0
  19. package/core/dist/principle-tree-ledger.d.ts +22 -21
  20. package/core/dist/principle-tree-ledger.d.ts.map +1 -1
  21. package/core/dist/principle-tree-ledger.js +77 -204
  22. package/core/dist/principle-tree-ledger.js.map +1 -1
  23. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts +13 -0
  24. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts.map +1 -1
  25. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.js +90 -1
  26. package/core/dist/runtime/adapter/principle-tree-ledger-adapter.js.map +1 -1
  27. package/core/dist/runtime/adapter/schema-prompt-adapter.d.ts.map +1 -1
  28. package/core/dist/runtime/adapter/schema-prompt-adapter.js +21 -30
  29. package/core/dist/runtime/adapter/schema-prompt-adapter.js.map +1 -1
  30. package/core/dist/runtime/candidate-intake-service.d.ts +40 -1
  31. package/core/dist/runtime/candidate-intake-service.d.ts.map +1 -1
  32. package/core/dist/runtime/candidate-intake-service.js +548 -110
  33. package/core/dist/runtime/candidate-intake-service.js.map +1 -1
  34. package/core/dist/runtime/candidate-intake.d.ts +59 -2
  35. package/core/dist/runtime/candidate-intake.d.ts.map +1 -1
  36. package/core/dist/runtime/candidate-intake.js +23 -0
  37. package/core/dist/runtime/candidate-intake.js.map +1 -1
  38. package/core/dist/runtime/candidate-seed-suppression.d.ts +63 -0
  39. package/core/dist/runtime/candidate-seed-suppression.d.ts.map +1 -0
  40. package/core/dist/runtime/candidate-seed-suppression.js +29 -0
  41. package/core/dist/runtime/candidate-seed-suppression.js.map +1 -0
  42. package/core/dist/runtime/config/pd-config-agent-binding.d.ts +5 -5
  43. package/core/dist/runtime/config/pd-config-agent-binding.d.ts.map +1 -1
  44. package/core/dist/runtime/config/pd-config-agent-binding.js +22 -16
  45. package/core/dist/runtime/config/pd-config-agent-binding.js.map +1 -1
  46. package/core/dist/runtime/config/pd-credentials.d.ts.map +1 -1
  47. package/core/dist/runtime/config/pd-credentials.js +7 -1
  48. package/core/dist/runtime/config/pd-credentials.js.map +1 -1
  49. package/core/dist/runtime/diagnostician/distiller-prompt-builder.d.ts.map +1 -1
  50. package/core/dist/runtime/diagnostician/distiller-prompt-builder.js +30 -3
  51. package/core/dist/runtime/diagnostician/distiller-prompt-builder.js.map +1 -1
  52. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
  53. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js +16 -5
  54. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js.map +1 -1
  55. package/core/dist/runtime/diagnostician/router-prompt-builder.d.ts.map +1 -1
  56. package/core/dist/runtime/diagnostician/router-prompt-builder.js +16 -4
  57. package/core/dist/runtime/diagnostician/router-prompt-builder.js.map +1 -1
  58. package/core/dist/runtime/index.d.ts +4 -2
  59. package/core/dist/runtime/index.d.ts.map +1 -1
  60. package/core/dist/runtime/index.js +3 -1
  61. package/core/dist/runtime/index.js.map +1 -1
  62. package/core/dist/runtime/internalization/dreamer-prompt-builder.d.ts.map +1 -1
  63. package/core/dist/runtime/internalization/dreamer-prompt-builder.js +177 -29
  64. package/core/dist/runtime/internalization/dreamer-prompt-builder.js.map +1 -1
  65. package/core/dist/runtime/internalization/internalization-orchestrator.d.ts +16 -2
  66. package/core/dist/runtime/internalization/internalization-orchestrator.d.ts.map +1 -1
  67. package/core/dist/runtime/internalization/internalization-orchestrator.js +48 -14
  68. package/core/dist/runtime/internalization/internalization-orchestrator.js.map +1 -1
  69. package/core/dist/runtime/internalization/philosopher-prompt-builder.d.ts.map +1 -1
  70. package/core/dist/runtime/internalization/philosopher-prompt-builder.js +7 -6
  71. package/core/dist/runtime/internalization/philosopher-prompt-builder.js.map +1 -1
  72. package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts +13 -6
  73. package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts.map +1 -1
  74. package/core/dist/runtime/internalization/scribe-prompt-builder.js +15 -10
  75. package/core/dist/runtime/internalization/scribe-prompt-builder.js.map +1 -1
  76. package/core/dist/runtime/pain-signal-bridge.d.ts +3 -0
  77. package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
  78. package/core/dist/runtime/pain-signal-bridge.js +224 -93
  79. package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
  80. package/core/dist/runtime/pain-submit-capability.d.ts.map +1 -1
  81. package/core/dist/runtime/pain-submit-capability.js +3 -5
  82. package/core/dist/runtime/pain-submit-capability.js.map +1 -1
  83. package/core/dist/runtime/pain-to-principle-service.d.ts.map +1 -1
  84. package/core/dist/runtime/pain-to-principle-service.js +18 -21
  85. package/core/dist/runtime/pain-to-principle-service.js.map +1 -1
  86. package/core/dist/runtime/store/candidate/admission-document.d.ts +129 -0
  87. package/core/dist/runtime/store/candidate/admission-document.d.ts.map +1 -1
  88. package/core/dist/runtime/store/candidate/admission-document.js +196 -0
  89. package/core/dist/runtime/store/candidate/admission-document.js.map +1 -1
  90. package/core/dist/runtime/store/candidate/candidate-store.d.ts +54 -1
  91. package/core/dist/runtime/store/candidate/candidate-store.d.ts.map +1 -1
  92. package/core/dist/runtime/store/candidate/memory-candidate-store.d.ts +32 -1
  93. package/core/dist/runtime/store/candidate/memory-candidate-store.d.ts.map +1 -1
  94. package/core/dist/runtime/store/candidate/memory-candidate-store.js +24 -1
  95. package/core/dist/runtime/store/candidate/memory-candidate-store.js.map +1 -1
  96. package/core/dist/runtime/store/candidate/sqlite-candidate-store.d.ts +32 -1
  97. package/core/dist/runtime/store/candidate/sqlite-candidate-store.d.ts.map +1 -1
  98. package/core/dist/runtime/store/candidate/sqlite-candidate-store.js +76 -1
  99. package/core/dist/runtime/store/candidate/sqlite-candidate-store.js.map +1 -1
  100. package/core/dist/runtime/store/runtime-state-manager.d.ts +34 -1
  101. package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
  102. package/core/dist/runtime/store/runtime-state-manager.js +10 -0
  103. package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
  104. package/core/package.json +1 -1
  105. package/host-runtime/dist/governance-signal-admission.js +1 -5
  106. package/host-runtime/package.json +1 -1
  107. package/package.json +2 -2
  108. package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
  109. package/pd-cli/dist/commands/candidate.js +243 -28
  110. package/pd-cli/dist/commands/candidate.js.map +1 -1
  111. package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
  112. package/pd-cli/dist/commands/diagnose.js +110 -7
  113. package/pd-cli/dist/commands/diagnose.js.map +1 -1
  114. package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
  115. package/pd-cli/dist/commands/pain-retry.js +3 -0
  116. package/pd-cli/dist/commands/pain-retry.js.map +1 -1
  117. package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
  118. package/pd-cli/dist/commands/runtime-internalization-run-once.js +68 -2
  119. package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
  120. package/pd-cli/dist/program.d.ts.map +1 -1
  121. package/pd-cli/dist/program.js +11 -1
  122. package/pd-cli/dist/program.js.map +1 -1
  123. package/pd-cli/dist/services/admission-write-gate.d.ts.map +1 -1
  124. package/pd-cli/dist/services/admission-write-gate.js +18 -7
  125. package/pd-cli/dist/services/admission-write-gate.js.map +1 -1
  126. package/pd-cli/dist/services/demo-story-a-runner.d.ts.map +1 -1
  127. package/pd-cli/dist/services/demo-story-a-runner.js +8 -3
  128. package/pd-cli/dist/services/demo-story-a-runner.js.map +1 -1
  129. package/pd-cli/dist/services/reuse-park-release.d.ts +142 -0
  130. package/pd-cli/dist/services/reuse-park-release.d.ts.map +1 -0
  131. package/pd-cli/dist/services/reuse-park-release.js +201 -0
  132. package/pd-cli/dist/services/reuse-park-release.js.map +1 -0
  133. package/pd-cli/package.json +1 -1
  134. package/plugin/dist/bundle.js +819 -629
  135. package/plugin/dist/openclaw.plugin.json +1 -1
  136. package/plugin/openclaw.plugin.json +1 -1
  137. package/plugin/package.json +1 -1
  138. package/release-manager/package.json +1 -1
@@ -2,8 +2,9 @@ import { DiagnosticianOutputV2Schema } from './diagnostician-output.js';
2
2
  import { Value } from '@sinclair/typebox/value';
3
3
  import { evaluateCandidateAdmissions, normalizePainProvenance } from './admission-gate.js';
4
4
  import { shouldShortCircuitEmptyEvidence, isOwnerStatementEvidence } from './evidence-guards.js';
5
- import { ADMISSION_POLICY_VERSION, fingerprintMaterial, fingerprintStatement, } from './store/candidate/admission-document.js';
5
+ import { ADMISSION_POLICY_VERSION, fingerprintMaterial, fingerprintStatement, pendingOwnerDecision, } from './store/candidate/admission-document.js';
6
6
  import { parseRootCauseCategory } from './store/pain-diagnosis/pain-diagnosis-store.js';
7
+ import { evaluateDreamerSeedSuppression } from './candidate-seed-suppression.js';
7
8
  import { buildDreamerSeedFromCandidate, findExistingDreamerTask, ROUTE_CHANNEL_MAP, CANDIDATE_KIND_TO_ROUTE } from './internalization/intake-to-internalization-bridge.js';
8
9
  import { isRetryWaitBackoffElapsed } from './internalization/internalization-task-guards.js';
9
10
  import { shapeBridgeResult } from './bridge-result-shaper.js';
@@ -205,6 +206,19 @@ function buildDiagnosticJson(data, workspaceDir) {
205
206
  ...(data.painIngress ? { painIngress: data.painIngress } : {}),
206
207
  });
207
208
  }
209
+ export async function persistPendingPainSignal(stateManager, data, workspaceDir) {
210
+ const taskId = data.taskId ?? createDiagnosticianTaskId(data.painId);
211
+ await stateManager.createTask({
212
+ taskId,
213
+ taskKind: 'diagnostician',
214
+ inputRef: data.painId,
215
+ status: 'pending',
216
+ attemptCount: 0,
217
+ maxAttempts: 3,
218
+ diagnosticJson: buildDiagnosticJson(data, workspaceDir),
219
+ });
220
+ return { taskId };
221
+ }
208
222
  /**
209
223
  * Pain Diagnosis Persistence: link the diagnostician's root-cause attribution
210
224
  * to the canonical pain_id in state.db pain_diagnoses. Runs BEFORE admission
@@ -642,18 +656,7 @@ export class PainSignalBridge {
642
656
  * PRI-369: async pain-record CLI — fire-and-forget submission.
643
657
  */
644
658
  async submitPainSignal(data) {
645
- const taskId = data.taskId ?? createDiagnosticianTaskId(data.painId);
646
- const diagnosticJson = buildDiagnosticJson(data, this.workspaceDir);
647
- await this.stateManager.createTask({
648
- taskId,
649
- taskKind: 'diagnostician',
650
- inputRef: data.painId,
651
- status: 'pending',
652
- attemptCount: 0,
653
- maxAttempts: 3,
654
- diagnosticJson,
655
- });
656
- return { taskId };
659
+ return persistPendingPainSignal(this.stateManager, data, this.workspaceDir);
657
660
  }
658
661
  async onPainDetected(data) {
659
662
  const { painId } = data;
@@ -668,15 +671,7 @@ export class PainSignalBridge {
668
671
  if (this.capabilityDisabled !== undefined) {
669
672
  const existing = await this.stateManager.getTask(taskId);
670
673
  if (existing === null) {
671
- await this.stateManager.createTask({
672
- taskId,
673
- taskKind: 'diagnostician',
674
- inputRef: painId,
675
- status: 'pending',
676
- attemptCount: 0,
677
- maxAttempts: 3,
678
- diagnosticJson: buildDiagnosticJson(data, this.workspaceDir),
679
- });
674
+ await this.submitPainSignal(data);
680
675
  }
681
676
  else if (existing.status === 'succeeded') {
682
677
  return this.buildExistingResult({ painId, taskId });
@@ -1043,6 +1038,13 @@ export class PainSignalBridge {
1043
1038
  // PRI-917 v0.3.3: candidates parked by the Reuse Review Gate (suspected
1044
1039
  // duplicates awaiting the Owner) — kept OUT of seeding/consumption.
1045
1040
  const reuseReviewRequiredByCandidate = new Map();
1041
+ // Phase 7.2 B2.5: candidates whose Dreamer seed was SUPPRESSED because
1042
+ // they are already resolved onto an existing principle (or still parked).
1043
+ const seedSuppressedByCandidate = new Map();
1044
+ // Phase 7.2 P1-01/P1-03: candidates carrying a PENDING typed Owner
1045
+ // decision — kept OUT of seeding/consumption/completion; the decision
1046
+ // lifecycle (Phase B/C re-run) owns their terminal state.
1047
+ const ownerDecisionPendingByCandidate = new Set();
1046
1048
  // PRI-939 Option A: auto-path hook outcomes for CREATE dispositions —
1047
1049
  // `unavailable` must reach the Owner's output, not die at the gate.
1048
1050
  const reuseRecommendationByCandidate = new Map();
@@ -1085,7 +1087,12 @@ export class PainSignalBridge {
1085
1087
  intakeResult = { outcome: 'ledger_entry', written: false, entry: existingLedgerEntry };
1086
1088
  }
1087
1089
  else {
1088
- intakeResult = await this.intakeService.intake(candidate.candidateId);
1090
+ // Phase 7.2 P2-01 review fix: pass this diagnosis's authoritative
1091
+ // pain as the hint the B1 exact-duplicate audit uses when the
1092
+ // flag-gated pain_diagnoses store has no row for the task —
1093
+ // without it, a workspace with pain-diagnosis persistence off
1094
+ // would fail every dedup resolution as reuse_pain_unresolvable.
1095
+ intakeResult = await this.intakeService.intake(candidate.candidateId, { painIdHint: painId });
1089
1096
  }
1090
1097
  }
1091
1098
  catch (intakeErr) {
@@ -1151,82 +1158,147 @@ export class PainSignalBridge {
1151
1158
  });
1152
1159
  continue;
1153
1160
  }
1161
+ // Phase 7.2 P1-01/P1-03 — a PENDING typed Owner decision whose
1162
+ // execution has not completed. The automatic path must not override
1163
+ // it: no consumption, no seed, no processing completion, and the
1164
+ // pending verdict stays visible in the report (same channel as the
1165
+ // park) with the resume nextAction. The decision lifecycle owns the
1166
+ // candidate's terminal state from here — Phase C completes it.
1167
+ if (intakeResult.outcome === 'refused' && intakeResult.reason === 'owner_decision_pending') {
1168
+ this.eventEmitter?.emitTelemetry({
1169
+ eventType: 'owner_decision_pending_skipped',
1170
+ traceId: candidate.candidateId,
1171
+ timestamp: new Date().toISOString(),
1172
+ payload: { candidateId: candidate.candidateId, message: intakeResult.message },
1173
+ });
1174
+ ownerDecisionPendingByCandidate.add(candidate.candidateId);
1175
+ continue;
1176
+ }
1177
+ // Phase 7.2 B2.5 — Dreamer seed suppression. A candidate already
1178
+ // resolved onto an existing principle (Owner reuse decision, INV-R07
1179
+ // replay, or the B1 exact-duplicate guard — all durable via the
1180
+ // ledger's reuseEvidence, i.e. identity basis 'principle_reuse') or
1181
+ // still parked for the Owner (persisted admission processing) has no
1182
+ // information gain from an independent exploration chain. The check
1183
+ // reads PERSISTENT facts, so it holds across restarts, rescans and
1184
+ // this very recovery loop (production anomaly 19aa989d: consumed AND
1185
+ // parked AND seeded).
1186
+ let seedSuppression = { suppress: false };
1154
1187
  try {
1155
- const route = CANDIDATE_KIND_TO_ROUTE[candidate.recommendationKind ?? ''];
1156
- if (route) {
1157
- // PRI-539: `ready` reflects only whether the route maps to a channel.
1158
- // Let computeBridgeDecision() itself decide MVP-disabled so the
1159
- // not_internalizable reason is accurate ("Channel ... MVP-disabled")
1160
- // instead of the misleading "not ready — missing required fields".
1161
- const channel = ROUTE_CHANNEL_MAP[route];
1162
- const ready = !!channel;
1163
- const seed = buildDreamerSeedFromCandidate(candidate, {
1164
- route,
1165
- ready,
1166
- sourcePainId: painId,
1167
- // PRI-720: explicit full-chain override when the Owner switched
1168
- // prompt_full_pipeline on. Seed-time application — in-flight
1169
- // chains keep their seeded topology.
1170
- pipelineMode: this.fullPipelinePromptSeeds ? 'full_chain' : undefined,
1188
+ const resolveIdentity = this.ledgerAdapter.resolveCandidatePrincipleIdentity;
1189
+ if (typeof resolveIdentity === 'function') {
1190
+ const admissionDoc = await this.stateManager.getAdmissionDocument(candidate.candidateId);
1191
+ const pending = pendingOwnerDecision(admissionDoc.ok ? admissionDoc.document ?? null : null);
1192
+ seedSuppression = evaluateDreamerSeedSuppression({
1193
+ identity: resolveIdentity.call(this.ledgerAdapter, candidate.candidateId, candidate.recommendationKind ?? 'principle'),
1194
+ processing: admissionDoc.ok ? admissionDoc.document?.processing : undefined,
1195
+ ...(pending !== null ? { pendingOwnerDecision: { decision: pending.decision } } : {}),
1171
1196
  });
1172
- // eslint-disable-next-line no-restricted-syntax -- 'in' required for discriminated union narrowing (BridgeTaskSeed | BridgeDecision)
1173
- if (!('decision' in seed)) {
1174
- // PRI-720 C6: dedup at candidate level — the demotion may have
1175
- // changed the derived channel suffix vs a pre-existing chain.
1176
- const existingTask = await findExistingDreamerTask((id) => this.stateManager.getTask(id), candidate.candidateId);
1177
- if (!existingTask) {
1178
- await this.stateManager.createTask({
1179
- taskId: seed.taskId,
1180
- taskKind: seed.taskKind,
1181
- inputRef: '',
1182
- status: seed.status,
1183
- attemptCount: seed.attemptCount,
1184
- maxAttempts: seed.maxAttempts,
1185
- diagnosticJson: seed.diagnosticJson,
1186
- });
1187
- seededTaskByCandidate.set(candidate.candidateId, seed.taskId);
1188
- this.eventEmitter?.emitTelemetry({
1189
- eventType: 'candidate_dreamer_task_seeded',
1190
- traceId: candidate.candidateId,
1191
- timestamp: new Date().toISOString(),
1192
- // rc-9: the full-chain override and the C6 channel demotion
1193
- // must both be observable at seed time.
1194
- payload: {
1195
- taskId: seed.taskId,
1196
- channel: seed.channel,
1197
- ...(seed.pipelineMode ? { pipelineMode: seed.pipelineMode } : {}),
1198
- ...(seed.demotedFromChannel ? { demotedFromChannel: seed.demotedFromChannel } : {}),
1199
- },
1200
- });
1201
- }
1202
- }
1203
- else if (seed.decision === 'not_internalizable') {
1204
- // PRI-539: surface MVP-disabled candidates instead of silently
1205
- // marking them consumed (rc-9-no-silent-fallback / ERR-002).
1206
- notInternalizable.push({ candidateId: candidate.candidateId, reason: seed.reason });
1207
- this.eventEmitter?.emitTelemetry({
1208
- eventType: 'candidate_not_internalizable',
1209
- traceId: candidate.candidateId,
1210
- timestamp: new Date().toISOString(),
1211
- payload: { reason: seed.reason, channel: channel ?? null, route },
1212
- });
1213
- }
1214
1197
  }
1215
1198
  }
1216
- catch (seedErr) {
1217
- seedFailureCandidateIds.push(candidate.candidateId);
1199
+ catch (identityErr) {
1200
+ // Fail-open with visible telemetry: the suppression is a
1201
+ // chain-budget correctness guard, not a safety gate — an unexpected
1202
+ // identity/processing read failure must not block learning (Rule 4
1203
+ // posture), but it must be observable (rc-9). Distinct event type
1204
+ // so it never masks a real seed failure.
1218
1205
  this.eventEmitter?.emitTelemetry({
1219
- eventType: 'candidate_dreamer_task_seed_failed',
1206
+ eventType: 'candidate_seed_suppression_check_failed',
1220
1207
  traceId: candidate.candidateId,
1221
1208
  timestamp: new Date().toISOString(),
1222
- payload: { error: String(seedErr) },
1209
+ payload: { error: `seed-suppression check failed: ${String(identityErr)}` },
1223
1210
  });
1224
- // CR-05 (SPEC §9.1): seed failure is a post-processing orphan —
1225
- // consumed-but-unseeded must stay discoverable by the worker
1226
- // continuation (never hidden behind the consumed status).
1227
- void this.recordPostProcessingFailure(candidate.candidateId, `seed_failed:${String(seedErr)}`).catch(() => undefined);
1228
1211
  }
1229
- if (candidate.status !== 'consumed') {
1212
+ if (seedSuppression.suppress) {
1213
+ seedSuppressedByCandidate.set(candidate.candidateId, seedSuppression);
1214
+ }
1215
+ else {
1216
+ try {
1217
+ const route = CANDIDATE_KIND_TO_ROUTE[candidate.recommendationKind ?? ''];
1218
+ if (route) {
1219
+ // PRI-539: `ready` reflects only whether the route maps to a channel.
1220
+ // Let computeBridgeDecision() itself decide MVP-disabled so the
1221
+ // not_internalizable reason is accurate ("Channel ... MVP-disabled")
1222
+ // instead of the misleading "not ready — missing required fields".
1223
+ const channel = ROUTE_CHANNEL_MAP[route];
1224
+ const ready = !!channel;
1225
+ const seed = buildDreamerSeedFromCandidate(candidate, {
1226
+ route,
1227
+ ready,
1228
+ sourcePainId: painId,
1229
+ // PRI-720: explicit full-chain override when the Owner switched
1230
+ // prompt_full_pipeline on. Seed-time application — in-flight
1231
+ // chains keep their seeded topology.
1232
+ pipelineMode: this.fullPipelinePromptSeeds ? 'full_chain' : undefined,
1233
+ });
1234
+ // eslint-disable-next-line no-restricted-syntax -- 'in' required for discriminated union narrowing (BridgeTaskSeed | BridgeDecision)
1235
+ if (!('decision' in seed)) {
1236
+ // PRI-720 C6: dedup at candidate level — the demotion may have
1237
+ // changed the derived channel suffix vs a pre-existing chain.
1238
+ const existingTask = await findExistingDreamerTask((id) => this.stateManager.getTask(id), candidate.candidateId);
1239
+ if (!existingTask) {
1240
+ await this.stateManager.createTask({
1241
+ taskId: seed.taskId,
1242
+ taskKind: seed.taskKind,
1243
+ inputRef: '',
1244
+ status: seed.status,
1245
+ attemptCount: seed.attemptCount,
1246
+ maxAttempts: seed.maxAttempts,
1247
+ diagnosticJson: seed.diagnosticJson,
1248
+ });
1249
+ seededTaskByCandidate.set(candidate.candidateId, seed.taskId);
1250
+ this.eventEmitter?.emitTelemetry({
1251
+ eventType: 'candidate_dreamer_task_seeded',
1252
+ traceId: candidate.candidateId,
1253
+ timestamp: new Date().toISOString(),
1254
+ // rc-9: the full-chain override and the C6 channel demotion
1255
+ // must both be observable at seed time.
1256
+ payload: {
1257
+ taskId: seed.taskId,
1258
+ channel: seed.channel,
1259
+ ...(seed.pipelineMode ? { pipelineMode: seed.pipelineMode } : {}),
1260
+ ...(seed.demotedFromChannel ? { demotedFromChannel: seed.demotedFromChannel } : {}),
1261
+ },
1262
+ });
1263
+ }
1264
+ }
1265
+ else if (seed.decision === 'not_internalizable') {
1266
+ // PRI-539: surface MVP-disabled candidates instead of silently
1267
+ // marking them consumed (rc-9-no-silent-fallback / ERR-002).
1268
+ notInternalizable.push({ candidateId: candidate.candidateId, reason: seed.reason });
1269
+ this.eventEmitter?.emitTelemetry({
1270
+ eventType: 'candidate_not_internalizable',
1271
+ traceId: candidate.candidateId,
1272
+ timestamp: new Date().toISOString(),
1273
+ payload: { reason: seed.reason, channel: channel ?? null, route },
1274
+ });
1275
+ }
1276
+ }
1277
+ }
1278
+ catch (seedErr) {
1279
+ seedFailureCandidateIds.push(candidate.candidateId);
1280
+ this.eventEmitter?.emitTelemetry({
1281
+ eventType: 'candidate_dreamer_task_seed_failed',
1282
+ traceId: candidate.candidateId,
1283
+ timestamp: new Date().toISOString(),
1284
+ payload: { error: String(seedErr) },
1285
+ });
1286
+ // CR-05 (SPEC §9.1): seed failure is a post-processing orphan —
1287
+ // consumed-but-unseeded must stay discoverable by the worker
1288
+ // continuation (never hidden behind the consumed status).
1289
+ void this.recordPostProcessingFailure(candidate.candidateId, `seed_failed:${String(seedErr)}`).catch(() => undefined);
1290
+ }
1291
+ } // end of the !seedSuppression.suppress guard (Phase 7.2 B2.5)
1292
+ // Phase 7.2 B2.5 (CodeRabbit): a candidate suppressed because a
1293
+ // persisted reuse PARK is still awaiting the Owner must NOT be
1294
+ // consumed — consuming it (or completing its processing below) would
1295
+ // clear the waiting state without an Owner decision or release audit,
1296
+ // recreating the exact bypass B2 exists to close. A candidate
1297
+ // suppressed because it is RESOLVED onto an existing principle IS
1298
+ // terminal: consume + complete as usual.
1299
+ const suppression = seedSuppressedByCandidate.get(candidate.candidateId);
1300
+ const parkedSuppressed = suppression?.suppress === true && suppression.reason === 'reuse_park_pending_owner';
1301
+ if (!parkedSuppressed && candidate.status !== 'consumed') {
1230
1302
  await this.stateManager.updateCandidateStatus(candidate.candidateId, { status: 'consumed' });
1231
1303
  }
1232
1304
  }
@@ -1245,6 +1317,15 @@ export class PainSignalBridge {
1245
1317
  continue;
1246
1318
  if (reuseReviewRequiredByCandidate.has(candidate.candidateId))
1247
1319
  continue;
1320
+ // Phase 7.2 B2.5: a park-pending suppression keeps awaiting_owner — the
1321
+ // Owner channel (with its release audit) is the only way out.
1322
+ const suppressedEntry = seedSuppressedByCandidate.get(candidate.candidateId);
1323
+ if (suppressedEntry?.suppress === true && suppressedEntry.reason === 'reuse_park_pending_owner')
1324
+ continue;
1325
+ // Phase 7.2 P1-01: a pending Owner decision keeps its own lifecycle
1326
+ // state — Phase C (not this loop) completes the candidate.
1327
+ if (ownerDecisionPendingByCandidate.has(candidate.candidateId))
1328
+ continue;
1248
1329
  this.safeUpdateAdmissionProcessing(candidate.candidateId, {
1249
1330
  state: 'complete',
1250
1331
  attempts: 0,
@@ -1296,6 +1377,27 @@ export class PainSignalBridge {
1296
1377
  outcome.reason = 'reuse_review_required';
1297
1378
  outcome.nextAction = `pd candidate review --candidate-id ${candidate.candidateId} --decide reuse|create --reason "..."`;
1298
1379
  }
1380
+ // Phase 7.2 P1-01 — pending Owner decision override: the candidate is
1381
+ // neither parked nor failed; a persisted Owner verdict is awaiting its
1382
+ // own resumption (rc-9 visible, never a silent skip).
1383
+ if (ownerDecisionPendingByCandidate.has(candidate.candidateId)) {
1384
+ outcome.reason = 'owner_decision_pending';
1385
+ outcome.nextAction = `pd candidate review --candidate-id ${candidate.candidateId} --decide reuse|create --reason "..." (re-run the SAME verdict to resume the recorded decision)`;
1386
+ }
1387
+ // Phase 7.2 B2.5 — seed-suppression override: the candidate IS consumed
1388
+ // and terminally resolved, but no Dreamer chain exists BY DESIGN (rc-9:
1389
+ // the suppression must be visible in the outcome, not silent).
1390
+ const suppressed = seedSuppressedByCandidate.get(candidate.candidateId);
1391
+ if (suppressed !== undefined && suppressed.suppress) {
1392
+ if (suppressed.reason === 'reuse_resolved_to_existing_principle') {
1393
+ outcome.reason = `dreamer_seed_suppressed: resolved onto existing principle ${suppressed.principleId}`;
1394
+ outcome.nextAction = 'No action required: this candidate is durably resolved (reuseEvidence); the existing principle already carries the mechanism.';
1395
+ }
1396
+ else {
1397
+ outcome.reason = 'dreamer_seed_suppressed: reuse park pending Owner decision';
1398
+ outcome.nextAction = `pd candidate review --candidate-id ${candidate.candidateId} --decide reuse|create --reason "..."`;
1399
+ }
1400
+ }
1299
1401
  // PRI-939 Option A — surface the auto-path evaluation outcome on the
1300
1402
  // CREATE disposition (status + bounded reason only; the park shape
1301
1403
  // already carries its own recommendation fields via reason/nextAction).
@@ -1355,11 +1457,40 @@ export class PainSignalBridge {
1355
1457
  // Without this, a batch of non-principle candidates that the write
1356
1458
  // boundary correctly refused would be misreported as an intake FAILURE
1357
1459
  // instead of their real disposition (routed / not_internalizable).
1358
- ledgerEligibleCandidateCount: candidates.filter((candidate, i) => admissionResults[i]?.admission.decision === 'admitted'
1359
- && isPrincipleLedgerEligibleKind(candidate.rawRecommendationKind)).length,
1460
+ ledgerEligibleCandidateCount: candidates.filter((candidate, i) => {
1461
+ if (admissionResults[i]?.admission.decision !== 'admitted')
1462
+ return false;
1463
+ if (!isPrincipleLedgerEligibleKind(candidate.rawRecommendationKind))
1464
+ return false;
1465
+ // Phase 7.2 P1-01: a candidate carrying a pending Owner decision is
1466
+ // equally not expected to produce an entry on the AUTOMATIC path.
1467
+ if (ownerDecisionPendingByCandidate.has(candidate.candidateId))
1468
+ return false;
1469
+ // Phase 7.2 B2.5 (CodeRabbit): a candidate already RESOLVED onto an
1470
+ // existing principle (reuse decision / INV-R07 replay / B1 exact-dup
1471
+ // resolution) intentionally has NO ledger entry of its own — counting
1472
+ // it as "expected" would misreport a resolved single-candidate batch
1473
+ // as an intake failure. Parked candidates are handled below.
1474
+ const suppressed = seedSuppressedByCandidate.get(candidate.candidateId);
1475
+ if (suppressed !== undefined && suppressed.suppress === true
1476
+ && suppressed.reason === 'reuse_resolved_to_existing_principle') {
1477
+ return false;
1478
+ }
1479
+ return true;
1480
+ }).length,
1360
1481
  // PRI-917 v0.3.3: parked candidates intentionally have no ledger entry —
1361
1482
  // a fully-parked batch is "awaiting the Owner", not an intake failure.
1362
- reuseReviewRequiredCandidateIds: [...reuseReviewRequiredByCandidate.keys()],
1483
+ // Phase 7.2 B2.5: park-SUPPRESSED candidates (still awaiting the Owner)
1484
+ // are equally not expected to have produced an entry.
1485
+ // Phase 7.2 P1-01: pending-decision candidates surface through the same
1486
+ // Owner-review channel (their resume action IS the review command).
1487
+ reuseReviewRequiredCandidateIds: [
1488
+ ...reuseReviewRequiredByCandidate.keys(),
1489
+ ...[...seedSuppressedByCandidate.entries()]
1490
+ .filter(([, suppression]) => suppression.suppress && suppression.reason === 'reuse_park_pending_owner')
1491
+ .map(([candidateId]) => candidateId),
1492
+ ...ownerDecisionPendingByCandidate,
1493
+ ],
1363
1494
  runId: latestRun?.runId,
1364
1495
  artifactId: firstCandidate?.artifactId,
1365
1496
  autoIntakeEnabled: this.autoIntakeEnabled,