@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,173 @@
|
|
|
1
|
+
import { parseArtifactMarkdown } from '../../../artifacts/artifact.parse.js';
|
|
2
|
+
import { createArtifactDraftMarkdown, renderArtifactCreationCandidateMarkdown, validateArtifactCreationResult } from '../../../schemas/creation.contracts.js';
|
|
3
|
+
|
|
4
|
+
const ROOT_TIMESTAMP_SHAPE = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
|
|
5
|
+
|
|
6
|
+
export function normalizePortableParentRecord(parent = {}) {
|
|
7
|
+
return Object.freeze({
|
|
8
|
+
id: String(parent.id || ''),
|
|
9
|
+
path: String(parent.path || ''),
|
|
10
|
+
kind: String(parent.kind || ''),
|
|
11
|
+
schemaId: String(parent.schemaId || ''),
|
|
12
|
+
currentSchemaId: String(parent.currentSchemaId || ''),
|
|
13
|
+
currentCreatedAt: String(parent.currentCreatedAt || ''),
|
|
14
|
+
createdAt: String(parent.createdAt || ''),
|
|
15
|
+
continuationTrace: String(parent.continuationTrace || ''),
|
|
16
|
+
boundary: String(parent.boundary || parent.source?.boundary || ''),
|
|
17
|
+
sourceMode: String(parent.sourceMode || ''),
|
|
18
|
+
recoveryMode: String(parent.recoveryMode || parent.parentRecoveryMode || ''),
|
|
19
|
+
source: parent.source || null,
|
|
20
|
+
markdown: String(parent.markdown || ''),
|
|
21
|
+
integrity: parent.integrity || null,
|
|
22
|
+
publishedReference: normalizeReferenceEvidence(parent.publishedReference || parent.browseGitReference || parent.browseGit || null),
|
|
23
|
+
schemaReferenceAuthority: normalizeSchemaReferenceEvidence(parent.schemaReferenceAuthority || parent.parentSchemaReferenceAuthority || null)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function qualifyPortableExactParent(parent = {}, transitionType = 'create-artifact') {
|
|
28
|
+
const rootCreation = String(transitionType || 'create-artifact') === 'create-artifact';
|
|
29
|
+
const declared = parentHasAnyValue(parent);
|
|
30
|
+
if (rootCreation) return declared ? invalid('root-parent-declared') : qualified(Object.freeze({}));
|
|
31
|
+
if (!declared) return invalid('continuation-parent-required');
|
|
32
|
+
if (!parent.id) return invalid('continuation-parent-id-required');
|
|
33
|
+
const schemaAuthority = qualifyParentSchemaAuthority(parent);
|
|
34
|
+
if (schemaAuthority.state !== 'qualified') return invalid(schemaAuthority.reason, schemaAuthority.evidence);
|
|
35
|
+
if (!parent.path) return invalid('continuation-parent-origin-required');
|
|
36
|
+
const createdAtAuthority = qualifyParentCreatedAtAuthority(parent);
|
|
37
|
+
if (createdAtAuthority.state !== 'qualified') return invalid(createdAtAuthority.reason, createdAtAuthority.evidence);
|
|
38
|
+
if (parent.continuationTrace) return invalid('continuation-parent-legacy-trace-not-authority', { observedTrace: parent.continuationTrace });
|
|
39
|
+
const schemaReference = parent.schemaReferenceAuthority || {};
|
|
40
|
+
if (schemaReference.schemaId && schemaReference.schemaId !== schemaAuthority.schemaId) return invalid('continuation-parent-schema-reference-contradictory', { schemaId: schemaAuthority.schemaId, referenceSchemaId: schemaReference.schemaId });
|
|
41
|
+
const snapshot = Object.freeze({
|
|
42
|
+
...parent,
|
|
43
|
+
schemaId: schemaAuthority.schemaId,
|
|
44
|
+
createdAt: createdAtAuthority.createdAt,
|
|
45
|
+
continuationTrace: ''
|
|
46
|
+
});
|
|
47
|
+
const schemaReferenceQualified = Boolean(schemaReference.preferredTarget && schemaReference.resolutionState === 'qualified');
|
|
48
|
+
const published = parent.publishedReference || {};
|
|
49
|
+
if (schemaReferenceQualified) return qualified(snapshot);
|
|
50
|
+
if (!schemaReferenceQualified) return qualifiedLocal(snapshot, 'continuation-parent-schema-reference-unqualified', {
|
|
51
|
+
schemaReferenceAuthority: schemaReference,
|
|
52
|
+
publishedReference: published,
|
|
53
|
+
exactnessConflict: 'Local continuity can preserve the declared Parent Schema identity/reference, but exact continuation requires independently qualified Parent Schema authority.'
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function qualifyParentCreatedAtAuthority(parent = {}) {
|
|
58
|
+
const declared = [
|
|
59
|
+
...(parent.currentCreatedAt ? [{ field: 'currentCreatedAt', value: String(parent.currentCreatedAt) }] : []),
|
|
60
|
+
...(parent.createdAt ? [{ field: 'createdAt', value: String(parent.createdAt) }] : [])
|
|
61
|
+
];
|
|
62
|
+
const distinct = [...new Set(declared.map((item) => item.value))];
|
|
63
|
+
if (distinct.length > 1) return Object.freeze({ state: 'invalid', reason: 'continuation-parent-created-at-contradictory', createdAt: '', evidence: Object.freeze({ declared: Object.freeze(declared.map((item) => Object.freeze({ ...item }))) }) });
|
|
64
|
+
const createdAt = distinct[0] || '';
|
|
65
|
+
if (createdAt && !ROOT_TIMESTAMP_SHAPE.test(createdAt)) return Object.freeze({ state: 'invalid', reason: 'continuation-parent-created-at-invalid', createdAt: '', evidence: Object.freeze({ observedCreatedAt: createdAt, requiredShape: 'YYYY-MM-DD hh:mm:ss', declared: Object.freeze(declared.map((item) => Object.freeze({ ...item }))) }) });
|
|
66
|
+
return Object.freeze({ state: 'qualified', reason: '', createdAt, evidence: Object.freeze({ declared: Object.freeze(declared.map((item) => Object.freeze({ ...item }))) }) });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function renderQualifiedPortableExactDraft({ contract = {}, schemaId = '', transitionType = 'create-artifact', parentSnapshot = {}, rendererInput = {} } = {}) {
|
|
70
|
+
const markdown = createArtifactDraftMarkdown(contract, { ...rendererInput, parentRecord: parentSnapshot, currentSchemaId: schemaId });
|
|
71
|
+
if (!markdown) return Object.freeze({ state: 'unqualified', reason: 'exact-renderer-empty-or-unqualified', markdown: '', validation: null, parentRepresentation: null });
|
|
72
|
+
const validation = validateArtifactCreationResult({ schemaId, status: 'local', sourceMode: 'local-portable-draft', markdown }, parentSnapshot, { contract, childPath: rendererInput.childPath || '', expectedAuthors: rendererInput.authors });
|
|
73
|
+
const parentRepresentation = qualifyPortableRenderedParentRepresentation(markdown, parentSnapshot, transitionType, rendererInput.childPath || '');
|
|
74
|
+
if (!validation.ok) return Object.freeze({ state: 'unqualified', reason: 'exact-result-validation-failed', markdown: '', validation, parentRepresentation });
|
|
75
|
+
if (parentRepresentation.state !== 'qualified') return Object.freeze({ state: 'unqualified', reason: parentRepresentation.reason, markdown: '', validation, parentRepresentation });
|
|
76
|
+
return Object.freeze({ state: 'qualified', reason: '', markdown, validation, parentRepresentation });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function renderPortableLocalContinuityDraft({ contract = {}, schemaId = '', transitionType = 'continue-from-record', parentSnapshot = {}, rendererInput = {} } = {}) {
|
|
80
|
+
const markdown = renderArtifactCreationCandidateMarkdown(contract, { ...rendererInput, parentRecord: parentSnapshot, currentSchemaId: schemaId });
|
|
81
|
+
if (!markdown) return Object.freeze({ state: 'unqualified', reason: 'local-continuity-renderer-empty', markdown: '', validation: null, parentRepresentation: null });
|
|
82
|
+
const parentRepresentation = qualifyPortableRenderedParentRepresentation(markdown, parentSnapshot, transitionType, rendererInput.childPath || '', { allowUnpublishedLocalParent: true });
|
|
83
|
+
if (parentRepresentation.state !== 'qualified') return Object.freeze({ state: 'unqualified', reason: parentRepresentation.reason || 'local-continuity-parent-representation-mismatch', markdown: '', validation: null, parentRepresentation });
|
|
84
|
+
const validation = validateArtifactCreationResult({ schemaId, status: 'local', sourceMode: 'local-portable-draft', markdown }, parentSnapshot, { contract, childPath: rendererInput.childPath || '', expectedAuthors: rendererInput.authors });
|
|
85
|
+
return Object.freeze({
|
|
86
|
+
state: 'qualified-local-continuity',
|
|
87
|
+
reason: 'continuation-parent-browse-git-root-contract-conflict',
|
|
88
|
+
markdown,
|
|
89
|
+
validation,
|
|
90
|
+
parentRepresentation
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function qualifyParentSchemaAuthority(parent = {}) {
|
|
95
|
+
const schemaId = String(parent.schemaId || '');
|
|
96
|
+
const currentSchemaId = String(parent.currentSchemaId || '');
|
|
97
|
+
const declared = [...(schemaId ? [{ field: 'schemaId', value: schemaId }] : []), ...(currentSchemaId ? [{ field: 'currentSchemaId', value: currentSchemaId }] : [])];
|
|
98
|
+
if (!declared.length) return Object.freeze({ state: 'invalid', reason: 'continuation-parent-schema-required', schemaId: '', evidence: Object.freeze({}) });
|
|
99
|
+
const distinct = [...new Set(declared.map((item) => item.value))];
|
|
100
|
+
if (distinct.length !== 1) return Object.freeze({ state: 'invalid', reason: 'continuation-parent-schema-contradictory', schemaId: '', evidence: Object.freeze({ schemaId, currentSchemaId, declared: Object.freeze(declared.map((item) => Object.freeze({ ...item }))) }) });
|
|
101
|
+
return Object.freeze({ state: 'qualified', reason: '', schemaId: distinct[0], evidence: Object.freeze({ declared: Object.freeze(declared.map((item) => Object.freeze({ ...item }))) }) });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function qualifyPortableRenderedParentRepresentation(markdown = '', parent = {}, transitionType = 'create-artifact', childPath = '', options = {}) {
|
|
105
|
+
const rootCreation = String(transitionType || 'create-artifact') === 'create-artifact';
|
|
106
|
+
let parsed;
|
|
107
|
+
try { parsed = parseArtifactMarkdown(markdown); } catch (_) { return Object.freeze({ state: 'invalid', reason: 'exact-result-parent-parse-failed' }); }
|
|
108
|
+
const observed = parsed.envelope?.parent || {};
|
|
109
|
+
const hasObserved = Boolean(observed.schema?.id || observed.trace || observed.origin || observed.createdAt || observed.boundary || observed.originEntries?.length);
|
|
110
|
+
if (rootCreation) return Object.freeze({ state: hasObserved ? 'invalid' : 'qualified', reason: hasObserved ? 'exact-result-parent-unexpected' : '' });
|
|
111
|
+
const relative = relativePath(dirname(childPath), parent.path);
|
|
112
|
+
const published = parent.publishedReference || {};
|
|
113
|
+
const publishedTarget = String(published.target || '');
|
|
114
|
+
const publishedQualified = Boolean(publishedTarget && published.state === 'qualified');
|
|
115
|
+
const recoveryMode = String(parent.recoveryMode || '').trim() === 'external-versioned' ? 'external-versioned' : 'local-relative';
|
|
116
|
+
const schemaTarget = String(parent.schemaReferenceAuthority?.preferredTarget || '');
|
|
117
|
+
const origins = observed.originEntries || [];
|
|
118
|
+
const createdAtLines = renderedParentFieldLines(markdown, 'Created At');
|
|
119
|
+
const expectedCreatedAt = String(parent.createdAt || '');
|
|
120
|
+
const createdAtExact = expectedCreatedAt ? createdAtLines.length === 1 && createdAtLines[0] === ` - Created At: ${expectedCreatedAt}` : createdAtLines.length === 0;
|
|
121
|
+
const relativeOrigins = origins.filter((entry) => entry.label === 'relative');
|
|
122
|
+
const browseOrigins = origins.filter((entry) => entry.label === 'browse + git');
|
|
123
|
+
const expectedTrace = recoveryMode === 'external-versioned' ? publishedTarget : relative;
|
|
124
|
+
const baseExact = String(observed.schema?.id || '') === String(parent.schemaId || '')
|
|
125
|
+
&& String(observed.schema?.target || '') === schemaTarget
|
|
126
|
+
&& String(observed.trace || '') === expectedTrace
|
|
127
|
+
&& /^\[[^\]]+\]\([^)]+\)$/.test(String(observed.traceRaw || ''))
|
|
128
|
+
&& !String(observed.boundary || '')
|
|
129
|
+
&& createdAtExact
|
|
130
|
+
&& String(observed.createdAt || '') === expectedCreatedAt;
|
|
131
|
+
const exactOrigins = recoveryMode === 'external-versioned'
|
|
132
|
+
? publishedQualified && relativeOrigins.length === 0 && browseOrigins.length === 1 && browseOrigins[0].target === publishedTarget && origins.length === 1
|
|
133
|
+
: relativeOrigins.length === 1 && relativeOrigins[0].target === relative && (publishedQualified
|
|
134
|
+
? browseOrigins.length === 1 && browseOrigins[0].target === publishedTarget && origins.length === 2
|
|
135
|
+
: browseOrigins.length === 0 && origins.length === 1);
|
|
136
|
+
const exact = baseExact && exactOrigins;
|
|
137
|
+
return Object.freeze({
|
|
138
|
+
state: exact ? 'qualified' : 'invalid',
|
|
139
|
+
reason: exact ? '' : 'exact-result-parent-representation-mismatch',
|
|
140
|
+
expected: Object.freeze({ schemaId: String(parent.schemaId || ''), schemaTarget, recoveryMode, trace: expectedTrace, relativeOrigin: recoveryMode === 'external-versioned' ? '' : relative, browseGitOrigin: publishedQualified ? publishedTarget : '', createdAt: expectedCreatedAt }),
|
|
141
|
+
observed: Object.freeze({ schemaId: String(observed.schema?.id || ''), schemaTarget: String(observed.schema?.target || ''), trace: String(observed.trace || ''), traceRaw: String(observed.traceRaw || ''), origins: Object.freeze(origins), boundary: String(observed.boundary || ''), createdAt: String(observed.createdAt || ''), createdAtLines: Object.freeze(createdAtLines) })
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function renderedParentFieldLines(markdown = '', label = '') {
|
|
146
|
+
const lines = String(markdown || '').split('\n');
|
|
147
|
+
const start = lines.findIndex((line) => line === '- Parent');
|
|
148
|
+
if (start < 0) return [];
|
|
149
|
+
let end = lines.length;
|
|
150
|
+
for (let i = start + 1; i < lines.length; i += 1) if (/^-\s+\S/.test(lines[i])) { end = i; break; }
|
|
151
|
+
const escaped = label.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
152
|
+
const re = new RegExp(`^ - ${escaped}:`);
|
|
153
|
+
return lines.slice(start + 1, end).filter((line) => re.test(line));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function normalizeReferenceEvidence(value) {
|
|
157
|
+
if (!value) return Object.freeze({ target: '', state: 'unavailable', evidence: Object.freeze({}) });
|
|
158
|
+
if (typeof value === 'string') return Object.freeze({ target: value, state: 'unresolved', evidence: Object.freeze({}) });
|
|
159
|
+
return Object.freeze({ target: String(value.target || value.url || ''), state: String(value.state || value.resolutionState || 'unresolved'), evidence: Object.freeze({ ...(value.evidence || value.resolutionEvidence || {}) }) });
|
|
160
|
+
}
|
|
161
|
+
function normalizeSchemaReferenceEvidence(value) {
|
|
162
|
+
if (!value) return Object.freeze({ schemaId: '', preferredTarget: '', exactTargets: Object.freeze([]), resolutionState: 'unavailable', evidence: Object.freeze({}) });
|
|
163
|
+
if (typeof value === 'string') return Object.freeze({ schemaId: '', preferredTarget: value, exactTargets: Object.freeze([value]), resolutionState: 'unresolved', evidence: Object.freeze({}) });
|
|
164
|
+
const preferredTarget = String(value.preferredTarget || value.target || '');
|
|
165
|
+
return Object.freeze({ schemaId: String(value.schemaId || ''), preferredTarget, exactTargets: Object.freeze([...new Set([...(value.exactTargets || []), preferredTarget].map(String).filter(Boolean))]), resolutionState: String(value.resolutionState || value.state || 'unresolved'), evidence: Object.freeze({ ...(value.evidence || value.resolutionEvidence || {}) }) });
|
|
166
|
+
}
|
|
167
|
+
function parentHasAnyValue(parent = {}) { return Boolean(parent.id || parent.path || parent.kind || parent.schemaId || parent.currentSchemaId || parent.continuationTrace || parent.currentCreatedAt || parent.createdAt || parent.boundary || parent.sourceMode || parent.source || parent.publishedReference?.target || parent.schemaReferenceAuthority?.preferredTarget); }
|
|
168
|
+
function qualified(snapshot) { return Object.freeze({ state: 'qualified', reason: '', snapshot }); }
|
|
169
|
+
function qualifiedLocal(snapshot, reason = 'continuation-parent-browse-git-root-contract-conflict', evidence = {}) { return Object.freeze({ state: 'qualified-local-continuity', reason, snapshot, evidence: Object.freeze({ ...evidence }) }); }
|
|
170
|
+
function invalid(reason, evidence = {}) { return Object.freeze({ state: 'invalid', reason, snapshot: null, evidence: Object.freeze({ ...evidence }) }); }
|
|
171
|
+
function normalizePath(value='') { return String(value || '').replace(/\\/g,'/').replace(/^\.\//,'').replace(/^\/+|\/+$/g,''); }
|
|
172
|
+
function dirname(value='') { const p=normalizePath(value); const i=p.lastIndexOf('/'); return i<0?'':p.slice(0,i); }
|
|
173
|
+
function relativePath(fromDir='', toPath='') { const from=normalizePath(fromDir).split('/').filter(Boolean), to=normalizePath(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,265 @@
|
|
|
1
|
+
import { parseArtifactMarkdown } from '../../../artifacts/artifact.parse.js';
|
|
2
|
+
import { runAudit } from '../../../audit/audit.run.js';
|
|
3
|
+
import { createRecordFromMarkdown } from '../../../artifacts/artifact.record.js';
|
|
4
|
+
import { portableFinding, normalizePortableFinding, summarizePortableFindings } from '../findings.js';
|
|
5
|
+
import { selectPortableLoadedSchemaMaterial } from '../providers/schema.providers.js';
|
|
6
|
+
import { buildPortableSchemaGuide } from '../schema/schema.guide.js';
|
|
7
|
+
import { compilePortableSchemaContract } from '../schema/contract.compile.js';
|
|
8
|
+
import { validatePortableContractInstance } from '../schema/contract.validate.js';
|
|
9
|
+
import { portableRuntimeValidationContractForSchema } from '../schema/qualifiedLocalRoot.runtime.js';
|
|
10
|
+
|
|
11
|
+
export function validatePortableDraft(input = {}, options = {}) {
|
|
12
|
+
const markdown = String(input.markdown || input.draft?.markdown || '');
|
|
13
|
+
const path = String(input.path || input.draft?.path || 'draft.md');
|
|
14
|
+
const requestedSchema = String(input.schemaId || options.schemaId || '').trim();
|
|
15
|
+
const findings = [];
|
|
16
|
+
if (!markdown) findings.push(portableFinding('error', 'portable.draft.markdown.required', 'Draft validation requires Markdown content.', { ref: path }));
|
|
17
|
+
const record = createRecordFromMarkdown(markdown, { path, name: path, sourceMode: 'portable-local-draft', lifecycleStatus: 'draft' });
|
|
18
|
+
const parsed = safeParse(markdown);
|
|
19
|
+
const declaredSchema = String(parsed.envelope?.current?.schema?.id || record.schemaId || '').trim();
|
|
20
|
+
const runtimeProjection = portableRuntimeValidationContractForSchema(requestedSchema || declaredSchema);
|
|
21
|
+
const audit = runAudit({ record, markdown, schemaReferenceAuthorities: input.schemaReferenceAuthorities || null, validationContractOverride: runtimeProjection.state === 'qualified' ? runtimeProjection.compiledContract : null });
|
|
22
|
+
if (requestedSchema && declaredSchema !== requestedSchema) findings.push(portableFinding('error', 'portable.draft.schema.mismatch', 'Draft Current Schema does not match the requested schema.', { requestedSchema, declaredSchema, ref: path }));
|
|
23
|
+
const sharedParserQuirks = detectSharedParserQuirks(markdown, parsed, audit, path);
|
|
24
|
+
const suppressedAuditCodes = new Set(sharedParserQuirks.flatMap((quirk) => quirk.suppressedCodes || []));
|
|
25
|
+
findings.push(...(audit.findings || [])
|
|
26
|
+
.filter((finding) => !suppressedAuditCodes.has(finding.code))
|
|
27
|
+
.map((finding) => normalizePortableFinding(finding, { ref: path })));
|
|
28
|
+
for (const quirk of sharedParserQuirks) findings.push(portableFinding('info', quirk.code, quirk.message, { ref: path, suppressedCodes: quirk.suppressedCodes, owner: quirk.owner }));
|
|
29
|
+
const schemaSelection = selectPortableLoadedSchemaMaterial(input.materials || input, { schemaId: requestedSchema || declaredSchema });
|
|
30
|
+
findings.push(...schemaSelection.findings);
|
|
31
|
+
const schemaMaterial = schemaSelection.material || null;
|
|
32
|
+
let structural = null;
|
|
33
|
+
if (audit.contractValidation?.available) {
|
|
34
|
+
structural = sharedContractValidationReceipt(audit.contractValidation, path);
|
|
35
|
+
} else if (schemaMaterial?.markdown) {
|
|
36
|
+
structural = validateContractStructure(markdown, schemaMaterial.markdown, requestedSchema || declaredSchema, path);
|
|
37
|
+
findings.push(...structural.findings);
|
|
38
|
+
if (structural.conditionalRequirements.length) findings.push(portableFinding('info', 'portable.draft.conditional-review.required', 'The readable schema contains conditional requirements that require trigger-aware review; they were not treated as unconditional failures.', {
|
|
39
|
+
schemaId: requestedSchema || declaredSchema,
|
|
40
|
+
groups: structural.conditionalRequirements.map((entry) => entry.name),
|
|
41
|
+
ref: path
|
|
42
|
+
}));
|
|
43
|
+
} else {
|
|
44
|
+
findings.push(portableFinding('info', 'portable.draft.contract-structure.unavailable', 'Readable child schema material was not supplied, so contract-driven structural validation was not run.', { schemaId: requestedSchema || declaredSchema, ref: path }));
|
|
45
|
+
}
|
|
46
|
+
const exactCreationValidation = input.exactCreationValidation || null;
|
|
47
|
+
const exactRuntimeValidation = Boolean(
|
|
48
|
+
exactCreationValidation?.ok === true
|
|
49
|
+
&& runtimeProjection.state === 'qualified'
|
|
50
|
+
&& !audit.resolution?.fallbackUsed
|
|
51
|
+
&& typeof audit.resolution?.module?.validate === 'function'
|
|
52
|
+
&& audit.status === 'readable'
|
|
53
|
+
&& !findings.some((finding) => finding.code === 'audit.validator.unavailable')
|
|
54
|
+
);
|
|
55
|
+
const summary = summarizePortableFindings(findings);
|
|
56
|
+
return Object.freeze({
|
|
57
|
+
schema: 'tiinex.portable.draft-validation.v1',
|
|
58
|
+
path,
|
|
59
|
+
requestedSchema,
|
|
60
|
+
declaredSchema,
|
|
61
|
+
status: summary.counts.error ? 'invalid' : summary.counts.warning ? 'degraded' : 'clean',
|
|
62
|
+
audit: sanitizeAudit(audit),
|
|
63
|
+
sharedParserQuirks: Object.freeze(sharedParserQuirks),
|
|
64
|
+
structural,
|
|
65
|
+
qualification: Object.freeze({
|
|
66
|
+
exactRuntimeValidation,
|
|
67
|
+
contractDrivenStructuralValidation: Boolean(structural),
|
|
68
|
+
readableSchemaAvailable: Boolean(schemaMaterial),
|
|
69
|
+
fallbackUsed: Boolean(audit.resolution?.fallbackUsed),
|
|
70
|
+
limitations: Object.freeze([
|
|
71
|
+
...(audit.resolution?.fallbackUsed ? ['Runtime audit used Root fallback and does not prove child-schema validity.'] : []),
|
|
72
|
+
...(sharedParserQuirks.length ? ['The shared parser currently leaks Current.CreatedAt into Parent when no Parent block exists; raw audit findings are preserved, but parser-induced parent repair findings are excluded from portable repair guidance.'] : []),
|
|
73
|
+
...(audit.contractValidation?.available ? ['Semantic contract validity was evaluated from the qualified current Root/descendant compiled machine-contract projection.'] : structural ? ['Only supplied readable-schema structural checks were available; complete current Root/descendant compiled contract authority was unavailable.'] : ['Readable schema contract was unavailable.']),
|
|
74
|
+
...(!exactCreationValidation ? ['Exact canonical creation/reference/integrity validation evidence was not supplied; exactRuntimeValidation remains false.'] : [])
|
|
75
|
+
])
|
|
76
|
+
}),
|
|
77
|
+
findings: Object.freeze(findings),
|
|
78
|
+
findingSummary: summary
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function explainPortableFindings(input = {}) {
|
|
83
|
+
const findings = extractFindings(input).map((finding) => normalizePortableFinding(finding));
|
|
84
|
+
const explanations = findings.map((finding) => Object.freeze({
|
|
85
|
+
severity: finding.severity,
|
|
86
|
+
code: finding.code,
|
|
87
|
+
message: finding.message,
|
|
88
|
+
blocking: finding.severity === 'error',
|
|
89
|
+
category: findingCategory(finding),
|
|
90
|
+
likelyOwner: findingOwner(finding),
|
|
91
|
+
recommendedAction: recommendedAction(finding),
|
|
92
|
+
preserveBoundary: boundaryWarning(finding)
|
|
93
|
+
}));
|
|
94
|
+
return Object.freeze({
|
|
95
|
+
schema: 'tiinex.portable.finding-explanation.v1',
|
|
96
|
+
explanations: Object.freeze(explanations),
|
|
97
|
+
findingSummary: summarizePortableFindings(findings)
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function buildPortableRepairPlan(input = {}) {
|
|
102
|
+
const explanation = explainPortableFindings(input);
|
|
103
|
+
const steps = [];
|
|
104
|
+
const seen = new Set();
|
|
105
|
+
for (const item of explanation.explanations) {
|
|
106
|
+
const key = `${item.category}:${item.recommendedAction}`;
|
|
107
|
+
if (seen.has(key)) continue;
|
|
108
|
+
seen.add(key);
|
|
109
|
+
steps.push(Object.freeze({
|
|
110
|
+
order: steps.length + 1,
|
|
111
|
+
priority: item.blocking ? 'blocking' : item.severity === 'warning' ? 'important' : 'optional',
|
|
112
|
+
category: item.category,
|
|
113
|
+
action: item.recommendedAction,
|
|
114
|
+
codes: Object.freeze(explanation.explanations.filter((entry) => entry.category === item.category && entry.recommendedAction === item.recommendedAction).map((entry) => entry.code)),
|
|
115
|
+
constraint: item.preserveBoundary
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
steps.sort((a, b) => priorityRank(a.priority) - priorityRank(b.priority) || a.order - b.order);
|
|
119
|
+
return Object.freeze({
|
|
120
|
+
schema: 'tiinex.portable.repair-plan.v1',
|
|
121
|
+
status: explanation.findingSummary.status,
|
|
122
|
+
steps: Object.freeze(steps.map((step, index) => Object.freeze({ ...step, order: index + 1 }))),
|
|
123
|
+
boundary: Object.freeze({
|
|
124
|
+
automaticRewrite: false,
|
|
125
|
+
preserveUnknownSections: true,
|
|
126
|
+
preserveSourceAndContinuity: true,
|
|
127
|
+
claimExactQualificationAfterRepair: false
|
|
128
|
+
}),
|
|
129
|
+
findingSummary: explanation.findingSummary
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
function detectSharedParserQuirks(markdown, parsed, audit, path) {
|
|
135
|
+
const quirks = [];
|
|
136
|
+
const parentBlockDeclared = /^-\s+Parent\s*$/m.test(String(markdown || ''));
|
|
137
|
+
const parent = parsed.envelope?.parent || {};
|
|
138
|
+
const current = parsed.envelope?.current || {};
|
|
139
|
+
const leakedCurrentCreatedAt = !parentBlockDeclared
|
|
140
|
+
&& !parent.schema?.id
|
|
141
|
+
&& !parent.trace
|
|
142
|
+
&& !parent.origin
|
|
143
|
+
&& Boolean(parent.createdAt)
|
|
144
|
+
&& parent.createdAt === current.createdAt;
|
|
145
|
+
const parentWarningCodes = ['root.parent.schema.missing', 'root.parent.trace.missing', 'root.parent.origin.missing'];
|
|
146
|
+
const auditCodes = new Set((audit.findings || []).map((finding) => finding.code));
|
|
147
|
+
if (leakedCurrentCreatedAt && parentWarningCodes.some((code) => auditCodes.has(code))) {
|
|
148
|
+
quirks.push(Object.freeze({
|
|
149
|
+
code: 'portable.draft.shared-parser.parent-block-fallback',
|
|
150
|
+
message: 'The shared artifact parser treated Current.CreatedAt as Parent.CreatedAt because no Parent block was present. Portable repair guidance excludes the resulting parent warnings so an LLM is not encouraged to invent lineage.',
|
|
151
|
+
owner: 'src/artifacts/artifact.parse.js:blockAfterTopLevelList',
|
|
152
|
+
ref: path,
|
|
153
|
+
suppressedCodes: Object.freeze(parentWarningCodes.filter((code) => auditCodes.has(code)))
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
return Object.freeze(quirks);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function validateContractStructure(draftMarkdown, schemaMarkdown, schemaId, path) {
|
|
160
|
+
const compiled = compilePortableSchemaContract(schemaMarkdown);
|
|
161
|
+
const validation = validatePortableContractInstance({ markdown: draftMarkdown, compiledContract: compiled });
|
|
162
|
+
const missingSections = validation.findings.filter((finding) => finding.code === 'portable.contract.section.required.missing').map((finding) => finding.section);
|
|
163
|
+
const missingFields = validation.findings.filter((finding) => finding.code === 'portable.contract.field.required.missing' || finding.code === 'portable.contract.declaration.field.required.missing').map((finding) => finding.field);
|
|
164
|
+
return Object.freeze({
|
|
165
|
+
schema: 'tiinex.portable.contract-structure-validation.v2',
|
|
166
|
+
schemaId,
|
|
167
|
+
status: validation.status,
|
|
168
|
+
requiredSections: compiled.validation.requiredSections,
|
|
169
|
+
requiredFields: compiled.validation.requiredFields,
|
|
170
|
+
missingSections: Object.freeze(missingSections),
|
|
171
|
+
missingFields: Object.freeze(missingFields),
|
|
172
|
+
conditionalRequirements: compiled.validation.conditionalRequirements,
|
|
173
|
+
compiledContractSchema: compiled.schema,
|
|
174
|
+
findings: Object.freeze(validation.findings.map((finding) => normalizePortableFinding(finding, { ref: path })))
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function sanitizeAudit(audit = {}) {
|
|
179
|
+
return Object.freeze({
|
|
180
|
+
status: audit.status || '',
|
|
181
|
+
resolution: Object.freeze({
|
|
182
|
+
status: audit.resolution?.status || '',
|
|
183
|
+
moduleId: audit.resolution?.module?.id || audit.artifact?.moduleId || '',
|
|
184
|
+
fallbackUsed: Boolean(audit.resolution?.fallbackUsed || audit.artifact?.fallbackUsed),
|
|
185
|
+
unresolvedSchemaId: audit.resolution?.unresolvedSchemaId || ''
|
|
186
|
+
}),
|
|
187
|
+
summary: audit.summary || null,
|
|
188
|
+
validation: audit.validation || null,
|
|
189
|
+
findings: Object.freeze((audit.findings || []).map((finding) => normalizePortableFinding(finding)))
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function sharedContractValidationReceipt(contractValidation = {}, path = '') {
|
|
194
|
+
const result = contractValidation.result || {};
|
|
195
|
+
return Object.freeze({
|
|
196
|
+
schema: 'tiinex.portable.contract-structure-validation.v3',
|
|
197
|
+
schemaId: contractValidation.schemaId || '',
|
|
198
|
+
status: result.status || contractValidation.state || 'unresolved',
|
|
199
|
+
authority: 'qualified-current-root-descendant-compiled-contract',
|
|
200
|
+
lineage: Object.freeze([...(contractValidation.lineage || [])]),
|
|
201
|
+
missingSections: Object.freeze((result.findings || []).filter((finding) => finding.code === 'portable.contract.section.required.missing').map((finding) => finding.section || '')),
|
|
202
|
+
missingFields: Object.freeze((result.findings || []).filter((finding) => String(finding.code || '').includes('field.required.missing')).map((finding) => finding.field || '')),
|
|
203
|
+
conditionalRequirements: Object.freeze([...(contractValidation.conditionalRequirements || [])].map((entry) => Object.freeze({ ...entry, name: entry.name || entry.group || '' }))),
|
|
204
|
+
findings: Object.freeze((result.findings || []).map((finding) => normalizePortableFinding(finding, { ref: path })))
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function extractFindings(input = {}) {
|
|
209
|
+
if (Array.isArray(input)) return input;
|
|
210
|
+
if (Array.isArray(input.findings)) return input.findings;
|
|
211
|
+
if (Array.isArray(input.audit?.findings)) return input.audit.findings;
|
|
212
|
+
if (Array.isArray(input.validation?.findings)) return input.validation.findings;
|
|
213
|
+
return [];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function findingCategory(finding = {}) {
|
|
217
|
+
const code = String(finding.code || '').toLowerCase();
|
|
218
|
+
if (code.includes('schema')) return 'schema';
|
|
219
|
+
if (code.includes('parent') || code.includes('trace') || code.includes('lineage')) return 'continuity';
|
|
220
|
+
if (code.includes('origin') || code.includes('source') || code.includes('boundary')) return 'provenance';
|
|
221
|
+
if (code.includes('integrity') || code.includes('checksum')) return 'integrity';
|
|
222
|
+
if (code.includes('section') || code.includes('field') || code.includes('shape')) return 'structure';
|
|
223
|
+
return 'content-or-policy';
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function findingOwner(finding = {}) {
|
|
227
|
+
const category = findingCategory(finding);
|
|
228
|
+
if (category === 'schema') return 'schema selection or schema companion';
|
|
229
|
+
if (category === 'continuity') return 'artifact continuity envelope';
|
|
230
|
+
if (category === 'provenance') return 'artifact origin/source boundary';
|
|
231
|
+
if (category === 'integrity') return 'integrity generation/verification tooling';
|
|
232
|
+
if (category === 'structure') return 'artifact body writer';
|
|
233
|
+
return 'human or LLM writer with schema guidance';
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function recommendedAction(finding = {}) {
|
|
237
|
+
const category = findingCategory(finding);
|
|
238
|
+
if (category === 'schema') return 'Confirm the intended schema and obtain its readable canonical contract before rewriting the body.';
|
|
239
|
+
if (category === 'continuity') return 'Repair only the declared Parent/Trace/continuity fields using known loaded material; do not invent a parent.';
|
|
240
|
+
if (category === 'provenance') return 'State the known origin/source boundary explicitly and preserve unknown or local status.';
|
|
241
|
+
if (category === 'integrity') return 'Regenerate integrity only with the maintained integrity tool after content is final.';
|
|
242
|
+
if (category === 'structure') return 'Add or correct the named required section/field without removing unknown supplied content.';
|
|
243
|
+
return 'Review the relevant schema rule and make the smallest local change that resolves the finding.';
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function boundaryWarning(finding = {}) {
|
|
247
|
+
const category = findingCategory(finding);
|
|
248
|
+
if (category === 'continuity') return 'Never guess a parent or convert Origin into Parent.';
|
|
249
|
+
if (category === 'provenance') return 'Never infer GitHub/source-backed status for local material.';
|
|
250
|
+
if (category === 'integrity') return 'Do not hand-edit integrity values.';
|
|
251
|
+
return 'Preserve unknown sections and unrelated content.';
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function priorityRank(value = '') {
|
|
255
|
+
return value === 'blocking' ? 0 : value === 'important' ? 1 : 2;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function normalizeKey(value = '') {
|
|
259
|
+
return String(value || '').toLowerCase().replace(/[`*_#]/g, '').replace(/[^a-z0-9]+/g, ' ').trim();
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function safeParse(markdown = '') {
|
|
263
|
+
try { return parseArtifactMarkdown(markdown); }
|
|
264
|
+
catch { return { envelope: {} }; }
|
|
265
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function buildPortableCreationQualification({ exactContract, exactRendererApplied, localContinuityRendererApplied = false, exactRendererParentCompatible, localContinuityParentCompatible = false, exactResultQualification, exactParentQualification, hasDeclaredParent, hasCompleteParent, schemaMaterial, validation, allowIncomplete, blocked }) {
|
|
2
|
+
const exactAvailable = exactContract.status === 'ready';
|
|
3
|
+
return Object.freeze({
|
|
4
|
+
blocked,
|
|
5
|
+
exactCreateTooling: Boolean(exactRendererApplied),
|
|
6
|
+
exactCreateToolingAvailable: exactAvailable,
|
|
7
|
+
exactCreateToolingApplied: Boolean(exactRendererApplied),
|
|
8
|
+
exactCreationResultQualification: String(exactResultQualification?.state || (exactRendererApplied ? 'qualified' : 'not-run')),
|
|
9
|
+
parentAuthorityQualification: String(exactParentQualification?.state || 'unqualified'),
|
|
10
|
+
parentAuthorityReason: String(exactParentQualification?.reason || ''),
|
|
11
|
+
localContinuityUsable: Boolean(localContinuityRendererApplied),
|
|
12
|
+
localContinuityAuthorityConflict: Boolean(localContinuityRendererApplied && localContinuityParentCompatible),
|
|
13
|
+
readableChildSchema: Boolean(schemaMaterial),
|
|
14
|
+
creationMode: exactRendererApplied
|
|
15
|
+
? 'exact-site-creation-contract'
|
|
16
|
+
: localContinuityRendererApplied
|
|
17
|
+
? 'local-relative-continuity-authority-conflict'
|
|
18
|
+
: schemaMaterial
|
|
19
|
+
? hasCompleteParent ? 'llm-writer-from-readable-schema' : 'readable-schema-root-writer'
|
|
20
|
+
: 'unavailable',
|
|
21
|
+
exactRuntimeValidation: Boolean(validation?.qualification?.exactRuntimeValidation),
|
|
22
|
+
contractDrivenStructuralValidation: Boolean(validation?.qualification?.contractDrivenStructuralValidation),
|
|
23
|
+
incompleteDraftAllowed: allowIncomplete,
|
|
24
|
+
remoteWrite: false,
|
|
25
|
+
sourceMutation: false,
|
|
26
|
+
limitations: Object.freeze([
|
|
27
|
+
...(!exactAvailable ? ['Exact child creation renderer is unavailable; the draft was rendered from readable schema structure and remains partially qualified.'] : []),
|
|
28
|
+
...(exactAvailable && !exactRendererApplied && !hasDeclaredParent ? ['The exact shared renderer was available but could not be applied at the requested continuity mode; portable tooling did not invent a Parent or alternate creation semantics.'] : []),
|
|
29
|
+
...(localContinuityRendererApplied ? [`Local continuity is represented with exact relative Trace and labeled relative Origin, while exact Parent qualification remains unresolved (${exactParentQualification?.reason || 'parent-authority-unresolved'}). No missing publication or reference authority is fabricated.`] : []),
|
|
30
|
+
...(exactAvailable && !exactRendererParentCompatible && hasDeclaredParent && !localContinuityParentCompatible ? [`The supplied Parent is not qualified for exact continuation (${exactParentQualification?.reason || 'parent-unqualified'}); portable tooling did not rewrite or synthesize Parent identity.`] : []),
|
|
31
|
+
...(hasDeclaredParent && !hasCompleteParent ? ['The supplied Parent declaration was incomplete and draft creation was blocked rather than inventing missing continuity or provenance fields.'] : []),
|
|
32
|
+
...(validation?.qualification?.limitations || []),
|
|
33
|
+
...(allowIncomplete ? ['Incomplete placeholders may remain and must not be treated as a qualified artifact.'] : [])
|
|
34
|
+
])
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export function portableParentRecordHasAnyValue(parent = {}) {
|
|
40
|
+
return Boolean(parent.id || parent.path || parent.kind || parent.schemaId || parent.currentSchemaId || parent.continuationTrace || parent.currentCreatedAt || parent.createdAt || parent.boundary || parent.sourceMode || parent.source || parent.publishedReference?.target || parent.schemaReferenceAuthority?.preferredTarget);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function portableParentRecordIsComplete(parent = {}) {
|
|
44
|
+
return Boolean((parent.schemaId || parent.currentSchemaId) && (parent.continuationTrace || parent.id) && parent.path);
|
|
45
|
+
}
|