create-principles-disciple 1.152.5 → 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.
- package/_release/product-identity.json +1 -1
- package/agent-skill/pd-setup/SKILL.md +70 -0
- package/codex-adapter/dist/background-selection.d.ts +9 -0
- package/codex-adapter/dist/background-selection.js +142 -0
- package/codex-adapter/dist/ingestion/adaptive-append-state.d.ts +209 -0
- package/codex-adapter/dist/ingestion/adaptive-append-state.js +544 -0
- package/codex-adapter/dist/pd-hook.js +329 -5
- package/codex-adapter/package.json +1 -1
- package/console/dist/server/config/pd-config-store.d.ts +11 -15
- package/console/dist/server/config/pd-config-store.js +92 -17
- package/console/dist/server/models/ActivationsConsoleModel.d.ts +8 -0
- package/console/dist/server/models/ActivationsConsoleModel.js +3 -2
- package/console/dist/server/models/AdaptiveActivationConsoleModel.d.ts +43 -4
- package/console/dist/server/models/AdaptiveActivationConsoleModel.js +36 -7
- package/console/dist/server/models/ExaminerEvidenceModel.d.ts +6 -2
- package/console/dist/server/models/ExaminerEvidenceModel.js +13 -2
- package/console/dist/server/routes/config.js +34 -8
- package/console/dist/server/routes/examiner-executor.d.ts +33 -0
- package/console/dist/server/routes/examiner-executor.js +95 -0
- package/console/dist/server/routes/examiner.js +12 -9
- package/console/dist/web/assets/app.css +14 -10
- package/console/dist/web/assets/app.js +27 -27
- package/core/dist/ledger-file-lock.d.ts +38 -0
- package/core/dist/ledger-file-lock.d.ts.map +1 -0
- package/core/dist/ledger-file-lock.js +240 -0
- package/core/dist/ledger-file-lock.js.map +1 -0
- package/core/dist/principle-text-normalization.d.ts +32 -0
- package/core/dist/principle-text-normalization.d.ts.map +1 -0
- package/core/dist/principle-text-normalization.js +34 -0
- package/core/dist/principle-text-normalization.js.map +1 -0
- package/core/dist/principle-tree-ledger.d.ts +22 -21
- package/core/dist/principle-tree-ledger.d.ts.map +1 -1
- package/core/dist/principle-tree-ledger.js +77 -204
- package/core/dist/principle-tree-ledger.js.map +1 -1
- package/core/dist/runtime/activation/sqlite-approval-store.d.ts.map +1 -1
- package/core/dist/runtime/activation/sqlite-approval-store.js +7 -1
- package/core/dist/runtime/activation/sqlite-approval-store.js.map +1 -1
- package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts +13 -0
- package/core/dist/runtime/adapter/principle-tree-ledger-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/principle-tree-ledger-adapter.js +90 -1
- package/core/dist/runtime/adapter/principle-tree-ledger-adapter.js.map +1 -1
- package/core/dist/runtime/adapter/schema-prompt-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/schema-prompt-adapter.js +21 -30
- package/core/dist/runtime/adapter/schema-prompt-adapter.js.map +1 -1
- package/core/dist/runtime/candidate-intake-service.d.ts +40 -1
- package/core/dist/runtime/candidate-intake-service.d.ts.map +1 -1
- package/core/dist/runtime/candidate-intake-service.js +548 -110
- package/core/dist/runtime/candidate-intake-service.js.map +1 -1
- package/core/dist/runtime/candidate-intake.d.ts +59 -2
- package/core/dist/runtime/candidate-intake.d.ts.map +1 -1
- package/core/dist/runtime/candidate-intake.js +23 -0
- package/core/dist/runtime/candidate-intake.js.map +1 -1
- package/core/dist/runtime/candidate-seed-suppression.d.ts +63 -0
- package/core/dist/runtime/candidate-seed-suppression.d.ts.map +1 -0
- package/core/dist/runtime/candidate-seed-suppression.js +29 -0
- package/core/dist/runtime/candidate-seed-suppression.js.map +1 -0
- package/core/dist/runtime/config/pd-config-agent-binding.d.ts +5 -5
- package/core/dist/runtime/config/pd-config-agent-binding.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-config-agent-binding.js +22 -16
- package/core/dist/runtime/config/pd-config-agent-binding.js.map +1 -1
- package/core/dist/runtime/config/pd-config-feature-flags.d.ts +10 -0
- package/core/dist/runtime/config/pd-config-feature-flags.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-config-feature-flags.js +14 -0
- package/core/dist/runtime/config/pd-config-feature-flags.js.map +1 -1
- package/core/dist/runtime/config/pd-config-types.d.ts +9 -0
- package/core/dist/runtime/config/pd-config-types.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-config-types.js.map +1 -1
- package/core/dist/runtime/config/pd-config-validate.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-config-validate.js +10 -2
- package/core/dist/runtime/config/pd-config-validate.js.map +1 -1
- package/core/dist/runtime/config/pd-credentials.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-credentials.js +7 -1
- package/core/dist/runtime/config/pd-credentials.js.map +1 -1
- package/core/dist/runtime/diagnostician/distiller-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician/distiller-prompt-builder.js +30 -3
- package/core/dist/runtime/diagnostician/distiller-prompt-builder.js.map +1 -1
- package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js +16 -5
- package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js.map +1 -1
- package/core/dist/runtime/diagnostician/router-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician/router-prompt-builder.js +16 -4
- package/core/dist/runtime/diagnostician/router-prompt-builder.js.map +1 -1
- package/core/dist/runtime/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
- package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +13 -2
- package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
- package/core/dist/runtime/index.d.ts +4 -2
- package/core/dist/runtime/index.d.ts.map +1 -1
- package/core/dist/runtime/index.js +3 -1
- package/core/dist/runtime/index.js.map +1 -1
- package/core/dist/runtime/intent/intent-doc.d.ts +22 -0
- package/core/dist/runtime/intent/intent-doc.d.ts.map +1 -1
- package/core/dist/runtime/intent/intent-doc.js +79 -0
- package/core/dist/runtime/intent/intent-doc.js.map +1 -1
- package/core/dist/runtime/intent/intent-friction-block.d.ts +7 -0
- package/core/dist/runtime/intent/intent-friction-block.d.ts.map +1 -1
- package/core/dist/runtime/intent/intent-friction-block.js +34 -1
- package/core/dist/runtime/intent/intent-friction-block.js.map +1 -1
- package/core/dist/runtime/intent/intent-snapshot.d.ts +44 -5
- package/core/dist/runtime/intent/intent-snapshot.d.ts.map +1 -1
- package/core/dist/runtime/intent/intent-snapshot.js +83 -15
- package/core/dist/runtime/intent/intent-snapshot.js.map +1 -1
- package/core/dist/runtime/intent/strategic-conflict-gate.d.ts +19 -0
- package/core/dist/runtime/intent/strategic-conflict-gate.d.ts.map +1 -1
- package/core/dist/runtime/intent/strategic-conflict-gate.js +94 -26
- package/core/dist/runtime/intent/strategic-conflict-gate.js.map +1 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +22 -11
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.js +101 -28
- package/core/dist/runtime/internalization/diag-rootcause-runner.js.map +1 -1
- package/core/dist/runtime/internalization/dreamer-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/dreamer-prompt-builder.js +177 -28
- package/core/dist/runtime/internalization/dreamer-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/dreamer-runner.d.ts +9 -2
- package/core/dist/runtime/internalization/dreamer-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/dreamer-runner.js +11 -1
- package/core/dist/runtime/internalization/dreamer-runner.js.map +1 -1
- package/core/dist/runtime/internalization/evaluator-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/evaluator-runner.js +7 -0
- package/core/dist/runtime/internalization/evaluator-runner.js.map +1 -1
- package/core/dist/runtime/internalization/formation-context.d.ts +16 -0
- package/core/dist/runtime/internalization/formation-context.d.ts.map +1 -1
- package/core/dist/runtime/internalization/formation-context.js +109 -8
- package/core/dist/runtime/internalization/formation-context.js.map +1 -1
- package/core/dist/runtime/internalization/index.d.ts +2 -2
- package/core/dist/runtime/internalization/index.d.ts.map +1 -1
- package/core/dist/runtime/internalization/index.js +1 -1
- package/core/dist/runtime/internalization/index.js.map +1 -1
- package/core/dist/runtime/internalization/intent-contract.d.ts +55 -4
- package/core/dist/runtime/internalization/intent-contract.d.ts.map +1 -1
- package/core/dist/runtime/internalization/intent-contract.js +111 -30
- package/core/dist/runtime/internalization/intent-contract.js.map +1 -1
- package/core/dist/runtime/internalization/internalization-orchestrator.d.ts +16 -2
- package/core/dist/runtime/internalization/internalization-orchestrator.d.ts.map +1 -1
- package/core/dist/runtime/internalization/internalization-orchestrator.js +48 -14
- package/core/dist/runtime/internalization/internalization-orchestrator.js.map +1 -1
- package/core/dist/runtime/internalization/philosopher-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/philosopher-prompt-builder.js +7 -6
- package/core/dist/runtime/internalization/philosopher-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/philosopher-runner.d.ts +9 -2
- package/core/dist/runtime/internalization/philosopher-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/philosopher-runner.js +11 -1
- package/core/dist/runtime/internalization/philosopher-runner.js.map +1 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts +13 -6
- package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.js +15 -10
- package/core/dist/runtime/internalization/scribe-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/scribe-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/scribe-runner.js +17 -7
- package/core/dist/runtime/internalization/scribe-runner.js.map +1 -1
- package/core/dist/runtime/pain-signal-bridge.d.ts +3 -0
- package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
- package/core/dist/runtime/pain-signal-bridge.js +224 -93
- package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
- package/core/dist/runtime/pain-submit-capability.d.ts.map +1 -1
- package/core/dist/runtime/pain-submit-capability.js +3 -5
- package/core/dist/runtime/pain-submit-capability.js.map +1 -1
- package/core/dist/runtime/pain-to-principle-service.d.ts.map +1 -1
- package/core/dist/runtime/pain-to-principle-service.js +18 -21
- package/core/dist/runtime/pain-to-principle-service.js.map +1 -1
- package/core/dist/runtime/store/candidate/admission-document.d.ts +129 -0
- package/core/dist/runtime/store/candidate/admission-document.d.ts.map +1 -1
- package/core/dist/runtime/store/candidate/admission-document.js +196 -0
- package/core/dist/runtime/store/candidate/admission-document.js.map +1 -1
- package/core/dist/runtime/store/candidate/candidate-store.d.ts +54 -1
- package/core/dist/runtime/store/candidate/candidate-store.d.ts.map +1 -1
- package/core/dist/runtime/store/candidate/memory-candidate-store.d.ts +32 -1
- package/core/dist/runtime/store/candidate/memory-candidate-store.d.ts.map +1 -1
- package/core/dist/runtime/store/candidate/memory-candidate-store.js +24 -1
- package/core/dist/runtime/store/candidate/memory-candidate-store.js.map +1 -1
- package/core/dist/runtime/store/candidate/sqlite-candidate-store.d.ts +32 -1
- package/core/dist/runtime/store/candidate/sqlite-candidate-store.d.ts.map +1 -1
- package/core/dist/runtime/store/candidate/sqlite-candidate-store.js +76 -1
- package/core/dist/runtime/store/candidate/sqlite-candidate-store.js.map +1 -1
- package/core/dist/runtime/store/intent/sqlite-intent-decision-store.d.ts +10 -0
- package/core/dist/runtime/store/intent/sqlite-intent-decision-store.d.ts.map +1 -1
- package/core/dist/runtime/store/intent/sqlite-intent-decision-store.js +15 -4
- package/core/dist/runtime/store/intent/sqlite-intent-decision-store.js.map +1 -1
- package/core/dist/runtime/store/runtime-state-manager.d.ts +34 -1
- package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
- package/core/dist/runtime/store/runtime-state-manager.js +10 -0
- package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
- package/core/dist/telemetry-event.d.ts +2 -2
- package/core/dist/telemetry-event.d.ts.map +1 -1
- package/core/dist/telemetry-event.js +6 -0
- package/core/dist/telemetry-event.js.map +1 -1
- package/core/package.json +1 -1
- package/dist/agent-skill.d.ts +59 -0
- package/dist/agent-skill.d.ts.map +1 -0
- package/dist/agent-skill.js +198 -0
- package/dist/agent-skill.js.map +1 -0
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +12 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +171 -3
- package/dist/index.js.map +1 -1
- package/dist/install-summary.d.ts +52 -0
- package/dist/install-summary.d.ts.map +1 -1
- package/dist/install-summary.js +104 -0
- package/dist/install-summary.js.map +1 -1
- package/host-runtime/dist/adaptive-background-append.d.ts +70 -0
- package/host-runtime/dist/adaptive-background-append.js +165 -0
- package/host-runtime/dist/governance-signal-admission.js +1 -5
- package/host-runtime/dist/index.d.ts +1 -0
- package/host-runtime/dist/index.js +5 -0
- package/host-runtime/package.json +1 -1
- package/package.json +3 -2
- package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
- package/pd-cli/dist/commands/candidate.js +243 -28
- package/pd-cli/dist/commands/candidate.js.map +1 -1
- package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
- package/pd-cli/dist/commands/diagnose.js +110 -7
- package/pd-cli/dist/commands/diagnose.js.map +1 -1
- package/pd-cli/dist/commands/health-console.d.ts +21 -0
- package/pd-cli/dist/commands/health-console.d.ts.map +1 -0
- package/pd-cli/dist/commands/health-console.js +106 -0
- package/pd-cli/dist/commands/health-console.js.map +1 -0
- package/pd-cli/dist/commands/health.d.ts +159 -0
- package/pd-cli/dist/commands/health.d.ts.map +1 -1
- package/pd-cli/dist/commands/health.js +162 -2
- package/pd-cli/dist/commands/health.js.map +1 -1
- package/pd-cli/dist/commands/mcp-probe.d.ts +48 -0
- package/pd-cli/dist/commands/mcp-probe.d.ts.map +1 -0
- package/pd-cli/dist/commands/mcp-probe.js +479 -0
- package/pd-cli/dist/commands/mcp-probe.js.map +1 -0
- package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-retry.js +3 -0
- package/pd-cli/dist/commands/pain-retry.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.js +70 -4
- package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
- package/pd-cli/dist/program.d.ts.map +1 -1
- package/pd-cli/dist/program.js +68 -1
- package/pd-cli/dist/program.js.map +1 -1
- package/pd-cli/dist/services/admission-write-gate.d.ts.map +1 -1
- package/pd-cli/dist/services/admission-write-gate.js +18 -7
- package/pd-cli/dist/services/admission-write-gate.js.map +1 -1
- package/pd-cli/dist/services/console-launcher.d.ts +3 -0
- package/pd-cli/dist/services/console-launcher.d.ts.map +1 -1
- package/pd-cli/dist/services/console-launcher.js +3 -2
- package/pd-cli/dist/services/console-launcher.js.map +1 -1
- package/pd-cli/dist/services/demo-story-a-runner.d.ts.map +1 -1
- package/pd-cli/dist/services/demo-story-a-runner.js +8 -3
- package/pd-cli/dist/services/demo-story-a-runner.js.map +1 -1
- package/pd-cli/dist/services/reuse-park-release.d.ts +142 -0
- package/pd-cli/dist/services/reuse-park-release.d.ts.map +1 -0
- package/pd-cli/dist/services/reuse-park-release.js +201 -0
- package/pd-cli/dist/services/reuse-park-release.js.map +1 -0
- package/pd-cli/package.json +1 -1
- package/plugin/dist/bundle.js +914 -640
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +1 -1
- package/release-manager/dist/i18n.js +12 -0
- package/release-manager/package.json +2 -1
- package/workbuddy-adapter/dist/pd-hook.js +37 -3
- package/workbuddy-adapter/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-principles-disciple",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.153.1",
|
|
4
4
|
"description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"dist",
|
|
22
|
+
"agent-skill",
|
|
22
23
|
"plugin",
|
|
23
24
|
"pd-cli",
|
|
24
25
|
"console",
|
|
@@ -101,5 +102,5 @@
|
|
|
101
102
|
"pd": {
|
|
102
103
|
"bundledPluginVersion": "2.2.13"
|
|
103
104
|
},
|
|
104
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "5ebfebcc384368a6f68f62fdd539507a03fd1d4a"
|
|
105
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candidate.d.ts","sourceRoot":"","sources":["../../src/commands/candidate.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,mBAAmB,
|
|
1
|
+
{"version":3,"file":"candidate.d.ts","sourceRoot":"","sources":["../../src/commands/candidate.ts"],"names":[],"mappings":"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"}
|
|
@@ -17,12 +17,13 @@ import * as path from 'path';
|
|
|
17
17
|
import { RuntimeStateManager, candidateList, candidateShow, CandidateIntakeService, CandidateIntakeError, INTAKE_ERROR_CODES, decideInternalizationRoute, buildDreamerSeedFromCandidate, findExistingDreamerTask, parseSeedSourcePainId, PrincipleTreeLedgerAdapter,
|
|
18
18
|
// PRI-917 PR3A: the review surface consumes the SAME proposal/semantics
|
|
19
19
|
// machinery as the intake gate (audit C4 — one implementation, no drift).
|
|
20
|
-
buildReuseProposal, buildReuseShortlist, extractIntakeRecommendation, isPrincipleLedgerEligibleKind, resolveOwnerIdentity, defaultOwnerIdentityHomeDir, ReuseEvaluationRunner, ReuseEvaluationError, createBridgeTelemetryEventEmitter, auditCandidateLedgerConsistency, } from '@principles/core/runtime';
|
|
20
|
+
buildReuseProposal, buildReuseShortlist, extractIntakeRecommendation, isPrincipleLedgerEligibleKind, resolveOwnerIdentity, defaultOwnerIdentityHomeDir, evaluateDreamerSeedSuppression, pendingOwnerDecision, ReuseEvaluationRunner, ReuseEvaluationError, createBridgeTelemetryEventEmitter, auditCandidateLedgerConsistency, } from '@principles/core/runtime';
|
|
21
21
|
import { loadLedger, getLedgerFilePathPublic } from '@principles/core/principle-tree-ledger';
|
|
22
22
|
import { resolveWorkspaceDir } from '../resolve-workspace.js';
|
|
23
23
|
import { createWorkspaceTelemetryEmitter } from '../services/workspace-telemetry.js';
|
|
24
24
|
import { loadPdConfig } from '../services/pd-config-loader.js';
|
|
25
25
|
import { createReuseGatedIntakeService } from '../services/reuse-gated-intake.js';
|
|
26
|
+
import { recordOwnerDecisionIntent, completeOwnerDecisionExecution } from '../services/reuse-park-release.js';
|
|
26
27
|
import { resolveRuntimeAdapterFromConfig } from '../services/runtime-adapter-resolver.js';
|
|
27
28
|
import { resolvePromptFullPipelineSeedMode } from '../services/pd-config-loader.js';
|
|
28
29
|
import { createRemediationResult, remediationAction } from './remediation-output.js';
|
|
@@ -582,8 +583,19 @@ async function evaluateReuseProposal(workspaceDir, claim, entries) {
|
|
|
582
583
|
}
|
|
583
584
|
/**
|
|
584
585
|
* Decision mode of {@link handleCandidateReview}: validate the CLI contract
|
|
585
|
-
* (rc-3), resolve the Owner identity (fail-closed), then run the
|
|
586
|
-
*
|
|
586
|
+
* (rc-3), resolve the Owner identity (fail-closed), then run the RECOVERABLE
|
|
587
|
+
* three-phase decision lifecycle (Phase 7.2 P1-01):
|
|
588
|
+
*
|
|
589
|
+
* Phase A — persist the typed decision INTENT (admission ownerDecisions,
|
|
590
|
+
* executionStatus pending). The park is NOT cleared.
|
|
591
|
+
* Phase B — execute the verdict through the intake service's
|
|
592
|
+
* ownerDecision channel (persisted-decision authorization, coordination
|
|
593
|
+
* lock, idempotent replays by decisionId).
|
|
594
|
+
* Phase C — one transactional write: decision applied + release audit
|
|
595
|
+
* (when a park was lifted) + processing complete.
|
|
596
|
+
*
|
|
597
|
+
* Every crash window resumes: a re-run with the same verdict detects the
|
|
598
|
+
* pending (or applied) record and continues / reports without re-asking.
|
|
587
599
|
*/
|
|
588
600
|
async function executeOwnerDecision(deps) {
|
|
589
601
|
const { opts, stateManager, ledgerAdapter, stateDir, workspaceDir } = deps;
|
|
@@ -598,30 +610,25 @@ async function executeOwnerDecision(deps) {
|
|
|
598
610
|
process.exit(1);
|
|
599
611
|
};
|
|
600
612
|
if (typeof opts.reason !== 'string' || opts.reason.trim() === '') {
|
|
601
|
-
failCli('--reason is required with --decide (the
|
|
613
|
+
failCli('--reason is required with --decide (the decision record must state why the Owner resolved this candidate)', 'Re-run with --reason "..." (non-empty).');
|
|
614
|
+
return;
|
|
602
615
|
}
|
|
603
616
|
if (opts.decide === 'reuse' && (typeof opts.principleId !== 'string' || opts.principleId.trim() === '')) {
|
|
604
617
|
failCli('--principle-id is required with --decide reuse', 'Re-run with --principle-id <id from the review proposal>.');
|
|
618
|
+
return;
|
|
605
619
|
}
|
|
606
620
|
// Owner identity: env > ~/.pd/owner.json > none (ADR-0022 resolver).
|
|
607
621
|
const identity = resolveOwnerIdentity(process.env, defaultOwnerIdentityHomeDir());
|
|
608
622
|
if ((identity.source !== 'env' && identity.source !== 'file') || !identity.ownerId) {
|
|
609
623
|
failCli(`Owner identity is required to record a ${opts.decide} decision (identity source: ${identity.source})${identity.error ? `: ${identity.error}` : ''}`, 'Register the Owner identity file (~/.pd/owner.json) or set PD_OWNER_ID and PD_OWNER_CREDENTIAL_ID together, then retry.');
|
|
624
|
+
return;
|
|
610
625
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
actor: { kind: 'owner', id: identity.ownerId },
|
|
616
|
-
reason: opts.reason,
|
|
617
|
-
decidedAt: new Date().toISOString(),
|
|
618
|
-
}
|
|
619
|
-
: { decision: 'create' };
|
|
620
|
-
// INV-R08: verify the selected principle is in the current proposal.
|
|
621
|
-
// This prevents a stale or empty proposal from silently degrading reuse
|
|
622
|
-
// into create.
|
|
626
|
+
// INV-R08 FIRST: verify the selected principle is in the current proposal
|
|
627
|
+
// BEFORE recording the intent — recording a verdict that then fails
|
|
628
|
+
// validation would leave a dead pending decision on the candidate.
|
|
629
|
+
const decisionCandidate = await stateManager.getCandidate(opts.candidateId);
|
|
623
630
|
if (opts.decide === 'reuse') {
|
|
624
|
-
const candidate =
|
|
631
|
+
const candidate = decisionCandidate;
|
|
625
632
|
const artifact = candidate ? await stateManager.getArtifact(candidate.artifactId) : null;
|
|
626
633
|
const extracted = candidate ? extractIntakeRecommendation(candidate, artifact) : null;
|
|
627
634
|
if (!candidate || !extracted || !extracted.ok) {
|
|
@@ -637,35 +644,142 @@ async function executeOwnerDecision(deps) {
|
|
|
637
644
|
failCli(`Principle ${opts.principleId} is not in the current reuse proposal`, 'Re-run `pd candidate review` to see the current proposal.');
|
|
638
645
|
}
|
|
639
646
|
}
|
|
647
|
+
// ── Phase A — record the decision INTENT (park NOT cleared) ──
|
|
648
|
+
const rawKind = typeof decisionCandidate?.rawRecommendationKind === 'string' ? decisionCandidate.rawRecommendationKind : null;
|
|
649
|
+
const phaseA = await recordOwnerDecisionIntent({
|
|
650
|
+
stateManager,
|
|
651
|
+
executionProbe: ledgerAdapter,
|
|
652
|
+
// P1-1: Phase A serializes on the SAME candidate coordination lock as
|
|
653
|
+
// Phase B — the read → probe → supersede/record sequence must never
|
|
654
|
+
// interleave with another process's verify → write.
|
|
655
|
+
coordination: ledgerAdapter,
|
|
656
|
+
candidateId: opts.candidateId,
|
|
657
|
+
decide: opts.decide,
|
|
658
|
+
reason: opts.reason,
|
|
659
|
+
ownerId: identity.ownerId,
|
|
660
|
+
identitySource: identity.source,
|
|
661
|
+
rawRecommendationKind: rawKind,
|
|
662
|
+
...(opts.decide === 'reuse' ? { selectedPrincipleId: opts.principleId } : {}),
|
|
663
|
+
});
|
|
664
|
+
if (phaseA.status === 'failed') {
|
|
665
|
+
failCli(`Cannot record the ${opts.decide} decision: ${phaseA.reason}`, phaseA.nextAction);
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
if (phaseA.status === 'already_applied') {
|
|
669
|
+
// Crash window AFTER Phase C with the response lost — the decision is
|
|
670
|
+
// durable and complete; report it without re-executing anything.
|
|
671
|
+
const info = {
|
|
672
|
+
candidateId: opts.candidateId,
|
|
673
|
+
decision: opts.decide,
|
|
674
|
+
decisionId: phaseA.decision.decisionId,
|
|
675
|
+
status: 'already_applied',
|
|
676
|
+
resultingPrincipleId: phaseA.decision.resultingPrincipleId,
|
|
677
|
+
message: `This ${opts.decide} decision already completed (applied ${phaseA.decision.executedAt ?? 'earlier'}); nothing was re-executed.`,
|
|
678
|
+
};
|
|
679
|
+
if (opts.json) {
|
|
680
|
+
console.log(JSON.stringify(info, null, 2));
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
console.log(`\nPrinciple Candidate Decision: ${opts.candidateId} (already applied)\n`);
|
|
684
|
+
console.log(` Decision: ${opts.decide} (${phaseA.decision.decisionId})`);
|
|
685
|
+
console.log(` Principle: ${phaseA.decision.resultingPrincipleId ?? '(n/a)'}\n`);
|
|
686
|
+
}
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
const decision = phaseA.decision;
|
|
690
|
+
// ── Phase B — execute the verdict through the persisted-decision channel ──
|
|
640
691
|
const service = new CandidateIntakeService({
|
|
641
692
|
stateManager,
|
|
642
693
|
ledgerAdapter,
|
|
643
|
-
// The verdict
|
|
644
|
-
//
|
|
645
|
-
//
|
|
646
|
-
reuseDecision: () => decision,
|
|
694
|
+
// The verdict comes from the PERSISTED decision record the service
|
|
695
|
+
// re-verifies under the coordination lock — no callback channel (P1-03:
|
|
696
|
+
// an injected callback is not Owner authorization).
|
|
647
697
|
reuseStateDir: stateDir,
|
|
648
698
|
});
|
|
649
|
-
|
|
699
|
+
let intakeResult;
|
|
700
|
+
try {
|
|
701
|
+
intakeResult = await service.intake(opts.candidateId, { ownerDecision: { decisionId: decision.decisionId } });
|
|
702
|
+
}
|
|
703
|
+
catch (err) {
|
|
704
|
+
// Structured execution refusals (P1-01) fail the CLI gracefully with a
|
|
705
|
+
// resume nextAction instead of an unhandled error (cli-6). The intent
|
|
706
|
+
// stays pending/applied exactly as the service left it.
|
|
707
|
+
if (err instanceof CandidateIntakeError) {
|
|
708
|
+
const reason = typeof err.context?.reason === 'string' ? err.context.reason : '';
|
|
709
|
+
failCli(`The ${opts.decide} decision was NOT executed: ${err.message}`, reason === 'owner_decision_conflicts_applied'
|
|
710
|
+
? 'A different verdict already governs this candidate — inspect `pd candidate show` and the admission document before deciding again.'
|
|
711
|
+
: 'Re-run the SAME verdict to resume, or inspect the candidate admission document.');
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
throw err;
|
|
715
|
+
}
|
|
650
716
|
if (intakeResult.outcome === 'refused' && intakeResult.reason === 'reuse_selected') {
|
|
717
|
+
// ── Phase C for a reuse execution ──
|
|
718
|
+
const resultingPrincipleId = intakeResult.selectedPrincipleId ?? decision.selectedPrincipleId;
|
|
719
|
+
if (resultingPrincipleId === undefined) {
|
|
720
|
+
failCli(`The reuse execution reported no selected principle for candidate ${opts.candidateId} (contract violation); the decision stays pending`, 'Re-run the SAME reuse verdict to resume; if it persists, inspect the candidate admission document.');
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
const phaseC = await completeOwnerDecisionExecution({
|
|
724
|
+
stateManager,
|
|
725
|
+
coordination: ledgerAdapter,
|
|
726
|
+
candidateId: opts.candidateId,
|
|
727
|
+
decision,
|
|
728
|
+
resultingPrincipleId,
|
|
729
|
+
ownerId: identity.ownerId,
|
|
730
|
+
identitySource: identity.source,
|
|
731
|
+
rawRecommendationKind: rawKind,
|
|
732
|
+
});
|
|
733
|
+
if (phaseC.status === 'failed') {
|
|
734
|
+
failCli(`The reuse decision executed but could not be completed: ${phaseC.reason}`, phaseC.nextAction);
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
651
737
|
await reportReuseResolution({ stateManager, candidateId: opts.candidateId, result: intakeResult, json: opts.json === true });
|
|
652
738
|
return;
|
|
653
739
|
}
|
|
654
740
|
if (intakeResult.outcome === 'refused') {
|
|
655
|
-
// A non-principle kind or unknown kind cannot carry
|
|
741
|
+
// A non-principle kind or unknown kind cannot carry an Owner decision.
|
|
742
|
+
// The intent stays pending — the candidate must be repaired first.
|
|
656
743
|
throw new CandidateIntakeError(INTAKE_ERROR_CODES.INPUT_INVALID, `Principle Ledger write refused: ${intakeResult.message}`, { candidateId: opts.candidateId, reason: intakeResult.reason });
|
|
657
744
|
}
|
|
658
|
-
//
|
|
745
|
+
// P1-2 belt-and-braces: a REUSE decision can never legitimately take the
|
|
746
|
+
// ledger_entry shape (reuse leaves evidence on the selected principle, not
|
|
747
|
+
// an own entry). The service now refuses that combination fail-closed; this
|
|
748
|
+
// CLI-side type check keeps the create-shaped Phase C unreachable even if a
|
|
749
|
+
// future adapter regression reintroduces the generic replay.
|
|
750
|
+
if (decision.decision === 'reuse') {
|
|
751
|
+
failCli(`The reuse decision was NOT executed: the intake returned a ledger entry (${intakeResult.entry.id}) for this candidate — a reuse verdict must resolve onto the SELECTED principle via reuseEvidence instead (contract violation)`, "Inspect the candidate's ledger lineage (a derived principle of its own conflicts with a reuse verdict); repair the candidate state, then re-run the SAME reuse verdict.");
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
// ── Phase C for a create execution (B1 dedup may redirect the entry) ──
|
|
659
755
|
const { entry } = intakeResult;
|
|
756
|
+
const phaseC = await completeOwnerDecisionExecution({
|
|
757
|
+
stateManager,
|
|
758
|
+
coordination: ledgerAdapter,
|
|
759
|
+
candidateId: opts.candidateId,
|
|
760
|
+
decision,
|
|
761
|
+
resultingPrincipleId: entry.id,
|
|
762
|
+
ownerId: identity.ownerId,
|
|
763
|
+
identitySource: identity.source,
|
|
764
|
+
rawRecommendationKind: rawKind,
|
|
765
|
+
});
|
|
766
|
+
if (phaseC.status === 'failed') {
|
|
767
|
+
failCli(`The create decision executed but could not be completed: ${phaseC.reason}`, phaseC.nextAction);
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
660
770
|
const consumedState = await markCandidateConsumed(stateManager, opts.candidateId, entry.id);
|
|
661
771
|
// PRI-1193: consuming the candidate is not the end of the create decision.
|
|
662
772
|
// `run-rulehost --pain-id` resolves the dreamer by pain; without a task
|
|
663
773
|
// bound to THIS principle candidate it silently picks the rule candidate's
|
|
664
774
|
// dreamer (no ledgerEntryId) and skips approval enqueue. Seed the principle
|
|
665
775
|
// dreamer here, exactly like `candidate internalize` does.
|
|
776
|
+
// Phase 7.2 B2.5: the seed helper itself suppresses the chain when the
|
|
777
|
+
// candidate is durably resolved onto an existing principle (e.g. the Owner
|
|
778
|
+
// create verdict met the B1 exact-duplicate guard) or still reuse-parked.
|
|
666
779
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define -- helper is defined beside this command for readability
|
|
667
780
|
const dreamer = await seedDreamerForConsumedCandidate({
|
|
668
781
|
stateManager,
|
|
782
|
+
ledgerAdapter,
|
|
669
783
|
workspaceDir,
|
|
670
784
|
candidateId: opts.candidateId,
|
|
671
785
|
});
|
|
@@ -693,6 +807,7 @@ async function executeOwnerDecision(deps) {
|
|
|
693
807
|
const result = {
|
|
694
808
|
candidateId: opts.candidateId,
|
|
695
809
|
decision: opts.decide,
|
|
810
|
+
decisionId: decision.decisionId,
|
|
696
811
|
ledgerEntryId: entry.id,
|
|
697
812
|
status: 'consumed',
|
|
698
813
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
@@ -725,6 +840,47 @@ async function seedDreamerForConsumedCandidate(deps) {
|
|
|
725
840
|
nextAction: 'Run `pd candidate internalization backfill --include-pending --confirm` after restoring the candidate row.',
|
|
726
841
|
};
|
|
727
842
|
}
|
|
843
|
+
// Phase 7.2 B2.5 — suppress the independent Dreamer chain when the candidate
|
|
844
|
+
// is durably resolved onto an existing principle (ledger reuseEvidence — an
|
|
845
|
+
// Owner reuse decision OR the B1 exact-duplicate guard resolving an Owner
|
|
846
|
+
// create) or still reuse-parked. The Owner create verdict itself is honored
|
|
847
|
+
// (the candidate IS consumed); what is suppressed is the redundant
|
|
848
|
+
// exploration of an already-learned mechanism. Fail-open on an unexpected
|
|
849
|
+
// read failure (same posture as the bridge).
|
|
850
|
+
let suppression;
|
|
851
|
+
try {
|
|
852
|
+
const admissionDoc = await deps.stateManager.getAdmissionDocument(deps.candidateId);
|
|
853
|
+
const pending = pendingOwnerDecision(admissionDoc.ok ? admissionDoc.document ?? null : null);
|
|
854
|
+
suppression = evaluateDreamerSeedSuppression({
|
|
855
|
+
identity: deps.ledgerAdapter.resolveCandidatePrincipleIdentity(deps.candidateId, candidate.recommendationKind ?? 'principle'),
|
|
856
|
+
processing: admissionDoc.ok ? admissionDoc.document?.processing : undefined,
|
|
857
|
+
...(pending !== null ? { pendingOwnerDecision: { decision: pending.decision } } : {}),
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
catch {
|
|
861
|
+
suppression = { suppress: false };
|
|
862
|
+
}
|
|
863
|
+
if (suppression.suppress) {
|
|
864
|
+
if (suppression.reason === 'reuse_resolved_to_existing_principle') {
|
|
865
|
+
return {
|
|
866
|
+
status: 'not_seeded',
|
|
867
|
+
reason: `dreamer_seed_suppressed: candidate is durably resolved onto existing principle ${suppression.principleId} (reuseEvidence)`,
|
|
868
|
+
nextAction: 'No independent Dreamer chain by design; the existing principle already carries the mechanism.',
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
if (suppression.reason === 'owner_decision_pending') {
|
|
872
|
+
return {
|
|
873
|
+
status: 'not_seeded',
|
|
874
|
+
reason: `dreamer_seed_suppressed: an Owner ${suppression.decision} decision is recorded but its execution has not completed`,
|
|
875
|
+
nextAction: `pd candidate review --candidate-id ${deps.candidateId} --decide reuse|create --reason "..." (re-run the SAME verdict to resume the recorded decision)`,
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
return {
|
|
879
|
+
status: 'not_seeded',
|
|
880
|
+
reason: 'dreamer_seed_suppressed: reuse park is pending the Owner decision',
|
|
881
|
+
nextAction: `pd candidate review --candidate-id ${deps.candidateId} --decide reuse|create --reason "..."`,
|
|
882
|
+
};
|
|
883
|
+
}
|
|
728
884
|
const recommendation = resolveCandidateRecommendation(candidate, deps.stateManager, deps.candidateId);
|
|
729
885
|
// The create decision already admitted this principle into the ledger, so
|
|
730
886
|
// its text is ledger-eligible even when the diagnostician used `description`
|
|
@@ -931,7 +1087,10 @@ export async function handleCandidateIntake(opts) {
|
|
|
931
1087
|
// R7 gate-bypass fix: the Reuse Review Gate parked this candidate as a
|
|
932
1088
|
// suspected duplicate. No ledger entry was written and the candidate
|
|
933
1089
|
// stays pending for the Owner — do NOT mark it consumed. cli-5: this
|
|
934
|
-
// path performs no state mutation
|
|
1090
|
+
// CLI path performs no FURTHER state mutation; the park itself is
|
|
1091
|
+
// persisted by the intake service on the candidate's admission
|
|
1092
|
+
// processing (Phase 7.2 B2), so an automatic re-intake now replays the
|
|
1093
|
+
// park instead of re-rolling the evaluation.
|
|
935
1094
|
reportReusePark({
|
|
936
1095
|
workspaceDir,
|
|
937
1096
|
candidateId: opts.candidateId,
|
|
@@ -1395,8 +1554,10 @@ export async function handleCandidateRepair(opts) {
|
|
|
1395
1554
|
if (intakeResult.outcome === 'refused' && intakeResult.reason === 'reuse_pending_owner') {
|
|
1396
1555
|
// R7 gate-bypass fix: the gate suspects a semantic duplicate — restoring
|
|
1397
1556
|
// the entry would recreate a near-duplicate Principle. No write happened;
|
|
1398
|
-
// the Owner resolves it via the review channel. cli-5: no
|
|
1399
|
-
// this path (candidate stays consumed, ledger untouched)
|
|
1557
|
+
// the Owner resolves it via the review channel. cli-5: no FURTHER
|
|
1558
|
+
// mutation on this path (candidate stays consumed, ledger untouched);
|
|
1559
|
+
// the park is persisted on the candidate's admission processing by the
|
|
1560
|
+
// intake service (Phase 7.2 B2).
|
|
1400
1561
|
reportReusePark({
|
|
1401
1562
|
workspaceDir,
|
|
1402
1563
|
candidateId: opts.candidateId,
|
|
@@ -1523,6 +1684,10 @@ export async function handleCandidateInternalizationBackfill(opts) {
|
|
|
1523
1684
|
errors: 0,
|
|
1524
1685
|
results: [],
|
|
1525
1686
|
};
|
|
1687
|
+
// Phase 7.2 B2.5: the seed-suppression guard needs the ledger adapter in
|
|
1688
|
+
// the CONSUMED loop too (a second --confirm run re-selects resolved
|
|
1689
|
+
// candidates whose first run suppressed the task creation).
|
|
1690
|
+
const ledgerAdapter = new PrincipleTreeLedgerAdapter({ stateDir: path.join(workspaceDir, '.state') });
|
|
1526
1691
|
for (const row of consumedRows) {
|
|
1527
1692
|
const candidateId = row.candidate_id;
|
|
1528
1693
|
const candidate = await stateManager.getCandidate(candidateId);
|
|
@@ -1572,6 +1737,31 @@ export async function handleCandidateInternalizationBackfill(opts) {
|
|
|
1572
1737
|
output.results.push({ candidateId, route: decision.route, status: 'existing', taskId: existingTask.taskId, channel, statusBefore: 'consumed', statusAfter: 'consumed', intakeDecision: 'not_needed', seedDecision: 'existing' });
|
|
1573
1738
|
continue;
|
|
1574
1739
|
}
|
|
1740
|
+
// Phase 7.2 B2.5 (CodeRabbit): a re-run of backfill re-selects this
|
|
1741
|
+
// consumed candidate; if it is durably resolved onto an existing
|
|
1742
|
+
// principle (or still reuse-parked), the FIRST run already suppressed
|
|
1743
|
+
// its task — this run must suppress it too, or it would create exactly
|
|
1744
|
+
// the chain the first run decided against. Same persistent-facts check
|
|
1745
|
+
// as the pending branch; fail-open on an unexpected read failure.
|
|
1746
|
+
let consumedSuppression = { suppress: false };
|
|
1747
|
+
try {
|
|
1748
|
+
const consumedAdmissionDoc = await stateManager.getAdmissionDocument(candidateId);
|
|
1749
|
+
consumedSuppression = evaluateDreamerSeedSuppression({
|
|
1750
|
+
identity: ledgerAdapter.resolveCandidatePrincipleIdentity(candidateId, 'principle'),
|
|
1751
|
+
processing: consumedAdmissionDoc.ok ? consumedAdmissionDoc.document?.processing : undefined,
|
|
1752
|
+
});
|
|
1753
|
+
}
|
|
1754
|
+
catch {
|
|
1755
|
+
consumedSuppression = { suppress: false };
|
|
1756
|
+
}
|
|
1757
|
+
if (consumedSuppression.suppress) {
|
|
1758
|
+
const suppressReason = consumedSuppression.reason === 'reuse_resolved_to_existing_principle'
|
|
1759
|
+
? `dreamer_seed_suppressed: durably resolved onto existing principle ${consumedSuppression.principleId} (reuseEvidence)`
|
|
1760
|
+
: 'dreamer_seed_suppressed: reuse park pending Owner decision';
|
|
1761
|
+
output.deferred++;
|
|
1762
|
+
output.results.push({ candidateId, route: decision.route, status: 'deferred', reason: suppressReason, statusBefore: 'consumed', statusAfter: 'consumed', intakeDecision: 'not_needed', seedDecision: 'skipped', nextAction: 'No action required: this candidate is durably resolved; no independent chain by design.' });
|
|
1763
|
+
continue;
|
|
1764
|
+
}
|
|
1575
1765
|
output.missingDreamerTask++;
|
|
1576
1766
|
if (!isConfirm) {
|
|
1577
1767
|
output.results.push({ candidateId, route: decision.route, status: 'would_create', taskId, channel, statusBefore: 'consumed', statusAfter: 'consumed', intakeDecision: 'not_needed', seedDecision: 'would_seed' });
|
|
@@ -1594,7 +1784,6 @@ export async function handleCandidateInternalizationBackfill(opts) {
|
|
|
1594
1784
|
output.results.push({ candidateId, route: decision.route, status: 'error', reason: err instanceof Error ? err.message : String(err), statusBefore: 'consumed', statusAfter: 'consumed', intakeDecision: 'not_needed', seedDecision: 'skipped', nextAction: 'Investigate dreamer task creation failure' });
|
|
1595
1785
|
}
|
|
1596
1786
|
}
|
|
1597
|
-
const ledgerAdapter = new PrincipleTreeLedgerAdapter({ stateDir: path.join(workspaceDir, '.state') });
|
|
1598
1787
|
// R7 gate-bypass fix (adhoc-20261007): --include-pending intakes parked
|
|
1599
1788
|
// (reuse_review_required) candidates too — the worst bypass, because it
|
|
1600
1789
|
// consumed the very state the gate created to await the Owner (R7 Wave-2
|
|
@@ -1703,6 +1892,32 @@ export async function handleCandidateInternalizationBackfill(opts) {
|
|
|
1703
1892
|
continue;
|
|
1704
1893
|
}
|
|
1705
1894
|
output.intakeSucceeded++;
|
|
1895
|
+
// Phase 7.2 B2.5 — seed suppression for resolved/parked candidates. The
|
|
1896
|
+
// intake above can succeed AS a resolution (B1 exact-duplicate guard:
|
|
1897
|
+
// ledger_entry written:false + deduplicatedAgainst, audited via
|
|
1898
|
+
// reuseEvidence). Such a candidate is consumed, but an independent
|
|
1899
|
+
// Dreamer chain has no information gain — the mechanism is already in
|
|
1900
|
+
// the ledger. Persistent facts only (identity + admission processing).
|
|
1901
|
+
// Fail-open on an unexpected read failure (same posture as the bridge).
|
|
1902
|
+
let backfillSuppression = { suppress: false };
|
|
1903
|
+
try {
|
|
1904
|
+
const backfillAdmissionDoc = await stateManager.getAdmissionDocument(candidateId);
|
|
1905
|
+
backfillSuppression = evaluateDreamerSeedSuppression({
|
|
1906
|
+
identity: ledgerAdapter.resolveCandidatePrincipleIdentity(candidateId, 'principle'),
|
|
1907
|
+
processing: backfillAdmissionDoc.ok ? backfillAdmissionDoc.document?.processing : undefined,
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1910
|
+
catch {
|
|
1911
|
+
backfillSuppression = { suppress: false };
|
|
1912
|
+
}
|
|
1913
|
+
if (backfillSuppression.suppress) {
|
|
1914
|
+
const suppressReason = backfillSuppression.reason === 'reuse_resolved_to_existing_principle'
|
|
1915
|
+
? `dreamer_seed_suppressed: durably resolved onto existing principle ${backfillSuppression.principleId} (reuseEvidence)`
|
|
1916
|
+
: 'dreamer_seed_suppressed: reuse park pending Owner decision';
|
|
1917
|
+
output.deferred++;
|
|
1918
|
+
output.results.push({ candidateId, route: decision.route, status: 'deferred', reason: suppressReason, statusBefore: 'pending', statusAfter: 'consumed', intakeDecision: 'intake_succeeded', seedDecision: 'skipped', nextAction: 'No action required: the candidate is resolved onto an existing principle; no independent chain by design.' });
|
|
1919
|
+
continue;
|
|
1920
|
+
}
|
|
1706
1921
|
const existingTask = await stateManager.getTask(taskId);
|
|
1707
1922
|
if (existingTask) {
|
|
1708
1923
|
output.alreadyHaveTask++;
|