@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,141 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PORTABLE_HOST_ACTION_ACCEPTANCE_SCHEMA_ID,
|
|
3
|
+
acceptPortableHostActionReceipt
|
|
4
|
+
} from '../host/tool.bindings.js';
|
|
5
|
+
import { portableFinding } from '../findings.js';
|
|
6
|
+
import { sha256Hex, utf8Bytes } from '../../../export/package.bytes.js';
|
|
7
|
+
|
|
8
|
+
export function normalizePublicationProviderReceipts(input = {}) {
|
|
9
|
+
const findings = [];
|
|
10
|
+
const references = [];
|
|
11
|
+
const observations = [];
|
|
12
|
+
|
|
13
|
+
for (const item of receiptInputs(input)) {
|
|
14
|
+
const plan = item?.plan || item?.hostActionPlan || null;
|
|
15
|
+
const receipt = item?.receipt || item?.hostReceipt || null;
|
|
16
|
+
if (!plan || !receipt) {
|
|
17
|
+
findings.push(portableFinding('error', 'portable.lineage.publication-provider.receipt-pair.required', 'Publication provider receipt input requires both the original host action plan and its receipt.'));
|
|
18
|
+
references.push(Object.freeze({ actionId: String(plan?.actionId || receipt?.actionId || ''), status: 'rejected', reason: 'publication-provider-receipt-pair-required' }));
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
addAcceptance(acceptPortableHostActionReceipt({ plan, receipt }), observations, references, findings, 'receipt');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
for (const acceptance of acceptanceInputs(input)) addAcceptance(acceptance, observations, references, findings, 'acceptance');
|
|
25
|
+
|
|
26
|
+
if (Array.isArray(input.providerResponses) && input.providerResponses.length) {
|
|
27
|
+
findings.push(portableFinding('warning', 'portable.lineage.publication-provider.responses-unaccepted', 'Direct providerResponses are not publication qualification authority; supply an accepted publication provider host receipt or acceptance.'));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return Object.freeze({
|
|
31
|
+
observations: Object.freeze(observations),
|
|
32
|
+
references: Object.freeze(references),
|
|
33
|
+
findings: Object.freeze(findings),
|
|
34
|
+
summary: Object.freeze({
|
|
35
|
+
acceptedReceipts: observations.length,
|
|
36
|
+
acceptedFiles: observations.reduce((sum, entry) => sum + entry.files.length, 0),
|
|
37
|
+
rejectedReceipts: references.filter((entry) => entry.status !== 'accepted').length
|
|
38
|
+
}),
|
|
39
|
+
boundary: Object.freeze({
|
|
40
|
+
acceptedAction: 'repository-read',
|
|
41
|
+
directProviderResponsesAreNotAuthority: true,
|
|
42
|
+
localRecordEvidenceIsDescriptiveOnly: true,
|
|
43
|
+
returnedProviderContentMustBeRehashedByLineageTooling: true
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function qualifiedPublicationCandidatesForParent(providerEvidence = {}, parentRecord = {}) {
|
|
49
|
+
const markdown = String(parentRecord?.markdown || '');
|
|
50
|
+
if (!markdown) return Object.freeze([]);
|
|
51
|
+
const expectedBytes = utf8Bytes(markdown);
|
|
52
|
+
const expectedSha256 = sha256Hex(expectedBytes);
|
|
53
|
+
const candidates = new Map();
|
|
54
|
+
for (const observation of providerEvidence.observations || []) {
|
|
55
|
+
for (const file of observation.files || []) {
|
|
56
|
+
const source = file.source || {};
|
|
57
|
+
const repository = String(source.repository || '').trim();
|
|
58
|
+
const commit = String(source.commit || '').trim().toLowerCase();
|
|
59
|
+
const sourcePath = normalizePath(source.path || file.path || '');
|
|
60
|
+
if (!repository || !/^[0-9a-f]{40}$/.test(commit) || !sourcePath || typeof file.content !== 'string') continue;
|
|
61
|
+
const bytes = utf8Bytes(file.content);
|
|
62
|
+
const sha256 = sha256Hex(bytes);
|
|
63
|
+
if (bytes.byteLength !== expectedBytes.byteLength || sha256.toLowerCase() !== expectedSha256.toLowerCase()) continue;
|
|
64
|
+
const locator = `https://github.com/${repository}/blob/${commit}/${sourcePath}`;
|
|
65
|
+
candidates.set(locator, Object.freeze({
|
|
66
|
+
state: 'qualified',
|
|
67
|
+
locator,
|
|
68
|
+
actionId: String(observation.actionId || ''),
|
|
69
|
+
providerId: String(file.providerId || ''),
|
|
70
|
+
source: Object.freeze({ repository, commit, path: sourcePath }),
|
|
71
|
+
materialIdentity: Object.freeze({ state: 'qualified', sha256, bytes: bytes.byteLength })
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return Object.freeze([...candidates.values()].sort((a, b) => a.locator.localeCompare(b.locator)));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function addAcceptance(acceptance = {}, observations, references, findings, sourceKind) {
|
|
79
|
+
const actionId = String(acceptance?.actionId || '');
|
|
80
|
+
if (acceptance?.schema !== PORTABLE_HOST_ACTION_ACCEPTANCE_SCHEMA_ID) {
|
|
81
|
+
reject(actionId, 'publication-provider-acceptance-schema-invalid', references, findings, 'portable.lineage.publication-provider.acceptance-schema.invalid', 'Publication provider evidence must use the portable host-action acceptance contract.');
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (acceptance.status !== 'accepted') {
|
|
85
|
+
reject(actionId, 'publication-provider-receipt-rejected', references, findings, 'portable.lineage.publication-provider.acceptance-rejected', 'Rejected host/provider receipt material cannot qualify publication.');
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (String(acceptance.action || '') !== 'repository-read') {
|
|
89
|
+
reject(actionId, 'publication-provider-action-mismatch', references, findings, 'portable.lineage.publication-provider.action.invalid', 'Publication qualification accepts only an explicit repository-read host action receipt.', { action: String(acceptance.action || '') });
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const providerResponses = Array.isArray(acceptance.providerResponses) ? acceptance.providerResponses : [];
|
|
94
|
+
const files = [];
|
|
95
|
+
for (const response of providerResponses) {
|
|
96
|
+
for (const file of Array.isArray(response?.files) ? response.files : []) {
|
|
97
|
+
if (file?.sourceMode !== 'portable-host-repository' || !file?.source?.repository || file?.source?.remoteFetch !== true || typeof file?.content !== 'string') continue;
|
|
98
|
+
files.push(Object.freeze({
|
|
99
|
+
providerId: String(response.providerId || ''),
|
|
100
|
+
path: normalizePath(file.path || ''),
|
|
101
|
+
content: file.content,
|
|
102
|
+
source: Object.freeze({
|
|
103
|
+
repository: String(file.source.repository || ''),
|
|
104
|
+
ref: String(file.source.ref || ''),
|
|
105
|
+
commit: String(file.source.commit || ''),
|
|
106
|
+
path: normalizePath(file.source.path || file.path || ''),
|
|
107
|
+
authority: String(file.source.authority || ''),
|
|
108
|
+
remoteFetch: true
|
|
109
|
+
})
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (!files.length) {
|
|
114
|
+
reject(actionId, 'publication-provider-repository-material-missing', references, findings, 'portable.lineage.publication-provider.repository-material.missing', 'Accepted publication provider evidence did not contain repository-read UTF-8 material.');
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
references.push(Object.freeze({ actionId, status: 'accepted', reason: '' }));
|
|
119
|
+
observations.push(Object.freeze({ actionId, action: 'repository-read', sourceKind, files: Object.freeze(files) }));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function reject(actionId, reason, references, findings, code, message, detail = {}) {
|
|
123
|
+
references.push(Object.freeze({ actionId, status: 'rejected', reason }));
|
|
124
|
+
findings.push(portableFinding('error', code, message, { actionId, ...detail }));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function receiptInputs(input = {}) {
|
|
128
|
+
const out = [];
|
|
129
|
+
if (input.publicationProviderReceipt) out.push(input.publicationProviderReceipt);
|
|
130
|
+
if (Array.isArray(input.publicationProviderReceipts)) out.push(...input.publicationProviderReceipts);
|
|
131
|
+
return out.filter(Boolean);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function acceptanceInputs(input = {}) {
|
|
135
|
+
const out = [];
|
|
136
|
+
if (input.publicationProviderAcceptance) out.push(input.publicationProviderAcceptance);
|
|
137
|
+
if (Array.isArray(input.publicationProviderAcceptances)) out.push(...input.publicationProviderAcceptances);
|
|
138
|
+
return out.filter(Boolean);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function normalizePath(value = '') { return String(value || '').replace(/\\/g, '/').replace(/^\.\//, '').replace(/\/{2,}/g, '/'); }
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { sha256Hex, utf8Bytes } from '../../../export/package.bytes.js';
|
|
2
|
+
|
|
3
|
+
export function classifyPortablePublicationOrigin(parentEnvelope = {}, childRecord = {}, parentRecord = null, providerEvidence = {}) {
|
|
4
|
+
const entries = Array.isArray(parentEnvelope.originEntries) ? parentEnvelope.originEntries : [];
|
|
5
|
+
const relative = entries.filter((entry) => String(entry.label || '') === 'relative');
|
|
6
|
+
const browse = entries.filter((entry) => String(entry.label || '') === 'browse + git');
|
|
7
|
+
if (relative.length > 1 || browse.length > 1) return publicationState('contradictory', 'duplicate-parent-origin-representation', browse[0]?.target || '', { locatorState: 'contradictory', evidenceState: 'rejected' });
|
|
8
|
+
if (relative.length === 1 && parentEnvelope.trace && String(relative[0].target || '') !== String(parentEnvelope.trace || '')) return publicationState('contradictory', 'relative-origin-disagrees-with-trace', browse[0]?.target || '', { locatorState: 'contradictory', evidenceState: 'rejected' });
|
|
9
|
+
if (!browse.length) {
|
|
10
|
+
const localTarget = String(relative[0]?.target || parentEnvelope.trace || '');
|
|
11
|
+
if (relative.length === 1 && localTarget && parentRecord?.markdown) return publicationState('qualified-local-relative', 'exact-loaded-parent-via-declared-relative-origin', localTarget, { locatorState: 'declared-relative-local', evidenceState: 'exact-loaded-parent' });
|
|
12
|
+
return publicationState('missing', 'browse-git-origin-missing', '', { locatorState: 'missing', evidenceState: 'not-applicable' });
|
|
13
|
+
}
|
|
14
|
+
const locator = String(browse[0].target || '');
|
|
15
|
+
if (!locator) return publicationState('unresolved', 'browse-git-origin-empty', '', { locatorState: 'empty', evidenceState: 'missing' });
|
|
16
|
+
|
|
17
|
+
const locatorState = declaredPublicationLocatorState(locator);
|
|
18
|
+
const qualification = qualifyPublicationEvidence({ locator, parentRecord, childRecord, providerEvidence });
|
|
19
|
+
if (locatorState === 'mutable-or-noncanonical-github-blob') return publicationState('stale', 'mutable-or-noncanonical-github-blob', locator, { locatorState, evidenceState: qualification.state, evidence: qualification.evidence, providerRequirement: providerRequirement(locator, parentRecord, true) });
|
|
20
|
+
if (qualification.state === 'qualified') return publicationState('qualified', 'accepted-provider-publication-material', locator, { locatorState, evidenceState: 'qualified', evidence: qualification.evidence, providerRequirement: providerRequirement(locator, parentRecord, false) });
|
|
21
|
+
if (qualification.state === 'contradictory') return publicationState('contradictory', qualification.reason, locator, { locatorState, evidenceState: 'rejected', evidence: qualification.evidence, providerRequirement: providerRequirement(locator, parentRecord, true) });
|
|
22
|
+
if (locatorState === 'commit-pinned-github-blob') return publicationState('unresolved', qualification.reason || 'publication-provider-receipt-required', locator, { locatorState, evidenceState: qualification.state, evidence: qualification.evidence, providerRequirement: providerRequirement(locator, parentRecord, true) });
|
|
23
|
+
if (/^https?:\/\//i.test(locator)) return publicationState('unresolved', qualification.reason || 'publication-locator-not-independently-qualified', locator, { locatorState, evidenceState: qualification.state, evidence: qualification.evidence, providerRequirement: providerRequirement(locator, parentRecord, true) });
|
|
24
|
+
return publicationState('unresolved', 'publication-locator-unsupported', locator, { locatorState, evidenceState: qualification.state, evidence: qualification.evidence, providerRequirement: providerRequirement(locator, parentRecord, true) });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function qualifyPublicationEvidence({ locator = '', parentRecord = null, childRecord = {}, providerEvidence = {} } = {}) {
|
|
28
|
+
const recordEvidence = inspectRecordPublicationEvidence({ locator, parentRecord, childRecord });
|
|
29
|
+
if (recordEvidence.state === 'contradictory') return recordEvidence;
|
|
30
|
+
if (!parentRecord?.markdown) return Object.freeze({ state: 'unresolved', reason: 'publication-parent-material-unavailable', evidence: recordEvidence.evidence || null });
|
|
31
|
+
|
|
32
|
+
const locatorIdentity = parseGithubBlobLocator(locator);
|
|
33
|
+
if (!locatorIdentity) return Object.freeze({ state: recordEvidence.state, reason: recordEvidence.reason || 'publication-provider-receipt-required', evidence: recordEvidence.evidence || null });
|
|
34
|
+
|
|
35
|
+
const eligible = eligibleProviderObservations(providerEvidence, recordEvidence.receiptReference);
|
|
36
|
+
if (recordEvidence.receiptReference && !eligible.length) {
|
|
37
|
+
const reference = (providerEvidence.references || []).find((entry) => entry.actionId === recordEvidence.receiptReference);
|
|
38
|
+
return Object.freeze({
|
|
39
|
+
state: 'unresolved',
|
|
40
|
+
reason: reference?.reason || 'publication-evidence-receipt-reference-unresolved',
|
|
41
|
+
evidence: recordEvidence.evidence || null
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const parentBytes = utf8Bytes(parentRecord.markdown || '');
|
|
46
|
+
const parentSha256 = sha256Hex(parentBytes);
|
|
47
|
+
for (const observation of eligible) {
|
|
48
|
+
for (const file of observation.files || []) {
|
|
49
|
+
const source = file.source || {};
|
|
50
|
+
const repository = String(source.repository || '');
|
|
51
|
+
const commit = String(source.commit || '').toLowerCase();
|
|
52
|
+
const sourcePath = normalizePath(source.path || file.path || '');
|
|
53
|
+
if (repository !== locatorIdentity.repository || commit !== locatorIdentity.commit || sourcePath !== locatorIdentity.path) continue;
|
|
54
|
+
const providerBytes = utf8Bytes(file.content || '');
|
|
55
|
+
const providerSha256 = sha256Hex(providerBytes);
|
|
56
|
+
if (providerSha256.toLowerCase() !== parentSha256.toLowerCase() || providerBytes.byteLength !== parentBytes.byteLength) {
|
|
57
|
+
return Object.freeze({ state: 'contradictory', reason: 'publication-provider-material-mismatch', evidence: summarizeProviderEvidence(locator, observation, file, providerSha256, providerBytes.byteLength) });
|
|
58
|
+
}
|
|
59
|
+
return Object.freeze({ state: 'qualified', reason: '', evidence: summarizeProviderEvidence(locator, observation, file, providerSha256, providerBytes.byteLength) });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (recordEvidence.receiptReference && eligible.length) return Object.freeze({ state: 'contradictory', reason: 'publication-provider-identity-mismatch', evidence: recordEvidence.evidence || null });
|
|
64
|
+
return Object.freeze({ state: 'unresolved', reason: 'publication-provider-receipt-required', evidence: recordEvidence.evidence || null });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function inspectRecordPublicationEvidence({ locator = '', parentRecord = null, childRecord = {} } = {}) {
|
|
68
|
+
const candidates = publicationEvidenceCandidates(parentRecord, childRecord);
|
|
69
|
+
if (!candidates.length) return Object.freeze({ state: 'missing', reason: 'publication-provider-receipt-required', evidence: null, receiptReference: '' });
|
|
70
|
+
for (const supplied of candidates) {
|
|
71
|
+
const evidence = supplied?.evidence || supplied?.resolutionEvidence || null;
|
|
72
|
+
if (!evidence || typeof evidence !== 'object') continue;
|
|
73
|
+
const summary = summarizePublicationEvidence(evidence, supplied);
|
|
74
|
+
const evidenceTarget = summary.target;
|
|
75
|
+
const evidenceState = summary.state;
|
|
76
|
+
const receiptReference = publicationEvidenceReceiptReference(evidence, supplied);
|
|
77
|
+
if (evidenceTarget && evidenceTarget !== locator) return Object.freeze({ state: 'contradictory', reason: 'publication-evidence-target-mismatch', evidence: summary, receiptReference });
|
|
78
|
+
if (evidenceState !== 'qualified') continue;
|
|
79
|
+
if (!parentRecord?.markdown) return Object.freeze({ state: 'unresolved', reason: 'publication-parent-material-unavailable', evidence: summary, receiptReference });
|
|
80
|
+
|
|
81
|
+
const identity = evidence.materialIdentity || evidence.material || {};
|
|
82
|
+
const actualBytes = utf8Bytes(parentRecord.markdown || '');
|
|
83
|
+
const actualSha256 = sha256Hex(actualBytes);
|
|
84
|
+
if (String(identity.state || '') === 'qualified' && String(identity.sha256 || '')) {
|
|
85
|
+
if (String(identity.sha256 || '').toLowerCase() !== actualSha256.toLowerCase()) return Object.freeze({ state: 'contradictory', reason: 'publication-evidence-material-sha256-mismatch', evidence: summary, receiptReference });
|
|
86
|
+
if (identity.bytes !== undefined && Number(identity.bytes) !== actualBytes.byteLength) return Object.freeze({ state: 'contradictory', reason: 'publication-evidence-material-bytes-mismatch', evidence: summary, receiptReference });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const locatorIdentity = parseGithubBlobLocator(locator);
|
|
90
|
+
const source = evidence.source || evidence.providerSource || evidence.provider || {};
|
|
91
|
+
if (source && typeof source === 'object' && Object.keys(source).length && locatorIdentity) {
|
|
92
|
+
const repository = String(source.repository || source.repo || '');
|
|
93
|
+
const commit = String(source.commit || source.ref || '');
|
|
94
|
+
const sourcePath = normalizePath(source.path || source.repositoryPath || '');
|
|
95
|
+
if (repository !== locatorIdentity.repository || commit.toLowerCase() !== locatorIdentity.commit || sourcePath !== locatorIdentity.path) return Object.freeze({ state: 'contradictory', reason: 'publication-evidence-provider-identity-mismatch', evidence: summary, receiptReference });
|
|
96
|
+
}
|
|
97
|
+
return Object.freeze({ state: 'unresolved', reason: 'publication-provider-receipt-required', evidence: summary, receiptReference });
|
|
98
|
+
}
|
|
99
|
+
return Object.freeze({ state: 'unresolved', reason: 'publication-provider-receipt-required', evidence: null, receiptReference: '' });
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function eligibleProviderObservations(providerEvidence = {}, receiptReference = '') {
|
|
103
|
+
const observations = Array.isArray(providerEvidence.observations) ? providerEvidence.observations : [];
|
|
104
|
+
if (!receiptReference) return observations;
|
|
105
|
+
return observations.filter((entry) => String(entry.actionId || '') === receiptReference);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function publicationEvidenceCandidates(parentRecord = null, childRecord = {}) {
|
|
109
|
+
return [
|
|
110
|
+
parentRecord?.publishedReference,
|
|
111
|
+
parentRecord?.publicationEvidence,
|
|
112
|
+
childRecord?.parentPublishedReference,
|
|
113
|
+
childRecord?.parentPublicationEvidence
|
|
114
|
+
].filter((value) => value && typeof value === 'object');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function publicationEvidenceReceiptReference(evidence = {}, supplied = {}) {
|
|
118
|
+
return String(evidence.receiptRef || evidence.providerReceiptRef || evidence.hostActionId || evidence.actionId || supplied.receiptRef || supplied.providerReceiptRef || supplied.hostActionId || supplied.actionId || '');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function summarizePublicationEvidence(evidence = {}, supplied = {}) {
|
|
122
|
+
const identity = evidence.materialIdentity || evidence.material || {};
|
|
123
|
+
const source = evidence.source || evidence.providerSource || evidence.provider || {};
|
|
124
|
+
return Object.freeze({
|
|
125
|
+
target: String(evidence.target || supplied.target || supplied.url || ''),
|
|
126
|
+
state: String(evidence.state || evidence.resolutionState || supplied.state || supplied.resolutionState || ''),
|
|
127
|
+
kind: String(evidence.kind || ''),
|
|
128
|
+
receiptReference: publicationEvidenceReceiptReference(evidence, supplied),
|
|
129
|
+
source: Object.freeze({ repository: String(source.repository || source.repo || ''), commit: String(source.commit || source.ref || ''), path: normalizePath(source.path || source.repositoryPath || ''), target: String(source.target || source.url || '') }),
|
|
130
|
+
materialIdentity: Object.freeze({ state: String(identity.state || ''), sha256: String(identity.sha256 || ''), bytes: identity.bytes === undefined ? null : Number(identity.bytes) })
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function summarizeProviderEvidence(locator, observation = {}, file = {}, sha256 = '', bytes = 0) {
|
|
135
|
+
const source = file.source || {};
|
|
136
|
+
return Object.freeze({
|
|
137
|
+
target: locator,
|
|
138
|
+
state: 'qualified',
|
|
139
|
+
kind: 'accepted-provider-material',
|
|
140
|
+
receiptReference: String(observation.actionId || ''),
|
|
141
|
+
providerId: String(file.providerId || ''),
|
|
142
|
+
source: Object.freeze({ repository: String(source.repository || ''), commit: String(source.commit || ''), path: normalizePath(source.path || file.path || ''), target: locator }),
|
|
143
|
+
materialIdentity: Object.freeze({ state: 'qualified', sha256, bytes: Number(bytes) })
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function providerRequirement(locator = '', parentRecord = null, required = true) {
|
|
148
|
+
const parsed = parseGithubBlobLocator(locator);
|
|
149
|
+
const markdown = String(parentRecord?.markdown || '');
|
|
150
|
+
const bytes = markdown ? utf8Bytes(markdown) : new Uint8Array();
|
|
151
|
+
return Object.freeze({
|
|
152
|
+
required,
|
|
153
|
+
mode: 'host-mediated',
|
|
154
|
+
action: parsed ? 'repositoryRead' : 'sourceRead',
|
|
155
|
+
target: String(locator || ''),
|
|
156
|
+
expected: Object.freeze({
|
|
157
|
+
repository: parsed?.repository || '',
|
|
158
|
+
commit: parsed?.commit || '',
|
|
159
|
+
path: parsed?.path || '',
|
|
160
|
+
materialSha256: markdown ? sha256Hex(bytes) : '',
|
|
161
|
+
materialBytes: markdown ? bytes.byteLength : 0
|
|
162
|
+
}),
|
|
163
|
+
remoteFetchPerformed: false,
|
|
164
|
+
remoteWriteAuthorized: false
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function declaredPublicationLocatorState(locator = '') {
|
|
169
|
+
if (isCommitPinnedGithubBlob(locator)) return 'commit-pinned-github-blob';
|
|
170
|
+
if (/^https:\/\/github\.com\/[^/]+\/[^/]+\/blob\//i.test(locator)) return 'mutable-or-noncanonical-github-blob';
|
|
171
|
+
if (/^https?:\/\//i.test(locator)) return 'declared-http-locator';
|
|
172
|
+
return 'unsupported-locator';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function parseGithubBlobLocator(value = '') {
|
|
176
|
+
const match = String(value || '').match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/blob\/([0-9a-f]{40})\/(.+)$/i);
|
|
177
|
+
if (!match) return null;
|
|
178
|
+
return Object.freeze({ repository: `${match[1]}/${match[2]}`, commit: match[3].toLowerCase(), path: normalizePath(match[4]) });
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function normalizePath(value = '') { return String(value || '').replace(/\\/g, '/').replace(/^\.\//, '').replace(/\/{2,}/g, '/'); }
|
|
182
|
+
function publicationState(value, reason = '', locator = '', details = {}) { return Object.freeze({ state: value, reason, locator, locatorState: String(details.locatorState || ''), evidenceState: String(details.evidenceState || ''), evidence: details.evidence || null, providerRequirement: details.providerRequirement || null }); }
|
|
183
|
+
function isCommitPinnedGithubBlob(value = '') { return /^https:\/\/github\.com\/[^/]+\/[^/]+\/blob\/[0-9a-f]{40}\//i.test(String(value || '')); }
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { runAudit } from '../../../audit/audit.run.js';
|
|
2
|
+
import { resolveLineage } from '../../../lineage/lineage.resolve.js';
|
|
3
|
+
import { LineageResolutionStatus } from '../../../lineage/lineage.model.js';
|
|
4
|
+
import { traverseLoadedLineage } from '../../../lineage/lineage.traverse.js';
|
|
5
|
+
import { normalizePortableInput } from '../input/portable.input.js';
|
|
6
|
+
import { portableFinding } from '../findings.js';
|
|
7
|
+
import { portableRuntimeValidationContractForSchema } from '../schema/qualifiedLocalRoot.runtime.js';
|
|
8
|
+
|
|
9
|
+
export const PORTABLE_LINEAGE_SEARCH_SCHEMA_ID = 'tiinex.portable.lineage-search.v1';
|
|
10
|
+
|
|
11
|
+
export function searchPortableLineage(input = {}, options = {}) {
|
|
12
|
+
const material = normalizePortableInput(input.materials || input);
|
|
13
|
+
const query = String(input.query ?? options.query ?? '').trim();
|
|
14
|
+
const filters = normalizeFilters(input.filters || options.filters || legacyFilterInput(input));
|
|
15
|
+
const resolved = resolveLineage(material.records, { depth: 'loaded-portable-search' });
|
|
16
|
+
const scopedIds = resolveScopeIds(material.records, resolved, input, options);
|
|
17
|
+
const relationIndex = buildRelationIndex(resolved);
|
|
18
|
+
const audits = needsAudits(filters) ? new Map(material.records.map((record) => {
|
|
19
|
+
const runtimeProjection = portableRuntimeValidationContractForSchema(record.schemaId || record.currentSchemaId || '');
|
|
20
|
+
return [record.id, runAudit({ record, markdown: record.markdown, validationContractOverride: runtimeProjection.state === 'qualified' ? runtimeProjection.compiledContract : null })];
|
|
21
|
+
})) : new Map();
|
|
22
|
+
const candidates = material.records.filter((record) => !scopedIds || scopedIds.has(record.id));
|
|
23
|
+
const matches = [];
|
|
24
|
+
for (const record of candidates) {
|
|
25
|
+
const node = resolved.nodes.find((item) => item.id === record.id) || {};
|
|
26
|
+
const audit = audits.get(record.id) || null;
|
|
27
|
+
const relation = relationIndex.get(record.id) || { root: false, leaf: false, parents: [], children: [] };
|
|
28
|
+
if (!matchesFilters(record, node, audit, relation, filters)) continue;
|
|
29
|
+
const score = queryScore(record, node, query, filters.searchFields);
|
|
30
|
+
if (query && score <= 0) continue;
|
|
31
|
+
matches.push(buildMatch(record, node, audit, relation, score, query, filters));
|
|
32
|
+
}
|
|
33
|
+
matches.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
34
|
+
const limited = matches.slice(filters.offset, filters.offset + filters.limit);
|
|
35
|
+
const findings = [...material.findings];
|
|
36
|
+
if (!query && !hasActiveFilters(filters)) findings.push(portableFinding('info', 'portable.lineage-search.unfiltered', 'No query or restrictive filter was supplied; all loaded lineage records are eligible.'));
|
|
37
|
+
return Object.freeze({
|
|
38
|
+
schema: PORTABLE_LINEAGE_SEARCH_SCHEMA_ID,
|
|
39
|
+
boundary: Object.freeze({
|
|
40
|
+
material: 'loaded-only',
|
|
41
|
+
remoteFetch: false,
|
|
42
|
+
inferredEdges: false,
|
|
43
|
+
fullTextFields: Object.freeze(filters.searchFields)
|
|
44
|
+
}),
|
|
45
|
+
query,
|
|
46
|
+
filters,
|
|
47
|
+
scope: Object.freeze({
|
|
48
|
+
mode: String(input.scope || options.scope || (scopedIds ? 'traversal' : 'all-loaded')),
|
|
49
|
+
startIds: Object.freeze(normalizeList(input.startIds || input.startId || options.startIds || options.startId)),
|
|
50
|
+
eligibleRecords: candidates.length
|
|
51
|
+
}),
|
|
52
|
+
matches: Object.freeze(limited),
|
|
53
|
+
page: Object.freeze({ offset: filters.offset, limit: filters.limit, returned: limited.length, total: matches.length }),
|
|
54
|
+
facets: buildFacets(matches),
|
|
55
|
+
findings: Object.freeze(findings)
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function resolveScopeIds(records, resolved, input, options) {
|
|
60
|
+
const startIds = normalizeList(input.startIds || input.startId || options.startIds || options.startId);
|
|
61
|
+
const scope = String(input.scope || options.scope || '').toLowerCase();
|
|
62
|
+
if (!startIds.length && !['ancestors', 'descendants', 'both', 'traversal'].includes(scope)) return null;
|
|
63
|
+
if (!startIds.length) return null;
|
|
64
|
+
const traversal = traverseLoadedLineage(records, {
|
|
65
|
+
resolvedLineage: resolved,
|
|
66
|
+
startIds,
|
|
67
|
+
direction: scope === 'descendants' ? 'descendants' : scope === 'both' ? 'both' : 'ancestors',
|
|
68
|
+
maxDepth: Number(input.maxDepth ?? options.maxDepth ?? 16)
|
|
69
|
+
});
|
|
70
|
+
return new Set((traversal.nodes || []).map((node) => node.id));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const TOPOLOGICAL_PARENT_EDGE_STATUSES = new Set([
|
|
74
|
+
LineageResolutionStatus.resolved,
|
|
75
|
+
LineageResolutionStatus.verified,
|
|
76
|
+
LineageResolutionStatus.probable,
|
|
77
|
+
LineageResolutionStatus.mismatch
|
|
78
|
+
]);
|
|
79
|
+
|
|
80
|
+
function buildRelationIndex(resolved = {}) {
|
|
81
|
+
const map = new Map((resolved.nodes || []).map((node) => [node.id, { root: true, leaf: true, parents: [], children: [] }]));
|
|
82
|
+
for (const edge of resolved.edges || []) {
|
|
83
|
+
if (edge.kind !== 'parent' || !TOPOLOGICAL_PARENT_EDGE_STATUSES.has(edge.status) || !edge.from || !edge.to) continue;
|
|
84
|
+
const parent = map.get(edge.from);
|
|
85
|
+
const child = map.get(edge.to);
|
|
86
|
+
if (parent && child) {
|
|
87
|
+
parent.leaf = false;
|
|
88
|
+
child.root = false;
|
|
89
|
+
parent.children.push(edge.to);
|
|
90
|
+
child.parents.push(edge.from);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return map;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function matchesFilters(record, node, audit, relation, filters) {
|
|
97
|
+
if (filters.schemaIds.length && !filters.schemaIds.includes(String(record.schemaId || node.schemaId || ''))) return false;
|
|
98
|
+
if (filters.parentSchemaIds.length && !filters.parentSchemaIds.includes(String(record.parentSchemaId || node.parentSchemaId || ''))) return false;
|
|
99
|
+
if (filters.sourceModes.length && !filters.sourceModes.includes(String(record.sourceMode || node.sourceMode || ''))) return false;
|
|
100
|
+
if (filters.paths.length && !filters.paths.some((prefix) => String(record.path || '').toLowerCase().startsWith(prefix.toLowerCase()))) return false;
|
|
101
|
+
if (filters.hasIntegrity !== null && Boolean(record.hasIntegrity ?? node.hasIntegrity) !== filters.hasIntegrity) return false;
|
|
102
|
+
if (filters.hasContinuityContext !== null && Boolean(record.hasContinuityContext ?? node.hasContinuityContext) !== filters.hasContinuityContext) return false;
|
|
103
|
+
if (filters.relation === 'root' && !relation.root) return false;
|
|
104
|
+
if (filters.relation === 'leaf' && !relation.leaf) return false;
|
|
105
|
+
if (filters.relation === 'intermediate' && (relation.root || relation.leaf)) return false;
|
|
106
|
+
if (filters.findingSeverities.length) {
|
|
107
|
+
const severities = new Set((audit?.findings || []).map((finding) => String(finding.severity || 'info')));
|
|
108
|
+
if (!filters.findingSeverities.some((severity) => severities.has(severity))) return false;
|
|
109
|
+
}
|
|
110
|
+
if (filters.qualification.length) {
|
|
111
|
+
const status = auditQualification(audit);
|
|
112
|
+
if (!filters.qualification.includes(status)) return false;
|
|
113
|
+
}
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function queryScore(record, node, query, fields) {
|
|
118
|
+
if (!query) return 1;
|
|
119
|
+
const tokens = tokenize(query);
|
|
120
|
+
if (!tokens.length) return 1;
|
|
121
|
+
const values = searchValues(record, node, fields);
|
|
122
|
+
let score = 0;
|
|
123
|
+
for (const token of tokens) {
|
|
124
|
+
let best = 0;
|
|
125
|
+
for (const entry of values) {
|
|
126
|
+
if (!entry.value.includes(token)) continue;
|
|
127
|
+
const exact = entry.value === token ? 3 : entry.value.startsWith(token) ? 2 : 1;
|
|
128
|
+
best = Math.max(best, exact * entry.weight);
|
|
129
|
+
}
|
|
130
|
+
if (!best) return 0;
|
|
131
|
+
score += best;
|
|
132
|
+
}
|
|
133
|
+
return score;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function searchValues(record, node, fields) {
|
|
137
|
+
const enabled = new Set(fields);
|
|
138
|
+
const values = [];
|
|
139
|
+
const add = (field, value, weight) => {
|
|
140
|
+
if (!enabled.has(field)) return;
|
|
141
|
+
const normalized = normalizeText(value);
|
|
142
|
+
if (normalized) values.push({ field, value: normalized, weight });
|
|
143
|
+
};
|
|
144
|
+
add('title', record.title || node.title, 8);
|
|
145
|
+
add('summary', record.summary, 6);
|
|
146
|
+
add('path', record.path || node.path, 5);
|
|
147
|
+
add('schema', record.schemaId || node.schemaId, 5);
|
|
148
|
+
add('body', record.markdown, 2);
|
|
149
|
+
add('origin', record.origin || node.origin, 3);
|
|
150
|
+
add('trace', record.trace || node.trace, 3);
|
|
151
|
+
add('source', [record.sourceMode, record.source?.label, record.source?.path, record.source?.boundary].filter(Boolean).join(' '), 3);
|
|
152
|
+
return values;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function buildMatch(record, node, audit, relation, score, query, filters) {
|
|
156
|
+
return Object.freeze({
|
|
157
|
+
id: record.id,
|
|
158
|
+
path: record.path || '',
|
|
159
|
+
title: record.title || node.title || record.id,
|
|
160
|
+
summary: record.summary || '',
|
|
161
|
+
schemaId: record.schemaId || node.schemaId || '',
|
|
162
|
+
parentSchemaId: record.parentSchemaId || node.parentSchemaId || '',
|
|
163
|
+
sourceMode: record.sourceMode || node.sourceMode || '',
|
|
164
|
+
relation: Object.freeze({ root: relation.root, leaf: relation.leaf, parents: Object.freeze(relation.parents), children: Object.freeze(relation.children) }),
|
|
165
|
+
integrity: Boolean(record.hasIntegrity ?? node.hasIntegrity),
|
|
166
|
+
continuity: Boolean(record.hasContinuityContext ?? node.hasContinuityContext),
|
|
167
|
+
qualification: audit ? auditQualification(audit) : 'not-evaluated',
|
|
168
|
+
findingSummary: audit ? summarizeFindings(audit.findings || []) : null,
|
|
169
|
+
score,
|
|
170
|
+
snippet: buildSnippet(record, query, filters.snippetChars)
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function auditQualification(audit = null) {
|
|
175
|
+
if (!audit) return 'not-evaluated';
|
|
176
|
+
if (audit.resolution?.fallbackUsed) return 'fallback';
|
|
177
|
+
if ((audit.findings || []).some((finding) => finding.code === 'audit.validator.unavailable')) return 'partial';
|
|
178
|
+
return 'exact';
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function buildSnippet(record, query, maxChars) {
|
|
182
|
+
const source = String(record.summary || record.markdown || '').replace(/\s+/g, ' ').trim();
|
|
183
|
+
if (!source) return '';
|
|
184
|
+
const token = tokenize(query)[0] || '';
|
|
185
|
+
const lower = source.toLowerCase();
|
|
186
|
+
const index = token ? lower.indexOf(token) : 0;
|
|
187
|
+
const start = Math.max(0, index - Math.floor(maxChars / 3));
|
|
188
|
+
const snippet = source.slice(start, start + maxChars).trim();
|
|
189
|
+
return `${start > 0 ? '…' : ''}${snippet}${start + maxChars < source.length ? '…' : ''}`;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function buildFacets(matches = []) {
|
|
193
|
+
return Object.freeze({
|
|
194
|
+
schemas: countBy(matches, (item) => item.schemaId || 'unknown'),
|
|
195
|
+
sourceModes: countBy(matches, (item) => item.sourceMode || 'unknown'),
|
|
196
|
+
relation: Object.freeze({
|
|
197
|
+
roots: matches.filter((item) => item.relation.root).length,
|
|
198
|
+
leaves: matches.filter((item) => item.relation.leaf).length,
|
|
199
|
+
intermediate: matches.filter((item) => !item.relation.root && !item.relation.leaf).length
|
|
200
|
+
}),
|
|
201
|
+
qualification: countBy(matches, (item) => item.qualification)
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function countBy(items, keyFn) {
|
|
206
|
+
const counts = {};
|
|
207
|
+
for (const item of items) {
|
|
208
|
+
const key = String(keyFn(item) || 'unknown');
|
|
209
|
+
counts[key] = (counts[key] || 0) + 1;
|
|
210
|
+
}
|
|
211
|
+
return Object.freeze(Object.fromEntries(Object.entries(counts).sort(([a], [b]) => a.localeCompare(b))));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function summarizeFindings(findings = []) {
|
|
215
|
+
const counts = { error: 0, warning: 0, info: 0 };
|
|
216
|
+
for (const finding of findings) counts[finding.severity === 'error' ? 'error' : finding.severity === 'warning' ? 'warning' : 'info'] += 1;
|
|
217
|
+
return Object.freeze({ ...counts, total: counts.error + counts.warning + counts.info });
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function legacyFilterInput(input = {}) {
|
|
221
|
+
const materialPayloadPresent = Boolean(input.materials || input.markdown || input.files || input.records || input.assets);
|
|
222
|
+
return Object.freeze({
|
|
223
|
+
schemaIds: input.schemaIds || input.schemaId,
|
|
224
|
+
parentSchemaIds: input.parentSchemaIds || input.parentSchemaId,
|
|
225
|
+
sourceModes: input.sourceModes || (!materialPayloadPresent ? input.sourceMode : undefined),
|
|
226
|
+
paths: input.paths || input.pathPrefix,
|
|
227
|
+
relation: input.relation || input.lineageRole,
|
|
228
|
+
hasIntegrity: input.hasIntegrity,
|
|
229
|
+
hasContinuityContext: input.hasContinuityContext,
|
|
230
|
+
findingSeverities: input.findingSeverities || input.findingSeverity,
|
|
231
|
+
qualification: input.qualification,
|
|
232
|
+
searchFields: input.searchFields,
|
|
233
|
+
snippetChars: input.snippetChars,
|
|
234
|
+
offset: input.offset,
|
|
235
|
+
limit: input.limit
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function normalizeFilters(raw = {}) {
|
|
240
|
+
return Object.freeze({
|
|
241
|
+
schemaIds: Object.freeze(normalizeList(raw.schemaIds || raw.schemaId)),
|
|
242
|
+
parentSchemaIds: Object.freeze(normalizeList(raw.parentSchemaIds || raw.parentSchemaId)),
|
|
243
|
+
sourceModes: Object.freeze(normalizeList(raw.sourceModes || raw.sourceMode)),
|
|
244
|
+
paths: Object.freeze(normalizeList(raw.paths || raw.pathPrefix)),
|
|
245
|
+
relation: normalizeRelation(raw.relation || raw.lineageRole),
|
|
246
|
+
hasIntegrity: normalizeBooleanFilter(raw.hasIntegrity),
|
|
247
|
+
hasContinuityContext: normalizeBooleanFilter(raw.hasContinuityContext),
|
|
248
|
+
findingSeverities: Object.freeze(normalizeList(raw.findingSeverities || raw.findingSeverity).map((value) => value.toLowerCase())),
|
|
249
|
+
qualification: Object.freeze(normalizeList(raw.qualification).map((value) => value.toLowerCase())),
|
|
250
|
+
searchFields: Object.freeze(normalizeSearchFields(raw.searchFields)),
|
|
251
|
+
snippetChars: normalizeInteger(raw.snippetChars, 280, 80, 2000),
|
|
252
|
+
offset: normalizeInteger(raw.offset, 0, 0, 100000),
|
|
253
|
+
limit: normalizeInteger(raw.limit, 50, 1, 500)
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function normalizeSearchFields(value) {
|
|
258
|
+
const allowed = new Set(['title', 'summary', 'path', 'schema', 'body', 'origin', 'trace', 'source']);
|
|
259
|
+
const selected = normalizeList(value).filter((field) => allowed.has(field));
|
|
260
|
+
return selected.length ? selected : ['title', 'summary', 'path', 'schema', 'body', 'origin', 'trace', 'source'];
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function normalizeRelation(value = '') {
|
|
264
|
+
const relation = String(value || '').toLowerCase();
|
|
265
|
+
return ['root', 'leaf', 'intermediate'].includes(relation) ? relation : '';
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function normalizeBooleanFilter(value) {
|
|
269
|
+
if (value === true || value === false) return value;
|
|
270
|
+
const normalized = String(value ?? '').toLowerCase();
|
|
271
|
+
if (['true', 'yes', '1'].includes(normalized)) return true;
|
|
272
|
+
if (['false', 'no', '0'].includes(normalized)) return false;
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function needsAudits(filters) {
|
|
277
|
+
return filters.findingSeverities.length > 0 || filters.qualification.length > 0;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function hasActiveFilters(filters) {
|
|
281
|
+
return Boolean(filters.schemaIds.length || filters.parentSchemaIds.length || filters.sourceModes.length || filters.paths.length || filters.relation || filters.hasIntegrity !== null || filters.hasContinuityContext !== null || filters.findingSeverities.length || filters.qualification.length);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function tokenize(value = '') {
|
|
285
|
+
return normalizeText(value).split(' ').filter(Boolean);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function normalizeText(value = '') {
|
|
289
|
+
return String(value || '').toLowerCase().normalize('NFKD').replace(/[\u0300-\u036f]/g, '').replace(/[^a-z0-9._:/-]+/g, ' ').replace(/\s+/g, ' ').trim();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function normalizeList(value) {
|
|
293
|
+
const list = Array.isArray(value) ? value : value ? String(value).split(',') : [];
|
|
294
|
+
return [...new Set(list.map((item) => String(item || '').trim()).filter(Boolean))];
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function normalizeInteger(value, fallback, min, max) {
|
|
298
|
+
const number = Number(value);
|
|
299
|
+
if (!Number.isFinite(number)) return fallback;
|
|
300
|
+
return Math.max(min, Math.min(max, Math.floor(number)));
|
|
301
|
+
}
|