@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,193 @@
|
|
|
1
|
+
export function compileOrdinaryFieldAuthority(document = {}) {
|
|
2
|
+
const groups = document?.validation?.groups || [];
|
|
3
|
+
const targeting = groups.find((group) => exactToken(group.name) === 'Ordinary Instance Field Targeting');
|
|
4
|
+
const override = groups.find((group) => exactToken(group.name) === 'Instance Target');
|
|
5
|
+
if (!targeting || !override) return null;
|
|
6
|
+
|
|
7
|
+
const targetingRules = categoryItems(targeting, ['Rules']).map(exactToken);
|
|
8
|
+
const overrideRules = categoryItems(override, ['Rules']).map(exactToken);
|
|
9
|
+
const overrideShape = categoryItems(override, ['Required Shape']).map(cleanToken);
|
|
10
|
+
const hasDefault = targetingRules.includes('Unless an ordinary instance-field group declares `Instance Target`, its Artifact instance target is the exact second-level heading whose text equals the contract group name.');
|
|
11
|
+
const hasLocalOwnership = targetingRules.includes('Ordinary field occurrences are owned only by their authorized target block. Fields inside a nested heading or named-declaration-owned region are not claimed by an ancestor ordinary group merely because the label matches.');
|
|
12
|
+
const hasSingularOverride = overrideRules.includes('`Instance Target` is singular; it must not be used as a list of multiple Artifact targets.');
|
|
13
|
+
const hasLiteralHeadingShape = overrideShape.includes('one literal Markdown heading token');
|
|
14
|
+
if (!hasDefault || !hasLocalOwnership || !hasSingularOverride || !hasLiteralHeadingShape) return null;
|
|
15
|
+
|
|
16
|
+
return Object.freeze({
|
|
17
|
+
state: 'available',
|
|
18
|
+
sourceSchemaId: document?.schemaId || '',
|
|
19
|
+
defaultTarget: 'exact-second-level-same-name',
|
|
20
|
+
overrideCategory: 'Instance Target',
|
|
21
|
+
overrideShape: 'one-literal-markdown-heading-token',
|
|
22
|
+
rules: Object.freeze([...targetingRules, ...overrideRules])
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function mergeOrdinaryFieldAuthorities(authorities = []) {
|
|
27
|
+
const available = authorities.filter((authority) => authority?.state === 'available');
|
|
28
|
+
if (!available.length) return Object.freeze({ state: 'unavailable', sources: Object.freeze([]) });
|
|
29
|
+
const signatures = unique(available.map((authority) => `${authority.defaultTarget}\u0000${authority.overrideCategory}\u0000${authority.overrideShape}`));
|
|
30
|
+
if (signatures.length !== 1) {
|
|
31
|
+
return Object.freeze({
|
|
32
|
+
state: 'contradictory',
|
|
33
|
+
sources: Object.freeze(unique(available.map((authority) => authority.sourceSchemaId))),
|
|
34
|
+
findings: Object.freeze(['Ordinary instance-field authority declarations disagree.'])
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return Object.freeze({
|
|
38
|
+
state: 'available',
|
|
39
|
+
sources: Object.freeze(unique(available.map((authority) => authority.sourceSchemaId))),
|
|
40
|
+
defaultTarget: available[0].defaultTarget,
|
|
41
|
+
overrideCategory: available[0].overrideCategory,
|
|
42
|
+
overrideShape: available[0].overrideShape
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function compileOrdinaryInstanceFieldGroups({ groups = [], declarations = [], requiredSections = [], requiredHeadings = [], optionalSections = [], authority = null } = {}) {
|
|
47
|
+
if (authority?.state !== 'available') return Object.freeze([]);
|
|
48
|
+
const declarationGroups = new Set((declarations || []).map((item) => exactToken(item.group)));
|
|
49
|
+
const requiredTargets = new Set((requiredSections || []).map(exactToken));
|
|
50
|
+
const optionalTargets = new Set((optionalSections || []).map(exactToken));
|
|
51
|
+
const out = [];
|
|
52
|
+
|
|
53
|
+
const authoritySources = new Set(authority.sources || []);
|
|
54
|
+
for (const group of groups || []) {
|
|
55
|
+
if (!isOrdinaryInstanceFieldGroup(group, declarationGroups, authoritySources)) continue;
|
|
56
|
+
const contributors = (group.contributors?.length ? group.contributors : [group])
|
|
57
|
+
.map((contribution) => compileOrdinaryContribution(contribution, authority));
|
|
58
|
+
const target = reconcileOrdinaryTargets(contributors, requiredTargets, optionalTargets, requiredHeadings);
|
|
59
|
+
const requiredFields = unique(contributors.flatMap((item) => item.requiredFields || []));
|
|
60
|
+
const requiredKeys = new Set(requiredFields.map(exactToken));
|
|
61
|
+
const optionalFields = unique(contributors.flatMap((item) => item.optionalFields || []))
|
|
62
|
+
.filter((field) => !requiredKeys.has(exactToken(field)));
|
|
63
|
+
out.push(Object.freeze({
|
|
64
|
+
group: group.name,
|
|
65
|
+
qualification: target.qualification,
|
|
66
|
+
target,
|
|
67
|
+
requiredFields: Object.freeze(requiredFields),
|
|
68
|
+
optionalFields: Object.freeze(optionalFields),
|
|
69
|
+
contributors: Object.freeze(contributors)
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
return Object.freeze(out);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function compileOrdinaryGroupContribution(group = {}, authority = null) {
|
|
76
|
+
if (authority?.state !== 'available') return null;
|
|
77
|
+
const requiredFields = categoryItems(group, ['Required Fields']).map(cleanToken);
|
|
78
|
+
const optionalFields = categoryItems(group, ['Optional Fields']).map(cleanToken);
|
|
79
|
+
if (!requiredFields.length && !optionalFields.length) return null;
|
|
80
|
+
if (categoryItems(group, ['Entry Shape']).length) return null;
|
|
81
|
+
if ([...requiredFields, ...optionalFields].some((field) => !isOrdinaryUnqualifiedField(field))) return null;
|
|
82
|
+
return compileOrdinaryContribution(group, authority);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function isOrdinaryInstanceFieldGroup(group = {}, declarationGroups = new Set(), authoritySources = new Set()) {
|
|
86
|
+
if (declarationGroups.has(exactToken(group.name))) return false;
|
|
87
|
+
const contributors = group.contributors?.length ? group.contributors : [group];
|
|
88
|
+
if (contributors.length && contributors.every((item) => authoritySources.has(String(item.sourceSchemaId || '')))) return false;
|
|
89
|
+
const requiredFields = categoryItems(group, ['Required Fields']).map(cleanToken);
|
|
90
|
+
const optionalFields = categoryItems(group, ['Optional Fields']).map(cleanToken);
|
|
91
|
+
if (!requiredFields.length && !optionalFields.length) return false;
|
|
92
|
+
if (categoryItems(group, ['Entry Shape']).length) return false;
|
|
93
|
+
if ([...requiredFields, ...optionalFields].some((field) => !isOrdinaryUnqualifiedField(field))) return false;
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function isOrdinaryUnqualifiedField(field = '') {
|
|
98
|
+
const token = cleanToken(field);
|
|
99
|
+
return Boolean(token) && !token.includes('->') && !/^#{1,6}\s+/.test(token);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function compileOrdinaryContribution(group = {}, authority = {}) {
|
|
103
|
+
const requiredFields = categoryItems(group, ['Required Fields']).map(cleanToken).filter(isOrdinaryUnqualifiedField);
|
|
104
|
+
const optionalFields = categoryItems(group, ['Optional Fields']).map(cleanToken).filter(isOrdinaryUnqualifiedField);
|
|
105
|
+
const targetCategory = (group.categories || []).find((category) => exactToken(category.name) === exactToken(authority.overrideCategory));
|
|
106
|
+
const targetLabelPresent = Boolean(targetCategory) || (group.labelCandidates || []).some((label) => exactToken(label) === exactToken(authority.overrideCategory));
|
|
107
|
+
const tokens = targetCategory ? (targetCategory.items || []).map(cleanToken).filter(Boolean) : [];
|
|
108
|
+
let target;
|
|
109
|
+
if (!targetLabelPresent) {
|
|
110
|
+
target = Object.freeze({
|
|
111
|
+
heading: `## ${group.name}`,
|
|
112
|
+
title: group.name,
|
|
113
|
+
level: 2,
|
|
114
|
+
authority: 'root-same-name-default',
|
|
115
|
+
qualification: 'valid'
|
|
116
|
+
});
|
|
117
|
+
} else if (tokens.length !== 1) {
|
|
118
|
+
target = Object.freeze({
|
|
119
|
+
heading: '', title: '', level: 0,
|
|
120
|
+
authority: 'explicit-instance-target',
|
|
121
|
+
qualification: 'structurally-invalid',
|
|
122
|
+
findings: Object.freeze([`Instance Target requires exactly one heading token; observed ${tokens.length}.`])
|
|
123
|
+
});
|
|
124
|
+
} else {
|
|
125
|
+
const parsed = parseExactHeadingToken(tokens[0]);
|
|
126
|
+
target = parsed
|
|
127
|
+
? Object.freeze({ heading: tokens[0], title: parsed.title, level: parsed.level, authority: 'explicit-instance-target', qualification: 'valid' })
|
|
128
|
+
: Object.freeze({ heading: tokens[0], title: '', level: 0, authority: 'explicit-instance-target', qualification: 'structurally-invalid', findings: Object.freeze(['Instance Target must be one exact literal Markdown heading token.']) });
|
|
129
|
+
}
|
|
130
|
+
return Object.freeze({
|
|
131
|
+
sourceSchemaId: String(group.sourceSchemaId || ''),
|
|
132
|
+
group: group.name,
|
|
133
|
+
requiredFields: Object.freeze(unique(requiredFields)),
|
|
134
|
+
optionalFields: Object.freeze(unique(optionalFields)),
|
|
135
|
+
target
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function reconcileOrdinaryTargets(contributors = [], requiredTargets = new Set(), optionalTargets = new Set(), requiredHeadings = []) {
|
|
140
|
+
const invalid = contributors.filter((item) => item.target?.qualification !== 'valid');
|
|
141
|
+
if (invalid.length) {
|
|
142
|
+
return Object.freeze({
|
|
143
|
+
heading: '', title: '', level: 0, authority: '', requiredness: 'unresolved',
|
|
144
|
+
qualification: 'structurally-invalid',
|
|
145
|
+
findings: Object.freeze(invalid.flatMap((item) => item.target?.findings || []))
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
const headings = unique(contributors.map((item) => item.target.heading));
|
|
149
|
+
if (headings.length !== 1) {
|
|
150
|
+
return Object.freeze({
|
|
151
|
+
heading: '', title: '', level: 0, authority: 'conflicting-contributions', requiredness: 'unresolved',
|
|
152
|
+
qualification: 'conflicting',
|
|
153
|
+
findings: Object.freeze([`Ordinary group contributors resolve to different targets: ${headings.join(', ')}.`])
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
const first = contributors[0]?.target || {};
|
|
157
|
+
const title = first.title || exactHeadingTitle(first.heading);
|
|
158
|
+
const level = Number(first.level || 0);
|
|
159
|
+
const requiredByExactHeading = (requiredHeadings || []).some((item) => Number(item?.level || 0) === level && exactToken(item?.title) === exactToken(title));
|
|
160
|
+
const requiredBySection = level === 2 && requiredTargets.has(title);
|
|
161
|
+
const optionalBySection = level === 2 && optionalTargets.has(title);
|
|
162
|
+
const required = requiredByExactHeading || requiredBySection;
|
|
163
|
+
const optional = optionalBySection;
|
|
164
|
+
// Root inheritance is additive and descendants may strengthen local requirements.
|
|
165
|
+
// Therefore an inherited optional target plus a required target resolves to required;
|
|
166
|
+
// a field requirement by itself never participates in this decision.
|
|
167
|
+
const requiredness = required ? 'required' : optional ? 'optional' : 'unresolved';
|
|
168
|
+
const targetAuthorities = unique(contributors.map((item) => item.target.authority));
|
|
169
|
+
return Object.freeze({
|
|
170
|
+
heading: first.heading,
|
|
171
|
+
title,
|
|
172
|
+
level,
|
|
173
|
+
authority: targetAuthorities.length === 1 ? targetAuthorities[0] : 'compatible-mixed-authority',
|
|
174
|
+
requiredness,
|
|
175
|
+
qualification: 'valid',
|
|
176
|
+
findings: Object.freeze([])
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function parseExactHeadingToken(value = '') {
|
|
181
|
+
const match = exactToken(value).match(/^(#{1,6})\s+(.+?)\s*$/);
|
|
182
|
+
return match ? { level: match[1].length, title: match[2].trim() } : null;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function categoryItems(group = {}, names = []) {
|
|
186
|
+
const wanted = new Set(names.map(exactToken));
|
|
187
|
+
return (group.categories || []).flatMap((category) => wanted.has(exactToken(category.name)) ? category.items : []);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function cleanToken(value = '') { return String(value || '').trim().replace(/^`|`$/g, '').trim(); }
|
|
191
|
+
function exactToken(value = '') { return String(value || '').trim(); }
|
|
192
|
+
function exactHeadingTitle(value = '') { return exactToken(value).replace(/^#{1,6}\s+/, ''); }
|
|
193
|
+
function unique(values = []) { return [...new Set(values.map((value) => String(value || '').trim()).filter(Boolean))]; }
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { declarationOwnershipRanges, parseDeclarationsAgainstContract } from './named.declarations.js';
|
|
2
|
+
|
|
3
|
+
export const PORTABLE_ORDINARY_FIELD_INSTANCE_SCHEMA_ID = 'tiinex.portable.ordinary-field-instance.v1';
|
|
4
|
+
|
|
5
|
+
export function resolveOrdinaryFieldInstances(markdown = '', compiledContract = {}, options = {}) {
|
|
6
|
+
const source = String(markdown || '');
|
|
7
|
+
const blocks = parseHeadingBlocks(source);
|
|
8
|
+
const parsedDeclarations = options.parsedDeclarations || parseDeclarationsAgainstContract(source, compiledContract?.declarations || []);
|
|
9
|
+
const declarationOwnership = declarationOwnershipRanges(parsedDeclarations);
|
|
10
|
+
const groups = (compiledContract?.validation?.ordinaryGroups || []).map((contract) => resolveGroup(contract, blocks, declarationOwnership));
|
|
11
|
+
return Object.freeze({
|
|
12
|
+
schema: PORTABLE_ORDINARY_FIELD_INSTANCE_SCHEMA_ID,
|
|
13
|
+
groups: Object.freeze(groups)
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function resolveGroup(contract = {}, blocks = [], declarationOwnership = []) {
|
|
18
|
+
const compiledQualification = String(contract.qualification || 'unresolved');
|
|
19
|
+
const targetContract = contract.target || {};
|
|
20
|
+
if (compiledQualification !== 'valid' || targetContract.qualification !== 'valid' || !targetContract.title) {
|
|
21
|
+
return Object.freeze({
|
|
22
|
+
group: contract.group || '',
|
|
23
|
+
qualification: compiledQualification === 'valid' ? String(targetContract.qualification || 'unresolved') : compiledQualification,
|
|
24
|
+
target: projectTarget(targetContract, [], false),
|
|
25
|
+
fields: Object.freeze(projectFields(contract, [])),
|
|
26
|
+
contributors: contract.contributors || Object.freeze([])
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const exactBlocks = blocks.filter((block) => block.level === Number(targetContract.level || 0) && block.title === targetContract.title);
|
|
31
|
+
const ambiguous = exactBlocks.length > 1;
|
|
32
|
+
const block = exactBlocks.length === 1 ? exactBlocks[0] : null;
|
|
33
|
+
const targetPresent = exactBlocks.length > 0;
|
|
34
|
+
const targetQualification = ambiguous ? 'ambiguous' : targetContract.requiredness === 'unresolved' && !targetPresent ? 'unresolved' : 'resolved';
|
|
35
|
+
const fieldDeclarations = [...(contract.requiredFields || []).map((label) => ({ label, requirement: 'required' })),
|
|
36
|
+
...(contract.optionalFields || []).map((label) => ({ label, requirement: 'optional' }))];
|
|
37
|
+
const fields = fieldDeclarations.map((declaration) => resolveField(declaration, block, {
|
|
38
|
+
ambiguous,
|
|
39
|
+
targetPresent,
|
|
40
|
+
requiredness: targetContract.requiredness,
|
|
41
|
+
declarationOwnership
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
return Object.freeze({
|
|
45
|
+
group: contract.group || '',
|
|
46
|
+
qualification: ambiguous ? 'ambiguous' : targetQualification,
|
|
47
|
+
target: projectTarget(targetContract, exactBlocks, targetPresent, targetQualification),
|
|
48
|
+
fields: Object.freeze(fields),
|
|
49
|
+
contributors: contract.contributors || Object.freeze([])
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function projectTarget(target = {}, blocks = [], present = false, qualification = '') {
|
|
54
|
+
return Object.freeze({
|
|
55
|
+
heading: String(target.heading || ''),
|
|
56
|
+
title: String(target.title || ''),
|
|
57
|
+
level: Number(target.level || 0),
|
|
58
|
+
authority: String(target.authority || ''),
|
|
59
|
+
requiredness: String(target.requiredness || 'unresolved'),
|
|
60
|
+
qualification: qualification || String(target.qualification || 'unresolved'),
|
|
61
|
+
present: Boolean(present),
|
|
62
|
+
occurrenceCount: blocks.length,
|
|
63
|
+
occurrences: Object.freeze(blocks.map((block) => Object.freeze({
|
|
64
|
+
line: block.line,
|
|
65
|
+
endLine: block.endLine,
|
|
66
|
+
order: block.order
|
|
67
|
+
})))
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function projectFields(contract = {}, occurrences = []) {
|
|
72
|
+
return [
|
|
73
|
+
...(contract.requiredFields || []).map((label) => Object.freeze({ label, requirement: 'required', qualification: 'unresolved', occurrences: Object.freeze(occurrences) })),
|
|
74
|
+
...(contract.optionalFields || []).map((label) => Object.freeze({ label, requirement: 'optional', qualification: 'unresolved', occurrences: Object.freeze(occurrences) }))
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function resolveField(declaration = {}, block = null, context = {}) {
|
|
79
|
+
if (context.ambiguous) {
|
|
80
|
+
return Object.freeze({
|
|
81
|
+
label: declaration.label,
|
|
82
|
+
requirement: declaration.requirement,
|
|
83
|
+
qualification: 'unresolved',
|
|
84
|
+
occurrences: Object.freeze([])
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (!context.targetPresent) {
|
|
88
|
+
const inactiveOptionalTarget = context.requiredness === 'optional';
|
|
89
|
+
return Object.freeze({
|
|
90
|
+
label: declaration.label,
|
|
91
|
+
requirement: declaration.requirement,
|
|
92
|
+
qualification: inactiveOptionalTarget || declaration.requirement === 'optional' ? 'absent' : context.requiredness === 'required' ? 'missing-required' : 'unresolved',
|
|
93
|
+
occurrences: Object.freeze([])
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const occurrences = (block?.fields || []).filter((field) => field.label === declaration.label && !lineOwnedByDeclaration(field.line, context.declarationOwnership));
|
|
97
|
+
const qualification = occurrences.length > 1
|
|
98
|
+
? 'duplicate'
|
|
99
|
+
: occurrences.length === 1
|
|
100
|
+
? 'present'
|
|
101
|
+
: declaration.requirement === 'required'
|
|
102
|
+
? 'missing-required'
|
|
103
|
+
: 'absent';
|
|
104
|
+
return Object.freeze({
|
|
105
|
+
label: declaration.label,
|
|
106
|
+
requirement: declaration.requirement,
|
|
107
|
+
qualification,
|
|
108
|
+
occurrences: Object.freeze(occurrences.map((field) => Object.freeze({
|
|
109
|
+
value: field.value,
|
|
110
|
+
rawValue: field.rawValue,
|
|
111
|
+
line: field.line,
|
|
112
|
+
order: field.order,
|
|
113
|
+
form: field.form
|
|
114
|
+
})))
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function lineOwnedByDeclaration(line = 0, ranges = []) {
|
|
119
|
+
const target = Number(line || 0);
|
|
120
|
+
return target > 0 && (ranges || []).some((range) => target >= Number(range.line || 0) && target <= Number(range.endLine || 0));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function parseHeadingBlocks(markdown = '') {
|
|
124
|
+
const lines = String(markdown || '').replace(/\r\n?/g, '\n').split('\n');
|
|
125
|
+
const headings = [];
|
|
126
|
+
let fenced = false;
|
|
127
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
128
|
+
const line = lines[index];
|
|
129
|
+
if (/^\s*```/.test(line)) { fenced = !fenced; continue; }
|
|
130
|
+
if (fenced) continue;
|
|
131
|
+
const match = line.match(/^(#{1,6})\s+(.+?)\s*$/);
|
|
132
|
+
if (!match) continue;
|
|
133
|
+
headings.push({ index, level: match[1].length, title: match[2].trim() });
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const blocks = [];
|
|
137
|
+
let order = 0;
|
|
138
|
+
for (let position = 0; position < headings.length; position += 1) {
|
|
139
|
+
const heading = headings[position];
|
|
140
|
+
let end = lines.length;
|
|
141
|
+
for (let cursor = position + 1; cursor < headings.length; cursor += 1) {
|
|
142
|
+
if (headings[cursor].level <= heading.level) { end = headings[cursor].index; break; }
|
|
143
|
+
}
|
|
144
|
+
const directContentEnd = Math.min(end, headings[position + 1]?.index ?? end);
|
|
145
|
+
blocks.push(Object.freeze({
|
|
146
|
+
level: heading.level,
|
|
147
|
+
title: heading.title,
|
|
148
|
+
line: heading.index + 1,
|
|
149
|
+
endLine: end,
|
|
150
|
+
order: order++,
|
|
151
|
+
fields: Object.freeze(parseTopLevelFieldOccurrences(lines, heading.index + 1, directContentEnd))
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
return Object.freeze(blocks);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function parseSecondLevelBlocks(markdown = '') {
|
|
158
|
+
return Object.freeze(parseHeadingBlocks(markdown).filter((block) => block.level === 2));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function parseTopLevelFieldOccurrences(lines = [], start = 0, end = 0) {
|
|
162
|
+
const fields = [];
|
|
163
|
+
let fenced = false;
|
|
164
|
+
let order = 0;
|
|
165
|
+
for (let index = start; index < end; index += 1) {
|
|
166
|
+
const raw = lines[index];
|
|
167
|
+
if (/^\s*```/.test(raw)) { fenced = !fenced; continue; }
|
|
168
|
+
if (fenced) continue;
|
|
169
|
+
|
|
170
|
+
const scalar = raw.match(/^-\s+([^:]+):\s*(.*?)\s*$/);
|
|
171
|
+
if (scalar) {
|
|
172
|
+
fields.push(Object.freeze({
|
|
173
|
+
label: scalar[1].trim(),
|
|
174
|
+
value: scalar[2],
|
|
175
|
+
rawValue: scalar[2],
|
|
176
|
+
line: index + 1,
|
|
177
|
+
order: order++,
|
|
178
|
+
form: 'scalar'
|
|
179
|
+
}));
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const block = raw.match(/^-\s+([^:]+?)\s*$/);
|
|
184
|
+
if (!block) continue;
|
|
185
|
+
const nested = [];
|
|
186
|
+
let cursor = index + 1;
|
|
187
|
+
while (cursor < end) {
|
|
188
|
+
const next = lines[cursor];
|
|
189
|
+
if (!next.trim()) { nested.push(next); cursor += 1; continue; }
|
|
190
|
+
if (/^\s+/.test(next)) { nested.push(next); cursor += 1; continue; }
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
if (!nested.some((line) => /^\s+-\s+/.test(line))) continue;
|
|
194
|
+
const rawValue = nested.join('\n').trimEnd();
|
|
195
|
+
fields.push(Object.freeze({
|
|
196
|
+
label: block[1].trim(),
|
|
197
|
+
value: rawValue,
|
|
198
|
+
rawValue,
|
|
199
|
+
line: index + 1,
|
|
200
|
+
order: order++,
|
|
201
|
+
form: 'block'
|
|
202
|
+
}));
|
|
203
|
+
}
|
|
204
|
+
return fields;
|
|
205
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import projection from './bootstrap/qualified-local-root/tiinex.root.v1.runtime-projection.json' with { type: 'json' };
|
|
2
|
+
|
|
3
|
+
export const PORTABLE_QUALIFIED_LOCAL_ROOT_RUNTIME_PROJECTION_SCHEMA_ID = 'tiinex.portable.qualified-local-root-runtime-projection.v1';
|
|
4
|
+
|
|
5
|
+
export function qualifiedLocalRootRuntimeProjection() {
|
|
6
|
+
return deepFreeze(clone(projection));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function projectPortableValidationContractWithQualifiedLocalRoot(baseContract = null) {
|
|
10
|
+
if (!baseContract || typeof baseContract !== 'object') return unavailable('base-validation-contract-unavailable');
|
|
11
|
+
const lineage = Array.isArray(baseContract.lineage) ? baseContract.lineage.map(String) : [];
|
|
12
|
+
if (!lineage.includes('tiinex.root.v1')) return unavailable('root-not-in-validation-lineage');
|
|
13
|
+
if (projection?.lineageQualification?.state !== 'valid' || projection?.lineageQualification?.complete !== true) return unavailable('local-root-lineage-unqualified');
|
|
14
|
+
|
|
15
|
+
const requirements = Array.isArray(baseContract?.validation?.conditionalRequirements)
|
|
16
|
+
? baseContract.validation.conditionalRequirements
|
|
17
|
+
: [];
|
|
18
|
+
const matchingIndexes = requirements
|
|
19
|
+
.map((entry, index) => ({ entry, index }))
|
|
20
|
+
.filter(({ entry }) => String(entry?.name || '') === 'Parent Origin' && normalizeList(entry?.requiredWhen).includes('Parent exists'))
|
|
21
|
+
.map(({ index }) => index);
|
|
22
|
+
if (matchingIndexes.length !== 1) return unavailable('parent-origin-contract-cardinality-unqualified', { observedMatches: matchingIndexes.length });
|
|
23
|
+
|
|
24
|
+
const replacement = clone(projection.parentOrigin);
|
|
25
|
+
const conditionalRequirements = requirements.map((entry, index) => index === matchingIndexes[0] ? replacement : clone(entry));
|
|
26
|
+
const compiledContract = {
|
|
27
|
+
...clone(baseContract),
|
|
28
|
+
validation: {
|
|
29
|
+
...clone(baseContract.validation || {}),
|
|
30
|
+
conditionalRequirements
|
|
31
|
+
},
|
|
32
|
+
portableRuntimeProjection: {
|
|
33
|
+
schema: PORTABLE_QUALIFIED_LOCAL_ROOT_RUNTIME_PROJECTION_SCHEMA_ID,
|
|
34
|
+
state: 'qualified-local',
|
|
35
|
+
schemaId: String(projection.schemaId || 'tiinex.root.v1'),
|
|
36
|
+
authority: clone(projection.authority || {}),
|
|
37
|
+
source: clone(projection.source || {}),
|
|
38
|
+
boundary: String(projection?.authority?.boundary || '')
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return deepFreeze({
|
|
42
|
+
state: 'qualified',
|
|
43
|
+
reason: '',
|
|
44
|
+
compiledContract,
|
|
45
|
+
projection: clone(projection)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function unavailable(reason, extra = {}) {
|
|
50
|
+
return deepFreeze({ state: 'unavailable', reason: String(reason || 'unavailable'), compiledContract: null, projection: clone(projection), ...extra });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function normalizeList(value) {
|
|
54
|
+
return Array.isArray(value) ? value.map((item) => String(item || '').trim()).filter(Boolean) : [];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function clone(value) {
|
|
58
|
+
if (value == null || typeof value !== 'object') return value;
|
|
59
|
+
if (Array.isArray(value)) return value.map(clone);
|
|
60
|
+
const result = {};
|
|
61
|
+
for (const [key, child] of Object.entries(value)) result[key] = clone(child);
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function deepFreeze(value) {
|
|
66
|
+
if (!value || typeof value !== 'object' || Object.isFrozen(value)) return value;
|
|
67
|
+
if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer) return value;
|
|
68
|
+
for (const child of Object.values(value)) deepFreeze(child);
|
|
69
|
+
return Object.freeze(value);
|
|
70
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { parseArtifactMarkdown } from '../../../artifacts/artifact.parse.js';
|
|
2
|
+
import { resolveSchemaModule } from '../../../schemas/resolver.js';
|
|
3
|
+
import { qualifySchemaReferenceValue, schemaReferenceAuthorityFromBinding } from '../../../schemas/schema.reference.js';
|
|
4
|
+
import {
|
|
5
|
+
PORTABLE_QUALIFIED_LOCAL_ROOT_RUNTIME_PROJECTION_SCHEMA_ID,
|
|
6
|
+
qualifiedLocalRootRuntimeProjection,
|
|
7
|
+
projectPortableValidationContractWithQualifiedLocalRoot
|
|
8
|
+
} from './qualifiedLocalRoot.projection.js';
|
|
9
|
+
|
|
10
|
+
export { PORTABLE_QUALIFIED_LOCAL_ROOT_RUNTIME_PROJECTION_SCHEMA_ID, qualifiedLocalRootRuntimeProjection, projectPortableValidationContractWithQualifiedLocalRoot };
|
|
11
|
+
|
|
12
|
+
export function portableRuntimeValidationContractForSchema(schemaId = '', resolutionInput = null) {
|
|
13
|
+
const resolution = resolutionInput || resolveSchemaModule({ schemaId });
|
|
14
|
+
if (resolution?.fallbackUsed || !resolution?.module) return unavailable('registered-schema-resolution-unavailable', { resolution });
|
|
15
|
+
const qualification = typeof resolution.module.schemaSource?.qualify === 'function' ? resolution.module.schemaSource.qualify() : null;
|
|
16
|
+
const baseContract = qualification?.state === 'qualified' ? qualification?.compiledContract?.validationContract || null : null;
|
|
17
|
+
if (!baseContract) return unavailable(qualification?.state === 'qualified' ? 'compiled-validation-contract-unavailable' : 'schema-source-unqualified', { resolution });
|
|
18
|
+
const projected = projectPortableValidationContractWithQualifiedLocalRoot(baseContract);
|
|
19
|
+
return deepFreeze({ ...projected, resolution, baseQualificationState: String(qualification?.state || 'unavailable') });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function portableRuntimeValidationAuthorityForRecord(record = {}) {
|
|
23
|
+
const markdown = String(record?.markdown || '');
|
|
24
|
+
const parsed = parseArtifactMarkdown(markdown);
|
|
25
|
+
const declaredSchema = parsed?.envelope?.current?.schema || {};
|
|
26
|
+
const schemaId = String(declaredSchema.id || record?.schemaId || record?.currentSchemaId || '').trim();
|
|
27
|
+
const runtime = portableRuntimeValidationContractForSchema(schemaId);
|
|
28
|
+
if (runtime.state !== 'qualified' || !runtime.compiledContract) {
|
|
29
|
+
return unavailableAuthority(schemaId, runtime, ['Registered compiled validation authority is unavailable for the declared Current Schema.']);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const findings = [];
|
|
33
|
+
const currentModule = runtime.resolution?.module || null;
|
|
34
|
+
const currentQualification = typeof currentModule?.schemaSource?.qualify === 'function' ? currentModule.schemaSource.qualify() : null;
|
|
35
|
+
const currentBinding = currentModule?.binding || {};
|
|
36
|
+
const localWorkspaceAuthority = isQualifiedLocalUnpublishedAuthority(currentBinding, currentQualification);
|
|
37
|
+
let currentReferenceState = 'unavailable';
|
|
38
|
+
let currentReferenceBasis = 'unavailable';
|
|
39
|
+
|
|
40
|
+
if (!declaredSchema.id || declaredSchema.id !== schemaId) {
|
|
41
|
+
findings.push(`Current Schema identity is unavailable or contradictory for ${schemaId || '(missing schema id)'}.`);
|
|
42
|
+
} else if (localWorkspaceAuthority) {
|
|
43
|
+
currentReferenceState = 'qualified';
|
|
44
|
+
currentReferenceBasis = 'qualified-workspace-local-authority';
|
|
45
|
+
} else if (declaredSchema.form === 'plain-schema-id') {
|
|
46
|
+
findings.push(`Current Schema ${schemaId} declares no version-bearing locator and no qualified local workspace authority supersedes that omission.`);
|
|
47
|
+
currentReferenceBasis = 'schema-id-only-version-unresolved';
|
|
48
|
+
} else {
|
|
49
|
+
const referenceAuthority = schemaReferenceAuthorityFromBinding(schemaId, currentBinding, currentQualification?.authority || null, currentQualification);
|
|
50
|
+
const referenceQualification = qualifySchemaReferenceValue(String(declaredSchema.raw || ''), referenceAuthority);
|
|
51
|
+
if (referenceQualification.state === 'qualified' && referenceQualification.targetState === 'qualified') {
|
|
52
|
+
currentReferenceState = 'qualified';
|
|
53
|
+
currentReferenceBasis = 'declared-current-schema-exact-source-target';
|
|
54
|
+
} else {
|
|
55
|
+
findings.push(...(referenceQualification.findings || []).map((item) => `Current Schema authority: ${item}`));
|
|
56
|
+
currentReferenceBasis = 'declared-current-schema-target-unqualified';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const lineage = Array.isArray(runtime.compiledContract?.lineage) ? runtime.compiledContract.lineage : [];
|
|
61
|
+
const projectedLineageAuthority = Array.isArray(runtime.compiledContract?.lineageAuthority) ? runtime.compiledContract.lineageAuthority : [];
|
|
62
|
+
if (!lineage.length || runtime.compiledContract?.lineageQualification?.state !== 'valid') {
|
|
63
|
+
findings.push('Compiled validation lineage is unavailable or not valid.');
|
|
64
|
+
}
|
|
65
|
+
if (projectedLineageAuthority.length !== lineage.length) {
|
|
66
|
+
findings.push(`Compiled validation lineage source authority is unavailable for ${schemaId || '(unknown schema)'}.`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const lineageAuthorities = projectedLineageAuthority.map((entry) => Object.freeze({
|
|
70
|
+
schemaId: String(entry?.schemaId || ''),
|
|
71
|
+
sourceRepository: String(entry?.source?.repository || '').trim(),
|
|
72
|
+
sourceCommit: String(entry?.source?.commit || '').trim().toLowerCase(),
|
|
73
|
+
sourcePath: String(entry?.source?.path || '').trim(),
|
|
74
|
+
publicationState: String(entry?.source?.publicationState || '').trim(),
|
|
75
|
+
snapshotCompleteness: String(entry?.source?.snapshotCompleteness || '').trim(),
|
|
76
|
+
parentSchemaId: String(entry?.parentSchemaId || '').trim(),
|
|
77
|
+
parentSourceCandidates: Object.freeze((entry?.parentSourceCandidates || []).map((candidate) => Object.freeze({
|
|
78
|
+
repository: String(candidate?.repository || '').trim(),
|
|
79
|
+
commit: String(candidate?.commit || '').trim().toLowerCase(),
|
|
80
|
+
path: String(candidate?.path || '').trim()
|
|
81
|
+
})))
|
|
82
|
+
}));
|
|
83
|
+
|
|
84
|
+
// A qualified local unpublished current-schema module is itself the Axiom-approved
|
|
85
|
+
// bounded workspace authority for its compiled validation contract. Its local
|
|
86
|
+
// lineage may intentionally supersede published parent locators, so do not
|
|
87
|
+
// reinterpret those edges through today's registry. For published/current
|
|
88
|
+
// authority, every compiled lineage edge must remain source-coherent.
|
|
89
|
+
if (!localWorkspaceAuthority) {
|
|
90
|
+
for (let index = 1; index < lineageAuthorities.length; index += 1) {
|
|
91
|
+
const parent = lineageAuthorities[index - 1];
|
|
92
|
+
const child = lineageAuthorities[index];
|
|
93
|
+
if (!child.parentSchemaId || child.parentSchemaId !== parent.schemaId) {
|
|
94
|
+
findings.push(`Compiled lineage identity is incoherent across ${parent.schemaId || '(unknown parent)'} -> ${child.schemaId || '(unknown child)'}.`);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (isQualifiedLocalUnpublishedSource(parent)) continue;
|
|
98
|
+
const candidates = child.parentSourceCandidates || [];
|
|
99
|
+
if (candidates.length !== 1) {
|
|
100
|
+
findings.push(candidates.length
|
|
101
|
+
? `Declared parent source authority is ambiguous for ${child.schemaId}: ${candidates.length} exact pinned candidates.`
|
|
102
|
+
: `Declared parent source authority is unavailable for ${child.schemaId} -> ${parent.schemaId}.`);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
const expected = candidates[0];
|
|
106
|
+
if (!sameSourceTuple(parent, expected)) {
|
|
107
|
+
findings.push(`Compiled lineage substitutes source authority for ${child.schemaId} -> ${parent.schemaId}: declared ${expected.repository || '(unknown repo)'}@${expected.commit || '(unknown commit)'}/${expected.path || '(unknown path)'} but compiled ${parent.sourceRepository || '(unknown repo)'}@${parent.sourceCommit || '(unknown commit)'}/${parent.sourcePath || '(unknown path)'}.`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const qualified = currentReferenceState === 'qualified' && findings.length === 0;
|
|
113
|
+
return deepFreeze({
|
|
114
|
+
schema: 'tiinex.portable.runtime-validation-authority.v1',
|
|
115
|
+
state: qualified ? 'qualified' : 'unavailable',
|
|
116
|
+
reason: qualified ? '' : 'exact-schema-authority-or-lineage-unqualified',
|
|
117
|
+
schemaId,
|
|
118
|
+
currentReference: Object.freeze({ state: currentReferenceState, basis: currentReferenceBasis, raw: String(declaredSchema.raw || ''), target: String(declaredSchema.target || '') }),
|
|
119
|
+
lineage: Object.freeze(lineageAuthorities),
|
|
120
|
+
findings: Object.freeze(findings),
|
|
121
|
+
resolution: runtime.resolution,
|
|
122
|
+
compiledContract: qualified ? runtime.compiledContract : null,
|
|
123
|
+
baseQualificationState: runtime.baseQualificationState || 'unavailable'
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function sameSourceTuple(actual = {}, expected = {}) {
|
|
128
|
+
return String(actual?.sourceRepository || '') === String(expected?.repository || '')
|
|
129
|
+
&& String(actual?.sourceCommit || '').toLowerCase() === String(expected?.commit || '').toLowerCase()
|
|
130
|
+
&& String(actual?.sourcePath || '') === String(expected?.path || '');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function isQualifiedLocalUnpublishedSource(source = {}) {
|
|
134
|
+
return String(source?.publicationState || '').trim().toLowerCase() === 'accepted-local-unpublished'
|
|
135
|
+
&& String(source?.snapshotCompleteness || '').trim() === 'exact-axiom-canonical-unpublished-bounded-workspace-contract';
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function isQualifiedLocalUnpublishedAuthority(binding = {}, qualification = null) {
|
|
139
|
+
const publicationState = String(binding?.publicationState || '').trim().toLowerCase();
|
|
140
|
+
const snapshotCompleteness = String(binding?.snapshotCompleteness || '').trim();
|
|
141
|
+
return qualification?.state === 'qualified'
|
|
142
|
+
&& publicationState === 'accepted-local-unpublished'
|
|
143
|
+
&& snapshotCompleteness === 'exact-axiom-canonical-unpublished-bounded-workspace-contract';
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function unavailableAuthority(schemaId = '', runtime = {}, findings = []) {
|
|
147
|
+
return deepFreeze({
|
|
148
|
+
schema: 'tiinex.portable.runtime-validation-authority.v1',
|
|
149
|
+
state: 'unavailable',
|
|
150
|
+
reason: String(runtime?.reason || 'exact-schema-authority-or-lineage-unqualified'),
|
|
151
|
+
schemaId: String(schemaId || ''),
|
|
152
|
+
currentReference: Object.freeze({ state: 'unavailable', basis: 'unavailable', raw: '', target: '' }),
|
|
153
|
+
lineage: Object.freeze([]),
|
|
154
|
+
findings: Object.freeze(findings),
|
|
155
|
+
resolution: runtime?.resolution || null,
|
|
156
|
+
compiledContract: null,
|
|
157
|
+
baseQualificationState: String(runtime?.baseQualificationState || 'unavailable')
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function unavailable(reason, extra = {}) {
|
|
162
|
+
return deepFreeze({ state: 'unavailable', reason: String(reason || 'unavailable'), compiledContract: null, projection: qualifiedLocalRootRuntimeProjection(), ...extra });
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function deepFreeze(value) {
|
|
166
|
+
if (!value || typeof value !== 'object' || Object.isFrozen(value)) return value;
|
|
167
|
+
if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer) return value;
|
|
168
|
+
for (const child of Object.values(value)) deepFreeze(child);
|
|
169
|
+
return Object.freeze(value);
|
|
170
|
+
}
|