@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,76 @@
|
|
|
1
|
+
import { parseArtifactMarkdown } from '../../../artifacts/artifact.parse.js';
|
|
2
|
+
|
|
3
|
+
export function parseStandaloneInheritanceRecord(input = '') {
|
|
4
|
+
const markdown = typeof input === 'string' ? input : String(input?.markdown || '');
|
|
5
|
+
let parsed;
|
|
6
|
+
try { parsed = parseArtifactMarkdown(markdown); }
|
|
7
|
+
catch { return blocked('Standalone inheritance record could not be parsed as a Tiinex artifact.'); }
|
|
8
|
+
if (String(parsed?.envelope?.current?.schema?.id || '') !== 'tiinex.schema.inheritance.v1') return blocked('Standalone inheritance record Current Schema must be tiinex.schema.inheritance.v1.');
|
|
9
|
+
|
|
10
|
+
const sections = secondLevelSections(markdown);
|
|
11
|
+
const identity = scalarFields(sections.get('Inheritance Identity') || '');
|
|
12
|
+
const parent = scalarFields(sections.get('Parent Contract') || '');
|
|
13
|
+
const child = scalarFields(sections.get('Child Contract') || '');
|
|
14
|
+
const mergeRules = repeatedRecords(sections.get('Merge Rules') || '');
|
|
15
|
+
const findings = [];
|
|
16
|
+
requireField(findings, identity, 'Inheritance Handle');
|
|
17
|
+
requireExact(findings, identity, 'Inheritance Kind', 'override');
|
|
18
|
+
requireField(findings, parent, 'Parent Schema');
|
|
19
|
+
requireField(findings, parent, 'Parent Contract Nodes');
|
|
20
|
+
requireExact(findings, parent, 'Parent Resolution State', 'resolved');
|
|
21
|
+
requireField(findings, child, 'Child Schema');
|
|
22
|
+
requireField(findings, child, 'Child Contract Nodes');
|
|
23
|
+
requireExact(findings, child, 'Child Resolution State', 'resolved');
|
|
24
|
+
if (!mergeRules.length) findings.push('Standalone inheritance record must declare at least one Merge Rules record.');
|
|
25
|
+
|
|
26
|
+
const rules = [];
|
|
27
|
+
for (const record of mergeRules) {
|
|
28
|
+
const operation = String(record.fields['Merge Operation'] || '').trim();
|
|
29
|
+
if (operation !== 'override') findings.push(`Merge Rules record ${record.name || '(unnamed)'} must use explicit Merge Operation: override.`);
|
|
30
|
+
for (const field of ['Applies To', 'Parent Node', 'Child Node']) if (!record.fields[field]) findings.push(`Merge Rules record ${record.name || '(unnamed)'} is missing ${field}.`);
|
|
31
|
+
if (record.fields['Parent Node'] && record.fields['Parent Node'] !== parent['Parent Contract Nodes']) findings.push(`Merge Rules record ${record.name || '(unnamed)'} Parent Node must exactly match Parent Contract Nodes.`);
|
|
32
|
+
if (record.fields['Child Node'] && record.fields['Child Node'] !== child['Child Contract Nodes']) findings.push(`Merge Rules record ${record.name || '(unnamed)'} Child Node must exactly match Child Contract Nodes.`);
|
|
33
|
+
rules.push(Object.freeze({ name: record.name, operation, parentNode: record.fields['Parent Node'] || '', childNode: record.fields['Child Node'] || '', appliesTo: record.fields['Applies To'] || '' }));
|
|
34
|
+
}
|
|
35
|
+
if (findings.length) return Object.freeze({ state: 'unresolved', findings: Object.freeze(findings), rules: Object.freeze([]) });
|
|
36
|
+
return Object.freeze({
|
|
37
|
+
state: 'qualified',
|
|
38
|
+
findings: Object.freeze([]),
|
|
39
|
+
handle: identity['Inheritance Handle'],
|
|
40
|
+
parentSchemaId: parent['Parent Schema'],
|
|
41
|
+
parentNode: parent['Parent Contract Nodes'],
|
|
42
|
+
childSchemaId: child['Child Schema'],
|
|
43
|
+
childNode: child['Child Contract Nodes'],
|
|
44
|
+
rules: Object.freeze(rules)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function secondLevelSections(markdown = '') {
|
|
49
|
+
const lines = String(markdown || '').replace(/\r\n?/g, '\n').split('\n');
|
|
50
|
+
const out = new Map(); let title = ''; let body = []; let fenced = false;
|
|
51
|
+
const flush = () => { if (title) out.set(title, body.join('\n').trim()); body = []; };
|
|
52
|
+
for (const line of lines) {
|
|
53
|
+
if (/^\s*```/.test(line)) { fenced = !fenced; if (title) body.push(line); continue; }
|
|
54
|
+
if (!fenced) { const match = line.match(/^##\s+(.+?)\s*$/); if (match) { flush(); title = match[1].trim(); continue; } }
|
|
55
|
+
if (title) body.push(line);
|
|
56
|
+
}
|
|
57
|
+
flush(); return out;
|
|
58
|
+
}
|
|
59
|
+
function scalarFields(text = '') {
|
|
60
|
+
const out = {};
|
|
61
|
+
for (const line of String(text || '').split('\n')) { const match = line.match(/^([A-Za-z][A-Za-z0-9 _+-]{0,80}):\s*(.*?)\s*$/); if (match) out[match[1].trim()] = match[2].trim(); }
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
function repeatedRecords(text = '') {
|
|
65
|
+
const records = []; let current = null;
|
|
66
|
+
const flush = () => { if (current) records.push(Object.freeze({ name: current.name, fields: Object.freeze({ ...current.fields }) })); current = null; };
|
|
67
|
+
for (const line of String(text || '').split('\n')) {
|
|
68
|
+
const top = line.match(/^-\s+(.+?)\s*$/); if (top) { flush(); current = { name: top[1].trim(), fields: {} }; continue; }
|
|
69
|
+
if (!current) continue;
|
|
70
|
+
const field = line.match(/^\s{2,}-\s*([A-Za-z][A-Za-z0-9 _+-]{0,80}):\s*(.*?)\s*$/); if (field) current.fields[field[1].trim()] = field[2].trim();
|
|
71
|
+
}
|
|
72
|
+
flush(); return records;
|
|
73
|
+
}
|
|
74
|
+
function requireField(findings, fields, name) { if (!String(fields?.[name] || '').trim()) findings.push(`Standalone inheritance record is missing ${name}.`); }
|
|
75
|
+
function requireExact(findings, fields, name, expected) { if (String(fields?.[name] || '').trim() !== expected) findings.push(`Standalone inheritance record ${name} must be exactly ${expected}.`); }
|
|
76
|
+
function blocked(message) { return Object.freeze({ state: 'unresolved', findings: Object.freeze([message]), rules: Object.freeze([]) }); }
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { compileLexicalShapeV1, qualifyLexicalShapeV1, PORTABLE_LEXICAL_SHAPE_PROFILE_V1 } from './lexical.shape.v1.js';
|
|
2
|
+
|
|
3
|
+
export const PORTABLE_MACHINE_SHAPE_AUTHORITY_SCHEMA_ID = 'tiinex.portable.machine-shape-authority.v1';
|
|
4
|
+
|
|
5
|
+
export function compileMachineShapeDefinitions(document = {}) {
|
|
6
|
+
const sourceSchemaId = String(document.schemaId || '');
|
|
7
|
+
const definitions = [];
|
|
8
|
+
for (const group of document.validation?.groups || []) {
|
|
9
|
+
for (const category of group.categories || []) {
|
|
10
|
+
if (exact(category.name) !== 'Machine Shape Definitions') continue;
|
|
11
|
+
for (const declaration of category.nodes || []) {
|
|
12
|
+
definitions.push(compileDefinition({ declaration, sourceSchemaId, sourceGroup: group.name }));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return Object.freeze(definitions);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function resolveFieldDomainShapeAuthoritiesAcrossChain(constraints = [], compiledLineage = []) {
|
|
20
|
+
return Object.freeze((constraints || []).map((constraint) => {
|
|
21
|
+
if (constraint?.kind !== 'field-domain') return constraint;
|
|
22
|
+
const allowedShapes = constraint.allowedShapes || [];
|
|
23
|
+
if (!allowedShapes.length) return Object.freeze({ ...constraint, allowedShapeAuthorities: Object.freeze([]) });
|
|
24
|
+
const resolutions = allowedShapes.map((shape) => resolveShapeAtSourcePoint(shape, constraint.sourceSchemaId, compiledLineage));
|
|
25
|
+
return Object.freeze({ ...constraint, allowedShapeAuthorities: Object.freeze(resolutions) });
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function summarizeMachineShapeAuthority(compiledLineage = []) {
|
|
30
|
+
const definitions = Object.freeze(compiledLineage.flatMap((item) => item.machineShapes?.definitions || []));
|
|
31
|
+
const leafSchemaId = String(compiledLineage.at(-1)?.schemaId || '');
|
|
32
|
+
const labels = unique(definitions.map((definition) => definition.shapeLabel));
|
|
33
|
+
const active = Object.freeze(labels.map((label) => resolveShapeAtSourcePoint(label, leafSchemaId, compiledLineage)));
|
|
34
|
+
const findings = [];
|
|
35
|
+
for (const definition of definitions) {
|
|
36
|
+
if (definition.definitionQualification === 'structurally-invalid') {
|
|
37
|
+
findings.push(Object.freeze({
|
|
38
|
+
state: 'structurally-invalid',
|
|
39
|
+
shapeLabel: definition.shapeLabel,
|
|
40
|
+
sourceSchemaId: definition.sourceSchemaId,
|
|
41
|
+
sourceGroup: definition.sourceGroup,
|
|
42
|
+
reasons: definition.definitionFindings
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
for (const resolution of active) {
|
|
47
|
+
if (resolution.qualification === 'conflicting') findings.push(Object.freeze({
|
|
48
|
+
state: 'contradictory',
|
|
49
|
+
shapeLabel: resolution.shapeLabel,
|
|
50
|
+
reasons: resolution.findings
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
schema: PORTABLE_MACHINE_SHAPE_AUTHORITY_SCHEMA_ID,
|
|
55
|
+
definitions,
|
|
56
|
+
active,
|
|
57
|
+
findings: Object.freeze(findings)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function projectMachineShapeSemanticIdentity(document = {}) {
|
|
62
|
+
const definitions = compileMachineShapeDefinitions(document).map(projectDefinitionSemanticIdentity);
|
|
63
|
+
definitions.sort(compareSemanticIdentity);
|
|
64
|
+
const categoryOccurrences = projectMachineShapeCategoryOccurrences(document);
|
|
65
|
+
return Object.freeze({
|
|
66
|
+
schema: PORTABLE_MACHINE_SHAPE_AUTHORITY_SCHEMA_ID,
|
|
67
|
+
categoryOccurrences,
|
|
68
|
+
definitions: Object.freeze(definitions)
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function projectMachineShapeCategoryOccurrences(document = {}) {
|
|
73
|
+
const sourceSchemaId = String(document.schemaId || '');
|
|
74
|
+
const occurrences = [];
|
|
75
|
+
for (const group of document.validation?.groups || []) {
|
|
76
|
+
for (const category of group.categories || []) {
|
|
77
|
+
if (exact(category.name) !== 'Machine Shape Definitions') continue;
|
|
78
|
+
const definitions = (category.nodes || [])
|
|
79
|
+
.map((declaration) => compileDefinition({ declaration, sourceSchemaId, sourceGroup: group.name }))
|
|
80
|
+
.map(projectDefinitionSemanticIdentity)
|
|
81
|
+
.sort(compareSemanticIdentity);
|
|
82
|
+
occurrences.push(Object.freeze({
|
|
83
|
+
sourceSchemaId,
|
|
84
|
+
sourceGroup: String(group.name || ''),
|
|
85
|
+
category: 'Machine Shape Definitions',
|
|
86
|
+
definitions: Object.freeze(definitions)
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
occurrences.sort(compareSemanticIdentity);
|
|
91
|
+
return Object.freeze(occurrences);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function qualifyResolvedMachineShape(value = '', resolution = {}) {
|
|
95
|
+
if (resolution?.qualification !== 'evaluable' || !resolution.definition) return Object.freeze({ qualification: 'unresolved' });
|
|
96
|
+
const definition = resolution.definition;
|
|
97
|
+
if (definition.grammarProfile === PORTABLE_LEXICAL_SHAPE_PROFILE_V1) return qualifyLexicalShapeV1(definition.compiledGrammar, value);
|
|
98
|
+
return Object.freeze({ qualification: 'unresolved' });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function compileDefinition({ declaration = {}, sourceSchemaId = '', sourceGroup = '' } = {}) {
|
|
102
|
+
const shapeLabel = exact(declaration.value);
|
|
103
|
+
const profiles = [];
|
|
104
|
+
const startRules = [];
|
|
105
|
+
const grammarRules = [];
|
|
106
|
+
const humanMeanings = [];
|
|
107
|
+
const unknown = [];
|
|
108
|
+
const findings = [];
|
|
109
|
+
|
|
110
|
+
for (const child of declaration.children || []) {
|
|
111
|
+
const parsed = splitProperty(child.rawValue ?? child.value);
|
|
112
|
+
if (!parsed || (child.children || []).length) {
|
|
113
|
+
unknown.push(String(child.value || ''));
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (parsed.name === 'Grammar Profile') profiles.push(exact(parsed.value));
|
|
117
|
+
else if (parsed.name === 'Start Rule') startRules.push(exact(parsed.value));
|
|
118
|
+
else if (parsed.name === 'Grammar Rule') grammarRules.push(parsed.value);
|
|
119
|
+
else if (parsed.name === 'Human Meaning') humanMeanings.push(exact(parsed.value));
|
|
120
|
+
else unknown.push(String(child.value || ''));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (!shapeLabel) findings.push('Machine Shape Definition has no exact shape label.');
|
|
124
|
+
if (profiles.length !== 1) findings.push(`Expected exactly one Grammar Profile; found ${profiles.length}.`);
|
|
125
|
+
if (startRules.length !== 1) findings.push(`Expected exactly one Start Rule; found ${startRules.length}.`);
|
|
126
|
+
if (!grammarRules.length) findings.push('Expected one or more Grammar Rule fields.');
|
|
127
|
+
if (humanMeanings.length !== 1) findings.push(`Expected exactly one Human Meaning; found ${humanMeanings.length}.`);
|
|
128
|
+
if (unknown.length) findings.push(`Unsupported Machine Shape Definition properties: ${unknown.join(', ')}.`);
|
|
129
|
+
|
|
130
|
+
const grammarProfile = profiles.length === 1 ? profiles[0] : '';
|
|
131
|
+
const startRule = startRules.length === 1 ? startRules[0] : '';
|
|
132
|
+
const humanMeaning = humanMeanings.length === 1 ? humanMeanings[0] : '';
|
|
133
|
+
let compiledGrammar = null;
|
|
134
|
+
let qualificationSupport = 'unavailable';
|
|
135
|
+
|
|
136
|
+
if (!findings.length && grammarProfile === PORTABLE_LEXICAL_SHAPE_PROFILE_V1) {
|
|
137
|
+
compiledGrammar = compileLexicalShapeV1({ startRule, grammarRules });
|
|
138
|
+
qualificationSupport = compiledGrammar.qualification === 'valid' ? 'available' : 'invalid';
|
|
139
|
+
if (compiledGrammar.qualification !== 'valid') findings.push(...compiledGrammar.findings);
|
|
140
|
+
} else if (findings.length) {
|
|
141
|
+
qualificationSupport = 'invalid';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return Object.freeze({
|
|
145
|
+
kind: 'machine-shape-definition',
|
|
146
|
+
shapeLabel,
|
|
147
|
+
sourceSchemaId,
|
|
148
|
+
sourceGroup,
|
|
149
|
+
declarationSource: Object.freeze({ line: Number(declaration.line || 0) }),
|
|
150
|
+
visibilityPolicy: 'lineage-prefix-ancestors-and-same-source',
|
|
151
|
+
grammarProfile,
|
|
152
|
+
startRule,
|
|
153
|
+
grammarRules: Object.freeze([...grammarRules]),
|
|
154
|
+
humanMeaning,
|
|
155
|
+
qualificationSupport,
|
|
156
|
+
definitionQualification: findings.length ? 'structurally-invalid' : 'valid',
|
|
157
|
+
definitionFindings: Object.freeze(findings),
|
|
158
|
+
declarationStructure: projectDeclarationStructure(declaration),
|
|
159
|
+
compiledGrammar
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function projectDefinitionSemanticIdentity(definition = {}) {
|
|
164
|
+
const common = {
|
|
165
|
+
shapeLabel: String(definition.shapeLabel || ''),
|
|
166
|
+
sourceSchemaId: String(definition.sourceSchemaId || ''),
|
|
167
|
+
sourceGroup: String(definition.sourceGroup || ''),
|
|
168
|
+
grammarProfile: String(definition.grammarProfile || ''),
|
|
169
|
+
startRule: String(definition.startRule || ''),
|
|
170
|
+
humanMeaning: String(definition.humanMeaning || ''),
|
|
171
|
+
qualificationSupport: String(definition.qualificationSupport || ''),
|
|
172
|
+
definitionQualification: String(definition.definitionQualification || ''),
|
|
173
|
+
grammarRuleCount: (definition.grammarRules || []).length
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
if (definition.grammarProfile === PORTABLE_LEXICAL_SHAPE_PROFILE_V1 && definition.compiledGrammar?.qualification === 'valid') {
|
|
177
|
+
return Object.freeze({
|
|
178
|
+
...common,
|
|
179
|
+
grammar: projectValidLexicalGrammar(definition.compiledGrammar)
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return Object.freeze({
|
|
184
|
+
...common,
|
|
185
|
+
structuralDeclaration: definition.declarationStructure || Object.freeze({ value: String(definition.shapeLabel || ''), children: Object.freeze([]) }),
|
|
186
|
+
grammar: Object.freeze({
|
|
187
|
+
qualification: String(definition.compiledGrammar?.qualification || definition.definitionQualification || ''),
|
|
188
|
+
rawRules: Object.freeze([...(definition.grammarRules || [])].map(String).sort(compareExactStrings))
|
|
189
|
+
})
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function projectDeclarationStructure(node = {}, isRoot = true) {
|
|
194
|
+
const children = (node.children || []).map((child) => projectDeclarationStructure(child, false));
|
|
195
|
+
children.sort(compareSemanticIdentity);
|
|
196
|
+
return Object.freeze({
|
|
197
|
+
value: isRoot ? exact(node.value) : String(node.rawValue ?? node.value ?? ''),
|
|
198
|
+
children: Object.freeze(children)
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function projectValidLexicalGrammar(compiled = {}) {
|
|
203
|
+
const rules = (compiled.grammarRules || []).map((rule) => Object.freeze({
|
|
204
|
+
name: String(rule.name || ''),
|
|
205
|
+
expression: canonicalExpression(rule.expression)
|
|
206
|
+
}));
|
|
207
|
+
rules.sort((left, right) => compareExactStrings(left.name, right.name) || compareSemanticIdentity(left, right));
|
|
208
|
+
return Object.freeze({
|
|
209
|
+
qualification: String(compiled.qualification || ''),
|
|
210
|
+
startRule: String(compiled.startRule || ''),
|
|
211
|
+
rules: Object.freeze(rules)
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function canonicalExpression(node = {}) {
|
|
216
|
+
if (!node || typeof node !== 'object') return node;
|
|
217
|
+
if (node.type === 'alternation') {
|
|
218
|
+
const alternatives = (node.alternatives || []).map(canonicalExpression).sort(compareSemanticIdentity);
|
|
219
|
+
return Object.freeze({ type: 'alternation', alternatives: Object.freeze(alternatives) });
|
|
220
|
+
}
|
|
221
|
+
if (node.type === 'concatenation') {
|
|
222
|
+
return Object.freeze({ type: 'concatenation', parts: Object.freeze((node.parts || []).map(canonicalExpression)) });
|
|
223
|
+
}
|
|
224
|
+
if (node.type === 'repeat') {
|
|
225
|
+
return Object.freeze({ type: 'repeat', quantifier: String(node.quantifier || ''), expression: canonicalExpression(node.expression) });
|
|
226
|
+
}
|
|
227
|
+
if (node.type === 'any-except') {
|
|
228
|
+
return Object.freeze({ type: 'any-except', exclusions: Object.freeze([...(node.exclusions || [])].map(String).sort(compareExactStrings)) });
|
|
229
|
+
}
|
|
230
|
+
if (node.type === 'literal') return Object.freeze({ type: 'literal', value: String(node.value ?? '') });
|
|
231
|
+
if (node.type === 'builtin') return Object.freeze({ type: 'builtin', name: String(node.name || '') });
|
|
232
|
+
if (node.type === 'reference') return Object.freeze({ type: 'reference', name: String(node.name || '') });
|
|
233
|
+
return Object.freeze({ ...node });
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function compareSemanticIdentity(left = {}, right = {}) {
|
|
237
|
+
return compareExactStrings(JSON.stringify(left), JSON.stringify(right));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function compareExactStrings(left = '', right = '') {
|
|
241
|
+
const a = String(left);
|
|
242
|
+
const b = String(right);
|
|
243
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function resolveShapeAtSourcePoint(shapeLabel = '', sourceSchemaId = '', compiledLineage = []) {
|
|
247
|
+
const label = exact(shapeLabel);
|
|
248
|
+
const sourceMatches = compiledLineage
|
|
249
|
+
.map((item, index) => ({ item, index }))
|
|
250
|
+
.filter(({ item }) => String(item?.schemaId || '') === String(sourceSchemaId || ''));
|
|
251
|
+
if (sourceMatches.length !== 1) return resolution(label, 'unresolved', null, [
|
|
252
|
+
`Machine-shape use source schema ${sourceSchemaId || '(unknown schema)'} resolves to ${sourceMatches.length} lineage positions.`
|
|
253
|
+
], [], sourceSchemaId, []);
|
|
254
|
+
|
|
255
|
+
const prefix = compiledLineage.slice(0, sourceMatches[0].index + 1);
|
|
256
|
+
const visibleSchemaIds = prefix.map((item) => String(item?.schemaId || '')).filter(Boolean);
|
|
257
|
+
const visible = prefix.flatMap((item) => (item.machineShapes?.definitions || []).filter((definition) => exact(definition.shapeLabel) === label));
|
|
258
|
+
if (!visible.length) return resolution(label, 'unresolved', null, [`No visible Machine Shape Definition exists for exact label ${label || '(empty)'}.`], [], sourceSchemaId, visibleSchemaIds);
|
|
259
|
+
if (visible.length > 1) return resolution(label, 'conflicting', null, [`Exact Machine Shape Definition label ${label} resolves to ${visible.length} active definitions at source point ${sourceSchemaId}.`], visible, sourceSchemaId, visibleSchemaIds);
|
|
260
|
+
|
|
261
|
+
const definition = visible[0];
|
|
262
|
+
if (definition.definitionQualification !== 'valid') return resolution(label, 'unresolved', definition, [
|
|
263
|
+
`Machine Shape Definition ${label} is structurally invalid.`,
|
|
264
|
+
...(definition.definitionFindings || [])
|
|
265
|
+
], visible, sourceSchemaId, visibleSchemaIds);
|
|
266
|
+
if (definition.qualificationSupport !== 'available') return resolution(label, 'unresolved', definition, [
|
|
267
|
+
`Machine Shape Definition ${label} uses unsupported or unavailable Grammar Profile ${definition.grammarProfile || '(none)'}.`
|
|
268
|
+
], visible, sourceSchemaId, visibleSchemaIds);
|
|
269
|
+
return resolution(label, 'evaluable', definition, [], visible, sourceSchemaId, visibleSchemaIds);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function resolution(shapeLabel, qualification, definition, findings, visibleDefinitions, useSourceSchemaId = '', visibleSchemaIds = []) {
|
|
273
|
+
return Object.freeze({
|
|
274
|
+
shapeLabel,
|
|
275
|
+
qualification,
|
|
276
|
+
useSourceSchemaId: String(useSourceSchemaId || ''),
|
|
277
|
+
visibilityPolicy: 'lineage-prefix-ancestors-and-same-source',
|
|
278
|
+
visibleSchemaIds: Object.freeze([...visibleSchemaIds]),
|
|
279
|
+
definition: definition || null,
|
|
280
|
+
resolvedDefinitionProvenance: definition ? Object.freeze({
|
|
281
|
+
sourceSchemaId: definition.sourceSchemaId,
|
|
282
|
+
sourceGroup: definition.sourceGroup,
|
|
283
|
+
declarationSource: definition.declarationSource
|
|
284
|
+
}) : null,
|
|
285
|
+
visibleDefinitions: Object.freeze((visibleDefinitions || []).map((item) => Object.freeze({
|
|
286
|
+
shapeLabel: item.shapeLabel,
|
|
287
|
+
sourceSchemaId: item.sourceSchemaId,
|
|
288
|
+
sourceGroup: item.sourceGroup,
|
|
289
|
+
declarationSource: item.declarationSource,
|
|
290
|
+
grammarProfile: item.grammarProfile,
|
|
291
|
+
definitionQualification: item.definitionQualification,
|
|
292
|
+
qualificationSupport: item.qualificationSupport
|
|
293
|
+
}))),
|
|
294
|
+
findings: Object.freeze(findings || [])
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function splitProperty(value = '') {
|
|
299
|
+
const text = String(value || '');
|
|
300
|
+
const separator = text.indexOf(':');
|
|
301
|
+
if (separator <= 0) return null;
|
|
302
|
+
const name = text.slice(0, separator).trim();
|
|
303
|
+
const propertyValue = text.slice(separator + 1);
|
|
304
|
+
if (!name || !exact(propertyValue)) return null;
|
|
305
|
+
return { name, value: propertyValue };
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function exact(value = '') { return String(value || '').trim(); }
|
|
309
|
+
function unique(values = []) { return [...new Set(values.map(exact).filter(Boolean))]; }
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { compilePortableSchemaContract } from './contract.compile.js';
|
|
2
|
+
import { validatePortableContractInstance } from './contract.validate.js';
|
|
3
|
+
import { resolveClassificationAgreement } from './contract.semantic-resolution.js';
|
|
4
|
+
|
|
5
|
+
export const PORTABLE_RESOLVED_INSTANCE_PROJECTION_SCHEMA_ID = 'tiinex.portable.resolved-contract-instance.v1';
|
|
6
|
+
|
|
7
|
+
export function projectPortableContractInstance(input = {}, options = {}) {
|
|
8
|
+
if (Object.prototype.hasOwnProperty.call(input, 'validation')) {
|
|
9
|
+
throw new TypeError('projectPortableContractInstance owns validation; precomputed validation input is not accepted because authority context must remain coherent.');
|
|
10
|
+
}
|
|
11
|
+
const compiled = input.compiledContract || compilePortableSchemaContract(input.schemaMarkdown || input.schemaDocument || '');
|
|
12
|
+
const resolvers = input.resolvers || options.resolvers || {};
|
|
13
|
+
const validation = validatePortableContractInstance({
|
|
14
|
+
markdown: String(input.markdown || ''),
|
|
15
|
+
compiledContract: compiled,
|
|
16
|
+
resolvers
|
|
17
|
+
});
|
|
18
|
+
const constraintIndex = classificationConstraintsByGroup(compiled.constraints || []);
|
|
19
|
+
const declarations = [];
|
|
20
|
+
|
|
21
|
+
for (const parsedGroup of validation.declarations || []) {
|
|
22
|
+
const group = parsedGroup.contract.group;
|
|
23
|
+
const constraints = constraintIndex.get(exactToken(group)) || [];
|
|
24
|
+
if (!constraints.length) continue;
|
|
25
|
+
const sections = [];
|
|
26
|
+
for (const section of parsedGroup.sections || []) {
|
|
27
|
+
const entries = [];
|
|
28
|
+
for (const entry of section.entries || []) {
|
|
29
|
+
if (entry.name === 'none') continue;
|
|
30
|
+
const semantics = constraints.map((constraint) => resolveClassificationAgreement({ entry, constraint, resolvers }));
|
|
31
|
+
entries.push(Object.freeze({
|
|
32
|
+
name: entry.name,
|
|
33
|
+
declaredFields: entry.fields,
|
|
34
|
+
semantics: Object.freeze(semantics)
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
sections.push(Object.freeze({
|
|
38
|
+
heading: section.heading,
|
|
39
|
+
present: Boolean(section.present),
|
|
40
|
+
entries: Object.freeze(entries)
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
declarations.push(Object.freeze({
|
|
44
|
+
group,
|
|
45
|
+
targetHeadings: parsedGroup.contract.targetHeadings,
|
|
46
|
+
sections: Object.freeze(sections)
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return Object.freeze({
|
|
51
|
+
schema: PORTABLE_RESOLVED_INSTANCE_PROJECTION_SCHEMA_ID,
|
|
52
|
+
schemaId: compiled.schemaId,
|
|
53
|
+
validation,
|
|
54
|
+
ordinaryGroups: validation.ordinaryGroups || Object.freeze([]),
|
|
55
|
+
fieldDomains: validation.fieldDomains || Object.freeze({ groups: Object.freeze([]), findings: Object.freeze([]) }),
|
|
56
|
+
declarations: Object.freeze(declarations),
|
|
57
|
+
limitations: Object.freeze([
|
|
58
|
+
'Projection is read-only and preserves declared fields separately from resolved semantics.',
|
|
59
|
+
'Ordinary contract-instance fields are projected only through compiled Root/schema target authority; document-wide label fallback is not used.',
|
|
60
|
+
'Field-domain truth is projected from compiled Field Value Constraints contributions without reinterpreting Allowed Labels.',
|
|
61
|
+
'Schema assignability/ancestor matching is not inferred by this projection.'
|
|
62
|
+
])
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function classificationConstraintsByGroup(constraints = []) {
|
|
67
|
+
const out = new Map();
|
|
68
|
+
for (const constraint of constraints) {
|
|
69
|
+
if (constraint.kind !== 'classification-agreement') continue;
|
|
70
|
+
for (const group of constraint.groups || []) {
|
|
71
|
+
const key = exactToken(group);
|
|
72
|
+
if (!out.has(key)) out.set(key, []);
|
|
73
|
+
out.get(key).push(constraint);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function exactToken(value = '') {
|
|
80
|
+
return String(value || '').trim();
|
|
81
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export const PORTABLE_CONTRACT_SEMANTIC_RESOLUTION_SCHEMA_ID = 'tiinex.portable.contract-semantic-resolution.v1';
|
|
2
|
+
|
|
3
|
+
const KNOWN_PARTICIPANT_CLASSIFICATIONS = new Set(['artifact', 'non-artifact']);
|
|
4
|
+
|
|
5
|
+
export function resolveSchemaAuthority(schemaId, resolvers = {}) {
|
|
6
|
+
const id = String(schemaId || '').trim();
|
|
7
|
+
if (!id) return null;
|
|
8
|
+
if (typeof resolvers.resolveSchemaAuthority === 'function') return resolvers.resolveSchemaAuthority(id) || null;
|
|
9
|
+
return resolvers.schemaAuthorities?.[id] || null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function resolveClassificationAgreement(input = {}) {
|
|
13
|
+
const entry = input.entry || {};
|
|
14
|
+
const constraint = input.constraint || {};
|
|
15
|
+
const resolvers = input.resolvers || {};
|
|
16
|
+
const explicitField = String(constraint.explicitField || '').trim();
|
|
17
|
+
const schemaField = String(constraint.schemaField || '').trim();
|
|
18
|
+
const declared = fieldValue(entry, explicitField);
|
|
19
|
+
const schemaId = fieldValue(entry, schemaField);
|
|
20
|
+
const authority = resolveSchemaAuthority(schemaId, resolvers);
|
|
21
|
+
const authorityObserved = String(authority?.targetKind || '').trim();
|
|
22
|
+
const authorityResolved = KNOWN_PARTICIPANT_CLASSIFICATIONS.has(authorityObserved) ? authorityObserved : '';
|
|
23
|
+
const schemaConstraintQualification = !schemaId
|
|
24
|
+
? 'absent'
|
|
25
|
+
: authorityResolved
|
|
26
|
+
? 'resolved'
|
|
27
|
+
: 'unresolved';
|
|
28
|
+
|
|
29
|
+
const evidence = [];
|
|
30
|
+
if (declared) evidence.push(Object.freeze({ source: 'explicit-declaration', field: explicitField, value: declared }));
|
|
31
|
+
if (schemaId) evidence.push(Object.freeze({ source: 'schema-constraint', field: schemaField, schemaId, targetKind: authorityObserved, qualification: schemaConstraintQualification }));
|
|
32
|
+
|
|
33
|
+
let qualification = 'unresolved';
|
|
34
|
+
let resolved = '';
|
|
35
|
+
let authoritySource = '';
|
|
36
|
+
|
|
37
|
+
if (declared === 'unknown') {
|
|
38
|
+
qualification = 'preserved-unknown';
|
|
39
|
+
resolved = 'unknown';
|
|
40
|
+
authoritySource = 'explicit-declaration';
|
|
41
|
+
} else if (KNOWN_PARTICIPANT_CLASSIFICATIONS.has(declared) && authorityResolved) {
|
|
42
|
+
if (declared === authorityResolved) {
|
|
43
|
+
qualification = 'agreement';
|
|
44
|
+
resolved = declared;
|
|
45
|
+
authoritySource = 'explicit+schema-constraint';
|
|
46
|
+
} else {
|
|
47
|
+
qualification = 'contradictory';
|
|
48
|
+
resolved = '';
|
|
49
|
+
authoritySource = 'conflicting-authorities';
|
|
50
|
+
}
|
|
51
|
+
} else if (KNOWN_PARTICIPANT_CLASSIFICATIONS.has(declared)) {
|
|
52
|
+
qualification = 'explicit';
|
|
53
|
+
resolved = declared;
|
|
54
|
+
authoritySource = 'explicit-declaration';
|
|
55
|
+
} else if (!declared && authorityResolved) {
|
|
56
|
+
qualification = 'resolved-by-authority';
|
|
57
|
+
resolved = authorityResolved;
|
|
58
|
+
authoritySource = 'schema-constraint';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return Object.freeze({
|
|
62
|
+
schema: PORTABLE_CONTRACT_SEMANTIC_RESOLUTION_SCHEMA_ID,
|
|
63
|
+
kind: 'classification-agreement',
|
|
64
|
+
field: explicitField,
|
|
65
|
+
schemaField,
|
|
66
|
+
declared,
|
|
67
|
+
resolved,
|
|
68
|
+
qualification,
|
|
69
|
+
authority: authoritySource,
|
|
70
|
+
schemaConstraint: Object.freeze({
|
|
71
|
+
schemaId,
|
|
72
|
+
qualification: schemaConstraintQualification,
|
|
73
|
+
observedTargetKind: authorityObserved
|
|
74
|
+
}),
|
|
75
|
+
evidence: Object.freeze(evidence)
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function fieldValue(entry = {}, field = '') {
|
|
80
|
+
if (!field || !Object.prototype.hasOwnProperty.call(entry.fields || {}, field)) return '';
|
|
81
|
+
return String(entry.fields[field] ?? '').trim();
|
|
82
|
+
}
|
|
Binary file
|