@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,191 @@
|
|
|
1
|
+
import { resolveLineage } from '../../../lineage/lineage.resolve.js';
|
|
2
|
+
import { portableFinding } from '../findings.js';
|
|
3
|
+
import {
|
|
4
|
+
PORTABLE_REDUCTION_DESTRUCTIVE_CONTRACT,
|
|
5
|
+
PORTABLE_REDUCTION_DESTRUCTIVE_ELIGIBILITY_SCHEMA_ID,
|
|
6
|
+
identity,
|
|
7
|
+
normalizePath,
|
|
8
|
+
parseReductionEntries,
|
|
9
|
+
qualifyReductionRecord,
|
|
10
|
+
resolveUniqueRecord,
|
|
11
|
+
safeCode,
|
|
12
|
+
samePath,
|
|
13
|
+
sha256Text,
|
|
14
|
+
stableJson
|
|
15
|
+
} from './reduction.shared.js';
|
|
16
|
+
import {
|
|
17
|
+
assessCandidateIdentity, assessCurrentness, assessSurvivingDependencies, boundCandidate, boundCurrentnessFact,
|
|
18
|
+
boundLocator, boundParentProof, boundSnapshot, currentnessReissueFor, fixtureRetired, hasDisappearingChild,
|
|
19
|
+
immutableLocatorForLeaf, issue, normalizeCandidateSet, normalizeContract, normalizeList, normalizeParentProofs,
|
|
20
|
+
normalizeSnapshots, parentGraph, priorReceiptFingerprint, projectPostApply, proofSnapshotScopes, proveParentClosure,
|
|
21
|
+
scopeLabel, sharedClosureMaterial, snapshotMatchesScope, uniqueIssues
|
|
22
|
+
} from './reduction.eligibility.helpers.js';
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
const DESTRUCTIVE_ACTIONS = new Set(['delete', 'remove', 'prune']);
|
|
26
|
+
|
|
27
|
+
export function projectReductionDestructiveEligibility(input = {}, material = {}, composition = null) {
|
|
28
|
+
const records = material.records || [];
|
|
29
|
+
const lineage = resolveLineage(records, { depth: 'portable-reduction-destructive-eligibility' });
|
|
30
|
+
const findings = [...(lineage.findings || [])];
|
|
31
|
+
const blockers = [];
|
|
32
|
+
const missingEvidence = [];
|
|
33
|
+
const ambiguities = [];
|
|
34
|
+
const rawCandidates = normalizeCandidateSet(input.candidateSet || input.destructiveCandidates || input.candidates || input.candidatePaths || []);
|
|
35
|
+
const snapshots = normalizeSnapshots(input.snapshots || input.workspaceSnapshots || input.repositorySnapshots || []);
|
|
36
|
+
const currentnessFacts = normalizeList(input.currentnessFacts || input.lifecycleFacts || input.currentness || []);
|
|
37
|
+
const immutableSources = normalizeList(input.immutableSources || input.sources || []);
|
|
38
|
+
const parentProofs = normalizeParentProofs(input.parentProofs || input.parentClosureProofs || []);
|
|
39
|
+
const endpointProofs = normalizeList(input.closureEndpoints || input.survivingBoundaries || []);
|
|
40
|
+
const reductionPath = normalizePath(input.reductionArtifactPath || input.reductionArtifact || input.reduction || '');
|
|
41
|
+
const reductionResolution = resolveUniqueRecord(records, reductionPath);
|
|
42
|
+
const reductionRecord = reductionResolution.record;
|
|
43
|
+
const reductionQualification = reductionRecord ? qualifyReductionRecord(reductionRecord, records) : null;
|
|
44
|
+
const reductionDigest = reductionRecord ? sha256Text(reductionRecord.markdown || '') : '';
|
|
45
|
+
const entries = reductionRecord ? parseReductionEntries(reductionRecord.markdown || '') : Object.freeze([]);
|
|
46
|
+
const graph = parentGraph(records, lineage, parentProofs);
|
|
47
|
+
const candidates = rawCandidates.map((candidate) => assessCandidateIdentity(candidate, records, immutableSources, snapshots));
|
|
48
|
+
const disappearing = candidates.filter((candidate) => DESTRUCTIVE_ACTIONS.has(candidate.action));
|
|
49
|
+
const semanticDisappearing = disappearing.filter((candidate) => candidate.classification.state === 'qualified' && candidate.classification.kind === 'semantic' && candidate.record);
|
|
50
|
+
const semanticDisappearingPaths = new Set(semanticDisappearing.map((candidate) => normalizePath(candidate.record.path || candidate.path)));
|
|
51
|
+
const leafEntrypoints = semanticDisappearing.filter((candidate) => !hasDisappearingChild(candidate.record, graph, semanticDisappearingPaths));
|
|
52
|
+
const proofLocators = parentProofs.flatMap((proof) => [proof.childLocator, proof.parentLocator].filter(Boolean));
|
|
53
|
+
const sourceLocators = [...immutableSources, ...proofLocators];
|
|
54
|
+
|
|
55
|
+
if (!reductionRecord && disappearing.length) missingEvidence.push(issue('qualified-pre-delete-reduction-required', reductionPath || '(empty)'));
|
|
56
|
+
else if (reductionRecord && !reductionQualification.qualified && disappearing.length) missingEvidence.push(issue('qualified-pre-delete-reduction-required', reductionQualification.reasons.join(', ')));
|
|
57
|
+
|
|
58
|
+
for (const candidate of candidates) {
|
|
59
|
+
if (candidate.identityState === 'ambiguous') ambiguities.push(issue('candidate-path-ambiguous', candidate.path));
|
|
60
|
+
else if (candidate.identityState === 'missing' && candidate.classification.kind === 'semantic') missingEvidence.push(issue('candidate-semantic-material-missing', candidate.path));
|
|
61
|
+
if (candidate.classification.state !== 'qualified') ambiguities.push(issue('candidate-classification-unresolved', candidate.path));
|
|
62
|
+
if (candidate.preimage.state === 'mismatch') blockers.push(issue('candidate-preimage-mismatch', candidate.path));
|
|
63
|
+
if (candidate.preimage.state === 'unresolved') missingEvidence.push(issue('candidate-preimage-unresolved', candidate.path));
|
|
64
|
+
if (candidate.classification.kind === 'fixture' && DESTRUCTIVE_ACTIONS.has(candidate.action) && !fixtureRetired(candidate, input.fixtureRetirements || [])) blockers.push(issue('fixture-required-deletion', candidate.path));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const leafProofs = [];
|
|
68
|
+
const covered = new Set();
|
|
69
|
+
if (reductionRecord && reductionQualification?.qualified) {
|
|
70
|
+
for (const leaf of leafEntrypoints) {
|
|
71
|
+
const matches = entries.filter((entry) => samePath(entry.leafPath, leaf.record.path));
|
|
72
|
+
if (matches.length === 0) { blockers.push(issue('disappearing-leaf-declaration-missing', leaf.record.path)); continue; }
|
|
73
|
+
if (matches.length > 1) { ambiguities.push(issue('disappearing-leaf-declaration-ambiguous', leaf.record.path)); continue; }
|
|
74
|
+
const entry = matches[0];
|
|
75
|
+
covered.add(normalizePath(leaf.record.path));
|
|
76
|
+
if (!entry.disposition) blockers.push(issue('disposition-required', leaf.record.path));
|
|
77
|
+
if (!entry.reason) blockers.push(issue('reason-required', leaf.record.path));
|
|
78
|
+
if (!entry.collapseToPath) blockers.push(issue('historical-closure-endpoint-required', leaf.record.path));
|
|
79
|
+
const leafLocator = immutableLocatorForLeaf(leaf.record, entry, sourceLocators);
|
|
80
|
+
if (!leafLocator.qualified) missingEvidence.push(issue('immutable-leaf-source-unresolved', leaf.record.path));
|
|
81
|
+
const proof = proveParentClosure({ leaf: leaf.record, boundaryPath: entry.collapseToPath, graph, disappearingPaths: semanticDisappearingPaths, records, sourceLocators, endpointProofs, snapshots });
|
|
82
|
+
leafProofs.push(Object.freeze({
|
|
83
|
+
leaf: identity(leaf.record),
|
|
84
|
+
immutableLocator: leafLocator,
|
|
85
|
+
disposition: entry.disposition,
|
|
86
|
+
reason: entry.reason,
|
|
87
|
+
historicalClosureEndpoint: entry.collapseToPath,
|
|
88
|
+
placementParent: reductionQualification.parentPath,
|
|
89
|
+
parentSpan: proof,
|
|
90
|
+
reissue: currentnessReissueFor(leaf.record.path, currentnessFacts)
|
|
91
|
+
}));
|
|
92
|
+
if (proof.state === 'ambiguous') ambiguities.push(issue(proof.code || 'parent-closure-ambiguous', leaf.record.path));
|
|
93
|
+
else if (proof.state === 'unresolved') missingEvidence.push(issue(proof.code || 'parent-closure-unresolved', leaf.record.path));
|
|
94
|
+
else if (proof.state === 'blocked') blockers.push(issue(proof.code || 'parent-closure-blocked', leaf.record.path));
|
|
95
|
+
if (proof.qualified) for (const item of proof.path.slice(0, -1)) covered.add(normalizePath(item));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for (const entry of entries) {
|
|
99
|
+
const matchedCandidate = candidates.find((candidate) => candidate.record && samePath(candidate.record.path, entry.leafPath));
|
|
100
|
+
if (matchedCandidate && !DESTRUCTIVE_ACTIONS.has(matchedCandidate.action)) blockers.push(issue('reduction-leaf-retained-by-candidate-set', entry.leafPath));
|
|
101
|
+
else if (!matchedCandidate && entry.leafPath) blockers.push(issue('reduction-leaf-not-in-destructive-set', entry.leafPath));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
for (const candidate of semanticDisappearing) {
|
|
106
|
+
const candidatePath = normalizePath(candidate.record.path || candidate.path);
|
|
107
|
+
if (!covered.has(candidatePath)) blockers.push(issue('uncovered-disappearing-semantic-artifact', candidatePath));
|
|
108
|
+
assessCurrentness(candidate, currentnessFacts, records, semanticDisappearingPaths, blockers, missingEvidence, ambiguities);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
assessSurvivingDependencies(records, graph, semanticDisappearingPaths, currentnessFacts, blockers, ambiguities);
|
|
112
|
+
const requiredSnapshotScopes = proofSnapshotScopes(candidates, leafProofs);
|
|
113
|
+
for (const scope of requiredSnapshotScopes) {
|
|
114
|
+
const match = snapshots.filter((snapshot) => snapshotMatchesScope(snapshot, scope));
|
|
115
|
+
if (match.length === 0) missingEvidence.push(issue('proof-snapshot-missing', scopeLabel(scope)));
|
|
116
|
+
else if (match.length > 1) ambiguities.push(issue('proof-snapshot-ambiguous', scopeLabel(scope)));
|
|
117
|
+
else if (!match[0].qualified) missingEvidence.push(issue('proof-snapshot-unqualified', scopeLabel(scope)));
|
|
118
|
+
else if (scope.commit && match[0].commit && scope.commit !== match[0].commit) missingEvidence.push(issue('proof-snapshot-immutable-ref-mismatch', scopeLabel(scope)));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const contract = normalizeContract(input.contractIdentity || input.qualificationContract || PORTABLE_REDUCTION_DESTRUCTIVE_CONTRACT);
|
|
122
|
+
if (!contract.qualified) missingEvidence.push(issue('qualification-contract-unqualified', contract.id || '(empty)'));
|
|
123
|
+
const boundCandidateSet = candidates.map(boundCandidate).sort((a, b) => `${a.repository}|${a.workspace}|${a.path}|${a.action}`.localeCompare(`${b.repository}|${b.workspace}|${b.path}|${b.action}`));
|
|
124
|
+
const boundSnapshots = snapshots.map(boundSnapshot).sort((a, b) => `${a.repository}|${a.workspace}|${a.commit}`.localeCompare(`${b.repository}|${b.workspace}|${b.commit}`));
|
|
125
|
+
const boundCurrentness = currentnessFacts.map(boundCurrentnessFact).sort((a, b) => `${a.target}|${a.state}`.localeCompare(`${b.target}|${b.state}`));
|
|
126
|
+
const candidateSetDigest = sha256Text(stableJson(boundCandidateSet));
|
|
127
|
+
const boundInputs = Object.freeze({
|
|
128
|
+
reduction: Object.freeze({ path: reductionPath, sha256: reductionDigest }),
|
|
129
|
+
snapshots: Object.freeze(boundSnapshots),
|
|
130
|
+
candidateSet: Object.freeze(boundCandidateSet),
|
|
131
|
+
lifecycleCurrentnessBasis: Object.freeze(boundCurrentness),
|
|
132
|
+
qualificationContract: contract.bound,
|
|
133
|
+
proofMaterial: Object.freeze({
|
|
134
|
+
parentProofsSha256: sha256Text(stableJson(parentProofs.map(boundParentProof))),
|
|
135
|
+
immutableSourcesSha256: sha256Text(stableJson(sourceLocators.map(boundLocator))),
|
|
136
|
+
compositionFingerprint: String(composition?.fingerprint || '')
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
const inputFingerprint = sha256Text(stableJson(boundInputs));
|
|
140
|
+
const priorFingerprint = priorReceiptFingerprint(input.priorReceipt || input.receipt || input.qualificationReceipt);
|
|
141
|
+
if (priorFingerprint && priorFingerprint !== inputFingerprint) blockers.push(issue('receipt-input-fingerprint-mismatch', `prior=${priorFingerprint} current=${inputFingerprint}`));
|
|
142
|
+
|
|
143
|
+
const postApply = projectPostApply(input.postApply || input.postApplyAudit || null, candidateSetDigest);
|
|
144
|
+
const requested = rawCandidates.length > 0;
|
|
145
|
+
const state = !requested ? 'not-requested'
|
|
146
|
+
: blockers.length ? 'blocked'
|
|
147
|
+
: missingEvidence.length || ambiguities.length ? 'unresolved'
|
|
148
|
+
: 'eligible';
|
|
149
|
+
const destructiveEligible = state === 'eligible';
|
|
150
|
+
|
|
151
|
+
for (const item of blockers) findings.push(portableFinding('error', `portable.reduction-eligibility.${safeCode(item.code)}`, item.detail, { ref: reductionPath }));
|
|
152
|
+
for (const item of missingEvidence) findings.push(portableFinding('warning', `portable.reduction-eligibility.${safeCode(item.code)}`, item.detail, { ref: reductionPath }));
|
|
153
|
+
for (const item of ambiguities) findings.push(portableFinding('warning', `portable.reduction-eligibility.${safeCode(item.code)}`, item.detail, { ref: reductionPath }));
|
|
154
|
+
if (requested && state === 'unresolved') findings.push(portableFinding('error', 'portable.reduction-eligibility.unresolved-fail-closed', 'Destructive eligibility is unresolved; destructive apply remains forbidden.', { ref: reductionPath }));
|
|
155
|
+
if (postApply.state === 'mismatch') findings.push(portableFinding('error', 'portable.reduction-eligibility.post-apply-simulation-mismatch', 'Simulated post-apply material does not match the exact qualified candidate set.', { ref: reductionPath }));
|
|
156
|
+
|
|
157
|
+
return Object.freeze({
|
|
158
|
+
schema: PORTABLE_REDUCTION_DESTRUCTIVE_ELIGIBILITY_SCHEMA_ID,
|
|
159
|
+
state,
|
|
160
|
+
destructiveEligible,
|
|
161
|
+
reduction: Object.freeze({ requestedPath: reductionPath, record: reductionRecord ? identity(reductionRecord) : null, qualification: reductionQualification, digest: reductionDigest, placementParent: reductionQualification?.parentPath || '' }),
|
|
162
|
+
snapshots: Object.freeze(snapshots),
|
|
163
|
+
candidateSet: Object.freeze(candidates),
|
|
164
|
+
candidateSetDigest,
|
|
165
|
+
disappearingSemanticSet: Object.freeze(semanticDisappearing.map((candidate) => identity(candidate.record))),
|
|
166
|
+
leafEntrypoints: Object.freeze(leafProofs),
|
|
167
|
+
sharedClosureMaterial: Object.freeze(sharedClosureMaterial(leafProofs)),
|
|
168
|
+
currentnessBasis: Object.freeze(currentnessFacts),
|
|
169
|
+
contract,
|
|
170
|
+
blockers: Object.freeze(uniqueIssues(blockers)),
|
|
171
|
+
missingEvidence: Object.freeze(uniqueIssues(missingEvidence)),
|
|
172
|
+
ambiguities: Object.freeze(uniqueIssues(ambiguities)),
|
|
173
|
+
receipt: Object.freeze({ schema: 'tiinex.portable.reduction-destructive-eligibility.receipt.v1', state, inputFingerprint, candidateSetDigest, boundInputs, stalePriorReceipt: Boolean(priorFingerprint && priorFingerprint !== inputFingerprint), reusableOnlyForExactBoundInputs: true }),
|
|
174
|
+
postApply,
|
|
175
|
+
boundary: Object.freeze({
|
|
176
|
+
adapterNeutral: true,
|
|
177
|
+
planningAndQualificationOnly: true,
|
|
178
|
+
sourceMutation: false,
|
|
179
|
+
remoteWrite: false,
|
|
180
|
+
destructiveApplyImplemented: false,
|
|
181
|
+
destructiveApplyAuthorized: false,
|
|
182
|
+
eligibleIsNecessaryButNotSufficient: true,
|
|
183
|
+
ordinaryReductionValidityDependsOnEligibility: false,
|
|
184
|
+
placementParentIsHistoricalClosureEndpoint: false,
|
|
185
|
+
lifecycleFactsAreEvidenceNotDeleteAuthority: true,
|
|
186
|
+
candidateSetDerivedCoverageNotReductionProse: true
|
|
187
|
+
}),
|
|
188
|
+
findings: Object.freeze(findings)
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { portableOperationResult as operationResult } from '../operation.result.js';
|
|
2
|
+
import { preflightPortableReduction } from './reduction.preflight.js';
|
|
3
|
+
|
|
4
|
+
export function preflightPortableReductionOperation(input = {}, options = {}) {
|
|
5
|
+
const preflight = preflightPortableReduction(input, options);
|
|
6
|
+
return operationResult('reduction-preflight', {
|
|
7
|
+
status: preflight.status,
|
|
8
|
+
destructiveEligible: preflight.destructiveEligible,
|
|
9
|
+
composition: preflight.composition,
|
|
10
|
+
eligibility: preflight.eligibility,
|
|
11
|
+
inventory: preflight.inventory,
|
|
12
|
+
reduction: preflight.reduction,
|
|
13
|
+
candidates: preflight.candidates,
|
|
14
|
+
summary: preflight.summary,
|
|
15
|
+
boundary: preflight.boundary,
|
|
16
|
+
findings: preflight.findings || []
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const portableReductionOperationDescriptors = Object.freeze([
|
|
21
|
+
Object.freeze({
|
|
22
|
+
name: 'reduction-preflight',
|
|
23
|
+
description: 'Project ordinary hierarchical Reduction composition/recovery and, only when an exact destructive candidate set is supplied, a separate fail-closed eligible|blocked|unresolved destructive-lineage qualification bound to exact inputs. The operation is read-only and never authorizes apply.',
|
|
24
|
+
safety: 'planning-only-read-only',
|
|
25
|
+
inputSchema: 'tiinex.portable.reduction-preflight.request.v1',
|
|
26
|
+
sourceMutation: false,
|
|
27
|
+
remoteWrite: false,
|
|
28
|
+
handler: preflightPortableReductionOperation
|
|
29
|
+
})
|
|
30
|
+
]);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { inferRecordMaterialRole, isDiscoveryWorkLeafEligible, MaterialRole } from '../../../workspaces/workspace.materialRole.js';
|
|
2
|
+
import { normalizePortableInput } from '../input/portable.input.js';
|
|
3
|
+
import { projectReductionComposition } from './reduction.composition.js';
|
|
4
|
+
import { projectReductionDestructiveEligibility } from './reduction.eligibility.js';
|
|
5
|
+
import { PORTABLE_REDUCTION_PREFLIGHT_SCHEMA_ID } from './reduction.shared.js';
|
|
6
|
+
|
|
7
|
+
const FIXTURE_RE = /(^|\/)(?:fixtures?|test-fixtures?|__fixtures__)(\/|$)|\.fixture\./i;
|
|
8
|
+
|
|
9
|
+
export { PORTABLE_REDUCTION_PREFLIGHT_SCHEMA_ID } from './reduction.shared.js';
|
|
10
|
+
|
|
11
|
+
export function preflightPortableReduction(input = {}, options = {}) {
|
|
12
|
+
const material = normalizePortableInput(input.materials || input);
|
|
13
|
+
const composition = projectReductionComposition(input, material, options);
|
|
14
|
+
const eligibility = projectReductionDestructiveEligibility(input, material, composition, options);
|
|
15
|
+
const inventory = buildInventory(material.records || []);
|
|
16
|
+
const findings = Object.freeze([...(material.findings || []), ...(composition.findings || []), ...(eligibility.findings || [])]);
|
|
17
|
+
const requested = eligibility.state !== 'not-requested';
|
|
18
|
+
const status = eligibility.state === 'eligible' ? 'preflight-qualified'
|
|
19
|
+
: requested ? 'blocked'
|
|
20
|
+
: ['qualified', 'qualified-with-known-loss'].includes(composition.state) ? 'projection-qualified' : 'unresolved';
|
|
21
|
+
const summary = Object.freeze({
|
|
22
|
+
records: material.records?.length || 0,
|
|
23
|
+
semanticRecords: inventory.counts.semantic,
|
|
24
|
+
explicitCandidates: eligibility.candidateSet.length,
|
|
25
|
+
disappearingSemantic: eligibility.disappearingSemanticSet.length,
|
|
26
|
+
leafEntrypoints: eligibility.leafEntrypoints.length,
|
|
27
|
+
compositionNodes: composition.nodes.length,
|
|
28
|
+
compositionHops: composition.hops.length,
|
|
29
|
+
eligibilityState: eligibility.state
|
|
30
|
+
});
|
|
31
|
+
return Object.freeze({
|
|
32
|
+
schema: PORTABLE_REDUCTION_PREFLIGHT_SCHEMA_ID,
|
|
33
|
+
status,
|
|
34
|
+
destructiveEligible: eligibility.destructiveEligible,
|
|
35
|
+
composition,
|
|
36
|
+
eligibility,
|
|
37
|
+
inventory,
|
|
38
|
+
reduction: Object.freeze({ ...eligibility.reduction, entries: Object.freeze(eligibility.leafEntrypoints.map((item) => Object.freeze({ leafPath: item.leaf.path, collapseToPath: item.historicalClosureEndpoint, disposition: item.disposition, reason: item.reason }))) }),
|
|
39
|
+
candidates: eligibility.candidateSet,
|
|
40
|
+
summary,
|
|
41
|
+
findings,
|
|
42
|
+
boundary: Object.freeze({
|
|
43
|
+
adapterNeutral: true,
|
|
44
|
+
sharedConsumers: Object.freeze(['Viewer', 'CLI', 'LLM', 'VS Code']),
|
|
45
|
+
planningOnly: true,
|
|
46
|
+
sourceMutation: false,
|
|
47
|
+
remoteWrite: false,
|
|
48
|
+
destructiveApplyImplemented: false,
|
|
49
|
+
destructiveApplyAuthorized: false,
|
|
50
|
+
ordinaryReductionAuthoritySeparate: true,
|
|
51
|
+
lifecycleLexicalStatusIsDestructivePolicy: false,
|
|
52
|
+
placementParentEqualsHistoricalClosureEndpoint: false,
|
|
53
|
+
canonicalReductionSchemaAuthorityChanged: false,
|
|
54
|
+
destructiveEligibilityMeaning: 'eligible is exact fail-closed qualification evidence only; a separate future apply capability must enforce current state, authorization, approvals, and mutation gates'
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function buildInventory(records = []) {
|
|
60
|
+
const items = records.map((record) => {
|
|
61
|
+
const role = inferRecordMaterialRole(record);
|
|
62
|
+
const fixture = record.fixture === true || record.requiredFixture === true || FIXTURE_RE.test(String(record.path || '').replace(/\\/g, '/'));
|
|
63
|
+
const semantic = isDiscoveryWorkLeafEligible(record);
|
|
64
|
+
return Object.freeze({
|
|
65
|
+
id: String(record.id || ''), path: String(record.path || ''), schemaId: String(record.schemaId || ''),
|
|
66
|
+
materialRole: role, semantic, fixture,
|
|
67
|
+
observedLifecycleStatus: String(record.lifecycleStatus || record.currentStatus || record.status || ''),
|
|
68
|
+
destructiveCurrentnessAuthority: 'none-without-qualified-normalized-currentness-input'
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
return Object.freeze({
|
|
72
|
+
items: Object.freeze(items),
|
|
73
|
+
counts: Object.freeze({
|
|
74
|
+
total: items.length,
|
|
75
|
+
semantic: items.filter((item) => item.semantic).length,
|
|
76
|
+
fixture: items.filter((item) => item.fixture).length,
|
|
77
|
+
leafRole: items.filter((item) => item.materialRole === MaterialRole.leaf).length,
|
|
78
|
+
schemaDefinition: items.filter((item) => item.materialRole === MaterialRole.schemaDefinition).length,
|
|
79
|
+
supporting: items.filter((item) => item.materialRole === MaterialRole.supporting).length,
|
|
80
|
+
workspaceArtifact: items.filter((item) => item.materialRole === MaterialRole.workspaceArtifact).length,
|
|
81
|
+
unknown: items.filter((item) => item.materialRole === MaterialRole.unknown).length
|
|
82
|
+
}),
|
|
83
|
+
boundary: 'Inventory is classification evidence only. Lexical lifecycle/status observations are not destructive currentness authority.'
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { auditPortableRecord } from '../audit/audit.capability.js';
|
|
4
|
+
import { isDiscoveryWorkLeafEligible } from '../../../workspaces/workspace.materialRole.js';
|
|
5
|
+
|
|
6
|
+
export const PORTABLE_REDUCTION_PREFLIGHT_SCHEMA_ID = 'tiinex.portable.reduction-preflight.v1';
|
|
7
|
+
export const PORTABLE_REDUCTION_COMPOSITION_SCHEMA_ID = 'tiinex.portable.reduction-composition.v1';
|
|
8
|
+
export const PORTABLE_REDUCTION_DESTRUCTIVE_ELIGIBILITY_SCHEMA_ID = 'tiinex.portable.reduction-destructive-eligibility.v1';
|
|
9
|
+
export const PORTABLE_REDUCTION_DESTRUCTIVE_CONTRACT = Object.freeze({
|
|
10
|
+
id: 'tiinex.portable.reduction-destructive-eligibility.v1',
|
|
11
|
+
version: 1,
|
|
12
|
+
authority: 'shared-tooling-projection-contract',
|
|
13
|
+
canonicalSchemaAuthorityChanged: false
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const GITHUB_IMMUTABLE_BLOB_RE = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\/blob\/([0-9a-f]{40})\/(.+)$/i;
|
|
17
|
+
|
|
18
|
+
export function sha256Text(value = '') { return createHash('sha256').update(String(value), 'utf8').digest('hex'); }
|
|
19
|
+
export function stableJson(value) { return JSON.stringify(sortJson(value)); }
|
|
20
|
+
function sortJson(value) {
|
|
21
|
+
if (Array.isArray(value)) return value.map(sortJson);
|
|
22
|
+
if (!value || typeof value !== 'object') return value;
|
|
23
|
+
return Object.fromEntries(Object.keys(value).sort().map((key) => [key, sortJson(value[key])]));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function normalizePath(value = '') { return String(value || '').replace(/\\/g, '/').replace(/^\.\//, '').replace(/^\/+|\/+$/g, '').trim(); }
|
|
27
|
+
export function safeCode(value = '') { return String(value || 'unresolved').toLowerCase().replace(/[^a-z0-9.-]+/g, '-').replace(/^-+|-+$/g, ''); }
|
|
28
|
+
export function escapeRegExp(value = '') { return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); }
|
|
29
|
+
export function linkPath(value = '') {
|
|
30
|
+
const text = String(value || '').trim();
|
|
31
|
+
const github = text.match(GITHUB_IMMUTABLE_BLOB_RE);
|
|
32
|
+
if (github) return normalizePath(github[4]);
|
|
33
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(text)) {
|
|
34
|
+
try { return normalizePath(new URL(text).pathname); } catch { return ''; }
|
|
35
|
+
}
|
|
36
|
+
return normalizePath(text.split('#')[0].split('?')[0]);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function identity(record = {}) {
|
|
40
|
+
return Object.freeze({ id: String(record.id || record.path || ''), path: String(record.path || ''), title: String(record.title || ''), schemaId: String(record.schemaId || '') });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function resolveUniqueRecord(records = [], requestedPath = '') {
|
|
44
|
+
const wanted = normalizePath(requestedPath);
|
|
45
|
+
if (!wanted) return Object.freeze({ state: 'missing', record: null });
|
|
46
|
+
const exact = records.filter((record) => normalizePath(record.path) === wanted || normalizePath(record.id) === wanted);
|
|
47
|
+
if (exact.length === 1) return Object.freeze({ state: 'exact', record: exact[0] });
|
|
48
|
+
if (exact.length > 1) return Object.freeze({ state: 'ambiguous', record: null });
|
|
49
|
+
const suffix = records.filter((record) => normalizePath(record.path).endsWith(`/${wanted}`));
|
|
50
|
+
if (suffix.length === 1) return Object.freeze({ state: 'suffix', record: suffix[0] });
|
|
51
|
+
return Object.freeze({ state: suffix.length > 1 ? 'ambiguous' : 'missing', record: null });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function qualifyRecord(record = {}) {
|
|
55
|
+
if (!record) return Object.freeze({ state: 'missing', qualified: false, reasons: Object.freeze(['record-missing']), audit: null });
|
|
56
|
+
const audit = auditPortableRecord(record);
|
|
57
|
+
const reasons = [];
|
|
58
|
+
if (!record.hasContinuityContext) reasons.push('continuity-context-missing');
|
|
59
|
+
if (!record.hasIntegrity) reasons.push('integrity-missing');
|
|
60
|
+
if (audit.qualification?.exact !== true || audit.qualification?.moduleExact !== true) reasons.push('non-exact-schema-validation');
|
|
61
|
+
if (audit.status !== 'readable') reasons.push(`audit-status:${audit.status || 'unknown'}`);
|
|
62
|
+
if ((audit.findings || []).some((finding) => finding.severity === 'error')) reasons.push('audit-error');
|
|
63
|
+
return Object.freeze({ state: reasons.length ? 'unresolved' : 'qualified', qualified: reasons.length === 0, reasons: Object.freeze(reasons), audit });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function qualifyReductionRecord(record = {}, records = []) {
|
|
67
|
+
if (!record) return Object.freeze({ qualified: false, state: 'missing', digest: '', parentPath: '', parent: null, reasons: Object.freeze(['reduction-artifact-missing']), audit: null });
|
|
68
|
+
const base = qualifyRecord(record);
|
|
69
|
+
const reasons = [...base.reasons];
|
|
70
|
+
if (String(record.schemaId || '') !== 'tiinex.reduction.v1') reasons.push(`schema:${record.schemaId || 'missing'}`);
|
|
71
|
+
const parentPath = normalizePath(record.trace || '');
|
|
72
|
+
const parentResolution = parentPath ? resolveUniqueRecord(records, parentPath) : { state: 'missing', record: null };
|
|
73
|
+
if (!parentPath) reasons.push('reduction-parent-required');
|
|
74
|
+
else if (parentResolution.state === 'ambiguous') reasons.push('reduction-parent-ambiguous');
|
|
75
|
+
else if (!parentResolution.record) reasons.push('reduction-parent-not-loaded');
|
|
76
|
+
else {
|
|
77
|
+
const parentQualification = qualifyRecord(parentResolution.record);
|
|
78
|
+
if (!isDiscoveryWorkLeafEligible(parentResolution.record)) reasons.push('reduction-parent-not-semantic-work-artifact');
|
|
79
|
+
if (!parentQualification.qualified) reasons.push('reduction-parent-unqualified');
|
|
80
|
+
}
|
|
81
|
+
return Object.freeze({
|
|
82
|
+
qualified: reasons.length === 0,
|
|
83
|
+
state: reasons.length ? 'unresolved' : 'qualified',
|
|
84
|
+
digest: sha256Text(record.markdown || ''),
|
|
85
|
+
parentPath,
|
|
86
|
+
parent: parentResolution.record ? identity(parentResolution.record) : null,
|
|
87
|
+
reasons: Object.freeze([...new Set(reasons)]),
|
|
88
|
+
audit: base.audit
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function sectionText(markdown = '', heading = '') {
|
|
93
|
+
const source = String(markdown || '');
|
|
94
|
+
const name = escapeRegExp(heading);
|
|
95
|
+
return String(source.match(new RegExp(`(?:^|\\n)##\\s+${name}\\s*\\r?\\n([\\s\\S]*?)(?=\\n##\\s+|\\n#\\s+|$)`, 'i'))?.[1] || '').trim();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function markdownLinks(markdown = '') {
|
|
99
|
+
return Object.freeze([...String(markdown || '').matchAll(/\[([^\]]+)\]\(([^)]+)\)/g)].map((match) => Object.freeze({ label: String(match[1] || '').trim(), target: String(match[2] || '').trim(), path: linkPath(match[2] || '') })));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function parseReductionEntries(markdown = '') {
|
|
103
|
+
const section = String(markdown || '').match(/###\s+Reduced Leaves\s*\/\s*Expansion Boundary\s*\n([\s\S]*?)(?=\n##\s|\n#\s|$)/i)?.[1] || '';
|
|
104
|
+
if (!section) return Object.freeze([]);
|
|
105
|
+
const starts = [...section.matchAll(/^\s*-\s+\*\*(.+?)\*\*\s*$/gm)];
|
|
106
|
+
const entries = [];
|
|
107
|
+
for (let index = 0; index < starts.length; index += 1) {
|
|
108
|
+
const start = starts[index].index ?? 0;
|
|
109
|
+
const end = index + 1 < starts.length ? starts[index + 1].index ?? section.length : section.length;
|
|
110
|
+
const block = section.slice(start, end);
|
|
111
|
+
const leaf = parseLabeledLink(block, 'Leaf');
|
|
112
|
+
const collapse = parseLabeledLink(block, 'Collapse To');
|
|
113
|
+
entries.push(Object.freeze({
|
|
114
|
+
title: String(starts[index][1] || '').trim(),
|
|
115
|
+
leafLabel: leaf.label,
|
|
116
|
+
leafTarget: leaf.target,
|
|
117
|
+
leafPath: linkPath(leaf.target || leaf.label),
|
|
118
|
+
collapseToLabel: collapse.label,
|
|
119
|
+
collapseToTarget: collapse.target,
|
|
120
|
+
collapseToPath: linkPath(collapse.target || collapse.label),
|
|
121
|
+
disposition: labeledCodeOrText(block, 'Disposition'),
|
|
122
|
+
reason: labeledText(block, 'Why'),
|
|
123
|
+
scope: labeledText(block, 'Expansion Span') || labeledText(block, 'Scope')
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
return Object.freeze(entries);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function parseLabeledLink(block, label) {
|
|
130
|
+
const match = block.match(new RegExp(`^\\s*-\\s+${escapeRegExp(label)}:\\s+\\[([^\\]]+)\\]\\(([^)]+)\\)\\s*$`, 'im'));
|
|
131
|
+
return Object.freeze({ label: String(match?.[1] || '').trim(), target: String(match?.[2] || '').trim() });
|
|
132
|
+
}
|
|
133
|
+
function labeledCodeOrText(block, label) { return labeledText(block, label).replace(/^`|`$/g, '').trim(); }
|
|
134
|
+
function labeledText(block, label) { return String(block.match(new RegExp(`^\\s*-\\s+${escapeRegExp(label)}:\\s+(.+?)\\s*$`, 'im'))?.[1] || '').trim(); }
|
|
135
|
+
|
|
136
|
+
export function locatorFromValue(value = {}) {
|
|
137
|
+
if (typeof value === 'string') {
|
|
138
|
+
const github = value.match(GITHUB_IMMUTABLE_BLOB_RE);
|
|
139
|
+
if (!github) return unqualifiedLocator('immutable-locator-unqualified');
|
|
140
|
+
return Object.freeze({ qualified: true, state: 'immutable-git', provider: 'github', repository: `${github[1]}/${github[2]}`, commit: github[3].toLowerCase(), workspace: '', path: normalizePath(github[4]), permalink: value, digest: '', basis: 'explicit-commit-pinned-permalink' });
|
|
141
|
+
}
|
|
142
|
+
const repository = String(value.repository || value.repo || '').trim();
|
|
143
|
+
const commit = String(value.commit || value.sha || value.ref || '').trim().toLowerCase();
|
|
144
|
+
const workspace = String(value.workspace || value.workspaceId || '').trim();
|
|
145
|
+
const sourcePath = normalizePath(value.path || value.sourcePath || '');
|
|
146
|
+
const permalink = String(value.permalink || value.url || '').trim();
|
|
147
|
+
const digest = String(value.digest || value.sha256 || '').replace(/^sha256:/, '').trim().toLowerCase();
|
|
148
|
+
const immutable = value.immutable === true || /^[0-9a-f]{40}$/i.test(commit);
|
|
149
|
+
const qualified = Boolean(immutable && /^[0-9a-f]{40}$/i.test(commit) && repository && sourcePath);
|
|
150
|
+
return Object.freeze({ qualified, state: qualified ? 'immutable-git' : 'unqualified', provider: String(value.provider || 'explicit'), repository, commit, workspace, path: sourcePath, permalink, digest, basis: value.basis || '', blocker: qualified ? '' : 'immutable-locator-unqualified' });
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function locatorForRecord(record = {}, supplied = []) {
|
|
154
|
+
const wanted = new Set([normalizePath(record.path), path.basename(normalizePath(record.path))].filter(Boolean));
|
|
155
|
+
const explicit = supplied.find((item) => wanted.has(normalizePath(item.path || item.candidatePath || item.target || '')) || wanted.has(path.basename(normalizePath(item.path || item.candidatePath || item.target || ''))));
|
|
156
|
+
if (explicit) return locatorFromValue(explicit);
|
|
157
|
+
const source = record.source || {};
|
|
158
|
+
if (source.repository && /^[0-9a-f]{40}$/i.test(String(source.commit || source.ref || '')) && source.path) return locatorFromValue({ repository: source.repository, commit: source.commit || source.ref, workspace: source.workspace || '', path: source.path, immutable: true, permalink: source.permalink || '', basis: source.boundary || 'explicit-record-source' });
|
|
159
|
+
return unqualifiedLocator('immutable-locator-missing');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function locatorMatchesRecord(locator = {}, record = {}) {
|
|
163
|
+
if (!locator?.qualified || !record) return false;
|
|
164
|
+
const recordPath = normalizePath(record.path || '');
|
|
165
|
+
return Boolean(recordPath === normalizePath(locator.path) || recordPath.endsWith(`/${normalizePath(locator.path)}`) || path.basename(recordPath) === path.basename(normalizePath(locator.path)));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function samePath(a = '', b = '') {
|
|
169
|
+
const left = normalizePath(a); const right = normalizePath(b);
|
|
170
|
+
return Boolean(left && right && (left === right || left.endsWith(`/${right}`) || right.endsWith(`/${left}`)));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function unqualifiedLocator(blocker) { return Object.freeze({ qualified: false, state: 'missing', provider: '', repository: '', commit: '', workspace: '', path: '', permalink: '', digest: '', basis: '', blocker }); }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
|
|
3
|
+
export const PORTABLE_CANONICAL_BOOTSTRAP_DOCS_COMMIT = '3988951208eb9a8926e84ab42625d4b42fa00c2d';
|
|
4
|
+
export const PORTABLE_CANONICAL_BOOTSTRAP_ROOT = fileURLToPath(new URL(`./docs-${PORTABLE_CANONICAL_BOOTSTRAP_DOCS_COMMIT}/`, import.meta.url));
|
|
5
|
+
|
|
6
|
+
export const portableCanonicalBootstrapRuntime = Object.freeze({
|
|
7
|
+
defaultSchemaMaterialPaths: Object.freeze([PORTABLE_CANONICAL_BOOTSTRAP_ROOT]),
|
|
8
|
+
defaultSchemaSource: Object.freeze({
|
|
9
|
+
repository: 'Tiinex/docs',
|
|
10
|
+
commit: PORTABLE_CANONICAL_BOOTSTRAP_DOCS_COMMIT,
|
|
11
|
+
sourcePathPrefix: '.topics/.schemas'
|
|
12
|
+
}),
|
|
13
|
+
defaultSchemaProviderSource: Object.freeze({
|
|
14
|
+
id: 'tiinex-docs',
|
|
15
|
+
repository: 'Tiinex/docs',
|
|
16
|
+
ref: 'master',
|
|
17
|
+
source: 'canonical-bootstrap-runtime-profile'
|
|
18
|
+
}),
|
|
19
|
+
defaultCarrierProfile: Object.freeze({
|
|
20
|
+
id: 'tiinex-foundation',
|
|
21
|
+
requiredMajorWorkspaceIds: Object.freeze(['business', 'docs', 'site']),
|
|
22
|
+
source: 'canonical-bootstrap-runtime-profile'
|
|
23
|
+
})
|
|
24
|
+
});
|