audit-tools 0.52.5 → 0.54.0
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/cli/auditStep.d.ts +1 -1
- package/dist/audit/cli/conceptualDispatch.d.ts +2 -2
- package/dist/audit/cli/conceptualDispatch.d.ts.map +1 -1
- package/dist/audit/cli/conceptualDispatch.js +6 -5
- 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 +3 -16
- package/dist/audit/cli/confirmIntentStep.js.map +1 -1
- package/dist/audit/cli/dispatch/hostHandoff.d.ts +2 -0
- package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
- package/dist/audit/cli/dispatch/hostHandoff.js +22 -1
- package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
- package/dist/audit/cli/dispatch/packetFilter.d.ts +1 -1
- package/dist/audit/cli/dispatch/packetFilter.d.ts.map +1 -1
- package/dist/audit/cli/dispatch/packetFilter.js +1 -1
- package/dist/audit/cli/dispatch/packetFilter.js.map +1 -1
- package/dist/audit/cli/functionalPreflight.d.ts.map +1 -1
- package/dist/audit/cli/functionalPreflight.js +6 -3
- package/dist/audit/cli/functionalPreflight.js.map +1 -1
- package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
- package/dist/audit/cli/nextStepCommand.js +57 -34
- package/dist/audit/cli/nextStepCommand.js.map +1 -1
- package/dist/audit/cli/nextStepHelpers.d.ts +3 -3
- package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
- package/dist/audit/cli/nextStepHelpers.js +52 -77
- package/dist/audit/cli/nextStepHelpers.js.map +1 -1
- package/dist/audit/cli/prompts.d.ts +1 -2
- package/dist/audit/cli/prompts.d.ts.map +1 -1
- package/dist/audit/cli/prompts.js +2 -12
- package/dist/audit/cli/prompts.js.map +1 -1
- package/dist/audit/cli/sampleRunCommand.d.ts +2 -2
- package/dist/audit/cli/semanticReviewStep.d.ts +11 -2
- package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
- package/dist/audit/cli/semanticReviewStep.js +14 -10
- package/dist/audit/cli/semanticReviewStep.js.map +1 -1
- package/dist/audit/contracts/workerSchemas.d.ts +14 -14
- package/dist/audit/contracts/wrapperResponse.d.ts +6 -6
- package/dist/audit/extractors/graphRoutes.d.ts.map +1 -1
- package/dist/audit/extractors/graphRoutes.js +1 -3
- package/dist/audit/extractors/graphRoutes.js.map +1 -1
- package/dist/audit/io/artifacts.d.ts.map +1 -1
- package/dist/audit/io/artifacts.js +2 -3
- package/dist/audit/io/artifacts.js.map +1 -1
- package/dist/audit/orchestrator/advance.d.ts.map +1 -1
- package/dist/audit/orchestrator/advance.js +21 -1
- package/dist/audit/orchestrator/advance.js.map +1 -1
- package/dist/audit/orchestrator/architectureDiscovery.d.ts +25 -0
- package/dist/audit/orchestrator/architectureDiscovery.d.ts.map +1 -0
- package/dist/audit/orchestrator/architectureDiscovery.js +193 -0
- package/dist/audit/orchestrator/architectureDiscovery.js.map +1 -0
- package/dist/audit/orchestrator/dependencyMap.d.ts +20 -0
- package/dist/audit/orchestrator/dependencyMap.d.ts.map +1 -1
- package/dist/audit/orchestrator/dependencyMap.js +47 -0
- 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 +37 -3
- package/dist/audit/orchestrator/dependencySlices.js.map +1 -1
- package/dist/audit/orchestrator/designReviewProjection.d.ts +2 -6
- package/dist/audit/orchestrator/designReviewProjection.d.ts.map +1 -1
- package/dist/audit/orchestrator/designReviewProjection.js +2 -6
- package/dist/audit/orchestrator/designReviewProjection.js.map +1 -1
- package/dist/audit/orchestrator/designReviewPrompt.d.ts +2 -2
- package/dist/audit/orchestrator/designReviewPrompt.js +2 -2
- package/dist/audit/orchestrator/designReviewSnapshot.d.ts +2 -3
- package/dist/audit/orchestrator/designReviewSnapshot.d.ts.map +1 -1
- package/dist/audit/orchestrator/designReviewSnapshot.js +2 -3
- package/dist/audit/orchestrator/designReviewSnapshot.js.map +1 -1
- package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
- package/dist/audit/orchestrator/executorRunners.js +1 -22
- 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 +0 -12
- package/dist/audit/orchestrator/executors.js.map +1 -1
- package/dist/audit/orchestrator/ingestionExecutors.d.ts.map +1 -1
- package/dist/audit/orchestrator/ingestionExecutors.js +38 -37
- package/dist/audit/orchestrator/ingestionExecutors.js.map +1 -1
- package/dist/audit/orchestrator/nextStep.d.ts +2 -28
- package/dist/audit/orchestrator/nextStep.d.ts.map +1 -1
- package/dist/audit/orchestrator/nextStep.js +4 -37
- package/dist/audit/orchestrator/nextStep.js.map +1 -1
- package/dist/audit/orchestrator/obligationDerive.d.ts +2 -3
- package/dist/audit/orchestrator/obligationDerive.d.ts.map +1 -1
- package/dist/audit/orchestrator/obligationDerive.js +2 -3
- package/dist/audit/orchestrator/obligationDerive.js.map +1 -1
- package/dist/audit/orchestrator/pendingTasks.d.ts +2 -0
- package/dist/audit/orchestrator/pendingTasks.d.ts.map +1 -1
- package/dist/audit/orchestrator/pendingTasks.js +5 -1
- package/dist/audit/orchestrator/pendingTasks.js.map +1 -1
- package/dist/audit/orchestrator/planningExecutors.d.ts.map +1 -1
- package/dist/audit/orchestrator/planningExecutors.js +9 -0
- package/dist/audit/orchestrator/planningExecutors.js.map +1 -1
- package/dist/audit/orchestrator/requeueCommand.d.ts +1 -1
- package/dist/audit/orchestrator/resultBaseline.d.ts +5 -5
- package/dist/audit/orchestrator/resultBaseline.d.ts.map +1 -1
- package/dist/audit/orchestrator/resultBaseline.js +24 -47
- package/dist/audit/orchestrator/resultBaseline.js.map +1 -1
- package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.d.ts.map +1 -1
- package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.js +2 -0
- package/dist/audit/orchestrator/selectiveDeepening/findingFollowup.js.map +1 -1
- package/dist/audit/orchestrator/staleness.d.ts.map +1 -1
- package/dist/audit/orchestrator/staleness.js +14 -10
- package/dist/audit/orchestrator/staleness.js.map +1 -1
- package/dist/audit/orchestrator/state.js +1 -1
- package/dist/audit/orchestrator/state.js.map +1 -1
- package/dist/audit/orchestrator/synthesisExecutors.d.ts.map +1 -1
- package/dist/audit/orchestrator/synthesisExecutors.js +3 -0
- package/dist/audit/orchestrator/synthesisExecutors.js.map +1 -1
- package/dist/audit/types/auditState.d.ts +6 -6
- package/dist/audit/types/flowCoverage.d.ts +6 -6
- package/dist/audit/types.d.ts +24 -13
- package/dist/audit/types.d.ts.map +1 -1
- package/dist/audit/types.js +92 -11
- package/dist/audit/types.js.map +1 -1
- package/dist/remediate/contractPipeline/executionPlan.d.ts +1908 -0
- package/dist/remediate/contractPipeline/executionPlan.d.ts.map +1 -0
- package/dist/remediate/contractPipeline/executionPlan.js +467 -0
- package/dist/remediate/contractPipeline/executionPlan.js.map +1 -0
- package/dist/remediate/contractPipeline/runtimePlanAuthority.d.ts +12 -0
- package/dist/remediate/contractPipeline/runtimePlanAuthority.d.ts.map +1 -0
- package/dist/remediate/contractPipeline/runtimePlanAuthority.js +41 -0
- package/dist/remediate/contractPipeline/runtimePlanAuthority.js.map +1 -0
- package/dist/remediate/dedup/crossLensDedup.d.ts +3 -16
- package/dist/remediate/dedup/crossLensDedup.d.ts.map +1 -1
- package/dist/remediate/dedup/crossLensDedup.js +2 -32
- package/dist/remediate/dedup/crossLensDedup.js.map +1 -1
- package/dist/remediate/index.d.ts +2 -19
- package/dist/remediate/index.d.ts.map +1 -1
- package/dist/remediate/index.js +22 -138
- package/dist/remediate/index.js.map +1 -1
- package/dist/remediate/intake.d.ts +10 -10
- package/dist/remediate/intent/intentOrdering.d.ts +6 -8
- package/dist/remediate/intent/intentOrdering.d.ts.map +1 -1
- package/dist/remediate/intent/intentOrdering.js +24 -47
- package/dist/remediate/intent/intentOrdering.js.map +1 -1
- package/dist/remediate/phases/close.d.ts +25 -17
- package/dist/remediate/phases/close.d.ts.map +1 -1
- package/dist/remediate/phases/close.js +278 -218
- package/dist/remediate/phases/close.js.map +1 -1
- package/dist/remediate/phases/closeAcceptance.d.ts +42 -0
- package/dist/remediate/phases/closeAcceptance.d.ts.map +1 -0
- package/dist/remediate/phases/closeAcceptance.js +66 -0
- package/dist/remediate/phases/closeAcceptance.js.map +1 -0
- package/dist/remediate/phases/closeReviewProvenance.d.ts +1 -1
- package/dist/remediate/phases/closeReviewProvenance.d.ts.map +1 -1
- package/dist/remediate/phases/closeReviewProvenance.js +9 -8
- package/dist/remediate/phases/closeReviewProvenance.js.map +1 -1
- package/dist/remediate/phases/closeVerifyAnalyzerLeads.d.ts.map +1 -1
- package/dist/remediate/phases/closeVerifyAnalyzerLeads.js +11 -9
- package/dist/remediate/phases/closeVerifyAnalyzerLeads.js.map +1 -1
- package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts +21 -86
- package/dist/remediate/phases/closeVerifyHeadEvidence.d.ts.map +1 -1
- package/dist/remediate/phases/closeVerifyHeadEvidence.js +30 -19
- package/dist/remediate/phases/closeVerifyHeadEvidence.js.map +1 -1
- package/dist/remediate/phases/plan.d.ts +3 -60
- package/dist/remediate/phases/plan.d.ts.map +1 -1
- package/dist/remediate/phases/plan.js +3 -227
- package/dist/remediate/phases/plan.js.map +1 -1
- package/dist/remediate/phases/triage.d.ts.map +1 -1
- package/dist/remediate/phases/triage.js +19 -30
- package/dist/remediate/phases/triage.js.map +1 -1
- package/dist/remediate/riskSignal.d.ts +9 -43
- package/dist/remediate/riskSignal.d.ts.map +1 -1
- package/dist/remediate/riskSignal.js +7 -28
- package/dist/remediate/riskSignal.js.map +1 -1
- package/dist/remediate/state/disposition.d.ts +2 -1
- package/dist/remediate/state/disposition.d.ts.map +1 -1
- package/dist/remediate/state/disposition.js +37 -1
- package/dist/remediate/state/disposition.js.map +1 -1
- package/dist/remediate/state/runIdentity.d.ts +2 -13
- package/dist/remediate/state/runIdentity.d.ts.map +1 -1
- package/dist/remediate/state/runIdentity.js +3 -13
- package/dist/remediate/state/runIdentity.js.map +1 -1
- package/dist/remediate/state/store.d.ts +12 -36
- package/dist/remediate/state/store.d.ts.map +1 -1
- package/dist/remediate/state/store.js +58 -150
- package/dist/remediate/state/store.js.map +1 -1
- package/dist/remediate/state/types.d.ts +406 -504
- package/dist/remediate/state/types.d.ts.map +1 -1
- package/dist/remediate/state/types.js +24 -104
- package/dist/remediate/state/types.js.map +1 -1
- package/dist/remediate/steps/contractPipeline.d.ts +7 -661
- package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
- package/dist/remediate/steps/contractPipeline.js +264 -3851
- package/dist/remediate/steps/contractPipeline.js.map +1 -1
- package/dist/remediate/steps/contractPipelinePrompts.d.ts +20 -142
- package/dist/remediate/steps/contractPipelinePrompts.d.ts.map +1 -1
- package/dist/remediate/steps/contractPipelinePrompts.js +48 -581
- package/dist/remediate/steps/contractPipelinePrompts.js.map +1 -1
- package/dist/remediate/steps/dispatch/contractConformanceReview.d.ts +4 -1
- package/dist/remediate/steps/dispatch/contractConformanceReview.d.ts.map +1 -1
- package/dist/remediate/steps/dispatch/contractConformanceReview.js +6 -3
- package/dist/remediate/steps/dispatch/contractConformanceReview.js.map +1 -1
- package/dist/remediate/steps/dispatch/hostContracts.d.ts +1 -1
- package/dist/remediate/steps/dispatch/hostContracts.d.ts.map +1 -1
- package/dist/remediate/steps/dispatch/hostHandoff.d.ts +4 -21
- package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
- package/dist/remediate/steps/dispatch/hostHandoff.js +161 -383
- package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
- package/dist/remediate/steps/finalGate.d.ts +34 -0
- package/dist/remediate/steps/finalGate.d.ts.map +1 -1
- package/dist/remediate/steps/finalGate.js +44 -4
- package/dist/remediate/steps/finalGate.js.map +1 -1
- package/dist/remediate/steps/frictionCloseout.d.ts +1 -30
- package/dist/remediate/steps/frictionCloseout.d.ts.map +1 -1
- package/dist/remediate/steps/frictionCloseout.js +6 -99
- package/dist/remediate/steps/frictionCloseout.js.map +1 -1
- package/dist/remediate/steps/nextStep.d.ts +2 -15
- package/dist/remediate/steps/nextStep.d.ts.map +1 -1
- package/dist/remediate/steps/nextStep.js +254 -1042
- package/dist/remediate/steps/nextStep.js.map +1 -1
- package/dist/remediate/steps/prompts.js +16 -16
- package/dist/remediate/steps/prompts.js.map +1 -1
- package/dist/remediate/steps/stepUtils.d.ts +1 -1
- package/dist/remediate/steps/stepUtils.d.ts.map +1 -1
- package/dist/remediate/steps/types.d.ts +1 -1
- package/dist/remediate/steps/types.d.ts.map +1 -1
- package/dist/remediate/steps/types.js +1 -1
- package/dist/remediate/steps/types.js.map +1 -1
- package/dist/remediate/types/options.d.ts +9 -0
- package/dist/remediate/types/options.d.ts.map +1 -1
- package/dist/remediate/validation/artifacts.d.ts.map +1 -1
- package/dist/remediate/validation/artifacts.js +10 -56
- package/dist/remediate/validation/artifacts.js.map +1 -1
- package/dist/remediate/validation/remediationState.d.ts +2 -2
- package/dist/remediate/validation/remediationState.d.ts.map +1 -1
- package/dist/remediate/validation/remediationState.js +17 -77
- package/dist/remediate/validation/remediationState.js.map +1 -1
- package/dist/remediate/validation/verificationReport.d.ts +3 -0
- package/dist/remediate/validation/verificationReport.d.ts.map +1 -0
- package/dist/remediate/validation/verificationReport.js +28 -0
- package/dist/remediate/validation/verificationReport.js.map +1 -0
- package/dist/shared/analyzers/types.d.ts +10 -10
- package/dist/shared/engine/obligationEngine.d.ts +2 -2
- package/dist/shared/friction/triage.d.ts +7 -28
- package/dist/shared/friction/triage.d.ts.map +1 -1
- package/dist/shared/friction/triage.js +7 -28
- package/dist/shared/friction/triage.js.map +1 -1
- package/dist/shared/graph/orderedReachability.js +1 -1
- package/dist/shared/graph/orderedReachability.js.map +1 -1
- package/dist/shared/index.d.ts +5 -6
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +3 -4
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/loopCorePaths.d.ts.map +1 -1
- package/dist/shared/loopCorePaths.js +37 -5
- package/dist/shared/loopCorePaths.js.map +1 -1
- package/dist/shared/prompts.d.ts +24 -10
- package/dist/shared/prompts.d.ts.map +1 -1
- package/dist/shared/prompts.js +27 -13
- package/dist/shared/prompts.js.map +1 -1
- package/dist/shared/reReview/projectionDiff.d.ts.map +1 -1
- package/dist/shared/reReview/projectionDiff.js +6 -14
- package/dist/shared/reReview/projectionDiff.js.map +1 -1
- package/dist/shared/types/executionPlan.d.ts +416 -0
- package/dist/shared/types/executionPlan.d.ts.map +1 -0
- package/dist/shared/types/executionPlan.js +132 -0
- package/dist/shared/types/executionPlan.js.map +1 -0
- package/dist/shared/types/remediationOutcome.d.ts +1378 -12
- package/dist/shared/types/remediationOutcome.d.ts.map +1 -1
- package/dist/shared/types/remediationOutcome.js +29 -1
- package/dist/shared/types/remediationOutcome.js.map +1 -1
- package/dist/shared/types/{contractPipeline/verification.d.ts → verificationReport.d.ts} +9 -37
- package/dist/shared/types/verificationReport.d.ts.map +1 -0
- package/dist/shared/types/verificationReport.js +4 -0
- package/dist/shared/types/verificationReport.js.map +1 -0
- package/dist/shared/validation/findingGrounding.d.ts +3 -5
- package/dist/shared/validation/findingGrounding.d.ts.map +1 -1
- package/dist/shared/validation/findingGrounding.js +4 -7
- package/dist/shared/validation/findingGrounding.js.map +1 -1
- package/package.json +2 -1
- package/scripts/shared/primitives.mjs +20 -0
- package/skills/audit-code/SKILL.md +5 -12
- package/skills/audit-code/audit-code.prompt.md +5 -8
- package/skills/audit-code/opencode-command-template.txt +2 -2
- package/skills/remediate-code/SKILL.md +5 -7
- package/skills/remediate-code/remediate-code.prompt.md +5 -5
- package/dispatch/lens-definitions.json +0 -46
- package/dist/remediate/contractPipeline/artifactNames.d.ts +0 -8
- package/dist/remediate/contractPipeline/artifactNames.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/artifactNames.js +0 -28
- package/dist/remediate/contractPipeline/artifactNames.js.map +0 -1
- package/dist/remediate/contractPipeline/artifactStore.d.ts +0 -219
- package/dist/remediate/contractPipeline/artifactStore.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/artifactStore.js +0 -436
- package/dist/remediate/contractPipeline/artifactStore.js.map +0 -1
- package/dist/remediate/contractPipeline/changeClassification.d.ts +0 -130
- package/dist/remediate/contractPipeline/changeClassification.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/changeClassification.js +0 -446
- package/dist/remediate/contractPipeline/changeClassification.js.map +0 -1
- package/dist/remediate/contractPipeline/contractReviewBinding.d.ts +0 -28
- package/dist/remediate/contractPipeline/contractReviewBinding.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/contractReviewBinding.js +0 -75
- package/dist/remediate/contractPipeline/contractReviewBinding.js.map +0 -1
- package/dist/remediate/contractPipeline/counterexampleFingerprint.d.ts +0 -27
- package/dist/remediate/contractPipeline/counterexampleFingerprint.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/counterexampleFingerprint.js +0 -37
- package/dist/remediate/contractPipeline/counterexampleFingerprint.js.map +0 -1
- package/dist/remediate/contractPipeline/cyclicSeamResolution.d.ts +0 -131
- package/dist/remediate/contractPipeline/cyclicSeamResolution.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/cyclicSeamResolution.js +0 -257
- package/dist/remediate/contractPipeline/cyclicSeamResolution.js.map +0 -1
- package/dist/remediate/contractPipeline/derive.d.ts +0 -173
- package/dist/remediate/contractPipeline/derive.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/derive.js +0 -477
- package/dist/remediate/contractPipeline/derive.js.map +0 -1
- package/dist/remediate/contractPipeline/finalizedContractFields.d.ts +0 -50
- package/dist/remediate/contractPipeline/finalizedContractFields.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/finalizedContractFields.js +0 -77
- package/dist/remediate/contractPipeline/finalizedContractFields.js.map +0 -1
- package/dist/remediate/contractPipeline/idRegistry.d.ts +0 -144
- package/dist/remediate/contractPipeline/idRegistry.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/idRegistry.js +0 -214
- package/dist/remediate/contractPipeline/idRegistry.js.map +0 -1
- package/dist/remediate/contractPipeline/obligationKinds.d.ts +0 -27
- package/dist/remediate/contractPipeline/obligationKinds.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/obligationKinds.js +0 -18
- package/dist/remediate/contractPipeline/obligationKinds.js.map +0 -1
- package/dist/remediate/contractPipeline/phaseCut.d.ts +0 -125
- package/dist/remediate/contractPipeline/phaseCut.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/phaseCut.js +0 -339
- package/dist/remediate/contractPipeline/phaseCut.js.map +0 -1
- package/dist/remediate/contractPipeline/phaseCutArtifact.d.ts +0 -31
- package/dist/remediate/contractPipeline/phaseCutArtifact.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/phaseCutArtifact.js +0 -48
- package/dist/remediate/contractPipeline/phaseCutArtifact.js.map +0 -1
- package/dist/remediate/contractPipeline/repairState.d.ts +0 -110
- package/dist/remediate/contractPipeline/repairState.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/repairState.js +0 -185
- package/dist/remediate/contractPipeline/repairState.js.map +0 -1
- package/dist/remediate/contractPipeline/reviewSnapshot.d.ts +0 -79
- package/dist/remediate/contractPipeline/reviewSnapshot.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/reviewSnapshot.js +0 -140
- package/dist/remediate/contractPipeline/reviewSnapshot.js.map +0 -1
- package/dist/remediate/contractPipeline/semanticProjection.d.ts +0 -64
- package/dist/remediate/contractPipeline/semanticProjection.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/semanticProjection.js +0 -136
- package/dist/remediate/contractPipeline/semanticProjection.js.map +0 -1
- package/dist/remediate/contractPipeline/sketchSource.d.ts +0 -194
- package/dist/remediate/contractPipeline/sketchSource.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/sketchSource.js +0 -262
- package/dist/remediate/contractPipeline/sketchSource.js.map +0 -1
- package/dist/remediate/contractPipeline/testPlanCarry.d.ts +0 -17
- package/dist/remediate/contractPipeline/testPlanCarry.d.ts.map +0 -1
- package/dist/remediate/contractPipeline/testPlanCarry.js +0 -72
- package/dist/remediate/contractPipeline/testPlanCarry.js.map +0 -1
- package/dist/remediate/steps/dispatch/marshal.d.ts +0 -7
- package/dist/remediate/steps/dispatch/marshal.d.ts.map +0 -1
- package/dist/remediate/steps/dispatch/marshal.js +0 -11
- package/dist/remediate/steps/dispatch/marshal.js.map +0 -1
- package/dist/remediate/validation/contractPipeline.d.ts +0 -35
- package/dist/remediate/validation/contractPipeline.d.ts.map +0 -1
- package/dist/remediate/validation/contractPipeline.js +0 -613
- package/dist/remediate/validation/contractPipeline.js.map +0 -1
- package/dist/remediate/validation/contractPipelineGates.d.ts +0 -272
- package/dist/remediate/validation/contractPipelineGates.d.ts.map +0 -1
- package/dist/remediate/validation/contractPipelineGates.js +0 -1397
- package/dist/remediate/validation/contractPipelineGates.js.map +0 -1
- package/dist/shared/types/contractPipeline/design.d.ts +0 -79
- package/dist/shared/types/contractPipeline/design.d.ts.map +0 -1
- package/dist/shared/types/contractPipeline/design.js +0 -16
- package/dist/shared/types/contractPipeline/design.js.map +0 -1
- package/dist/shared/types/contractPipeline/goal.d.ts +0 -41
- package/dist/shared/types/contractPipeline/goal.d.ts.map +0 -1
- package/dist/shared/types/contractPipeline/goal.js +0 -10
- package/dist/shared/types/contractPipeline/goal.js.map +0 -1
- package/dist/shared/types/contractPipeline/implementation.d.ts +0 -118
- package/dist/shared/types/contractPipeline/implementation.d.ts.map +0 -1
- package/dist/shared/types/contractPipeline/implementation.js +0 -13
- package/dist/shared/types/contractPipeline/implementation.js.map +0 -1
- package/dist/shared/types/contractPipeline/obligations.d.ts +0 -283
- package/dist/shared/types/contractPipeline/obligations.d.ts.map +0 -1
- package/dist/shared/types/contractPipeline/obligations.js +0 -84
- package/dist/shared/types/contractPipeline/obligations.js.map +0 -1
- package/dist/shared/types/contractPipeline/verification.d.ts.map +0 -1
- package/dist/shared/types/contractPipeline/verification.js +0 -10
- package/dist/shared/types/contractPipeline/verification.js.map +0 -1
- package/dist/shared/types/contractPipeline.d.ts +0 -48
- package/dist/shared/types/contractPipeline.d.ts.map +0 -1
- package/dist/shared/types/contractPipeline.js +0 -32
- package/dist/shared/types/contractPipeline.js.map +0 -1
- package/dist/shared/types/obligationLedger.d.ts +0 -39
- package/dist/shared/types/obligationLedger.d.ts.map +0 -1
- package/dist/shared/types/obligationLedger.js +0 -49
- package/dist/shared/types/obligationLedger.js.map +0 -1
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// sites-pinned: tests/remediate/contract-review-independence.test.ts, tests/remediate/contract-pipeline-adversarial.test.ts
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { bindWorkerPrompt } from "../../shared/submission/workerPromptBinding.js";
|
|
5
|
-
import { writeJsonFile } from "../../shared/io/json.js";
|
|
6
|
-
import { readSubmissionDocument } from "../../shared/submission/submissionClassifier.js";
|
|
7
|
-
import { hashContent } from "../../shared/hash.js";
|
|
8
|
-
import { stableStringify } from "../../shared/stableStringify.js";
|
|
9
|
-
import { ReviewRequirementSchema, parseReviewSubmissionEnvelope } from "../../shared/types/reviewIndependence.js";
|
|
10
|
-
import { DEPENDENCY_MAP, contractPipelineDir, readContractArtifact } from "./artifactStore.js";
|
|
11
|
-
const BindingSchema = z.object({
|
|
12
|
-
contract_version: z.literal("contract-review-binding/v1"),
|
|
13
|
-
artifact_name: z.string(),
|
|
14
|
-
role: z.string(),
|
|
15
|
-
emission_id: z.string(),
|
|
16
|
-
requirement: ReviewRequirementSchema,
|
|
17
|
-
prompt_sha256: z.string().regex(/^[0-9a-f]{64}$/u),
|
|
18
|
-
source_prompt_sha256: z.string().regex(/^[0-9a-f]{64}$/u),
|
|
19
|
-
dependency_hashes: z.record(z.string(), z.string().nullable()),
|
|
20
|
-
}).strict();
|
|
21
|
-
export function contractReviewBindingPath(artifactsDir, name) {
|
|
22
|
-
return join(contractPipelineDir(artifactsDir), `${name}.review-binding.json`);
|
|
23
|
-
}
|
|
24
|
-
async function dependencyHashes(artifactsDir, name) {
|
|
25
|
-
const pairs = await Promise.all(DEPENDENCY_MAP[name].map(async (dep) => [dep, (await readContractArtifact(artifactsDir, dep))?.content_hash ?? null]));
|
|
26
|
-
return Object.fromEntries(pairs);
|
|
27
|
-
}
|
|
28
|
-
/** Tool-owned expectation, separate from the worker's declared review envelope. */
|
|
29
|
-
export async function bindContractReviewPrompt(params) {
|
|
30
|
-
if (params.requirement === "ordinary")
|
|
31
|
-
return params.prompt;
|
|
32
|
-
const dependencies = await dependencyHashes(params.artifactsDir, params.artifact);
|
|
33
|
-
const sourcePromptHash = hashContent(params.prompt);
|
|
34
|
-
const priorRead = await readSubmissionDocument(contractReviewBindingPath(params.artifactsDir, params.artifact));
|
|
35
|
-
const prior = BindingSchema.safeParse(priorRead.kind === "value" ? priorRead.value : undefined);
|
|
36
|
-
const sameTask = prior.success && prior.data.artifact_name === params.artifact && prior.data.role === params.role &&
|
|
37
|
-
prior.data.requirement === params.requirement && prior.data.source_prompt_sha256 === sourcePromptHash &&
|
|
38
|
-
stableStringify(prior.data.dependency_hashes) === stableStringify(dependencies);
|
|
39
|
-
const emissionId = sameTask ? prior.data.emission_id : params.emissionId;
|
|
40
|
-
const context = { artifact_name: params.artifact, role: params.role, emission_id: emissionId, requirement: params.requirement, dependency_hashes: dependencies };
|
|
41
|
-
const body = `${params.prompt}\n\n## Bound review submission\n\nThe domain schema above is the inner result. Submit the complete review envelope below to the named output path, not a raw artifact.\nReview context: ${stableStringify(context)}`;
|
|
42
|
-
const bound = bindWorkerPrompt(body, prompt_sha256 => [
|
|
43
|
-
"```json",
|
|
44
|
-
JSON.stringify({ contract_version: "review-submission/v1", prompt_sha256,
|
|
45
|
-
review: { mode: params.requirement === "degraded_allowed" ? "degraded" : "independent", reason: "<how the review context meets the required policy>" },
|
|
46
|
-
result: { "<artifact fields>": "<complete domain object using the schema above>" },
|
|
47
|
-
}, null, 2),
|
|
48
|
-
"```",
|
|
49
|
-
"If the required review context is unavailable, declare mode unavailable with the reason. Do not silently replace required independent review with self-review.",
|
|
50
|
-
].join("\n"));
|
|
51
|
-
await writeJsonFile(contractReviewBindingPath(params.artifactsDir, params.artifact), {
|
|
52
|
-
contract_version: "contract-review-binding/v1", ...context, prompt_sha256: bound.sha256, source_prompt_sha256: sourcePromptHash,
|
|
53
|
-
});
|
|
54
|
-
return bound.text;
|
|
55
|
-
}
|
|
56
|
-
export async function validateContractReviewInput(params) {
|
|
57
|
-
if (params.requirement === "ordinary")
|
|
58
|
-
return { ok: true, payload: params.raw };
|
|
59
|
-
const read = await readSubmissionDocument(contractReviewBindingPath(params.artifactsDir, params.artifact));
|
|
60
|
-
const parsed = BindingSchema.safeParse(read.kind === "value" ? read.value : undefined);
|
|
61
|
-
if (!parsed.success || parsed.data.artifact_name !== params.artifact || parsed.data.role !== params.role || parsed.data.requirement !== params.requirement) {
|
|
62
|
-
return { ok: false, code: "binding_missing", issue: "This required review has no current tool-issued role/policy binding. Re-emit the role and use its bound review-submission/v1 envelope." };
|
|
63
|
-
}
|
|
64
|
-
const binding = parsed.data;
|
|
65
|
-
if (stableStringify(binding.dependency_hashes) !== stableStringify(await dependencyHashes(params.artifactsDir, params.artifact))) {
|
|
66
|
-
return { ok: false, code: "dependency_stale", issue: "The inputs reviewed by this submission have changed. Re-emit the review against the current dependency content before accepting it." };
|
|
67
|
-
}
|
|
68
|
-
const submission = parseReviewSubmissionEnvelope(params.raw, { requirement: params.requirement, promptSha256: binding.prompt_sha256 });
|
|
69
|
-
if (!submission.ok)
|
|
70
|
-
return submission;
|
|
71
|
-
return { ok: true, payload: submission.result, provenance: {
|
|
72
|
-
requirement: params.requirement, prompt_sha256: binding.prompt_sha256, review: submission.review,
|
|
73
|
-
} };
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=contractReviewBinding.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contractReviewBinding.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/contractReviewBinding.ts"],"names":[],"mappings":"AAAA,4HAA4H;AAC5H,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAA4F,MAAM,0CAA0C,CAAC;AAC5M,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAqC,MAAM,oBAAoB,CAAC;AAElI,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,4BAA4B,CAAC;IACzD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,WAAW,EAAE,uBAAuB;IACpC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC;IAClD,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC;IACzD,iBAAiB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC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,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,qIAAqI,EAAE,CAAC;IAC/L,CAAC;IACD,MAAM,UAAU,GAAG,6BAA6B,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,YAAY,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACvI,IAAI,CAAC,UAAU,CAAC,EAAE;QAAE,OAAO,UAAU,CAAC;IACtC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE;YACzD,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,CAAC,MAAO;SAClG,EAAE,CAAC;AACN,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Content fingerprint for a counterexample.
|
|
3
|
-
*
|
|
4
|
-
* The judge↔repair convergence gate ({@link evaluateJudgeGate} in
|
|
5
|
-
* `../steps/contractPipeline.js`) must detect genuine re-occurrence of the
|
|
6
|
-
* same unrepaired defect across independent adversarial rounds. The
|
|
7
|
-
* reviewer-supplied counterexample `id` is free text (see
|
|
8
|
-
* `Counterexample.id` in `audit-tools/shared`'s obligations types) and is NOT
|
|
9
|
-
* a stable cross-round identity: two independent critic rounds each commonly
|
|
10
|
-
* label their genuinely-distinct top counterexample "CE-001" (the prompt
|
|
11
|
-
* schema's own example value). Keying convergence on the raw id string then
|
|
12
|
-
* misreads "two different CEs that happen to share a label" as "the same CE
|
|
13
|
-
* re-accepted after a repair" and falsely escalates a stall while a real new
|
|
14
|
-
* defect is being correctly repaired.
|
|
15
|
-
*
|
|
16
|
-
* This fingerprint keys on CONTENT instead: the tool-constrained
|
|
17
|
-
* `violated_obligation_ids` vocabulary (sorted, normalized) paired with the
|
|
18
|
-
* normalized `claim` prose, falling back to the normalized claim alone when
|
|
19
|
-
* no obligations are cited. Mirrors the derivation style of
|
|
20
|
-
* `src/shared/findingIdentitySignature.ts` (tiered stable fields, aggressive
|
|
21
|
-
* title normalization, truncated content hash) rather than introducing a
|
|
22
|
-
* second identity convention.
|
|
23
|
-
*/
|
|
24
|
-
import { type Counterexample } from "audit-tools/shared";
|
|
25
|
-
/** Deterministic, content-derived identity for a counterexample. */
|
|
26
|
-
export declare function counterexampleFingerprint(ce: Counterexample): string;
|
|
27
|
-
//# sourceMappingURL=counterexampleFingerprint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"counterexampleFingerprint.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/counterexampleFingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEtF,oEAAoE;AACpE,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,cAAc,GAAG,MAAM,CAWpE"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Content fingerprint for a counterexample.
|
|
3
|
-
*
|
|
4
|
-
* The judge↔repair convergence gate ({@link evaluateJudgeGate} in
|
|
5
|
-
* `../steps/contractPipeline.js`) must detect genuine re-occurrence of the
|
|
6
|
-
* same unrepaired defect across independent adversarial rounds. The
|
|
7
|
-
* reviewer-supplied counterexample `id` is free text (see
|
|
8
|
-
* `Counterexample.id` in `audit-tools/shared`'s obligations types) and is NOT
|
|
9
|
-
* a stable cross-round identity: two independent critic rounds each commonly
|
|
10
|
-
* label their genuinely-distinct top counterexample "CE-001" (the prompt
|
|
11
|
-
* schema's own example value). Keying convergence on the raw id string then
|
|
12
|
-
* misreads "two different CEs that happen to share a label" as "the same CE
|
|
13
|
-
* re-accepted after a repair" and falsely escalates a stall while a real new
|
|
14
|
-
* defect is being correctly repaired.
|
|
15
|
-
*
|
|
16
|
-
* This fingerprint keys on CONTENT instead: the tool-constrained
|
|
17
|
-
* `violated_obligation_ids` vocabulary (sorted, normalized) paired with the
|
|
18
|
-
* normalized `claim` prose, falling back to the normalized claim alone when
|
|
19
|
-
* no obligations are cited. Mirrors the derivation style of
|
|
20
|
-
* `src/shared/findingIdentitySignature.ts` (tiered stable fields, aggressive
|
|
21
|
-
* title normalization, truncated content hash) rather than introducing a
|
|
22
|
-
* second identity convention.
|
|
23
|
-
*/
|
|
24
|
-
import { hashContent, normalizeTitle } from "audit-tools/shared";
|
|
25
|
-
/** Deterministic, content-derived identity for a counterexample. */
|
|
26
|
-
export function counterexampleFingerprint(ce) {
|
|
27
|
-
const obligations = (ce.violated_obligation_ids ?? [])
|
|
28
|
-
.map((id) => id.trim().toLowerCase())
|
|
29
|
-
.filter((id) => id.length > 0)
|
|
30
|
-
.sort();
|
|
31
|
-
const claim = normalizeTitle(ce.claim);
|
|
32
|
-
const key = obligations.length > 0
|
|
33
|
-
? `obligations|${obligations.join(",")}|${claim}`
|
|
34
|
-
: `claim|${claim}`;
|
|
35
|
-
return hashContent(key, { length: 8 });
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=counterexampleFingerprint.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"counterexampleFingerprint.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/counterexampleFingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAuB,MAAM,oBAAoB,CAAC;AAEtF,oEAAoE;AACpE,MAAM,UAAU,yBAAyB,CAAC,EAAkB;IAC1D,MAAM,WAAW,GAAG,CAAC,EAAE,CAAC,uBAAuB,IAAI,EAAE,CAAC;SACnD,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;SACpC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;SAC7B,IAAI,EAAE,CAAC;IACV,MAAM,KAAK,GAAG,cAAc,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,GAAG,GACP,WAAW,CAAC,MAAM,GAAG,CAAC;QACpB,CAAC,CAAC,eAAe,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,EAAE;QACjD,CAAC,CAAC,SAAS,KAAK,EAAE,CAAC;IACvB,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cyclic-seam resolution: deterministic cycle detection over module seam
|
|
3
|
-
* obligations, plus a re-check helper that validates a proposed cycle-break
|
|
4
|
-
* does not re-introduce a cycle.
|
|
5
|
-
*
|
|
6
|
-
* A "seam obligation" is any module that declares an interface obligation
|
|
7
|
-
* (via neighbor_needs / inputs / outputs) that depends on a type or interface
|
|
8
|
-
* owned by another module. For the purposes of this detector, a module M
|
|
9
|
-
* is said to need module N when M lists N in its `needs` array.
|
|
10
|
-
*
|
|
11
|
-
* Detection is the shared directed-cycle core's exact strongly-connected-
|
|
12
|
-
* component membership (`audit-tools/shared` → `findCyclicComponents`). Each
|
|
13
|
-
* cyclic component is reported as one detected cycle.
|
|
14
|
-
*/
|
|
15
|
-
/** A module node in the seam-obligation graph. */
|
|
16
|
-
export interface SeamObligationNode {
|
|
17
|
-
/** Unique module identifier. */
|
|
18
|
-
id: string;
|
|
19
|
-
/** IDs of modules this module declares an interface obligation toward. */
|
|
20
|
-
needs: string[];
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* One detected cycle (N ≥ 1 nodes — a module that needs ITSELF is a 1-member
|
|
24
|
-
* cycle; every other cycle has 2 or more members).
|
|
25
|
-
*/
|
|
26
|
-
export interface DetectedCycle {
|
|
27
|
-
/** Module IDs that form the cycle, in input order (not in cycle order). */
|
|
28
|
-
members: string[];
|
|
29
|
-
}
|
|
30
|
-
/** A proposed mediator module that breaks a cycle. */
|
|
31
|
-
export interface ProposedMediator {
|
|
32
|
-
/** Module ID for the new mediator. */
|
|
33
|
-
id: string;
|
|
34
|
-
/** Modules the mediator itself needs (must not form a new cycle). */
|
|
35
|
-
needs: string[];
|
|
36
|
-
}
|
|
37
|
-
/** Result of a cycle-break re-check. */
|
|
38
|
-
export interface CycleBreakValidation {
|
|
39
|
-
accepted: boolean;
|
|
40
|
-
/** Present only when accepted === false. */
|
|
41
|
-
reason?: string;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* The break a worker ACTUALLY authored, read off the `cyclic_seam_resolution`
|
|
45
|
-
* record rather than fabricated by the re-checker.
|
|
46
|
-
*
|
|
47
|
-
* Both sanctioned strategies designate a REAL node: `mediator` names a third
|
|
48
|
-
* obligation that now owns the shared primitive, `single_authority` names the
|
|
49
|
-
* one cycle member that keeps the interface. A record that designates nothing
|
|
50
|
-
* cannot be validated against the real graph at all — see
|
|
51
|
-
* {@link validateAuthoredCycleBreak}, which refuses it rather than inventing a
|
|
52
|
-
* placeholder.
|
|
53
|
-
*/
|
|
54
|
-
export interface AuthoredCycleBreak {
|
|
55
|
-
/** `break_strategy` from the resolution record. */
|
|
56
|
-
strategy: "mediator" | "single_authority";
|
|
57
|
-
/** The obligation id the record designates, when it named one. */
|
|
58
|
-
designatedId?: string;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Detect cyclic seam obligations in a module graph.
|
|
62
|
-
*
|
|
63
|
-
* Membership is EXACT: each reported cycle is one strongly connected component
|
|
64
|
-
* of the (module → modules it needs) graph. Two properties follow, and both
|
|
65
|
-
* differ from the Kahn drain this replaced:
|
|
66
|
-
*
|
|
67
|
-
* - a module DOWNSTREAM of a cycle (it needs a member, no member needs it) is
|
|
68
|
-
* not a member and is not reported — the drain reported every node it could
|
|
69
|
-
* not drain, tails included;
|
|
70
|
-
* - two cycles CHAINED by an edge between them are two cycles, not one — the
|
|
71
|
-
* drain's weakly-connected grouping fused them.
|
|
72
|
-
*
|
|
73
|
-
* A module that needs ITSELF is reported as a 1-member cycle.
|
|
74
|
-
*
|
|
75
|
-
* Returns an empty array when no cycle is found.
|
|
76
|
-
*/
|
|
77
|
-
export declare function detectCyclicSeamObligations(nodes: SeamObligationNode[]): DetectedCycle[];
|
|
78
|
-
/**
|
|
79
|
-
* Validate a proposed cycle-break by re-running cycle detection on the
|
|
80
|
-
* graph after the break is applied.
|
|
81
|
-
*
|
|
82
|
-
* The break modifies the original graph as follows:
|
|
83
|
-
* - Remove every `needs` edge between original cycle members that crossed the
|
|
84
|
-
* cycle (both sides still appear in the graph with their original non-cycle
|
|
85
|
-
* needs intact).
|
|
86
|
-
* - Add the `proposedMediator` as a new node.
|
|
87
|
-
* - For each original cycle member, replace any needs-edge that pointed to
|
|
88
|
-
* another cycle member with a needs-edge to the mediator.
|
|
89
|
-
*
|
|
90
|
-
* If the resulting graph still contains a cycle, the proposed break is
|
|
91
|
-
* rejected.
|
|
92
|
-
*
|
|
93
|
-
* The mediator appears EXACTLY ONCE in the patched graph. When it is already a
|
|
94
|
-
* node of `allNodes` — which is the live feed from
|
|
95
|
-
* {@link validateAuthoredCycleBreak}, where the mediator is a real obligation —
|
|
96
|
-
* its own entry carries the proposed needs instead of a second entry with the
|
|
97
|
-
* same id being appended.
|
|
98
|
-
*/
|
|
99
|
-
export declare function validateCycleBreak(originalCycle: DetectedCycle, allNodes: SeamObligationNode[], proposedMediator: ProposedMediator): CycleBreakValidation;
|
|
100
|
-
/**
|
|
101
|
-
* Re-check a cycle-break AS AUTHORED, against the REAL obligation graph.
|
|
102
|
-
*
|
|
103
|
-
* The distinction from {@link validateCycleBreak} is the whole point: that
|
|
104
|
-
* function asks a HYPOTHETICAL — "if the intra-cycle edges were redirected to
|
|
105
|
-
* this proposed node, would the graph be acyclic?" — and its caller used to
|
|
106
|
-
* answer it with a node it had fabricated itself (`{ id: "_mediator_A_B",
|
|
107
|
-
* needs: [] }`) against the UNMODIFIED ledger. An edge-free sink absorbs every
|
|
108
|
-
* redirected edge, so for a single detected cycle that question is acyclic BY
|
|
109
|
-
* CONSTRUCTION and the re-check could never reject — a worker could claim
|
|
110
|
-
* `status: "resolved"` while leaving the ledger's cycle edges exactly as they
|
|
111
|
-
* were, and the pipeline advanced.
|
|
112
|
-
*
|
|
113
|
-
* This function asks the REAL question instead: does the graph the pipeline
|
|
114
|
-
* will actually consume still carry the cycle? The break is accepted only when
|
|
115
|
-
*
|
|
116
|
-
* 1. the record designates a node (a break with no designated owner is not a
|
|
117
|
-
* break, it is a claim), and that node EXISTS in the live graph;
|
|
118
|
-
* 2. the strategy and the designated node agree — a mediator is a THIRD node
|
|
119
|
-
* outside the cycle, a single authority is one of the cycle's own members;
|
|
120
|
-
* 3. the live graph no longer contains a cycle touching the original members
|
|
121
|
-
* — i.e. the break is reflected in the edges, not just asserted in prose;
|
|
122
|
-
* 4. and, for the mediator strategy, redirecting the cycle's edges at the
|
|
123
|
-
* mediator's REAL `needs` (never a fabricated empty set) stays acyclic, so
|
|
124
|
-
* a mediator that itself depends back into the cycle is refused.
|
|
125
|
-
*
|
|
126
|
-
* `currentNodes` must be built from the obligation ledger as it stands NOW, on
|
|
127
|
-
* this invocation, after ingestion and the staleness-archive pass — a stale
|
|
128
|
-
* snapshot would reintroduce exactly the vacuity this closes.
|
|
129
|
-
*/
|
|
130
|
-
export declare function validateAuthoredCycleBreak(originalCycle: DetectedCycle, currentNodes: SeamObligationNode[], authored: AuthoredCycleBreak): CycleBreakValidation;
|
|
131
|
-
//# sourceMappingURL=cyclicSeamResolution.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cyclicSeamResolution.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/cyclicSeamResolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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
-
* obligations, plus a re-check helper that validates a proposed cycle-break
|
|
4
|
-
* does not re-introduce a cycle.
|
|
5
|
-
*
|
|
6
|
-
* A "seam obligation" is any module that declares an interface obligation
|
|
7
|
-
* (via neighbor_needs / inputs / outputs) that depends on a type or interface
|
|
8
|
-
* owned by another module. For the purposes of this detector, a module M
|
|
9
|
-
* is said to need module N when M lists N in its `needs` array.
|
|
10
|
-
*
|
|
11
|
-
* Detection is the shared directed-cycle core's exact strongly-connected-
|
|
12
|
-
* component membership (`audit-tools/shared` → `findCyclicComponents`). Each
|
|
13
|
-
* cyclic component is reported as one detected cycle.
|
|
14
|
-
*/
|
|
15
|
-
import { findCyclicComponents } from "audit-tools/shared";
|
|
16
|
-
// ── Cycle detection ───────────────────────────────────────────────────────────
|
|
17
|
-
/**
|
|
18
|
-
* Detect cyclic seam obligations in a module graph.
|
|
19
|
-
*
|
|
20
|
-
* Membership is EXACT: each reported cycle is one strongly connected component
|
|
21
|
-
* of the (module → modules it needs) graph. Two properties follow, and both
|
|
22
|
-
* differ from the Kahn drain this replaced:
|
|
23
|
-
*
|
|
24
|
-
* - a module DOWNSTREAM of a cycle (it needs a member, no member needs it) is
|
|
25
|
-
* not a member and is not reported — the drain reported every node it could
|
|
26
|
-
* not drain, tails included;
|
|
27
|
-
* - two cycles CHAINED by an edge between them are two cycles, not one — the
|
|
28
|
-
* drain's weakly-connected grouping fused them.
|
|
29
|
-
*
|
|
30
|
-
* A module that needs ITSELF is reported as a 1-member cycle.
|
|
31
|
-
*
|
|
32
|
-
* Returns an empty array when no cycle is found.
|
|
33
|
-
*/
|
|
34
|
-
export function detectCyclicSeamObligations(nodes) {
|
|
35
|
-
const components = findCyclicComponents(nodes.map((node) => ({ id: node.id, depends_on: node.needs })), { includeSelfLoops: true });
|
|
36
|
-
return components.map((members) => ({ members }));
|
|
37
|
-
}
|
|
38
|
-
// ── Cycle-break re-check ──────────────────────────────────────────────────────
|
|
39
|
-
/**
|
|
40
|
-
* Validate a proposed cycle-break by re-running cycle detection on the
|
|
41
|
-
* graph after the break is applied.
|
|
42
|
-
*
|
|
43
|
-
* The break modifies the original graph as follows:
|
|
44
|
-
* - Remove every `needs` edge between original cycle members that crossed the
|
|
45
|
-
* cycle (both sides still appear in the graph with their original non-cycle
|
|
46
|
-
* needs intact).
|
|
47
|
-
* - Add the `proposedMediator` as a new node.
|
|
48
|
-
* - For each original cycle member, replace any needs-edge that pointed to
|
|
49
|
-
* another cycle member with a needs-edge to the mediator.
|
|
50
|
-
*
|
|
51
|
-
* If the resulting graph still contains a cycle, the proposed break is
|
|
52
|
-
* rejected.
|
|
53
|
-
*
|
|
54
|
-
* The mediator appears EXACTLY ONCE in the patched graph. When it is already a
|
|
55
|
-
* node of `allNodes` — which is the live feed from
|
|
56
|
-
* {@link validateAuthoredCycleBreak}, where the mediator is a real obligation —
|
|
57
|
-
* its own entry carries the proposed needs instead of a second entry with the
|
|
58
|
-
* same id being appended.
|
|
59
|
-
*/
|
|
60
|
-
export function validateCycleBreak(originalCycle, allNodes, proposedMediator) {
|
|
61
|
-
const cycleSet = new Set(originalCycle.members);
|
|
62
|
-
// Build the patched node list:
|
|
63
|
-
// - For each cycle member: replace needs-edges to other cycle members with
|
|
64
|
-
// a needs-edge to the mediator.
|
|
65
|
-
// - For non-cycle members: unchanged.
|
|
66
|
-
// - Add the mediator, unless the graph already carries a node with its id.
|
|
67
|
-
const patched = [];
|
|
68
|
-
const mediatorAlreadyPresent = allNodes.some((node) => node.id === proposedMediator.id);
|
|
69
|
-
for (const node of allNodes) {
|
|
70
|
-
if (node.id === proposedMediator.id) {
|
|
71
|
-
// The mediator's own entry — carry the proposed needs here rather than
|
|
72
|
-
// appending a second node with the same id below.
|
|
73
|
-
patched.push({ id: node.id, needs: [...proposedMediator.needs] });
|
|
74
|
-
}
|
|
75
|
-
else if (cycleSet.has(node.id)) {
|
|
76
|
-
const newNeeds = node.needs.map((dep) => cycleSet.has(dep) ? proposedMediator.id : dep);
|
|
77
|
-
// Deduplicate mediator references.
|
|
78
|
-
patched.push({ id: node.id, needs: [...new Set(newNeeds)] });
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
patched.push(node);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
// Add the mediator itself, unless the live graph already carries it.
|
|
85
|
-
if (!mediatorAlreadyPresent) {
|
|
86
|
-
patched.push({ id: proposedMediator.id, needs: proposedMediator.needs });
|
|
87
|
-
}
|
|
88
|
-
const remaining = detectCyclicSeamObligations(patched);
|
|
89
|
-
if (remaining.length > 0) {
|
|
90
|
-
const affectedIds = remaining.flatMap((c) => c.members).join(", ");
|
|
91
|
-
return {
|
|
92
|
-
accepted: false,
|
|
93
|
-
reason: `Proposed mediator "${proposedMediator.id}" still leaves cycle(s) involving: [${affectedIds}].`,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
return { accepted: true };
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Re-check a cycle-break AS AUTHORED, against the REAL obligation graph.
|
|
100
|
-
*
|
|
101
|
-
* The distinction from {@link validateCycleBreak} is the whole point: that
|
|
102
|
-
* function asks a HYPOTHETICAL — "if the intra-cycle edges were redirected to
|
|
103
|
-
* this proposed node, would the graph be acyclic?" — and its caller used to
|
|
104
|
-
* answer it with a node it had fabricated itself (`{ id: "_mediator_A_B",
|
|
105
|
-
* needs: [] }`) against the UNMODIFIED ledger. An edge-free sink absorbs every
|
|
106
|
-
* redirected edge, so for a single detected cycle that question is acyclic BY
|
|
107
|
-
* CONSTRUCTION and the re-check could never reject — a worker could claim
|
|
108
|
-
* `status: "resolved"` while leaving the ledger's cycle edges exactly as they
|
|
109
|
-
* were, and the pipeline advanced.
|
|
110
|
-
*
|
|
111
|
-
* This function asks the REAL question instead: does the graph the pipeline
|
|
112
|
-
* will actually consume still carry the cycle? The break is accepted only when
|
|
113
|
-
*
|
|
114
|
-
* 1. the record designates a node (a break with no designated owner is not a
|
|
115
|
-
* break, it is a claim), and that node EXISTS in the live graph;
|
|
116
|
-
* 2. the strategy and the designated node agree — a mediator is a THIRD node
|
|
117
|
-
* outside the cycle, a single authority is one of the cycle's own members;
|
|
118
|
-
* 3. the live graph no longer contains a cycle touching the original members
|
|
119
|
-
* — i.e. the break is reflected in the edges, not just asserted in prose;
|
|
120
|
-
* 4. and, for the mediator strategy, redirecting the cycle's edges at the
|
|
121
|
-
* mediator's REAL `needs` (never a fabricated empty set) stays acyclic, so
|
|
122
|
-
* a mediator that itself depends back into the cycle is refused.
|
|
123
|
-
*
|
|
124
|
-
* `currentNodes` must be built from the obligation ledger as it stands NOW, on
|
|
125
|
-
* this invocation, after ingestion and the staleness-archive pass — a stale
|
|
126
|
-
* snapshot would reintroduce exactly the vacuity this closes.
|
|
127
|
-
*/
|
|
128
|
-
export function validateAuthoredCycleBreak(originalCycle, currentNodes, authored) {
|
|
129
|
-
const members = originalCycle.members;
|
|
130
|
-
const cycleSet = new Set(members);
|
|
131
|
-
const designatedId = authored.designatedId?.trim();
|
|
132
|
-
if (!designatedId) {
|
|
133
|
-
return {
|
|
134
|
-
accepted: false,
|
|
135
|
-
reason: `The ${authored.strategy} break for cycle [${members.join(", ")}] names no obligation. ` +
|
|
136
|
-
`A mediator break must name the mediating obligation and a single_authority break must ` +
|
|
137
|
-
`name the owning obligation, or there is nothing to re-check against the ledger.`,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
const designated = currentNodes.find((node) => node.id === designatedId);
|
|
141
|
-
if (!designated) {
|
|
142
|
-
return {
|
|
143
|
-
accepted: false,
|
|
144
|
-
reason: `The ${authored.strategy} break for cycle [${members.join(", ")}] names "${designatedId}", ` +
|
|
145
|
-
`which is not an obligation in the ledger. The break must be recorded in the ledger the ` +
|
|
146
|
-
`pipeline reads, not only in the resolution record.`,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
if (authored.strategy === "mediator" && cycleSet.has(designatedId)) {
|
|
150
|
-
return {
|
|
151
|
-
accepted: false,
|
|
152
|
-
reason: `Mediator "${designatedId}" is itself a member of cycle [${members.join(", ")}]. A mediator ` +
|
|
153
|
-
`is a THIRD obligation that both sides depend on; designating a participant is a ` +
|
|
154
|
-
`single_authority break, not a mediator break.`,
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
if (authored.strategy === "single_authority" && !cycleSet.has(designatedId)) {
|
|
158
|
-
return {
|
|
159
|
-
accepted: false,
|
|
160
|
-
reason: `Single authority "${designatedId}" is not a member of cycle [${members.join(", ")}]. The ` +
|
|
161
|
-
`authority must be one of the co-defining obligations; the others become consumers.`,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
// (3) The designated obligation must be a member of THE BROKEN CYCLE'S OWN
|
|
165
|
-
// node set — the cycle members plus what they now need. Existing in the
|
|
166
|
-
// ledger is not enough: a mediator that no cycle member depends on mediates
|
|
167
|
-
// nothing, so an arbitrary unrelated obligation could otherwise be named and
|
|
168
|
-
// the break would pass on the strength of a graph that is acyclic for
|
|
169
|
-
// reasons having nothing to do with the claim.
|
|
170
|
-
const brokenCycleNodeSet = new Set(members);
|
|
171
|
-
for (const node of currentNodes) {
|
|
172
|
-
if (!cycleSet.has(node.id))
|
|
173
|
-
continue;
|
|
174
|
-
for (const dep of node.needs)
|
|
175
|
-
brokenCycleNodeSet.add(dep);
|
|
176
|
-
}
|
|
177
|
-
if (!brokenCycleNodeSet.has(designatedId)) {
|
|
178
|
-
return {
|
|
179
|
-
accepted: false,
|
|
180
|
-
reason: `The ${authored.strategy} break names "${designatedId}", which no member of cycle ` +
|
|
181
|
-
`[${members.join(", ")}] depends on. The designated obligation must be part of the broken ` +
|
|
182
|
-
`cycle's own node set — a mediator no cycle member needs is not mediating the cycle.`,
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
// (3b) BOTH SIDES, for the mediator strategy. Step (3) above accepts a
|
|
186
|
-
// designated node that ANY single member needs, but the prompt this record
|
|
187
|
-
// answers states the stronger requirement: "a THIRD obligation that both sides
|
|
188
|
-
// depend on". A cycle of A ← B ← C (a two-sided cycle: A needs B, B needs C, C
|
|
189
|
-
// needs A) designating C as the mediator passes (3) on A's single edge while
|
|
190
|
-
// leaving B — one of the two sides the break is supposed to route through C —
|
|
191
|
-
// still pointing at the cycle. The break would then be recorded as a mediated
|
|
192
|
-
// resolution over a ledger whose edges the designated node does not mediate.
|
|
193
|
-
//
|
|
194
|
-
// The cycle is a real cycle, so "both sides" is answerable without guessing
|
|
195
|
-
// WHICH two members are the sides: the requirement enforced here is that at
|
|
196
|
-
// least TWO distinct cycle members depend on the designated node. For a
|
|
197
|
-
// two-member cycle that is exactly both; for a longer cycle it is the
|
|
198
|
-
// structural form of the same claim (a mediator one member uses is not shared,
|
|
199
|
-
// which is the defect). `single_authority` is deliberately NOT held to this:
|
|
200
|
-
// its own branch above already requires the designated node to BE a member,
|
|
201
|
-
// and the prompt asks the others to become its consumers, not to share it.
|
|
202
|
-
if (authored.strategy === "mediator") {
|
|
203
|
-
const dependingMembers = currentNodes.filter((node) => cycleSet.has(node.id) && node.needs.includes(designatedId));
|
|
204
|
-
if (dependingMembers.length < 2) {
|
|
205
|
-
const named = dependingMembers.map((node) => node.id);
|
|
206
|
-
return {
|
|
207
|
-
accepted: false,
|
|
208
|
-
reason: `Mediator "${designatedId}" is depended on by ` +
|
|
209
|
-
`${named.length === 0 ? "no member" : `only [${named.join(", ")}]`} of cycle ` +
|
|
210
|
-
`[${members.join(", ")}]. A mediator is a THIRD obligation that BOTH sides depend on; ` +
|
|
211
|
-
`one member routing through it does not mediate the cycle, it re-points one edge. ` +
|
|
212
|
-
`Rewrite the ledger so every side of the cycle depends on "${designatedId}".`,
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
// (4) The live edges, not the claim: any remaining cycle that still touches
|
|
217
|
-
// the original members means the ledger was never actually rewritten.
|
|
218
|
-
const allRemaining = detectCyclicSeamObligations(currentNodes);
|
|
219
|
-
const remaining = allRemaining.filter((cycle) => cycle.members.some((id) => cycleSet.has(id)));
|
|
220
|
-
if (remaining.length > 0) {
|
|
221
|
-
const affectedIds = [...new Set(remaining.flatMap((c) => c.members))].join(", ");
|
|
222
|
-
return {
|
|
223
|
-
accepted: false,
|
|
224
|
-
reason: `Cycle [${members.join(", ")}] is still present in the obligation ledger after the claimed ` +
|
|
225
|
-
`${authored.strategy} break via "${designatedId}" — the depends_on edges involving ` +
|
|
226
|
-
`[${affectedIds}] were not changed. Rewrite the ledger so the cycle's edges actually route ` +
|
|
227
|
-
`through the designated obligation.`,
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
// (5) SYMMETRIC across both strategies: the break must not have introduced a
|
|
231
|
-
// cycle ELSEWHERE either. Step (4) only looks at cycles touching the original
|
|
232
|
-
// members, so a brand-new cycle among untouched obligations would pass it —
|
|
233
|
-
// and a single_authority break used to reach the accept with no whole-graph
|
|
234
|
-
// check at all.
|
|
235
|
-
if (allRemaining.length > 0) {
|
|
236
|
-
const affectedIds = [...new Set(allRemaining.flatMap((c) => c.members))].join(", ");
|
|
237
|
-
return {
|
|
238
|
-
accepted: false,
|
|
239
|
-
reason: `The ${authored.strategy} break via "${designatedId}" leaves the obligation graph cyclic ` +
|
|
240
|
-
`elsewhere: [${affectedIds}]. Breaking one cycle may not introduce another.`,
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
// (6) The mediator's REAL needs — the check the fabricated `needs: []` node
|
|
244
|
-
// could never fail. Deliberately NOT run for single_authority: that strategy
|
|
245
|
-
// designates a cycle MEMBER, and `validateCycleBreak` redirects a member's
|
|
246
|
-
// intra-cycle edges at the designated node, which for the authority itself
|
|
247
|
-
// would manufacture a self-edge and reject a sound break. Step (5) is the
|
|
248
|
-
// whole-graph guarantee both strategies share.
|
|
249
|
-
if (authored.strategy === "mediator") {
|
|
250
|
-
return validateCycleBreak(originalCycle, currentNodes, {
|
|
251
|
-
id: designated.id,
|
|
252
|
-
needs: designated.needs,
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
return { accepted: true };
|
|
256
|
-
}
|
|
257
|
-
//# sourceMappingURL=cyclicSeamResolution.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cyclicSeamResolution.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/cyclicSeamResolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAsD1D,iFAAiF;AAEjF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAA2B;IAE3B,MAAM,UAAU,GAAG,oBAAoB,CACrC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,EAC9D,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAC3B,CAAC;IACF,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,iFAAiF;AAEjF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,kBAAkB,CAChC,aAA4B,EAC5B,QAA8B,EAC9B,gBAAkC;IAElC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAEhD,+BAA+B;IAC/B,2EAA2E;IAC3E,kCAAkC;IAClC,sCAAsC;IACtC,2EAA2E;IAC3E,MAAM,OAAO,GAAyB,EAAE,CAAC;IACzC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,IAAI,CAC1C,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,gBAAgB,CAAC,EAAE,CAC1C,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B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