@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,377 @@
|
|
|
1
|
+
import { parseArtifactMarkdown } from '../../../artifacts/artifact.parse.js';
|
|
2
|
+
import { canonicalC14nV2SelfState, validatedC14nV2PrimarySelfDigest, verifyC14nV2TargetSelfDigest } from '../../../integrity/integrity.c14nV2.js';
|
|
3
|
+
import { C14N_V2_METHOD_ID } from '../../../integrity/integrity.methodReference.js';
|
|
4
|
+
import { resolveLineage } from '../../../lineage/lineage.resolve.js';
|
|
5
|
+
import { normalizePortableInput } from '../input/portable.input.js';
|
|
6
|
+
import { portableFinding, summarizePortableFindings } from '../findings.js';
|
|
7
|
+
import { classifyPortablePublicationOrigin } from './lineage.publicationQualification.js';
|
|
8
|
+
import { normalizePublicationProviderReceipts } from './lineage.publicationProviderReceipts.js';
|
|
9
|
+
|
|
10
|
+
export const PORTABLE_LINEAGE_INTEGRITY_INSPECTION_SCHEMA_ID = 'tiinex.portable.lineage-integrity-inspection.v1';
|
|
11
|
+
export const PORTABLE_LINEAGE_INTEGRITY_PLAN_MODE = 'lineage-integrity-inspection';
|
|
12
|
+
|
|
13
|
+
export function inspectPortableLineageIntegrity(input = {}, options = {}) {
|
|
14
|
+
const material = normalizePortableInput(input.materials || input);
|
|
15
|
+
const publicationProviderEvidence = normalizePublicationProviderReceipts(input);
|
|
16
|
+
const records = (material.records || []).filter((record) => record?.path && typeof record.markdown === 'string' && record.markdown);
|
|
17
|
+
const lineage = resolveLineage(records, { depth: options.depth || 'portable-lineage-integrity-inspection' });
|
|
18
|
+
const nodeById = new Map((lineage.nodes || []).map((node) => [String(node.id || ''), node]));
|
|
19
|
+
const parentEdgesByChild = indexParentEdges(lineage.edges || []);
|
|
20
|
+
const descendantsByParent = indexDescendants(lineage.edges || [], nodeById);
|
|
21
|
+
const findings = [...(material.findings || []), ...(publicationProviderEvidence.findings || [])];
|
|
22
|
+
const artifacts = [];
|
|
23
|
+
|
|
24
|
+
for (const node of lineage.nodes || []) {
|
|
25
|
+
const record = node.record || {};
|
|
26
|
+
const inspection = inspectOneArtifact({ node, record, lineage, parentEdgesByChild, nodeById, descendantsByParent, publicationProviderEvidence });
|
|
27
|
+
artifacts.push(inspection);
|
|
28
|
+
findings.push(...inspectionFindings(inspection));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const repairPlan = buildLineageIntegrityRepairPlan(artifacts, findings);
|
|
32
|
+
return Object.freeze({
|
|
33
|
+
schema: PORTABLE_LINEAGE_INTEGRITY_INSPECTION_SCHEMA_ID,
|
|
34
|
+
status: inspectionStatus(artifacts),
|
|
35
|
+
artifacts: Object.freeze(artifacts),
|
|
36
|
+
repairPlan,
|
|
37
|
+
publicationProviderEvidence: Object.freeze({ summary: publicationProviderEvidence.summary, boundary: publicationProviderEvidence.boundary }),
|
|
38
|
+
lineage: Object.freeze({
|
|
39
|
+
schema: lineage.schema,
|
|
40
|
+
stats: Object.freeze({ ...(lineage.stats || {}) }),
|
|
41
|
+
findings: Object.freeze([...(lineage.findings || [])])
|
|
42
|
+
}),
|
|
43
|
+
boundary: Object.freeze({
|
|
44
|
+
readOnly: true,
|
|
45
|
+
sourceMutation: false,
|
|
46
|
+
remoteWrite: false,
|
|
47
|
+
automaticRepair: false,
|
|
48
|
+
inferenceFromChronologyFilenameOrLayout: false,
|
|
49
|
+
parentAuthority: 'declared Parent Trace/Origin plus exact loaded resolution only',
|
|
50
|
+
publicationQualification: 'declared locator and record-local evidence are descriptive only; qualified state requires accepted repository-read provider bytes bound to the exact locator and loaded Parent material'
|
|
51
|
+
}),
|
|
52
|
+
compatibility: Object.freeze({
|
|
53
|
+
consumer: 'Tooling 022 and later repair consumers',
|
|
54
|
+
note: 'publicationOrigin.state=qualified requires accepted repository-read provider material whose returned bytes bind the declared locator to the loaded Parent. Record-local evidence and commit-pinned URL shape are not mutation authority.'
|
|
55
|
+
}),
|
|
56
|
+
findings: Object.freeze(findings),
|
|
57
|
+
findingSummary: summarizePortableFindings(findings)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function buildLineageIntegrityRepairPlan(artifacts = [], findings = []) {
|
|
62
|
+
const steps = artifacts.map((artifact, index) => repairStepForArtifact(artifact, index + 1));
|
|
63
|
+
const blocked = steps.some((step) => step.approval.disposition === 'blocked');
|
|
64
|
+
const review = steps.some((step) => step.approval.disposition === 'requires-explicit-approval');
|
|
65
|
+
const proposed = steps.some((step) => step.approval.disposition === 'proposed');
|
|
66
|
+
return Object.freeze({
|
|
67
|
+
schema: 'tiinex.portable.repair-plan.v1',
|
|
68
|
+
mode: PORTABLE_LINEAGE_INTEGRITY_PLAN_MODE,
|
|
69
|
+
status: blocked ? 'blocked' : review ? 'review-required' : proposed ? 'proposed' : 'clean',
|
|
70
|
+
steps: Object.freeze(steps),
|
|
71
|
+
boundary: Object.freeze({
|
|
72
|
+
automaticRewrite: false,
|
|
73
|
+
preserveUnknownSections: true,
|
|
74
|
+
preserveSourceAndContinuity: true,
|
|
75
|
+
claimExactQualificationAfterRepair: false,
|
|
76
|
+
readOnlyInspection: true,
|
|
77
|
+
bodyMutationAuthorized: false,
|
|
78
|
+
publicationMutationAuthorized: false,
|
|
79
|
+
descendantRefreshAutomatic: false
|
|
80
|
+
}),
|
|
81
|
+
findingSummary: summarizePortableFindings(findings)
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function inspectOneArtifact({ node, record, lineage, parentEdgesByChild, nodeById, descendantsByParent, publicationProviderEvidence }) {
|
|
86
|
+
const path = String(record.path || node.path || '');
|
|
87
|
+
const id = String(record.id || node.id || path);
|
|
88
|
+
let parsed;
|
|
89
|
+
try { parsed = parseArtifactMarkdown(record.markdown || ''); }
|
|
90
|
+
catch (error) {
|
|
91
|
+
return freezeInspection({
|
|
92
|
+
id, path, schemaId: String(record.schemaId || ''), title: String(record.title || path),
|
|
93
|
+
state: 'unsupported', reasons: [`parse-failed:${error?.message || 'unknown'}`],
|
|
94
|
+
parentAvailability: state('unsupported', 'artifact-parse-failed'),
|
|
95
|
+
parentSchema: state('unsupported', 'artifact-parse-failed'),
|
|
96
|
+
parentPrimarySelf: state('unsupported', 'artifact-parse-failed'),
|
|
97
|
+
childSelf: state('unsupported', 'artifact-parse-failed'),
|
|
98
|
+
parentTarget: state('unsupported', 'artifact-parse-failed'),
|
|
99
|
+
publicationOrigin: state('unsupported', 'artifact-parse-failed'),
|
|
100
|
+
exactParent: emptyParent(), downstreamDescendants: descendantsFor(id, descendantsByParent),
|
|
101
|
+
repairCandidate: emptyRepairCandidate()
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const parentEnvelope = parsed.envelope?.parent || {};
|
|
106
|
+
const hasParent = Boolean(parentEnvelope.schema?.id || parentEnvelope.trace || parentEnvelope.originEntries?.length || parentEnvelope.origin);
|
|
107
|
+
const childSelfRaw = canonicalC14nV2SelfState(record.markdown || '');
|
|
108
|
+
const childSelf = normalizeSelfState(childSelfRaw);
|
|
109
|
+
if (!hasParent) {
|
|
110
|
+
return freezeInspection({
|
|
111
|
+
id, path, schemaId: String(record.schemaId || parsed.envelope?.current?.schema?.id || ''), title: String(record.title || parsed.title || path),
|
|
112
|
+
state: childSelf.state === 'verified' ? 'healthy' : childSelf.state === 'mismatch' ? 'child-self-mismatch' : 'child-self-unavailable',
|
|
113
|
+
reasons: childSelf.state === 'verified' ? [] : [childSelf.reason],
|
|
114
|
+
parentAvailability: state('root', 'no-declared-parent'),
|
|
115
|
+
parentSchema: state('not-applicable', 'root-artifact'),
|
|
116
|
+
parentPrimarySelf: state('not-applicable', 'root-artifact'),
|
|
117
|
+
childSelf,
|
|
118
|
+
parentTarget: state('not-applicable', 'root-artifact'),
|
|
119
|
+
publicationOrigin: state('not-applicable', 'root-artifact'),
|
|
120
|
+
exactParent: emptyParent(), downstreamDescendants: descendantsFor(id, descendantsByParent),
|
|
121
|
+
repairCandidate: emptyRepairCandidate()
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const parentResolution = resolveParentForNode(node, lineage, parentEdgesByChild, nodeById);
|
|
126
|
+
const exactParentNode = parentResolution.node;
|
|
127
|
+
const exactParentRecord = exactParentNode?.record || null;
|
|
128
|
+
const parentSelfRaw = exactParentRecord ? validatedC14nV2PrimarySelfDigest(exactParentRecord.markdown || '') : null;
|
|
129
|
+
const parentPrimarySelf = exactParentRecord ? normalizeParentSelfState(parentSelfRaw) : state('unavailable', parentResolution.reason || 'parent-unavailable');
|
|
130
|
+
const parentSchema = inspectResolvedParentSchema(parentEnvelope, exactParentRecord, parentResolution);
|
|
131
|
+
const publicationOrigin = classifyPortablePublicationOrigin(parentEnvelope, record, exactParentRecord, publicationProviderEvidence);
|
|
132
|
+
const expectedIntegrityTarget = exactIntegrityTarget(parentEnvelope, publicationOrigin);
|
|
133
|
+
const targetInspection = inspectParentTarget(parsed, exactParentRecord, expectedIntegrityTarget);
|
|
134
|
+
const exactParent = Object.freeze({
|
|
135
|
+
id: String(exactParentRecord?.id || exactParentNode?.id || ''),
|
|
136
|
+
path: String(exactParentRecord?.path || exactParentNode?.path || ''),
|
|
137
|
+
trace: String(parentEnvelope.trace || ''),
|
|
138
|
+
expectedIntegrityTarget,
|
|
139
|
+
publicationLocator: String(publicationOrigin.locator || '')
|
|
140
|
+
});
|
|
141
|
+
const reasons = [];
|
|
142
|
+
const primaryState = choosePrimaryState({ parentResolution, parentSchema, parentPrimarySelf, childSelf, targetInspection, publicationOrigin }, reasons);
|
|
143
|
+
const repairCandidate = Object.freeze({
|
|
144
|
+
kind: targetInspection.state === 'missing' ? 'backfill' : targetInspection.state === 'mismatch' ? 'mismatch-review' : 'none',
|
|
145
|
+
oldTargetDigest: String(targetInspection.declaredValue || ''),
|
|
146
|
+
candidateTargetDigest: parentPrimarySelf.state === 'verified' ? String(parentPrimarySelf.value || '') : '',
|
|
147
|
+
expectedTarget: expectedIntegrityTarget,
|
|
148
|
+
publicationLocator: String(publicationOrigin.locator || '')
|
|
149
|
+
});
|
|
150
|
+
return freezeInspection({
|
|
151
|
+
id, path, schemaId: String(record.schemaId || parsed.envelope?.current?.schema?.id || ''), title: String(record.title || parsed.title || path),
|
|
152
|
+
state: primaryState, reasons,
|
|
153
|
+
parentAvailability: parentResolution.state,
|
|
154
|
+
parentSchema,
|
|
155
|
+
parentPrimarySelf,
|
|
156
|
+
childSelf,
|
|
157
|
+
parentTarget: targetInspection,
|
|
158
|
+
publicationOrigin,
|
|
159
|
+
exactParent,
|
|
160
|
+
downstreamDescendants: descendantsFor(id, descendantsByParent),
|
|
161
|
+
repairCandidate
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function resolveParentForNode(node, lineage, parentEdgesByChild, nodeById) {
|
|
166
|
+
const nodeId = String(node.id || '');
|
|
167
|
+
const ambiguity = (lineage.findings || []).find((finding) => finding.nodeId === nodeId && finding.code === 'lineage.target.ambiguous');
|
|
168
|
+
if (ambiguity) return { state: state('ambiguous', 'declared-parent-ambiguous'), reason: 'declared-parent-ambiguous', node: null };
|
|
169
|
+
const edges = parentEdgesByChild.get(nodeId) || [];
|
|
170
|
+
const exact = edges.filter((edge) => edge.from && edge.status !== 'missing');
|
|
171
|
+
if (exact.length === 1) return { state: state('resolved', exact[0].status || 'resolved'), reason: '', node: nodeById.get(String(exact[0].from || '')) || null };
|
|
172
|
+
if (exact.length > 1) return { state: state('ambiguous', 'multiple-parent-edges'), reason: 'multiple-parent-edges', node: null };
|
|
173
|
+
const missing = edges.find((edge) => edge.status === 'missing');
|
|
174
|
+
return { state: state('unresolved', missing ? 'declared-parent-not-loaded' : 'declared-parent-unresolved'), reason: missing ? 'declared-parent-not-loaded' : 'declared-parent-unresolved', node: null };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function inspectResolvedParentSchema(parentEnvelope = {}, parentRecord = null, parentResolution = {}) {
|
|
178
|
+
const declared = String(parentEnvelope?.schema?.id || '');
|
|
179
|
+
if (!declared) return state('missing', 'parent-schema-missing');
|
|
180
|
+
if (!parentRecord?.markdown) return state('unavailable', parentResolution?.reason || 'resolved-parent-bytes-unavailable');
|
|
181
|
+
try {
|
|
182
|
+
const parsedParent = parseArtifactMarkdown(parentRecord.markdown || '');
|
|
183
|
+
const actual = String(parsedParent.envelope?.current?.schema?.id || '');
|
|
184
|
+
if (!actual) return state('unavailable', 'resolved-parent-current-schema-unavailable');
|
|
185
|
+
if (actual !== declared) return Object.freeze({ state: 'mismatch', reason: 'declared-parent-schema-disagrees-with-resolved-parent', declaredSchemaId: declared, resolvedSchemaId: actual });
|
|
186
|
+
return Object.freeze({ state: 'verified', reason: '', declaredSchemaId: declared, resolvedSchemaId: actual });
|
|
187
|
+
} catch (error) {
|
|
188
|
+
return state('unavailable', `resolved-parent-parse-failed:${error?.message || 'unknown'}`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function exactIntegrityTarget(parentEnvelope = {}, publicationOrigin = {}) {
|
|
193
|
+
if (publicationOrigin.locator) return String(publicationOrigin.locator);
|
|
194
|
+
return String(parentEnvelope.trace || '');
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function inspectParentTarget(parsed = {}, parentRecord = null, expectedTarget = '') {
|
|
198
|
+
const entries = (parsed.integrity?.entries || []).filter((entry) => entry?.method === C14N_V2_METHOD_ID && String(entry?.towards || '') !== 'self');
|
|
199
|
+
if (!entries.length) return targetState('missing', 'parent-target-entry-missing', '', expectedTarget, '');
|
|
200
|
+
if (entries.length !== 1) return targetState('ambiguous', 'multiple-parent-target-entries', '', expectedTarget, '');
|
|
201
|
+
const entry = entries[0];
|
|
202
|
+
const declaredTarget = String(entry.towards || '');
|
|
203
|
+
const declaredValue = String(entry.value || '');
|
|
204
|
+
if (!expectedTarget) return targetState('unsupported', 'expected-parent-target-unavailable', declaredValue, expectedTarget, declaredTarget);
|
|
205
|
+
if (declaredTarget !== expectedTarget) return targetState('mismatch', 'parent-target-locator-mismatch', declaredValue, expectedTarget, declaredTarget);
|
|
206
|
+
if (!parentRecord) return targetState('unavailable', 'resolved-parent-bytes-unavailable', declaredValue, expectedTarget, declaredTarget);
|
|
207
|
+
const verification = verifyC14nV2TargetSelfDigest({ value: declaredValue, targetMarkdown: parentRecord.markdown || '' });
|
|
208
|
+
if (verification.state === 'verified') return targetState('verified', '', declaredValue, expectedTarget, declaredTarget, verification.targetValue);
|
|
209
|
+
if (verification.state === 'mismatch') return targetState('mismatch', verification.reason || 'target-self-digest-mismatch', declaredValue, expectedTarget, declaredTarget, verification.targetValue);
|
|
210
|
+
if (verification.state === 'target-self-mismatch') return targetState('parent-self-mismatch', verification.reason || 'parent-self-mismatch', declaredValue, expectedTarget, declaredTarget, verification.targetValue);
|
|
211
|
+
return targetState(verification.state || 'unavailable', verification.reason || verification.state || 'unavailable', declaredValue, expectedTarget, declaredTarget, verification.targetValue);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function choosePrimaryState({ parentResolution, parentSchema, parentPrimarySelf, childSelf, targetInspection, publicationOrigin }, reasons) {
|
|
215
|
+
const consider = (condition, value, reason) => {
|
|
216
|
+
if (!condition) return '';
|
|
217
|
+
if (reason) reasons.push(reason);
|
|
218
|
+
return value;
|
|
219
|
+
};
|
|
220
|
+
return consider(parentResolution.state.state === 'ambiguous', 'parent-ambiguous', parentResolution.state.reason)
|
|
221
|
+
|| consider(parentResolution.state.state !== 'resolved', 'parent-unresolved', parentResolution.state.reason)
|
|
222
|
+
|| consider(parentSchema.state === 'mismatch', 'parent-schema-mismatch', parentSchema.reason)
|
|
223
|
+
|| consider(parentSchema.state !== 'verified', 'parent-schema-unavailable', parentSchema.reason)
|
|
224
|
+
|| consider(parentPrimarySelf.state === 'mismatch', 'parent-self-mismatch', parentPrimarySelf.reason)
|
|
225
|
+
|| consider(parentPrimarySelf.state !== 'verified', 'parent-self-unavailable', parentPrimarySelf.reason)
|
|
226
|
+
|| consider(childSelf.state === 'mismatch', 'child-self-mismatch', childSelf.reason)
|
|
227
|
+
|| consider(childSelf.state !== 'verified', 'child-self-unavailable', childSelf.reason)
|
|
228
|
+
|| consider(targetInspection.state === 'missing', 'parent-target-missing', targetInspection.reason)
|
|
229
|
+
|| consider(targetInspection.state === 'mismatch', 'parent-target-mismatch', targetInspection.reason)
|
|
230
|
+
|| consider(targetInspection.state !== 'verified', targetInspection.state === 'ambiguous' ? 'parent-target-ambiguous' : 'unsupported', targetInspection.reason)
|
|
231
|
+
|| consider(publicationOrigin.state === 'contradictory', 'publication-origin-contradictory', publicationOrigin.reason)
|
|
232
|
+
|| consider(publicationOrigin.state === 'stale', 'publication-origin-stale', publicationOrigin.reason)
|
|
233
|
+
|| consider(publicationOrigin.state === 'unresolved', 'publication-origin-unresolved', publicationOrigin.reason)
|
|
234
|
+
|| consider(publicationOrigin.state === 'missing', 'publication-origin-missing', publicationOrigin.reason)
|
|
235
|
+
|| 'healthy';
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function repairStepForArtifact(artifact, order) {
|
|
239
|
+
const blockers = [];
|
|
240
|
+
let action = 'no-change';
|
|
241
|
+
let disposition = 'no-change';
|
|
242
|
+
let priority = 'optional';
|
|
243
|
+
const willChangeSelf = ['parent-target-missing', 'parent-target-mismatch'].includes(artifact.state);
|
|
244
|
+
|
|
245
|
+
if (artifact.state === 'parent-target-missing') {
|
|
246
|
+
action = 'backfill-parent-target-v2';
|
|
247
|
+
disposition = 'proposed';
|
|
248
|
+
priority = 'important';
|
|
249
|
+
if (artifact.parentAvailability.state !== 'resolved') blockers.push(`parent-${artifact.parentAvailability.state}`);
|
|
250
|
+
if (artifact.parentPrimarySelf.state !== 'verified') blockers.push(`parent-self-${artifact.parentPrimarySelf.state}`);
|
|
251
|
+
if (artifact.childSelf.state !== 'verified') blockers.push(`child-self-${artifact.childSelf.state}`);
|
|
252
|
+
if (!qualifiedPublicationOrigin(artifact.publicationOrigin.state)) blockers.push(`publication-origin-${artifact.publicationOrigin.state}`);
|
|
253
|
+
if (!artifact.exactParent.expectedIntegrityTarget) blockers.push('parent-target-locator-unavailable');
|
|
254
|
+
if (blockers.length) disposition = 'blocked';
|
|
255
|
+
} else if (artifact.state === 'parent-target-mismatch') {
|
|
256
|
+
action = 'review-parent-target-mismatch';
|
|
257
|
+
disposition = 'requires-explicit-approval';
|
|
258
|
+
priority = 'blocking';
|
|
259
|
+
blockers.push('existing-target-mismatch-is-not-refresh-authority');
|
|
260
|
+
if (artifact.parentPrimarySelf.state !== 'verified') blockers.push(`parent-self-${artifact.parentPrimarySelf.state}`);
|
|
261
|
+
if (!qualifiedPublicationOrigin(artifact.publicationOrigin.state)) blockers.push(`publication-origin-${artifact.publicationOrigin.state}`);
|
|
262
|
+
} else if (artifact.state !== 'healthy') {
|
|
263
|
+
action = 'resolve-lineage-integrity-blocker';
|
|
264
|
+
disposition = 'blocked';
|
|
265
|
+
priority = 'blocking';
|
|
266
|
+
blockers.push(...artifact.reasons);
|
|
267
|
+
if (artifact.publicationOrigin.state && !['qualified', 'qualified-local-relative', 'not-applicable'].includes(artifact.publicationOrigin.state)) blockers.push(`publication-origin-${artifact.publicationOrigin.state}`);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const descendants = willChangeSelf ? artifact.downstreamDescendants : [];
|
|
271
|
+
return Object.freeze({
|
|
272
|
+
order,
|
|
273
|
+
priority,
|
|
274
|
+
category: 'lineage-integrity',
|
|
275
|
+
action,
|
|
276
|
+
artifact: Object.freeze({ id: artifact.id, path: artifact.path, schemaId: artifact.schemaId }),
|
|
277
|
+
currentState: artifact.state,
|
|
278
|
+
exactParentTarget: Object.freeze({ ...artifact.exactParent }),
|
|
279
|
+
oldTargetDigest: artifact.repairCandidate.oldTargetDigest,
|
|
280
|
+
candidateTargetDigest: artifact.repairCandidate.candidateTargetDigest,
|
|
281
|
+
publicationLocator: artifact.repairCandidate.publicationLocator,
|
|
282
|
+
expectedMutation: Object.freeze({
|
|
283
|
+
headerFields: Object.freeze([]),
|
|
284
|
+
footerChanges: Object.freeze(willChangeSelf ? ['Parent-target c14n-v2 entry', 'primary self c14n-v2 Value after fixed sibling entry'] : []),
|
|
285
|
+
bodyMutation: false,
|
|
286
|
+
sourceMutation: false,
|
|
287
|
+
publicationMutation: false
|
|
288
|
+
}),
|
|
289
|
+
descendantImpact: Object.freeze(descendants),
|
|
290
|
+
approval: Object.freeze({
|
|
291
|
+
required: disposition === 'proposed' || disposition === 'requires-explicit-approval',
|
|
292
|
+
disposition,
|
|
293
|
+
blockers: Object.freeze(unique(blockers.filter(Boolean)))
|
|
294
|
+
}),
|
|
295
|
+
reasons: Object.freeze([...artifact.reasons])
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function inspectionFindings(artifact) {
|
|
300
|
+
if (artifact.state === 'healthy') return [];
|
|
301
|
+
const severity = ['parent-target-mismatch', 'parent-self-mismatch', 'child-self-mismatch', 'parent-ambiguous', 'parent-schema-mismatch'].includes(artifact.state) ? 'error' : 'warning';
|
|
302
|
+
const owner = findingOwnerForInspectionState(artifact.state);
|
|
303
|
+
return [portableFinding(severity, `portable.lineage-integrity.${artifact.state}`, `Lineage integrity inspection classified ${artifact.path || artifact.id} as ${artifact.state}.`, {
|
|
304
|
+
ref: artifact.path || artifact.id,
|
|
305
|
+
reason: artifact.reasons.join(', '),
|
|
306
|
+
params: { ...owner, reason: artifact.reasons.join(', ') }
|
|
307
|
+
})];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function findingOwnerForInspectionState(value = '') {
|
|
311
|
+
if (value === 'parent-schema-mismatch' || value === 'parent-schema-unavailable') return { field: 'Parent Schema' };
|
|
312
|
+
if (value === 'parent-unresolved' || value === 'parent-ambiguous') return { field: 'Trace' };
|
|
313
|
+
if (value.startsWith('parent-target') || value === 'parent-self-mismatch' || value === 'parent-self-unavailable' || value === 'child-self-mismatch' || value === 'child-self-unavailable') return { group: 'Continuity Integrity' };
|
|
314
|
+
if (value.startsWith('publication-origin')) return { group: 'Origin' };
|
|
315
|
+
return {};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function indexParentEdges(edges = []) {
|
|
319
|
+
const map = new Map();
|
|
320
|
+
for (const edge of edges) {
|
|
321
|
+
if (edge.kind !== 'parent') continue;
|
|
322
|
+
const key = String(edge.to || '');
|
|
323
|
+
const list = map.get(key) || [];
|
|
324
|
+
list.push(edge);
|
|
325
|
+
map.set(key, list);
|
|
326
|
+
}
|
|
327
|
+
return map;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function indexDescendants(edges = [], nodeById = new Map()) {
|
|
331
|
+
const children = new Map();
|
|
332
|
+
for (const edge of edges) {
|
|
333
|
+
if (edge.kind !== 'parent' || !edge.from || !edge.to || edge.status === 'missing') continue;
|
|
334
|
+
const key = String(edge.from || '');
|
|
335
|
+
const list = children.get(key) || [];
|
|
336
|
+
list.push(String(edge.to || ''));
|
|
337
|
+
children.set(key, list);
|
|
338
|
+
}
|
|
339
|
+
const result = new Map();
|
|
340
|
+
for (const parentId of nodeById.keys()) {
|
|
341
|
+
const seen = new Set([parentId]);
|
|
342
|
+
const queue = (children.get(parentId) || []).map((id) => ({ id, depth: 1 }));
|
|
343
|
+
const descendants = [];
|
|
344
|
+
while (queue.length) {
|
|
345
|
+
queue.sort((a, b) => a.depth - b.depth || nodePath(a.id, nodeById).localeCompare(nodePath(b.id, nodeById)));
|
|
346
|
+
const current = queue.shift();
|
|
347
|
+
if (!current || seen.has(current.id)) continue;
|
|
348
|
+
seen.add(current.id);
|
|
349
|
+
const node = nodeById.get(current.id);
|
|
350
|
+
descendants.push(Object.freeze({ id: current.id, path: String(node?.path || ''), depth: current.depth, reason: 'descendant-binds-to-artifact-self-digest' }));
|
|
351
|
+
for (const child of children.get(current.id) || []) queue.push({ id: child, depth: current.depth + 1 });
|
|
352
|
+
}
|
|
353
|
+
result.set(parentId, Object.freeze(descendants));
|
|
354
|
+
}
|
|
355
|
+
return result;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function descendantsFor(id, map) { return Object.freeze([...(map.get(String(id || '')) || [])]); }
|
|
359
|
+
function nodePath(id, nodeById) { return String(nodeById.get(String(id || ''))?.path || id || ''); }
|
|
360
|
+
function inspectionStatus(artifacts = []) {
|
|
361
|
+
if (artifacts.every((artifact) => artifact.state === 'healthy')) return 'healthy';
|
|
362
|
+
if (artifacts.some((artifact) => ['parent-target-mismatch', 'parent-self-mismatch', 'child-self-mismatch', 'parent-ambiguous', 'parent-schema-mismatch'].includes(artifact.state))) return 'attention-required';
|
|
363
|
+
return 'repair-planning-available';
|
|
364
|
+
}
|
|
365
|
+
function normalizeSelfState(value = {}) {
|
|
366
|
+
return Object.freeze({ state: value.state === 'prepared' ? 'unavailable' : value.state || 'unavailable', reason: value.reason || (value.state === 'prepared' ? 'self-value-missing' : value.state || 'unavailable'), value: value.declaredValue || '', computedValue: value.computedValue || '' });
|
|
367
|
+
}
|
|
368
|
+
function normalizeParentSelfState(value = {}) {
|
|
369
|
+
return Object.freeze({ state: value.state || 'unavailable', reason: value.reason || '', value: value.value || '', declaredValue: value.declaredValue || '', computedValue: value.computedValue || '' });
|
|
370
|
+
}
|
|
371
|
+
function qualifiedPublicationOrigin(value = '') { return value === 'qualified' || value === 'qualified-local-relative'; }
|
|
372
|
+
function state(value, reason = '') { return Object.freeze({ state: value, reason }); }
|
|
373
|
+
function targetState(value, reason = '', declaredValue = '', expectedTarget = '', declaredTarget = '', targetValue = '') { return Object.freeze({ state: value, reason, declaredValue, expectedTarget, declaredTarget, targetValue }); }
|
|
374
|
+
function emptyParent() { return Object.freeze({ id: '', path: '', trace: '', expectedIntegrityTarget: '', publicationLocator: '' }); }
|
|
375
|
+
function emptyRepairCandidate() { return Object.freeze({ kind: 'none', oldTargetDigest: '', candidateTargetDigest: '', expectedTarget: '', publicationLocator: '' }); }
|
|
376
|
+
function freezeInspection(value) { return Object.freeze({ ...value, reasons: Object.freeze([...(value.reasons || [])]) }); }
|
|
377
|
+
function unique(values = []) { return [...new Set(values.map(String).filter(Boolean))]; }
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const REVIEW_STATES = new Set(['parent-target-mismatch', 'parent-self-mismatch', 'child-self-mismatch', 'parent-ambiguous', 'parent-target-ambiguous']);
|
|
2
|
+
const APPROVED = new Set(['approved', 'accepted']);
|
|
3
|
+
|
|
4
|
+
export function safeActionsFor({ state, step, decision, intake, localResultReady }) {
|
|
5
|
+
const actions = [action('inspect', 'available'), action('preview', step?.action && step.action !== 'no-change' ? 'available' : 'not-applicable')];
|
|
6
|
+
if (localResultReady) {
|
|
7
|
+
actions.push(action('export-changeset', 'available'));
|
|
8
|
+
return Object.freeze(actions);
|
|
9
|
+
}
|
|
10
|
+
if (decision.required) actions.push(action('approve', decision.blockers.length ? 'blocked' : 'required'));
|
|
11
|
+
else actions.push(action('approve', 'not-required'));
|
|
12
|
+
if (state === 'repair-available' || state === 'review-required') {
|
|
13
|
+
const applyState = !intake.localOwned ? 'requires-local-owned-material' : decision.blockers.length ? 'blocked' : decision.state === 'approved' || !decision.required ? 'available' : 'after-approval';
|
|
14
|
+
actions.push(action('apply-local-result', applyState));
|
|
15
|
+
} else if (state === 'blocked') actions.push(action('apply-local-result', 'blocked'));
|
|
16
|
+
actions.push(action('export-changeset', 'after-local-result'));
|
|
17
|
+
return Object.freeze(actions);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function opportunityState(artifact = {}, step = null) {
|
|
21
|
+
if (REVIEW_STATES.has(String(artifact.state || '')) || step?.approval?.disposition === 'requires-explicit-approval') return 'review-required';
|
|
22
|
+
if (step?.approval?.disposition === 'proposed') return 'repair-available';
|
|
23
|
+
if (artifact.state === 'healthy' && (!step || step.action === 'no-change')) return 'healthy';
|
|
24
|
+
return 'blocked';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function findingClassFor(artifact = {}, step = null, receipt = null) {
|
|
28
|
+
if (receipt && ['changed', 'no-op'].includes(String(receipt.status || ''))) return 'repaired-local-result';
|
|
29
|
+
if (step?.action === 'update-parent-origin-permalink') return 'qualified-permalink-repair';
|
|
30
|
+
if (artifact.publicationOrigin?.state === 'missing' && step?.approval?.disposition === 'blocked') return 'publication-locator-unavailable';
|
|
31
|
+
if (step?.action === 'backfill-parent-target-v2') return 'missing-parent-target';
|
|
32
|
+
if (step?.action === 'review-parent-target-mismatch') return 'parent-target-mismatch';
|
|
33
|
+
if (artifact.state === 'healthy') return 'healthy-lineage';
|
|
34
|
+
if (artifact.publicationOrigin?.state === 'missing') return 'publication-locator-unavailable';
|
|
35
|
+
return String(artifact.state || 'lineage-integrity-blocker');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function severityFor(artifact = {}, state = '') {
|
|
39
|
+
if (state === 'healthy' || state === 'local-result-ready') return 'info';
|
|
40
|
+
if (state === 'review-required' || REVIEW_STATES.has(String(artifact.state || ''))) return 'error';
|
|
41
|
+
return 'warning';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function trustImpactFor(artifact = {}, state = '') {
|
|
45
|
+
if (state === 'healthy') return 'none';
|
|
46
|
+
if (state === 'local-result-ready') return 'local-repair-produced-not-published';
|
|
47
|
+
if (state === 'review-required') return 'trust-sensitive-review-required';
|
|
48
|
+
if (artifact.publicationOrigin?.state === 'missing') return 'publication-truth-unavailable';
|
|
49
|
+
return 'lineage-verification-incomplete';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function humanExplanation({ artifact = {}, step = null, state = '', permalink = false }) {
|
|
53
|
+
const path = normalizePath(artifact.path || '') || 'artifact';
|
|
54
|
+
if (state === 'local-result-ready') return Object.freeze({ headline: 'Local repair is ready to export.', detail: `${path} has a local repair result; source and publication state were not mutated.`, nextAction: 'Export the changeset or merge it through the normal workflow.' });
|
|
55
|
+
if (state === 'healthy') return Object.freeze({ headline: 'Lineage integrity is healthy.', detail: `${path} matches its resolved Parent integrity target.`, nextAction: 'No repair action is required.' });
|
|
56
|
+
if (permalink) return Object.freeze({ headline: 'Qualified Parent permalink repair is available.', detail: 'Accepted provider bytes identify one exact immutable Parent URL; nothing has been applied.', nextAction: 'Review the header/footer mutation and approve it for local application.' });
|
|
57
|
+
if (step?.action === 'review-parent-target-mismatch') return Object.freeze({ headline: 'Parent target mismatch needs review.', detail: 'The recorded Parent target does not match the loaded Parent truth and must not be refreshed automatically.', nextAction: 'Provide a semantic disposition and authority before local application.' });
|
|
58
|
+
if (artifact.publicationOrigin?.state === 'missing') return Object.freeze({ headline: 'Parent publication locator is unavailable.', detail: 'No truthful immutable Parent locator is currently qualified, so none was fabricated.', nextAction: 'Keep this repair blocked until publication evidence exists.' });
|
|
59
|
+
if (step?.action === 'backfill-parent-target-v2') return Object.freeze({ headline: 'Parent integrity repair is ready to review.', detail: 'A verified Parent target can be added without changing authored body content.', nextAction: 'Review the cascade impact and approve the local repair.' });
|
|
60
|
+
return Object.freeze({ headline: 'Lineage repair is blocked.', detail: `${path} has unresolved integrity or publication evidence.`, nextAction: 'Resolve the listed blocker before applying a repair.' });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function mutationProjection(step = null) {
|
|
64
|
+
if (!step || step.action === 'no-change') return Object.freeze({ required: false, headerFields: Object.freeze([]), footerChanges: Object.freeze([]), bodyMutation: false, sourceMutation: false, publicationMutation: false });
|
|
65
|
+
return Object.freeze({
|
|
66
|
+
required: true,
|
|
67
|
+
headerFields: Object.freeze([...(step.expectedMutation?.headerFields || [])]),
|
|
68
|
+
footerChanges: Object.freeze([...(step.expectedMutation?.footerChanges || [])]),
|
|
69
|
+
bodyMutation: false,
|
|
70
|
+
sourceMutation: false,
|
|
71
|
+
publicationMutation: false
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function approvalState(approval = null, step = null) {
|
|
76
|
+
if (!step?.approval?.required) return 'not-required';
|
|
77
|
+
if (!approval) return 'pending';
|
|
78
|
+
return APPROVED.has(String(approval.state || approval.disposition || '').toLowerCase()) ? 'approved' : 'not-approved';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function action(id, state) { return Object.freeze({ id, state }); }
|
|
82
|
+
function normalizePath(value = '') { return String(value || '').replace(/\\/g, '/').replace(/^\.\//, '').replace(/^\/+|\/+$/g, ''); }
|