@tiinex/core 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +31 -0
- package/README.md +45 -0
- package/package.json +176 -0
- package/src/actions/record.actions.js +312 -0
- package/src/adapters/adapter.contracts.js +143 -0
- package/src/adapters/archive/archive.adapter.js +502 -0
- package/src/adapters/archive/archive.portableChangeset.js +141 -0
- package/src/adapters/archive/archive.transport.js +124 -0
- package/src/artifacts/artifact.localDraft.js +27 -0
- package/src/artifacts/artifact.normalize.js +28 -0
- package/src/artifacts/artifact.parse.js +207 -0
- package/src/artifacts/artifact.record.js +83 -0
- package/src/audit/audit.run.js +103 -0
- package/src/audit/audit.summary.js +7 -0
- package/src/diagnostics/sourceBoundary.report.js +112 -0
- package/src/export/package.apply.js +349 -0
- package/src/export/package.builder.js +366 -0
- package/src/export/package.bytes.js +164 -0
- package/src/export/package.controlIntegrity.js +42 -0
- package/src/export/package.controlTopology.js +97 -0
- package/src/export/package.fileMap.js +174 -0
- package/src/export/package.manifest.js +401 -0
- package/src/export/package.preflight.js +204 -0
- package/src/export/package.sourceReference.js +81 -0
- package/src/export/package.workspaceContext.js +144 -0
- package/src/export/package.zip.js +128 -0
- package/src/export/tree.bundle.js +278 -0
- package/src/governance/governance.boundary.js +196 -0
- package/src/integrity/integrity.c14nV2.js +190 -0
- package/src/integrity/integrity.methodReference.js +73 -0
- package/src/integrity/integrity.validate.js +56 -0
- package/src/lineage/lineage.candidateResolution.js +46 -0
- package/src/lineage/lineage.githubIssueComment.js +106 -0
- package/src/lineage/lineage.githubIssueLocal.js +196 -0
- package/src/lineage/lineage.githubIssueTarget.js +89 -0
- package/src/lineage/lineage.integrity.js +133 -0
- package/src/lineage/lineage.materialPreference.js +26 -0
- package/src/lineage/lineage.model.js +63 -0
- package/src/lineage/lineage.parentAuthority.js +5 -0
- package/src/lineage/lineage.parentBinding.js +104 -0
- package/src/lineage/lineage.pathBasis.js +47 -0
- package/src/lineage/lineage.resolve.js +388 -0
- package/src/lineage/lineage.sourceScope.js +74 -0
- package/src/lineage/lineage.targetKeys.js +80 -0
- package/src/lineage/lineage.traverse.js +132 -0
- package/src/public/applicationProjection.js +236 -0
- package/src/public/companionResources.js +246 -0
- package/src/public/index.js +16 -0
- package/src/public/node.js +2 -0
- package/src/public/schemaAncestry.js +26 -0
- package/src/publication/publication.contract.js +196 -0
- package/src/publication/publication.preflight.js +159 -0
- package/src/publication/publication.targetContract.js +241 -0
- package/src/reingest/reingest.plan.js +162 -0
- package/src/release/plan.mjs +28 -0
- package/src/release/policy.mjs +100 -0
- package/src/release/run.mjs +74 -0
- package/src/schemas/capability.registry.js +226 -0
- package/src/schemas/companion.js +245 -0
- package/src/schemas/contracts.js +6 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.js +14 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.json +23 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.runtime.json +4283 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.source.js +9 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.js +26 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.json +23 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.runtime.json +1985 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.source.js +9 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.js +14 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.json +24 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.runtime.json +1700 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.source.js +9 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.capabilities.js +14 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.en.i18n.json +6 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.findings.js +9 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.presenter.js +1 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.js +32 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.json +24 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.runtime.json +2184 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.source.js +9 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.sv.i18n.json +6 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.transitions.js +1 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.validate.js +10 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.js +14 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.json +23 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.runtime.json +1773 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.source.js +9 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.capabilities.js +11 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.contract.js +40 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.en.i18n.json +9 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.findings.js +12 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.localMaterialization.js +89 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.presenter.js +8 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.js +34 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.json +23 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.runtime.json +2029 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.source.js +9 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.sv.i18n.json +9 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.transitions.js +1 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.validate.js +25 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.capabilities.js +14 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.en.i18n.json +6 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.findings.js +9 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.presenter.js +1 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.js +31 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.json +23 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.runtime.json +2033 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.source.js +9 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.sv.i18n.json +6 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.transitions.js +1 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.validate.js +10 -0
- package/src/schemas/core/relation/tiinex.relation.v1.capabilities.js +7 -0
- package/src/schemas/core/relation/tiinex.relation.v1.contract.js +3 -0
- package/src/schemas/core/relation/tiinex.relation.v1.en.i18n.json +4 -0
- package/src/schemas/core/relation/tiinex.relation.v1.findings.js +9 -0
- package/src/schemas/core/relation/tiinex.relation.v1.localMaterialization.js +153 -0
- package/src/schemas/core/relation/tiinex.relation.v1.presenter.js +3 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.js +20 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.json +23 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.runtime.json +1668 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.source.js +9 -0
- package/src/schemas/core/relation/tiinex.relation.v1.sv.i18n.json +4 -0
- package/src/schemas/core/relation/tiinex.relation.v1.transitions.js +1 -0
- package/src/schemas/core/relation/tiinex.relation.v1.validate.js +36 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.capabilities.js +14 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.contract.js +57 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.en.i18n.json +4 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.findings.js +13 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.presenter.js +3 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.js +20 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.json +24 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.runtime.json +3315 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.source.js +9 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.sv.i18n.json +4 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.transitions.js +1 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.validate.js +78 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.js +14 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.json +23 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.runtime.json +1733 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.source.js +9 -0
- package/src/schemas/core/task/tiinex.task.v1.capabilities.js +11 -0
- package/src/schemas/core/task/tiinex.task.v1.contract.js +3 -0
- package/src/schemas/core/task/tiinex.task.v1.en.i18n.json +15 -0
- package/src/schemas/core/task/tiinex.task.v1.findings.js +18 -0
- package/src/schemas/core/task/tiinex.task.v1.localMaterialization.js +148 -0
- package/src/schemas/core/task/tiinex.task.v1.presenter.js +8 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.js +35 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.json +23 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.runtime.json +1708 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.source.js +9 -0
- package/src/schemas/core/task/tiinex.task.v1.sv.i18n.json +15 -0
- package/src/schemas/core/task/tiinex.task.v1.transitions.js +3 -0
- package/src/schemas/core/task/tiinex.task.v1.validate.js +41 -0
- package/src/schemas/core/topic/tiinex.topic.v1.capabilities.js +14 -0
- package/src/schemas/core/topic/tiinex.topic.v1.creation.js +46 -0
- package/src/schemas/core/topic/tiinex.topic.v1.en.i18n.json +8 -0
- package/src/schemas/core/topic/tiinex.topic.v1.findings.js +11 -0
- package/src/schemas/core/topic/tiinex.topic.v1.localMaterialization.js +135 -0
- package/src/schemas/core/topic/tiinex.topic.v1.presenter.js +1 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.js +34 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.json +23 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.runtime.json +1699 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.source.js +9 -0
- package/src/schemas/core/topic/tiinex.topic.v1.sv.i18n.json +8 -0
- package/src/schemas/core/topic/tiinex.topic.v1.transitions.js +31 -0
- package/src/schemas/core/topic/tiinex.topic.v1.validate.js +11 -0
- package/src/schemas/creation.capability.js +289 -0
- package/src/schemas/creation.contracts.js +334 -0
- package/src/schemas/creation.executionSnapshot.js +79 -0
- package/src/schemas/creation.factoryQualification.js +73 -0
- package/src/schemas/creation.renderer.js +244 -0
- package/src/schemas/creation.representation.js +279 -0
- package/src/schemas/creation.rootMetadata.js +6 -0
- package/src/schemas/creation.schemaReferences.js +65 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.js +14 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.json +23 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.runtime.json +1873 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.source.js +9 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.js +14 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.json +23 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.runtime.json +1839 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.source.js +9 -0
- package/src/schemas/generic.artifact.module.js +25 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.js +26 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.json +23 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.runtime.json +2249 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.source.js +9 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.js +26 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.json +24 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.runtime.json +2091 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.source.js +9 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.capabilities.js +14 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.en.i18n.json +4 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.findings.js +1 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.presenter.js +1 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.js +29 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.json +21 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.runtime.json +2180 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.source.js +9 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.sv.i18n.json +4 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.transitions.js +1 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.validate.js +1 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.js +26 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.json +23 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.runtime.json +1733 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.source.js +9 -0
- package/src/schemas/reference.shapes.js +33 -0
- package/src/schemas/registry.js +36 -0
- package/src/schemas/resolver.js +13 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.capabilities.js +14 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.en.i18n.json +4 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.findings.js +1 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.presenter.js +1 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.js +29 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.json +21 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.runtime.json +2093 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.source.js +9 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.sv.i18n.json +4 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.transitions.js +1 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.validate.js +1 -0
- package/src/schemas/schema.factory.descriptor.js +104 -0
- package/src/schemas/schema.githubSourceTarget.js +131 -0
- package/src/schemas/schema.identity.js +10 -0
- package/src/schemas/schema.reference.js +133 -0
- package/src/schemas/schema.source.js +239 -0
- package/src/schemas/tiinex.root.v1.capabilities.js +14 -0
- package/src/schemas/tiinex.root.v1.classify.js +55 -0
- package/src/schemas/tiinex.root.v1.en.i18n.json +24 -0
- package/src/schemas/tiinex.root.v1.fallback.js +84 -0
- package/src/schemas/tiinex.root.v1.findings.js +19 -0
- package/src/schemas/tiinex.root.v1.presenter.js +5 -0
- package/src/schemas/tiinex.root.v1.schema.js +29 -0
- package/src/schemas/tiinex.root.v1.schema.json +24 -0
- package/src/schemas/tiinex.root.v1.schema.runtime.json +1574 -0
- package/src/schemas/tiinex.root.v1.schema.source.js +9 -0
- package/src/schemas/tiinex.root.v1.sv.i18n.json +24 -0
- package/src/schemas/tiinex.root.v1.transitions.js +1 -0
- package/src/schemas/tiinex.root.v1.validate.js +36 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.js +14 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.json +23 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.runtime.json +2027 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.source.js +9 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.js +14 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.json +23 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.runtime.json +1848 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.source.js +9 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.js +14 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.json +23 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.runtime.json +2015 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.source.js +9 -0
- package/src/schemas/workspace/tiinex.workspace.v1.capabilities.js +12 -0
- package/src/schemas/workspace/tiinex.workspace.v1.en.i18n.json +7 -0
- package/src/schemas/workspace/tiinex.workspace.v1.findings.js +5 -0
- package/src/schemas/workspace/tiinex.workspace.v1.presenter.js +27 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.js +30 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.json +23 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.runtime.json +1596 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.source.js +9 -0
- package/src/schemas/workspace/tiinex.workspace.v1.sv.i18n.json +7 -0
- package/src/schemas/workspace/tiinex.workspace.v1.transitions.js +10 -0
- package/src/schemas/workspace/tiinex.workspace.v1.validate.js +10 -0
- package/src/sources/github/github.issueTarget.js +127 -0
- package/src/sources/origin.references.js +249 -0
- package/src/sources/source.explicitTargets.js +49 -0
- package/src/sources/transport.levels.js +107 -0
- package/src/tooling/portable/adapters/cli/cli.cold-start-input.js +34 -0
- package/src/tooling/portable/adapters/cli/cli.command-input.js +455 -0
- package/src/tooling/portable/adapters/cli/cli.common-author.js +249 -0
- package/src/tooling/portable/adapters/cli/cli.common-output.js +330 -0
- package/src/tooling/portable/adapters/cli/cli.editor-assistance.js +13 -0
- package/src/tooling/portable/adapters/cli/cli.ground-materialize.js +96 -0
- package/src/tooling/portable/adapters/cli/cli.ground-recovery.js +99 -0
- package/src/tooling/portable/adapters/cli/cli.handoff-manufacture.js +345 -0
- package/src/tooling/portable/adapters/cli/cli.handoff-sibling-allocation.js +31 -0
- package/src/tooling/portable/adapters/cli/cli.help.js +80 -0
- package/src/tooling/portable/adapters/cli/cli.land.js +13 -0
- package/src/tooling/portable/adapters/cli/cli.local-output.js +72 -0
- package/src/tooling/portable/adapters/cli/cli.material-policy.js +6 -0
- package/src/tooling/portable/adapters/cli/cli.operator-bridge.js +18 -0
- package/src/tooling/portable/adapters/cli/cli.reduction-input.js +14 -0
- package/src/tooling/portable/adapters/cli/cli.run.js +434 -0
- package/src/tooling/portable/adapters/llm/llm.entrypoint.js +34 -0
- package/src/tooling/portable/adapters/node/checkpoint.verify.js +267 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.bootstrap.js +109 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.enumeration.js +94 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.js +193 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.multiRoot.js +49 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.packageParent.js +130 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.requirements.js +353 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.scope.js +147 -0
- package/src/tooling/portable/adapters/node/workspaceCarrier.manufacture.js +62 -0
- package/src/tooling/portable/assets/asset.operations.js +170 -0
- package/src/tooling/portable/audit/audit.capability.js +119 -0
- package/src/tooling/portable/bootstrap/artifact.result.selfverify.mjs +109 -0
- package/src/tooling/portable/bootstrap/bootstrap.case.mjs +43 -0
- package/src/tooling/portable/bootstrap/tiinex.llm.bootstrap.md +814 -0
- package/src/tooling/portable/bootstrap/tiinex.llm.bootstrap.pointer.json +25 -0
- package/src/tooling/portable/checkpoint/portable.checkpoint.js +89 -0
- package/src/tooling/portable/conformance/checkpoint.qualification.js +271 -0
- package/src/tooling/portable/draft/draft.create.js +389 -0
- package/src/tooling/portable/draft/draft.crud.js +175 -0
- package/src/tooling/portable/draft/draft.exact.js +173 -0
- package/src/tooling/portable/draft/draft.operations.js +265 -0
- package/src/tooling/portable/draft/draft.qualification.js +45 -0
- package/src/tooling/portable/draft/draft.set.js +193 -0
- package/src/tooling/portable/draft/draft.validation-context.js +7 -0
- package/src/tooling/portable/editor/authoring.parent.js +37 -0
- package/src/tooling/portable/editor/editor.assistance.js +221 -0
- package/src/tooling/portable/editor/staged.validation.js +96 -0
- package/src/tooling/portable/engine.facade.js +468 -0
- package/src/tooling/portable/findings.js +92 -0
- package/src/tooling/portable/grounding/grounding.capsule.js +128 -0
- package/src/tooling/portable/grounding/grounding.continuity.js +283 -0
- package/src/tooling/portable/grounding/grounding.participantAuthority.js +20 -0
- package/src/tooling/portable/grounding/grounding.planningContext.js +34 -0
- package/src/tooling/portable/grounding/grounding.readiness.authority.js +17 -0
- package/src/tooling/portable/grounding/grounding.readiness.js +316 -0
- package/src/tooling/portable/grounding/grounding.readiness.support.js +245 -0
- package/src/tooling/portable/grounding/grounding.sourceEvidence.js +71 -0
- package/src/tooling/portable/grounding/grounding.workContext.js +72 -0
- package/src/tooling/portable/grounding/grounding.workProvenance.js +153 -0
- package/src/tooling/portable/handoff/carrierLineage.js +214 -0
- package/src/tooling/portable/handoff/carrierProfile.js +54 -0
- package/src/tooling/portable/handoff/carrierProjection.js +193 -0
- package/src/tooling/portable/handoff/carrierProjection.routeQualification.js +228 -0
- package/src/tooling/portable/handoff/carrierProjection.shared.js +7 -0
- package/src/tooling/portable/handoff/carrierProjection.workspaces.js +54 -0
- package/src/tooling/portable/handoff/coldConsumerEntrypoint.js +185 -0
- package/src/tooling/portable/handoff/coldStartQualification.contract.js +184 -0
- package/src/tooling/portable/handoff/coldStartQualification.grounding.js +392 -0
- package/src/tooling/portable/handoff/coldStartQualification.js +22 -0
- package/src/tooling/portable/handoff/coldStartQualification.materials.js +364 -0
- package/src/tooling/portable/handoff/coldStartQualification.observation.js +220 -0
- package/src/tooling/portable/handoff/coldStartQualification.run.js +81 -0
- package/src/tooling/portable/handoff/coldStartQualification.shared.js +57 -0
- package/src/tooling/portable/handoff/coldStartRolePointers.js +39 -0
- package/src/tooling/portable/handoff/contextAudit.js +247 -0
- package/src/tooling/portable/handoff/contracts/tiinex.handoff.package.v1.schema.md +409 -0
- package/src/tooling/portable/handoff/handoffAuthoringPlan.js +35 -0
- package/src/tooling/portable/handoff/handoffEndpointProjection.js +61 -0
- package/src/tooling/portable/handoff/handoffLeafProjection.js +91 -0
- package/src/tooling/portable/handoff/humanOutputPresentation.js +21 -0
- package/src/tooling/portable/handoff/manufacture.js +84 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.binding.js +72 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.direct.js +160 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.indexes.js +36 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.js +247 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.projectionProvider.js +44 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.workspace.js +226 -0
- package/src/tooling/portable/handoff/materialClosure.descriptor.js +169 -0
- package/src/tooling/portable/handoff/materialClosure.inputBinding.js +372 -0
- package/src/tooling/portable/handoff/materialClosure.inputBinding.support.js +62 -0
- package/src/tooling/portable/handoff/materialClosure.materialized.js +143 -0
- package/src/tooling/portable/handoff/materialClosure.materials.js +116 -0
- package/src/tooling/portable/handoff/materialClosure.package.js +181 -0
- package/src/tooling/portable/handoff/materialClosure.plan.js +204 -0
- package/src/tooling/portable/handoff/materialClosure.readiness.js +36 -0
- package/src/tooling/portable/handoff/materialClosure.requirements.js +137 -0
- package/src/tooling/portable/handoff/operatorContextProjection.js +105 -0
- package/src/tooling/portable/handoff/pointerEntrypoint.js +138 -0
- package/src/tooling/portable/handoff/qualifiedHandoffFixture.js +34 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.build.js +321 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.closure.js +126 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.inspect.js +194 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.materials.js +207 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.projection.js +69 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.roles.js +166 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.routes.js +113 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.shared.js +87 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.workspaces.js +160 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirstPhase1.js +44 -0
- package/src/tooling/portable/handoff/recipientV2.artifactInspection.js +55 -0
- package/src/tooling/portable/handoff/recipientV2.artifacts.js +174 -0
- package/src/tooling/portable/handoff/recipientV2.coldProjection.js +24 -0
- package/src/tooling/portable/handoff/recipientV2.delivery.js +48 -0
- package/src/tooling/portable/handoff/recipientV2.endpointRolePointers.js +179 -0
- package/src/tooling/portable/handoff/recipientV2.entryContract.js +28 -0
- package/src/tooling/portable/handoff/recipientV2.humanOutput.js +78 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.helpers.js +218 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.js +194 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.pathToken.js +9 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.projection.js +58 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.workspaces.js +177 -0
- package/src/tooling/portable/handoff/recipientV2.lineage.js +142 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.build.js +147 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.constants.js +4 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.contract.js +101 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.inspect.helpers.js +126 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.inspect.js +185 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.js +12 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.shared.js +24 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.workspaceProjection.js +22 -0
- package/src/tooling/portable/handoff/recipientV2.pointer.js +40 -0
- package/src/tooling/portable/handoff/recipientV2.routeSelection.js +16 -0
- package/src/tooling/portable/handoff/recipientV2.topology.helpers.js +20 -0
- package/src/tooling/portable/handoff/recipientV2.topology.js +320 -0
- package/src/tooling/portable/handoff/recipientV2.topology.materials.js +70 -0
- package/src/tooling/portable/handoff/recipientV2.topology.workspaces.js +193 -0
- package/src/tooling/portable/handoff/recipientV2.transportManifest.js +123 -0
- package/src/tooling/portable/handoff/recipientV2.workspaceRepresentation.js +163 -0
- package/src/tooling/portable/handoff/routeArtifactConformance.js +130 -0
- package/src/tooling/portable/handoff/toolingBootstrap.js +67 -0
- package/src/tooling/portable/handoff/transportCompanion.js +175 -0
- package/src/tooling/portable/handoff/workspaceByteProvider.archive.js +95 -0
- package/src/tooling/portable/handoff/workspaceByteProvider.js +271 -0
- package/src/tooling/portable/handoff/workspaceCarrier.manufacture.js +93 -0
- package/src/tooling/portable/handoff/workspaceLandingPlan.js +142 -0
- package/src/tooling/portable/handoff/workspacePackageSources.js +105 -0
- package/src/tooling/portable/handoff/workspaceQualifiedReference.js +10 -0
- package/src/tooling/portable/handoff/workspaceSourceIdentity.js +52 -0
- package/src/tooling/portable/handoff/workspaceTargetConformance.js +134 -0
- package/src/tooling/portable/host/host.capabilities.js +181 -0
- package/src/tooling/portable/host/tool.bindings.js +357 -0
- package/src/tooling/portable/host/tool.receiptNormalization.js +141 -0
- package/src/tooling/portable/index.js +52 -0
- package/src/tooling/portable/input/node.input.js +184 -0
- package/src/tooling/portable/input/portable.input.js +249 -0
- package/src/tooling/portable/lifecycle/lifecycle.action.js +11 -0
- package/src/tooling/portable/lifecycle/lifecycle.material.js +173 -0
- package/src/tooling/portable/lifecycle/lifecycle.operations.js +34 -0
- package/src/tooling/portable/lifecycle/lifecycle.readiness.js +247 -0
- package/src/tooling/portable/lineage/lineage.integrity.apply.audit.js +22 -0
- package/src/tooling/portable/lineage/lineage.integrity.apply.evidence.js +36 -0
- package/src/tooling/portable/lineage/lineage.integrity.apply.js +306 -0
- package/src/tooling/portable/lineage/lineage.integrity.apply.structure.js +178 -0
- package/src/tooling/portable/lineage/lineage.integrity.plan.js +377 -0
- package/src/tooling/portable/lineage/lineage.integrity.projection.human.js +82 -0
- package/src/tooling/portable/lineage/lineage.integrity.projection.js +349 -0
- package/src/tooling/portable/lineage/lineage.operations.js +32 -0
- package/src/tooling/portable/lineage/lineage.print.js +398 -0
- package/src/tooling/portable/lineage/lineage.print.render.js +88 -0
- package/src/tooling/portable/lineage/lineage.print.utils.js +58 -0
- package/src/tooling/portable/lineage/lineage.publicationProviderReceipts.js +141 -0
- package/src/tooling/portable/lineage/lineage.publicationQualification.js +183 -0
- package/src/tooling/portable/lineage/lineage.search.js +301 -0
- package/src/tooling/portable/live/live.artifact.js +192 -0
- package/src/tooling/portable/live/live.export.js +107 -0
- package/src/tooling/portable/live/live.lineage.closure.js +71 -0
- package/src/tooling/portable/live/live.lineage.js +338 -0
- package/src/tooling/portable/live/live.protocol.js +181 -0
- package/src/tooling/portable/materialization/durable.materialize.js +162 -0
- package/src/tooling/portable/materialization/epistemic.plan.js +239 -0
- package/src/tooling/portable/materialization/loaded.parent.js +54 -0
- package/src/tooling/portable/materialization/materialization.facade.js +30 -0
- package/src/tooling/portable/operation.catalog.js +393 -0
- package/src/tooling/portable/operation.catalog.package.js +183 -0
- package/src/tooling/portable/operation.result.js +25 -0
- package/src/tooling/portable/orchestration/task.prepare.js +191 -0
- package/src/tooling/portable/output/artifact.result.package.js +308 -0
- package/src/tooling/portable/output/deterministic.zip.js +88 -0
- package/src/tooling/portable/output/node.artifact-set.js +223 -0
- package/src/tooling/portable/output/node.draft.js +41 -0
- package/src/tooling/portable/output/node.zip.js +39 -0
- package/src/tooling/portable/output/recipientV2.zip.js +59 -0
- package/src/tooling/portable/overview/blockingCue.js +16 -0
- package/src/tooling/portable/overview/operatingOverview.js +413 -0
- package/src/tooling/portable/package/generation.binding.js +314 -0
- package/src/tooling/portable/package/generation.binding.projection.js +128 -0
- package/src/tooling/portable/package/material.graph.js +236 -0
- package/src/tooling/portable/package/runtime.package.js +321 -0
- package/src/tooling/portable/package/schema.transition.companion.js +196 -0
- package/src/tooling/portable/package/semantic.package.graph.js +272 -0
- package/src/tooling/portable/package/semantic.package.js +203 -0
- package/src/tooling/portable/package/semantic.package.schema-resolution.js +158 -0
- package/src/tooling/portable/package/semantic.package.transition-registry.js +189 -0
- package/src/tooling/portable/package/semantic.package.types.js +18 -0
- package/src/tooling/portable/providers/schema.bootstrap.provenance.js +10 -0
- package/src/tooling/portable/providers/schema.provider.qualification.js +52 -0
- package/src/tooling/portable/providers/schema.providers.js +458 -0
- package/src/tooling/portable/publication/runtime.publication.js +53 -0
- package/src/tooling/portable/qualification.js +150 -0
- package/src/tooling/portable/reduction/reduction.composition.js +229 -0
- package/src/tooling/portable/reduction/reduction.eligibility.helpers.js +258 -0
- package/src/tooling/portable/reduction/reduction.eligibility.js +191 -0
- package/src/tooling/portable/reduction/reduction.operations.js +30 -0
- package/src/tooling/portable/reduction/reduction.preflight.js +85 -0
- package/src/tooling/portable/reduction/reduction.shared.js +173 -0
- package/src/tooling/portable/schema/bootstrap/canonical.pack.js +24 -0
- package/src/tooling/portable/schema/bootstrap/docs-3988951208eb9a8926e84ab42625d4b42fa00c2d/party/role/tiinex.party.role.v1.schema.md +289 -0
- package/src/tooling/portable/schema/bootstrap/docs-3988951208eb9a8926e84ab42625d4b42fa00c2d/validation/report/tiinex.validation.report.v1.schema.md +300 -0
- package/src/tooling/portable/schema/bootstrap/qualified-local-root/tiinex.root.v1.runtime-projection.json +48 -0
- package/src/tooling/portable/schema/bootstrap/qualified-local-root/tiinex.root.v1.schema.md +865 -0
- package/src/tooling/portable/schema/contract.compile.js +406 -0
- package/src/tooling/portable/schema/contract.compile.utils.js +9 -0
- package/src/tooling/portable/schema/contract.constraints.js +117 -0
- package/src/tooling/portable/schema/contract.envelope.validate.js +177 -0
- package/src/tooling/portable/schema/contract.field-domain.compile.js +399 -0
- package/src/tooling/portable/schema/contract.field-domain.js +247 -0
- package/src/tooling/portable/schema/contract.field-shape.compile.js +34 -0
- package/src/tooling/portable/schema/contract.inheritance.inline.js +103 -0
- package/src/tooling/portable/schema/contract.inheritance.js +210 -0
- package/src/tooling/portable/schema/contract.inheritance.record.js +76 -0
- package/src/tooling/portable/schema/contract.machine-shape.js +309 -0
- package/src/tooling/portable/schema/contract.project.js +81 -0
- package/src/tooling/portable/schema/contract.semantic-resolution.js +82 -0
- package/src/tooling/portable/schema/contract.validate.js +0 -0
- package/src/tooling/portable/schema/lexical.shape.v1.js +338 -0
- package/src/tooling/portable/schema/llm.companion.js +108 -0
- package/src/tooling/portable/schema/named.declarations.js +162 -0
- package/src/tooling/portable/schema/ordinary.contract.js +193 -0
- package/src/tooling/portable/schema/ordinary.fields.js +205 -0
- package/src/tooling/portable/schema/qualifiedLocalRoot.projection.js +70 -0
- package/src/tooling/portable/schema/qualifiedLocalRoot.runtime.js +170 -0
- package/src/tooling/portable/schema/schema.contract.js +465 -0
- package/src/tooling/portable/schema/schema.guide.js +326 -0
- package/src/tooling/portable/schema/schema.snapshot.js +119 -0
- package/src/tooling/portable/session/portable.session.js +145 -0
- package/src/tooling/portable/transfer/transfer.plan.js +102 -0
- package/src/transitions/record.transitions.js +484 -0
- package/src/transitions/transition.validate.js +129 -0
- package/src/validation/findings.js +76 -0
- package/src/validation/validateArtifact.js +216 -0
- package/src/workspaces/workspace.entrypointCapability.js +44 -0
- package/src/workspaces/workspace.materialRole.js +242 -0
- package/src/workspaces/workspace.recordPaths.js +426 -0
- package/tools/tiinex-portable.mjs +6 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { portableFinding } from '../findings.js';
|
|
2
|
+
import {
|
|
3
|
+
PORTABLE_REDUCTION_COMPOSITION_SCHEMA_ID,
|
|
4
|
+
identity,
|
|
5
|
+
linkPath,
|
|
6
|
+
locatorForRecord,
|
|
7
|
+
locatorFromValue,
|
|
8
|
+
markdownLinks,
|
|
9
|
+
normalizePath,
|
|
10
|
+
qualifyRecord,
|
|
11
|
+
qualifyReductionRecord,
|
|
12
|
+
resolveUniqueRecord,
|
|
13
|
+
safeCode,
|
|
14
|
+
sectionText,
|
|
15
|
+
sha256Text,
|
|
16
|
+
stableJson
|
|
17
|
+
} from './reduction.shared.js';
|
|
18
|
+
|
|
19
|
+
const MAX_COMPOSITION_NODES = 128;
|
|
20
|
+
|
|
21
|
+
export function projectReductionComposition(input = {}, material = {}) {
|
|
22
|
+
const records = material.records || [];
|
|
23
|
+
const requestedPath = normalizePath(input.reductionArtifactPath || input.reductionArtifact || input.reduction || '');
|
|
24
|
+
const rootResolution = resolveUniqueRecord(records, requestedPath);
|
|
25
|
+
const root = rootResolution.record;
|
|
26
|
+
const findings = [];
|
|
27
|
+
const blockers = [];
|
|
28
|
+
const missingEvidence = [];
|
|
29
|
+
const ambiguities = [];
|
|
30
|
+
const nodes = new Map();
|
|
31
|
+
const hops = [];
|
|
32
|
+
const sourceReferences = normalizeSourceReferences(input.compositionSources || input.sourceReferences || input.reductionSources || []);
|
|
33
|
+
const immutableSources = normalizeList(input.immutableSources || input.sources || []);
|
|
34
|
+
const lossFacts = normalizeList(input.lossFacts || input.loss || []);
|
|
35
|
+
|
|
36
|
+
if (!root) missingEvidence.push(issue(rootResolution.state === 'ambiguous' ? 'reduction-artifact-ambiguous' : 'reduction-artifact-missing', requestedPath || '(empty)'));
|
|
37
|
+
else if (String(root.schemaId || '') !== 'tiinex.reduction.v1') blockers.push(issue('reduction-schema-mismatch', String(root.schemaId || 'missing')));
|
|
38
|
+
|
|
39
|
+
const rootQualification = root ? qualifyReductionRecord(root, records) : null;
|
|
40
|
+
if (root && !rootQualification.qualified) missingEvidence.push(issue('reduction-unqualified', rootQualification.reasons.join(', ')));
|
|
41
|
+
|
|
42
|
+
if (root && rootQualification.qualified) visitReduction(root, [], 0);
|
|
43
|
+
|
|
44
|
+
const orderedNodes = [...nodes.values()].sort((a, b) => a.path.localeCompare(b.path));
|
|
45
|
+
const orderedHops = [...hops].sort((a, b) => `${a.from}|${a.to}`.localeCompare(`${b.from}|${b.to}`));
|
|
46
|
+
const inheritedLoss = inheritedLossProjection(root?.path || requestedPath, orderedNodes, orderedHops);
|
|
47
|
+
const rootLoss = root ? lossProjectionFor(root, lossFacts) : null;
|
|
48
|
+
const knownLoss = [rootLoss, ...inheritedLoss].filter((item) => item && item.state === 'known-irrecoverable');
|
|
49
|
+
const unresolvedLoss = [rootLoss, ...inheritedLoss].filter((item) => item && item.state === 'unresolved');
|
|
50
|
+
const terminalSources = orderedNodes.filter((node) => node.kind !== 'reduction' && !orderedHops.some((hop) => hop.from === node.path));
|
|
51
|
+
const unrecoverableTerminal = terminalSources.filter((node) => node.recovery?.qualified !== true);
|
|
52
|
+
|
|
53
|
+
if (unrecoverableTerminal.length) missingEvidence.push(issue('immutable-source-recovery-unresolved', unrecoverableTerminal.map((item) => item.path).join(', ')));
|
|
54
|
+
if (unresolvedLoss.length) ambiguities.push(issue('reduction-loss-unresolved', unresolvedLoss.map((item) => item.target).join(', ')));
|
|
55
|
+
if (nodes.size >= MAX_COMPOSITION_NODES) ambiguities.push(issue('composition-node-limit-reached', String(MAX_COMPOSITION_NODES)));
|
|
56
|
+
|
|
57
|
+
const state = blockers.length ? 'blocked'
|
|
58
|
+
: missingEvidence.length || ambiguities.length ? 'unresolved'
|
|
59
|
+
: knownLoss.length ? 'qualified-with-known-loss'
|
|
60
|
+
: rootQualification?.qualified ? 'qualified' : 'unresolved';
|
|
61
|
+
const expansionState = blockers.length ? 'blocked'
|
|
62
|
+
: missingEvidence.length || ambiguities.length ? 'unresolved'
|
|
63
|
+
: knownLoss.length ? 'known-loss'
|
|
64
|
+
: rootQualification?.qualified ? 'qualified-navigation' : 'unresolved';
|
|
65
|
+
|
|
66
|
+
for (const item of blockers) findings.push(portableFinding('error', `portable.reduction-composition.${safeCode(item.code)}`, item.detail, { ref: requestedPath }));
|
|
67
|
+
for (const item of missingEvidence) findings.push(portableFinding('warning', `portable.reduction-composition.${safeCode(item.code)}`, item.detail, { ref: requestedPath }));
|
|
68
|
+
for (const item of ambiguities) findings.push(portableFinding('warning', `portable.reduction-composition.${safeCode(item.code)}`, item.detail, { ref: requestedPath }));
|
|
69
|
+
|
|
70
|
+
const projection = Object.freeze({
|
|
71
|
+
schema: PORTABLE_REDUCTION_COMPOSITION_SCHEMA_ID,
|
|
72
|
+
state,
|
|
73
|
+
currentReduction: root ? Object.freeze({ ...identity(root), digest: sha256Text(root.markdown || ''), qualification: rootQualification }) : null,
|
|
74
|
+
immediateSources: Object.freeze(orderedHops.filter((hop) => hop.from === normalizePath(root?.path || requestedPath))),
|
|
75
|
+
hops: Object.freeze(orderedHops),
|
|
76
|
+
nodes: Object.freeze(orderedNodes),
|
|
77
|
+
carryForward: root ? Object.freeze({ local: sectionText(root.markdown || '', 'Carry-Forward State'), basis: 'exact-qualified-reduction-body-section' }) : null,
|
|
78
|
+
lossAndUncertainty: Object.freeze({ local: rootLoss, inherited: Object.freeze(inheritedLoss), knownIrrecoverable: Object.freeze(knownLoss), unresolved: Object.freeze(unresolvedLoss) }),
|
|
79
|
+
expansion: Object.freeze({
|
|
80
|
+
state: expansionState,
|
|
81
|
+
terminalSources: Object.freeze(terminalSources.map((item) => Object.freeze({ path: item.path, recovery: item.recovery }))),
|
|
82
|
+
knownLoss: Object.freeze(knownLoss),
|
|
83
|
+
ambiguities: Object.freeze(ambiguities),
|
|
84
|
+
missingEvidence: Object.freeze(missingEvidence),
|
|
85
|
+
boundary: 'Deterministic navigation follows explicit qualified Source Context/source-reference edges. It never reconstructs omitted bytes from a Reduction alone.'
|
|
86
|
+
}),
|
|
87
|
+
qualificationBasis: Object.freeze({ reduction: rootQualification, sourceEdges: 'explicit Source Context links or explicit qualified sourceReferences only', sourceQualification: 'each loaded source is independently audited; downstream qualification never repairs an upstream source' }),
|
|
88
|
+
blockers: Object.freeze(blockers),
|
|
89
|
+
missingEvidence: Object.freeze(missingEvidence),
|
|
90
|
+
ambiguities: Object.freeze(ambiguities),
|
|
91
|
+
fingerprint: sha256Text(stableJson({ root: root ? sha256Text(root.markdown || '') : '', hops: orderedHops.map((hop) => ({ from: hop.from, to: hop.to, relationQualification: hop.relationQualification })), nodes: orderedNodes.map((node) => ({ path: node.path, digest: node.digest, qualification: node.qualification?.state, recovery: node.recovery })) })),
|
|
92
|
+
boundary: Object.freeze({
|
|
93
|
+
adapterNeutral: true,
|
|
94
|
+
ordinaryReductionAuthorityOnly: true,
|
|
95
|
+
sourceMutation: false,
|
|
96
|
+
destructiveApplyAuthorized: false,
|
|
97
|
+
taskCompletionAuthority: false,
|
|
98
|
+
releaseReadinessAuthority: false,
|
|
99
|
+
placementIsNotSourceAuthority: true,
|
|
100
|
+
downstreamValidationRepairsUpstream: false
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
return Object.freeze({ ...projection, findings: Object.freeze(findings) });
|
|
104
|
+
|
|
105
|
+
function visitReduction(record, stack, depth) {
|
|
106
|
+
const recordPath = normalizePath(record.path || '');
|
|
107
|
+
if (depth >= MAX_COMPOSITION_NODES) return;
|
|
108
|
+
if (stack.includes(recordPath)) { ambiguities.push(issue('reduction-source-cycle', [...stack, recordPath].join(' -> '))); return; }
|
|
109
|
+
const qualification = qualifyReductionRecord(record, records);
|
|
110
|
+
const loss = lossProjectionFor(record, lossFacts);
|
|
111
|
+
const recovery = locatorForRecord(record, immutableSources);
|
|
112
|
+
putNode(record, 'reduction', qualification, recovery, loss);
|
|
113
|
+
if (!qualification.qualified) { missingEvidence.push(issue('upstream-reduction-unqualified', `${recordPath}: ${qualification.reasons.join(', ')}`)); return; }
|
|
114
|
+
const references = sourceReferencesFor(record, sourceReferences);
|
|
115
|
+
for (const reference of references) {
|
|
116
|
+
const targetPath = normalizePath(reference.path || linkPath(reference.target || ''));
|
|
117
|
+
const resolution = resolveUniqueRecord(records, targetPath);
|
|
118
|
+
if (resolution.state === 'ambiguous') { ambiguities.push(issue('immediate-source-ambiguous', `${recordPath} -> ${targetPath}`)); continue; }
|
|
119
|
+
if (!resolution.record) {
|
|
120
|
+
const locator = locatorFromValue(reference.target || reference.locator || reference);
|
|
121
|
+
if (!locator.qualified) { missingEvidence.push(issue('immediate-source-missing', `${recordPath} -> ${targetPath || reference.target || '(empty)'}`)); continue; }
|
|
122
|
+
const externalPath = normalizePath(locator.path);
|
|
123
|
+
putExternalNode(externalPath, locator, reference);
|
|
124
|
+
hops.push(hop(recordPath, externalPath, reference, 'material', 'qualified-external-immutable'));
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
const source = resolution.record;
|
|
128
|
+
const sourcePath = normalizePath(source.path || '');
|
|
129
|
+
const relationQualification = reference.qualification === 'unresolved' ? 'unresolved' : 'qualified';
|
|
130
|
+
if (relationQualification !== 'qualified') { ambiguities.push(issue('source-edge-unqualified', `${recordPath} -> ${sourcePath}`)); continue; }
|
|
131
|
+
const isReduction = String(source.schemaId || '') === 'tiinex.reduction.v1';
|
|
132
|
+
const qualificationResult = isReduction ? qualifyReductionRecord(source, records) : qualifyRecord(source);
|
|
133
|
+
const locator = locatorForRecord(source, immutableSources);
|
|
134
|
+
const sourceLoss = isReduction ? lossProjectionFor(source, lossFacts) : null;
|
|
135
|
+
putNode(source, isReduction ? 'reduction' : 'material', qualificationResult, locator, sourceLoss);
|
|
136
|
+
hops.push(hop(recordPath, sourcePath, reference, isReduction ? 'reduction' : 'material', qualificationResult.qualified ? 'qualified' : 'unresolved'));
|
|
137
|
+
if (!qualificationResult.qualified) {
|
|
138
|
+
missingEvidence.push(issue(isReduction ? 'upstream-reduction-unqualified' : 'immediate-source-unqualified', `${sourcePath}: ${(qualificationResult.reasons || []).join(', ')}`));
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (isReduction) visitReduction(source, [...stack, recordPath], depth + 1);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function putNode(record, kind, qualification, recovery, loss) {
|
|
146
|
+
const recordPath = normalizePath(record.path || '');
|
|
147
|
+
if (!recordPath || nodes.has(recordPath)) return;
|
|
148
|
+
nodes.set(recordPath, Object.freeze({
|
|
149
|
+
...identity(record),
|
|
150
|
+
path: recordPath,
|
|
151
|
+
kind,
|
|
152
|
+
digest: sha256Text(record.markdown || ''),
|
|
153
|
+
qualification,
|
|
154
|
+
recovery,
|
|
155
|
+
carryForward: kind === 'reduction' ? sectionText(record.markdown || '', 'Carry-Forward State') : '',
|
|
156
|
+
lossAndUncertainty: kind === 'reduction' ? Object.freeze({ declared: sectionText(record.markdown || '', 'Loss And Uncertainty'), fact: loss }) : null
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
function putExternalNode(externalPath, locator, reference) {
|
|
160
|
+
if (nodes.has(externalPath)) return;
|
|
161
|
+
nodes.set(externalPath, Object.freeze({ id: externalPath, path: externalPath, title: reference.label || externalPath, schemaId: '', kind: 'material', digest: locator.digest || '', qualification: Object.freeze({ state: 'qualified', qualified: true, reasons: Object.freeze([]) }), recovery: locator, carryForward: '', lossAndUncertainty: null }));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function sourceReferencesFor(record = {}, explicit = []) {
|
|
166
|
+
const recordPath = normalizePath(record.path || '');
|
|
167
|
+
const supplied = explicit.filter((item) => sameKey(item.from || item.reduction || item.currentReduction || '', recordPath));
|
|
168
|
+
const fromMarkdown = markdownLinks(sectionText(record.markdown || '', 'Source Context')).map((link) => Object.freeze({ ...link, from: recordPath, qualification: 'qualified', basis: 'explicit-qualified-reduction-source-context-link' }));
|
|
169
|
+
const merged = [...supplied, ...fromMarkdown];
|
|
170
|
+
const seen = new Set();
|
|
171
|
+
return merged.filter((item) => {
|
|
172
|
+
const key = `${normalizePath(item.path || linkPath(item.target || ''))}|${String(item.target || '')}`;
|
|
173
|
+
if (!key || seen.has(key)) return false;
|
|
174
|
+
seen.add(key); return true;
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function normalizeSourceReferences(value) {
|
|
179
|
+
return normalizeList(value).map((item) => typeof item === 'string'
|
|
180
|
+
? Object.freeze({ from: '', target: item, path: linkPath(item), qualification: 'unresolved', basis: '' })
|
|
181
|
+
: Object.freeze({
|
|
182
|
+
from: normalizePath(item.from || item.reduction || item.currentReduction || ''),
|
|
183
|
+
target: String(item.target || item.source || item.reference || item.path || ''),
|
|
184
|
+
path: normalizePath(item.path || linkPath(item.target || item.source || item.reference || '')),
|
|
185
|
+
label: String(item.label || ''),
|
|
186
|
+
qualification: String(item.qualification || item.semanticState || 'qualified'),
|
|
187
|
+
basis: item.basis || '',
|
|
188
|
+
locator: item.locator || null
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function lossProjectionFor(record = {}, facts = []) {
|
|
193
|
+
const target = normalizePath(record.path || '');
|
|
194
|
+
const matches = facts.filter((item) => sameKey(item.target || item.reduction || item.path || '', target));
|
|
195
|
+
const declared = sectionText(record.markdown || '', 'Loss And Uncertainty');
|
|
196
|
+
if (matches.length !== 1) return Object.freeze({ target, state: matches.length > 1 ? 'unresolved' : 'declared-unclassified', qualification: matches.length > 1 ? 'unresolved' : 'declared-only', detail: declared, basis: matches.length > 1 ? 'multiple normalized loss facts' : 'exact Reduction Loss And Uncertainty body retained without lexical interpretation' });
|
|
197
|
+
const fact = matches[0];
|
|
198
|
+
const state = String(fact.state || fact.lossState || 'unresolved');
|
|
199
|
+
const qualified = String(fact.qualification || fact.semanticState || '') === 'qualified' && nonEmptyBasis(fact.basis);
|
|
200
|
+
return Object.freeze({ target, state: qualified ? state : 'unresolved', qualification: qualified ? 'qualified' : 'unresolved', detail: String(fact.detail || declared), basis: fact.basis || '' });
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function inheritedLossProjection(rootPath, nodes, hops) {
|
|
204
|
+
const descendants = new Set();
|
|
205
|
+
const queue = [normalizePath(rootPath)];
|
|
206
|
+
while (queue.length) {
|
|
207
|
+
const current = queue.shift();
|
|
208
|
+
for (const hop of hops.filter((item) => item.from === current)) {
|
|
209
|
+
if (descendants.has(hop.to)) continue;
|
|
210
|
+
descendants.add(hop.to); queue.push(hop.to);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return nodes.filter((node) => descendants.has(node.path) && node.kind === 'reduction' && node.lossAndUncertainty?.fact).map((node) => node.lossAndUncertainty.fact);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function hop(from, to, reference, kind, sourceQualification) {
|
|
217
|
+
return Object.freeze({
|
|
218
|
+
from: normalizePath(from), to: normalizePath(to), sourceKind: kind,
|
|
219
|
+
relationQualification: String(reference.qualification || 'qualified') === 'qualified' ? 'qualified' : 'unresolved',
|
|
220
|
+
sourceQualification,
|
|
221
|
+
basis: reference.basis || 'explicit qualified Source Context link',
|
|
222
|
+
target: String(reference.target || reference.path || '')
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function issue(code, detail) { return Object.freeze({ code: String(code), detail: String(detail || '') }); }
|
|
227
|
+
function normalizeList(value) { return Array.isArray(value) ? value : value && typeof value === 'object' ? Object.entries(value).map(([target, item]) => typeof item === 'object' && item !== null ? ({ target, ...item }) : ({ target, state: item })) : []; }
|
|
228
|
+
function sameKey(a, b) { const left = normalizePath(a); const right = normalizePath(b); return Boolean(left && right && (left === right || left.endsWith(`/${right}`) || right.endsWith(`/${left}`))); }
|
|
229
|
+
function nonEmptyBasis(value) { return Array.isArray(value) ? value.length > 0 : typeof value === 'string' ? Boolean(value.trim()) : Boolean(value && typeof value === 'object' && Object.keys(value).length); }
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { inferRecordMaterialRole, isDiscoveryWorkLeafEligible, MaterialRole } from '../../../workspaces/workspace.materialRole.js';
|
|
2
|
+
import {
|
|
3
|
+
PORTABLE_REDUCTION_DESTRUCTIVE_CONTRACT, identity,
|
|
4
|
+
locatorForRecord, locatorFromValue, normalizePath, resolveUniqueRecord, samePath, sha256Text, stableJson
|
|
5
|
+
} from './reduction.shared.js';
|
|
6
|
+
|
|
7
|
+
const FIXTURE_RE = /(^|\/)(?:fixtures?|test-fixtures?|__fixtures__)(\/|$)|\.fixture\./i;
|
|
8
|
+
const SHA256_RE = /^[0-9a-f]{64}$/i;
|
|
9
|
+
const GIT_COMMIT_RE = /^[0-9a-f]{40}$/i;
|
|
10
|
+
const CLEAR_CURRENTNESS = new Set(['closed', 'resolved', 'historical-closed', 'superseded-resolved']);
|
|
11
|
+
const OPERATIVE_CURRENTNESS = new Set(['operative', 'open', 'active', 'blocked', 'incomplete', 'disputed']);
|
|
12
|
+
|
|
13
|
+
export function assessCandidateIdentity(candidate, records, immutableSources, snapshots) {
|
|
14
|
+
const resolution = resolveUniqueRecord(records, candidate.path);
|
|
15
|
+
const record = resolution.record;
|
|
16
|
+
const classification = classifyCandidate(candidate, record);
|
|
17
|
+
let repository = candidate.repository;
|
|
18
|
+
let workspace = candidate.workspace;
|
|
19
|
+
let locator = record ? locatorForRecord(record, immutableSources) : locatorFromValue(candidate.immutableSource || {});
|
|
20
|
+
if (!locator.qualified && record && candidate.repository) {
|
|
21
|
+
const snapshot = snapshots.find((item) => item.qualified && item.repository === candidate.repository && (!candidate.workspace || item.workspace === candidate.workspace));
|
|
22
|
+
if (snapshot?.commit) locator = locatorFromValue({ repository: candidate.repository, commit: snapshot.commit, workspace: candidate.workspace, path: record.path, immutable: true, basis: 'candidate identity plus exact bound snapshot' });
|
|
23
|
+
}
|
|
24
|
+
if (!repository && locator.qualified) repository = locator.repository;
|
|
25
|
+
if (!workspace && locator.qualified) workspace = locator.workspace;
|
|
26
|
+
const actualDigest = record ? sha256Text(record.markdown || '') : '';
|
|
27
|
+
const expectedDigest = String(candidate.expectedDigest || '').replace(/^sha256:/, '').toLowerCase();
|
|
28
|
+
const preimage = !expectedDigest ? Object.freeze({ state: 'not-supplied', expectedDigest: '', actualDigest })
|
|
29
|
+
: !record ? Object.freeze({ state: 'unresolved', expectedDigest, actualDigest: '' })
|
|
30
|
+
: expectedDigest === actualDigest ? Object.freeze({ state: 'matched', expectedDigest, actualDigest })
|
|
31
|
+
: Object.freeze({ state: 'mismatch', expectedDigest, actualDigest });
|
|
32
|
+
return Object.freeze({ ...candidate, repository, workspace, identityState: resolution.state, record: record ? identity(record) : null, classification, immutableLocator: locator, preimage });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function classifyCandidate(candidate, record) {
|
|
36
|
+
const explicitKind = String(candidate.classification || candidate.kind || '').toLowerCase();
|
|
37
|
+
const explicitQualified = String(candidate.classificationQualification || candidate.qualification || '') === 'qualified' && nonEmptyBasis(candidate.classificationBasis || candidate.basis);
|
|
38
|
+
const fixture = candidate.fixture === true || candidate.fixtureRequired === true || FIXTURE_RE.test(candidate.path);
|
|
39
|
+
const inferredSemantic = Boolean(record && isDiscoveryWorkLeafEligible(record));
|
|
40
|
+
if (explicitKind) {
|
|
41
|
+
if (!explicitQualified) return Object.freeze({ state: 'unresolved', kind: explicitKind, basis: 'explicit classification is not qualified' });
|
|
42
|
+
if (record && explicitKind === 'semantic' && !inferredSemantic) return Object.freeze({ state: 'unresolved', kind: explicitKind, basis: 'explicit semantic classification conflicts with loaded material role' });
|
|
43
|
+
if (record && explicitKind === 'fixture' && !fixture) return Object.freeze({ state: 'unresolved', kind: explicitKind, basis: 'explicit fixture classification conflicts with loaded material' });
|
|
44
|
+
return Object.freeze({ state: 'qualified', kind: explicitKind === 'transport' ? 'transport' : explicitKind === 'fixture' ? 'fixture' : explicitKind === 'semantic' ? 'semantic' : 'nonsemantic', basis: candidate.classificationBasis || candidate.basis });
|
|
45
|
+
}
|
|
46
|
+
if (fixture) return Object.freeze({ state: 'qualified', kind: 'fixture', basis: 'declared fixture flag/path classification' });
|
|
47
|
+
if (inferredSemantic) return Object.freeze({ state: 'qualified', kind: 'semantic', basis: 'loaded qualified semantic-work material role' });
|
|
48
|
+
if (record) {
|
|
49
|
+
const role = inferRecordMaterialRole(record);
|
|
50
|
+
if ([MaterialRole.schemaDefinition, MaterialRole.supporting, MaterialRole.workspaceArtifact].includes(role)) return Object.freeze({ state: 'qualified', kind: 'nonsemantic', basis: `loaded material role:${role}` });
|
|
51
|
+
}
|
|
52
|
+
return Object.freeze({ state: 'unresolved', kind: 'unknown', basis: 'semantic/transport/fixture classification is unresolved' });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function parentGraph(records, lineage, proofs) {
|
|
56
|
+
const byId = new Map(records.map((record) => [String(record.id || record.path || ''), record]));
|
|
57
|
+
const parentsByChild = new Map();
|
|
58
|
+
for (const edge of lineage.edges || []) {
|
|
59
|
+
if (edge.kind !== 'parent' || edge.status !== 'verified' || !edge.from || !edge.to) continue;
|
|
60
|
+
const parent = byId.get(String(edge.from)); const child = byId.get(String(edge.to));
|
|
61
|
+
if (!parent || !child) continue;
|
|
62
|
+
addParentEdge(parentsByChild, normalizePath(child.path), Object.freeze({ child: normalizePath(child.path), parent: normalizePath(parent.path), state: 'qualified', basis: 'verified loaded declared Parent edge', source: 'loaded-lineage' }));
|
|
63
|
+
}
|
|
64
|
+
for (const proof of proofs) if (proof.qualified) addParentEdge(parentsByChild, proof.child, Object.freeze({ child: proof.child, parent: proof.parent, state: 'qualified', basis: proof.basis, source: 'explicit-qualified-parent-proof' }));
|
|
65
|
+
return Object.freeze({ parentsByChild });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function addParentEdge(map, child, edge) { const list = map.get(child) || []; list.push(edge); map.set(child, list); }
|
|
69
|
+
export function hasDisappearingChild(record, graph, disappearingPaths) {
|
|
70
|
+
const parentPath = normalizePath(record.path || '');
|
|
71
|
+
for (const [child, edges] of graph.parentsByChild.entries()) if (disappearingPaths.has(child) && edges.some((edge) => samePath(edge.parent, parentPath))) return true;
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function proveParentClosure({ leaf, boundaryPath, graph, disappearingPaths, records, sourceLocators, endpointProofs, snapshots }) {
|
|
76
|
+
const start = normalizePath(leaf.path || ''); const boundary = normalizePath(boundaryPath || '');
|
|
77
|
+
if (!boundary) return unresolvedProof('historical-closure-endpoint-required');
|
|
78
|
+
if (disappearingPaths.has(boundary)) return blockedProof('closure-endpoint-does-not-survive');
|
|
79
|
+
const pathItems = [start]; const seen = new Set([start]); let current = start;
|
|
80
|
+
while (!samePath(current, boundary)) {
|
|
81
|
+
const edges = (graph.parentsByChild.get(current) || []).filter((edge) => edge.state === 'qualified');
|
|
82
|
+
const distinct = uniqueBy(edges, (edge) => normalizePath(edge.parent));
|
|
83
|
+
if (!distinct.length) return unresolvedProof('parent-hop-missing-or-unqualified', pathItems);
|
|
84
|
+
if (distinct.length > 1) return ambiguousProof('parent-hop-ambiguous', pathItems);
|
|
85
|
+
const parent = normalizePath(distinct[0].parent);
|
|
86
|
+
if (!parent || seen.has(parent)) return ambiguousProof('parent-closure-cycle-or-ambiguity', pathItems);
|
|
87
|
+
pathItems.push(parent); seen.add(parent);
|
|
88
|
+
if (!samePath(parent, boundary) && !disappearingPaths.has(parent)) return blockedProof('closure-endpoint-not-nearest-surviving-boundary', pathItems);
|
|
89
|
+
current = parent;
|
|
90
|
+
if (pathItems.length > 128) return ambiguousProof('parent-closure-limit-reached', pathItems);
|
|
91
|
+
}
|
|
92
|
+
const locatorItems = [];
|
|
93
|
+
for (const itemPath of pathItems) {
|
|
94
|
+
const record = resolveUniqueRecord(records, itemPath).record;
|
|
95
|
+
let locator = record ? locatorForRecord(record, sourceLocators) : locatorForExternal(itemPath, sourceLocators, endpointProofs);
|
|
96
|
+
if (!locator.qualified) return unresolvedProof('parent-hop-immutable-source-unresolved', pathItems);
|
|
97
|
+
const snapshotMatches = snapshots.filter((snapshot) => snapshot.qualified && snapshotMatchesScope(snapshot, locator));
|
|
98
|
+
if (!snapshotMatches.length) return unresolvedProof('parent-hop-snapshot-unresolved', pathItems);
|
|
99
|
+
if (snapshotMatches.length > 1) return ambiguousProof('parent-hop-snapshot-ambiguous', pathItems);
|
|
100
|
+
if (snapshotMatches[0].commit && locator.commit && snapshotMatches[0].commit !== locator.commit) return unresolvedProof('parent-hop-snapshot-ref-mismatch', pathItems);
|
|
101
|
+
locatorItems.push(locator);
|
|
102
|
+
}
|
|
103
|
+
const repositories = [...new Set(locatorItems.map((item) => item.repository).filter(Boolean))];
|
|
104
|
+
return Object.freeze({ state: 'qualified', qualified: true, code: '', path: Object.freeze(pathItems), locators: Object.freeze(locatorItems), repositories: Object.freeze(repositories), crossRepository: repositories.length > 1, nearestSurvivingBoundary: boundary });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function locatorForExternal(itemPath, sources, endpoints) {
|
|
108
|
+
const source = sources.find((item) => samePath(item.path || item.target || '', itemPath));
|
|
109
|
+
if (source) return locatorFromValue(source);
|
|
110
|
+
const endpoint = endpoints.find((item) => samePath(item.path || item.target || '', itemPath));
|
|
111
|
+
return endpoint ? locatorFromValue(endpoint.locator || endpoint) : locatorFromValue({});
|
|
112
|
+
}
|
|
113
|
+
function unresolvedProof(code, pathItems = []) { return Object.freeze({ state: 'unresolved', qualified: false, code, path: Object.freeze([...pathItems]), locators: Object.freeze([]), repositories: Object.freeze([]), crossRepository: false }); }
|
|
114
|
+
function ambiguousProof(code, pathItems = []) { return Object.freeze({ state: 'ambiguous', qualified: false, code, path: Object.freeze([...pathItems]), locators: Object.freeze([]), repositories: Object.freeze([]), crossRepository: false }); }
|
|
115
|
+
function blockedProof(code, pathItems = []) { return Object.freeze({ state: 'blocked', qualified: false, code, path: Object.freeze([...pathItems]), locators: Object.freeze([]), repositories: Object.freeze([]), crossRepository: false }); }
|
|
116
|
+
|
|
117
|
+
export function assessCurrentness(candidate, facts, records, disappearingPaths, blockers, missingEvidence, ambiguities) {
|
|
118
|
+
const target = normalizePath(candidate.currentnessTarget || candidate.path || candidate.record?.path || '');
|
|
119
|
+
const matches = facts.filter((fact) => samePath(fact.target || fact.path || fact.obligation || '', target));
|
|
120
|
+
if (!matches.length) { missingEvidence.push(issue('currentness-evidence-missing', target)); return; }
|
|
121
|
+
if (matches.length > 1) { ambiguities.push(issue('currentness-evidence-ambiguous', target)); return; }
|
|
122
|
+
const fact = matches[0];
|
|
123
|
+
const qualified = String(fact.qualification || fact.semanticState || '') === 'qualified' && String(fact.currentness || '') === 'current' && nonEmptyBasis(fact.basis);
|
|
124
|
+
if (!qualified) { ambiguities.push(issue('currentness-evidence-unqualified', target)); return; }
|
|
125
|
+
const state = String(fact.state || fact.operativeState || '').toLowerCase();
|
|
126
|
+
if (CLEAR_CURRENTNESS.has(state)) return;
|
|
127
|
+
if (OPERATIVE_CURRENTNESS.has(state)) {
|
|
128
|
+
const reissue = normalizeReissue(fact.reissue || fact.retainedReissue || {});
|
|
129
|
+
if (!reissue.qualified) { blockers.push(issue('operative-obligation-disappearing', target)); return; }
|
|
130
|
+
const surviving = resolveUniqueRecord(records, reissue.survivingArtifact).record;
|
|
131
|
+
if (!surviving || disappearingPaths.has(normalizePath(surviving.path))) { blockers.push(issue('operative-obligation-reissue-not-surviving', target)); return; }
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
ambiguities.push(issue('currentness-state-unresolved', target));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function assessSurvivingDependencies(records, graph, disappearingPaths, currentnessFacts, blockers, ambiguities) {
|
|
138
|
+
for (const record of records) {
|
|
139
|
+
const recordPath = normalizePath(record.path || '');
|
|
140
|
+
if (disappearingPaths.has(recordPath) || !isDiscoveryWorkLeafEligible(record)) continue;
|
|
141
|
+
const parents = graph.parentsByChild.get(recordPath) || [];
|
|
142
|
+
const disappearingParents = parents.filter((edge) => disappearingPaths.has(normalizePath(edge.parent)));
|
|
143
|
+
if (!disappearingParents.length) continue;
|
|
144
|
+
const fact = currentnessFacts.find((item) => samePath(item.target || item.path || '', recordPath));
|
|
145
|
+
const reissue = normalizeReissue(fact?.reissue || {});
|
|
146
|
+
if (!reissue.qualified) blockers.push(issue('surviving-material-parent-depends-on-disappearing-material', recordPath));
|
|
147
|
+
else if (!nonEmptyBasis(reissue.basis)) ambiguities.push(issue('surviving-material-reissue-basis-unresolved', recordPath));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function currentnessReissueFor(target, facts) { const fact = facts.find((item) => samePath(item.target || item.path || '', target)); return normalizeReissue(fact?.reissue || {}); }
|
|
152
|
+
function normalizeReissue(value = {}) {
|
|
153
|
+
const qualified = String(value.qualification || value.semanticState || '') === 'qualified' && nonEmptyBasis(value.basis) && Boolean(value.survivingArtifact || value.target) && Boolean(value.mapping || value.obligationMapping);
|
|
154
|
+
return Object.freeze({ qualified, state: qualified ? 'qualified' : 'unresolved', survivingArtifact: normalizePath(value.survivingArtifact || value.target || ''), mapping: String(value.mapping || value.obligationMapping || ''), basis: value.basis || '' });
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function immutableLocatorForLeaf(record, entry, sources) {
|
|
158
|
+
const fromEntry = locatorFromValue(entry.leafTarget || '');
|
|
159
|
+
if (fromEntry.qualified && samePath(fromEntry.path, record.path)) return fromEntry;
|
|
160
|
+
return locatorForRecord(record, sources);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export function proofSnapshotScopes(candidates, leafProofs) {
|
|
164
|
+
const scopes = [];
|
|
165
|
+
for (const candidate of candidates) if (candidate.immutableLocator?.qualified) scopes.push(candidate.immutableLocator);
|
|
166
|
+
for (const proof of leafProofs) for (const locator of proof.parentSpan?.locators || []) scopes.push(locator);
|
|
167
|
+
return uniqueBy(scopes.filter((item) => item.repository || item.workspace), (item) => `${item.repository}|${item.workspace}|${item.commit}`);
|
|
168
|
+
}
|
|
169
|
+
export function snapshotMatchesScope(snapshot, scope) { return Boolean((scope.repository && snapshot.repository === scope.repository) || (scope.workspace && snapshot.workspace === scope.workspace)); }
|
|
170
|
+
export function scopeLabel(scope) { return `${scope.repository || '(no-repository)'}${scope.workspace ? `/${scope.workspace}` : ''}${scope.commit ? `@${scope.commit}` : ''}`; }
|
|
171
|
+
|
|
172
|
+
export function normalizeCandidateSet(value) {
|
|
173
|
+
const list = Array.isArray(value) ? value : typeof value === 'string' ? value.split(',') : value && typeof value === 'object' ? Object.entries(value).map(([candidatePath, item]) => typeof item === 'object' && item !== null ? ({ candidatePath, ...item }) : ({ candidatePath, action: item })) : [];
|
|
174
|
+
return Object.freeze(list.map((item) => typeof item === 'string'
|
|
175
|
+
? Object.freeze({ path: normalizePath(item), action: 'delete', repository: '', workspace: '', expectedDigest: '', classification: '', classificationQualification: '', classificationBasis: '', basis: '', fixture: false, fixtureRequired: false, currentnessTarget: '', immutableSource: null })
|
|
176
|
+
: Object.freeze({
|
|
177
|
+
path: normalizePath(item.path || item.candidatePath || item.candidate || item.artifact || ''),
|
|
178
|
+
action: String(item.action || item.destructiveAction || 'delete').toLowerCase(),
|
|
179
|
+
repository: String(item.repository || item.repo || ''),
|
|
180
|
+
workspace: String(item.workspace || item.workspaceId || ''),
|
|
181
|
+
expectedDigest: String(item.expectedDigest || item.preimageDigest || item.sha256 || ''),
|
|
182
|
+
classification: String(item.classification || item.kind || ''),
|
|
183
|
+
classificationQualification: String(item.classificationQualification || item.qualification || ''),
|
|
184
|
+
classificationBasis: item.classificationBasis || item.basis || '',
|
|
185
|
+
basis: item.basis || '',
|
|
186
|
+
fixture: item.fixture === true,
|
|
187
|
+
fixtureRequired: item.fixtureRequired === true,
|
|
188
|
+
currentnessTarget: normalizePath(item.currentnessTarget || item.obligation || ''),
|
|
189
|
+
immutableSource: item.immutableSource || item.locator || null
|
|
190
|
+
})).filter((item) => item.path));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function normalizeSnapshots(value) {
|
|
194
|
+
return Object.freeze(normalizeList(value).map((item) => {
|
|
195
|
+
const repository = String(item.repository || item.repo || '');
|
|
196
|
+
const workspace = String(item.workspace || item.workspaceId || '');
|
|
197
|
+
const commit = String(item.commit || item.sha || item.ref || '').toLowerCase();
|
|
198
|
+
const manifestDigest = String(item.manifestDigest || item.contentDigest || item.sha256 || '').replace(/^sha256:/, '').toLowerCase();
|
|
199
|
+
const localState = item.localState === true || item.uncommitted === true;
|
|
200
|
+
const qualified = Boolean((repository && GIT_COMMIT_RE.test(commit) || workspace && SHA256_RE.test(manifestDigest)) && (!localState || SHA256_RE.test(manifestDigest)) && String(item.qualification || item.semanticState || 'qualified') === 'qualified');
|
|
201
|
+
return Object.freeze({ repository, workspace, commit, manifestDigest, localState, qualified, state: qualified ? 'qualified' : 'unresolved', basis: item.basis || '' });
|
|
202
|
+
}));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function normalizeParentProofs(value) {
|
|
206
|
+
return Object.freeze(normalizeList(value).map((item) => {
|
|
207
|
+
const childLocator = locatorFromValue(item.childLocator || item.childSource || {});
|
|
208
|
+
const parentLocator = locatorFromValue(item.parentLocator || item.parentSource || {});
|
|
209
|
+
const child = normalizePath(item.child || childLocator.path || '');
|
|
210
|
+
const parent = normalizePath(item.parent || parentLocator.path || '');
|
|
211
|
+
const qualified = String(item.kind || 'parent') === 'parent' && String(item.qualification || item.semanticState || '') === 'qualified' && nonEmptyBasis(item.basis) && child && parent && childLocator.qualified && parentLocator.qualified;
|
|
212
|
+
return Object.freeze({ child, parent, childLocator, parentLocator, qualified, basis: item.basis || '' });
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function normalizeContract(value) {
|
|
217
|
+
const raw = typeof value === 'string' ? { id: value, version: 1 } : value || {};
|
|
218
|
+
const id = String(raw.id || PORTABLE_REDUCTION_DESTRUCTIVE_CONTRACT.id);
|
|
219
|
+
const version = Number(raw.version || PORTABLE_REDUCTION_DESTRUCTIVE_CONTRACT.version);
|
|
220
|
+
const qualified = id === PORTABLE_REDUCTION_DESTRUCTIVE_CONTRACT.id && version === PORTABLE_REDUCTION_DESTRUCTIVE_CONTRACT.version;
|
|
221
|
+
return Object.freeze({ id, version, qualified, bound: Object.freeze({ id, version, implementation: 'shared-portable-tooling', canonicalSchemaAuthorityChanged: false }) });
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export function fixtureRetired(candidate, values) {
|
|
225
|
+
const matches = normalizeList(values).filter((item) => samePath(item.target || item.path || '', candidate.path));
|
|
226
|
+
return matches.length === 1 && String(matches[0].qualification || matches[0].semanticState || '') === 'qualified' && String(matches[0].state || '') === 'retired' && nonEmptyBasis(matches[0].basis);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export function boundCandidate(candidate) { return Object.freeze({ path: candidate.path, action: candidate.action, repository: candidate.repository || candidate.immutableLocator?.repository || '', workspace: candidate.workspace || candidate.immutableLocator?.workspace || '', expectedDigest: String(candidate.expectedDigest || '').replace(/^sha256:/, '').toLowerCase(), classification: candidate.classification.kind, currentnessTarget: candidate.currentnessTarget || candidate.path }); }
|
|
230
|
+
export function boundSnapshot(snapshot) { return Object.freeze({ repository: snapshot.repository, workspace: snapshot.workspace, commit: snapshot.commit, manifestDigest: snapshot.manifestDigest, localState: snapshot.localState, qualified: snapshot.qualified }); }
|
|
231
|
+
export function boundCurrentnessFact(fact) { return Object.freeze({ target: normalizePath(fact.target || fact.path || fact.obligation || ''), state: String(fact.state || fact.operativeState || ''), currentness: String(fact.currentness || ''), qualification: String(fact.qualification || fact.semanticState || ''), basis: compactBasis(fact.basis), reissue: normalizeReissue(fact.reissue || {}) }); }
|
|
232
|
+
export function boundParentProof(proof) { return Object.freeze({ child: proof.child, parent: proof.parent, qualified: proof.qualified, childLocator: boundLocator(proof.childLocator), parentLocator: boundLocator(proof.parentLocator) }); }
|
|
233
|
+
export function boundLocator(locator) { const value = locatorFromValue(locator); return Object.freeze({ repository: value.repository, commit: value.commit, workspace: value.workspace, path: value.path, digest: value.digest, qualified: value.qualified }); }
|
|
234
|
+
export function priorReceiptFingerprint(value = {}) { return String(value?.receipt?.inputFingerprint || value?.inputFingerprint || value?.boundInputFingerprint || ''); }
|
|
235
|
+
|
|
236
|
+
export function projectPostApply(value, candidateSetDigest) {
|
|
237
|
+
if (!value) return Object.freeze({ state: 'not-requested', expectedCandidateSetDigest: candidateSetDigest, actualCandidateSetDigest: '', sourceMutation: false, boundary: 'Simulation only; no source mutation is performed.' });
|
|
238
|
+
const actual = normalizeCandidateSet(value.actualCandidateSet || value.candidateSet || value.actualCandidates || []);
|
|
239
|
+
const actualDigest = sha256Text(stableJson(actual.map((item) => ({ path: item.path, action: item.action, repository: item.repository, workspace: item.workspace, expectedDigest: String(item.expectedDigest || '').replace(/^sha256:/, '').toLowerCase(), classification: item.classification }))));
|
|
240
|
+
return Object.freeze({ state: actualDigest === candidateSetDigest ? 'matched' : 'mismatch', expectedCandidateSetDigest: candidateSetDigest, actualCandidateSetDigest: actualDigest, sourceMutation: false, boundary: 'Separately simulated post-apply comparison only. It cannot repair a missing pre-delete qualification and performs no mutation.' });
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export function sharedClosureMaterial(proofs) {
|
|
244
|
+
const items = new Map();
|
|
245
|
+
for (const proof of proofs) for (let index = 1; index < (proof.parentSpan?.path || []).length; index += 1) {
|
|
246
|
+
const itemPath = normalizePath(proof.parentSpan.path[index]);
|
|
247
|
+
if (!items.has(itemPath)) items.set(itemPath, Object.freeze({ path: itemPath, reachableFrom: [] }));
|
|
248
|
+
items.get(itemPath).reachableFrom.push(normalizePath(proof.leaf.path));
|
|
249
|
+
}
|
|
250
|
+
return [...items.values()].map((item) => Object.freeze({ path: item.path, reachableFrom: Object.freeze([...new Set(item.reachableFrom)].sort()) })).sort((a, b) => a.path.localeCompare(b.path));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export function normalizeList(value) { return Array.isArray(value) ? value : value && typeof value === 'object' ? Object.entries(value).map(([target, item]) => typeof item === 'object' && item !== null ? ({ target, ...item }) : ({ target, state: item })) : []; }
|
|
254
|
+
function nonEmptyBasis(value) { return Array.isArray(value) ? value.length > 0 : typeof value === 'string' ? Boolean(value.trim()) : Boolean(value && typeof value === 'object' && Object.keys(value).length); }
|
|
255
|
+
function compactBasis(value) { return typeof value === 'string' ? value.slice(0, 720) : Array.isArray(value) ? value.slice(0, 8) : value && typeof value === 'object' ? value : null; }
|
|
256
|
+
function uniqueBy(values, keyFn) { const seen = new Set(); return values.filter((value) => { const key = keyFn(value); if (seen.has(key)) return false; seen.add(key); return true; }); }
|
|
257
|
+
export function uniqueIssues(values) { return uniqueBy(values, (item) => `${item.code}|${item.detail}`); }
|
|
258
|
+
export function issue(code, detail) { return Object.freeze({ code: String(code), detail: String(detail || '') }); }
|