@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,244 @@
|
|
|
1
|
+
import { sealC14nV2Self, validatedC14nV2PrimarySelfDigest } from '../integrity/integrity.c14nV2.js';
|
|
2
|
+
import { schemaIdForRecord } from './schema.identity.js';
|
|
3
|
+
import { canonicalRootCreatedAt } from './creation.rootMetadata.js';
|
|
4
|
+
import { renderSchemaReference } from './schema.reference.js';
|
|
5
|
+
import { C14N_V2_METHOD_ID, renderIntegrityMethodReference } from '../integrity/integrity.methodReference.js';
|
|
6
|
+
|
|
7
|
+
export const GENERIC_ARTIFACT_CREATION_RENDERER_ID = 'tiinex.site.generic-artifact-creation-renderer.v1';
|
|
8
|
+
|
|
9
|
+
export function renderArtifactCreationDraftMarkdown(contract = {}, input = {}) {
|
|
10
|
+
const parentRecord = input.parentRecord || {};
|
|
11
|
+
const rootCreation = String(contract?.transitionType || 'create-artifact') === 'create-artifact';
|
|
12
|
+
const currentSchemaId = String(input.currentSchemaId || contract.target?.schemaId || '').trim();
|
|
13
|
+
const createdAt = canonicalRootCreatedAt(input.createdAt);
|
|
14
|
+
const values = creationValues(input);
|
|
15
|
+
const summaryBinding = (contract?.creation?.inputBindings || []).find((binding) => binding?.kind === 'root-current-summary-body-title');
|
|
16
|
+
const boundSummary = summaryBinding ? creationValue(values, summaryBinding.input) : undefined;
|
|
17
|
+
const hasBoundSummary = Boolean(summaryBinding && boundSummary !== undefined);
|
|
18
|
+
const boundSummaryText = hasBoundSummary ? exactOneLineValue(boundSummary, 'Summary') : '';
|
|
19
|
+
if (hasBoundSummary && input.title !== undefined && String(input.title) !== boundSummaryText) throw new Error('creation-summary-title-conflict');
|
|
20
|
+
if (hasBoundSummary && input.summary !== undefined && String(input.summary) !== boundSummaryText) throw new Error('creation-summary-envelope-conflict');
|
|
21
|
+
const title = hasBoundSummary ? boundSummaryText : exactOneLineValue(input.title !== undefined ? input.title : `${contract.target?.label || labelFromSchemaId(currentSchemaId)} Draft`, 'title');
|
|
22
|
+
const summary = hasBoundSummary ? boundSummaryText : exactOneLineValue(input.summary !== undefined ? input.summary : title, 'summary');
|
|
23
|
+
const authorsValue = input.authors !== undefined ? input.authors : creationValue(values, 'Authors');
|
|
24
|
+
const authors = authorsValue === undefined ? '' : exactOneLineValue(authorsValue, 'Authors');
|
|
25
|
+
const whyValue = input.why !== undefined ? input.why : creationValue(values, 'Why');
|
|
26
|
+
const why = whyValue === undefined || String(whyValue) === '' ? '' : exactOneLineValue(whyValue, 'Why');
|
|
27
|
+
const statusValue = input.status !== undefined ? input.status : creationValue(values, 'Status');
|
|
28
|
+
const status = statusValue === undefined || String(statusValue) === '' ? '' : exactOneLineValue(statusValue, 'Status');
|
|
29
|
+
const bodyMarkdown = input.bodyMarkdown !== undefined ? String(input.bodyMarkdown) : contractDrivenBodyMarkdown(contract, { title, values });
|
|
30
|
+
const rootSchemaId = 'tiinex.root.v1';
|
|
31
|
+
const envelopeSchemaReference = renderSchemaReference(contract?.schemaReferences?.envelope || { schemaId: rootSchemaId });
|
|
32
|
+
const currentSchemaReference = renderSchemaReference(contract?.schemaReferences?.current || { schemaId: currentSchemaId });
|
|
33
|
+
const parent = parentEnvelope(parentRecord, input.childPath || '');
|
|
34
|
+
const integrityMethodReference = renderIntegrityMethodReference(contract?.integrityMethodReferences?.primarySelf || { methodId: C14N_V2_METHOD_ID });
|
|
35
|
+
if (rootCreation && parent) throw new Error('creation-root-parent-not-authorized');
|
|
36
|
+
if (!rootCreation && !parent) throw new Error('creation-continuation-parent-required');
|
|
37
|
+
const lines = [
|
|
38
|
+
'# Continuity Context', '',
|
|
39
|
+
`- Envelope Schema: ${envelopeSchemaReference}`,
|
|
40
|
+
...(parent ? renderParent(parent) : []),
|
|
41
|
+
'- Current',
|
|
42
|
+
` - Current Schema: ${currentSchemaReference}`,
|
|
43
|
+
` - Created At: ${createdAt}`,
|
|
44
|
+
...(authors ? [` - Authors: ${authors}`] : []),
|
|
45
|
+
...(why ? [` - Why: ${why}`] : []),
|
|
46
|
+
` - Summary: ${summary}`,
|
|
47
|
+
...(status ? [` - Status: ${status}`] : []),
|
|
48
|
+
'', '---', '', bodyMarkdown, '', '---', '', '# Continuity Integrity', '',
|
|
49
|
+
...(parent ? [
|
|
50
|
+
`- ${integrityMethodReference}`,
|
|
51
|
+
` - Towards: [${parent.traceLabel}](${parent.integrityTarget})`,
|
|
52
|
+
` - Value: ${parent.primarySelfDigest}`,
|
|
53
|
+
''
|
|
54
|
+
] : []),
|
|
55
|
+
`- ${integrityMethodReference}`,
|
|
56
|
+
' - Towards: self',
|
|
57
|
+
' - Value: pending'
|
|
58
|
+
];
|
|
59
|
+
const unsigned = lines.join('\n');
|
|
60
|
+
const sealed = sealC14nV2Self(unsigned);
|
|
61
|
+
if (sealed.state !== 'sealed') throw new Error(`creation-integrity-seal-${sealed.reason || sealed.state}`);
|
|
62
|
+
return sealed.markdown;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const genericArtifactCreationImplementation = Object.freeze({
|
|
66
|
+
status: 'implemented',
|
|
67
|
+
renderer: Object.freeze({ id: GENERIC_ARTIFACT_CREATION_RENDERER_ID, scope: 'contract-driven-browser-local-draft' }),
|
|
68
|
+
execute: renderArtifactCreationDraftMarkdown
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
function renderParent(parent) {
|
|
72
|
+
return [
|
|
73
|
+
'- Parent',
|
|
74
|
+
` - Parent Schema: ${renderSchemaReference(parent.schemaReferenceAuthority)}`,
|
|
75
|
+
...(parent.createdAt ? [` - Created At: ${parent.createdAt}`] : []),
|
|
76
|
+
` - Trace: [${parent.traceLabel}](${parent.traceReference})`,
|
|
77
|
+
' - Origin:',
|
|
78
|
+
...(parent.relativeReference ? [` - [relative](${parent.relativeReference})`] : []),
|
|
79
|
+
...(parent.publishedReference ? [` - [browse + git](${parent.publishedReference})`] : [])
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function contractDrivenBodyMarkdown(contract = {}, { title = '', values = {} } = {}) {
|
|
84
|
+
const creation = contract?.creation || {};
|
|
85
|
+
const bindings = Array.isArray(creation.inputBindings) ? creation.inputBindings : [];
|
|
86
|
+
const supplementalRequiredFields = Array.isArray(creation.supplementalRequiredFields) ? creation.supplementalRequiredFields : [];
|
|
87
|
+
const sections = Array.isArray(creation.representationSections) && creation.representationSections.length
|
|
88
|
+
? creation.representationSections
|
|
89
|
+
: (Array.isArray(creation.requiredSections) ? creation.requiredSections : []);
|
|
90
|
+
if (!sections.length) throw new Error('creation-representation-required-sections-unavailable');
|
|
91
|
+
const lines = [`# ${title}`];
|
|
92
|
+
if ((creation.requiredShape || []).some((item) => String(item?.primitive?.kind || '') === 'body-prose-block')) {
|
|
93
|
+
lines.push('', 'Provide the required unheaded body prose here.');
|
|
94
|
+
}
|
|
95
|
+
for (const section of sections) {
|
|
96
|
+
const sectionBindings = bindings.filter((candidate) => candidate?.section === section && candidate?.kind !== 'root-current-summary-body-title');
|
|
97
|
+
if (!sectionBindings.length) throw new Error(`creation-input-binding-unavailable:${section}`);
|
|
98
|
+
lines.push('', `## ${section}`, '');
|
|
99
|
+
if (sectionBindings.length === 1 && sectionBindings[0]?.kind === 'section-body') {
|
|
100
|
+
const binding = sectionBindings[0];
|
|
101
|
+
const value = creationValue(values, binding.input);
|
|
102
|
+
if (value === undefined || String(value).trim() === '') throw new Error(`creation-required-input-missing:${binding.input}`);
|
|
103
|
+
lines.push(String(value));
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const fieldBindings = sectionBindings.filter((binding) => binding?.kind === 'ordinary-field');
|
|
107
|
+
const groupBindings = sectionBindings.filter((binding) => binding?.kind === 'ordinary-group');
|
|
108
|
+
const declarationBindings = sectionBindings.filter((binding) => binding?.kind === 'named-declaration-section');
|
|
109
|
+
if (fieldBindings.length && groupBindings.length) throw new Error(`creation-section-binding-ambiguous:${section}`);
|
|
110
|
+
if ((fieldBindings.length || groupBindings.length) && declarationBindings.length) throw new Error(`creation-section-binding-ambiguous:${section}`);
|
|
111
|
+
if (declarationBindings.length > 1 || groupBindings.length > 1) throw new Error(`creation-section-binding-ambiguous:${section}`);
|
|
112
|
+
if (fieldBindings.length) {
|
|
113
|
+
for (const binding of fieldBindings) {
|
|
114
|
+
const value = creationValue(values, binding.input);
|
|
115
|
+
if (value === undefined) throw new Error(`creation-required-input-missing:${binding.input}`);
|
|
116
|
+
lines.push(`- ${binding.field || binding.input}: ${exactOneLineValue(value, binding.input)}`);
|
|
117
|
+
}
|
|
118
|
+
for (const supplemental of supplementalRequiredFields.filter((item) => String(item?.section || '') === String(section || ''))) {
|
|
119
|
+
lines.push(`- ${supplemental.field}: ${exactOneLineValue(supplemental.value, supplemental.field)}`);
|
|
120
|
+
}
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (groupBindings.length === 1) {
|
|
124
|
+
lines.push(...renderOrdinaryGroupBinding(groupBindings[0], creationValue(values, groupBindings[0].input)));
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (declarationBindings.length === 1) {
|
|
128
|
+
lines.push(...renderNamedDeclarationBinding(declarationBindings[0], creationValue(values, declarationBindings[0].input)));
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
throw new Error(`creation-input-binding-unavailable:${section}`);
|
|
132
|
+
}
|
|
133
|
+
return lines.join('\n');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function renderOrdinaryGroupBinding(binding = {}, value) {
|
|
137
|
+
const object = structuredObject(value, binding.input);
|
|
138
|
+
const required = [...(binding.requiredFields || [])];
|
|
139
|
+
const optional = [...(binding.optionalFields || [])];
|
|
140
|
+
const allowed = new Set([...required, ...optional]);
|
|
141
|
+
for (const field of required) if (!Object.prototype.hasOwnProperty.call(object, field)) throw new Error(`creation-required-structured-field-missing:${binding.input}:${field}`);
|
|
142
|
+
for (const field of Object.keys(object)) if (!allowed.has(field)) throw new Error(`creation-structured-field-unqualified:${binding.input}:${field}`);
|
|
143
|
+
const lines = [];
|
|
144
|
+
for (const field of [...required, ...optional]) {
|
|
145
|
+
if (!Object.prototype.hasOwnProperty.call(object, field)) continue;
|
|
146
|
+
lines.push(`- ${field}: ${exactOneLineValue(object[field], `${binding.input}.${field}`)}`);
|
|
147
|
+
}
|
|
148
|
+
return lines;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function renderNamedDeclarationBinding(binding = {}, value) {
|
|
152
|
+
if (typeof value === 'string' && value === 'none' && binding.allowLiteralNone === true) return ['- none'];
|
|
153
|
+
if (!Array.isArray(value) || value.length === 0) throw new Error(`creation-declaration-list-required:${binding.input}`);
|
|
154
|
+
const required = [...(binding.requiredFields || [])];
|
|
155
|
+
const optional = [...(binding.optionalFields || [])];
|
|
156
|
+
const allowed = new Set([...required, ...optional]);
|
|
157
|
+
const seen = new Set();
|
|
158
|
+
const lines = [];
|
|
159
|
+
for (const entry of value) {
|
|
160
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) throw new Error(`creation-declaration-entry-invalid:${binding.input}`);
|
|
161
|
+
const name = exactOneLineValue(entry.name, `${binding.input}.name`);
|
|
162
|
+
if (name === 'none') throw new Error(`creation-declaration-name-reserved:${binding.input}`);
|
|
163
|
+
if (seen.has(name)) throw new Error(`creation-declaration-name-duplicate:${binding.input}:${name}`);
|
|
164
|
+
seen.add(name);
|
|
165
|
+
const fields = structuredObject(entry.fields, `${binding.input}.${name}.fields`);
|
|
166
|
+
for (const field of required) if (!Object.prototype.hasOwnProperty.call(fields, field)) throw new Error(`creation-required-structured-field-missing:${binding.input}:${field}`);
|
|
167
|
+
for (const field of Object.keys(fields)) if (!allowed.has(field)) throw new Error(`creation-structured-field-unqualified:${binding.input}:${field}`);
|
|
168
|
+
lines.push(`- ${name}`);
|
|
169
|
+
for (const field of [...required, ...optional]) {
|
|
170
|
+
if (!Object.prototype.hasOwnProperty.call(fields, field)) continue;
|
|
171
|
+
lines.push(` - ${field}: ${exactOneLineValue(fields[field], `${binding.input}.${name}.${field}`)}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return lines;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function structuredObject(value, label = 'value') {
|
|
178
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error(`creation-structured-object-required:${label}`);
|
|
179
|
+
return value;
|
|
180
|
+
}
|
|
181
|
+
function creationValues(input = {}) {
|
|
182
|
+
const explicit = input.values && typeof input.values === 'object' && !Array.isArray(input.values) ? input.values : {};
|
|
183
|
+
const alternate = input.inputs && typeof input.inputs === 'object' && !Array.isArray(input.inputs) ? input.inputs : {};
|
|
184
|
+
return Object.freeze({ ...alternate, ...explicit });
|
|
185
|
+
}
|
|
186
|
+
function creationValue(values = {}, name = '') { return Object.prototype.hasOwnProperty.call(values, name) ? values[name] : undefined; }
|
|
187
|
+
|
|
188
|
+
function parentEnvelope(record = {}, childPath = '') {
|
|
189
|
+
const hasParent = Boolean(record?.id || record?.path || record?.schemaId || record?.currentSchemaId || record?.publishedReference);
|
|
190
|
+
if (!hasParent) return null;
|
|
191
|
+
const schemaId = schemaIdForRecord(record);
|
|
192
|
+
const parentPath = normalizePath(record.path);
|
|
193
|
+
const child = normalizePath(childPath);
|
|
194
|
+
const recoveryMode = normalizeParentRecoveryMode(record.recoveryMode || record.parentRecoveryMode || 'local-relative');
|
|
195
|
+
const published = normalizePublishedReference(record.publishedReference || record.browseGitReference || record.browseGit || '');
|
|
196
|
+
const publishedReference = published.state === 'qualified' ? published.target : '';
|
|
197
|
+
const relativeReference = recoveryMode === 'external-versioned' ? '' : String(record.relativeReference || relativePath(dirname(child), parentPath)).trim();
|
|
198
|
+
const traceReference = recoveryMode === 'external-versioned' ? publishedReference : relativeReference;
|
|
199
|
+
const schemaReferenceAuthority = normalizeParentSchemaReferenceAuthority(record.schemaReferenceAuthority || record.parentSchemaReferenceAuthority, schemaId);
|
|
200
|
+
if (!schemaId || !parentPath || !child || !traceReference) throw new Error('creation-parent-identity-incomplete');
|
|
201
|
+
if (recoveryMode === 'external-versioned' && !publishedReference) throw new Error('creation-parent-external-versioned-reference-required');
|
|
202
|
+
const parentSelf = validatedC14nV2PrimarySelfDigest(record.markdown || '');
|
|
203
|
+
if (parentSelf.state !== 'verified') throw new Error(`creation-parent-primary-self-${parentSelf.reason || parentSelf.state}`);
|
|
204
|
+
const integrityTarget = publishedReference || relativeReference;
|
|
205
|
+
if (!integrityTarget) throw new Error('creation-parent-integrity-target-unavailable');
|
|
206
|
+
return Object.freeze({
|
|
207
|
+
schemaId,
|
|
208
|
+
schemaReferenceAuthority,
|
|
209
|
+
createdAt: String(record.createdAt || '').trim(),
|
|
210
|
+
recoveryMode,
|
|
211
|
+
traceReference,
|
|
212
|
+
relativeReference,
|
|
213
|
+
publishedReference,
|
|
214
|
+
integrityTarget,
|
|
215
|
+
primarySelfDigest: parentSelf.value,
|
|
216
|
+
traceLabel: basename(parentPath)
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function normalizeParentRecoveryMode(value = '') { return String(value || '').trim() === 'external-versioned' ? 'external-versioned' : 'local-relative'; }
|
|
221
|
+
function normalizePublishedReference(value) {
|
|
222
|
+
if (typeof value === 'string') return Object.freeze({ target: value, state: value ? 'unresolved' : 'unavailable' });
|
|
223
|
+
return Object.freeze({ target: String(value?.target || value?.url || ''), state: String(value?.state || value?.resolutionState || 'unresolved') });
|
|
224
|
+
}
|
|
225
|
+
function normalizeParentSchemaReferenceAuthority(value, schemaId) {
|
|
226
|
+
if (typeof value === 'string') return Object.freeze({ schemaId, exactTargets: Object.freeze([value]), preferredTarget: value, resolutionState: 'unresolved' });
|
|
227
|
+
const target = String(value?.preferredTarget || value?.target || '');
|
|
228
|
+
const exactTargets = [...new Set([...(value?.exactTargets || []), target].map(String).filter(Boolean))];
|
|
229
|
+
return Object.freeze({ schemaId: String(value?.schemaId || schemaId), exactTargets: Object.freeze(exactTargets), preferredTarget: target || exactTargets[0] || '', resolutionState: String(value?.resolutionState || value?.state || 'unresolved') });
|
|
230
|
+
}
|
|
231
|
+
function exactOneLineValue(value, label = 'value') {
|
|
232
|
+
const text = String(value ?? '');
|
|
233
|
+
if (!text || /[\r\n]/.test(text) || text !== text.trim()) throw new Error(`creation-one-line-value-unrepresentable:${label}`);
|
|
234
|
+
return text;
|
|
235
|
+
}
|
|
236
|
+
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); }
|
|
237
|
+
function normalizePath(value='') { return String(value || '').replace(/\\/g,'/').replace(/^\.\//,'').replace(/^\/+|\/+$/g,''); }
|
|
238
|
+
function dirname(value='') { const p=normalizePath(value); const i=p.lastIndexOf('/'); return i<0?'':p.slice(0,i); }
|
|
239
|
+
function basename(value='') { const p=normalizePath(value); return p.split('/').pop() || 'parent'; }
|
|
240
|
+
function relativePath(fromDir='', toPath='') {
|
|
241
|
+
const from=normalizePath(fromDir).split('/').filter(Boolean), to=normalizePath(toPath).split('/').filter(Boolean);
|
|
242
|
+
let i=0; while (i<from.length && i<to.length && from[i]===to[i]) i+=1;
|
|
243
|
+
return [...Array(from.length-i).fill('..'), ...to.slice(i)].join('/') || basename(toPath);
|
|
244
|
+
}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { C14N_V2_METHOD_ID, qualifyIntegrityMethodReferenceValue } from '../integrity/integrity.methodReference.js';
|
|
2
|
+
import { isMarkdownLink, isRelativePath } from './reference.shapes.js';
|
|
3
|
+
|
|
4
|
+
export function inspectCreationRepresentation(markdown = '', options = {}) {
|
|
5
|
+
const text = String(markdown || '').replace(/\r\n?/g, '\n');
|
|
6
|
+
const lines = text.split('\n');
|
|
7
|
+
const boundary = lines.findIndex((line) => line === '---');
|
|
8
|
+
const envelopeLines = boundary >= 0 ? lines.slice(0, boundary) : lines.slice();
|
|
9
|
+
const integrityHeadingIndexes = indexesOf(lines, (line) => line === '# Continuity Integrity');
|
|
10
|
+
const integrityStart = integrityHeadingIndexes.length ? integrityHeadingIndexes[0] : lines.length;
|
|
11
|
+
const footerSeparatorIndexes = integrityHeadingIndexes.filter((index) => canonicalDividerImmediatelyBefore(lines, index));
|
|
12
|
+
const bodyEnd = footerSeparatorIndexes.length === 1 ? footerSeparatorIndexes[0] - 2 : integrityStart;
|
|
13
|
+
const bodyLines = boundary >= 0 ? lines.slice(boundary + 1, bodyEnd) : [];
|
|
14
|
+
const currentBlocks = topLevelListBlocks(envelopeLines, 'Current');
|
|
15
|
+
const parentBlocks = topLevelListBlocks(envelopeLines, 'Parent');
|
|
16
|
+
const boundSections = [...new Set((options.boundSections || []).map((value) => String(value || '')).filter(Boolean))];
|
|
17
|
+
const bodyH1 = headingOccurrences(bodyLines, 1);
|
|
18
|
+
const bodyH2 = headingOccurrences(bodyLines, 2);
|
|
19
|
+
const sectionBodies = Object.fromEntries(boundSections.map((section) => [section, Object.freeze(exactSectionBodies(bodyLines, section))]));
|
|
20
|
+
const integrityEntriesDetailed = integrityEntries(lines, integrityHeadingIndexes);
|
|
21
|
+
const selfEntries = integrityEntriesDetailed.filter(isSelf);
|
|
22
|
+
return Object.freeze({
|
|
23
|
+
schema: 'tiinex.site.creation-representation-occurrences.v1',
|
|
24
|
+
continuityContextHeadings: countExact(envelopeLines, '# Continuity Context'),
|
|
25
|
+
envelopeSeparators: boundary >= 0 ? 1 : 0,
|
|
26
|
+
currentBlocks: currentBlocks.length,
|
|
27
|
+
parentBlocks: parentBlocks.length,
|
|
28
|
+
envelopeSchema: Object.freeze(topLevelFieldValues(envelopeLines, 'Envelope Schema')),
|
|
29
|
+
currentSchema: Object.freeze(currentFieldValues(currentBlocks, 'Current Schema')),
|
|
30
|
+
createdAt: Object.freeze(currentFieldValues(currentBlocks, 'Created At')),
|
|
31
|
+
summary: Object.freeze(currentFieldValues(currentBlocks, 'Summary')),
|
|
32
|
+
bodyH1: Object.freeze(bodyH1),
|
|
33
|
+
bodyH2: Object.freeze(bodyH2),
|
|
34
|
+
sectionBodies: Object.freeze(sectionBodies),
|
|
35
|
+
integrityHeadings: integrityHeadingIndexes.length,
|
|
36
|
+
footerSeparators: footerSeparatorIndexes.length,
|
|
37
|
+
integrityEntries: integrityEntriesDetailed.length,
|
|
38
|
+
integrityEntryDetails: Object.freeze(integrityEntriesDetailed),
|
|
39
|
+
selfIntegrityEntries: Object.freeze(selfEntries)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function qualifyRootCreationRepresentation(markdown = '', contract = {}) {
|
|
44
|
+
const creation = contract?.creation || {};
|
|
45
|
+
const summaryBound = (creation.inputBindings || []).some((item) => item?.kind === 'root-current-summary-body-title');
|
|
46
|
+
const sections = [...new Set([...(creation.representationSections || []), ...(creation.requiredSections || []), ...(creation.inputBindings || []).map((item) => item?.section).filter(Boolean)])];
|
|
47
|
+
const observed = inspectCreationRepresentation(markdown, { boundSections: sections });
|
|
48
|
+
const findings = [];
|
|
49
|
+
expectCount(findings, 'Continuity Context heading', observed.continuityContextHeadings, 1);
|
|
50
|
+
expectCount(findings, 'Envelope Schema field', observed.envelopeSchema.length, 1);
|
|
51
|
+
expectCount(findings, 'Current block', observed.currentBlocks, 1);
|
|
52
|
+
expectCount(findings, 'Parent block', observed.parentBlocks, 0);
|
|
53
|
+
expectCount(findings, 'Current Schema field', observed.currentSchema.length, 1);
|
|
54
|
+
expectCount(findings, 'Created At field', observed.createdAt.length, 1);
|
|
55
|
+
if (summaryBound) expectCount(findings, 'Current Summary field', observed.summary.length, 1);
|
|
56
|
+
expectCount(findings, 'body H1 title', observed.bodyH1.length, 1);
|
|
57
|
+
expectCount(findings, 'Continuity Integrity heading', observed.integrityHeadings, 1);
|
|
58
|
+
expectCount(findings, 'canonical divider immediately before Continuity Integrity', observed.footerSeparators, 1);
|
|
59
|
+
expectCount(findings, 'Continuity Integrity method entry', observed.integrityEntries, 1);
|
|
60
|
+
expectCount(findings, `${C14N_V2_METHOD_ID} Towards:self entry`, observed.selfIntegrityEntries.length, 1);
|
|
61
|
+
qualifyPrimarySelfMethodReference(findings, observed, contract);
|
|
62
|
+
for (const section of sections) expectCount(findings, `bound section ${section}`, observed.sectionBodies[section]?.length || 0, 1);
|
|
63
|
+
return Object.freeze({ state: findings.length ? 'ambiguous' : 'qualified', findings: Object.freeze(findings), observed });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
function qualifyPrimarySelfMethodReference(findings, observed, contract) {
|
|
68
|
+
if (observed.selfIntegrityEntries.length !== 1) return;
|
|
69
|
+
const authority = contract?.integrityMethodReferences?.primarySelf || null;
|
|
70
|
+
if (!authority) return;
|
|
71
|
+
const qualification = qualifyIntegrityMethodReferenceValue(observed.selfIntegrityEntries[0].methodRaw || observed.selfIntegrityEntries[0].method || '', authority);
|
|
72
|
+
for (const finding of qualification.findings || []) findings.push(finding);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function canonicalDividerImmediatelyBefore(lines, headingIndex) {
|
|
76
|
+
if (headingIndex < 2) return false;
|
|
77
|
+
return lines[headingIndex - 1] === '' && lines[headingIndex - 2] === '---';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function expectCount(findings, label, count, expected) {
|
|
81
|
+
if (count === expected) return;
|
|
82
|
+
findings.push(`${label} requires exactly ${expected} occurrence${expected === 1 ? '' : 's'}; observed ${count}.`);
|
|
83
|
+
}
|
|
84
|
+
function countExact(lines, exact) { return lines.reduce((count, line) => count + (line === exact ? 1 : 0), 0); }
|
|
85
|
+
function indexesOf(lines, predicate) { const out = []; for (let i = 0; i < lines.length; i += 1) if (predicate(lines[i], i)) out.push(i); return out; }
|
|
86
|
+
function topLevelListBlocks(lines, label) {
|
|
87
|
+
const starts = indexesOf(lines, (line) => line === `- ${label}`);
|
|
88
|
+
return starts.map((start) => {
|
|
89
|
+
let end = lines.length;
|
|
90
|
+
for (let i = start + 1; i < lines.length; i += 1) if (/^-\s+\S/.test(lines[i])) { end = i; break; }
|
|
91
|
+
return Object.freeze({ start, end, lines: Object.freeze(lines.slice(start + 1, end)) });
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function topLevelFieldValues(lines, label) {
|
|
96
|
+
const escaped = escapeRegExp(label); const out = [];
|
|
97
|
+
for (const line of lines) {
|
|
98
|
+
const match = line.match(new RegExp(`^-\\s*${escaped}:\\s*(.*)$`));
|
|
99
|
+
if (match) out.push(match[1]);
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function currentFieldValues(blocks, label) {
|
|
105
|
+
const escaped = escapeRegExp(label); const out = [];
|
|
106
|
+
for (const block of blocks) for (const line of block.lines) {
|
|
107
|
+
const match = line.match(new RegExp(`^\\s+-\\s*${escaped}:\\s*(.*)$`));
|
|
108
|
+
if (match) out.push(match[1]);
|
|
109
|
+
}
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
112
|
+
function headingOccurrences(lines, level) {
|
|
113
|
+
const prefix = '#'.repeat(level); const out = [];
|
|
114
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
115
|
+
const match = lines[i].match(new RegExp(`^${prefix}\\s+(.+)$`));
|
|
116
|
+
if (match) out.push(Object.freeze({ index: i, text: match[1] }));
|
|
117
|
+
}
|
|
118
|
+
return out;
|
|
119
|
+
}
|
|
120
|
+
function exactSectionBodies(lines, section) {
|
|
121
|
+
const heading = `## ${section}`; const starts = indexesOf(lines, (line) => line === heading); const out = [];
|
|
122
|
+
for (const startHeading of starts) {
|
|
123
|
+
let start = startHeading + 1; if (lines[start] === '') start += 1;
|
|
124
|
+
let end = lines.length;
|
|
125
|
+
for (let i = start; i < lines.length; i += 1) if (/^#{1,2}\s+/.test(lines[i])) { end = i; break; }
|
|
126
|
+
if (end > start && lines[end - 1] === '') end -= 1;
|
|
127
|
+
out.push(lines.slice(start, end).join('\n'));
|
|
128
|
+
}
|
|
129
|
+
return out;
|
|
130
|
+
}
|
|
131
|
+
function integrityEntryCount(lines, integrityHeadingIndexes) {
|
|
132
|
+
let count = 0;
|
|
133
|
+
for (const headingIndex of integrityHeadingIndexes) {
|
|
134
|
+
const end = nextTopLevelHeading(lines, headingIndex + 1);
|
|
135
|
+
for (let i = headingIndex + 1; i < end; i += 1) if (/^-\s+\S/.test(lines[i])) count += 1;
|
|
136
|
+
}
|
|
137
|
+
return count;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function integrityEntries(lines, integrityHeadingIndexes) {
|
|
141
|
+
const out = [];
|
|
142
|
+
for (const headingIndex of integrityHeadingIndexes) {
|
|
143
|
+
const end = nextTopLevelHeading(lines, headingIndex + 1);
|
|
144
|
+
let current = null;
|
|
145
|
+
const flush = () => {
|
|
146
|
+
if (!current) return;
|
|
147
|
+
out.push(Object.freeze(current));
|
|
148
|
+
current = null;
|
|
149
|
+
};
|
|
150
|
+
for (let i = headingIndex + 1; i < end; i += 1) {
|
|
151
|
+
const top = lines[i].match(/^-\s+(.+?)\s*$/);
|
|
152
|
+
if (top) {
|
|
153
|
+
flush();
|
|
154
|
+
current = { methodRaw: top[1], method: stripLink(top[1]), towardsRaw: '', towards: '', towardsLabel: '', valueCount: 0, value: '' };
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (!current) continue;
|
|
158
|
+
const towards = lines[i].match(/^\s+-\s+Towards:\s*(.*?)\s*$/);
|
|
159
|
+
if (towards) {
|
|
160
|
+
current.towardsRaw = towards[1];
|
|
161
|
+
current.towards = linkTargetOrText(towards[1]);
|
|
162
|
+
current.towardsLabel = stripLink(towards[1]);
|
|
163
|
+
}
|
|
164
|
+
const value = lines[i].match(/^\s+-\s+Value:\s*(.*?)\s*$/);
|
|
165
|
+
if (value) {
|
|
166
|
+
current.valueCount += 1;
|
|
167
|
+
if (current.valueCount === 1) current.value = value[1];
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
flush();
|
|
171
|
+
}
|
|
172
|
+
return out;
|
|
173
|
+
}
|
|
174
|
+
function isSelf(entry) { return entry.method === C14N_V2_METHOD_ID && entry.towards === 'self'; }
|
|
175
|
+
function nextTopLevelHeading(lines, start) { for (let i = start; i < lines.length; i += 1) if (/^#\s+/.test(lines[i])) return i; return lines.length; }
|
|
176
|
+
function stripLink(value = '') { const text = String(value || '').trim(); const link = text.match(/^\[([^\]]+)\]\([^)]+\)$/); return (link ? link[1] : text).trim(); }
|
|
177
|
+
function linkTargetOrText(value = '') { const text = String(value || '').trim(); const link = text.match(/^\[([^\]]+)\]\(([^)]+)\)$/); return (link ? link[2] : text).trim(); }
|
|
178
|
+
function escapeRegExp(value = '') { return String(value || '').replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); }
|
|
179
|
+
|
|
180
|
+
export function qualifyContinuationCreationRepresentation(markdown = '', contract = {}, parentRecord = {}, options = {}) {
|
|
181
|
+
const creation = contract?.creation || {};
|
|
182
|
+
const sections = [...new Set([...(creation.representationSections || []), ...(creation.requiredSections || []), ...(creation.inputBindings || []).map((item) => item?.section).filter(Boolean)])];
|
|
183
|
+
const observed = inspectCreationRepresentation(markdown, { boundSections: sections });
|
|
184
|
+
const findings = [];
|
|
185
|
+
expectCount(findings, 'Continuity Context heading', observed.continuityContextHeadings, 1);
|
|
186
|
+
expectCount(findings, 'Envelope Schema field', observed.envelopeSchema.length, 1);
|
|
187
|
+
expectCount(findings, 'Current block', observed.currentBlocks, 1);
|
|
188
|
+
expectCount(findings, 'Parent block', observed.parentBlocks, 1);
|
|
189
|
+
expectCount(findings, 'Current Schema field', observed.currentSchema.length, 1);
|
|
190
|
+
expectCount(findings, 'Created At field', observed.createdAt.length, 1);
|
|
191
|
+
expectCount(findings, 'body H1 title', observed.bodyH1.length, 1);
|
|
192
|
+
expectCount(findings, 'Continuity Integrity heading', observed.integrityHeadings, 1);
|
|
193
|
+
expectCount(findings, 'canonical divider immediately before Continuity Integrity', observed.footerSeparators, 1);
|
|
194
|
+
expectCount(findings, 'Continuity Integrity method entry', observed.integrityEntries, 2);
|
|
195
|
+
expectCount(findings, `${C14N_V2_METHOD_ID} Towards:self entry`, observed.selfIntegrityEntries.length, 1);
|
|
196
|
+
qualifyPrimarySelfMethodReference(findings, observed, contract);
|
|
197
|
+
qualifyParentTargetIntegrityEntry(findings, observed, contract, options.parentIntegrityTarget || '');
|
|
198
|
+
for (const section of sections) expectCount(findings, `bound section ${section}`, observed.sectionBodies[section]?.length || 0, 1);
|
|
199
|
+
|
|
200
|
+
const text = String(markdown || '').replace(/\r\n?/g, '\n');
|
|
201
|
+
const parentBlock = exactTopLevelBlock(text, 'Parent');
|
|
202
|
+
if (!parentBlock) findings.push('Parent block is required.');
|
|
203
|
+
else {
|
|
204
|
+
const traceLines = exactNestedFieldLines(parentBlock, 'Trace');
|
|
205
|
+
const originHeader = exactNestedFieldLines(parentBlock, 'Origin', { allowEmpty: true });
|
|
206
|
+
const boundaryLines = exactNestedFieldLines(parentBlock, 'Boundary');
|
|
207
|
+
expectCount(findings, 'Parent Trace field', traceLines.length, 1);
|
|
208
|
+
expectCount(findings, 'Parent Origin block', originHeader.length, 1);
|
|
209
|
+
expectCount(findings, 'undeclared Parent Boundary field', boundaryLines.length, 0);
|
|
210
|
+
const trace = traceLines[0]?.value || '';
|
|
211
|
+
if (trace && !isMarkdownLink(trace) && !isRelativePath(trace)) findings.push('Parent Trace must be one Markdown link or one relative path; synthetic record tokens are not Root Trace authority.');
|
|
212
|
+
if (trace.startsWith('record:')) findings.push('Parent Trace must not use a record: synthetic token.');
|
|
213
|
+
const origins = originHeader.length ? nestedOriginLinks(parentBlock, originHeader[0].index) : [];
|
|
214
|
+
const relative = origins.filter((entry) => entry.label === 'relative');
|
|
215
|
+
const browse = origins.filter((entry) => entry.label === 'browse + git');
|
|
216
|
+
const publishedReference = parentRecord?.publishedReference || parentRecord?.browseGitReference || parentRecord?.browseGit || null;
|
|
217
|
+
const publishedTarget = typeof publishedReference === 'string' ? '' : String(publishedReference?.target || publishedReference?.url || '');
|
|
218
|
+
const publishedState = typeof publishedReference === 'string' ? 'unresolved' : String(publishedReference?.state || publishedReference?.resolutionState || 'unresolved');
|
|
219
|
+
const publishedQualified = Boolean(publishedTarget && publishedState === 'qualified');
|
|
220
|
+
const recoveryMode = String(parentRecord?.recoveryMode || parentRecord?.parentRecoveryMode || '').trim() === 'external-versioned' ? 'external-versioned' : 'local-relative';
|
|
221
|
+
if (recoveryMode === 'external-versioned') {
|
|
222
|
+
if (!publishedQualified) findings.push('External Parent recovery requires one qualified version-stable published representation.');
|
|
223
|
+
if (origins.length !== 1 || relative.length !== 0 || browse.length !== 1) findings.push('External Parent Origin must contain exactly one [browse + git](...) entry and must not fabricate [relative](...).');
|
|
224
|
+
if (browse[0]?.target !== publishedTarget) findings.push('Parent browse + git Origin must preserve the exact qualified published Parent representation.');
|
|
225
|
+
if (linkTargetOrText(trace) !== publishedTarget) findings.push('External Parent Trace must target the exact qualified published Parent representation.');
|
|
226
|
+
} else {
|
|
227
|
+
if (relative.length !== 1 || origins.length < 1 || origins.length > 2 || browse.length > 1) findings.push('Directly recoverable local Parent Origin must contain exactly one [relative](...) entry and may contain at most one truthful [browse + git](...) supplement.');
|
|
228
|
+
if (relative[0]?.target !== String(options.relativeReference || '')) findings.push(`Parent relative Origin must be exactly ${options.relativeReference || '(unavailable)'}.`);
|
|
229
|
+
if (browse.length && (!publishedQualified || browse[0]?.target !== publishedTarget)) findings.push('Parent browse + git Origin must preserve qualified publication evidence and must not be invented.');
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return Object.freeze({ state: findings.length ? 'ambiguous' : 'qualified', findings: Object.freeze(findings), observed });
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
function qualifyParentTargetIntegrityEntry(findings, observed, contract, expectedTarget = '') {
|
|
237
|
+
const candidates = (observed.integrityEntryDetails || []).filter((entry) => entry.method === C14N_V2_METHOD_ID && entry.towards !== 'self');
|
|
238
|
+
expectCount(findings, `${C14N_V2_METHOD_ID} Parent-target entry`, candidates.length, 1);
|
|
239
|
+
if (candidates.length !== 1) return;
|
|
240
|
+
const entry = candidates[0];
|
|
241
|
+
const authority = contract?.integrityMethodReferences?.primarySelf || null;
|
|
242
|
+
if (authority) {
|
|
243
|
+
const qualification = qualifyIntegrityMethodReferenceValue(entry.methodRaw || entry.method || '', authority);
|
|
244
|
+
for (const finding of qualification.findings || []) findings.push(finding);
|
|
245
|
+
}
|
|
246
|
+
if (!entry.towards) findings.push('Parent-target integrity Towards value is required.');
|
|
247
|
+
else if (!expectedTarget) findings.push('Required Parent-target integrity target is unavailable.');
|
|
248
|
+
else if (entry.towards !== String(expectedTarget)) findings.push(`Parent-target integrity Towards must be exactly ${expectedTarget}.`);
|
|
249
|
+
expectCount(findings, 'Parent-target integrity Value field', entry.valueCount, 1);
|
|
250
|
+
if (entry.valueCount === 1 && !entry.value) findings.push('Parent-target integrity Value must not be empty.');
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function exactTopLevelBlock(text, label) {
|
|
254
|
+
const lines = String(text || '').split('\n');
|
|
255
|
+
const start = lines.findIndex((line) => line === `- ${label}`);
|
|
256
|
+
if (start < 0) return null;
|
|
257
|
+
let end = lines.length;
|
|
258
|
+
for (let i = start + 1; i < lines.length; i += 1) if (/^-\s+\S/.test(lines[i])) { end = i; break; }
|
|
259
|
+
return Object.freeze({ lines: Object.freeze(lines.slice(start + 1, end)) });
|
|
260
|
+
}
|
|
261
|
+
function exactNestedFieldLines(block, label, options = {}) {
|
|
262
|
+
const escaped = escapeRegExp(label); const out = [];
|
|
263
|
+
for (let i = 0; i < (block?.lines || []).length; i += 1) {
|
|
264
|
+
const match = block.lines[i].match(new RegExp(`^ - ${escaped}:\\s*(.*)$`));
|
|
265
|
+
if (!match) continue;
|
|
266
|
+
if (match[1] || options.allowEmpty) out.push(Object.freeze({ index: i, value: match[1] }));
|
|
267
|
+
}
|
|
268
|
+
return out;
|
|
269
|
+
}
|
|
270
|
+
function nestedOriginLinks(block, originIndex) {
|
|
271
|
+
const out = [];
|
|
272
|
+
for (let i = originIndex + 1; i < (block?.lines || []).length; i += 1) {
|
|
273
|
+
const line = block.lines[i];
|
|
274
|
+
if (/^ - \S/.test(line)) break;
|
|
275
|
+
const match = line.match(/^ - \[([^\]]+)\]\(([^)]+)\)$/);
|
|
276
|
+
if (match) out.push(Object.freeze({ label: match[1], target: match[2] }));
|
|
277
|
+
}
|
|
278
|
+
return out;
|
|
279
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function canonicalRootCreatedAt(value) {
|
|
2
|
+
if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(value)) return value;
|
|
3
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
4
|
+
if (!(date instanceof Date) || Number.isNaN(date.getTime())) throw new Error('creation-created-at-unrepresentable');
|
|
5
|
+
return date.toISOString().replace('T', ' ').replace(/\.\d{3}Z$/, '');
|
|
6
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { resolveSchemaModule as resolveRegisteredSchemaModule } from './resolver.js';
|
|
2
|
+
import { inspectCreationRepresentation } from './creation.representation.js';
|
|
3
|
+
import { qualifySchemaReferenceMaterialCoherence, qualifySchemaReferenceValue, schemaReferenceAuthorityFromBinding } from './schema.reference.js';
|
|
4
|
+
|
|
5
|
+
export function schemaReferenceAuthoritiesForCreation(targetModule = null, explicit = null) {
|
|
6
|
+
const root = resolveRegisteredSchemaModule({ schemaId: 'tiinex.root.v1' });
|
|
7
|
+
const rootModule = root?.fallbackUsed ? null : root?.module || null;
|
|
8
|
+
const rootQualification = qualifiedSourceQualification(rootModule);
|
|
9
|
+
const targetQualification = qualifiedSourceQualification(targetModule);
|
|
10
|
+
const defaults = {
|
|
11
|
+
envelope: schemaReferenceAuthorityFromBinding('tiinex.root.v1', rootModule?.binding || {}, rootQualification?.authority || null, rootQualification),
|
|
12
|
+
current: schemaReferenceAuthorityFromBinding(String(targetModule?.id || ''), targetModule?.binding || {}, targetQualification?.authority || null, targetQualification)
|
|
13
|
+
};
|
|
14
|
+
return Object.freeze({
|
|
15
|
+
envelope: explicitSchemaReferenceAuthority(explicit?.envelope, defaults.envelope),
|
|
16
|
+
current: explicitSchemaReferenceAuthority(explicit?.current, defaults.current)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function explicitSchemaReferenceAuthority(value = null, fallback = {}) {
|
|
21
|
+
if (!value) return fallback;
|
|
22
|
+
const schemaId = String(value.schemaId || fallback.schemaId || '').trim();
|
|
23
|
+
const exactTargets = [...new Set([
|
|
24
|
+
...(Array.isArray(value.exactTargets) ? value.exactTargets : []),
|
|
25
|
+
value.preferredTarget || value.target || ''
|
|
26
|
+
].map((item) => String(item || '')).filter(Boolean))];
|
|
27
|
+
const preferredTarget = String(value.preferredTarget || value.target || exactTargets[0] || '').trim();
|
|
28
|
+
const fallbackTargets = Object.freeze([...(fallback.exactTargets || [])]);
|
|
29
|
+
const materialBoundTarget = Boolean(preferredTarget && fallback?.materialBoundTarget === true && fallbackTargets.includes(preferredTarget));
|
|
30
|
+
return Object.freeze({
|
|
31
|
+
...fallback,
|
|
32
|
+
schemaId,
|
|
33
|
+
exactTargets: Object.freeze(exactTargets),
|
|
34
|
+
preferredTarget,
|
|
35
|
+
targetAuthority: exactTargets.length ? 'explicit-exact-reference' : String(fallback.targetAuthority || 'schema-id-only'),
|
|
36
|
+
resolutionState: String(value.resolutionState || value.state || (materialBoundTarget ? 'qualified' : 'unresolved')),
|
|
37
|
+
resolutionEvidence: Object.freeze({ ...(materialBoundTarget ? fallback.resolutionEvidence || {} : {}), ...(value.resolutionEvidence || value.evidence || {}) }),
|
|
38
|
+
semanticSourceTargets: fallbackTargets,
|
|
39
|
+
materialBoundTarget,
|
|
40
|
+
semanticMaterialIdentity: fallback.semanticMaterialIdentity || Object.freeze({ state: 'unavailable' })
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function qualifyCreationSchemaReferences(markdown = '', contract = {}) {
|
|
45
|
+
const observed = inspectCreationRepresentation(markdown);
|
|
46
|
+
const authorities = contract?.schemaReferences || {};
|
|
47
|
+
const envelopeValue = observed.envelopeSchema.length === 1 ? observed.envelopeSchema[0] : '';
|
|
48
|
+
const currentValue = observed.currentSchema.length === 1 ? observed.currentSchema[0] : '';
|
|
49
|
+
const envelope = qualifyResolvedSchemaReference(envelopeValue, authorities.envelope || { schemaId: 'tiinex.root.v1', exactTargets: [] });
|
|
50
|
+
const current = qualifyResolvedSchemaReference(currentValue, authorities.current || { schemaId: String(contract?.target?.schemaId || ''), exactTargets: [] });
|
|
51
|
+
const findings = Object.freeze([...(envelope.findings || []).map((item) => `Envelope Schema: ${item}`), ...(current.findings || []).map((item) => `Current Schema: ${item}`)]);
|
|
52
|
+
return Object.freeze({ state: findings.length ? 'unavailable' : 'qualified', envelope, current, findings });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function qualifyResolvedSchemaReference(value, authority) {
|
|
56
|
+
const lexical = qualifySchemaReferenceValue(value, authority);
|
|
57
|
+
const material = qualifySchemaReferenceMaterialCoherence(authority);
|
|
58
|
+
const findings = [...(lexical.findings || []), ...(material.findings || [])];
|
|
59
|
+
return Object.freeze({ ...lexical, state: findings.length ? 'unavailable' : 'qualified', resolutionState: authority?.resolutionState || '', materialCoherence: material, findings: Object.freeze(findings) });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function qualifiedSourceQualification(module = null) {
|
|
63
|
+
const qualified = typeof module?.schemaSource?.qualify === 'function' ? module.schemaSource.qualify() : null;
|
|
64
|
+
return qualified?.state === 'qualified' ? qualified : null;
|
|
65
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import binding from './tiinex.discovery.finding.v1.schema.json' with { type: 'json' };
|
|
2
|
+
import { schemaSource } from './tiinex.discovery.finding.v1.schema.source.js';
|
|
3
|
+
import { defineGenericArtifactSchemaModule } from '../../generic.artifact.module.js';
|
|
4
|
+
|
|
5
|
+
export const discoveryFindingSchemaModule = defineGenericArtifactSchemaModule({
|
|
6
|
+
id: 'tiinex.discovery.finding.v1',
|
|
7
|
+
label: 'Discovery Finding',
|
|
8
|
+
parentSchemaId: 'tiinex.discovery.v1',
|
|
9
|
+
kind: 'concrete',
|
|
10
|
+
role: 'workflow-discovery-finding-artifact',
|
|
11
|
+
summary: 'Maintained discovered finding/triage artifact.',
|
|
12
|
+
binding,
|
|
13
|
+
schemaSource
|
|
14
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaId": "tiinex.discovery.finding.v1",
|
|
3
|
+
"kind": "concrete",
|
|
4
|
+
"role": "workflow-discovery-finding-artifact",
|
|
5
|
+
"module": "./tiinex.discovery.finding.v1.schema.js",
|
|
6
|
+
"snapshot": "./tiinex.discovery.finding.v1.schema.md",
|
|
7
|
+
"canonicalUri": "tiinex://schemas/discovery/finding/tiinex.discovery.finding.v1",
|
|
8
|
+
"permalink": "https://github.com/Tiinex/docs/blob/e713557f8be630967571d11a73f9ecd05ae329ce/.topics/.schemas/discovery/finding/tiinex.discovery.finding.v1.schema.md",
|
|
9
|
+
"rawUrl": "https://raw.githubusercontent.com/Tiinex/docs/e713557f8be630967571d11a73f9ecd05ae329ce/.topics/.schemas/discovery/finding/tiinex.discovery.finding.v1.schema.md",
|
|
10
|
+
"sourcePath": ".topics/.schemas/discovery/finding/tiinex.discovery.finding.v1.schema.md",
|
|
11
|
+
"sourceRepository": "Tiinex/docs",
|
|
12
|
+
"sourceCommit": "e713557f8be630967571d11a73f9ecd05ae329ce",
|
|
13
|
+
"sourceBlobSha": "e4f4b5caaf590ed3dc138b5bf2f25e2ece85e6b8",
|
|
14
|
+
"checksum": {
|
|
15
|
+
"algorithm": "sha256",
|
|
16
|
+
"value": "dafb380d7ee1b0cfe91bc1db3c5c18a40fc3826d2120bb71f54491b885d2b696"
|
|
17
|
+
},
|
|
18
|
+
"capabilityContract": "tiinex.schema.module.v1",
|
|
19
|
+
"snapshotCompleteness": "exact-canonical-docs-snapshot",
|
|
20
|
+
"bindingVersion": "tiinex.web.schema-binding.v1",
|
|
21
|
+
"originId": "tiinex-docs-e713557f",
|
|
22
|
+
"originTrustRole": "canonical-core"
|
|
23
|
+
}
|