@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,320 @@
|
|
|
1
|
+
import { finalizeFile } from '../../../export/package.fileMap.js';
|
|
2
|
+
import { exportFileMapZipUint8Array } from '../../../export/package.zip.js';
|
|
3
|
+
import {
|
|
4
|
+
RECIPIENT_V2_EXTERNAL_PAYLOAD_SCHEMA_TARGET,
|
|
5
|
+
RECIPIENT_V2_POINTER_SCHEMA_TARGET,
|
|
6
|
+
renderRecipientV2ExternalPayload,
|
|
7
|
+
renderRecipientV2Pointer
|
|
8
|
+
} from './recipientV2.artifacts.js';
|
|
9
|
+
import { selectRecipientRoutes } from './recipientV2.routeSelection.js';
|
|
10
|
+
import { recipientPackageRootPath } from './recipientV2.topology.helpers.js';
|
|
11
|
+
import { RECIPIENT_V2_ROUTE_SELECTION_AUTHORITY, RECIPIENT_V2_SIBLING_ROUTE_INFERENCE, recipientV2EntryCurrentRead } from './recipientV2.entryContract.js';
|
|
12
|
+
import { buildRecipientV2TransportManifestFile, recipientV2TransportFacts } from './recipientV2.transportManifest.js';
|
|
13
|
+
import { buildRecipientFacingV2ArtifactFirstPhase1, buildRecipientFacingV2ArtifactFirstPhase2Clean } from './recipientV2.artifactFirstPhase1.js';
|
|
14
|
+
import { buildRecipientFacingV2PackageV1 } from './recipientV2.packageV1.js';
|
|
15
|
+
import { buildEndpointRolePointerChain, buildParticipantRolePointerChain } from './recipientV2.endpointRolePointers.js';
|
|
16
|
+
import {
|
|
17
|
+
bindingForWorkspace,
|
|
18
|
+
deepFreeze,
|
|
19
|
+
detachedMaterial,
|
|
20
|
+
duplicates,
|
|
21
|
+
finding,
|
|
22
|
+
groupRoutes,
|
|
23
|
+
roleMaterialTarget,
|
|
24
|
+
routeClaimsDetachedMaterial,
|
|
25
|
+
safeToken,
|
|
26
|
+
uniqueFileIndex
|
|
27
|
+
} from './recipientV2.topology.materials.js';
|
|
28
|
+
import {
|
|
29
|
+
buildRecipientV2BootstrapCarrier,
|
|
30
|
+
buildRecipientV2WorkspaceCarriers,
|
|
31
|
+
recipientV2ParentAuthority
|
|
32
|
+
} from './recipientV2.topology.workspaces.js';
|
|
33
|
+
|
|
34
|
+
export const RECIPIENT_V2_READ_PATH = '001-1-READ-BEFORE-PROCEEDING.trace.md';
|
|
35
|
+
export const RECIPIENT_V2_FORMAT_ID = 'tiinex-recipient-facing-handoff-v2-flat';
|
|
36
|
+
|
|
37
|
+
export function buildRecipientFacingV2Topology(input = {}) {
|
|
38
|
+
const artifactFirst = input.legacyRecipientV2Compatibility !== true;
|
|
39
|
+
const sourceSurface = buildRecipientFacingV2TopologyLegacy({
|
|
40
|
+
...input,
|
|
41
|
+
...(artifactFirst ? { routeSelector: '' } : {}),
|
|
42
|
+
artifactFirstDualProjectionPhase1: false,
|
|
43
|
+
artifactFirstCleanCarrierPhase2: false,
|
|
44
|
+
legacyRecipientV2Compatibility: false
|
|
45
|
+
});
|
|
46
|
+
if (input.legacyRecipientV2Compatibility === true) return sourceSurface;
|
|
47
|
+
if (input.artifactFirstDualProjectionPhase1 === true) return buildRecipientFacingV2ArtifactFirstPhase1({ ...input, sourceSurface });
|
|
48
|
+
if (input.artifactFirstCleanCarrierPhase2 === true) return buildRecipientFacingV2ArtifactFirstPhase2Clean({ ...input, sourceSurface });
|
|
49
|
+
const hasIndependentBoundedWorkspaceRepresentation = (input.descriptor?.workspaceArchiveBindings || input.bundle?.handoffClosure?.workspaceArchiveBindings || [])
|
|
50
|
+
.some((binding) => String(binding.coverage || '') === 'bounded' || String(binding.representation?.kind || '') === 'bounded-workspace-snapshot');
|
|
51
|
+
if (hasIndependentBoundedWorkspaceRepresentation) return buildRecipientFacingV2ArtifactFirstPhase2Clean({ ...input, sourceSurface });
|
|
52
|
+
const explicitRouteSelector = String(input.routeSelector || input.routeId || '').trim();
|
|
53
|
+
if (!explicitRouteSelector && (sourceSurface.topology?.routes || []).length > 1) return sourceSurface;
|
|
54
|
+
return buildRecipientFacingV2PackageV1({ ...input, sourceSurface });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function buildRecipientFacingV2TopologyLegacy(input = {}) {
|
|
58
|
+
const internalBundle = input.bundle || {};
|
|
59
|
+
const descriptor = input.descriptor || internalBundle.handoffClosure || {};
|
|
60
|
+
const carrier = input.carrierProjection || {};
|
|
61
|
+
const createdAt = input.createdAt || internalBundle.manifest?.createdAt || internalBundle.builtAt || '';
|
|
62
|
+
const findings = [];
|
|
63
|
+
const files = [];
|
|
64
|
+
const topology = { root: null, read: null, workspaces: [], caches: [], endpointRoles: [], participantRoles: [], routes: [], bootstrap: null };
|
|
65
|
+
const byPath = uniqueFileIndex(internalBundle.files || [], findings);
|
|
66
|
+
|
|
67
|
+
const routeSelection = selectRecipientRoutes(carrier.routes || [], input.routeSelector || '', findings);
|
|
68
|
+
const selectedWorkspaceIds = routeSelection.selector ? new Set(routeSelection.routes.map((route) => String(route.workspaceId || ''))) : null;
|
|
69
|
+
const bindings = [...(descriptor.workspaceArchiveBindings || [])]
|
|
70
|
+
.filter((binding) => !selectedWorkspaceIds || selectedWorkspaceIds.has(String(binding.workspaceId || '')))
|
|
71
|
+
.sort((a, b) => String(a.workspaceId || '').localeCompare(String(b.workspaceId || '')));
|
|
72
|
+
const workspacePlans = bindings.map((binding, index) => {
|
|
73
|
+
const ordinal = index + 3;
|
|
74
|
+
const workspaceId = String(binding.workspaceId || '');
|
|
75
|
+
const slug = safeToken(workspaceId || `workspace-${ordinal}`);
|
|
76
|
+
const prefix = `001-${ordinal}`;
|
|
77
|
+
return Object.freeze({ binding, ordinal, workspaceId, slug, prefix, workspacePath: `${prefix}-${slug}.workspace.md`, archivePath: `${prefix}-${slug}.workspace.zip`, payloadArtifactPath: `${prefix}-1-workspace-representation-payload.trace.md`, representationArtifactPath: `${prefix}-2-workspace-representation.trace.md` });
|
|
78
|
+
});
|
|
79
|
+
const workspaceOrdinalById = new Map(workspacePlans.map((plan) => [plan.workspaceId, plan.ordinal]));
|
|
80
|
+
const routesByWorkspace = groupRoutes(routeSelection.routes);
|
|
81
|
+
const routePlans = [];
|
|
82
|
+
for (const workspace of workspacePlans) {
|
|
83
|
+
const routes = (routesByWorkspace.get(workspace.workspaceId) || []).filter((route) => String(route.state || '') === 'qualified');
|
|
84
|
+
routes.forEach((route, index) => routePlans.push(Object.freeze({ workspace, route, ordinal: index + 1 })));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const detached = detachedMaterial(descriptor, byPath, findings);
|
|
88
|
+
|
|
89
|
+
const bootstrapSource = (internalBundle.files || []).filter((file) => String(file.path || '').startsWith('tiinex.bootstrap/'));
|
|
90
|
+
const rootPath = recipientPackageRootPath(workspacePlans);
|
|
91
|
+
const rootDestinations = [
|
|
92
|
+
{ label: 'Read before proceeding', target: RECIPIENT_V2_READ_PATH },
|
|
93
|
+
...(bootstrapSource.length ? [{ label: 'Portable Tooling bootstrap', target: '001-2-bootstrap.trace.md' }] : []),
|
|
94
|
+
...workspacePlans.map((workspace) => ({ label: `Workspace ${workspace.workspaceId}`, target: workspace.workspacePath }))
|
|
95
|
+
];
|
|
96
|
+
const rootFacts = { format: RECIPIENT_V2_FORMAT_ID, packageRootPath: rootPath, entryArtifactPath: RECIPIENT_V2_READ_PATH, artifactSurface: 'flat-qualified-tiinex-artifacts-and-explicit-payload-zips', carrierLineage: carrier.lineage || null, pathParentProjection: true, pathAuthority: false };
|
|
97
|
+
const rootFile = finalizeFile({
|
|
98
|
+
path: rootPath,
|
|
99
|
+
kind: 'handoff-package-lineage-root',
|
|
100
|
+
logicalKind: 'recipient-v2-package-root',
|
|
101
|
+
mediaType: 'text/markdown',
|
|
102
|
+
transportFacts: recipientV2TransportFacts('package-root', rootFacts),
|
|
103
|
+
content: renderRecipientV2Pointer({
|
|
104
|
+
createdAt,
|
|
105
|
+
role: 'package-root',
|
|
106
|
+
title: 'Tiinex Handoff Package',
|
|
107
|
+
summary: 'Package-local Tiinex lineage root for one recipient-facing Handoff carrier.',
|
|
108
|
+
prose: 'This artifact is the package-local lineage root. Its descendants deliberately mirror this declared Parent tree in their numeric pathing so a reader can random-access any leaf and traverse back to this root.',
|
|
109
|
+
currentRead: [
|
|
110
|
+
{ label: 'Start', value: `[READ BEFORE PROCEEDING](${RECIPIENT_V2_READ_PATH})` },
|
|
111
|
+
{ label: 'Carrier Dimension', value: `\`${String(carrier.lineage?.dimension || '001')}\`` },
|
|
112
|
+
...(carrier.lineage?.parentDimension ? [{ label: 'Parent Carrier Dimension', value: `\`${String(carrier.lineage.parentDimension)}\`` }] : []),
|
|
113
|
+
{ label: 'Carrier Checkpoint', value: String(carrier.lineage?.checkpointKind || 'major') },
|
|
114
|
+
{ label: 'Lineage Rule', value: 'numeric pathing mirrors declared package-local Parent continuity; filenames alone never establish the relation' }
|
|
115
|
+
],
|
|
116
|
+
destinations: rootDestinations,
|
|
117
|
+
facts: rootFacts
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
files.push(rootFile);
|
|
121
|
+
topology.root = Object.freeze({ path: rootPath, sha256: rootFile.sha256 });
|
|
122
|
+
const rootParent = recipientV2ParentAuthority(rootFile, 'tiinex.pointer.v1', RECIPIENT_V2_POINTER_SCHEMA_TARGET, createdAt);
|
|
123
|
+
|
|
124
|
+
if (bootstrapSource.length) {
|
|
125
|
+
const bootstrap = buildRecipientV2BootstrapCarrier(bootstrapSource, createdAt, findings, rootParent);
|
|
126
|
+
if (bootstrap) {
|
|
127
|
+
files.push(bootstrap.artifact, bootstrap.payload);
|
|
128
|
+
topology.bootstrap = bootstrap.projection;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const workspaceById = buildRecipientV2WorkspaceCarriers({
|
|
133
|
+
workspacePlans,
|
|
134
|
+
byPath,
|
|
135
|
+
findings,
|
|
136
|
+
createdAt,
|
|
137
|
+
rootParent,
|
|
138
|
+
files,
|
|
139
|
+
topology
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
const cachePlanByWorkspace = new Map();
|
|
144
|
+
for (const workspacePlan of workspacePlans) {
|
|
145
|
+
const workspace = workspaceById.get(workspacePlan.workspaceId);
|
|
146
|
+
if (!workspace) continue;
|
|
147
|
+
const workspaceRoutes = routePlans.filter((plan) => plan.workspace.workspaceId === workspace.workspaceId);
|
|
148
|
+
const materials = detached.filter((item) => workspaceRoutes.some((plan) => routeClaimsDetachedMaterial(plan.route, item)));
|
|
149
|
+
if (!materials.length) continue;
|
|
150
|
+
const artifactPath = `001-${workspacePlan.ordinal}-1-cache.trace.md`;
|
|
151
|
+
const archivePath = `001-${workspacePlan.ordinal}-1-cache.zip`;
|
|
152
|
+
const cacheEntries = materials.map((item, index) => ({ path: `material/${index + 1}-${safeToken(item.requirementId || item.referenceTarget || 'material')}.bin`, data: item.data }));
|
|
153
|
+
const cacheBytes = exportFileMapZipUint8Array(cacheEntries, 'portable.handoff-v2-surface.cache.path.invalid');
|
|
154
|
+
const cacheFile = finalizeFile({ path: archivePath, kind: 'handoff-material-cache', logicalKind: 'recipient-v2-workspace-dependency-cache', mediaType: 'application/zip', data: cacheBytes, boundary: 'Exact detached dependency bytes required by Handoff routes owned by this Workspace and absent from all qualified Workspace payloads. No Workspace byte may be duplicated here.' });
|
|
155
|
+
const cacheFacts = {
|
|
156
|
+
workspaceId: workspace.workspaceId,
|
|
157
|
+
archivePath,
|
|
158
|
+
archiveBytes: cacheFile.bytes,
|
|
159
|
+
archiveSha256: cacheFile.sha256,
|
|
160
|
+
materials: materials.map((item, index) => ({ requirementId: item.requirementId, classification: item.classification, referenceTarget: item.referenceTarget, routeWorkspaceId: item.routeWorkspaceId, routePath: item.routePath, sourceRequirementId: item.sourceRequirementId, originalPath: item.originalPath, archiveEntry: cacheEntries[index].path, bytes: item.bytes, sha256: item.sha256 }))
|
|
161
|
+
};
|
|
162
|
+
const cacheArtifact = finalizeFile({ path: artifactPath, kind: 'tiinex-external-payload-artifact', logicalKind: 'recipient-v2-workspace-dependency-cache-reference', mediaType: 'text/markdown', transportFacts: recipientV2TransportFacts('workspace-scoped Handoff dependency cache', cacheFacts), content: renderRecipientV2ExternalPayload({ createdAt, parent: workspace.parent, title: `Workspace Dependency Cache — ${workspace.workspaceId}`, summary: 'Exact recipient-relative dependency bytes not satisfied by any qualified Workspace archive.', label: `${workspace.workspaceId} Handoff dependency cache`, kind: 'zip export', role: 'workspace-scoped Handoff dependency cache', location: archivePath, bytes: cacheFile.bytes, sha256: cacheFile.sha256, facts: cacheFacts }) });
|
|
163
|
+
files.push(cacheArtifact, cacheFile);
|
|
164
|
+
const projection = Object.freeze({ workspaceId: workspace.workspaceId, artifactPath, archivePath, materials: cacheFacts.materials });
|
|
165
|
+
topology.caches.push(projection);
|
|
166
|
+
cachePlanByWorkspace.set(workspace.workspaceId, { ...projection, parent: recipientV2ParentAuthority(cacheArtifact, 'tiinex.external.payload.v1', RECIPIENT_V2_EXTERNAL_PAYLOAD_SCHEMA_TARGET, createdAt) });
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const claimedDetached = new Set();
|
|
170
|
+
for (const cache of topology.caches) for (const material of cache.materials || []) claimedDetached.add(`${material.requirementId}\u0000${material.referenceTarget}\u0000${material.sha256}`);
|
|
171
|
+
for (const item of detached) {
|
|
172
|
+
const key = `${item.requirementId}\u0000${item.referenceTarget}\u0000${item.sha256}`;
|
|
173
|
+
if (!claimedDetached.has(key)) findings.push(finding('error', 'portable.handoff-v2-surface.cache.material-unowned', 'Detached dependency bytes are not claimed by any Workspace-scoped Handoff route cache.', { requirementId: item.requirementId || '', referenceTarget: item.referenceTarget || '' }));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
for (const plan of routePlans) {
|
|
177
|
+
const workspace = workspaceById.get(plan.workspace.workspaceId);
|
|
178
|
+
if (!workspace) continue;
|
|
179
|
+
const route = plan.route;
|
|
180
|
+
const binding = bindingForWorkspace(descriptor, workspace.workspaceId);
|
|
181
|
+
const cache = cachePlanByWorkspace.get(workspace.workspaceId) || null;
|
|
182
|
+
const routeDimension = cache ? `001-${plan.workspace.ordinal}-1-${plan.ordinal}` : `001-${plan.workspace.ordinal}-${plan.ordinal}`;
|
|
183
|
+
let lineageParent = cache?.parent || workspace.parent;
|
|
184
|
+
let nextDimension = routeDimension;
|
|
185
|
+
const endpointChain = buildEndpointRolePointerChain({
|
|
186
|
+
requirements: route.materialRequirements?.endpointRoles || [],
|
|
187
|
+
descriptor,
|
|
188
|
+
workspaceById,
|
|
189
|
+
cache,
|
|
190
|
+
workspace,
|
|
191
|
+
route,
|
|
192
|
+
createdAt,
|
|
193
|
+
lineageParent,
|
|
194
|
+
nextDimension,
|
|
195
|
+
resolveRoleMaterialTarget: roleMaterialTarget,
|
|
196
|
+
parentAuthority: recipientV2ParentAuthority
|
|
197
|
+
});
|
|
198
|
+
files.push(...endpointChain.files);
|
|
199
|
+
topology.endpointRoles.push(...endpointChain.roles);
|
|
200
|
+
findings.push(...endpointChain.findings);
|
|
201
|
+
lineageParent = endpointChain.lineageParent;
|
|
202
|
+
nextDimension = endpointChain.nextDimension;
|
|
203
|
+
const participantChain = buildParticipantRolePointerChain({
|
|
204
|
+
requirements: route.materialRequirements?.participantRoles || [],
|
|
205
|
+
descriptor,
|
|
206
|
+
workspaceById,
|
|
207
|
+
cache,
|
|
208
|
+
workspace,
|
|
209
|
+
route,
|
|
210
|
+
createdAt,
|
|
211
|
+
lineageParent,
|
|
212
|
+
nextDimension,
|
|
213
|
+
resolveRoleMaterialTarget: roleMaterialTarget,
|
|
214
|
+
parentAuthority: recipientV2ParentAuthority
|
|
215
|
+
});
|
|
216
|
+
files.push(...participantChain.files);
|
|
217
|
+
topology.participantRoles.push(...participantChain.roles);
|
|
218
|
+
findings.push(...participantChain.findings);
|
|
219
|
+
lineageParent = participantChain.lineageParent;
|
|
220
|
+
nextDimension = participantChain.nextDimension;
|
|
221
|
+
const pointerPath = `${nextDimension}-handoff-pointer.trace.md`;
|
|
222
|
+
const pointerFacts = {
|
|
223
|
+
workspaceId: workspace.workspaceId,
|
|
224
|
+
workspaceArtifactPath: workspace.workspacePath,
|
|
225
|
+
workspaceArtifactSha256: workspace.workspaceSha256,
|
|
226
|
+
archivePath: workspace.archivePath,
|
|
227
|
+
archiveSha256: workspace.archiveSha256,
|
|
228
|
+
sourceWorkspaceTargetInnerPath: workspace.sourceWorkspaceTargetInnerPath,
|
|
229
|
+
sourceWorkspaceTargetSha256: workspace.sourceWorkspaceTargetSha256,
|
|
230
|
+
workspaceRelativeHandoffPath: String(route.workspaceRelativePath || ''),
|
|
231
|
+
handoffBytes: Number((binding?.entryMap?.entries || []).find((entry) => String(entry.path || '') === String(route.workspaceRelativePath || ''))?.bytes || 0),
|
|
232
|
+
handoffSha256: String(route.sha256 || ''),
|
|
233
|
+
routeId: String(route.id || ''),
|
|
234
|
+
parties: route.parties || {},
|
|
235
|
+
cacheArtifactPath: cache?.artifactPath || '',
|
|
236
|
+
requiredContextBindings: Object.freeze((route.requiredClosure?.requirements || [])
|
|
237
|
+
.filter((entry) => entry.state === 'qualified' && entry.resolution?.kind === 'workspace-archive-entry')
|
|
238
|
+
.map((entry) => Object.freeze({
|
|
239
|
+
requirementId: String(entry.requirementId || ''),
|
|
240
|
+
name: String(entry.name || ''),
|
|
241
|
+
referenceTarget: String(entry.referenceTarget || ''),
|
|
242
|
+
workspaceId: String(entry.resolution?.workspaceId || ''),
|
|
243
|
+
workspaceRelativePath: String(entry.resolution?.workspaceRelativePath || entry.resolution?.innerPath || ''),
|
|
244
|
+
bytes: Number(entry.resolution?.bytes || 0),
|
|
245
|
+
sha256: String(entry.resolution?.sha256 || '')
|
|
246
|
+
})))
|
|
247
|
+
};
|
|
248
|
+
const pointer = finalizeFile({
|
|
249
|
+
path: pointerPath,
|
|
250
|
+
kind: 'handoff-route-pointer',
|
|
251
|
+
logicalKind: 'recipient-v2-handoff-route-pointer',
|
|
252
|
+
mediaType: 'text/markdown',
|
|
253
|
+
transportFacts: recipientV2TransportFacts('handoff-route', pointerFacts),
|
|
254
|
+
content: renderRecipientV2Pointer({
|
|
255
|
+
createdAt,
|
|
256
|
+
parent: lineageParent,
|
|
257
|
+
role: 'handoff-route',
|
|
258
|
+
title: `Handoff Route Pointer — ${String(route.parties?.to || workspace.workspaceId || 'recipient')}`,
|
|
259
|
+
summary: 'Qualified package-local Pointer to one selected Handoff inside one exact Workspace archive representation.',
|
|
260
|
+
prose: 'Follow the declared Parent chain for package lineage, then resolve the workspace-relative Handoff path against the exact Workspace archive bytes declared by this route.',
|
|
261
|
+
currentRead: [
|
|
262
|
+
{ label: 'Workspace', value: `[${workspace.workspaceId}](${workspace.workspacePath})` },
|
|
263
|
+
...(pointerFacts.cacheArtifactPath ? [{ label: 'Workspace Dependency Cache', value: `[cache](${pointerFacts.cacheArtifactPath})` }] : []),
|
|
264
|
+
{ label: 'Handoff Workspace Path', value: `\`${String(route.workspaceRelativePath || '')}\`` }
|
|
265
|
+
],
|
|
266
|
+
destinations: [{ label: 'Workspace archive containing the qualified Handoff route', display: `${workspace.archivePath} :: ${String(route.workspaceRelativePath || '')}`, target: workspace.archivePath }],
|
|
267
|
+
facts: pointerFacts
|
|
268
|
+
})
|
|
269
|
+
});
|
|
270
|
+
files.push(pointer);
|
|
271
|
+
topology.routes.push(Object.freeze({ pointerPath, workspaceId: workspace.workspaceId, workspaceRelativeHandoffPath: String(route.workspaceRelativePath || ''), routeId: String(route.id || ''), sha256: String(route.sha256 || '') }));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const readDestinations = [
|
|
275
|
+
...(topology.bootstrap ? [{ label: 'Portable Tooling bootstrap', target: topology.bootstrap.artifactPath }] : []),
|
|
276
|
+
...topology.workspaces.map((workspace) => ({ label: `Workspace ${workspace.workspaceId}`, target: workspace.workspacePath })),
|
|
277
|
+
...topology.caches.map((cache) => ({ label: `Workspace dependency cache ${cache.workspaceId}`, target: cache.artifactPath })),
|
|
278
|
+
...topology.endpointRoles.map((role) => ({ label: `Endpoint Role ${role.requirementId}`, target: role.pointerPath })),
|
|
279
|
+
...topology.participantRoles.map((role) => ({ label: `Participant Role ${role.requirementId}`, target: role.pointerPath })),
|
|
280
|
+
...topology.routes.map((route) => ({ label: `Handoff route ${route.routeId || route.workspaceRelativeHandoffPath}`, target: route.pointerPath }))
|
|
281
|
+
];
|
|
282
|
+
const readFacts = { format: RECIPIENT_V2_FORMAT_ID, packageRootPath: rootPath, entryArtifactPath: RECIPIENT_V2_READ_PATH, artifactSurface: 'flat-qualified-tiinex-artifacts-and-explicit-payload-zips', routeAuthority: 'qualified-handoff-route-pointer-plus-exact-handoff-bytes', routeSelectionAuthority: RECIPIENT_V2_ROUTE_SELECTION_AUTHORITY, siblingRouteInference: RECIPIENT_V2_SIBLING_ROUTE_INFERENCE, pathParentProjection: true, pathAuthority: false };
|
|
283
|
+
const readFile = finalizeFile({
|
|
284
|
+
path: RECIPIENT_V2_READ_PATH,
|
|
285
|
+
kind: 'handoff-recovery-pointer',
|
|
286
|
+
logicalKind: 'recipient-v2-recovery-orientation',
|
|
287
|
+
mediaType: 'text/markdown',
|
|
288
|
+
transportFacts: recipientV2TransportFacts('recovery-orientation', readFacts),
|
|
289
|
+
content: renderRecipientV2Pointer({
|
|
290
|
+
createdAt,
|
|
291
|
+
parent: rootParent,
|
|
292
|
+
role: 'recovery-orientation',
|
|
293
|
+
title: 'READ BEFORE PROCEEDING — Tiinex Handoff Carrier',
|
|
294
|
+
summary: 'Qualified recovery/orientation Pointer for the visible recipient-facing Handoff carrier.',
|
|
295
|
+
prose: 'Read this artifact before traversing the sibling material nodes. The package-local numeric tree mirrors declared Parent continuity, while exact Workspace/archive/Handoff bytes must still independently qualify.',
|
|
296
|
+
currentRead: recipientV2EntryCurrentRead(),
|
|
297
|
+
destinations: readDestinations,
|
|
298
|
+
facts: readFacts
|
|
299
|
+
})
|
|
300
|
+
});
|
|
301
|
+
files.push(readFile);
|
|
302
|
+
topology.read = Object.freeze({ path: RECIPIENT_V2_READ_PATH, sha256: readFile.sha256 });
|
|
303
|
+
const transportManifest = buildRecipientV2TransportManifestFile(files, { format: RECIPIENT_V2_FORMAT_ID, packageRootPath: rootPath, entryArtifactPath: RECIPIENT_V2_READ_PATH });
|
|
304
|
+
files.push(transportManifest);
|
|
305
|
+
topology.transportManifest = Object.freeze({ path: transportManifest.path, sha256: transportManifest.sha256 });
|
|
306
|
+
|
|
307
|
+
const duplicatePaths = duplicates(files.map((file) => file.path));
|
|
308
|
+
for (const path of duplicatePaths) findings.push(finding('error', 'portable.handoff-v2-surface.path-duplicate', 'Recipient-facing v2 topology generated duplicate root paths.', { path }));
|
|
309
|
+
for (const file of files) if (String(file.path || '').includes('/')) findings.push(finding('error', 'portable.handoff-v2-surface.path-nonflat', 'Recipient-facing v2 topology must expose only flat root files.', { path: file.path || '' }));
|
|
310
|
+
const sortedFiles = [...files].sort((a, b) => String(a.path || '').localeCompare(String(b.path || '')));
|
|
311
|
+
const status = findings.some((item) => item.severity === 'error') || !topology.workspaces.length || !topology.routes.length ? 'blocked' : 'ready';
|
|
312
|
+
return deepFreeze({
|
|
313
|
+
status,
|
|
314
|
+
files: Object.freeze(sortedFiles),
|
|
315
|
+
topology: deepFreeze(topology),
|
|
316
|
+
findings: Object.freeze(findings),
|
|
317
|
+
boundary: 'Recipient-facing v2 serialization only: a flat root of qualified Tiinex Markdown lineage nodes and explicitly owned ZIP companions. Numeric pathing deliberately mirrors declared package-local Parent continuity, but filenames alone never establish semantic authority.'
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { packageFileBytes, sha256Hex } from '../../../export/package.bytes.js';
|
|
2
|
+
|
|
3
|
+
export function bindingForWorkspace(descriptor = {}, workspaceId = '') { return (descriptor.workspaceArchiveBindings || []).find((binding) => String(binding.workspaceId || '') === String(workspaceId || '')) || null; }
|
|
4
|
+
export function routeClaimsDetachedMaterial(route = {}, material = {}) {
|
|
5
|
+
const scopedWorkspace = String(material.routeWorkspaceId || '').trim();
|
|
6
|
+
const scopedPath = normalizeWorkspacePath(material.routePath || '');
|
|
7
|
+
if (scopedWorkspace && scopedPath) return scopedWorkspace === String(route.workspaceId || '') && scopedPath === normalizeWorkspacePath(route.workspaceRelativePath || '');
|
|
8
|
+
const requirements = route.materialRequirements || {};
|
|
9
|
+
const all = [...(requirements.required || []), ...(requirements.reference || []), ...(requirements.endpointRoles || []), ...(requirements.participantRoles || []), ...(requirements.dependencies || [])];
|
|
10
|
+
return all.some((requirement) => String(requirement.id || '') === String(material.requirementId || '') || (material.referenceTarget && String(requirement.reference?.target || '') === String(material.referenceTarget || '')));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function roleMaterialTarget(requirement = {}, descriptor = {}, workspaceById = new Map(), owningCache = null, route = {}) {
|
|
14
|
+
const requirementId = String(requirement.id || '');
|
|
15
|
+
const routeWorkspaceId = String(route.workspaceId || '');
|
|
16
|
+
const routePath = normalizeWorkspacePath(route.workspaceRelativePath || '');
|
|
17
|
+
const materialized = descriptor.materialized || [];
|
|
18
|
+
const scoped = materialized.filter((item) => {
|
|
19
|
+
const sourceRequirementId = String(item.sourceRequirementId || item.requirementId || '');
|
|
20
|
+
if (sourceRequirementId !== requirementId) return false;
|
|
21
|
+
const itemWorkspaceId = String(item.routeWorkspaceId || '');
|
|
22
|
+
const itemRoutePath = normalizeWorkspacePath(item.routePath || '');
|
|
23
|
+
return Boolean(itemWorkspaceId && itemRoutePath) && itemWorkspaceId === routeWorkspaceId && itemRoutePath === routePath;
|
|
24
|
+
});
|
|
25
|
+
const legacy = scoped.length ? [] : materialized.filter((item) => !item.routeWorkspaceId && !item.routePath && String(item.requirementId || '') === requirementId);
|
|
26
|
+
const matches = scoped.length ? scoped : legacy;
|
|
27
|
+
if (matches.length !== 1) return Object.freeze({ state: matches.length > 1 ? 'ambiguous' : 'unresolved', reason: matches.length > 1 ? 'material-ambiguous' : 'material-missing' });
|
|
28
|
+
const material = matches[0];
|
|
29
|
+
if (String(material.carrierKind || '') === 'workspace-archive-entry') {
|
|
30
|
+
const targetWorkspace = workspaceById.get(String(material.workspaceId || ''));
|
|
31
|
+
if (!targetWorkspace) return Object.freeze({ state: 'unresolved', reason: 'target-workspace-missing' });
|
|
32
|
+
return Object.freeze({ state: 'qualified', carrierKind: 'workspace-archive-entry', targetWorkspaceId: String(material.workspaceId || ''), archivePath: targetWorkspace.archivePath, archiveSha256: targetWorkspace.archiveSha256, innerPath: String(material.workspaceRelativePath || ''), archiveEntry: '', bytes: Number(material.bytes || 0), sha256: String(material.sha256 || ''), referenceTarget: String(material.referenceTarget || requirement.reference?.target || '') });
|
|
33
|
+
}
|
|
34
|
+
if (!owningCache) return Object.freeze({ state: 'unresolved', reason: 'owning-cache-missing' });
|
|
35
|
+
const cacheCandidates = (owningCache.materials || []).filter((item) => {
|
|
36
|
+
const sourceRequirementId = String(item.sourceRequirementId || item.requirementId || '');
|
|
37
|
+
if (sourceRequirementId !== requirementId) return false;
|
|
38
|
+
const itemWorkspaceId = String(item.routeWorkspaceId || '');
|
|
39
|
+
const itemRoutePath = normalizeWorkspacePath(item.routePath || '');
|
|
40
|
+
if (itemWorkspaceId && itemRoutePath) return itemWorkspaceId === routeWorkspaceId && itemRoutePath === routePath;
|
|
41
|
+
return String(item.requirementId || '') === requirementId;
|
|
42
|
+
});
|
|
43
|
+
const cacheMaterial = cacheCandidates.length === 1 ? cacheCandidates[0] : null;
|
|
44
|
+
if (!cacheMaterial) return Object.freeze({ state: 'unresolved', reason: 'cache-material-missing' });
|
|
45
|
+
return Object.freeze({ state: 'qualified', carrierKind: 'workspace-cache-entry', targetWorkspaceId: '', archivePath: owningCache.archivePath, archiveSha256: '', innerPath: '', archiveEntry: String(cacheMaterial.archiveEntry || ''), bytes: Number(cacheMaterial.bytes || 0), sha256: String(cacheMaterial.sha256 || ''), referenceTarget: String(cacheMaterial.referenceTarget || requirement.reference?.target || '') });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function detachedMaterial(descriptor, byPath, findings) {
|
|
49
|
+
const out = [];
|
|
50
|
+
for (const material of descriptor.materialized || []) {
|
|
51
|
+
if (String(material.carrierKind || '') === 'workspace-archive-entry') continue;
|
|
52
|
+
const file = oneFile(byPath, material.packagePath, findings, 'detached-material');
|
|
53
|
+
if (!file) continue;
|
|
54
|
+
const data = packageFileBytes(file);
|
|
55
|
+
const sha256 = sha256Hex(data);
|
|
56
|
+
if (Number(material.bytes || 0) !== data.byteLength || String(material.sha256 || '') !== sha256) findings.push(finding('error', 'portable.handoff-v2-surface.cache.material-identity-mismatch', 'Detached material bytes diverge from qualified closure identity.', { requirementId: material.requirementId || '' }));
|
|
57
|
+
out.push(Object.freeze({ requirementId: String(material.requirementId || ''), classification: String(material.classification || ''), referenceTarget: String(material.referenceTarget || ''), routeWorkspaceId: String(material.routeWorkspaceId || ''), routePath: String(material.routePath || ''), sourceRequirementId: String(material.sourceRequirementId || ''), originalPath: String(material.originalPath || ''), bytes: data.byteLength, sha256, data }));
|
|
58
|
+
}
|
|
59
|
+
return out.sort((a, b) => a.requirementId.localeCompare(b.requirementId));
|
|
60
|
+
}
|
|
61
|
+
export function groupRoutes(routes = []) { const map = new Map(); for (const route of [...routes].sort((a, b) => String(a.workspaceId || '').localeCompare(String(b.workspaceId || '')) || String(a.workspaceRelativePath || '').localeCompare(String(b.workspaceRelativePath || '')))) { const id = String(route.workspaceId || ''); const list = map.get(id) || []; list.push(route); map.set(id, list); } return map; }
|
|
62
|
+
export function uniqueFileIndex(files, findings) { const map = new Map(); for (const file of files) { const path = String(file.path || ''); const list = map.get(path) || []; list.push(file); map.set(path, list); } for (const [path, list] of map) if (list.length > 1) findings.push(finding('error', 'portable.handoff-v2-surface.source-path-ambiguous', 'Internal qualified source contains duplicate package paths.', { path, count: list.length })); return map; }
|
|
63
|
+
export function oneFile(byPath, path, findings, role) { const list = byPath.get(String(path || '')) || []; if (list.length !== 1) findings.push(finding('error', 'portable.handoff-v2-surface.source-unresolvable', 'Recipient-facing topology source byte is not uniquely resolvable.', { role, path: String(path || ''), count: list.length })); return list.length === 1 ? list[0] : null; }
|
|
64
|
+
export function duplicates(values = []) { const counts = new Map(); for (const value of values) counts.set(value, (counts.get(value) || 0) + 1); return [...counts].filter(([, count]) => count > 1).map(([value]) => value); }
|
|
65
|
+
function normalizeWorkspacePath(value = '') { return String(value || '').trim().replace(/\\/g, '/').replace(/^\.\//, '').replace(/^\/+/, ''); }
|
|
66
|
+
export function safeToken(value = '') { return String(value || '').trim().toLowerCase().normalize('NFKD').replace(/[\u0300-\u036f]/g, '').replace(/[^a-z0-9._-]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 80) || 'workspace'; }
|
|
67
|
+
export function stableJson(value) { return JSON.stringify(sortJson(value)); }
|
|
68
|
+
function sortJson(value) { if (Array.isArray(value)) return value.map(sortJson); if (!value || typeof value !== 'object') return value; return Object.fromEntries(Object.keys(value).sort().map((key) => [key, sortJson(value[key])])); }
|
|
69
|
+
export function finding(severity, code, message, extra = {}) { return Object.freeze({ severity, code, message, ...extra }); }
|
|
70
|
+
export function deepFreeze(value) { if (!value || typeof value !== 'object' || Object.isFrozen(value)) return value; if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer) return value; for (const child of Object.values(value)) deepFreeze(child); return Object.freeze(value); }
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { finalizeFile } from '../../../export/package.fileMap.js';
|
|
2
|
+
import { packageFileByteView, packageFileBytes, sha256Hex, utf8Bytes } from '../../../export/package.bytes.js';
|
|
3
|
+
import { exportFileMapZipUint8Array } from '../../../export/package.zip.js';
|
|
4
|
+
import { validatedC14nV2PrimarySelfDigest } from '../../../integrity/integrity.c14nV2.js';
|
|
5
|
+
import {
|
|
6
|
+
RECIPIENT_V2_EXTERNAL_PAYLOAD_SCHEMA_TARGET,
|
|
7
|
+
RECIPIENT_V2_WORKSPACE_SCHEMA_TARGET,
|
|
8
|
+
renderRecipientV2ExternalPayload,
|
|
9
|
+
renderRecipientV2Workspace,
|
|
10
|
+
renderRecipientV2WorkspaceRepresentation
|
|
11
|
+
} from './recipientV2.artifacts.js';
|
|
12
|
+
import { recipientEntriesFingerprint } from './recipientV2.topology.helpers.js';
|
|
13
|
+
import { recipientV2TransportFacts } from './recipientV2.transportManifest.js';
|
|
14
|
+
import { finding, oneFile, stableJson } from './recipientV2.topology.materials.js';
|
|
15
|
+
|
|
16
|
+
export function buildRecipientV2WorkspaceCarriers({ workspacePlans = [], byPath = new Map(), findings = [], createdAt = '', rootParent = null, files = [], topology = { workspaces: [] } } = {}) {
|
|
17
|
+
const workspaceById = new Map();
|
|
18
|
+
for (const plan of workspacePlans) {
|
|
19
|
+
const { binding, ordinal, workspaceId, workspacePath, archivePath, payloadArtifactPath, representationArtifactPath } = plan;
|
|
20
|
+
const sourceTarget = oneFile(byPath, binding.workspaceTarget?.packagePath, findings, 'workspace-target');
|
|
21
|
+
const sourceArchive = oneFile(byPath, binding.representation?.packagePath, findings, 'workspace-archive');
|
|
22
|
+
if (!sourceTarget || !sourceArchive) continue;
|
|
23
|
+
const coverage = String(binding.coverage || '') === 'bounded' || String(binding.representation?.kind || '') === 'bounded-workspace-snapshot' ? 'bounded' : 'complete';
|
|
24
|
+
const coverageEvidence = coverage === 'bounded' ? (binding.scope || {}) : (binding.completeness || {});
|
|
25
|
+
const sourceTargetData = packageFileByteView(sourceTarget);
|
|
26
|
+
const sourceTargetSha256 = sha256Hex(sourceTargetData);
|
|
27
|
+
const archiveFile = repathFinalizedFile(sourceArchive, archivePath, { kind: 'handoff-workspace-archive', logicalKind: coverage === 'bounded' ? 'recipient-v2-bounded-workspace-archive' : 'recipient-v2-complete-workspace-archive', mediaType: 'application/zip', boundary: coverage === 'bounded' ? 'Exact bounded Workspace Representation entry set. Detached recovery closure is separate and package placement is not binding authority.' : 'Exact complete Workspace archive representation. Its semantic provider activation is owned by the explicit Workspace Representation + External Payload artifacts; package placement is not binding authority.' });
|
|
28
|
+
const facts = {
|
|
29
|
+
workspaceId,
|
|
30
|
+
archivePath,
|
|
31
|
+
archiveBytes: archiveFile.bytes,
|
|
32
|
+
archiveSha256: archiveFile.sha256,
|
|
33
|
+
representationArtifactPath,
|
|
34
|
+
payloadArtifactPath,
|
|
35
|
+
sourceWorkspaceTargetInnerPath: String(binding.workspaceTarget?.innerPath || ''),
|
|
36
|
+
sourceWorkspaceTargetBytes: sourceTargetData.byteLength,
|
|
37
|
+
sourceWorkspaceTargetSha256: sourceTargetSha256,
|
|
38
|
+
entryCount: Number(binding.entryMap?.count || 0),
|
|
39
|
+
entriesFingerprint: recipientEntriesFingerprint(binding.entryMap?.entries || []),
|
|
40
|
+
coverage,
|
|
41
|
+
totalBytes: Number(coverageEvidence.totalBytes || 0),
|
|
42
|
+
coverageState: String(coverageEvidence.state || ''),
|
|
43
|
+
coverageBasis: String(coverageEvidence.basis || coverageEvidence.proof || ''),
|
|
44
|
+
completenessState: coverage === 'complete' ? String(coverageEvidence.state || '') : '',
|
|
45
|
+
completenessBasis: coverage === 'complete' ? String(coverageEvidence.basis || '') : '',
|
|
46
|
+
archiveCodec: String(binding.representation?.codec || ''),
|
|
47
|
+
providerKind: String(binding.provider?.kind || '')
|
|
48
|
+
};
|
|
49
|
+
const workspaceFile = finalizeFile({
|
|
50
|
+
path: workspacePath,
|
|
51
|
+
kind: 'handoff-package-workspace-node',
|
|
52
|
+
logicalKind: 'recipient-v2-workspace-node',
|
|
53
|
+
mediaType: 'text/markdown',
|
|
54
|
+
transportFacts: recipientV2TransportFacts('workspace-node', facts),
|
|
55
|
+
content: renderRecipientV2Workspace({
|
|
56
|
+
createdAt,
|
|
57
|
+
parent: rootParent,
|
|
58
|
+
workspaceId,
|
|
59
|
+
title: `${workspaceId || 'Workspace'} — Handoff Workspace`,
|
|
60
|
+
representationPath: representationArtifactPath,
|
|
61
|
+
sourceWorkspaceInnerPath: facts.sourceWorkspaceTargetInnerPath,
|
|
62
|
+
facts
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
const workspaceParent = recipientV2ParentAuthority(workspaceFile, 'tiinex.workspace.v1', RECIPIENT_V2_WORKSPACE_SCHEMA_TARGET, createdAt);
|
|
66
|
+
const payloadFacts = {
|
|
67
|
+
workspaceId,
|
|
68
|
+
payloadClass: 'workspace-representation',
|
|
69
|
+
archivePath,
|
|
70
|
+
archiveBytes: archiveFile.bytes,
|
|
71
|
+
archiveSha256: archiveFile.sha256
|
|
72
|
+
};
|
|
73
|
+
const payloadArtifact = finalizeFile({
|
|
74
|
+
path: payloadArtifactPath,
|
|
75
|
+
kind: 'tiinex-external-payload-artifact',
|
|
76
|
+
logicalKind: 'recipient-v2-workspace-representation-payload',
|
|
77
|
+
mediaType: 'text/markdown',
|
|
78
|
+
transportFacts: recipientV2TransportFacts('workspace-representation-payload', payloadFacts),
|
|
79
|
+
content: renderRecipientV2ExternalPayload({
|
|
80
|
+
createdAt,
|
|
81
|
+
parent: workspaceParent,
|
|
82
|
+
title: `Workspace Representation Payload — ${workspaceId}`,
|
|
83
|
+
summary: coverage === 'bounded' ? 'Exact bounded Workspace archive payload referenced by the canonical Workspace Representation binding.' : 'Exact complete Workspace archive payload referenced by the canonical Workspace Representation binding.',
|
|
84
|
+
label: `${workspaceId} ${coverage} Workspace archive`,
|
|
85
|
+
kind: 'zip export',
|
|
86
|
+
role: `${coverage} Workspace archive representation payload`,
|
|
87
|
+
location: archivePath,
|
|
88
|
+
bytes: archiveFile.bytes,
|
|
89
|
+
sha256: archiveFile.sha256,
|
|
90
|
+
facts: payloadFacts
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
const representationFacts = {
|
|
94
|
+
workspaceId,
|
|
95
|
+
workspaceArtifactPath: workspacePath,
|
|
96
|
+
payloadArtifactPath,
|
|
97
|
+
sourceWorkspaceTargetInnerPath: facts.sourceWorkspaceTargetInnerPath,
|
|
98
|
+
archivePath,
|
|
99
|
+
archiveSha256: archiveFile.sha256,
|
|
100
|
+
entryCount: facts.entryCount,
|
|
101
|
+
entriesFingerprint: facts.entriesFingerprint,
|
|
102
|
+
coverage,
|
|
103
|
+
coverageState: facts.coverageState,
|
|
104
|
+
completenessState: facts.completenessState
|
|
105
|
+
};
|
|
106
|
+
const representationArtifact = finalizeFile({
|
|
107
|
+
path: representationArtifactPath,
|
|
108
|
+
kind: 'tiinex-workspace-representation-artifact',
|
|
109
|
+
logicalKind: 'recipient-v2-workspace-representation-binding',
|
|
110
|
+
mediaType: 'text/markdown',
|
|
111
|
+
transportFacts: recipientV2TransportFacts('workspace-representation', representationFacts),
|
|
112
|
+
content: renderRecipientV2WorkspaceRepresentation({
|
|
113
|
+
createdAt,
|
|
114
|
+
parent: workspaceParent,
|
|
115
|
+
title: `Workspace Representation — ${workspaceId}`,
|
|
116
|
+
workspaceLabel: `${workspaceId} Handoff Workspace`,
|
|
117
|
+
workspaceArtifactPath: workspacePath,
|
|
118
|
+
payloadLabel: `${workspaceId} Workspace archive payload`,
|
|
119
|
+
payloadArtifactPath,
|
|
120
|
+
workspaceArtifactInnerPath: facts.sourceWorkspaceTargetInnerPath,
|
|
121
|
+
decoderRequirement: 'deterministic stored ZIP with safe-entry validation',
|
|
122
|
+
coverage,
|
|
123
|
+
facts: representationFacts
|
|
124
|
+
})
|
|
125
|
+
});
|
|
126
|
+
files.push(workspaceFile, payloadArtifact, representationArtifact, archiveFile);
|
|
127
|
+
const projection = Object.freeze({
|
|
128
|
+
workspaceId,
|
|
129
|
+
ordinal,
|
|
130
|
+
workspacePath,
|
|
131
|
+
workspaceSha256: workspaceFile.sha256,
|
|
132
|
+
representationArtifactPath,
|
|
133
|
+
representationArtifactSha256: representationArtifact.sha256,
|
|
134
|
+
payloadArtifactPath,
|
|
135
|
+
payloadArtifactSha256: payloadArtifact.sha256,
|
|
136
|
+
archivePath,
|
|
137
|
+
archiveSha256: archiveFile.sha256,
|
|
138
|
+
sourceWorkspaceTargetInnerPath: facts.sourceWorkspaceTargetInnerPath,
|
|
139
|
+
sourceWorkspaceTargetSha256: sourceTargetSha256,
|
|
140
|
+
sourceWorkspaceTargetBytes: sourceTargetData.byteLength,
|
|
141
|
+
coverage
|
|
142
|
+
});
|
|
143
|
+
topology.workspaces.push(projection);
|
|
144
|
+
workspaceById.set(workspaceId, { ...projection, file: workspaceFile, representationArtifact, payloadArtifact, parent: workspaceParent });
|
|
145
|
+
}
|
|
146
|
+
return workspaceById;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function repathFinalizedFile(file = {}, path = '', overrides = {}) {
|
|
150
|
+
const data = packageFileByteView(file);
|
|
151
|
+
const bytes = Number(file.bytes || 0);
|
|
152
|
+
const sha256 = String(file.sha256 || '');
|
|
153
|
+
const fingerprint = String(file.fingerprint || '');
|
|
154
|
+
if (bytes !== data.byteLength || !/^[0-9a-f]{64}$/i.test(sha256) || !fingerprint) {
|
|
155
|
+
return finalizeFile({ ...file, ...overrides, path, requestedPath: path, data });
|
|
156
|
+
}
|
|
157
|
+
return Object.freeze({ ...file, ...overrides, path, requestedPath: path, data, bytes, sha256, fingerprint });
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function recipientV2ParentAuthority(file, schemaId, schemaTarget, createdAt) {
|
|
161
|
+
const markdown = new TextDecoder('utf-8').decode(packageFileBytes(file));
|
|
162
|
+
const self = validatedC14nV2PrimarySelfDigest(markdown);
|
|
163
|
+
if (self.state !== 'verified') throw new Error(`portable.handoff-v2-surface.parent-self-unverified:${String(file?.path || '')}:${self.reason || self.state}`);
|
|
164
|
+
return Object.freeze({ path: String(file.path || ''), label: String(file.path || ''), schemaId, schemaTarget, createdAt, selfDigest: self.value });
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function bindingForWorkspace(descriptor = {}, workspaceId = '') { return (descriptor.workspaceArchiveBindings || []).find((binding) => String(binding.workspaceId || '') === String(workspaceId || '')) || null; }
|
|
168
|
+
|
|
169
|
+
export function buildRecipientV2BootstrapCarrier(source, createdAt, findings, parent) {
|
|
170
|
+
const entries = source.map((file) => ({ path: String(file.path || '').slice('tiinex.bootstrap/'.length), data: packageFileBytes(file) })).filter((entry) => entry.path).sort((a, b) => a.path.localeCompare(b.path));
|
|
171
|
+
if (!entries.length) return null;
|
|
172
|
+
const zipBytes = exportFileMapZipUint8Array(entries, 'portable.handoff-v2-surface.bootstrap.path.invalid');
|
|
173
|
+
const payloadPath = '001-2-bootstrap.zip';
|
|
174
|
+
const artifactPath = '001-2-bootstrap.trace.md';
|
|
175
|
+
const payload = finalizeFile({ path: payloadPath, kind: 'handoff-tooling-bootstrap-archive', logicalKind: 'recipient-v2-tooling-bootstrap-payload', mediaType: 'application/zip', data: zipBytes, boundary: 'Portable Tooling bootstrap payload. Runtime/source/JSON remain inside this explicitly referenced ZIP and gain no authority by archive placement.' });
|
|
176
|
+
const identities = entries.map((entry) => ({ path: entry.path, bytes: entry.data.byteLength, sha256: sha256Hex(entry.data) }));
|
|
177
|
+
const bootstrapFacts = { archivePath: payloadPath, archiveBytes: payload.bytes, archiveSha256: payload.sha256, entryCount: identities.length, totalBytes: identities.reduce((sum, item) => sum + item.bytes, 0), entriesFingerprint: sha256Hex(utf8Bytes(stableJson(identities))) };
|
|
178
|
+
const artifact = finalizeFile({ path: artifactPath, kind: 'tiinex-external-payload-artifact', logicalKind: 'recipient-v2-tooling-bootstrap-reference', mediaType: 'text/markdown', transportFacts: recipientV2TransportFacts('portable Tooling bootstrap runtime for recipient orientation and verification', bootstrapFacts), content: renderRecipientV2ExternalPayload({
|
|
179
|
+
createdAt,
|
|
180
|
+
parent,
|
|
181
|
+
title: 'Portable Tooling Bootstrap Payload',
|
|
182
|
+
summary: 'Qualified package-local payload node for the portable Tooling bootstrap archive.',
|
|
183
|
+
label: 'portable Tooling bootstrap runtime',
|
|
184
|
+
kind: 'zip export',
|
|
185
|
+
role: 'portable Tooling bootstrap runtime for recipient orientation and verification',
|
|
186
|
+
location: payloadPath,
|
|
187
|
+
bytes: payload.bytes,
|
|
188
|
+
sha256: payload.sha256,
|
|
189
|
+
facts: bootstrapFacts
|
|
190
|
+
}) });
|
|
191
|
+
if (!entries.some((entry) => entry.path === 'manifest.json')) findings.push(finding('error', 'portable.handoff-v2-surface.bootstrap.manifest-missing', 'Bootstrap payload source lacks its existing manifest.json authority.'));
|
|
192
|
+
return Object.freeze({ artifact, payload, projection: Object.freeze({ artifactPath, payloadPath, payloadSha256: payload.sha256, entryCount: identities.length }) });
|
|
193
|
+
}
|