@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,72 @@
|
|
|
1
|
+
import { posix } from 'node:path';
|
|
2
|
+
import { parseArtifactMarkdown } from '../../../artifacts/artifact.parse.js';
|
|
3
|
+
|
|
4
|
+
const MAX_PARENT_DEPTH = 6;
|
|
5
|
+
const CONTEXT_HEADINGS = Object.freeze([
|
|
6
|
+
Object.freeze({ kind: 'project', headings: Object.freeze(['Project Identity', 'Project Context']) }),
|
|
7
|
+
Object.freeze({ kind: 'organization', headings: Object.freeze(['Organization Identity', 'Organization Context']) })
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
export function projectQualifiedWorkTargetContext(target = {}, byPath = new Map()) {
|
|
11
|
+
const start = String(target.resolvedPath || '');
|
|
12
|
+
const chain = qualifiedContextChain(start, byPath);
|
|
13
|
+
const contexts = [];
|
|
14
|
+
for (let distance = 0; distance < chain.length; distance += 1) {
|
|
15
|
+
const record = chain[distance];
|
|
16
|
+
for (const definition of CONTEXT_HEADINGS) {
|
|
17
|
+
for (const heading of definition.headings) {
|
|
18
|
+
const text = section(record.markdown || '', heading);
|
|
19
|
+
if (!text) continue;
|
|
20
|
+
contexts.push(Object.freeze({
|
|
21
|
+
kind: definition.kind,
|
|
22
|
+
state: 'qualified-carried',
|
|
23
|
+
label: field(text, 'Name') || String(record.title || ''),
|
|
24
|
+
path: String(record.path || ''),
|
|
25
|
+
schemaId: String(record.schemaId || ''),
|
|
26
|
+
description: compact(field(text, 'Description') || text, 220),
|
|
27
|
+
declaredBoundary: compact(field(text, 'Boundary'), 180),
|
|
28
|
+
basis: Object.freeze({ kind: 'explicit-qualified-context-section', heading, targetPath: start, parentDistance: distance }),
|
|
29
|
+
membershipClaim: false
|
|
30
|
+
}));
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const project = contexts.find((item) => item.kind === 'project') || unresolved('project-context-unresolved', 'No explicit qualified project identity/context section was recoverable from the work target or its qualified direct Parent context.');
|
|
36
|
+
const organization = contexts.find((item) => item.kind === 'organization') || unresolved('organization-context-unresolved', 'No explicit qualified organization identity/context section was recoverable from the work target or its qualified direct Parent context.');
|
|
37
|
+
const qualifiedCount = Number(project.state === 'qualified-carried') + Number(organization.state === 'qualified-carried');
|
|
38
|
+
return Object.freeze({
|
|
39
|
+
state: qualifiedCount === 2 ? 'qualified' : qualifiedCount === 1 ? 'qualified-partial' : 'unresolved',
|
|
40
|
+
project,
|
|
41
|
+
organization,
|
|
42
|
+
contexts: Object.freeze(contexts),
|
|
43
|
+
boundary: 'Direct Parent continuity may be followed only to inspect already-declared qualified context. Parent is not reinterpreted as work provenance, project membership, organization membership, responsibility transfer, or controlling-work authority.'
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function qualifiedContextChain(startPath = '', byPath = new Map()) {
|
|
48
|
+
const out = [];
|
|
49
|
+
let path = startPath;
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
for (let depth = 0; depth < MAX_PARENT_DEPTH && path && !seen.has(path); depth += 1) {
|
|
52
|
+
seen.add(path);
|
|
53
|
+
const matches = byPath.get(path) || [];
|
|
54
|
+
if (matches.length !== 1) break;
|
|
55
|
+
const record = matches[0];
|
|
56
|
+
if (!record.hasContinuityContext || !record.hasIntegrity) break;
|
|
57
|
+
out.push(record);
|
|
58
|
+
let parsed;
|
|
59
|
+
try { parsed = parseArtifactMarkdown(record.markdown || ''); } catch { break; }
|
|
60
|
+
const parent = String(parsed?.envelope?.parent?.trace || '').trim();
|
|
61
|
+
if (!parent || /^[a-z][a-z0-9+.-]*:\/\//i.test(parent)) break;
|
|
62
|
+
path = resolvePath(parent, record.path || '');
|
|
63
|
+
}
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
66
|
+
function resolvePath(reference = '', ownerPath = '') { const raw = String(reference || '').split('#')[0].trim(); const cross = raw.match(/^([^:/\\]+)::(.+)$/); const candidate = cross ? `${cross[1]}/${cross[2].replace(/^\/+/, '')}` : raw.startsWith('/') ? raw.slice(1) : posix.join(posix.dirname(String(ownerPath || '')), raw); const normalized = posix.normalize(candidate).replace(/^\.\//, ''); return !normalized || normalized === '..' || normalized.startsWith('../') ? '' : normalized; }
|
|
67
|
+
function unresolved(code, detail) { return Object.freeze({ state: 'unresolved', code, detail, membershipClaim: false }); }
|
|
68
|
+
function section(markdown = '', heading = '') { const escaped = escape(heading); return String(markdown || '').match(new RegExp(`(?:^|\\n)##\\s+${escaped}\\s*\\r?\\n([\\s\\S]*?)(?=\\n##\\s+|\\n#\\s+Continuity Integrity|$)`, 'i'))?.[1]?.trim() || ''; }
|
|
69
|
+
function field(markdown = '', label = '') { const escaped = escape(label); return strip(String(markdown || '').match(new RegExp(`^\\s*-\\s+${escaped}:\\s*(.+)$`, 'mi'))?.[1] || ''); }
|
|
70
|
+
function strip(value = '') { return String(value || '').replace(/^\[([^\]]+)\]\([^)]+\)$/, '$1').replace(/[`*_]/g, '').trim(); }
|
|
71
|
+
function compact(value = '', limit = 220) { const text = strip(String(value || '').replace(/\s+/g, ' ')); return text.length > limit ? `${text.slice(0, limit - 1).trimEnd()}…` : text; }
|
|
72
|
+
function escape(value = '') { return String(value || '').replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); }
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { posix } from 'node:path';
|
|
2
|
+
import { parseArtifactMarkdown } from '../../../artifacts/artifact.parse.js';
|
|
3
|
+
import { relationValidate } from '../../../schemas/core/relation/tiinex.relation.v1.validate.js';
|
|
4
|
+
import { projectQualifiedWorkTargetContext } from './grounding.workContext.js';
|
|
5
|
+
|
|
6
|
+
const FAMILY = 'work-provenance';
|
|
7
|
+
const MAX_EDGES = 12;
|
|
8
|
+
|
|
9
|
+
export function projectWorkProvenance({ records = [], topology = {} } = {}) {
|
|
10
|
+
const byPath = recordIndex(records);
|
|
11
|
+
const edges = records.filter(isCandidate).map((record) => relationEdge(record, byPath)).filter(Boolean).slice(0, MAX_EDGES);
|
|
12
|
+
const frontierPaths = new Set((topology.currentFrontier || []).map((item) => String(item.path || '')).filter(Boolean));
|
|
13
|
+
const relevantPaths = new Set([
|
|
14
|
+
...(topology.relevantPaths || []),
|
|
15
|
+
...(topology.currentTasks || []).map((item) => String(item.path || '')),
|
|
16
|
+
...frontierPaths
|
|
17
|
+
].filter(Boolean));
|
|
18
|
+
const exactQualified = edges.filter((edge) => edge.state === 'qualified' && frontierPaths.has(edge.source.resolvedPath));
|
|
19
|
+
const lineageQualified = exactQualified.length ? [] : edges.filter((edge) => edge.state === 'qualified' && relevantPaths.has(edge.source.resolvedPath));
|
|
20
|
+
const selected = exactQualified.length ? exactQualified : lineageQualified;
|
|
21
|
+
const selectionState = exactQualified.length ? 'qualified' : lineageQualified.length ? 'qualified-relevant' : 'unresolved';
|
|
22
|
+
const unresolved = [];
|
|
23
|
+
|
|
24
|
+
if (!frontierPaths.size) unresolved.push(issue('organizational-work-provenance', 'current-work-anchor-unresolved', 'No current work frontier.'));
|
|
25
|
+
else if (!selected.length) {
|
|
26
|
+
const candidates = edges.filter((edge) => relevantPaths.has(edge.source.resolvedPath));
|
|
27
|
+
unresolved.push(issue('organizational-work-provenance', 'organizational-work-provenance-unresolved', candidates.length ? 'Declared work-provenance material on the selected lineage exists, but source/target qualification is unresolved.' : 'No qualified declared edge on current lineage.'));
|
|
28
|
+
} else {
|
|
29
|
+
if (!selected.some((edge) => edge.context?.project?.state === 'qualified-carried')) unresolved.push(issue('project-context', 'project-context-unresolved', 'Qualified work provenance is available, but no explicit qualified project identity/context is recoverable from its target context.'));
|
|
30
|
+
if (!selected.some((edge) => edge.context?.organization?.state === 'qualified-carried')) unresolved.push(issue('organization-context', 'organization-context-unresolved', 'Qualified work provenance is available, but no explicit qualified organization identity/context is recoverable from its target context.'));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!edges.length) return Object.freeze({
|
|
34
|
+
state: 'unresolved',
|
|
35
|
+
current: Object.freeze({ state: 'unresolved', sourceAnchors: Object.freeze([...frontierPaths]), relationSourceAnchors: Object.freeze([]), edges: Object.freeze([]) }),
|
|
36
|
+
context: Object.freeze({ state: 'unresolved', items: Object.freeze([]) }),
|
|
37
|
+
unresolved: Object.freeze(unresolved)
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return Object.freeze({
|
|
41
|
+
state: selectionState,
|
|
42
|
+
current: Object.freeze({
|
|
43
|
+
state: exactQualified.length ? 'qualified' : lineageQualified.length ? 'qualified-via-selected-lineage' : 'unresolved',
|
|
44
|
+
sourceAnchors: Object.freeze([...frontierPaths]),
|
|
45
|
+
relationSourceAnchors: Object.freeze(selected.map((edge) => edge.source.resolvedPath)),
|
|
46
|
+
edges: Object.freeze(selected),
|
|
47
|
+
basis: selected.length ? (exactQualified.length ? 'exact-qualified-frontier-source' : 'qualified-declared-relation-source-on-selected-parent-lineage') : 'unresolved'
|
|
48
|
+
}),
|
|
49
|
+
edges: Object.freeze(edges),
|
|
50
|
+
reverseDiscovery: reverseIndex(edges.filter((edge) => edge.state === 'qualified')),
|
|
51
|
+
context: contextProjection(selected, selectionState),
|
|
52
|
+
unresolved: Object.freeze(unresolved),
|
|
53
|
+
boundary: 'Declared qualified edges only; selected Parent lineage may establish relevance but never creates or redirects an edge; reverse discovery is the same edge.'
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function isCandidate(record = {}) {
|
|
58
|
+
return String(record.schemaId || '') === 'tiinex.relation.v1' && field(section(record.markdown, 'Relation Declaration'), 'Relation Family').toLowerCase() === FAMILY;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function relationEdge(record, byPath) {
|
|
62
|
+
const markdown = String(record.markdown || '');
|
|
63
|
+
let parsed;
|
|
64
|
+
try { parsed = parseArtifactMarkdown(markdown); } catch { return null; }
|
|
65
|
+
const findings = relationValidate(parsed);
|
|
66
|
+
const declaration = section(markdown, 'Relation Declaration');
|
|
67
|
+
const sourceRef = reference(section(markdown, 'Relation Source'), 'Source');
|
|
68
|
+
const targetRef = reference(section(markdown, 'Relation Target'), 'Target');
|
|
69
|
+
const source = resolveReference(sourceRef, record.path, byPath);
|
|
70
|
+
const target = resolveReference(targetRef, record.path, byPath);
|
|
71
|
+
const contractQualified = Boolean(record.hasContinuityContext && record.hasIntegrity && !findings.some((item) => item.severity === 'error'));
|
|
72
|
+
const state = contractQualified && source.state === 'qualified-carried' && target.state === 'qualified-carried' ? 'qualified' : 'unresolved';
|
|
73
|
+
const context = target.state === 'qualified-carried'
|
|
74
|
+
? projectQualifiedWorkTargetContext(target, byPath)
|
|
75
|
+
: Object.freeze({ state: 'unresolved', project: unresolvedContext('project-context-unresolved'), organization: unresolvedContext('organization-context-unresolved'), contexts: Object.freeze([]), boundary: 'Target context is unavailable until the declared relation target is qualified-carried.' });
|
|
76
|
+
return Object.freeze({
|
|
77
|
+
state,
|
|
78
|
+
relationFamily: FAMILY,
|
|
79
|
+
relationType: field(declaration, 'Relation Type'),
|
|
80
|
+
direction: field(declaration, 'Relation Direction'),
|
|
81
|
+
scope: field(declaration, 'Relation Scope'),
|
|
82
|
+
source,
|
|
83
|
+
target,
|
|
84
|
+
context,
|
|
85
|
+
basis: Object.freeze({ relationArtifact: String(record.path || ''), schemaId: String(record.schemaId || ''), contractState: contractQualified ? 'qualified-carried-contract' : 'unqualified', integrityPresent: Boolean(record.hasIntegrity) })
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function contextProjection(edges = [], state = 'unresolved') {
|
|
90
|
+
return Object.freeze({
|
|
91
|
+
state: edges.length ? (edges.every((edge) => edge.context?.state === 'qualified') ? 'qualified' : edges.some((edge) => edge.context?.state !== 'unresolved') ? 'qualified-partial' : 'unresolved') : 'unresolved',
|
|
92
|
+
selectionState: state,
|
|
93
|
+
items: Object.freeze(edges.map((edge) => Object.freeze({
|
|
94
|
+
relationType: edge.relationType,
|
|
95
|
+
targetPath: edge.target.resolvedPath,
|
|
96
|
+
project: edge.context?.project || unresolvedContext('project-context-unresolved'),
|
|
97
|
+
organization: edge.context?.organization || unresolvedContext('organization-context-unresolved'),
|
|
98
|
+
basis: edge.basis
|
|
99
|
+
}))),
|
|
100
|
+
boundary: 'Project/organization context requires explicit qualified target context; names/paths/Parent/chat do not manufacture membership.'
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function resolveReference(ref = {}, ownerPath = '', byPath = new Map()) {
|
|
105
|
+
const target = String(ref.target || '').trim();
|
|
106
|
+
if (!target) return Object.freeze({ state: 'unresolved-missing-reference', label: ref.label || '', reference: '', resolvedPath: '' });
|
|
107
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(target)) return Object.freeze({ state: 'external-not-loaded', label: ref.label || '', reference: target, resolvedPath: '' });
|
|
108
|
+
const path = resolvePath(target, ownerPath);
|
|
109
|
+
if (!path) return Object.freeze({ state: 'unresolved-reference', label: ref.label || '', reference: target, resolvedPath: '' });
|
|
110
|
+
const matches = byPath.get(path) || [];
|
|
111
|
+
if (matches.length !== 1) return Object.freeze({ state: matches.length ? 'ambiguous-carried-target' : 'not-carried', label: ref.label || '', reference: target, resolvedPath: path });
|
|
112
|
+
const record = matches[0];
|
|
113
|
+
const qualified = Boolean(record.hasContinuityContext && record.hasIntegrity);
|
|
114
|
+
return Object.freeze({ state: qualified ? 'qualified-carried' : 'present-unqualified', label: ref.label || record.title || '', reference: target, resolvedPath: path, title: String(record.title || ''), schemaId: String(record.schemaId || ''), summary: compact(record.summary || '', 180) });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function reverseIndex(edges = []) {
|
|
118
|
+
const groups = new Map();
|
|
119
|
+
for (const edge of edges) {
|
|
120
|
+
const key = edge.target.resolvedPath;
|
|
121
|
+
if (!groups.has(key)) groups.set(key, { target: edge.target, spawned: [] });
|
|
122
|
+
groups.get(key).spawned.push(Object.freeze({ source: edge.source, relationType: edge.relationType, direction: edge.direction, scope: edge.scope, basis: edge.basis }));
|
|
123
|
+
}
|
|
124
|
+
return Object.freeze([...groups.values()].map((entry) => Object.freeze({ target: entry.target, spawned: Object.freeze(entry.spawned) })));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function recordIndex(records = []) {
|
|
128
|
+
const map = new Map();
|
|
129
|
+
for (const record of records) { const key = String(record.path || ''); if (!map.has(key)) map.set(key, []); map.get(key).push(record); }
|
|
130
|
+
return map;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function resolvePath(reference = '', ownerPath = '') {
|
|
134
|
+
const raw = String(reference || '').split('#')[0].trim();
|
|
135
|
+
const cross = raw.match(/^([^:/\\]+)::(.+)$/);
|
|
136
|
+
const candidate = cross ? `${cross[1]}/${cross[2].replace(/^\/+/, '')}` : raw.startsWith('/') ? raw.slice(1) : posix.join(posix.dirname(String(ownerPath || '')), raw);
|
|
137
|
+
const normalized = posix.normalize(candidate).replace(/^\.\//, '');
|
|
138
|
+
return !normalized || normalized === '..' || normalized.startsWith('../') ? '' : normalized;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function reference(markdown = '', label = '') {
|
|
142
|
+
const raw = rawField(markdown, label);
|
|
143
|
+
const link = raw.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
|
|
144
|
+
return Object.freeze({ label: link ? strip(link[1]) : strip(raw), target: link ? link[2].trim() : strip(raw) });
|
|
145
|
+
}
|
|
146
|
+
function section(markdown = '', heading = '') { const e = escape(heading); return String(markdown || '').match(new RegExp(`(?:^|\\n)##\\s+${e}\\s*\\r?\\n([\\s\\S]*?)(?=\\n##\\s+|\\n#\\s+Continuity Integrity|$)`, 'i'))?.[1]?.trim() || ''; }
|
|
147
|
+
function rawField(markdown = '', label = '') { const e = escape(label); return String(markdown || '').match(new RegExp(`^\\s*-\\s+${e}:\\s*(.+)$`, 'mi'))?.[1]?.trim() || ''; }
|
|
148
|
+
function field(markdown = '', label = '') { return strip(rawField(markdown, label)); }
|
|
149
|
+
function strip(value = '') { return String(value || '').replace(/^\[([^\]]+)\]\([^)]+\)$/, '$1').replace(/[`*_]/g, '').trim(); }
|
|
150
|
+
function compact(value = '', limit = 180) { const text = strip(String(value || '').replace(/\s+/g, ' ')); return text.length > limit ? `${text.slice(0, limit - 1).trimEnd()}…` : text; }
|
|
151
|
+
function escape(value = '') { return String(value || '').replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); }
|
|
152
|
+
function issue(slot, code, detail) { return Object.freeze({ slot, state: 'unresolved', code, detail }); }
|
|
153
|
+
function unresolvedContext(code) { return Object.freeze({ state: 'unresolved', code, membershipClaim: false }); }
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { packageFileBytes, sha256Hex } from '../../../export/package.bytes.js';
|
|
2
|
+
import { canonicalC14nV2SelfState } from '../../../integrity/integrity.c14nV2.js';
|
|
3
|
+
import { parseHandoffPackageV1, validatePackageFields } from './recipientV2.packageV1.contract.js';
|
|
4
|
+
import { RECIPIENT_V2_PACKAGE_V1_SCHEMA_ID } from './recipientV2.packageV1.constants.js';
|
|
5
|
+
import { currentSchemaId } from './recipientV2.packageV1.shared.js';
|
|
6
|
+
import { recipientV2FactsIndex } from './recipientV2.transportManifest.js';
|
|
7
|
+
import { handoffCarrierProfileFromPackageContract, normalizeHandoffCarrierProfile } from './carrierProfile.js';
|
|
8
|
+
|
|
9
|
+
export const HANDOFF_CARRIER_LINEAGE_SCHEMA_ID = 'tiinex.portable.handoff-carrier-lineage.v1';
|
|
10
|
+
|
|
11
|
+
export function initialHandoffCarrierLineage() {
|
|
12
|
+
return freezeLineage({ mode: 'root', dimension: '001', parentDimension: '', parentPackageSha256: '', parentPackageFilename: '', major: '001', majorReason: 'initial carrier root', checkpointKind: 'major' });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function continueHandoffCarrierLineage(parent = {}, siblingIndex = 1) {
|
|
16
|
+
const normalized = normalizeParentLineage(parent);
|
|
17
|
+
if (!normalized.dimension) throw new Error('portable.handoff-carrier-lineage.parent.unresolved');
|
|
18
|
+
const childIndex = normalizeSiblingIndex(siblingIndex);
|
|
19
|
+
return freezeLineage({
|
|
20
|
+
mode: 'continue',
|
|
21
|
+
dimension: `${normalized.dimension}-${childIndex}`,
|
|
22
|
+
parentDimension: normalized.dimension,
|
|
23
|
+
parentPackageSha256: normalized.packageSha256,
|
|
24
|
+
parentPackageFilename: normalized.packageFilename,
|
|
25
|
+
major: majorSegment(normalized.dimension),
|
|
26
|
+
majorReason: '',
|
|
27
|
+
checkpointKind: 'progression'
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function advanceHandoffCarrierMajor(parent = {}, reason = '') {
|
|
32
|
+
const normalized = normalizeParentLineage(parent);
|
|
33
|
+
if (!normalized.dimension) throw new Error('portable.handoff-carrier-lineage.parent.unresolved');
|
|
34
|
+
const majorReason = String(reason || '').trim();
|
|
35
|
+
if (!majorReason) throw new Error('portable.handoff-carrier-lineage.major-reason.required');
|
|
36
|
+
const currentMajor = Number.parseInt(majorSegment(normalized.dimension), 10);
|
|
37
|
+
if (!Number.isFinite(currentMajor) || currentMajor < 1 || currentMajor >= 999) throw new Error('portable.handoff-carrier-lineage.major.invalid');
|
|
38
|
+
const nextMajor = String(currentMajor + 1).padStart(3, '0');
|
|
39
|
+
return freezeLineage({
|
|
40
|
+
mode: 'major',
|
|
41
|
+
dimension: nextMajor,
|
|
42
|
+
parentDimension: normalized.dimension,
|
|
43
|
+
parentPackageSha256: normalized.packageSha256,
|
|
44
|
+
parentPackageFilename: normalized.packageFilename,
|
|
45
|
+
major: nextMajor,
|
|
46
|
+
majorReason,
|
|
47
|
+
checkpointKind: 'major'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function normalizeHandoffCarrierLineage(value = null) {
|
|
52
|
+
if (!value || typeof value !== 'object') return initialHandoffCarrierLineage();
|
|
53
|
+
const dimension = normalizeDimension(value.dimension || '');
|
|
54
|
+
if (!dimension) return initialHandoffCarrierLineage();
|
|
55
|
+
const mode = ['root', 'continue', 'major'].includes(String(value.mode || '')) ? String(value.mode) : dimension.includes('-') ? 'continue' : 'root';
|
|
56
|
+
return freezeLineage({
|
|
57
|
+
mode,
|
|
58
|
+
dimension,
|
|
59
|
+
parentDimension: normalizeDimension(value.parentDimension || ''),
|
|
60
|
+
parentPackageSha256: normalizeSha256(value.parentPackageSha256 || ''),
|
|
61
|
+
parentPackageFilename: String(value.parentPackageFilename || ''),
|
|
62
|
+
major: majorSegment(dimension),
|
|
63
|
+
majorReason: String(value.majorReason || ''),
|
|
64
|
+
checkpointKind: String(value.checkpointKind || (mode === 'continue' ? 'progression' : 'major'))
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function parentHandoffCarrierLineageFromBundle(bundle = {}, options = {}) {
|
|
69
|
+
const files = Array.isArray(bundle.files) ? bundle.files : [];
|
|
70
|
+
const factsIndex = recipientV2FactsIndex({ ...bundle, files });
|
|
71
|
+
if (factsIndex.transport?.state === 'invalid') throw new Error('portable.handoff-carrier-lineage.parent.transport-invalid');
|
|
72
|
+
const roots = [];
|
|
73
|
+
for (const file of files) {
|
|
74
|
+
if (!/\.md$/i.test(String(file.path || ''))) continue;
|
|
75
|
+
const facts = factsIndex.map.get(String(file.path || '')) || null;
|
|
76
|
+
if (facts?.role === 'package-root') roots.push({ file, facts });
|
|
77
|
+
}
|
|
78
|
+
let lineage = null;
|
|
79
|
+
if (roots.length === 1 && roots[0].facts.carrierLineage) lineage = normalizeHandoffCarrierLineage(roots[0].facts.carrierLineage);
|
|
80
|
+
if (!lineage) lineage = packageV1CarrierLineage(files);
|
|
81
|
+
if (!lineage) {
|
|
82
|
+
const dimensions = [...new Set((options.routeDimensions || []).map(normalizeDimension).filter(Boolean))];
|
|
83
|
+
if (dimensions.length === 1) lineage = normalizeHandoffCarrierLineage({ mode: dimensions[0].includes('-') ? 'continue' : 'root', dimension: dimensions[0] });
|
|
84
|
+
}
|
|
85
|
+
if (!lineage) throw new Error('portable.handoff-carrier-lineage.parent.unresolved');
|
|
86
|
+
return Object.freeze({
|
|
87
|
+
...lineage,
|
|
88
|
+
packageSha256: normalizeSha256(options.packageSha256 || ''),
|
|
89
|
+
packageFilename: String(options.packageFilename || '')
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function parentHandoffCarrierProfileFromBundle(bundle = {}) {
|
|
94
|
+
const files = Array.isArray(bundle.files) ? bundle.files : [];
|
|
95
|
+
const candidates = files.filter((file) => {
|
|
96
|
+
if (!/\.md$/i.test(String(file.path || ''))) return false;
|
|
97
|
+
return currentSchemaId(decodeUtf8(packageFileBytes(file))) === RECIPIENT_V2_PACKAGE_V1_SCHEMA_ID;
|
|
98
|
+
});
|
|
99
|
+
if (candidates.length !== 1) return normalizeHandoffCarrierProfile(null);
|
|
100
|
+
const file = candidates[0];
|
|
101
|
+
if (!/^\d{3}-tiinex-handoff-package\.trace\.md$/.test(String(file.path || ''))) return normalizeHandoffCarrierProfile(null);
|
|
102
|
+
const markdown = decodeUtf8(packageFileBytes(file));
|
|
103
|
+
if (canonicalC14nV2SelfState(markdown).state !== 'verified') return normalizeHandoffCarrierProfile(null);
|
|
104
|
+
const contract = parseHandoffPackageV1(markdown);
|
|
105
|
+
const findings = [];
|
|
106
|
+
validatePackageFields(contract, findings);
|
|
107
|
+
if (findings.some((item) => item.severity === 'error' && !String(item.code || '').includes('major-carrier-profile'))) return normalizeHandoffCarrierProfile(null);
|
|
108
|
+
return handoffCarrierProfileFromPackageContract(contract);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function packageV1CarrierLineage(files = []) {
|
|
112
|
+
const candidates = files.filter((file) => {
|
|
113
|
+
if (!/\.md$/i.test(String(file.path || ''))) return false;
|
|
114
|
+
return currentSchemaId(decodeUtf8(packageFileBytes(file))) === RECIPIENT_V2_PACKAGE_V1_SCHEMA_ID;
|
|
115
|
+
});
|
|
116
|
+
if (candidates.length !== 1) return null;
|
|
117
|
+
const file = candidates[0];
|
|
118
|
+
if (!/^\d{3}-tiinex-handoff-package\.trace\.md$/.test(String(file.path || ''))) return null;
|
|
119
|
+
const markdown = decodeUtf8(packageFileBytes(file));
|
|
120
|
+
if (canonicalC14nV2SelfState(markdown).state !== 'verified') return null;
|
|
121
|
+
const contract = parseHandoffPackageV1(markdown);
|
|
122
|
+
const findings = [];
|
|
123
|
+
validatePackageFields(contract, findings);
|
|
124
|
+
if (findings.some((item) => item.severity === 'error')) return null;
|
|
125
|
+
return normalizeHandoffCarrierLineage({
|
|
126
|
+
mode: contract.carrierCheckpoint === 'major' ? 'major' : (contract.parentCarrierDimension ? 'continue' : 'root'),
|
|
127
|
+
dimension: contract.carrierDimension,
|
|
128
|
+
parentDimension: contract.parentCarrierDimension,
|
|
129
|
+
checkpointKind: contract.carrierCheckpoint,
|
|
130
|
+
majorReason: contract.majorReason
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function qualifyMajorCarrierReadiness(input = {}, lineage = {}) {
|
|
135
|
+
const profile = normalizeHandoffCarrierProfile(input.carrierProfile || null);
|
|
136
|
+
if (String(lineage.checkpointKind || '') !== 'major') return Object.freeze({
|
|
137
|
+
state: 'not-applicable',
|
|
138
|
+
profile,
|
|
139
|
+
completeWorkspaceCount: 0,
|
|
140
|
+
workspaceCount: 0,
|
|
141
|
+
requiredWorkspaceIds: profile.requiredMajorWorkspaceIds,
|
|
142
|
+
missingWorkspaceIds: Object.freeze([]),
|
|
143
|
+
reason: ''
|
|
144
|
+
});
|
|
145
|
+
const workspaces = [...(input.workspaceMaterializations || [])];
|
|
146
|
+
const requiredWorkspaceIds = profile.requiredMajorWorkspaceIds;
|
|
147
|
+
const completeWorkspaceIds = new Set(workspaces
|
|
148
|
+
.filter((workspace) => String(workspace.state || '') === 'complete' && String(workspace.completenessEvidence?.state || '') === 'qualified')
|
|
149
|
+
.map((workspace) => String(workspace.id || workspace.workspaceId || '').trim().toLowerCase())
|
|
150
|
+
.filter(Boolean));
|
|
151
|
+
const missingWorkspaceIds = Object.freeze(requiredWorkspaceIds.filter((workspaceId) => !completeWorkspaceIds.has(workspaceId)));
|
|
152
|
+
const complete = workspaces.filter((workspace) => String(workspace.state || '') === 'complete' && String(workspace.completenessEvidence?.state || '') === 'qualified').length;
|
|
153
|
+
const profileReady = profile.state === 'qualified';
|
|
154
|
+
const ready = workspaces.length > 0 && complete === workspaces.length && missingWorkspaceIds.length === 0;
|
|
155
|
+
return Object.freeze({
|
|
156
|
+
state: ready ? 'qualified' : 'blocked',
|
|
157
|
+
profile,
|
|
158
|
+
workspaceCount: workspaces.length,
|
|
159
|
+
completeWorkspaceCount: complete,
|
|
160
|
+
requiredWorkspaceIds,
|
|
161
|
+
missingWorkspaceIds,
|
|
162
|
+
reason: ready
|
|
163
|
+
? (profileReady ? 'major-carrier-satisfies-explicit-carrier-profile' : 'major-carrier-has-complete-carried-workspaces-without-named-profile-requirements')
|
|
164
|
+
: 'major-carrier-requires-complete-carried-and-profile-declared-workspaces',
|
|
165
|
+
semanticClosure: lineage.mode === 'major' ? 'explicit-major-reason-caller-declared' : 'initial-root'
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function carrierLineageFromCliParent({ bundle = {}, parentPath = '', parentBytes = null, routeDimensions = [], qualifiedParentLineage = null, major = false, majorReason = '', siblingIndex = 1 } = {}) {
|
|
170
|
+
const bytes = parentBytes ? packageFileBytes({ data: parentBytes }) : new Uint8Array();
|
|
171
|
+
const packageIdentity = Object.freeze({
|
|
172
|
+
packageSha256: bytes.byteLength ? sha256Hex(bytes) : '',
|
|
173
|
+
packageFilename: parentPath ? portableBasename(parentPath) : ''
|
|
174
|
+
});
|
|
175
|
+
const qualifiedDimension = normalizeDimension(qualifiedParentLineage?.dimension || '');
|
|
176
|
+
const parent = qualifiedDimension
|
|
177
|
+
? Object.freeze({ ...normalizeHandoffCarrierLineage(qualifiedParentLineage), ...packageIdentity })
|
|
178
|
+
: parentHandoffCarrierLineageFromBundle(bundle, { routeDimensions, ...packageIdentity });
|
|
179
|
+
return major ? advanceHandoffCarrierMajor(parent, majorReason) : continueHandoffCarrierLineage(parent, siblingIndex);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function normalizeSiblingIndex(value = 1) {
|
|
183
|
+
const number = Number.parseInt(value, 10);
|
|
184
|
+
if (!Number.isFinite(number) || number < 1 || number > 9999) throw new Error('portable.handoff-carrier-lineage.sibling-index.invalid');
|
|
185
|
+
return number;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function freezeLineage(value = {}) {
|
|
189
|
+
return Object.freeze({
|
|
190
|
+
schema: HANDOFF_CARRIER_LINEAGE_SCHEMA_ID,
|
|
191
|
+
version: 1,
|
|
192
|
+
mode: String(value.mode || ''),
|
|
193
|
+
dimension: normalizeDimension(value.dimension || ''),
|
|
194
|
+
major: majorSegment(value.dimension || ''),
|
|
195
|
+
parentDimension: normalizeDimension(value.parentDimension || ''),
|
|
196
|
+
parentPackageSha256: normalizeSha256(value.parentPackageSha256 || ''),
|
|
197
|
+
parentPackageFilename: String(value.parentPackageFilename || ''),
|
|
198
|
+
checkpointKind: String(value.checkpointKind || ''),
|
|
199
|
+
majorReason: String(value.majorReason || ''),
|
|
200
|
+
authority: 'human-progress-projection-only',
|
|
201
|
+
boundary: 'Carrier lineage is a compact human progress/retention projection. It never replaces artifact Parent/Trace/Origin, Handoff authority, or source truth. Major checkpoints require complete carried Workspace snapshots and explicit semantic closure intent.'
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function normalizeParentLineage(value = {}) {
|
|
205
|
+
const explicitDimension = String(value?.dimension || '').trim();
|
|
206
|
+
if (explicitDimension && !normalizeDimension(explicitDimension)) return Object.freeze({ dimension: '', packageSha256: normalizeSha256(value.packageSha256 || value.parentPackageSha256 || ''), packageFilename: String(value.packageFilename || value.parentPackageFilename || '') });
|
|
207
|
+
const lineage = normalizeHandoffCarrierLineage(value);
|
|
208
|
+
return Object.freeze({ ...lineage, packageSha256: normalizeSha256(value.packageSha256 || value.parentPackageSha256 || ''), packageFilename: String(value.packageFilename || value.parentPackageFilename || '') });
|
|
209
|
+
}
|
|
210
|
+
function normalizeDimension(value = '') { const v = String(value || '').trim(); return /^\d{3}(?:-\d+)*$/.test(v) ? v : ''; }
|
|
211
|
+
function majorSegment(value = '') { return normalizeDimension(value).split('-')[0] || ''; }
|
|
212
|
+
function portableBasename(value = '') { return String(value || '').replace(/\\/g, '/').split('/').filter(Boolean).pop() || ''; }
|
|
213
|
+
function normalizeSha256(value = '') { const v = String(value || '').trim().toLowerCase(); return /^[a-f0-9]{64}$/.test(v) ? v : ''; }
|
|
214
|
+
function decodeUtf8(data) { try { return new TextDecoder('utf-8', { fatal: true }).decode(data); } catch { return ''; } }
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export const HANDOFF_CARRIER_PROFILE_SCHEMA_ID = 'tiinex.portable.handoff-carrier-profile.v1';
|
|
2
|
+
|
|
3
|
+
export function normalizeHandoffCarrierProfile(value = null, options = {}) {
|
|
4
|
+
const raw = value && typeof value === 'object' ? value : {};
|
|
5
|
+
const id = String(raw.id || raw.profileId || raw.name || '').trim();
|
|
6
|
+
const requiredMajorWorkspaceIds = normalizeWorkspaceIds(
|
|
7
|
+
raw.requiredMajorWorkspaceIds
|
|
8
|
+
|| raw.requiredWorkspaceIds
|
|
9
|
+
|| raw.majorRequiredWorkspaceIds
|
|
10
|
+
|| []
|
|
11
|
+
);
|
|
12
|
+
const source = String(raw.source || options.source || '').trim();
|
|
13
|
+
const state = id ? 'qualified' : 'unresolved';
|
|
14
|
+
return Object.freeze({
|
|
15
|
+
schema: HANDOFF_CARRIER_PROFILE_SCHEMA_ID,
|
|
16
|
+
state,
|
|
17
|
+
id,
|
|
18
|
+
requiredMajorWorkspaceIds,
|
|
19
|
+
source,
|
|
20
|
+
boundary: 'Carrier profile data is explicit project/operator/package policy. Workspace identifiers have no universal meaning in generic Handoff mechanics.'
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function handoffCarrierProfileFromPackageContract(contract = {}) {
|
|
25
|
+
return normalizeHandoffCarrierProfile({
|
|
26
|
+
id: contract.carrierProfileId || '',
|
|
27
|
+
requiredMajorWorkspaceIds: contract.requiredMajorWorkspaceIds || [],
|
|
28
|
+
source: contract.carrierProfileId ? 'declared-package-contract' : ''
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function normalizeWorkspaceIds(value = []) {
|
|
33
|
+
if (!Array.isArray(value) && String(value || '').trim().toLowerCase() === 'none') return Object.freeze([]);
|
|
34
|
+
const list = Array.isArray(value)
|
|
35
|
+
? value
|
|
36
|
+
: String(value || '').split(',');
|
|
37
|
+
const seen = new Set();
|
|
38
|
+
const out = [];
|
|
39
|
+
for (const entry of list) {
|
|
40
|
+
const id = normalizeWorkspaceId(entry);
|
|
41
|
+
if (!id || seen.has(id)) continue;
|
|
42
|
+
seen.add(id);
|
|
43
|
+
out.push(id);
|
|
44
|
+
}
|
|
45
|
+
return Object.freeze(out);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function normalizeWorkspaceId(value = '') {
|
|
49
|
+
return String(value || '')
|
|
50
|
+
.trim()
|
|
51
|
+
.toLowerCase()
|
|
52
|
+
.replace(/[^a-z0-9._-]+/g, '-')
|
|
53
|
+
.replace(/^-+|-+$/g, '');
|
|
54
|
+
}
|