@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,334 @@
|
|
|
1
|
+
import { parseArtifactMarkdown } from '../artifacts/artifact.parse.js';
|
|
2
|
+
import { rootValidate } from './tiinex.root.v1.validate.js';
|
|
3
|
+
import { resolveSchemaCapabilities, CapabilityStatus } from './capability.registry.js';
|
|
4
|
+
import { schemaRegistry } from './registry.js';
|
|
5
|
+
import { resolveSchemaModule as resolveRegisteredSchemaModule } from './resolver.js';
|
|
6
|
+
import { executeArtifactCreationCapability, qualifyArtifactCreationCapability } from './creation.capability.js';
|
|
7
|
+
import { canonicalC14nV2SelfState, verifyC14nV2TargetSelfDigest } from '../integrity/integrity.c14nV2.js';
|
|
8
|
+
import { validatePortableContractInstance } from '../tooling/portable/schema/contract.validate.js';
|
|
9
|
+
import { projectPortableValidationContractWithQualifiedLocalRoot } from '../tooling/portable/schema/qualifiedLocalRoot.projection.js';
|
|
10
|
+
import { qualifyRootCreationRepresentation, qualifyContinuationCreationRepresentation } from './creation.representation.js';
|
|
11
|
+
import { qualifyCreationSchemaReferences, schemaReferenceAuthoritiesForCreation } from './creation.schemaReferences.js';
|
|
12
|
+
import { qualifySchemaReferenceValue } from './schema.reference.js';
|
|
13
|
+
import { C14N_V2_METHOD_ID, integrityMethodReferenceAuthorityForCreation } from '../integrity/integrity.methodReference.js';
|
|
14
|
+
|
|
15
|
+
export const ARTIFACT_CREATION_CONTRACT_SCHEMA_ID = 'tiinex.artifact.creation.contract.v1';
|
|
16
|
+
export const ARTIFACT_CREATION_RESULT_VALIDATION_SCHEMA_ID = 'tiinex.artifact.creation.result.validation.v1';
|
|
17
|
+
export const ROOT_SCHEMA_ID = 'tiinex.root.v1';
|
|
18
|
+
|
|
19
|
+
export function listCreatableArtifactSchemas(registry = schemaRegistry) {
|
|
20
|
+
const modules = Array.isArray(registry.modules) ? registry.modules : [];
|
|
21
|
+
return modules
|
|
22
|
+
.map((module) => buildArtifactCreationContract({ schemaId: module.id, module }))
|
|
23
|
+
.filter((contract) => contract.status === 'ready');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function buildArtifactCreationContract(input = {}, options = {}) {
|
|
27
|
+
const schemaId = String(input.schemaId || input.id || input.module?.id || '').trim();
|
|
28
|
+
const resolution = input.module ? { module: input.module, fallbackUsed: false, descriptor: describeModuleThroughResolution(input.module) } : resolveSchemaCapabilities({ schemaId });
|
|
29
|
+
const descriptor = input.module ? resolution.descriptor : resolution.descriptor;
|
|
30
|
+
const module = input.module || resolveRegisteredSchemaModule({ schemaId })?.module || null;
|
|
31
|
+
const schemaReferences = schemaReferenceAuthoritiesForCreation(module, input.schemaReferences || options.schemaReferences || null);
|
|
32
|
+
const integrityMethodReferences = Object.freeze({
|
|
33
|
+
primarySelf: integrityMethodReferenceAuthorityForCreation(
|
|
34
|
+
C14N_V2_METHOD_ID,
|
|
35
|
+
Object.prototype.hasOwnProperty.call(input, 'integrityMethodReference') ? input.integrityMethodReference : options.integrityMethodReference
|
|
36
|
+
)
|
|
37
|
+
});
|
|
38
|
+
const fallbackUsed = Boolean(resolution.fallbackUsed && !input.module);
|
|
39
|
+
const transitionType = String(input.transitionType || options.transitionType || 'create-artifact').trim();
|
|
40
|
+
const creationCapability = qualifyArtifactCreationCapability(module, transitionType);
|
|
41
|
+
const creationAuthority = creationCapability.authority?.compiledContract?.creation || {};
|
|
42
|
+
const creation = Object.freeze({
|
|
43
|
+
requiredInputs: list(creationAuthority.requiredInputs),
|
|
44
|
+
optionalInputs: list(creationAuthority.optionalInputs),
|
|
45
|
+
requiredSections: list(creationAuthority.requiredSections),
|
|
46
|
+
representationSections: list(creationAuthority.representationSections),
|
|
47
|
+
toolingConfigurationFields: list(creationAuthority.toolingConfigurationFields),
|
|
48
|
+
inputBindings: list(creationAuthority.inputBindings),
|
|
49
|
+
supplementalRequiredFields: list(creationAuthority.supplementalRequiredFields),
|
|
50
|
+
requiredShape: list(creationAuthority.requiredShape)
|
|
51
|
+
});
|
|
52
|
+
const renderer = creationCapability.implementation?.state === 'implemented'
|
|
53
|
+
? { status: CapabilityStatus.implemented, ...(creationCapability.implementation.renderer || {}) }
|
|
54
|
+
: { status: CapabilityStatus.unavailable, id: '', scope: transitionType };
|
|
55
|
+
const isCreatable = creationCapability.authority?.state === 'qualified' && renderer.status === CapabilityStatus.implemented && !fallbackUsed;
|
|
56
|
+
const findings = [];
|
|
57
|
+
if (!schemaId) findings.push(error('creation.schema.required', 'Creation contract requires a target schema id.'));
|
|
58
|
+
if (fallbackUsed) findings.push(error('creation.schema.fallback-blocked', `Cannot create ${schemaId || 'unknown schema'} through Root fallback; choose an implemented schema module.`));
|
|
59
|
+
if (creationCapability.authority?.state !== 'qualified') findings.push(error('creation.authority.missing', `${schemaId || 'target schema'} does not expose an exact Artifact Creation Contract authority.`));
|
|
60
|
+
if (renderer.status !== 'implemented') findings.push(error('creation.renderer.missing', `${schemaId || 'target schema'} does not have an implemented creation renderer for ${transitionType}.`));
|
|
61
|
+
if (!descriptor?.binding?.schemaId) findings.push(error('creation.binding.schemaId.missing', `${schemaId || 'target schema'} is missing schema binding.`));
|
|
62
|
+
|
|
63
|
+
const status = findings.some((finding) => finding.severity === 'error') ? 'blocked' : 'ready';
|
|
64
|
+
return Object.freeze({
|
|
65
|
+
schema: ARTIFACT_CREATION_CONTRACT_SCHEMA_ID,
|
|
66
|
+
id: stableContractId(schemaId, transitionType),
|
|
67
|
+
status,
|
|
68
|
+
transitionType,
|
|
69
|
+
target: Object.freeze({
|
|
70
|
+
schemaId,
|
|
71
|
+
moduleId: descriptor?.moduleId || '',
|
|
72
|
+
label: descriptor?.label || labelFromSchemaId(schemaId),
|
|
73
|
+
role: descriptor?.role || '',
|
|
74
|
+
parentSchemaId: descriptor?.parentSchemaId || ROOT_SCHEMA_ID,
|
|
75
|
+
fallbackUsed,
|
|
76
|
+
binding: Object.freeze({
|
|
77
|
+
schemaId: descriptor?.binding?.schemaId || '',
|
|
78
|
+
checksum: descriptor?.binding?.checksum || '',
|
|
79
|
+
sourcePath: descriptor?.binding?.sourcePath || '',
|
|
80
|
+
sourceRepository: descriptor?.binding?.sourceRepository || '',
|
|
81
|
+
sourceCommit: descriptor?.binding?.sourceCommit || ''
|
|
82
|
+
})
|
|
83
|
+
}),
|
|
84
|
+
creation,
|
|
85
|
+
executionQualification: creationCapability.implementation?.executionQualification || null,
|
|
86
|
+
resultBoundary: Object.freeze({
|
|
87
|
+
mode: 'browser-local-draft',
|
|
88
|
+
sourceMutation: 'none',
|
|
89
|
+
remoteWrite: false,
|
|
90
|
+
mayInheritParentSource: false,
|
|
91
|
+
allowedSourceModePrefix: 'local-'
|
|
92
|
+
}),
|
|
93
|
+
requiredEnvelope: Object.freeze({
|
|
94
|
+
envelopeSchemaId: ROOT_SCHEMA_ID,
|
|
95
|
+
parentMode: 'forbidden-for-root-required-when-parent-supplied',
|
|
96
|
+
parentFieldsWhenPresent: Object.freeze(['Parent Schema', 'Trace', 'Origin']),
|
|
97
|
+
parentOrigin: 'required-and-labelled-when-parent-present',
|
|
98
|
+
currentFields: Object.freeze(['Current Schema', 'Created At', 'Summary']),
|
|
99
|
+
integrityFooter: 'required'
|
|
100
|
+
}),
|
|
101
|
+
schemaReferences,
|
|
102
|
+
integrityMethodReferences,
|
|
103
|
+
capabilities: Object.freeze({
|
|
104
|
+
create: isCreatable ? CapabilityStatus.implemented : CapabilityStatus.unavailable,
|
|
105
|
+
semanticCreationAuthority: creationCapability.authority?.state || 'unavailable',
|
|
106
|
+
createRenderer: renderer.status,
|
|
107
|
+
fallback: descriptor?.actions?.fallback?.status || CapabilityStatus.unavailable,
|
|
108
|
+
validate: descriptor?.actions?.validate?.status || CapabilityStatus.unavailable,
|
|
109
|
+
present: descriptor?.actions?.present?.status || CapabilityStatus.unavailable
|
|
110
|
+
}),
|
|
111
|
+
renderer: Object.freeze(renderer),
|
|
112
|
+
findings: Object.freeze(findings)
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function renderArtifactCreationCandidateMarkdown(contract = {}, input = {}) {
|
|
117
|
+
if (contract?.status !== 'ready') return '';
|
|
118
|
+
const schemaId = String(contract?.target?.schemaId || '').trim();
|
|
119
|
+
const transitionType = String(contract?.transitionType || 'create-artifact').trim();
|
|
120
|
+
const resolution = resolveRegisteredSchemaModule({ schemaId });
|
|
121
|
+
const module = resolution?.fallbackUsed ? null : resolution?.module || null;
|
|
122
|
+
if (!module) return '';
|
|
123
|
+
const executed = executeArtifactCreationCapability(module, transitionType, contract, input);
|
|
124
|
+
return executed.state === 'rendered' ? executed.markdown : '';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function createArtifactDraftMarkdown(contract = {}, input = {}) {
|
|
128
|
+
const schemaId = String(contract?.target?.schemaId || '').trim();
|
|
129
|
+
const markdown = renderArtifactCreationCandidateMarkdown(contract, input);
|
|
130
|
+
if (!markdown) return '';
|
|
131
|
+
const parentRecord = input.parentRecord || {};
|
|
132
|
+
const validation = validateArtifactCreationResult({ schemaId, status: 'local', sourceMode: 'local-create', path: input.childPath || '', markdown }, parentRecord, {
|
|
133
|
+
contract,
|
|
134
|
+
childPath: input.childPath || '',
|
|
135
|
+
...(Object.prototype.hasOwnProperty.call(input, 'authors') ? { expectedAuthors: input.authors } : {})
|
|
136
|
+
});
|
|
137
|
+
return validation.ok ? markdown : '';
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function validateArtifactCreationContract(contract = {}) {
|
|
141
|
+
const findings = [];
|
|
142
|
+
if (contract.schema !== ARTIFACT_CREATION_CONTRACT_SCHEMA_ID) findings.push(error('creation.contract.schema.invalid', 'Creation contract schema id is invalid.'));
|
|
143
|
+
if (!contract.target?.schemaId) findings.push(error('creation.contract.target.missing', 'Creation contract target schema is missing.'));
|
|
144
|
+
if (contract.status !== 'ready') findings.push(...(contract.findings || [error('creation.contract.not-ready', 'Creation contract is not ready.')]));
|
|
145
|
+
if (contract.resultBoundary?.remoteWrite !== false) findings.push(error('creation.contract.remoteWrite.invalid', 'Artifact creation contract must not perform remote writes.'));
|
|
146
|
+
if (contract.resultBoundary?.mayInheritParentSource !== false) findings.push(error('creation.contract.source.inherit.invalid', 'Draft creation must not inherit parent source objects.'));
|
|
147
|
+
return makeValidation('tiinex.artifact.creation.contract.validation.v1', findings, {
|
|
148
|
+
targetSchemaId: contract.target?.schemaId || '',
|
|
149
|
+
contractId: contract.id || ''
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function validateArtifactCreationResult(draft = {}, parentRecord = {}, options = {}) {
|
|
154
|
+
const contract = options.contract || draft.creationContract || buildArtifactCreationContract({ schemaId: draft.schemaId || draft.targetSchemaId || '' });
|
|
155
|
+
const parsed = parseArtifactMarkdown(draft.markdown || '');
|
|
156
|
+
const findings = [];
|
|
157
|
+
findings.push(...validateArtifactCreationContract(contract).findings);
|
|
158
|
+
findings.push(...validateTargetSchema(parsed, contract));
|
|
159
|
+
findings.push(...validateCreationSchemaReferences(draft.markdown || '', contract));
|
|
160
|
+
findings.push(...validatePortableRootTargetCreationResult(draft.markdown || '', contract, { parentRecord }));
|
|
161
|
+
|
|
162
|
+
const rootCreation = String(contract?.transitionType || 'create-artifact') === 'create-artifact';
|
|
163
|
+
const currentSchemaId = parsed.envelope?.current?.schema?.id || '';
|
|
164
|
+
const expectedSchemaId = contract.target?.schemaId || draft.schemaId || draft.targetSchemaId || '';
|
|
165
|
+
const parent = parsed.envelope?.parent || {};
|
|
166
|
+
const suppliedParent = parentRecordHasAnyValue(parentRecord);
|
|
167
|
+
const parentExpected = !rootCreation && suppliedParent;
|
|
168
|
+
const parentObserved = parsedParentHasAnyValue(parent);
|
|
169
|
+
if (expectedSchemaId && currentSchemaId !== expectedSchemaId) findings.push(error('creation.current.schema.mismatch', `Creation result Current Schema must be ${expectedSchemaId}.`));
|
|
170
|
+
if (options.expectedAuthors !== undefined && String(parsed.envelope?.current?.authors || '') !== String(options.expectedAuthors)) findings.push(error('creation.current.authors.mismatch', 'Creation result Current Authors must preserve the caller-supplied exact value.'));
|
|
171
|
+
if (rootCreation && suppliedParent) findings.push(error('creation.parent.input.unexpected', 'Standalone/root creation must not accept a Continuity Parent input.'));
|
|
172
|
+
if (!parentExpected && parentObserved) findings.push(error('creation.parent.unexpected', 'Standalone/root creation must not invent Continuity Parent truth.'));
|
|
173
|
+
|
|
174
|
+
if (rootCreation) findings.push(...validateRootCreationRepresentation(draft.markdown || '', contract));
|
|
175
|
+
else if (parentExpected) {
|
|
176
|
+
const relativeReference = relativePath(dirname(options.childPath || draft.path || ''), parentRecord.path || '');
|
|
177
|
+
const parentIntegrityTarget = qualifiedParentIntegrityTarget(parentRecord, relativeReference);
|
|
178
|
+
const representation = qualifyContinuationCreationRepresentation(draft.markdown || '', contract, parentRecord, { relativeReference, parentIntegrityTarget });
|
|
179
|
+
findings.push(...(representation.findings || []).map((message, index) => error(`creation.continuation-representation.${index + 1}`, message)));
|
|
180
|
+
findings.push(...validateParentTargetIntegrity(parsed, parentRecord, parentIntegrityTarget));
|
|
181
|
+
const parentSchemaAuthority = parentRecord.schemaReferenceAuthority || {};
|
|
182
|
+
const parentSchemaReference = qualifySchemaReferenceValue(parent.schema?.raw || '', parentSchemaAuthority);
|
|
183
|
+
for (const [index, message] of (parentSchemaReference.findings || []).entries()) findings.push(error(`creation.parent-schema-reference.${index + 1}`, message));
|
|
184
|
+
if (parentSchemaAuthority.resolutionState !== 'qualified') findings.push(error('creation.parent-schema-reference.unresolved', 'Exact continuation requires the declared Parent Schema reference authority to be resolver-qualified.'));
|
|
185
|
+
} else if (!rootCreation) findings.push(error('creation.parent.required', 'Continuation creation requires an exact supplied Parent authority.'));
|
|
186
|
+
|
|
187
|
+
if (draft.status !== 'local') findings.push(error('creation.result.status.not-local', 'Creation result must stay local until explicit publication/export.'));
|
|
188
|
+
if (!String(draft.sourceMode || '').startsWith('local-')) findings.push(error('creation.result.sourceMode.not-local', 'Creation result must use a browser-local sourceMode.'));
|
|
189
|
+
if (draft.source?.adapterId) findings.push(error('creation.result.source.inherited', 'Creation result must not inherit source object from its parent.'));
|
|
190
|
+
if (!parsed.hasIntegrity) findings.push(error('creation.integrity.required', 'Creation result must include Continuity Integrity.'));
|
|
191
|
+
|
|
192
|
+
return makeValidation(ARTIFACT_CREATION_RESULT_VALIDATION_SCHEMA_ID, findings, {
|
|
193
|
+
targetSchemaId: expectedSchemaId,
|
|
194
|
+
currentSchemaId,
|
|
195
|
+
parentTrace: parent.trace || '',
|
|
196
|
+
parentOrigin: parent.origin || '',
|
|
197
|
+
contractId: contract.id || ''
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
function validateParentTargetIntegrity(parsed = {}, parentRecord = {}, expectedTarget = '') {
|
|
204
|
+
const entries = (parsed?.integrity?.entries || []).filter((entry) => entry?.method === C14N_V2_METHOD_ID && String(entry?.towards || '') !== 'self');
|
|
205
|
+
if (entries.length !== 1) return [];
|
|
206
|
+
const entry = entries[0];
|
|
207
|
+
if (!expectedTarget || String(entry.towards || '') !== String(expectedTarget)) return [];
|
|
208
|
+
const result = verifyC14nV2TargetSelfDigest({ value: entry.value || '', targetMarkdown: parentRecord.markdown || '' });
|
|
209
|
+
if (result.state === 'verified') return [];
|
|
210
|
+
const code = result.state === 'mismatch'
|
|
211
|
+
? 'creation.integrity.parent-target.mismatch'
|
|
212
|
+
: result.state === 'target-self-mismatch'
|
|
213
|
+
? 'creation.integrity.parent-self.mismatch'
|
|
214
|
+
: result.state === 'ambiguous'
|
|
215
|
+
? 'creation.integrity.parent-self.ambiguous'
|
|
216
|
+
: 'creation.integrity.parent-self.unavailable';
|
|
217
|
+
return [error(code, `Parent-target c14n-v2 verification failed: ${result.reason || result.state}.`)];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function qualifiedParentIntegrityTarget(parentRecord = {}, relativeReference = '') {
|
|
221
|
+
const published = parentRecord?.publishedReference || parentRecord?.browseGitReference || parentRecord?.browseGit || null;
|
|
222
|
+
const target = typeof published === 'string' ? '' : String(published?.target || published?.url || '');
|
|
223
|
+
const state = typeof published === 'string' ? 'unresolved' : String(published?.state || published?.resolutionState || 'unresolved');
|
|
224
|
+
const recoveryMode = String(parentRecord?.recoveryMode || parentRecord?.parentRecoveryMode || '').trim() === 'external-versioned' ? 'external-versioned' : 'local-relative';
|
|
225
|
+
if (recoveryMode === 'external-versioned') return state === 'qualified' && target ? target : '';
|
|
226
|
+
return state === 'qualified' && target ? target : String(relativeReference || '');
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function validateRootCreationRepresentation(markdown = '', contract = {}) {
|
|
230
|
+
const qualification = qualifyRootCreationRepresentation(markdown, contract);
|
|
231
|
+
return (qualification.findings || []).map((message, index) => error(`creation.representation.multiplicity.${index + 1}`, message));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function validateCreationSchemaReferences(markdown = '', contract = {}) {
|
|
235
|
+
const qualification = qualifyCreationSchemaReferences(markdown, contract);
|
|
236
|
+
return (qualification.findings || []).map((message, index) => error(`creation.schema-reference.${index + 1}`, message));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function validatePortableRootTargetCreationResult(markdown = '', contract = {}, options = {}) {
|
|
240
|
+
const targetSchemaId = String(contract?.target?.schemaId || '').trim();
|
|
241
|
+
const resolution = resolveRegisteredSchemaModule({ schemaId: targetSchemaId });
|
|
242
|
+
const module = resolution?.fallbackUsed ? null : resolution?.module || null;
|
|
243
|
+
const baseValidationContract = module?.schemaSource?.qualify?.()?.compiledContract?.validationContract || null;
|
|
244
|
+
const runtimeProjection = projectPortableValidationContractWithQualifiedLocalRoot(baseValidationContract);
|
|
245
|
+
const validationContract = runtimeProjection.state === 'qualified' ? runtimeProjection.compiledContract : null;
|
|
246
|
+
const findings = [];
|
|
247
|
+
if (!validationContract) return [error('creation.portable-contract.unavailable', `Portable Root + ${targetSchemaId || 'target'} structural validation projection is unavailable.`)];
|
|
248
|
+
try {
|
|
249
|
+
const result = validatePortableContractInstance({ markdown, compiledContract: validationContract });
|
|
250
|
+
for (const item of result.findings || []) {
|
|
251
|
+
if (item?.severity === 'error') findings.push(error(`creation.portable-contract.${item.code || 'invalid'}`, item.message || 'Portable contract validation failed.'));
|
|
252
|
+
else if (item?.severity === 'warning') findings.push(warning(`creation.portable-contract.${item.code || 'warning'}`, item.message || 'Portable contract validation is degraded.'));
|
|
253
|
+
}
|
|
254
|
+
if (result.status !== 'valid' && !(result.findings || []).some((item) => item?.severity === 'error') && !findings.some((item) => item.severity === 'error')) findings.push(error('creation.portable-contract.not-valid', `Portable Root + target structural validation is ${result.status}.`));
|
|
255
|
+
} catch (exception) {
|
|
256
|
+
findings.push(error('creation.portable-contract.failed', String(exception?.message || exception || 'Portable contract validation failed.')));
|
|
257
|
+
}
|
|
258
|
+
const integrity = canonicalC14nV2SelfState(markdown);
|
|
259
|
+
if (integrity.state !== 'verified') findings.push(error('creation.integrity.self.not-verified', `Created artifact self-integrity is not verified: ${integrity.reason || integrity.state}.`));
|
|
260
|
+
return findings;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function validateTargetSchema(parsed = {}, contract = {}) {
|
|
264
|
+
const targetSchemaId = contract.target?.schemaId || parsed.envelope?.current?.schema?.id || '';
|
|
265
|
+
const resolution = resolveRegisteredSchemaModule({ schemaId: targetSchemaId });
|
|
266
|
+
const module = resolution?.module || null;
|
|
267
|
+
const findings = [];
|
|
268
|
+
if (resolution?.fallbackUsed) {
|
|
269
|
+
findings.push(error('creation.validator.root-fallback', `Cannot validate ${targetSchemaId || 'unknown schema'} with a target module; root fallback would be used.`));
|
|
270
|
+
return findings.concat(rootValidate(parsed).map(normalizeFinding));
|
|
271
|
+
}
|
|
272
|
+
if (typeof module?.validate === 'function') return module.validate(parsed).map(normalizeFinding);
|
|
273
|
+
if (hasQualifiedCompiledValidation(module)) return [];
|
|
274
|
+
findings.push(error('creation.validator.unavailable', `${targetSchemaId || 'target schema'} has neither a schema-specific validator nor a qualified compiled validation contract.`));
|
|
275
|
+
return findings.concat(rootValidate(parsed).map(normalizeFinding));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function hasQualifiedCompiledValidation(module = {}) {
|
|
279
|
+
const qualification = typeof module?.schemaSource?.qualify === 'function' ? module.schemaSource.qualify() : null;
|
|
280
|
+
return Boolean(qualification?.state === 'qualified' && qualification?.compiledContract?.validationContract?.lineageQualification?.state === 'valid');
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function describeModuleThroughResolution(module = {}) {
|
|
284
|
+
return {
|
|
285
|
+
moduleId: module.id || '',
|
|
286
|
+
label: module.label || module.id || '',
|
|
287
|
+
role: module.role || '',
|
|
288
|
+
parentSchemaId: module.parentSchemaId || ROOT_SCHEMA_ID,
|
|
289
|
+
binding: {
|
|
290
|
+
schemaId: module.binding?.schemaId || module.id || '',
|
|
291
|
+
checksum: module.binding?.checksum?.value || module.binding?.checksum || '',
|
|
292
|
+
sourcePath: module.binding?.sourcePath || '',
|
|
293
|
+
sourceRepository: module.binding?.sourceRepository || '',
|
|
294
|
+
sourceCommit: module.binding?.sourceCommit || ''
|
|
295
|
+
},
|
|
296
|
+
actions: {
|
|
297
|
+
create: { status: qualifyArtifactCreationCapability(module, 'create-artifact').ready ? CapabilityStatus.implemented : CapabilityStatus.unavailable },
|
|
298
|
+
fallback: { status: module.capabilities?.canRenderFallback === true ? CapabilityStatus.implemented : CapabilityStatus.fallback },
|
|
299
|
+
validate: { status: typeof module.validate === 'function' || hasQualifiedCompiledValidation(module) ? CapabilityStatus.implemented : CapabilityStatus.unavailable },
|
|
300
|
+
present: { status: typeof module.present === 'function' ? CapabilityStatus.implemented : CapabilityStatus.unavailable }
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function makeValidation(schema, findings = [], parsed = {}) {
|
|
306
|
+
const counts = countFindings(findings);
|
|
307
|
+
return Object.freeze({ schema, ok: counts.errors === 0, status: counts.errors ? 'invalid' : counts.warnings ? 'degraded' : 'valid', counts, parsed: Object.freeze(parsed), findings: Object.freeze(findings) });
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function countFindings(findings = []) {
|
|
311
|
+
return findings.reduce((counts, finding) => {
|
|
312
|
+
if (finding.severity === 'error') counts.errors += 1;
|
|
313
|
+
else if (finding.severity === 'warning') counts.warnings += 1;
|
|
314
|
+
else counts.info += 1;
|
|
315
|
+
return counts;
|
|
316
|
+
}, { errors: 0, warnings: 0, info: 0 });
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function stableContractId(schemaId, transitionType) { return `creation:${transitionType || 'create'}:${schemaId || 'unknown'}`; }
|
|
320
|
+
function labelFromSchemaId(id = '') { const tail = String(id || '').split('.').filter(Boolean).slice(-2, -1)[0] || String(id || 'artifact'); return tail.charAt(0).toUpperCase() + tail.slice(1); }
|
|
321
|
+
function parentRecordHasAnyValue(record = {}) { return Boolean(record?.id || record?.path || record?.schemaId || record?.currentSchemaId || record?.continuationTrace || record?.publishedReference?.target || record?.schemaReferenceAuthority?.preferredTarget); }
|
|
322
|
+
function parsedParentHasAnyValue(parent = {}) { return Boolean(parent?.schema?.id || parent?.trace || parent?.origin || parent?.boundary || parent?.createdAt || parent?.originEntries?.length); }
|
|
323
|
+
function originMatchesPath(origin = '', path = '') { return normalizePath(origin).endsWith(normalizePath(path)); }
|
|
324
|
+
function normalizePath(value = '') { return String(value || '').replace(/^https?:\/\/github\.com\/[^/]+\/[^/]+\/blob\/[^/]+\//, '').replace(/^https?:\/\/raw\.githubusercontent\.com\/[^/]+\/[^/]+\/[^/]+\//, '').replace(/^\/+/, '').replace(/\\/g, '/'); }
|
|
325
|
+
function normalizeFinding(finding = {}) { return { severity: finding.severity || 'info', code: finding.code || 'creation.finding', message: finding.message || '', source: finding.source || ARTIFACT_CREATION_CONTRACT_SCHEMA_ID }; }
|
|
326
|
+
function finding(severity, code, message) { return { severity, code, message, source: ARTIFACT_CREATION_CONTRACT_SCHEMA_ID }; }
|
|
327
|
+
function list(value) { return Object.freeze([...(value || [])]); }
|
|
328
|
+
|
|
329
|
+
function error(code, message) { return finding('error', code, message); }
|
|
330
|
+
function warning(code, message) { return finding('warning', code, message); }
|
|
331
|
+
|
|
332
|
+
function canonicalPath(value='') { return String(value || '').replace(/\\/g,'/').replace(/^\.\//,'').replace(/^\/+|\/+$/g,''); }
|
|
333
|
+
function dirname(value='') { const p=canonicalPath(value); const i=p.lastIndexOf('/'); return i<0?'':p.slice(0,i); }
|
|
334
|
+
function relativePath(fromDir='', toPath='') { const from=canonicalPath(fromDir).split('/').filter(Boolean), to=canonicalPath(toPath).split('/').filter(Boolean); let i=0; while(i<from.length&&i<to.length&&from[i]===to[i])i++; return [...Array(from.length-i).fill('..'),...to.slice(i)].join('/') || (to.at(-1)||''); }
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { canonicalRootCreatedAt } from './creation.rootMetadata.js';
|
|
2
|
+
|
|
3
|
+
export const CREATION_EXECUTION_SNAPSHOT_SCHEMA_ID = 'tiinex.site.creation-execution-snapshot.v1';
|
|
4
|
+
|
|
5
|
+
export function snapshotOrdinaryCreationExecutionInput(contract = {}, input = {}, options = {}) {
|
|
6
|
+
if (declaredParentInput(input?.parentRecord)) throw new Error('creation-root-parent-not-authorized');
|
|
7
|
+
const creation = contract?.creation || {};
|
|
8
|
+
const declaredLabels = uniqueExactLabels([...(creation.requiredInputs || []), ...(creation.optionalInputs || [])]);
|
|
9
|
+
const bindings = new Map((creation.inputBindings || []).map((item) => [String(item?.input || ''), item]));
|
|
10
|
+
const effective = exactDeclaredValues(input, declaredLabels, bindings);
|
|
11
|
+
const createdAt = canonicalRootCreatedAt(hasCreatedAt(input) ? input.createdAt : (typeof options.now === 'function' ? options.now() : new Date()));
|
|
12
|
+
const authorityValues = freezeCreationMap(effective);
|
|
13
|
+
const authority = Object.freeze({
|
|
14
|
+
schema: CREATION_EXECUTION_SNAPSHOT_SCHEMA_ID,
|
|
15
|
+
values: authorityValues,
|
|
16
|
+
createdAt,
|
|
17
|
+
declaredLabels: Object.freeze(declaredLabels.slice())
|
|
18
|
+
});
|
|
19
|
+
const executionValues = freezeCreationMap(effective);
|
|
20
|
+
const executionInputs = freezeCreationMap(effective);
|
|
21
|
+
const implementationInput = Object.freeze({
|
|
22
|
+
values: executionValues,
|
|
23
|
+
inputs: executionInputs,
|
|
24
|
+
createdAt,
|
|
25
|
+
...(input.title !== undefined ? { title: scalar(input.title) } : {}),
|
|
26
|
+
...(input.summary !== undefined ? { summary: scalar(input.summary) } : {}),
|
|
27
|
+
...(input.authors !== undefined ? { authors: scalar(input.authors) } : {}),
|
|
28
|
+
...(input.why !== undefined ? { why: scalar(input.why) } : {}),
|
|
29
|
+
...(input.status !== undefined ? { status: scalar(input.status) } : {}),
|
|
30
|
+
...(input.bodyMarkdown !== undefined ? { bodyMarkdown: scalar(input.bodyMarkdown) } : {})
|
|
31
|
+
});
|
|
32
|
+
return Object.freeze({ authority, implementationInput });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function exactDeclaredValues(input = {}, labels = [], bindings = new Map()) {
|
|
36
|
+
const values = objectMap(input?.values);
|
|
37
|
+
const inputs = objectMap(input?.inputs);
|
|
38
|
+
const out = {};
|
|
39
|
+
for (const label of labels) {
|
|
40
|
+
const binding = bindings.get(label) || null;
|
|
41
|
+
if (Object.prototype.hasOwnProperty.call(values, label)) out[label] = snapshotCreationValue(values[label], binding);
|
|
42
|
+
else if (Object.prototype.hasOwnProperty.call(inputs, label)) out[label] = snapshotCreationValue(inputs[label], binding);
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
function snapshotCreationValue(value, binding = null) {
|
|
47
|
+
const kind = String(binding?.kind || '');
|
|
48
|
+
if (kind === 'ordinary-group') return freezeStructuredObject(value, binding?.input || 'value');
|
|
49
|
+
if (kind === 'named-declaration-section') {
|
|
50
|
+
if (typeof value === 'string') return scalar(value);
|
|
51
|
+
if (!Array.isArray(value)) throw new Error(`creation-declaration-list-required:${binding?.input || 'value'}`);
|
|
52
|
+
return Object.freeze(value.map((entry) => freezeStructuredObject(entry, binding?.input || 'value')));
|
|
53
|
+
}
|
|
54
|
+
return scalar(value);
|
|
55
|
+
}
|
|
56
|
+
function freezeStructuredObject(value, label) {
|
|
57
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error(`creation-structured-object-required:${label}`);
|
|
58
|
+
return deepFreezeJson(value);
|
|
59
|
+
}
|
|
60
|
+
function deepFreezeJson(value) {
|
|
61
|
+
if (!value || typeof value !== 'object') return scalar(value);
|
|
62
|
+
if (Array.isArray(value)) return Object.freeze(value.map(deepFreezeJson));
|
|
63
|
+
const out = {};
|
|
64
|
+
for (const [key, item] of Object.entries(value)) out[key] = deepFreezeJson(item);
|
|
65
|
+
return Object.freeze(out);
|
|
66
|
+
}
|
|
67
|
+
function uniqueExactLabels(values = []) {
|
|
68
|
+
const out = [];
|
|
69
|
+
for (const value of values) {
|
|
70
|
+
const label = String(value || '');
|
|
71
|
+
if (label && !out.includes(label)) out.push(label);
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
function objectMap(value) { return value && typeof value === 'object' && !Array.isArray(value) ? value : {}; }
|
|
76
|
+
function freezeCreationMap(value = {}) { return Object.freeze(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, deepFreezeJson(item)]))); }
|
|
77
|
+
function scalar(value) { return typeof value === 'string' ? value : String(value ?? ''); }
|
|
78
|
+
function hasCreatedAt(input = {}) { return input.createdAt !== undefined && input.createdAt !== null && String(input.createdAt) !== ''; }
|
|
79
|
+
function declaredParentInput(record = {}) { return Boolean(record && (record.id || record.path || record.schemaId || record.currentSchemaId || record.continuationTrace)); }
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export function representativeCreationValue(name, index, binding = {}, validationContract = null) {
|
|
2
|
+
const sentinel = `TIINEX_CREATE_INPUT_${index + 1}_${sentinelToken(name)}`;
|
|
3
|
+
if (binding?.kind === 'ordinary-field') return representativeScalarForField(validationContract, binding.group, binding.field || name, sentinel);
|
|
4
|
+
if (binding?.kind === 'ordinary-group') {
|
|
5
|
+
return Object.freeze(Object.fromEntries((binding.requiredFields || []).map((field, fieldIndex) => [field, representativeScalarForField(validationContract, binding.group, field, `${sentinel}_${fieldIndex + 1}`)])));
|
|
6
|
+
}
|
|
7
|
+
if (binding?.kind === 'named-declaration-section') {
|
|
8
|
+
const fields = Object.freeze(Object.fromEntries((binding.requiredFields || []).map((field, fieldIndex) => [field, representativeScalarForField(validationContract, binding.group, field, `${sentinel}_${fieldIndex + 1}`)])));
|
|
9
|
+
return Object.freeze([Object.freeze({ name: `entry-${index + 1}`, fields })]);
|
|
10
|
+
}
|
|
11
|
+
return sentinel;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function qualifyStructuredCreationInputFidelity(requiredInputs = [], inputBindings = [], values = {}, validation = {}) {
|
|
15
|
+
const findings = [];
|
|
16
|
+
for (const name of requiredInputs) {
|
|
17
|
+
const binding = inputBindings.find((item) => String(item?.input || '') === String(name || ''));
|
|
18
|
+
if (!binding || !Object.prototype.hasOwnProperty.call(values, name)) continue;
|
|
19
|
+
if (binding.kind === 'ordinary-field') qualifyOrdinaryField(findings, name, binding, values[name], validation);
|
|
20
|
+
else if (binding.kind === 'ordinary-group') qualifyOrdinaryGroup(findings, name, binding, values[name], validation);
|
|
21
|
+
else if (binding.kind === 'named-declaration-section') qualifyDeclarationSection(findings, name, binding, values[name], validation);
|
|
22
|
+
}
|
|
23
|
+
return findings;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function representativeScalarForField(validationContract = null, group = '', field = '', fallback = 'TIINEX_CREATE_VALUE') {
|
|
27
|
+
const contributions = (validationContract?.constraints || []).filter((item) => item?.kind === 'field-domain' && String(item?.targetGroup || item?.sourceGroup || '') === String(group || '') && String(item?.field || '') === String(field || '') && String(item?.authorityQualification || 'valid') === 'valid');
|
|
28
|
+
const closed = contributions.filter((item) => String(item?.domainPolicy || '') === 'closed');
|
|
29
|
+
if (closed.length) {
|
|
30
|
+
const candidateSets = closed.map((item) => [...(item.allowedValues || [])]);
|
|
31
|
+
const shared = (candidateSets[0] || []).find((value) => candidateSets.every((set) => set.includes(value)));
|
|
32
|
+
if (shared !== undefined) return String(shared);
|
|
33
|
+
}
|
|
34
|
+
return String(fallback);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function qualifyOrdinaryField(findings, name, binding, expected, validation) {
|
|
38
|
+
const group = (validation.ordinaryGroups || []).find((item) => String(item?.group || '') === String(binding.group || ''));
|
|
39
|
+
const field = (group?.fields || []).find((item) => String(item?.label || '') === String(binding.field || name));
|
|
40
|
+
const occurrences = field?.occurrences || [];
|
|
41
|
+
if (occurrences.length !== 1 || String(occurrences[0]?.value || '') !== String(expected)) findings.push(`Required input ${name} was not preserved exactly in ordinary field ${binding.group}.${binding.field || name}.`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function qualifyOrdinaryGroup(findings, name, binding, expectedValue, validation) {
|
|
45
|
+
const group = (validation.ordinaryGroups || []).find((item) => String(item?.group || '') === String(binding.group || ''));
|
|
46
|
+
const expected = expectedValue && typeof expectedValue === 'object' && !Array.isArray(expectedValue) ? expectedValue : {};
|
|
47
|
+
for (const [fieldName, fieldValue] of Object.entries(expected)) {
|
|
48
|
+
const field = (group?.fields || []).find((item) => String(item?.label || '') === String(fieldName));
|
|
49
|
+
const occurrences = field?.occurrences || [];
|
|
50
|
+
if (occurrences.length !== 1 || String(occurrences[0]?.value || '') !== String(fieldValue)) findings.push(`Required input ${name}.${fieldName} was not preserved exactly in ordinary group ${binding.group}.`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function qualifyDeclarationSection(findings, name, binding, expected, validation) {
|
|
55
|
+
const declaration = (validation.declarations || []).find((item) => String(item?.contract?.group || '') === String(binding.group || ''));
|
|
56
|
+
const section = (declaration?.sections || []).find((item) => String(item?.heading || '').replace(/^##\s+/, '') === String(binding.section || ''));
|
|
57
|
+
if (typeof expected === 'string' && expected === 'none') {
|
|
58
|
+
const entries = section?.entries || [];
|
|
59
|
+
if (!(entries.length === 1 && String(entries[0]?.name || '') === 'none')) findings.push(`Required input ${name} literal none was not preserved exactly in declaration section ${binding.section}.`);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!Array.isArray(expected)) return;
|
|
63
|
+
const entries = section?.entries || [];
|
|
64
|
+
if (entries.length !== expected.length) { findings.push(`Required input ${name} declaration count was not preserved exactly in ${binding.section}.`); return; }
|
|
65
|
+
for (let index = 0; index < expected.length; index += 1) {
|
|
66
|
+
const expectedEntry = expected[index] || {};
|
|
67
|
+
const observed = entries[index] || {};
|
|
68
|
+
if (String(observed.name || '') !== String(expectedEntry.name || '')) findings.push(`Required input ${name} declaration name at index ${index} was not preserved exactly.`);
|
|
69
|
+
for (const [fieldName, fieldValue] of Object.entries(expectedEntry.fields || {})) if (String(observed.fields?.[fieldName] || '') !== String(fieldValue)) findings.push(`Required input ${name}.${expectedEntry.name || index}.${fieldName} was not preserved exactly.`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function sentinelToken(value = '') { return String(value || '').toUpperCase().replace(/[^A-Z0-9]+/g, '_').replace(/^_+|_+$/g, '') || 'INPUT'; }
|