audit-tools 0.51.7 → 0.51.9
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/audit/clarification/blastRadius.d.ts +17 -16
- package/dist/audit/clarification/blastRadius.d.ts.map +1 -1
- package/dist/audit/clarification/blastRadius.js +48 -44
- package/dist/audit/clarification/blastRadius.js.map +1 -1
- package/dist/audit/clarification/dials.d.ts +4 -4
- package/dist/audit/clarification/dials.d.ts.map +1 -1
- package/dist/audit/clarification/dials.js +1 -0
- package/dist/audit/clarification/dials.js.map +1 -1
- package/dist/audit/clarification/partition.d.ts +12 -21
- package/dist/audit/clarification/partition.d.ts.map +1 -1
- package/dist/audit/clarification/partition.js +52 -59
- package/dist/audit/clarification/partition.js.map +1 -1
- package/dist/audit/clarification/riskGate.d.ts +2 -2
- package/dist/audit/clarification/riskGate.d.ts.map +1 -1
- package/dist/audit/clarification/riskGate.js +1 -0
- package/dist/audit/clarification/riskGate.js.map +1 -1
- package/dist/audit/clarification/voiQueue.d.ts +3 -3
- package/dist/audit/clarification/voiQueue.d.ts.map +1 -1
- package/dist/audit/clarification/voiQueue.js +1 -0
- package/dist/audit/clarification/voiQueue.js.map +1 -1
- package/dist/audit/cli/auditStep.d.ts +14 -2
- package/dist/audit/cli/auditStep.d.ts.map +1 -1
- package/dist/audit/cli/auditStep.js +13 -5
- package/dist/audit/cli/auditStep.js.map +1 -1
- package/dist/audit/cli/charterClarificationPrompt.d.ts +6 -9
- package/dist/audit/cli/charterClarificationPrompt.d.ts.map +1 -1
- package/dist/audit/cli/charterClarificationPrompt.js +35 -47
- package/dist/audit/cli/charterClarificationPrompt.js.map +1 -1
- package/dist/audit/cli/charterComparisonPrompt.d.ts +14 -0
- package/dist/audit/cli/charterComparisonPrompt.d.ts.map +1 -0
- package/dist/audit/cli/charterComparisonPrompt.js +111 -0
- package/dist/audit/cli/charterComparisonPrompt.js.map +1 -0
- package/dist/audit/cli/charterExtractionPrompt.d.ts +14 -17
- package/dist/audit/cli/charterExtractionPrompt.d.ts.map +1 -1
- package/dist/audit/cli/charterExtractionPrompt.js +81 -104
- package/dist/audit/cli/charterExtractionPrompt.js.map +1 -1
- package/dist/audit/cli/charterFidelityPrompt.d.ts +14 -0
- package/dist/audit/cli/charterFidelityPrompt.d.ts.map +1 -0
- package/dist/audit/cli/charterFidelityPrompt.js +58 -0
- package/dist/audit/cli/charterFidelityPrompt.js.map +1 -0
- package/dist/audit/cli/conceptualDispatch.d.ts +39 -6
- package/dist/audit/cli/conceptualDispatch.d.ts.map +1 -1
- package/dist/audit/cli/conceptualDispatch.js +59 -12
- package/dist/audit/cli/conceptualDispatch.js.map +1 -1
- package/dist/audit/cli/confirmIntentStep.d.ts.map +1 -1
- package/dist/audit/cli/confirmIntentStep.js +46 -2
- package/dist/audit/cli/confirmIntentStep.js.map +1 -1
- package/dist/audit/cli/dispatch/hostHandoff.d.ts +18 -6
- package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
- package/dist/audit/cli/dispatch/hostHandoff.js +525 -67
- package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
- package/dist/audit/cli/fanoutLanes.d.ts +24 -0
- package/dist/audit/cli/fanoutLanes.d.ts.map +1 -1
- package/dist/audit/cli/fanoutLanes.js +9 -1
- package/dist/audit/cli/fanoutLanes.js.map +1 -1
- package/dist/audit/cli/foldTransaction.d.ts.map +1 -1
- package/dist/audit/cli/foldTransaction.js +14 -3
- package/dist/audit/cli/foldTransaction.js.map +1 -1
- package/dist/audit/cli/forceSynthesisCommand.d.ts.map +1 -1
- package/dist/audit/cli/forceSynthesisCommand.js +4 -1
- package/dist/audit/cli/forceSynthesisCommand.js.map +1 -1
- package/dist/audit/cli/intakeCommand.d.ts.map +1 -1
- package/dist/audit/cli/intakeCommand.js +1 -0
- package/dist/audit/cli/intakeCommand.js.map +1 -1
- package/dist/audit/cli/laneSubmissions.d.ts +18 -12
- package/dist/audit/cli/laneSubmissions.d.ts.map +1 -1
- package/dist/audit/cli/laneSubmissions.js +40 -4
- package/dist/audit/cli/laneSubmissions.js.map +1 -1
- package/dist/audit/cli/laneValidators.d.ts.map +1 -1
- package/dist/audit/cli/laneValidators.js +14 -14
- package/dist/audit/cli/laneValidators.js.map +1 -1
- package/dist/audit/cli/nextStepCommand.d.ts +7 -0
- package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
- package/dist/audit/cli/nextStepCommand.js +206 -31
- package/dist/audit/cli/nextStepCommand.js.map +1 -1
- package/dist/audit/cli/nextStepHelpers.d.ts +92 -28
- package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
- package/dist/audit/cli/nextStepHelpers.js +363 -126
- package/dist/audit/cli/nextStepHelpers.js.map +1 -1
- package/dist/audit/cli/prompts.d.ts +10 -0
- package/dist/audit/cli/prompts.d.ts.map +1 -1
- package/dist/audit/cli/prompts.js +3 -1
- package/dist/audit/cli/prompts.js.map +1 -1
- package/dist/audit/cli/reviewRun.d.ts +12 -0
- package/dist/audit/cli/reviewRun.d.ts.map +1 -1
- package/dist/audit/cli/reviewRun.js +242 -29
- package/dist/audit/cli/reviewRun.js.map +1 -1
- package/dist/audit/cli/sampleRunCommand.d.ts +12 -4
- package/dist/audit/cli/sampleRunCommand.d.ts.map +1 -1
- package/dist/audit/cli/semanticReviewStep.d.ts +9 -0
- package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
- package/dist/audit/cli/semanticReviewStep.js +71 -30
- package/dist/audit/cli/semanticReviewStep.js.map +1 -1
- package/dist/audit/cli/statusCommand.d.ts.map +1 -1
- package/dist/audit/cli/statusCommand.js +29 -66
- package/dist/audit/cli/statusCommand.js.map +1 -1
- package/dist/audit/cli/stepScaffold.d.ts +43 -2
- package/dist/audit/cli/stepScaffold.d.ts.map +1 -1
- package/dist/audit/cli/stepScaffold.js +24 -10
- package/dist/audit/cli/stepScaffold.js.map +1 -1
- package/dist/audit/cli/steps.d.ts +52 -29
- package/dist/audit/cli/steps.d.ts.map +1 -1
- package/dist/audit/cli/steps.js +44 -14
- package/dist/audit/cli/steps.js.map +1 -1
- package/dist/audit/cli/synthesizeCommand.d.ts.map +1 -1
- package/dist/audit/cli/synthesizeCommand.js +4 -1
- package/dist/audit/cli/synthesizeCommand.js.map +1 -1
- package/dist/audit/contracts/workerSchemas.d.ts +65 -16
- package/dist/audit/contracts/workerSchemas.d.ts.map +1 -1
- package/dist/audit/contracts/workerSchemas.js +89 -8
- package/dist/audit/contracts/workerSchemas.js.map +1 -1
- package/dist/audit/contracts/wrapperResponse.d.ts +14 -21
- package/dist/audit/contracts/wrapperResponse.d.ts.map +1 -1
- package/dist/audit/contracts/wrapperResponse.js +0 -1
- package/dist/audit/contracts/wrapperResponse.js.map +1 -1
- package/dist/audit/decompose/findings.d.ts.map +1 -1
- package/dist/audit/decompose/findings.js +10 -2
- package/dist/audit/decompose/findings.js.map +1 -1
- package/dist/audit/extractors/designAssessment.d.ts.map +1 -1
- package/dist/audit/extractors/designAssessment.js +13 -4
- package/dist/audit/extractors/designAssessment.js.map +1 -1
- package/dist/audit/extractors/disposition.d.ts.map +1 -1
- package/dist/audit/extractors/disposition.js +17 -5
- package/dist/audit/extractors/disposition.js.map +1 -1
- package/dist/audit/extractors/graph.d.ts +1 -1
- package/dist/audit/extractors/graph.js +1 -1
- package/dist/audit/extractors/graphRoutes.d.ts.map +1 -1
- package/dist/audit/extractors/graphRoutes.js +224 -17
- package/dist/audit/extractors/graphRoutes.js.map +1 -1
- package/dist/audit/extractors/leadLineage.d.ts +10 -0
- package/dist/audit/extractors/leadLineage.d.ts.map +1 -0
- package/dist/audit/extractors/leadLineage.js +44 -0
- package/dist/audit/extractors/leadLineage.js.map +1 -0
- package/dist/audit/io/artifacts.d.ts.map +1 -1
- package/dist/audit/io/artifacts.js +25 -8
- package/dist/audit/io/artifacts.js.map +1 -1
- package/dist/audit/io/runArtifacts.d.ts +76 -1
- package/dist/audit/io/runArtifacts.d.ts.map +1 -1
- package/dist/audit/io/runArtifacts.js +113 -20
- package/dist/audit/io/runArtifacts.js.map +1 -1
- package/dist/audit/io/toolingManifest.d.ts +15 -0
- package/dist/audit/io/toolingManifest.d.ts.map +1 -1
- package/dist/audit/io/toolingManifest.js +158 -11
- package/dist/audit/io/toolingManifest.js.map +1 -1
- package/dist/audit/orchestrator/advance.d.ts.map +1 -1
- package/dist/audit/orchestrator/advance.js +30 -4
- package/dist/audit/orchestrator/advance.js.map +1 -1
- package/dist/audit/orchestrator/advanceTypes.d.ts +28 -5
- package/dist/audit/orchestrator/advanceTypes.d.ts.map +1 -1
- package/dist/audit/orchestrator/artifactMetadata.d.ts.map +1 -1
- package/dist/audit/orchestrator/artifactMetadata.js +39 -1
- package/dist/audit/orchestrator/artifactMetadata.js.map +1 -1
- package/dist/audit/orchestrator/auditTaskUtils.d.ts.map +1 -1
- package/dist/audit/orchestrator/auditTaskUtils.js +4 -1
- package/dist/audit/orchestrator/auditTaskUtils.js.map +1 -1
- package/dist/audit/orchestrator/charterClarificationExecutor.d.ts +11 -17
- package/dist/audit/orchestrator/charterClarificationExecutor.d.ts.map +1 -1
- package/dist/audit/orchestrator/charterClarificationExecutor.js +61 -93
- package/dist/audit/orchestrator/charterClarificationExecutor.js.map +1 -1
- package/dist/audit/orchestrator/charterComparisonExecutor.d.ts +24 -0
- package/dist/audit/orchestrator/charterComparisonExecutor.d.ts.map +1 -0
- package/dist/audit/orchestrator/charterComparisonExecutor.js +110 -0
- package/dist/audit/orchestrator/charterComparisonExecutor.js.map +1 -0
- package/dist/audit/orchestrator/charterExtractionExecutor.d.ts +34 -20
- package/dist/audit/orchestrator/charterExtractionExecutor.d.ts.map +1 -1
- package/dist/audit/orchestrator/charterExtractionExecutor.js +80 -106
- package/dist/audit/orchestrator/charterExtractionExecutor.js.map +1 -1
- package/dist/audit/orchestrator/charterFidelityExecutor.d.ts +20 -0
- package/dist/audit/orchestrator/charterFidelityExecutor.d.ts.map +1 -0
- package/dist/audit/orchestrator/charterFidelityExecutor.js +76 -0
- package/dist/audit/orchestrator/charterFidelityExecutor.js.map +1 -0
- package/dist/audit/orchestrator/charterFidelityPacket.d.ts +7 -0
- package/dist/audit/orchestrator/charterFidelityPacket.d.ts.map +1 -0
- package/dist/audit/orchestrator/charterFidelityPacket.js +68 -0
- package/dist/audit/orchestrator/charterFidelityPacket.js.map +1 -0
- package/dist/audit/orchestrator/dependencyMap.d.ts.map +1 -1
- package/dist/audit/orchestrator/dependencyMap.js +9 -8
- package/dist/audit/orchestrator/dependencyMap.js.map +1 -1
- package/dist/audit/orchestrator/dependencySlices.d.ts.map +1 -1
- package/dist/audit/orchestrator/dependencySlices.js +7 -6
- package/dist/audit/orchestrator/dependencySlices.js.map +1 -1
- package/dist/audit/orchestrator/designReviewProjection.d.ts.map +1 -1
- package/dist/audit/orchestrator/designReviewProjection.js +7 -0
- package/dist/audit/orchestrator/designReviewProjection.js.map +1 -1
- package/dist/audit/orchestrator/designReviewPrompt.d.ts.map +1 -1
- package/dist/audit/orchestrator/designReviewPrompt.js +58 -19
- package/dist/audit/orchestrator/designReviewPrompt.js.map +1 -1
- package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
- package/dist/audit/orchestrator/executorRunners.js +6 -2
- package/dist/audit/orchestrator/executorRunners.js.map +1 -1
- package/dist/audit/orchestrator/executors.d.ts.map +1 -1
- package/dist/audit/orchestrator/executors.js +22 -8
- package/dist/audit/orchestrator/executors.js.map +1 -1
- package/dist/audit/orchestrator/hostInputPause.js +1 -0
- package/dist/audit/orchestrator/hostInputPause.js.map +1 -1
- package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts +40 -0
- package/dist/audit/orchestrator/intentCheckpointExecutor.d.ts.map +1 -1
- package/dist/audit/orchestrator/intentCheckpointExecutor.js +32 -2
- package/dist/audit/orchestrator/intentCheckpointExecutor.js.map +1 -1
- package/dist/audit/orchestrator/intentCheckpointGate.d.ts +5 -3
- package/dist/audit/orchestrator/intentCheckpointGate.d.ts.map +1 -1
- package/dist/audit/orchestrator/intentCheckpointGate.js +34 -5
- package/dist/audit/orchestrator/intentCheckpointGate.js.map +1 -1
- package/dist/audit/orchestrator/intentEquivalenceExecutor.d.ts +2 -2
- package/dist/audit/orchestrator/intentInterpreter.d.ts +1 -1
- package/dist/audit/orchestrator/intentInterpreter.js +1 -1
- package/dist/audit/orchestrator/nextStep.d.ts.map +1 -1
- package/dist/audit/orchestrator/nextStep.js +3 -1
- package/dist/audit/orchestrator/nextStep.js.map +1 -1
- package/dist/audit/orchestrator/obligationPolicy.d.ts +2 -1
- package/dist/audit/orchestrator/obligationPolicy.d.ts.map +1 -1
- package/dist/audit/orchestrator/obligationPolicy.js +19 -7
- package/dist/audit/orchestrator/obligationPolicy.js.map +1 -1
- package/dist/audit/orchestrator/partitionTaskGraph.d.ts.map +1 -1
- package/dist/audit/orchestrator/partitionTaskGraph.js +1 -0
- package/dist/audit/orchestrator/partitionTaskGraph.js.map +1 -1
- package/dist/audit/orchestrator/resultIngestion.d.ts.map +1 -1
- package/dist/audit/orchestrator/resultIngestion.js +3 -1
- package/dist/audit/orchestrator/resultIngestion.js.map +1 -1
- package/dist/audit/orchestrator/runtimeCommand.d.ts +72 -0
- package/dist/audit/orchestrator/runtimeCommand.d.ts.map +1 -1
- package/dist/audit/orchestrator/runtimeCommand.js +177 -20
- package/dist/audit/orchestrator/runtimeCommand.js.map +1 -1
- package/dist/audit/orchestrator/scopeIndexBaseline.d.ts +56 -0
- package/dist/audit/orchestrator/scopeIndexBaseline.d.ts.map +1 -0
- package/dist/audit/orchestrator/scopeIndexBaseline.js +114 -0
- package/dist/audit/orchestrator/scopeIndexBaseline.js.map +1 -0
- package/dist/audit/orchestrator/staleness.d.ts +70 -1
- package/dist/audit/orchestrator/staleness.d.ts.map +1 -1
- package/dist/audit/orchestrator/staleness.js +171 -21
- package/dist/audit/orchestrator/staleness.js.map +1 -1
- package/dist/audit/orchestrator/state.d.ts.map +1 -1
- package/dist/audit/orchestrator/state.js +49 -25
- package/dist/audit/orchestrator/state.js.map +1 -1
- package/dist/audit/orchestrator/structureExecutors.d.ts.map +1 -1
- package/dist/audit/orchestrator/structureExecutors.js +7 -5
- package/dist/audit/orchestrator/structureExecutors.js.map +1 -1
- package/dist/audit/orchestrator/syntaxResolutionExecutor.d.ts.map +1 -1
- package/dist/audit/orchestrator/syntaxResolutionExecutor.js +1 -0
- package/dist/audit/orchestrator/syntaxResolutionExecutor.js.map +1 -1
- package/dist/audit/orchestrator/systemicChallengeExecutor.d.ts +13 -2
- package/dist/audit/orchestrator/systemicChallengeExecutor.d.ts.map +1 -1
- package/dist/audit/orchestrator/systemicChallengeExecutor.js +166 -12
- package/dist/audit/orchestrator/systemicChallengeExecutor.js.map +1 -1
- package/dist/audit/reporting/mergeFindings.d.ts.map +1 -1
- package/dist/audit/reporting/mergeFindings.js +6 -5
- package/dist/audit/reporting/mergeFindings.js.map +1 -1
- package/dist/audit/reporting/synthesis.d.ts +117 -0
- package/dist/audit/reporting/synthesis.d.ts.map +1 -1
- package/dist/audit/reporting/synthesis.js +277 -10
- package/dist/audit/reporting/synthesis.js.map +1 -1
- package/dist/audit/supervisor/operatorHandoff.d.ts +0 -2
- package/dist/audit/supervisor/operatorHandoff.d.ts.map +1 -1
- package/dist/audit/supervisor/operatorHandoff.js +0 -3
- package/dist/audit/supervisor/operatorHandoff.js.map +1 -1
- package/dist/audit/systemic/coveredThemes.d.ts +28 -0
- package/dist/audit/systemic/coveredThemes.d.ts.map +1 -0
- package/dist/audit/systemic/coveredThemes.js +52 -0
- package/dist/audit/systemic/coveredThemes.js.map +1 -0
- package/dist/audit/systemic/reviewFileMap.d.ts +81 -0
- package/dist/audit/systemic/reviewFileMap.d.ts.map +1 -0
- package/dist/audit/systemic/reviewFileMap.js +169 -0
- package/dist/audit/systemic/reviewFileMap.js.map +1 -0
- package/dist/audit/systemic/secondOrderAdversaryPrompt.d.ts.map +1 -1
- package/dist/audit/systemic/secondOrderAdversaryPrompt.js +149 -26
- package/dist/audit/systemic/secondOrderAdversaryPrompt.js.map +1 -1
- package/dist/audit/systemic/systemicChallengeLoop.d.ts +44 -4
- package/dist/audit/systemic/systemicChallengeLoop.d.ts.map +1 -1
- package/dist/audit/systemic/systemicChallengeLoop.js +114 -10
- package/dist/audit/systemic/systemicChallengeLoop.js.map +1 -1
- package/dist/audit/types/auditState.d.ts +6 -6
- package/dist/audit/types/charterClarification.d.ts +9 -4
- package/dist/audit/types/charterClarification.d.ts.map +1 -1
- package/dist/audit/types/charterRegister.d.ts +48 -93
- package/dist/audit/types/charterRegister.d.ts.map +1 -1
- package/dist/audit/types/charterRegister.js +15 -26
- package/dist/audit/types/charterRegister.js.map +1 -1
- package/dist/audit/types/conceptualAdjudication.d.ts +88 -18
- package/dist/audit/types/conceptualAdjudication.d.ts.map +1 -1
- package/dist/audit/types/conceptualAdjudication.js +77 -16
- package/dist/audit/types/conceptualAdjudication.js.map +1 -1
- package/dist/audit/types/designAssessment.d.ts +8 -6
- package/dist/audit/types/designAssessment.d.ts.map +1 -1
- package/dist/audit/types/reviewPlanning.d.ts +2 -2
- package/dist/audit/types/systemicChallenge.d.ts +43 -7
- package/dist/audit/types/systemicChallenge.d.ts.map +1 -1
- package/dist/audit/types.d.ts +71 -10
- package/dist/audit/types.d.ts.map +1 -1
- package/dist/audit/types.js +23 -2
- package/dist/audit/types.js.map +1 -1
- package/dist/audit/validation/auditResults.d.ts +30 -0
- package/dist/audit/validation/auditResults.d.ts.map +1 -1
- package/dist/audit/validation/auditResults.js +50 -8
- package/dist/audit/validation/auditResults.js.map +1 -1
- package/dist/audit/validation/ingestIssueCodes.d.ts +1 -1
- package/dist/audit/validation/ingestIssueCodes.d.ts.map +1 -1
- package/dist/audit/validation/ingestIssueCodes.js +14 -0
- package/dist/audit/validation/ingestIssueCodes.js.map +1 -1
- package/dist/remediate/contractPipeline/artifactStore.d.ts +97 -2
- package/dist/remediate/contractPipeline/artifactStore.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/artifactStore.js +163 -9
- package/dist/remediate/contractPipeline/artifactStore.js.map +1 -1
- package/dist/remediate/contractPipeline/changeClassification.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/changeClassification.js +93 -3
- package/dist/remediate/contractPipeline/changeClassification.js.map +1 -1
- package/dist/remediate/contractPipeline/cyclicSeamResolution.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/cyclicSeamResolution.js +31 -0
- package/dist/remediate/contractPipeline/cyclicSeamResolution.js.map +1 -1
- package/dist/remediate/contractPipeline/derive.d.ts +0 -14
- package/dist/remediate/contractPipeline/derive.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/derive.js +52 -24
- package/dist/remediate/contractPipeline/derive.js.map +1 -1
- package/dist/remediate/contractPipeline/finalizedContractFields.d.ts +50 -0
- package/dist/remediate/contractPipeline/finalizedContractFields.d.ts.map +1 -0
- package/dist/remediate/contractPipeline/finalizedContractFields.js +77 -0
- package/dist/remediate/contractPipeline/finalizedContractFields.js.map +1 -0
- package/dist/remediate/contractPipeline/idRegistry.d.ts +85 -0
- package/dist/remediate/contractPipeline/idRegistry.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/idRegistry.js +147 -0
- package/dist/remediate/contractPipeline/idRegistry.js.map +1 -1
- package/dist/remediate/contractPipeline/phaseCut.d.ts +13 -16
- package/dist/remediate/contractPipeline/phaseCut.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/phaseCut.js +15 -30
- package/dist/remediate/contractPipeline/phaseCut.js.map +1 -1
- package/dist/remediate/contractPipeline/reviewSnapshot.d.ts +20 -1
- package/dist/remediate/contractPipeline/reviewSnapshot.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/reviewSnapshot.js +23 -7
- package/dist/remediate/contractPipeline/reviewSnapshot.js.map +1 -1
- package/dist/remediate/contractPipeline/semanticProjection.d.ts +17 -0
- package/dist/remediate/contractPipeline/semanticProjection.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/semanticProjection.js +6 -9
- package/dist/remediate/contractPipeline/semanticProjection.js.map +1 -1
- package/dist/remediate/contractPipeline/sketchSource.d.ts +183 -0
- package/dist/remediate/contractPipeline/sketchSource.d.ts.map +1 -0
- package/dist/remediate/contractPipeline/sketchSource.js +255 -0
- package/dist/remediate/contractPipeline/sketchSource.js.map +1 -0
- package/dist/remediate/findingFilter.d.ts.map +1 -1
- package/dist/remediate/findingFilter.js +1 -0
- package/dist/remediate/findingFilter.js.map +1 -1
- package/dist/remediate/index.d.ts +81 -0
- package/dist/remediate/index.d.ts.map +1 -1
- package/dist/remediate/index.js +162 -53
- package/dist/remediate/index.js.map +1 -1
- package/dist/remediate/intake.d.ts +43 -0
- package/dist/remediate/intake.d.ts.map +1 -1
- package/dist/remediate/intake.js +82 -13
- package/dist/remediate/intake.js.map +1 -1
- package/dist/remediate/phases/close.d.ts +33 -2
- package/dist/remediate/phases/close.d.ts.map +1 -1
- package/dist/remediate/phases/close.js +227 -13
- package/dist/remediate/phases/close.js.map +1 -1
- package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts +154 -0
- package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts.map +1 -0
- package/dist/remediate/phases/closeVerifyHeadEvidence.js +242 -0
- package/dist/remediate/phases/closeVerifyHeadEvidence.js.map +1 -0
- package/dist/remediate/state/runStatus.d.ts +35 -0
- package/dist/remediate/state/runStatus.d.ts.map +1 -0
- package/dist/remediate/state/runStatus.js +46 -0
- package/dist/remediate/state/runStatus.js.map +1 -0
- package/dist/remediate/state/store.d.ts +52 -2
- package/dist/remediate/state/store.d.ts.map +1 -1
- package/dist/remediate/state/store.js +124 -21
- package/dist/remediate/state/store.js.map +1 -1
- package/dist/remediate/state/types.d.ts +83 -13
- package/dist/remediate/state/types.d.ts.map +1 -1
- package/dist/remediate/steps/contractPipeline.d.ts +65 -1
- package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
- package/dist/remediate/steps/contractPipeline.js +302 -85
- package/dist/remediate/steps/contractPipeline.js.map +1 -1
- package/dist/remediate/steps/contractPipelinePrompts.d.ts.map +1 -1
- package/dist/remediate/steps/contractPipelinePrompts.js +58 -21
- package/dist/remediate/steps/contractPipelinePrompts.js.map +1 -1
- package/dist/remediate/steps/dispatch/hostHandoff.d.ts +87 -2
- package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
- package/dist/remediate/steps/dispatch/hostHandoff.js +344 -44
- package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
- package/dist/remediate/steps/finalGate.d.ts +109 -5
- package/dist/remediate/steps/finalGate.d.ts.map +1 -1
- package/dist/remediate/steps/finalGate.js +135 -27
- package/dist/remediate/steps/finalGate.js.map +1 -1
- package/dist/remediate/steps/gateCommands.d.ts +167 -0
- package/dist/remediate/steps/gateCommands.d.ts.map +1 -1
- package/dist/remediate/steps/gateCommands.js +428 -1
- package/dist/remediate/steps/gateCommands.js.map +1 -1
- package/dist/remediate/steps/intakeResolver.d.ts +2 -13
- package/dist/remediate/steps/intakeResolver.d.ts.map +1 -1
- package/dist/remediate/steps/intakeResolver.js +22 -4
- package/dist/remediate/steps/intakeResolver.js.map +1 -1
- package/dist/remediate/steps/nextStep.d.ts +44 -40
- package/dist/remediate/steps/nextStep.d.ts.map +1 -1
- package/dist/remediate/steps/nextStep.js +501 -106
- package/dist/remediate/steps/nextStep.js.map +1 -1
- package/dist/remediate/steps/stepWriter.d.ts +1 -1
- package/dist/remediate/steps/stepWriter.d.ts.map +1 -1
- package/dist/remediate/steps/stepWriter.js +1 -0
- package/dist/remediate/steps/stepWriter.js.map +1 -1
- package/dist/remediate/steps/types.d.ts +32 -1
- package/dist/remediate/steps/types.d.ts.map +1 -1
- package/dist/remediate/steps/types.js +1 -0
- package/dist/remediate/steps/types.js.map +1 -1
- package/dist/remediate/types/options.d.ts +8 -0
- package/dist/remediate/types/options.d.ts.map +1 -1
- package/dist/remediate/utils/fileIntegrity.d.ts +8 -0
- package/dist/remediate/utils/fileIntegrity.d.ts.map +1 -1
- package/dist/remediate/utils/fileIntegrity.js +12 -1
- package/dist/remediate/utils/fileIntegrity.js.map +1 -1
- package/dist/remediate/validation/artifacts.d.ts +1 -1
- package/dist/remediate/validation/artifacts.d.ts.map +1 -1
- package/dist/remediate/validation/artifacts.js +19 -2
- package/dist/remediate/validation/artifacts.js.map +1 -1
- package/dist/remediate/validation/contractPipeline.d.ts.map +1 -1
- package/dist/remediate/validation/contractPipeline.js +26 -39
- package/dist/remediate/validation/contractPipeline.js.map +1 -1
- package/dist/remediate/validation/contractPipelineGates.d.ts +18 -1
- package/dist/remediate/validation/contractPipelineGates.d.ts.map +1 -1
- package/dist/remediate/validation/contractPipelineGates.js +33 -5
- package/dist/remediate/validation/contractPipelineGates.js.map +1 -1
- package/dist/shared/analyzers/acquisitionEngine.d.ts +83 -5
- package/dist/shared/analyzers/acquisitionEngine.d.ts.map +1 -1
- package/dist/shared/analyzers/acquisitionEngine.js +46 -14
- package/dist/shared/analyzers/acquisitionEngine.js.map +1 -1
- package/dist/shared/analyzers/binaryAcquisition.d.ts +35 -2
- package/dist/shared/analyzers/binaryAcquisition.d.ts.map +1 -1
- package/dist/shared/analyzers/binaryAcquisition.js +5 -5
- package/dist/shared/analyzers/binaryAcquisition.js.map +1 -1
- package/dist/shared/analyzers/candidates.d.ts.map +1 -1
- package/dist/shared/analyzers/candidates.js +1 -0
- package/dist/shared/analyzers/candidates.js.map +1 -1
- package/dist/shared/analyzers/clippy.d.ts +9 -1
- package/dist/shared/analyzers/clippy.d.ts.map +1 -1
- package/dist/shared/analyzers/clippy.js +10 -2
- package/dist/shared/analyzers/clippy.js.map +1 -1
- package/dist/shared/analyzers/normalizeExternal.d.ts.map +1 -1
- package/dist/shared/analyzers/normalizeExternal.js +1 -0
- package/dist/shared/analyzers/normalizeExternal.js.map +1 -1
- package/dist/shared/analyzers/rubocop.d.ts +7 -1
- package/dist/shared/analyzers/rubocop.d.ts.map +1 -1
- package/dist/shared/analyzers/rubocop.js +8 -2
- package/dist/shared/analyzers/rubocop.js.map +1 -1
- package/dist/shared/analyzers/types.d.ts +24 -24
- package/dist/shared/analyzers/types.d.ts.map +1 -1
- package/dist/shared/analyzers/types.js +15 -0
- package/dist/shared/analyzers/types.js.map +1 -1
- package/dist/shared/artifactFreshness.d.ts.map +1 -1
- package/dist/shared/artifactFreshness.js +42 -7
- package/dist/shared/artifactFreshness.js.map +1 -1
- package/dist/shared/chunkByBudget.d.ts.map +1 -1
- package/dist/shared/chunkByBudget.js.map +1 -1
- package/dist/shared/continuityScore.d.ts.map +1 -1
- package/dist/shared/continuityScore.js +12 -4
- package/dist/shared/continuityScore.js.map +1 -1
- package/dist/shared/decompose/charterClarification.d.ts +49 -45
- package/dist/shared/decompose/charterClarification.d.ts.map +1 -1
- package/dist/shared/decompose/charterClarification.js +50 -57
- package/dist/shared/decompose/charterClarification.js.map +1 -1
- package/dist/shared/decompose/charterExtraction.d.ts +616 -342
- package/dist/shared/decompose/charterExtraction.d.ts.map +1 -1
- package/dist/shared/decompose/charterExtraction.js +590 -488
- package/dist/shared/decompose/charterExtraction.js.map +1 -1
- package/dist/shared/decompose/contentCoherence.d.ts +36 -2
- package/dist/shared/decompose/contentCoherence.d.ts.map +1 -1
- package/dist/shared/decompose/contentCoherence.js +45 -5
- package/dist/shared/decompose/contentCoherence.js.map +1 -1
- package/dist/shared/decompose/modularity.d.ts +98 -1
- package/dist/shared/decompose/modularity.d.ts.map +1 -1
- package/dist/shared/decompose/modularity.js +89 -8
- package/dist/shared/decompose/modularity.js.map +1 -1
- package/dist/shared/decompose/systemicChallenge.d.ts +111 -0
- package/dist/shared/decompose/systemicChallenge.d.ts.map +1 -1
- package/dist/shared/decompose/systemicChallenge.js +28 -0
- package/dist/shared/decompose/systemicChallenge.js.map +1 -1
- package/dist/shared/engine/obligationEngine.d.ts +2 -2
- package/dist/shared/engine/obligationEngine.d.ts.map +1 -1
- package/dist/shared/engine/obligationEngine.js +8 -2
- package/dist/shared/engine/obligationEngine.js.map +1 -1
- package/dist/shared/findingSimilarity.d.ts +8 -0
- package/dist/shared/findingSimilarity.d.ts.map +1 -1
- package/dist/shared/findingSimilarity.js +10 -3
- package/dist/shared/findingSimilarity.js.map +1 -1
- package/dist/shared/findings/dedupe.d.ts +15 -0
- package/dist/shared/findings/dedupe.d.ts.map +1 -1
- package/dist/shared/findings/dedupe.js +137 -1
- package/dist/shared/findings/dedupe.js.map +1 -1
- package/dist/shared/friction/frictionRecord.d.ts.map +1 -1
- package/dist/shared/friction/frictionRecord.js +14 -1
- package/dist/shared/friction/frictionRecord.js.map +1 -1
- package/dist/shared/friction/triage.d.ts +4 -0
- package/dist/shared/friction/triage.d.ts.map +1 -1
- package/dist/shared/friction/triage.js +41 -29
- package/dist/shared/friction/triage.js.map +1 -1
- package/dist/shared/git.d.ts +14 -0
- package/dist/shared/git.d.ts.map +1 -1
- package/dist/shared/git.js +22 -0
- package/dist/shared/git.js.map +1 -1
- package/dist/shared/index.d.ts +42 -38
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +35 -23
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/intent/clauseBoundaries.d.ts +75 -0
- package/dist/shared/intent/clauseBoundaries.d.ts.map +1 -0
- package/dist/shared/intent/clauseBoundaries.js +134 -0
- package/dist/shared/intent/clauseBoundaries.js.map +1 -0
- package/dist/shared/intent/clauseInterpreter.d.ts +11 -5
- package/dist/shared/intent/clauseInterpreter.d.ts.map +1 -1
- package/dist/shared/intent/clauseInterpreter.js +16 -41
- package/dist/shared/intent/clauseInterpreter.js.map +1 -1
- package/dist/shared/intent/freeFormIntentInterpreter.d.ts +11 -0
- package/dist/shared/intent/freeFormIntentInterpreter.d.ts.map +1 -1
- package/dist/shared/intent/freeFormIntentInterpreter.js +31 -17
- package/dist/shared/intent/freeFormIntentInterpreter.js.map +1 -1
- package/dist/shared/io/fileLock.d.ts.map +1 -1
- package/dist/shared/io/fileLock.js +18 -6
- package/dist/shared/io/fileLock.js.map +1 -1
- package/dist/shared/io/frictionCapture.d.ts +25 -5
- package/dist/shared/io/frictionCapture.d.ts.map +1 -1
- package/dist/shared/io/frictionCapture.js +30 -9
- package/dist/shared/io/frictionCapture.js.map +1 -1
- package/dist/shared/io/schemaVersion.d.ts +4 -3
- package/dist/shared/io/schemaVersion.d.ts.map +1 -1
- package/dist/shared/io/schemaVersion.js +27 -4
- package/dist/shared/io/schemaVersion.js.map +1 -1
- package/dist/shared/io/stepContractWriter.d.ts +38 -4
- package/dist/shared/io/stepContractWriter.d.ts.map +1 -1
- package/dist/shared/io/stepContractWriter.js +59 -1
- package/dist/shared/io/stepContractWriter.js.map +1 -1
- package/dist/shared/loopCorePaths.d.ts.map +1 -1
- package/dist/shared/loopCorePaths.js +8 -0
- package/dist/shared/loopCorePaths.js.map +1 -1
- package/dist/shared/opencodePermissions.d.ts +27 -3
- package/dist/shared/opencodePermissions.d.ts.map +1 -1
- package/dist/shared/opencodePermissions.js +77 -26
- package/dist/shared/opencodePermissions.js.map +1 -1
- package/dist/shared/prompts.d.ts +12 -1
- package/dist/shared/prompts.d.ts.map +1 -1
- package/dist/shared/prompts.js +11 -1
- package/dist/shared/prompts.js.map +1 -1
- package/dist/shared/reReview/projectionDiff.d.ts +13 -0
- package/dist/shared/reReview/projectionDiff.d.ts.map +1 -1
- package/dist/shared/reReview/projectionDiff.js +1 -1
- package/dist/shared/reReview/projectionDiff.js.map +1 -1
- package/dist/shared/reporting/findingDisplay.d.ts +7 -0
- package/dist/shared/reporting/findingDisplay.d.ts.map +1 -1
- package/dist/shared/reporting/findingDisplay.js +8 -1
- package/dist/shared/reporting/findingDisplay.js.map +1 -1
- package/dist/shared/steps/stepEmissionScaffold.d.ts +15 -3
- package/dist/shared/steps/stepEmissionScaffold.d.ts.map +1 -1
- package/dist/shared/steps/stepEmissionScaffold.js +8 -6
- package/dist/shared/steps/stepEmissionScaffold.js.map +1 -1
- package/dist/shared/submission/hostHandoffCore.d.ts +37 -12
- package/dist/shared/submission/hostHandoffCore.d.ts.map +1 -1
- package/dist/shared/submission/hostHandoffCore.js +81 -18
- package/dist/shared/submission/hostHandoffCore.js.map +1 -1
- package/dist/shared/submission/hostResultOutcomes.d.ts +70 -1
- package/dist/shared/submission/hostResultOutcomes.d.ts.map +1 -1
- package/dist/shared/submission/hostResultOutcomes.js +66 -1
- package/dist/shared/submission/hostResultOutcomes.js.map +1 -1
- package/dist/shared/submission/submissionLedger.d.ts +86 -1
- package/dist/shared/submission/submissionLedger.d.ts.map +1 -1
- package/dist/shared/submission/submissionLedger.js +108 -0
- package/dist/shared/submission/submissionLedger.js.map +1 -1
- package/dist/shared/submission/submissionScan.d.ts.map +1 -1
- package/dist/shared/submission/submissionScan.js +1 -0
- package/dist/shared/submission/submissionScan.js.map +1 -1
- package/dist/shared/tooling/analyzerDeps.d.ts +14 -0
- package/dist/shared/tooling/analyzerDeps.d.ts.map +1 -1
- package/dist/shared/tooling/analyzerDeps.js +23 -0
- package/dist/shared/tooling/analyzerDeps.js.map +1 -1
- package/dist/shared/tooling/commandShape.d.ts +35 -1
- package/dist/shared/tooling/commandShape.d.ts.map +1 -1
- package/dist/shared/tooling/commandShape.js +66 -4
- package/dist/shared/tooling/commandShape.js.map +1 -1
- package/dist/shared/tooling/exec.d.ts +62 -4
- package/dist/shared/tooling/exec.d.ts.map +1 -1
- package/dist/shared/tooling/exec.js +127 -8
- package/dist/shared/tooling/exec.js.map +1 -1
- package/dist/shared/types/charter.d.ts +674 -156
- package/dist/shared/types/charter.d.ts.map +1 -1
- package/dist/shared/types/charter.js +172 -118
- package/dist/shared/types/charter.js.map +1 -1
- package/dist/shared/types/closingActions.d.ts +25 -0
- package/dist/shared/types/closingActions.d.ts.map +1 -1
- package/dist/shared/types/closingActions.js +26 -0
- package/dist/shared/types/closingActions.js.map +1 -1
- package/dist/shared/types/contractPipeline/obligations.d.ts +63 -2
- package/dist/shared/types/contractPipeline/obligations.d.ts.map +1 -1
- package/dist/shared/types/contractPipeline/obligations.js +51 -0
- package/dist/shared/types/contractPipeline/obligations.js.map +1 -1
- package/dist/shared/types/contractPipeline.d.ts +1 -0
- package/dist/shared/types/contractPipeline.d.ts.map +1 -1
- package/dist/shared/types/contractPipeline.js +1 -0
- package/dist/shared/types/contractPipeline.js.map +1 -1
- package/dist/shared/types/contractPropertyShapes.d.ts +34 -0
- package/dist/shared/types/contractPropertyShapes.d.ts.map +1 -0
- package/dist/shared/types/contractPropertyShapes.js +255 -0
- package/dist/shared/types/contractPropertyShapes.js.map +1 -0
- package/dist/shared/types/finding.d.ts +376 -18
- package/dist/shared/types/finding.d.ts.map +1 -1
- package/dist/shared/types/finding.js +111 -0
- package/dist/shared/types/finding.js.map +1 -1
- package/dist/shared/types/intentCheckpoint.d.ts +214 -2
- package/dist/shared/types/intentCheckpoint.d.ts.map +1 -1
- package/dist/shared/types/intentCheckpoint.js +273 -0
- package/dist/shared/types/intentCheckpoint.js.map +1 -1
- package/dist/shared/types/intentInterpretation.d.ts +1 -1
- package/dist/shared/types/intentInterpretation.js +1 -1
- package/dist/shared/types/remediationOutcome.d.ts +294 -30
- package/dist/shared/types/remediationOutcome.d.ts.map +1 -1
- package/dist/shared/types/remediationOutcome.js +96 -7
- package/dist/shared/types/remediationOutcome.js.map +1 -1
- package/dist/shared/types/stepContract.d.ts +47 -0
- package/dist/shared/types/stepContract.d.ts.map +1 -1
- package/dist/shared/types/stepContract.js +113 -0
- package/dist/shared/types/stepContract.js.map +1 -1
- package/dist/shared/validation/charterGate.d.ts +13 -28
- package/dist/shared/validation/charterGate.d.ts.map +1 -1
- package/dist/shared/validation/charterGate.js +13 -35
- package/dist/shared/validation/charterGate.js.map +1 -1
- package/dist/shared/validation/contractConstructionSites.d.ts +116 -0
- package/dist/shared/validation/contractConstructionSites.d.ts.map +1 -0
- package/dist/shared/validation/contractConstructionSites.js +277 -0
- package/dist/shared/validation/contractConstructionSites.js.map +1 -0
- package/dist/shared/validation/designFindingGrounding.d.ts +33 -4
- package/dist/shared/validation/designFindingGrounding.d.ts.map +1 -1
- package/dist/shared/validation/designFindingGrounding.js +40 -6
- package/dist/shared/validation/designFindingGrounding.js.map +1 -1
- package/dist/shared/validation/findingGrounding.d.ts.map +1 -1
- package/dist/shared/validation/findingGrounding.js +11 -1
- package/dist/shared/validation/findingGrounding.js.map +1 -1
- package/dist/shared/validation/findingsReport.d.ts.map +1 -1
- package/dist/shared/validation/findingsReport.js +5 -0
- package/dist/shared/validation/findingsReport.js.map +1 -1
- package/docs/audit-pkg/contracts.md +8 -2
- package/opencode.json +29 -29
- package/package.json +16 -3
- package/schemas/audit-code-v1alpha1.schema.json +0 -4
- package/scripts/audit/postinstall.mjs +81 -96
- package/scripts/remediate/postinstall.mjs +43 -83
- package/scripts/shared/host-asset-plan.mjs +176 -0
- package/scripts/shared/install-host-assets.mjs +44 -1
- package/scripts/shared/primitives.mjs +89 -0
- package/skills/audit-code/SKILL.md +4 -4
- package/skills/audit-code/audit-code.prompt.md +14 -10
- package/skills/remediate-code/SKILL.md +9 -5
- package/skills/remediate-code/remediate-code.prompt.md +11 -4
- package/wrapper/audit-code-wrapper-build.mjs +6 -3
- package/dist/audit/cli/charterDeltaPrompt.d.ts +0 -18
- package/dist/audit/cli/charterDeltaPrompt.d.ts.map +0 -1
- package/dist/audit/cli/charterDeltaPrompt.js +0 -150
- package/dist/audit/cli/charterDeltaPrompt.js.map +0 -1
- package/dist/audit/orchestrator/charterDeltaExecutor.d.ts +0 -24
- package/dist/audit/orchestrator/charterDeltaExecutor.d.ts.map +0 -1
- package/dist/audit/orchestrator/charterDeltaExecutor.js +0 -128
- package/dist/audit/orchestrator/charterDeltaExecutor.js.map +0 -1
- package/dist/audit/supervisor/runLedger.d.ts +0 -3
- package/dist/audit/supervisor/runLedger.d.ts.map +0 -1
- package/dist/audit/supervisor/runLedger.js +0 -69
- package/dist/audit/supervisor/runLedger.js.map +0 -1
- package/dist/shared/types/executionRecord.d.ts +0 -58
- package/dist/shared/types/executionRecord.d.ts.map +0 -1
- package/dist/shared/types/executionRecord.js +0 -26
- package/dist/shared/types/executionRecord.js.map +0 -1
- package/dist/shared/types/runLedger.d.ts +0 -17
- package/dist/shared/types/runLedger.d.ts.map +0 -1
- package/dist/shared/types/runLedger.js +0 -7
- package/dist/shared/types/runLedger.js.map +0 -1
|
@@ -1,556 +1,658 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// spec/conceptual-design-review-design.md §"The estimator charters"
|
|
4
|
-
//
|
|
1
|
+
// sites-pinned: tests/shared/charter-layer.test.ts, tests/shared/charter-lane-dag.test.ts
|
|
2
|
+
// The five-step charter layer — deterministic ENFORCEMENT half (design of record:
|
|
3
|
+
// spec/conceptual-design-review-design.md §"The estimator charters", steps 1–5;
|
|
4
|
+
// decision record docs/reviews/charter-redesign-feedback-2026-09-15.md).
|
|
5
5
|
//
|
|
6
|
-
// Division of labour (
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
// IO): provenance-on-disk grounding is the ingest's concern, not this module's.
|
|
6
|
+
// Division of labour: the host lanes emit JUDGMENT (three goal DAGs, the confirmed
|
|
7
|
+
// correspondences and typed differences, the fidelity verdicts); this module is the
|
|
8
|
+
// tool-owned half that grounds, validates, derives and routes:
|
|
9
|
+
// 1. `assembleLaneGraph` — one lane submission → a persisted lane DAG (ids
|
|
10
|
+
// unique, edges resolve, NO cycles, levels derived,
|
|
11
|
+
// file scopes grounded against the repo universe).
|
|
12
|
+
// 2. `proposeCorrespondences` — tool candidates from file overlap + provenance
|
|
13
|
+
// cross-refs (deterministic, content-keyed ids).
|
|
14
|
+
// 3. `assembleComparison` — the comparison submission → confirmed
|
|
15
|
+
// correspondences + difference records, each routed
|
|
16
|
+
// by the FIXED `(dimension, relation, split)` table.
|
|
17
|
+
// 4. `applyFidelity` — tool pre-check verdicts + lane verdicts stamped on.
|
|
18
|
+
// 5. `differenceFindings` — `supported` finding candidates → Finding leads.
|
|
19
|
+
// PURE + deterministic + language-neutral: no IO, no LLM. Provenance-on-disk
|
|
20
|
+
// grounding is the ingest's concern (it hands the pre-check its read results).
|
|
22
21
|
import { z } from "zod";
|
|
23
22
|
import { hashContent } from "../hash.js";
|
|
24
|
-
import { CharterSchema, CharterKindSchema, CharterConfidenceSchema, CharterProvenanceSchema, GoalGraphSchema, TeleologyNodeSchema, TriangulatedTelosSchema, } from "../types/charter.js";
|
|
25
|
-
import { applyTrueCharterGate, gateCharterDelta, } from "../validation/charterGate.js";
|
|
26
23
|
import { compareCodeUnits } from "../compareCodeUnits.js";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
import { CharterLaneGraphSchema, CharterLaneKindSchema, CharterProvenanceSchema, CharterConfidenceSchema, CorrespondenceMemberSchema, DifferenceDimensionSchema, DifferenceRelationSchema, DifferenceSplitSchema, DifferenceAccountSchema, } from "../types/charter.js";
|
|
25
|
+
// ── Step 1: lane submission → lane DAG ─────────────────────────────────────────
|
|
26
|
+
/** A node as a LANE submits it: local id, telos, optional scope, evidence, confidence. */
|
|
27
|
+
const LaneNodeInputSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
node_id: z.string().min(1),
|
|
30
|
+
purpose: z.string().min(1),
|
|
31
|
+
files: z.array(z.string()).optional(),
|
|
32
|
+
provenance: z.array(CharterProvenanceSchema),
|
|
33
|
+
confidence: CharterConfidenceSchema,
|
|
34
|
+
})
|
|
37
35
|
.strict();
|
|
38
|
-
|
|
39
|
-
* The charter-EXTRACTION submission (Phase C.1): ONE blind lane's self-organized
|
|
40
|
-
* teleology. Deltas are NOT authored here — the independent delta miner mines
|
|
41
|
-
* them in a second pass over the joined charters, so no author marks its own
|
|
42
|
-
* homework. Lanes from every kind are merged (concatenated) before assembly;
|
|
43
|
-
* the join is by file-set overlap, so lanes never need to agree on node ids.
|
|
44
|
-
*/
|
|
45
|
-
export const CharterSubmissionSchema = z
|
|
36
|
+
const LaneEdgeInputSchema = z
|
|
46
37
|
.object({
|
|
47
|
-
|
|
38
|
+
from: z.string().min(1),
|
|
39
|
+
to: z.string().min(1),
|
|
40
|
+
provenance: z.array(CharterProvenanceSchema),
|
|
48
41
|
})
|
|
49
42
|
.strict();
|
|
50
43
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* `
|
|
54
|
-
* design's fixed table, enforced here).
|
|
44
|
+
* The charter-EXTRACTION submission (step 1): ONE blind lane's goal DAG. The lane
|
|
45
|
+
* mints local ids; `premise_height` is not asked for (the tool derives it);
|
|
46
|
+
* `files` is optional (the Stated lane cites provenance only).
|
|
55
47
|
*/
|
|
56
|
-
const
|
|
48
|
+
export const CharterSubmissionSchema = z
|
|
57
49
|
.object({
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
kind: CharterLaneKindSchema,
|
|
51
|
+
nodes: z.array(LaneNodeInputSchema).default([]),
|
|
52
|
+
edges: z.array(LaneEdgeInputSchema).default([]),
|
|
60
53
|
})
|
|
61
54
|
.strict();
|
|
62
|
-
/**
|
|
63
|
-
const
|
|
64
|
-
.object({
|
|
65
|
-
node_id: z.string(),
|
|
66
|
-
deltas: z.array(CharterDeltaInputSchema).default([]),
|
|
67
|
-
})
|
|
55
|
+
/** The TOOL-merged extraction submission: every lane's DAG, handed to the executor by path. */
|
|
56
|
+
export const CharterExtractionMergedSchema = z
|
|
57
|
+
.object({ lanes: z.array(CharterSubmissionSchema) })
|
|
68
58
|
.strict();
|
|
69
59
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* `
|
|
60
|
+
* Validate one lane's submission into its persisted DAG. Deterministic: same
|
|
61
|
+
* submission + same universe → same graph. Refusals, per node/edge, are recorded
|
|
62
|
+
* as validation issues (surfaced, never silent):
|
|
63
|
+
* - a duplicate `node_id` keeps the first and drops the rest;
|
|
64
|
+
* - an edge naming an unknown node, or a self-edge, is dropped;
|
|
65
|
+
* - a file outside the universe is dropped from the node's scope (a node left with
|
|
66
|
+
* an EMPTY declared scope keeps `files` absent, i.e. becomes provenance-only);
|
|
67
|
+
* - a CYCLE refuses the whole edge set: every edge on a cycle is dropped and the
|
|
68
|
+
* issue names the cycle, because a level cannot be derived from a cyclic graph
|
|
69
|
+
* and a silently broken cycle would hide which edge the lane drafted backwards
|
|
70
|
+
* ([[inverted-neighbor-edges-manufacture-a-cycle]]).
|
|
71
|
+
* `premise_height` = longest path from a ROOT (a node that serves nothing) down to
|
|
72
|
+
* the node, so 0 is a top-level purpose and a leaf mechanism sits deepest.
|
|
73
|
+
*/
|
|
74
|
+
export function assembleLaneGraph(submission, params) {
|
|
75
|
+
const validation_issues = [];
|
|
76
|
+
const kind = submission.kind;
|
|
77
|
+
// Nodes: unique ids, grounded scopes.
|
|
78
|
+
const byId = new Map();
|
|
79
|
+
for (const node of submission.nodes) {
|
|
80
|
+
if (byId.has(node.node_id)) {
|
|
81
|
+
validation_issues.push(`${kind}: duplicate node_id "${node.node_id}" — kept the first, dropped the rest`);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
let files;
|
|
85
|
+
if (node.files !== undefined) {
|
|
86
|
+
const known = [...new Set(node.files)].filter((f) => params.universe.has(f));
|
|
87
|
+
const unknown = node.files.filter((f) => !params.universe.has(f));
|
|
88
|
+
if (unknown.length > 0) {
|
|
89
|
+
validation_issues.push(`${kind}: node "${node.node_id}" cites file(s) outside the repo universe — dropped from its scope (${[...new Set(unknown)]
|
|
90
|
+
.sort(compareCodeUnits)
|
|
91
|
+
.join(", ")})`);
|
|
92
|
+
}
|
|
93
|
+
files = known.length > 0 ? known.sort(compareCodeUnits) : undefined;
|
|
94
|
+
}
|
|
95
|
+
byId.set(node.node_id, {
|
|
96
|
+
node_id: node.node_id,
|
|
97
|
+
purpose: node.purpose,
|
|
98
|
+
premise_height: 0,
|
|
99
|
+
...(files !== undefined ? { files } : {}),
|
|
100
|
+
provenance: node.provenance,
|
|
101
|
+
confidence: node.confidence,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
// Edges: resolve, no self-edges, no duplicates.
|
|
105
|
+
const edgeKeys = new Set();
|
|
106
|
+
const edges = [];
|
|
107
|
+
for (const edge of submission.edges) {
|
|
108
|
+
if (edge.from === edge.to) {
|
|
109
|
+
validation_issues.push(`${kind}: edge "${edge.from}" serves itself — dropped`);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (!byId.has(edge.from) || !byId.has(edge.to)) {
|
|
113
|
+
validation_issues.push(`${kind}: edge ${edge.from} → ${edge.to} names an unknown node — dropped`);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const key = `${edge.from} -> ${edge.to}`;
|
|
117
|
+
if (edgeKeys.has(key))
|
|
118
|
+
continue;
|
|
119
|
+
edgeKeys.add(key);
|
|
120
|
+
edges.push({ from: edge.from, to: edge.to, provenance: edge.provenance });
|
|
121
|
+
}
|
|
122
|
+
// Cycle check (Kahn over the SERVES direction). Nodes left unprocessed lie on or
|
|
123
|
+
// downstream of a cycle; every edge among them is refused and the issue names them.
|
|
124
|
+
const acyclicEdges = refuseCycles(kind, [...byId.keys()], edges, validation_issues);
|
|
125
|
+
// Levels: longest path from a root. `from` serves `to`, so `to` is the parent;
|
|
126
|
+
// height(child) = max(height(parent)) + 1; roots (serve nothing) are 0.
|
|
127
|
+
const parentsOf = new Map();
|
|
128
|
+
for (const e of acyclicEdges) {
|
|
129
|
+
const list = parentsOf.get(e.from) ?? [];
|
|
130
|
+
list.push(e.to);
|
|
131
|
+
parentsOf.set(e.from, list);
|
|
132
|
+
}
|
|
133
|
+
const height = new Map();
|
|
134
|
+
const heightOf = (id) => {
|
|
135
|
+
const cached = height.get(id);
|
|
136
|
+
if (cached !== undefined)
|
|
137
|
+
return cached;
|
|
138
|
+
const parents = parentsOf.get(id) ?? [];
|
|
139
|
+
const h = parents.length === 0 ? 0 : Math.max(...parents.map(heightOf)) + 1;
|
|
140
|
+
height.set(id, h);
|
|
141
|
+
return h;
|
|
142
|
+
};
|
|
143
|
+
const nodes = [...byId.values()]
|
|
144
|
+
.map((n) => ({ ...n, premise_height: heightOf(n.node_id) }))
|
|
145
|
+
.sort((a, b) => compareCodeUnits(a.node_id, b.node_id));
|
|
146
|
+
const sortedEdges = [...acyclicEdges].sort((a, b) => compareCodeUnits(a.from, b.from) || compareCodeUnits(a.to, b.to));
|
|
147
|
+
return {
|
|
148
|
+
graph: CharterLaneGraphSchema.parse({ kind, nodes, edges: sortedEdges }),
|
|
149
|
+
validation_issues,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function refuseCycles(kind, ids, edges, issues) {
|
|
153
|
+
const indegree = new Map(ids.map((id) => [id, 0]));
|
|
154
|
+
const out = new Map();
|
|
155
|
+
for (const e of edges) {
|
|
156
|
+
indegree.set(e.to, (indegree.get(e.to) ?? 0) + 1);
|
|
157
|
+
const list = out.get(e.from) ?? [];
|
|
158
|
+
list.push(e.to);
|
|
159
|
+
out.set(e.from, list);
|
|
160
|
+
}
|
|
161
|
+
const queue = ids.filter((id) => (indegree.get(id) ?? 0) === 0).sort(compareCodeUnits);
|
|
162
|
+
const done = new Set();
|
|
163
|
+
while (queue.length > 0) {
|
|
164
|
+
const id = queue.shift();
|
|
165
|
+
done.add(id);
|
|
166
|
+
for (const next of out.get(id) ?? []) {
|
|
167
|
+
const d = (indegree.get(next) ?? 1) - 1;
|
|
168
|
+
indegree.set(next, d);
|
|
169
|
+
if (d === 0)
|
|
170
|
+
queue.push(next);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (done.size === ids.length)
|
|
174
|
+
return edges;
|
|
175
|
+
const cyclic = ids.filter((id) => !done.has(id)).sort(compareCodeUnits);
|
|
176
|
+
const cyclicSet = new Set(cyclic);
|
|
177
|
+
const refused = edges.filter((e) => cyclicSet.has(e.from) && cyclicSet.has(e.to));
|
|
178
|
+
issues.push(`${kind}: the goal graph has a cycle through ${cyclic.map((c) => `"${c}"`).join(", ")} — ${refused.length} edge(s) among those nodes refused; a level cannot be derived from a cycle (an edge drafted as "what the parent needs from me" instead of "what I serve" is the usual cause)`);
|
|
179
|
+
return edges.filter((e) => !(cyclicSet.has(e.from) && cyclicSet.has(e.to)));
|
|
180
|
+
}
|
|
181
|
+
// ── Step 2: tool-proposed correspondence candidates ────────────────────────────
|
|
182
|
+
/** The path part of a provenance ref: `<path>#<symbol>` or `<path>:<line>` → `<path>`. */
|
|
183
|
+
export function provenancePath(ref) {
|
|
184
|
+
const hash = ref.indexOf("#");
|
|
185
|
+
const cut = hash >= 0 ? ref.slice(0, hash) : ref;
|
|
186
|
+
const colon = cut.lastIndexOf(":");
|
|
187
|
+
return colon > 0 && /^\d+$/.test(cut.slice(colon + 1)) ? cut.slice(0, colon) : cut;
|
|
188
|
+
}
|
|
189
|
+
function memberKey(members) {
|
|
190
|
+
return [...members]
|
|
191
|
+
.map((m) => `${m.kind}:${[...m.node_ids].sort(compareCodeUnits).join(",")}`)
|
|
192
|
+
.sort(compareCodeUnits)
|
|
193
|
+
.join("|");
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Propose correspondence candidates between every pair of lanes. Two signals, both
|
|
197
|
+
* deterministic and content-derived:
|
|
198
|
+
* - `file_overlap`: the nodes' file scopes share ≥1 path;
|
|
199
|
+
* - `cross_ref`: a node's provenance cites a path (`<path>#<symbol>` / `<path>:<line>`)
|
|
200
|
+
* that lies in the other node's file scope (the Stated lane's usual key).
|
|
201
|
+
* A pair related by both is reported once, as `file_overlap` (the stronger signal),
|
|
202
|
+
* with the union of evidence paths. Candidate ids are content-keyed on the member
|
|
203
|
+
* set, so re-proposal never churns the artifact.
|
|
74
204
|
*/
|
|
75
|
-
|
|
205
|
+
export function proposeCorrespondences(graphs) {
|
|
206
|
+
const byKey = new Map();
|
|
207
|
+
const sorted = [...graphs].sort((a, b) => compareCodeUnits(a.kind, b.kind));
|
|
208
|
+
for (let i = 0; i < sorted.length; i += 1) {
|
|
209
|
+
for (let j = i + 1; j < sorted.length; j += 1) {
|
|
210
|
+
const a = sorted[i];
|
|
211
|
+
const b = sorted[j];
|
|
212
|
+
if (a.kind === b.kind)
|
|
213
|
+
continue;
|
|
214
|
+
for (const na of a.nodes) {
|
|
215
|
+
for (const nb of b.nodes) {
|
|
216
|
+
const overlap = fileOverlap(na, nb);
|
|
217
|
+
const crossRefs = overlap.length > 0 ? [] : crossRefPaths(na, nb);
|
|
218
|
+
if (overlap.length === 0 && crossRefs.length === 0)
|
|
219
|
+
continue;
|
|
220
|
+
const members = [
|
|
221
|
+
{ kind: a.kind, node_ids: [na.node_id] },
|
|
222
|
+
{ kind: b.kind, node_ids: [nb.node_id] },
|
|
223
|
+
];
|
|
224
|
+
const key = memberKey(members);
|
|
225
|
+
if (byKey.has(key))
|
|
226
|
+
continue;
|
|
227
|
+
byKey.set(key, {
|
|
228
|
+
candidate_id: `cand-${hashContent(key, { length: 10 })}`,
|
|
229
|
+
members,
|
|
230
|
+
basis: overlap.length > 0 ? "file_overlap" : "cross_ref",
|
|
231
|
+
evidence_paths: (overlap.length > 0 ? overlap : crossRefs).sort(compareCodeUnits),
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return [...byKey.values()].sort((a, b) => compareCodeUnits(a.candidate_id, b.candidate_id));
|
|
238
|
+
}
|
|
239
|
+
function fileOverlap(a, b) {
|
|
240
|
+
if (!a.files || !b.files)
|
|
241
|
+
return [];
|
|
242
|
+
const setB = new Set(b.files);
|
|
243
|
+
return [...new Set(a.files.filter((f) => setB.has(f)))];
|
|
244
|
+
}
|
|
245
|
+
function crossRefPaths(a, b) {
|
|
246
|
+
const hits = new Set();
|
|
247
|
+
const collect = (from, into) => {
|
|
248
|
+
if (!into.files)
|
|
249
|
+
return;
|
|
250
|
+
const scope = new Set(into.files);
|
|
251
|
+
for (const p of from.provenance) {
|
|
252
|
+
const path = provenancePath(p.ref);
|
|
253
|
+
if (scope.has(path))
|
|
254
|
+
hits.add(path);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
collect(a, b);
|
|
258
|
+
collect(b, a);
|
|
259
|
+
return [...hits];
|
|
260
|
+
}
|
|
261
|
+
// ── Step 3: the comparison submission → correspondences + differences ──────────
|
|
262
|
+
const CorrespondenceInputSchema = z
|
|
76
263
|
.object({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
264
|
+
candidate_id: z.string().min(1).optional(),
|
|
265
|
+
verdict: z.enum(["confirm", "reject", "widen"]),
|
|
266
|
+
members: z.array(CorrespondenceMemberSchema).min(2),
|
|
267
|
+
evidence: z.array(CharterProvenanceSchema).default([]),
|
|
268
|
+
})
|
|
269
|
+
.strict();
|
|
270
|
+
const DifferenceInputSchema = z
|
|
271
|
+
.object({
|
|
272
|
+
/** The candidate_id, or the 0-based index into `correspondences`, this rests on. */
|
|
273
|
+
correspondence: z.union([z.string().min(1), z.number().int().min(0)]),
|
|
274
|
+
dimension: DifferenceDimensionSchema,
|
|
275
|
+
relation: DifferenceRelationSchema,
|
|
276
|
+
split: DifferenceSplitSchema.optional(),
|
|
277
|
+
accounts: z.array(DifferenceAccountSchema).min(2),
|
|
278
|
+
gap: z.string().min(1),
|
|
279
|
+
covered_channel_gap: z.boolean().optional(),
|
|
85
280
|
})
|
|
86
281
|
.strict();
|
|
87
282
|
/**
|
|
88
|
-
* The charter-
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* (it is the only pass that sees every joined unit, so it owns `goal_graph`).
|
|
283
|
+
* The charter-COMPARISON submission (steps 2–3): the comparison reader's verdicts
|
|
284
|
+
* on the tool candidates (plus any it adds), and the typed differences. An empty
|
|
285
|
+
* result must affirm `no_correspondences: true` (a silent empty is indistinguishable
|
|
286
|
+
* from a reader that never ran).
|
|
93
287
|
*/
|
|
94
|
-
export const
|
|
288
|
+
export const CharterComparisonSubmissionSchema = z
|
|
95
289
|
.object({
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
goal_graph: GoalGraphSchema.optional(),
|
|
100
|
-
/**
|
|
101
|
-
* Explicit clean affirmation — "I mined every subsystem and found no deltas."
|
|
102
|
-
* REQUIRED when the submission carries zero deltas, and REFUSED alongside any
|
|
103
|
-
* delta, so a dead miner (which submits nothing) can never be mistaken for a
|
|
104
|
-
* clean one (same contract as `reviewed_clean` on a zero-finding AuditResult).
|
|
105
|
-
* Keyed to DELTAS only: a clean mine may still carry triangulated teloses.
|
|
106
|
-
*/
|
|
107
|
-
no_deltas: z.boolean().optional(),
|
|
290
|
+
correspondences: z.array(CorrespondenceInputSchema).default([]),
|
|
291
|
+
differences: z.array(DifferenceInputSchema).default([]),
|
|
292
|
+
no_correspondences: z.boolean().optional(),
|
|
108
293
|
})
|
|
109
294
|
.strict()
|
|
110
295
|
.superRefine((value, ctx) => {
|
|
111
|
-
const
|
|
112
|
-
if (
|
|
296
|
+
const confirmed = value.correspondences.filter((c) => c.verdict !== "reject").length;
|
|
297
|
+
if (confirmed === 0 && value.no_correspondences !== true) {
|
|
113
298
|
ctx.addIssue({
|
|
114
299
|
code: z.ZodIssueCode.custom,
|
|
115
|
-
path: ["
|
|
116
|
-
message: "a submission
|
|
117
|
-
"without the affirmation is indistinguishable from a miner that never ran.",
|
|
300
|
+
path: ["no_correspondences"],
|
|
301
|
+
message: "a submission that confirms or adds no correspondence must affirm `no_correspondences: true`",
|
|
118
302
|
});
|
|
119
303
|
}
|
|
120
|
-
if (
|
|
304
|
+
if (confirmed > 0 && value.no_correspondences === true) {
|
|
121
305
|
ctx.addIssue({
|
|
122
306
|
code: z.ZodIssueCode.custom,
|
|
123
|
-
path: ["
|
|
124
|
-
message: "`
|
|
307
|
+
path: ["no_correspondences"],
|
|
308
|
+
message: "`no_correspondences: true` alongside confirmed correspondences is contradictory",
|
|
125
309
|
});
|
|
126
310
|
}
|
|
127
311
|
});
|
|
128
|
-
// ── Deterministic routing table (design §"The estimator charters") ─────────────
|
|
129
312
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
313
|
+
* The design's routing table (step 5), keyed on `(dimension, relation, split)`.
|
|
314
|
+
* The host never picks a route. Non-incompatible records route nowhere except a
|
|
315
|
+
* covered-channel Presence gap, which routes by the silent channel (Stated silent →
|
|
316
|
+
* doc rot for the remediator; a code channel silent → a clarification).
|
|
132
317
|
*/
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
"structural|true": {
|
|
167
|
-
kind: "wrong_goal",
|
|
168
|
-
routed_to: "human",
|
|
169
|
-
severity: "high",
|
|
170
|
-
},
|
|
171
|
-
"revealed|true": {
|
|
172
|
-
kind: "wrong_goal",
|
|
173
|
-
routed_to: "human",
|
|
174
|
-
severity: "high",
|
|
175
|
-
},
|
|
176
|
-
};
|
|
177
|
-
/** Lower of two charter confidences — a delta is only as strong as its weaker side. */
|
|
178
|
-
function weakerConfidence(a, b) {
|
|
179
|
-
const rank = { high: 2, medium: 1, low: 0 };
|
|
180
|
-
return rank[a.confidence] <= rank[b.confidence] ? a.confidence : b.confidence;
|
|
181
|
-
}
|
|
182
|
-
// ── Assembly: the file-set-overlap JOIN (Phase C.1) ────────────────────────────
|
|
183
|
-
/** Stable content-derived node order so assembly never depends on input order. */
|
|
184
|
-
function sortNodeInputs(nodes) {
|
|
185
|
-
return [...nodes].sort((a, b) => KIND_ORDER.indexOf(a.kind) - KIND_ORDER.indexOf(b.kind) ||
|
|
186
|
-
a.premise_height - b.premise_height ||
|
|
187
|
-
compareCodeUnits(a.purpose, b.purpose) ||
|
|
188
|
-
compareCodeUnits(a.files[0] ?? "", b.files[0] ?? ""));
|
|
189
|
-
}
|
|
190
|
-
/** Sorted intersection size of a node's files against a member set. */
|
|
191
|
-
function overlapSize(files, members) {
|
|
192
|
-
let n = 0;
|
|
193
|
-
for (const f of files)
|
|
194
|
-
if (members.has(f))
|
|
195
|
-
n += 1;
|
|
196
|
-
return n;
|
|
318
|
+
export function routeDifference(input) {
|
|
319
|
+
const { dimension, relation, split } = input;
|
|
320
|
+
if (relation !== "incompatible") {
|
|
321
|
+
if (dimension === "presence" && input.covered_channel_gap === true) {
|
|
322
|
+
return input.silent === "stated"
|
|
323
|
+
? { routed_to: "remediator", severity: "low" }
|
|
324
|
+
: { routed_to: "clarification", severity: "medium" };
|
|
325
|
+
}
|
|
326
|
+
return { routed_to: "none", severity: "info" };
|
|
327
|
+
}
|
|
328
|
+
if (!split || split.kind === "three_way") {
|
|
329
|
+
return { routed_to: "clarification", severity: "high" };
|
|
330
|
+
}
|
|
331
|
+
const odd = split.odd;
|
|
332
|
+
switch (dimension) {
|
|
333
|
+
case "purpose":
|
|
334
|
+
case "scope":
|
|
335
|
+
return odd === "stated"
|
|
336
|
+
? { routed_to: "remediator", severity: "low" }
|
|
337
|
+
: { routed_to: "clarification", severity: "medium" };
|
|
338
|
+
case "responsibility":
|
|
339
|
+
case "hierarchy":
|
|
340
|
+
return { routed_to: "clarification", severity: "medium" };
|
|
341
|
+
case "standing":
|
|
342
|
+
case "standard":
|
|
343
|
+
return { routed_to: "clarification", severity: "medium" };
|
|
344
|
+
case "presence":
|
|
345
|
+
return odd === "stated"
|
|
346
|
+
? { routed_to: "remediator", severity: "low" }
|
|
347
|
+
: { routed_to: "clarification", severity: "medium" };
|
|
348
|
+
default:
|
|
349
|
+
return { routed_to: "clarification", severity: "medium" };
|
|
350
|
+
}
|
|
197
351
|
}
|
|
198
352
|
/**
|
|
199
|
-
* Assemble the
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* Per unit per kind, the best-overlap node becomes the kind's charter
|
|
210
|
-
* (`charter_id = unit:kind`); every joined node persists in the unit's
|
|
211
|
-
* teleology, levels intact.
|
|
353
|
+
* Assemble the confirmed correspondences and the difference records from the
|
|
354
|
+
* comparison submission. Refusals are validation issues, never silent:
|
|
355
|
+
* - a member naming a node absent from its lane's DAG;
|
|
356
|
+
* - a `confirm`/`widen` naming an unknown candidate;
|
|
357
|
+
* - a host-added correspondence (no candidate) with fewer than two evidence refs
|
|
358
|
+
* whose PATHS lie in the repo universe, or whose refs are all on one side;
|
|
359
|
+
* - a difference naming no confirmed correspondence, an account for a lane not in
|
|
360
|
+
* that correspondence, an `incompatible` relation without a `split`, or a split
|
|
361
|
+
* with a non-incompatible relation.
|
|
362
|
+
* Ids are content-keyed (member set / correspondence + dimension + gap).
|
|
212
363
|
*/
|
|
213
|
-
export function
|
|
364
|
+
export function assembleComparison(submission, params) {
|
|
214
365
|
const validation_issues = [];
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
366
|
+
const nodeIdsByKind = new Map(params.graphs.map((g) => [g.kind, new Set(g.nodes.map((n) => n.node_id))]));
|
|
367
|
+
const candidateById = new Map(params.candidates.map((c) => [c.candidate_id, c]));
|
|
368
|
+
const correspondences = [];
|
|
369
|
+
const byInputIndex = new Map();
|
|
370
|
+
const byCandidate = new Map();
|
|
371
|
+
const seenKeys = new Set();
|
|
372
|
+
submission.correspondences.forEach((input, index) => {
|
|
373
|
+
if (input.verdict === "reject")
|
|
374
|
+
return;
|
|
375
|
+
const badMember = input.members.find((m) => m.node_ids.some((id) => !(nodeIdsByKind.get(m.kind)?.has(id) ?? false)));
|
|
376
|
+
if (badMember) {
|
|
377
|
+
validation_issues.push(`correspondence #${index}: names node(s) absent from the ${badMember.kind} DAG — dropped`);
|
|
378
|
+
return;
|
|
225
379
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const hintIds = [...params.hint.keys()].sort((a, b) => compareCodeUnits(a, b));
|
|
230
|
-
const hintMembers = new Map(hintIds.map((id) => [id, new Set(params.hint.get(id))]));
|
|
231
|
-
const hinted = new Map();
|
|
232
|
-
const residual = [];
|
|
233
|
-
for (const node of grounded) {
|
|
234
|
-
let bestId;
|
|
235
|
-
let bestOverlap = 0;
|
|
236
|
-
for (const id of hintIds) {
|
|
237
|
-
const overlap = overlapSize(node.files, hintMembers.get(id));
|
|
238
|
-
if (overlap > bestOverlap) {
|
|
239
|
-
bestOverlap = overlap;
|
|
240
|
-
bestId = id;
|
|
241
|
-
}
|
|
380
|
+
if (new Set(input.members.map((m) => m.kind)).size < 2) {
|
|
381
|
+
validation_issues.push(`correspondence #${index}: spans fewer than two lanes — dropped`);
|
|
382
|
+
return;
|
|
242
383
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
384
|
+
let basis = "host";
|
|
385
|
+
if (input.candidate_id !== undefined) {
|
|
386
|
+
if (!candidateById.has(input.candidate_id)) {
|
|
387
|
+
validation_issues.push(`correspondence #${index}: candidate "${input.candidate_id}" is not a tool candidate — dropped`);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
basis = "tool";
|
|
247
391
|
}
|
|
248
392
|
else {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
393
|
+
// A host-added correspondence needs two CHECKABLE refs (their paths lie in
|
|
394
|
+
// the repo universe) on at least two different sides — one per lane it joins.
|
|
395
|
+
// A ref is attributed to the member whose scope holds its path; a checkable
|
|
396
|
+
// ref no member scope holds counts, but only as one unattributed side.
|
|
397
|
+
const sides = new Set();
|
|
398
|
+
for (const p of input.evidence) {
|
|
399
|
+
const path = provenancePath(p.ref);
|
|
400
|
+
if (!params.universe.has(path))
|
|
401
|
+
continue;
|
|
402
|
+
sides.add(ownerOfPath(input.members, params.graphs, path) ?? `unattributed:${path}`);
|
|
403
|
+
}
|
|
404
|
+
if (sides.size < 2) {
|
|
405
|
+
validation_issues.push(`correspondence #${index}: host-added with fewer than two checkable evidence refs on different sides — dropped`);
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
258
408
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const rb = find(b);
|
|
264
|
-
if (ra !== rb)
|
|
265
|
-
parent[Math.max(ra, rb)] = Math.min(ra, rb);
|
|
266
|
-
};
|
|
267
|
-
const byFile = new Map();
|
|
268
|
-
residual.forEach((node, i) => {
|
|
269
|
-
for (const f of node.files) {
|
|
270
|
-
const seen = byFile.get(f);
|
|
271
|
-
if (seen === undefined)
|
|
272
|
-
byFile.set(f, i);
|
|
273
|
-
else
|
|
274
|
-
union(seen, i);
|
|
409
|
+
const key = memberKey(input.members);
|
|
410
|
+
if (seenKeys.has(key)) {
|
|
411
|
+
validation_issues.push(`correspondence #${index}: duplicates an earlier member set — dropped`);
|
|
412
|
+
return;
|
|
275
413
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
const nodes = hinted.get(id);
|
|
287
|
-
if (!nodes || nodes.length === 0)
|
|
288
|
-
continue; // partial coverage is designed
|
|
289
|
-
const members = new Set(params.hint.get(id));
|
|
290
|
-
for (const node of nodes)
|
|
291
|
-
for (const f of node.files)
|
|
292
|
-
members.add(f);
|
|
293
|
-
drafts.push({
|
|
294
|
-
node_id: id,
|
|
295
|
-
members: [...members].sort((a, b) => compareCodeUnits(a, b)),
|
|
296
|
-
nodes,
|
|
414
|
+
seenKeys.add(key);
|
|
415
|
+
const correspondence_id = `corr-${hashContent(key, { length: 10 })}`;
|
|
416
|
+
correspondences.push({
|
|
417
|
+
correspondence_id,
|
|
418
|
+
members: [...input.members]
|
|
419
|
+
.map((m) => ({ kind: m.kind, node_ids: [...m.node_ids].sort(compareCodeUnits) }))
|
|
420
|
+
.sort((a, b) => compareCodeUnits(a.kind, b.kind)),
|
|
421
|
+
basis,
|
|
422
|
+
...(input.candidate_id !== undefined ? { candidate_id: input.candidate_id } : {}),
|
|
423
|
+
evidence: input.evidence,
|
|
297
424
|
});
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
for (const node of draft.nodes) {
|
|
314
|
-
const list = byKind.get(node.kind) ?? [];
|
|
315
|
-
list.push(node);
|
|
316
|
-
byKind.set(node.kind, list);
|
|
425
|
+
byInputIndex.set(index, correspondence_id);
|
|
426
|
+
if (input.candidate_id !== undefined)
|
|
427
|
+
byCandidate.set(input.candidate_id, correspondence_id);
|
|
428
|
+
});
|
|
429
|
+
const corrById = new Map(correspondences.map((c) => [c.correspondence_id, c]));
|
|
430
|
+
const differences = [];
|
|
431
|
+
const seenDiff = new Set();
|
|
432
|
+
submission.differences.forEach((input, index) => {
|
|
433
|
+
const corrId = typeof input.correspondence === "number"
|
|
434
|
+
? byInputIndex.get(input.correspondence)
|
|
435
|
+
: (byCandidate.get(input.correspondence) ?? (corrById.has(input.correspondence) ? input.correspondence : undefined));
|
|
436
|
+
const corr = corrId ? corrById.get(corrId) : undefined;
|
|
437
|
+
if (!corr) {
|
|
438
|
+
validation_issues.push(`difference #${index}: names no confirmed correspondence (${String(input.correspondence)}) — dropped`);
|
|
439
|
+
return;
|
|
317
440
|
}
|
|
318
|
-
const
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
continue;
|
|
324
|
-
teleologies[kind] = nodes
|
|
325
|
-
.map((n) => ({
|
|
326
|
-
purpose: n.purpose,
|
|
327
|
-
premise_height: n.premise_height,
|
|
328
|
-
files: n.files,
|
|
329
|
-
}))
|
|
330
|
-
.sort((a, b) => a.premise_height - b.premise_height ||
|
|
331
|
-
compareCodeUnits(a.purpose, b.purpose));
|
|
332
|
-
const best = [...nodes].sort((a, b) => overlapSize(b.files, memberSet) - overlapSize(a.files, memberSet) ||
|
|
333
|
-
a.premise_height - b.premise_height ||
|
|
334
|
-
compareCodeUnits(a.purpose, b.purpose))[0];
|
|
335
|
-
selected.push({
|
|
336
|
-
charter_id: `${draft.node_id}:${kind}`,
|
|
337
|
-
kind,
|
|
338
|
-
purpose: best.purpose,
|
|
339
|
-
provenance: best.provenance,
|
|
340
|
-
confidence: best.confidence,
|
|
341
|
-
...(best.nominated_alternative !== undefined
|
|
342
|
-
? { nominated_alternative: best.nominated_alternative }
|
|
343
|
-
: {}),
|
|
344
|
-
...(best.nominated_cost !== undefined
|
|
345
|
-
? { nominated_cost: best.nominated_cost }
|
|
346
|
-
: {}),
|
|
347
|
-
});
|
|
441
|
+
const lanes = new Set(corr.members.map((m) => m.kind));
|
|
442
|
+
const stray = input.accounts.find((a) => !lanes.has(a.kind));
|
|
443
|
+
if (stray) {
|
|
444
|
+
validation_issues.push(`difference #${index}: carries an account for "${stray.kind}", a lane outside its correspondence — dropped`);
|
|
445
|
+
return;
|
|
348
446
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
for (const drop of dropped) {
|
|
353
|
-
validation_issues.push(`${drop.charter_id}: ${drop.reason}`);
|
|
447
|
+
if (input.relation === "incompatible" && !input.split) {
|
|
448
|
+
validation_issues.push(`difference #${index}: incompatible without a split — dropped`);
|
|
449
|
+
return;
|
|
354
450
|
}
|
|
355
|
-
if (
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
451
|
+
if (input.relation !== "incompatible" && input.split) {
|
|
452
|
+
validation_issues.push(`difference #${index}: a split on a ${input.relation} relation — dropped`);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
if (input.split?.kind === "two_against_one" && !lanes.has(input.split.odd)) {
|
|
456
|
+
validation_issues.push(`difference #${index}: split names "${input.split.odd}" as the odd channel, which is not in its correspondence — dropped`);
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
if (input.split?.kind === "three_way" && lanes.size < 3) {
|
|
460
|
+
validation_issues.push(`difference #${index}: three_way split on a two-lane correspondence — dropped`);
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
const accounts = [...input.accounts].sort((a, b) => compareCodeUnits(a.kind, b.kind));
|
|
464
|
+
const silent = input.dimension === "presence"
|
|
465
|
+
? [...lanes].find((k) => !accounts.some((a) => a.kind === k))
|
|
466
|
+
: undefined;
|
|
467
|
+
const route = routeDifference({
|
|
468
|
+
dimension: input.dimension,
|
|
469
|
+
relation: input.relation,
|
|
470
|
+
split: input.split,
|
|
471
|
+
covered_channel_gap: input.covered_channel_gap,
|
|
472
|
+
silent,
|
|
362
473
|
});
|
|
363
|
-
|
|
364
|
-
|
|
474
|
+
const difference_id = `diff-${hashContent(`${corr.correspondence_id}|${input.dimension}|${input.gap}`, { length: 10 })}`;
|
|
475
|
+
if (seenDiff.has(difference_id)) {
|
|
476
|
+
validation_issues.push(`difference #${index}: duplicates an earlier record — dropped`);
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
seenDiff.add(difference_id);
|
|
480
|
+
differences.push({
|
|
481
|
+
difference_id,
|
|
482
|
+
correspondence_id: corr.correspondence_id,
|
|
483
|
+
dimension: input.dimension,
|
|
484
|
+
relation: input.relation,
|
|
485
|
+
...(input.split ? { split: input.split } : {}),
|
|
486
|
+
accounts,
|
|
487
|
+
gap: input.gap,
|
|
488
|
+
...(input.covered_channel_gap !== undefined ? { covered_channel_gap: input.covered_channel_gap } : {}),
|
|
489
|
+
routed_to: route.routed_to,
|
|
490
|
+
finding_candidate: input.relation === "incompatible" ||
|
|
491
|
+
(input.dimension === "presence" && input.covered_channel_gap === true),
|
|
492
|
+
});
|
|
493
|
+
});
|
|
494
|
+
correspondences.sort((a, b) => compareCodeUnits(a.correspondence_id, b.correspondence_id));
|
|
495
|
+
differences.sort((a, b) => compareCodeUnits(a.difference_id, b.difference_id));
|
|
496
|
+
return { correspondences, differences, validation_issues };
|
|
365
497
|
}
|
|
366
|
-
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
// Every goal-graph node id the miner reported — a delta's subsystem is
|
|
376
|
-
// "linked" exactly when its node_id appears here (mirrors the existing
|
|
377
|
-
// out-of-scope consumer's own derivation, now computed once here instead).
|
|
378
|
-
const goalNodeIds = new Set((submission.goal_graph?.nodes ?? []).map((n) => n.node_id));
|
|
379
|
-
// True nominations first (deepest only): survivors join the unit's charters
|
|
380
|
-
// and are pair-eligible for this same submission's deltas.
|
|
381
|
-
const nominations = [...submission.true_nominations].sort((a, b) => compareCodeUnits(a.node_id, b.node_id) || compareCodeUnits(a.purpose, b.purpose));
|
|
382
|
-
if (nominations.length > 0 && !params.allowTrueNominations) {
|
|
383
|
-
validation_issues.push(`submission carries ${nominations.length} true nomination(s) but the ceiling does not authorize the deepest rung — all dropped (true provocations require explicit deepest opt-in)`);
|
|
384
|
-
}
|
|
385
|
-
else {
|
|
386
|
-
for (const nomination of nominations) {
|
|
387
|
-
const subsystem = byNode.get(nomination.node_id);
|
|
388
|
-
if (!subsystem) {
|
|
389
|
-
validation_issues.push(`true nomination for "${nomination.node_id}" names no joined subsystem — dropped`);
|
|
390
|
-
continue;
|
|
391
|
-
}
|
|
392
|
-
if (subsystem.charters.some((c) => c.kind === "true")) {
|
|
393
|
-
validation_issues.push(`subsystem "${nomination.node_id}" has more than one true nomination — kept the first, dropped the rest`);
|
|
394
|
-
continue;
|
|
395
|
-
}
|
|
396
|
-
const candidate = {
|
|
397
|
-
charter_id: `${nomination.node_id}:true`,
|
|
398
|
-
kind: "true",
|
|
399
|
-
purpose: nomination.purpose,
|
|
400
|
-
provenance: nomination.provenance,
|
|
401
|
-
confidence: nomination.confidence,
|
|
402
|
-
nominated_alternative: nomination.nominated_alternative,
|
|
403
|
-
nominated_cost: nomination.nominated_cost,
|
|
404
|
-
};
|
|
405
|
-
const { kept, dropped } = applyTrueCharterGate([candidate]);
|
|
406
|
-
for (const drop of dropped) {
|
|
407
|
-
validation_issues.push(`${drop.charter_id}: ${drop.reason}`);
|
|
408
|
-
}
|
|
409
|
-
if (kept.length > 0) {
|
|
410
|
-
subsystem.charters.push(kept[0]);
|
|
411
|
-
subsystem.charters.sort((a, b) => compareCodeUnits(a.charter_id, b.charter_id));
|
|
412
|
-
}
|
|
498
|
+
function ownerOfPath(members, graphs, path) {
|
|
499
|
+
for (const m of members) {
|
|
500
|
+
const graph = graphs.find((g) => g.kind === m.kind);
|
|
501
|
+
if (!graph)
|
|
502
|
+
continue;
|
|
503
|
+
for (const id of m.node_ids) {
|
|
504
|
+
const node = graph.nodes.find((n) => n.node_id === id);
|
|
505
|
+
if (node?.files?.includes(path))
|
|
506
|
+
return m.kind;
|
|
413
507
|
}
|
|
414
508
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
509
|
+
return undefined;
|
|
510
|
+
}
|
|
511
|
+
// ── Step 4: fidelity ───────────────────────────────────────────────────────────
|
|
512
|
+
/** The fidelity lane's submission: one verdict per difference in its packet. */
|
|
513
|
+
export const CharterFidelitySubmissionSchema = z
|
|
514
|
+
.object({
|
|
515
|
+
verdicts: z
|
|
516
|
+
.array(z
|
|
517
|
+
.object({
|
|
518
|
+
difference_id: z.string().min(1),
|
|
519
|
+
verdict: z.enum(["supported", "interpretation", "unverifiable"]),
|
|
520
|
+
over_read_side: CharterLaneKindSchema.optional(),
|
|
521
|
+
rationale: z.string().min(1),
|
|
522
|
+
})
|
|
523
|
+
.strict()
|
|
524
|
+
.superRefine((v, ctx) => {
|
|
525
|
+
if (v.verdict === "interpretation" && !v.over_read_side) {
|
|
526
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["over_read_side"], message: "an interpretation verdict names the side that over-read" });
|
|
422
527
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
// Pass 1: validate + route every draft delta (identical checks/drop
|
|
426
|
-
// reasons/order to before), grouping the SURVIVORS by canonical pair —
|
|
427
|
-
// the grouping key delta_id minting (pass 2) discriminates on.
|
|
428
|
-
const survivorsByPairKey = new Map();
|
|
429
|
-
for (const draft of sub.deltas) {
|
|
430
|
-
const [ka, kb] = canonicalPair(draft.pair);
|
|
431
|
-
if (ka === kb) {
|
|
432
|
-
validation_issues.push(`subsystem "${sub.node_id}" delta pairs "${ka}" with itself — dropped`);
|
|
433
|
-
continue;
|
|
434
|
-
}
|
|
435
|
-
const route = DELTA_ROUTES[`${ka}|${kb}`];
|
|
436
|
-
if (!route) {
|
|
437
|
-
validation_issues.push(`subsystem "${sub.node_id}" delta [${ka}, ${kb}] has no routing in the design's table — dropped`);
|
|
438
|
-
continue;
|
|
439
|
-
}
|
|
440
|
-
const charterA = keptByKind.get(ka);
|
|
441
|
-
const charterB = keptByKind.get(kb);
|
|
442
|
-
if (!charterA || !charterB) {
|
|
443
|
-
const missing = [!charterA ? ka : null, !charterB ? kb : null]
|
|
444
|
-
.filter((m) => m !== null)
|
|
445
|
-
.join(" + ");
|
|
446
|
-
validation_issues.push(`subsystem "${sub.node_id}" delta [${ka}, ${kb}] references a missing/dropped charter (${missing}) — dropped`);
|
|
447
|
-
continue;
|
|
448
|
-
}
|
|
449
|
-
const pairKey = `${ka}|${kb}`;
|
|
450
|
-
const list = survivorsByPairKey.get(pairKey) ?? [];
|
|
451
|
-
list.push({ pair: [ka, kb], route, charterA, charterB, summary: draft.summary });
|
|
452
|
-
survivorsByPairKey.set(pairKey, list);
|
|
528
|
+
if (v.verdict !== "interpretation" && v.over_read_side) {
|
|
529
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["over_read_side"], message: "over_read_side only with an interpretation verdict" });
|
|
453
530
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
// (`{ ...delta, routed_to: "human" }`), so node_id/goal_node_id
|
|
482
|
-
// survive the call; the cast reflects that read, not an assumption.
|
|
483
|
-
const gated = gateCharterDelta(baseDelta, kept);
|
|
484
|
-
deltas.push(gated);
|
|
485
|
-
findings.push(deltaToFinding(gated, sub.node_id, subsystem.members, surv.route.severity, weakerConfidence(surv.charterA, surv.charterB)));
|
|
486
|
-
}
|
|
531
|
+
}))
|
|
532
|
+
.default([]),
|
|
533
|
+
})
|
|
534
|
+
.strict();
|
|
535
|
+
/**
|
|
536
|
+
* The MECHANICAL pre-check (step 4, first half): given, per provenance ref, whether
|
|
537
|
+
* its quote was found at its ref on disk (`quoteFound(ref, quote)` — the ingest reads
|
|
538
|
+
* the files; this module never does), stamp `unverifiable` (decided_by `tool`) on
|
|
539
|
+
* every finding candidate that has a side whose cited quote is absent. Records with
|
|
540
|
+
* every quote present are left for the lane. Returns the differences with the tool
|
|
541
|
+
* verdicts stamped, plus the ids still owed a lane verdict.
|
|
542
|
+
*/
|
|
543
|
+
export function precheckFidelity(differences, quoteFound) {
|
|
544
|
+
const pendingLane = [];
|
|
545
|
+
const stamped = differences.map((d) => {
|
|
546
|
+
if (!d.finding_candidate)
|
|
547
|
+
return d;
|
|
548
|
+
const missing = d.accounts.flatMap((a) => a.provenance
|
|
549
|
+
.filter((p) => p.quote !== undefined && quoteFound(p) === false)
|
|
550
|
+
.map((p) => `${a.kind}: ${p.ref}`));
|
|
551
|
+
if (missing.length > 0) {
|
|
552
|
+
const verdict = {
|
|
553
|
+
verdict: "unverifiable",
|
|
554
|
+
rationale: `cited quote not found at ${missing.sort(compareCodeUnits).join("; ")}`,
|
|
555
|
+
decided_by: "tool",
|
|
556
|
+
};
|
|
557
|
+
return { ...d, fidelity: verdict };
|
|
487
558
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
559
|
+
pendingLane.push(d.difference_id);
|
|
560
|
+
return d;
|
|
561
|
+
});
|
|
562
|
+
return { differences: stamped, pendingLane: pendingLane.sort(compareCodeUnits) };
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Stamp the lane's verdicts (step 4, second half). A verdict naming an unknown
|
|
566
|
+
* difference, or a difference the tool already settled, is a validation issue; a
|
|
567
|
+
* finding candidate left without any verdict stays pending (never assumed
|
|
568
|
+
* `supported`).
|
|
569
|
+
*/
|
|
570
|
+
export function applyFidelity(differences, submission) {
|
|
571
|
+
const validation_issues = [];
|
|
572
|
+
const byId = new Map(differences.map((d) => [d.difference_id, d]));
|
|
573
|
+
const verdicts = new Map();
|
|
574
|
+
for (const v of submission.verdicts) {
|
|
575
|
+
const d = byId.get(v.difference_id);
|
|
576
|
+
if (!d) {
|
|
577
|
+
validation_issues.push(`fidelity verdict for unknown difference "${v.difference_id}" — dropped`);
|
|
495
578
|
continue;
|
|
496
579
|
}
|
|
497
|
-
if (
|
|
498
|
-
validation_issues.push(`
|
|
580
|
+
if (d.fidelity?.decided_by === "tool") {
|
|
581
|
+
validation_issues.push(`fidelity verdict for "${v.difference_id}" ignored — the tool pre-check already settled it as unverifiable`);
|
|
499
582
|
continue;
|
|
500
583
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
// Disagreement density: tool-computed, per unit per channel pair — the
|
|
505
|
-
// quantitative surface for "which parts of the triangulation need
|
|
506
|
-
// clarification."
|
|
507
|
-
const densityByKey = new Map();
|
|
508
|
-
for (const delta of deltas) {
|
|
509
|
-
// Read the explicit field (INV-CDI-EXPLICIT-NODE-FIELDS) — never parse
|
|
510
|
-
// delta_id, which is opaque and, since the fix above, may carry a
|
|
511
|
-
// discriminator suffix a naive last-colon split would misread.
|
|
512
|
-
const key = `${delta.node_id}|${delta.pair[0]}|${delta.pair[1]}`;
|
|
513
|
-
const existing = densityByKey.get(key);
|
|
514
|
-
if (existing) {
|
|
515
|
-
densityByKey.set(key, { ...existing, count: existing.count + 1 });
|
|
516
|
-
}
|
|
517
|
-
else {
|
|
518
|
-
densityByKey.set(key, { node_id: delta.node_id, pair: delta.pair, count: 1 });
|
|
584
|
+
if (verdicts.has(v.difference_id)) {
|
|
585
|
+
validation_issues.push(`duplicate fidelity verdict for "${v.difference_id}" — kept the first`);
|
|
586
|
+
continue;
|
|
519
587
|
}
|
|
588
|
+
verdicts.set(v.difference_id, {
|
|
589
|
+
verdict: v.verdict,
|
|
590
|
+
...(v.over_read_side ? { over_read_side: v.over_read_side } : {}),
|
|
591
|
+
rationale: v.rationale,
|
|
592
|
+
decided_by: "lane",
|
|
593
|
+
});
|
|
520
594
|
}
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
triangulated,
|
|
531
|
-
disagreement,
|
|
532
|
-
goal_graph: submission.goal_graph ?? { nodes: [], edges: [] },
|
|
533
|
-
validation_issues,
|
|
534
|
-
};
|
|
595
|
+
const stamped = differences.map((d) => {
|
|
596
|
+
const v = verdicts.get(d.difference_id);
|
|
597
|
+
return v ? { ...d, fidelity: v } : d;
|
|
598
|
+
});
|
|
599
|
+
const still_pending = stamped
|
|
600
|
+
.filter((d) => d.finding_candidate && !d.fidelity)
|
|
601
|
+
.map((d) => d.difference_id)
|
|
602
|
+
.sort(compareCodeUnits);
|
|
603
|
+
return { differences: stamped, validation_issues, still_pending };
|
|
535
604
|
}
|
|
605
|
+
// ── Step 5: findings (leads) ───────────────────────────────────────────────────
|
|
536
606
|
/**
|
|
537
|
-
* Surface
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
* affected files (the charter layer operates over file ids).
|
|
607
|
+
* Surface every `supported` finding candidate as a Finding LEAD (leads-not-verdicts).
|
|
608
|
+
* `affected_files` = the union of the corresponding nodes' scopes (the report's
|
|
609
|
+
* grouping evidence); `confidence` = the weakest account's source confidence.
|
|
541
610
|
*/
|
|
542
|
-
function
|
|
543
|
-
const
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
611
|
+
export function differenceFindings(differences, correspondences, graphs) {
|
|
612
|
+
const corrById = new Map(correspondences.map((c) => [c.correspondence_id, c]));
|
|
613
|
+
const findings = [];
|
|
614
|
+
for (const d of differences) {
|
|
615
|
+
if (!d.finding_candidate || d.fidelity?.verdict !== "supported")
|
|
616
|
+
continue;
|
|
617
|
+
const corr = corrById.get(d.correspondence_id);
|
|
618
|
+
const files = new Set();
|
|
619
|
+
let weakest = "high";
|
|
620
|
+
for (const m of corr?.members ?? []) {
|
|
621
|
+
const graph = graphs.find((g) => g.kind === m.kind);
|
|
622
|
+
for (const id of m.node_ids) {
|
|
623
|
+
const node = graph?.nodes.find((n) => n.node_id === id);
|
|
624
|
+
for (const f of node?.files ?? [])
|
|
625
|
+
files.add(f);
|
|
626
|
+
if (node && rank(node.confidence) < rank(weakest))
|
|
627
|
+
weakest = node.confidence;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
const route = routeDifference({
|
|
631
|
+
dimension: d.dimension,
|
|
632
|
+
relation: d.relation,
|
|
633
|
+
split: d.split,
|
|
634
|
+
covered_channel_gap: d.covered_channel_gap,
|
|
635
|
+
});
|
|
636
|
+
findings.push({
|
|
637
|
+
id: d.difference_id,
|
|
638
|
+
title: `Charter ${d.dimension} difference (${describeSplit(d)})`,
|
|
639
|
+
category: `charter_difference:${d.dimension}`,
|
|
640
|
+
severity: route.severity,
|
|
641
|
+
confidence: weakest,
|
|
642
|
+
lens: "architecture",
|
|
643
|
+
summary: `${d.gap} ${d.accounts.map((a) => `[${a.kind}] ${a.claim}`).join(" ")}`,
|
|
644
|
+
affected_files: [...files].sort(compareCodeUnits).map((path) => ({ path })),
|
|
645
|
+
systemic: true,
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
return findings.sort((a, b) => compareCodeUnits(a.id, b.id));
|
|
649
|
+
}
|
|
650
|
+
function rank(c) {
|
|
651
|
+
return c === "high" ? 2 : c === "medium" ? 1 : 0;
|
|
652
|
+
}
|
|
653
|
+
function describeSplit(d) {
|
|
654
|
+
if (!d.split)
|
|
655
|
+
return d.relation;
|
|
656
|
+
return d.split.kind === "three_way" ? "three-way" : `${d.split.odd} against the rest`;
|
|
555
657
|
}
|
|
556
658
|
//# sourceMappingURL=charterExtraction.js.map
|