@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,196 @@
|
|
|
1
|
+
export const GOVERNANCE_BOUNDARY_SCHEMA_ID = 'tiinex.governance.boundary.v1';
|
|
2
|
+
export const GOVERNANCE_SUMMARY_SCHEMA_ID = 'tiinex.governance.summary.v1';
|
|
3
|
+
|
|
4
|
+
export const GOVERNANCE_POLICY_NAMES = Object.freeze([
|
|
5
|
+
'LINEAGE_LICENSE.md',
|
|
6
|
+
'LINEAGE_LICENSE',
|
|
7
|
+
'LINEAGE_POLICY.md',
|
|
8
|
+
'LINEAGE_POLICY',
|
|
9
|
+
'LICENSE.md',
|
|
10
|
+
'LICENSE',
|
|
11
|
+
'POLICY.md',
|
|
12
|
+
'POLICY'
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
export const GOVERNANCE_NOTICE_NAMES = Object.freeze(['NOTICE', 'NOTICE.md']);
|
|
16
|
+
|
|
17
|
+
const POLICY_NAME_RANK = Object.freeze(new Map(GOVERNANCE_POLICY_NAMES.map((name, index) => [name.toLowerCase(), index])));
|
|
18
|
+
const NOTICE_NAME_RANK = Object.freeze(new Map(GOVERNANCE_NOTICE_NAMES.map((name, index) => [name.toLowerCase(), index])));
|
|
19
|
+
|
|
20
|
+
export function isLineageGovernancePath(path = '') {
|
|
21
|
+
const root = governanceRootPath(path);
|
|
22
|
+
return /^LINEAGE_(LICENSE|POLICY)(\.md)?$/i.test(root);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function isGovernancePolicyPath(path = '') {
|
|
26
|
+
const root = governanceRootPath(path);
|
|
27
|
+
return POLICY_NAME_RANK.has(root.toLowerCase());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function isGovernanceNoticePath(path = '') {
|
|
31
|
+
const root = governanceRootPath(path);
|
|
32
|
+
return NOTICE_NAME_RANK.has(root.toLowerCase());
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function governanceRootPath(path = '') {
|
|
36
|
+
const clean = sourceArtifactPath(path).replace(/^\/+/, '').replace(/\\/g, '/').replace(/\/+/g, '/');
|
|
37
|
+
if (!clean || clean.includes('/')) return '';
|
|
38
|
+
return clean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function governanceBoundaryFromRootFiles(source = {}, files = [], input = {}) {
|
|
42
|
+
const normalizedFiles = normalizeGovernanceFiles(files);
|
|
43
|
+
const policy = firstRankedFile(normalizedFiles.filter((file) => file.type === 'policy'), POLICY_NAME_RANK);
|
|
44
|
+
const notice = firstRankedFile(normalizedFiles.filter((file) => file.type === 'notice'), NOTICE_NAME_RANK);
|
|
45
|
+
return buildGovernanceBoundary(source, { policy, notice, rootChecked: input.rootChecked === true, discoveredFrom: input.discoveredFrom || '' });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function buildGovernanceBoundaryForSource(source = {}, input = {}) {
|
|
49
|
+
const entries = [];
|
|
50
|
+
for (const record of input.records || []) entries.push(governanceFileFromMaterial(record));
|
|
51
|
+
for (const asset of input.assets || []) entries.push(governanceFileFromMaterial(asset));
|
|
52
|
+
return governanceBoundaryFromRootFiles(source, entries.filter(Boolean), { rootChecked: input.rootChecked === true, discoveredFrom: input.discoveredFrom || 'loaded-source-material' });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function buildWorkspaceGovernanceSummary(workspace = {}, input = {}) {
|
|
56
|
+
const records = Array.isArray(input.records) ? input.records : (Array.isArray(workspace.records) ? workspace.records : []);
|
|
57
|
+
const assets = Array.isArray(input.assets) ? input.assets : (Array.isArray(workspace.assets) ? workspace.assets : []);
|
|
58
|
+
const sources = Array.isArray(workspace.sources) ? workspace.sources : [];
|
|
59
|
+
const sourceBoundaries = sources
|
|
60
|
+
.filter((source) => isSourceBacked(source))
|
|
61
|
+
.map((source) => source.governanceBoundary?.schema === GOVERNANCE_BOUNDARY_SCHEMA_ID
|
|
62
|
+
? source.governanceBoundary
|
|
63
|
+
: buildGovernanceBoundaryForSource(source, { records: records.filter((record) => String(record?.source?.id || '') === String(source.id || '')), assets: assets.filter((asset) => String(asset?.source?.id || '') === String(source.id || '')) }))
|
|
64
|
+
.filter(Boolean);
|
|
65
|
+
const counts = {
|
|
66
|
+
sources: sourceBoundaries.length,
|
|
67
|
+
found: sourceBoundaries.filter((item) => item.status === 'found').length,
|
|
68
|
+
originFallback: sourceBoundaries.filter((item) => item.status === 'origin-fallback').length,
|
|
69
|
+
missing: sourceBoundaries.filter((item) => item.status === 'missing').length,
|
|
70
|
+
unknown: sourceBoundaries.filter((item) => item.status === 'unknown').length,
|
|
71
|
+
local: sourceBoundaries.filter((item) => item.status === 'local').length,
|
|
72
|
+
notices: sourceBoundaries.filter((item) => item.notice?.status === 'found').length
|
|
73
|
+
};
|
|
74
|
+
const status = counts.missing ? 'degraded' : (counts.unknown ? 'unknown' : (counts.found || counts.originFallback || counts.notices ? 'ready' : 'local'));
|
|
75
|
+
return deepFreeze({
|
|
76
|
+
schema: GOVERNANCE_SUMMARY_SCHEMA_ID,
|
|
77
|
+
status,
|
|
78
|
+
boundary: 'Governance summary carries source/root policy, license, and notice context. It is advisory metadata for transitions/export and does not mutate source material.',
|
|
79
|
+
counts: Object.freeze(counts),
|
|
80
|
+
sources: Object.freeze(sourceBoundaries)
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function governanceFindingForBoundary(boundary = {}, input = {}) {
|
|
85
|
+
if (!boundary || boundary.schema !== GOVERNANCE_BOUNDARY_SCHEMA_ID) return null;
|
|
86
|
+
const repo = boundary.scope?.repo || input.repo || '';
|
|
87
|
+
if (boundary.status === 'missing') return finding('warning', 'governance.boundary.missing', `No lineage policy/license file was found at the origin root for ${repo || 'this source'}.`, { repo, status: boundary.status });
|
|
88
|
+
if (boundary.status === 'unknown') return finding('info', 'governance.boundary.unknown', `Governance boundary for ${repo || 'this source'} was not checked in this bounded materialization.`, { repo, status: boundary.status });
|
|
89
|
+
if (boundary.status === 'found' || boundary.status === 'origin-fallback') return finding('info', 'governance.boundary.detected', `${boundary.policy?.kind || 'Governance file'} applies to source-backed material from ${repo || 'this source'}.`, { repo, status: boundary.status, kind: boundary.policy?.kind || '' });
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function buildGovernanceBoundary(source = {}, input = {}) {
|
|
94
|
+
const repo = normalizeRepo(source.repo || source.repository || source.config?.repo || '');
|
|
95
|
+
const ref = String(source.ref || source.config?.ref || '').trim();
|
|
96
|
+
const policy = input.policy || null;
|
|
97
|
+
const noticeFile = input.notice || null;
|
|
98
|
+
if (!repo) {
|
|
99
|
+
return deepFreeze({
|
|
100
|
+
schema: GOVERNANCE_BOUNDARY_SCHEMA_ID,
|
|
101
|
+
status: 'local',
|
|
102
|
+
scope: Object.freeze({ kind: 'local', repo: '', ref: '', root: '' }),
|
|
103
|
+
policy: null,
|
|
104
|
+
notice: Object.freeze({ status: 'local', kind: '', path: '', url: '', note: 'Local/browser material has no remote origin governance lookup.' }),
|
|
105
|
+
rootChecked: false,
|
|
106
|
+
boundary: 'Local/browser workspace material does not inherit GitHub repository governance by inference.'
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const status = policy ? (isLineageGovernancePath(policy.path || policy.kind) ? 'found' : 'origin-fallback') : (input.rootChecked ? 'missing' : 'unknown');
|
|
110
|
+
return deepFreeze({
|
|
111
|
+
schema: GOVERNANCE_BOUNDARY_SCHEMA_ID,
|
|
112
|
+
status,
|
|
113
|
+
scope: Object.freeze({ kind: 'github-repo-root', repo, ref, root: '/' }),
|
|
114
|
+
policy: policy ? Object.freeze({ kind: policy.kind || governanceRootPath(policy.path), path: policy.path || policy.kind || '', url: policy.url || repoRawUrl(repo, ref, policy.path || policy.kind || ''), contentAvailable: Boolean(policy.text || policy.content || policy.body) }) : null,
|
|
115
|
+
notice: noticeFile ? Object.freeze({ status: 'found', kind: noticeFile.kind || governanceRootPath(noticeFile.path), path: noticeFile.path || noticeFile.kind || '', url: noticeFile.url || repoRawUrl(repo, ref, noticeFile.path || noticeFile.kind || ''), contentAvailable: Boolean(noticeFile.text || noticeFile.content || noticeFile.body), note: 'NOTICE found at source root.' }) : Object.freeze({ status: input.rootChecked ? 'missing' : 'unknown', kind: '', path: '', url: '', note: input.rootChecked ? 'No NOTICE file found at source root.' : 'Root NOTICE was not checked in this bounded materialization.' }),
|
|
116
|
+
rootChecked: input.rootChecked === true,
|
|
117
|
+
discoveredFrom: input.discoveredFrom || '',
|
|
118
|
+
candidates: Object.freeze({ policy: GOVERNANCE_POLICY_NAMES.slice(), notice: GOVERNANCE_NOTICE_NAMES.slice() }),
|
|
119
|
+
note: status === 'missing'
|
|
120
|
+
? `No lineage policy/license found at ${repo}@${ref || 'unresolved'} root. Checked known root names only.`
|
|
121
|
+
: status === 'unknown'
|
|
122
|
+
? `Governance root files for ${repo}@${ref || 'unresolved'} were not checked by this bounded materialization.`
|
|
123
|
+
: `${policy?.kind || governanceRootPath(policy?.path || '')} applies to source-backed material from ${repo}@${ref || 'unresolved'}.`,
|
|
124
|
+
boundary: 'Governance boundary follows explicit source origin root files only. README/validation notes are not treated as license/policy fallback.'
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function normalizeGovernanceFiles(files = []) {
|
|
129
|
+
return (files || []).map((file) => {
|
|
130
|
+
const path = governanceRootPath(file?.path || file?.kind || file?.name || '');
|
|
131
|
+
if (!path) return null;
|
|
132
|
+
const lower = path.toLowerCase();
|
|
133
|
+
const kind = POLICY_NAME_RANK.has(lower) ? 'policy' : NOTICE_NAME_RANK.has(lower) ? 'notice' : '';
|
|
134
|
+
if (!kind) return null;
|
|
135
|
+
return Object.assign({}, file, { path, kind: file.kind || path, governanceKind: kind });
|
|
136
|
+
}).filter(Boolean).map((file) => Object.assign({}, file, { kind: file.path, type: file.governanceKind }));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function firstRankedFile(files = [], rankMap = new Map()) {
|
|
140
|
+
return files.slice().sort((a, b) => (rankMap.get(String(a.path || a.kind || '').toLowerCase()) ?? 999) - (rankMap.get(String(b.path || b.kind || '').toLowerCase()) ?? 999))[0] || null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function governanceFileFromMaterial(item = {}) {
|
|
144
|
+
const path = governanceRootPath(item?.sourceTarget?.sourceArtifactPath || item?.path || item?.name || '');
|
|
145
|
+
if (!path) return null;
|
|
146
|
+
if (!isGovernancePolicyPath(path) && !isGovernanceNoticePath(path)) return null;
|
|
147
|
+
return {
|
|
148
|
+
path,
|
|
149
|
+
kind: path,
|
|
150
|
+
url: item?.sourceTarget?.rawUrl || item?.source?.url || '',
|
|
151
|
+
text: item?.markdown || item?.content || item?.text || ''
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function sourceArtifactPath(value = '') {
|
|
156
|
+
const raw = String(value || '').trim();
|
|
157
|
+
if (!raw) return '';
|
|
158
|
+
try {
|
|
159
|
+
const url = new URL(raw);
|
|
160
|
+
if (/raw\.githubusercontent\.com$/i.test(url.hostname)) {
|
|
161
|
+
const parts = url.pathname.split('/').filter(Boolean);
|
|
162
|
+
if (parts.length >= 4) return parts.slice(3).join('/');
|
|
163
|
+
}
|
|
164
|
+
if (/github\.com$/i.test(url.hostname) && /\/blob\//i.test(url.pathname)) {
|
|
165
|
+
const parts = url.pathname.split('/').filter(Boolean);
|
|
166
|
+
const blob = parts.indexOf('blob');
|
|
167
|
+
if (blob >= 0) return parts.slice(blob + 2).join('/');
|
|
168
|
+
}
|
|
169
|
+
} catch (_) {}
|
|
170
|
+
return raw;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function normalizeRepo(value = '') {
|
|
174
|
+
return String(value || '').trim().replace(/^https?:\/\/github\.com\//i, '').replace(/\.git$/i, '').replace(/^\/+|\/+$/g, '').split('/').slice(0, 2).join('/');
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function repoRawUrl(repo = '', ref = '', path = '') {
|
|
178
|
+
if (!repo || !ref || !path) return '';
|
|
179
|
+
return `https://raw.githubusercontent.com/${repo}/${encodeURIComponent(ref)}/${String(path).split('/').map((part) => encodeURIComponent(part)).join('/')}`;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function isSourceBacked(source = {}) {
|
|
183
|
+
const kind = String(source.adapterId || source.sourceKind || source.kind || '').toLowerCase();
|
|
184
|
+
return kind.includes('github') || kind.includes('source');
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function finding(severity, code, message, extra = {}) {
|
|
188
|
+
return Object.freeze(Object.assign({ severity, code, message }, extra || {}));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function deepFreeze(value) {
|
|
192
|
+
if (!value || typeof value !== 'object' || Object.isFrozen(value)) return value;
|
|
193
|
+
Object.freeze(value);
|
|
194
|
+
for (const item of Object.values(value)) deepFreeze(item);
|
|
195
|
+
return value;
|
|
196
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
export const C14N_V2_METHOD_ID = 'sha256-base64url-c14n-v2';
|
|
2
|
+
|
|
3
|
+
export function canonicalC14nV2SelfState(markdown = '') {
|
|
4
|
+
const normalized = normalizeCanonicalSource(markdown);
|
|
5
|
+
const located = locateSelfEntries(normalized);
|
|
6
|
+
if (located.integrityHeading < 0) return Object.freeze({ state: 'unavailable', reason: 'integrity-footer-missing', entries: Object.freeze([]) });
|
|
7
|
+
if (located.entries.length !== 1) return Object.freeze({ state: 'ambiguous', reason: located.entries.length ? 'multiple-primary-self-entries' : 'primary-self-entry-missing', entries: Object.freeze(located.entries) });
|
|
8
|
+
const entry = located.entries[0];
|
|
9
|
+
if (entry.valueLines.length !== 1) return Object.freeze({ state: 'ambiguous', reason: entry.valueLines.length ? 'multiple-value-fields' : 'value-field-missing', entries: Object.freeze(located.entries) });
|
|
10
|
+
const valueLine = entry.valueLines[0];
|
|
11
|
+
const canonicalLines = located.lines.slice();
|
|
12
|
+
canonicalLines[valueLine.index] = `${valueLine.label}${valueLine.spacing}`;
|
|
13
|
+
const canonical = canonicalLines.join('\n');
|
|
14
|
+
const computedValue = sha256Base64Url(canonical);
|
|
15
|
+
const declaredValue = valueLine.value;
|
|
16
|
+
return Object.freeze({
|
|
17
|
+
state: declaredValue && declaredValue === computedValue ? 'verified' : declaredValue ? 'mismatch' : 'prepared',
|
|
18
|
+
reason: declaredValue && declaredValue !== computedValue ? 'digest-mismatch' : '',
|
|
19
|
+
method: C14N_V2_METHOD_ID,
|
|
20
|
+
towards: 'self',
|
|
21
|
+
declaredValue,
|
|
22
|
+
computedValue,
|
|
23
|
+
canonical,
|
|
24
|
+
entryIndex: entry.entryIndex,
|
|
25
|
+
valueLineIndex: valueLine.index
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
export function validatedC14nV2PrimarySelfDigest(markdown = '') {
|
|
31
|
+
const state = canonicalC14nV2SelfState(markdown);
|
|
32
|
+
if (state.state !== 'verified') return Object.freeze({
|
|
33
|
+
state: state.state,
|
|
34
|
+
reason: state.reason || state.state,
|
|
35
|
+
value: '',
|
|
36
|
+
declaredValue: state.declaredValue || '',
|
|
37
|
+
computedValue: state.computedValue || ''
|
|
38
|
+
});
|
|
39
|
+
return Object.freeze({
|
|
40
|
+
state: 'verified',
|
|
41
|
+
reason: '',
|
|
42
|
+
value: state.declaredValue,
|
|
43
|
+
declaredValue: state.declaredValue,
|
|
44
|
+
computedValue: state.computedValue
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function verifyC14nV2TargetSelfDigest({ value = '', targetMarkdown = '' } = {}) {
|
|
49
|
+
const expectedValue = String(value || '').trim();
|
|
50
|
+
const target = validatedC14nV2PrimarySelfDigest(targetMarkdown);
|
|
51
|
+
if (target.state !== 'verified') return Object.freeze({
|
|
52
|
+
state: target.state === 'mismatch' ? 'target-self-mismatch' : target.state,
|
|
53
|
+
reason: target.reason || target.state,
|
|
54
|
+
expectedValue,
|
|
55
|
+
targetValue: target.declaredValue || '',
|
|
56
|
+
computedTargetValue: target.computedValue || ''
|
|
57
|
+
});
|
|
58
|
+
return Object.freeze({
|
|
59
|
+
state: expectedValue && expectedValue === target.value ? 'verified' : 'mismatch',
|
|
60
|
+
reason: !expectedValue ? 'comparison-value-missing' : expectedValue === target.value ? '' : 'target-self-digest-mismatch',
|
|
61
|
+
expectedValue,
|
|
62
|
+
targetValue: target.value,
|
|
63
|
+
computedTargetValue: target.computedValue
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function sealC14nV2Self(markdown = '') {
|
|
68
|
+
const state = canonicalC14nV2SelfState(markdown);
|
|
69
|
+
if (!['verified', 'mismatch', 'prepared'].includes(state.state)) return Object.freeze({ state: state.state, reason: state.reason, markdown: String(markdown || ''), value: '' });
|
|
70
|
+
const normalized = normalizeCanonicalSource(markdown);
|
|
71
|
+
const lines = normalized.split('\n');
|
|
72
|
+
const located = locateSelfEntries(normalized);
|
|
73
|
+
const valueLine = located.entries[0]?.valueLines?.[0];
|
|
74
|
+
if (!valueLine) return Object.freeze({ state: 'ambiguous', reason: 'value-field-missing', markdown: String(markdown || ''), value: '' });
|
|
75
|
+
lines[valueLine.index] = `${valueLine.label}${valueLine.spacing}${state.computedValue}`;
|
|
76
|
+
return Object.freeze({ state: 'sealed', reason: '', markdown: lines.join('\n'), value: state.computedValue });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function sha256Base64Url(text = '') {
|
|
80
|
+
return base64Url(sha256Bytes(new TextEncoder().encode(String(text || ''))));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function normalizeCanonicalSource(markdown = '') {
|
|
84
|
+
return String(markdown || '')
|
|
85
|
+
.replace(/\r\n?/g, '\n')
|
|
86
|
+
.replace(/[ \t]+$/gm, '')
|
|
87
|
+
.trimEnd();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function locateSelfEntries(normalized = '') {
|
|
91
|
+
const lines = String(normalized || '').split('\n');
|
|
92
|
+
const integrityHeading = lines.findIndex((line) => line === '# Continuity Integrity');
|
|
93
|
+
if (integrityHeading < 0) return { lines, integrityHeading, entries: [] };
|
|
94
|
+
const allEntries = [];
|
|
95
|
+
let current = null;
|
|
96
|
+
const finish = (end) => {
|
|
97
|
+
if (!current) return;
|
|
98
|
+
current.end = end;
|
|
99
|
+
allEntries.push(current);
|
|
100
|
+
current = null;
|
|
101
|
+
};
|
|
102
|
+
for (let index = integrityHeading + 1; index < lines.length; index += 1) {
|
|
103
|
+
const line = lines[index];
|
|
104
|
+
if (/^#\s+/.test(line)) { finish(index); break; }
|
|
105
|
+
const top = line.match(/^-\s+(.+?)\s*$/);
|
|
106
|
+
if (top) {
|
|
107
|
+
finish(index);
|
|
108
|
+
current = { entryIndex: allEntries.length, start: index, end: lines.length, method: stripMarkdownLink(top[1].trim()), towards: '', valueLines: [] };
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (!current) continue;
|
|
112
|
+
const towards = line.match(/^\s+-\s+Towards:\s*(.*?)\s*$/);
|
|
113
|
+
if (towards) current.towards = stripMarkdownLink(towards[1].trim());
|
|
114
|
+
const value = line.match(/^(\s+-\s+Value:)([ \t]*)(.*)$/);
|
|
115
|
+
if (value) current.valueLines.push({ index, label: value[1], spacing: value[2], value: value[3].trim() });
|
|
116
|
+
}
|
|
117
|
+
finish(lines.length);
|
|
118
|
+
const entries = allEntries.filter((entry) => entry.method === C14N_V2_METHOD_ID && entry.towards === 'self');
|
|
119
|
+
return { lines, integrityHeading, entries };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function stripMarkdownLink(value = '') {
|
|
123
|
+
const text = String(value || '').trim();
|
|
124
|
+
const link = text.match(/^\[([^\]]+)\]\([^)]+\)$/);
|
|
125
|
+
return (link ? link[1] : text).trim();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function sha256Bytes(bytes) {
|
|
129
|
+
const K = [
|
|
130
|
+
0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
|
|
131
|
+
0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
|
|
132
|
+
0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,
|
|
133
|
+
0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,
|
|
134
|
+
0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,
|
|
135
|
+
0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,
|
|
136
|
+
0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,
|
|
137
|
+
0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
|
|
138
|
+
];
|
|
139
|
+
const length = bytes.length;
|
|
140
|
+
const bitLength = length * 8;
|
|
141
|
+
const paddedLength = (((length + 9 + 63) >> 6) << 6);
|
|
142
|
+
const buffer = new Uint8Array(paddedLength);
|
|
143
|
+
buffer.set(bytes);
|
|
144
|
+
buffer[length] = 0x80;
|
|
145
|
+
const view = new DataView(buffer.buffer);
|
|
146
|
+
const high = Math.floor(bitLength / 0x100000000);
|
|
147
|
+
const low = bitLength >>> 0;
|
|
148
|
+
view.setUint32(paddedLength - 8, high, false);
|
|
149
|
+
view.setUint32(paddedLength - 4, low, false);
|
|
150
|
+
let h0=0x6a09e667,h1=0xbb67ae85,h2=0x3c6ef372,h3=0xa54ff53a,h4=0x510e527f,h5=0x9b05688c,h6=0x1f83d9ab,h7=0x5be0cd19;
|
|
151
|
+
const w = new Uint32Array(64);
|
|
152
|
+
for (let offset = 0; offset < paddedLength; offset += 64) {
|
|
153
|
+
for (let i = 0; i < 16; i += 1) w[i] = view.getUint32(offset + i * 4, false);
|
|
154
|
+
for (let i = 16; i < 64; i += 1) {
|
|
155
|
+
const a=w[i-15], b=w[i-2];
|
|
156
|
+
const s0=(rotr(a,7)^rotr(a,18)^(a>>>3))>>>0;
|
|
157
|
+
const s1=(rotr(b,17)^rotr(b,19)^(b>>>10))>>>0;
|
|
158
|
+
w[i]=(w[i-16]+s0+w[i-7]+s1)>>>0;
|
|
159
|
+
}
|
|
160
|
+
let a=h0,b=h1,c=h2,d=h3,e=h4,f=h5,g=h6,h=h7;
|
|
161
|
+
for (let i=0;i<64;i+=1) {
|
|
162
|
+
const S1=(rotr(e,6)^rotr(e,11)^rotr(e,25))>>>0;
|
|
163
|
+
const ch=((e&f)^(~e&g))>>>0;
|
|
164
|
+
const t1=(h+S1+ch+K[i]+w[i])>>>0;
|
|
165
|
+
const S0=(rotr(a,2)^rotr(a,13)^rotr(a,22))>>>0;
|
|
166
|
+
const maj=((a&b)^(a&c)^(b&c))>>>0;
|
|
167
|
+
const t2=(S0+maj)>>>0;
|
|
168
|
+
h=g; g=f; f=e; e=(d+t1)>>>0; d=c; c=b; b=a; a=(t1+t2)>>>0;
|
|
169
|
+
}
|
|
170
|
+
h0=(h0+a)>>>0; h1=(h1+b)>>>0; h2=(h2+c)>>>0; h3=(h3+d)>>>0;
|
|
171
|
+
h4=(h4+e)>>>0; h5=(h5+f)>>>0; h6=(h6+g)>>>0; h7=(h7+h)>>>0;
|
|
172
|
+
}
|
|
173
|
+
const out = new Uint8Array(32);
|
|
174
|
+
const outView = new DataView(out.buffer);
|
|
175
|
+
[h0,h1,h2,h3,h4,h5,h6,h7].forEach((value,index)=>outView.setUint32(index*4,value,false));
|
|
176
|
+
return out;
|
|
177
|
+
}
|
|
178
|
+
function rotr(value, shift) { return ((value >>> shift) | (value << (32 - shift))) >>> 0; }
|
|
179
|
+
function base64Url(bytes) {
|
|
180
|
+
const alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
|
|
181
|
+
let out='';
|
|
182
|
+
for (let i=0;i<bytes.length;i+=3) {
|
|
183
|
+
const a=bytes[i], b=i+1<bytes.length?bytes[i+1]:0, c=i+2<bytes.length?bytes[i+2]:0;
|
|
184
|
+
const triple=(a<<16)|(b<<8)|c;
|
|
185
|
+
out+=alphabet[(triple>>>18)&63]+alphabet[(triple>>>12)&63];
|
|
186
|
+
if (i+1<bytes.length) out+=alphabet[(triple>>>6)&63];
|
|
187
|
+
if (i+2<bytes.length) out+=alphabet[triple&63];
|
|
188
|
+
}
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export const INTEGRITY_METHOD_REFERENCE_AUTHORITY_SCHEMA_ID = 'tiinex.site.integrity-method-reference-authority.v1';
|
|
2
|
+
export const C14N_V2_METHOD_ID = 'sha256-base64url-c14n-v2';
|
|
3
|
+
export const C14N_V2_VALIDATOR_TARGET = 'https://github.com/Tiinex/docs/blob/3988951208eb9a8926e84ab42625d4b42fa00c2d/.topics/.validators/sha256-base64url-c14n-v2.validator.md';
|
|
4
|
+
const C14N_V2_PRIOR_EQUIVALENT_TARGET = 'https://github.com/Tiinex/docs/blob/053d46ce082d4ec261b82abc44ecca403d61e240/.topics/.validators/sha256-base64url-c14n-v2.validator.md';
|
|
5
|
+
|
|
6
|
+
const maintainedC14nV2 = Object.freeze({
|
|
7
|
+
schema: INTEGRITY_METHOD_REFERENCE_AUTHORITY_SCHEMA_ID,
|
|
8
|
+
methodId: C14N_V2_METHOD_ID,
|
|
9
|
+
preferredTarget: C14N_V2_VALIDATOR_TARGET,
|
|
10
|
+
exactTargets: Object.freeze([C14N_V2_VALIDATOR_TARGET, C14N_V2_PRIOR_EQUIVALENT_TARGET]),
|
|
11
|
+
resolutionState: 'qualified',
|
|
12
|
+
resolutionEvidence: Object.freeze({
|
|
13
|
+
sourceRepository: 'Tiinex/docs',
|
|
14
|
+
sourceCommit: '3988951208eb9a8926e84ab42625d4b42fa00c2d',
|
|
15
|
+
sourcePath: '.topics/.validators/sha256-base64url-c14n-v2.validator.md',
|
|
16
|
+
gitBlobSha: '20df4285e96a26ba69e9b8c054688cfdb60492d3'
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export function integrityMethodReferenceAuthorityForCreation(methodId = C14N_V2_METHOD_ID, explicit = undefined) {
|
|
21
|
+
const id = String(methodId || '').trim();
|
|
22
|
+
const fallback = id === C14N_V2_METHOD_ID ? maintainedC14nV2 : Object.freeze({
|
|
23
|
+
schema: INTEGRITY_METHOD_REFERENCE_AUTHORITY_SCHEMA_ID,
|
|
24
|
+
methodId: id,
|
|
25
|
+
preferredTarget: '',
|
|
26
|
+
exactTargets: Object.freeze([]),
|
|
27
|
+
resolutionState: 'unavailable',
|
|
28
|
+
resolutionEvidence: Object.freeze({})
|
|
29
|
+
});
|
|
30
|
+
if (explicit === undefined || explicit === null) return fallback;
|
|
31
|
+
if (explicit === false) return Object.freeze({ ...fallback, preferredTarget: '', exactTargets: Object.freeze([]), resolutionState: 'unavailable', resolutionEvidence: Object.freeze({}) });
|
|
32
|
+
if (typeof explicit === 'string') return Object.freeze({ ...fallback, preferredTarget: explicit, exactTargets: Object.freeze(explicit ? [explicit] : []), resolutionState: 'unresolved', resolutionEvidence: Object.freeze({}) });
|
|
33
|
+
const target = String(explicit.preferredTarget || explicit.target || '').trim();
|
|
34
|
+
const exactTargets = Object.freeze([...new Set([...(explicit.exactTargets || []), target].map((item) => String(item || '')).filter(Boolean))]);
|
|
35
|
+
return Object.freeze({
|
|
36
|
+
...fallback,
|
|
37
|
+
methodId: String(explicit.methodId || id),
|
|
38
|
+
preferredTarget: target || exactTargets[0] || '',
|
|
39
|
+
exactTargets,
|
|
40
|
+
resolutionState: String(explicit.resolutionState || explicit.state || (target && fallback.exactTargets.includes(target) ? fallback.resolutionState : 'unresolved')),
|
|
41
|
+
resolutionEvidence: Object.freeze({ ...(target && fallback.exactTargets.includes(target) ? fallback.resolutionEvidence : {}), ...(explicit.resolutionEvidence || explicit.evidence || {}) })
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function renderIntegrityMethodReference(authority = {}) {
|
|
46
|
+
const methodId = String(authority?.methodId || '').trim();
|
|
47
|
+
if (!methodId) throw new Error('integrity-method-reference-id-missing');
|
|
48
|
+
const target = authority?.resolutionState === 'qualified' ? String(authority?.preferredTarget || '').trim() : '';
|
|
49
|
+
return target ? `[${methodId}](${target})` : methodId;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function qualifyIntegrityMethodReferenceValue(value = '', authority = {}) {
|
|
53
|
+
const raw = String(value || '').trim();
|
|
54
|
+
const parsed = parseMethodReference(raw);
|
|
55
|
+
const methodId = String(authority?.methodId || '').trim();
|
|
56
|
+
const exactTargets = new Set([...(authority?.exactTargets || [])].map((item) => String(item || '')).filter(Boolean));
|
|
57
|
+
const maintainedAvailable = authority?.resolutionState === 'qualified' && Boolean(authority?.preferredTarget);
|
|
58
|
+
const findings = [];
|
|
59
|
+
if (!methodId || parsed.methodId !== methodId) findings.push(`Integrity method identifier must be exactly ${methodId || '(unavailable)'}.`);
|
|
60
|
+
if (maintainedAvailable) {
|
|
61
|
+
if (parsed.form === 'markdown-link' && !exactTargets.has(parsed.target)) findings.push(`Integrity method target is not the qualified maintained representation for ${methodId}: ${parsed.target || '(empty)'}.`);
|
|
62
|
+
} else if (parsed.form === 'markdown-link' && exactTargets.size && !exactTargets.has(parsed.target)) {
|
|
63
|
+
findings.push(`Integrity method target is not qualified for ${methodId}: ${parsed.target || '(empty)'}.`);
|
|
64
|
+
}
|
|
65
|
+
return Object.freeze({ state: findings.length ? 'unavailable' : 'qualified', observed: parsed, authority, maintainedTargetAvailable: maintainedAvailable, findings: Object.freeze(findings) });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function parseMethodReference(value = '') {
|
|
69
|
+
const text = String(value || '').trim();
|
|
70
|
+
const match = text.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
|
|
71
|
+
if (match) return Object.freeze({ raw: text, form: 'markdown-link', methodId: match[1], target: match[2] });
|
|
72
|
+
return Object.freeze({ raw: text, form: text ? 'plain-method-id' : 'empty', methodId: text, target: '' });
|
|
73
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { C14N_V2_METHOD_ID, canonicalC14nV2SelfState } from './integrity.c14nV2.js';
|
|
2
|
+
import { integrityMethodReferenceAuthorityForCreation, qualifyIntegrityMethodReferenceValue } from './integrity.methodReference.js';
|
|
3
|
+
|
|
4
|
+
export const INTEGRITY_VALIDATION_ENGINE_ID = 'tiinex.integrity.validation.v1';
|
|
5
|
+
|
|
6
|
+
export function validateIntegrity(artifact = {}, options = {}) {
|
|
7
|
+
const findings = [];
|
|
8
|
+
const methods = normalizeMethods(artifact?.integrity?.methods);
|
|
9
|
+
const hasIntegrity = Boolean(artifact?.hasIntegrity);
|
|
10
|
+
|
|
11
|
+
if (!hasIntegrity) {
|
|
12
|
+
findings.push(info('integrity.validation.skipped', 'Continuity Integrity footer is missing; integrity engine did not run byte/canonicalization validation.'));
|
|
13
|
+
return findings;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!methods.length) {
|
|
17
|
+
findings.push(info('integrity.method.unspecified', 'Continuity Integrity exists but no machine-verifiable integrity method is declared.'));
|
|
18
|
+
return findings;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (methods.includes(C14N_V2_METHOD_ID)) {
|
|
22
|
+
findings.push(info('integrity.c14n-v2.detected', 'c14n-v2 integrity method is declared; the integrity engine evaluates self entries when canonical artifact bytes are available.'));
|
|
23
|
+
const selfEntries = (artifact?.integrity?.entries || []).filter((entry) => entry?.method === C14N_V2_METHOD_ID && entry?.towards === 'self');
|
|
24
|
+
const maintainedAuthority = integrityMethodReferenceAuthorityForCreation(C14N_V2_METHOD_ID);
|
|
25
|
+
for (const entry of (artifact?.integrity?.entries || []).filter((item) => item?.method === C14N_V2_METHOD_ID)) {
|
|
26
|
+
const reference = qualifyIntegrityMethodReferenceValue(entry?.methodRaw || entry?.method || '', maintainedAuthority);
|
|
27
|
+
if (reference.state !== 'qualified') findings.push(error('integrity.method-reference.unqualified', reference.findings.join(' ')));
|
|
28
|
+
else findings.push(info('integrity.method-reference.qualified', 'c14n-v2 integrity method reference conforms to the canonical Root method-entry contract.'));
|
|
29
|
+
}
|
|
30
|
+
if (selfEntries.length) {
|
|
31
|
+
const result = canonicalC14nV2SelfState(artifact.markdown || '');
|
|
32
|
+
if (result.state === 'verified') findings.push(info('integrity.c14n-v2.verified', 'c14n-v2 self-integrity is verified against the current canonical artifact bytes.'));
|
|
33
|
+
else if (result.state === 'mismatch') findings.push(warning('integrity.c14n-v2.mismatch', 'c14n-v2 self-integrity does not match the current canonical artifact bytes.'));
|
|
34
|
+
else findings.push(warning('integrity.c14n-v2.ambiguous', `c14n-v2 self-integrity could not be verified: ${result.reason || result.state}.`));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
for (const method of methods) {
|
|
39
|
+
if (method === C14N_V2_METHOD_ID) continue;
|
|
40
|
+
if (/browser-local-draft|draft local integrity/i.test(method)) {
|
|
41
|
+
findings.push(info('integrity.local-draft.declared', 'Draft/local integrity marker is present; it is a recoverability marker, not a published byte-verification proof.'));
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
findings.push(info('integrity.method.declared', `Integrity method declared: ${method}.`));
|
|
45
|
+
}
|
|
46
|
+
return findings;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function normalizeMethods(methods = []) {
|
|
50
|
+
if (!Array.isArray(methods)) return [];
|
|
51
|
+
return [...new Set(methods.map((method) => String(method || '').trim()).filter(Boolean))];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function warning(code, message) { return { severity: 'warning', code, message, source: INTEGRITY_VALIDATION_ENGINE_ID }; }
|
|
55
|
+
function info(code, message) { return { severity: 'info', code, message, source: INTEGRITY_VALIDATION_ENGINE_ID }; }
|
|
56
|
+
function error(code, message) { return { severity: 'error', code, message, source: INTEGRITY_VALIDATION_ENGINE_ID }; }
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { lineageBasePathForNode } from './lineage.pathBasis.js';
|
|
2
|
+
import { preferredLineageMaterialCandidates } from './lineage.materialPreference.js';
|
|
3
|
+
import { canonicalPath } from './lineage.targetKeys.js';
|
|
4
|
+
|
|
5
|
+
export function resolveCandidateNodes(nodes = [], method = 'unknown', declaringNode = null) {
|
|
6
|
+
const unique = uniqueNodes(nodes || []);
|
|
7
|
+
if (!unique.length) return null;
|
|
8
|
+
const withoutSelf = unique.filter((candidate) => !sameLineageNode(candidate, declaringNode));
|
|
9
|
+
if (!withoutSelf.length) return { selfReference: true, method, candidates: unique };
|
|
10
|
+
const preferred = preferredLineageMaterialCandidates(withoutSelf, method);
|
|
11
|
+
if (preferred.length === 1) return Object.assign({ method }, preferred[0]);
|
|
12
|
+
if (withoutSelf.length === 1) return Object.assign({ method }, withoutSelf[0]);
|
|
13
|
+
return { ambiguous: true, method, candidates: preferred.length ? preferred : withoutSelf };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function relativeCandidatePath(rawTarget, declaringNode = null) {
|
|
17
|
+
const raw = String(rawTarget || '').trim();
|
|
18
|
+
const declaringPath = canonicalPath(lineageBasePathForNode(declaringNode));
|
|
19
|
+
const targetPath = canonicalPath(raw);
|
|
20
|
+
if (!targetPath) return null;
|
|
21
|
+
const dir = dirname(declaringPath);
|
|
22
|
+
return { path: normalizeJoinedPath(dir, raw), method: dir ? 'relative-path' : 'relative-root-path' };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function isSimpleRelativeReference(value = '') {
|
|
26
|
+
const raw = String(value || '').trim();
|
|
27
|
+
const path = canonicalPath(raw);
|
|
28
|
+
return Boolean(raw && path && !path.includes('/') && !isUrlLike(raw) && !/^record:/i.test(raw));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function isDotRelativeReference(value = '') { return /^\.\.?(?:\/|$)/.test(String(value || '').replace(/\\/g, '/').trim()); }
|
|
32
|
+
|
|
33
|
+
function sameLineageNode(candidate = {}, declaringNode = null) {
|
|
34
|
+
if (!candidate || !declaringNode) return false;
|
|
35
|
+
const candidateId = String(candidate.id || '').trim();
|
|
36
|
+
const declaringId = String(declaringNode.id || '').trim();
|
|
37
|
+
if (candidateId && declaringId) return candidateId === declaringId;
|
|
38
|
+
const candidatePath = canonicalPath(candidate.path || candidate.record?.path || '');
|
|
39
|
+
const declaringPath = canonicalPath(declaringNode.path || declaringNode.record?.path || '');
|
|
40
|
+
return Boolean(candidatePath && declaringPath && candidatePath === declaringPath);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function dirname(path = '') { const parts = canonicalPath(path).split('/').filter(Boolean); parts.pop(); return parts.join('/'); }
|
|
44
|
+
function normalizeJoinedPath(base = '', target = '') { const text = String(target || '').replace(/\\/g, '/'); return canonicalPath(text.startsWith('/') ? text : [base, text].filter(Boolean).join('/')); }
|
|
45
|
+
export function isUrlLike(value = '') { return /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(String(value || '').trim()); }
|
|
46
|
+
function uniqueNodes(nodes = []) { const seen = new Set(); const out = []; for (const node of Array.isArray(nodes) ? nodes : []) { const key = node?.id || node?.path || JSON.stringify(node || {}); if (!key || seen.has(key)) continue; seen.add(key); out.push(node); } return out; }
|