@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,353 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { access, readFile, stat } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { packageFileBytes, sha256Hex } from '../../../../export/package.bytes.js';
|
|
5
|
+
import { parseArtifactMarkdown } from '../../../../artifacts/artifact.parse.js';
|
|
6
|
+
import { projectHandoffMaterialRequirements, projectParticipantRoleRequirements } from '../../handoff/materialClosure.requirements.js';
|
|
7
|
+
import { safeWorkspaceToken } from './handoff.manufacture.multiRoot.js';
|
|
8
|
+
import { parseWorkspaceQualifiedReference } from '../../handoff/workspaceQualifiedReference.js';
|
|
9
|
+
|
|
10
|
+
export async function projectManufacturingRequirements({ handoff, workspaceId, handoffPath, routeSpecs, workspaceRuntimeById }) {
|
|
11
|
+
const primary = projectHandoffMaterialRequirements(handoff);
|
|
12
|
+
const combined = { required: [], reference: [], endpointRoles: [], participantRoles: [], dependencies: [], findings: [...(primary.findings || [])] };
|
|
13
|
+
const seenRoute = new Set();
|
|
14
|
+
for (const route of routeSpecs || []) {
|
|
15
|
+
const routeWorkspaceId = String(route.workspaceId || workspaceId || '').trim();
|
|
16
|
+
const routePath = normalizeRelativePath(route.path || route.workspaceRelativePath || '');
|
|
17
|
+
const routeKey = `${routeWorkspaceId}\u0000${routePath}`;
|
|
18
|
+
if (!routeWorkspaceId || !routePath || seenRoute.has(routeKey)) continue;
|
|
19
|
+
seenRoute.add(routeKey);
|
|
20
|
+
const runtime = workspaceRuntimeById.get(routeWorkspaceId);
|
|
21
|
+
if (!runtime) throw new Error(`portable.handoff-manufacture.route.workspace-unresolved:${routeWorkspaceId}`);
|
|
22
|
+
const routeMarkdown = routeWorkspaceId === workspaceId && routePath === handoffPath
|
|
23
|
+
? handoff.markdown
|
|
24
|
+
: await readWorkspaceText(runtime.root, routePath, 'portable.handoff-manufacture.route.path');
|
|
25
|
+
const projected = routeWorkspaceId === workspaceId && routePath === handoffPath
|
|
26
|
+
? primary
|
|
27
|
+
: projectHandoffMaterialRequirements({ id: routePath, path: routePath, semanticStatus: 'unknown', markdown: routeMarkdown });
|
|
28
|
+
const primaryRoute = routeWorkspaceId === workspaceId && routePath === handoffPath;
|
|
29
|
+
for (const key of ['required', 'reference', 'endpointRoles']) {
|
|
30
|
+
for (const requirement of projected[key] || []) combined[key].push(scopeRouteRequirement(requirement, routeWorkspaceId, routePath, primaryRoute));
|
|
31
|
+
}
|
|
32
|
+
combined.participantRoles.push(...projectParticipantRoleRequirements(route.participantRoles || route.roles || [], { workspaceId: routeWorkspaceId, routePath }));
|
|
33
|
+
combined.findings.push(...(projected.findings || []));
|
|
34
|
+
}
|
|
35
|
+
if (!seenRoute.has(`${workspaceId}\u0000${handoffPath}`)) {
|
|
36
|
+
for (const key of ['required', 'reference', 'endpointRoles']) for (const requirement of primary[key] || []) combined[key].push(scopeRouteRequirement(requirement, workspaceId, handoffPath, true));
|
|
37
|
+
}
|
|
38
|
+
return Object.freeze({
|
|
39
|
+
...primary,
|
|
40
|
+
required: Object.freeze(combined.required),
|
|
41
|
+
reference: Object.freeze(combined.reference),
|
|
42
|
+
endpointRoles: Object.freeze(combined.endpointRoles),
|
|
43
|
+
participantRoles: Object.freeze(combined.participantRoles),
|
|
44
|
+
dependencies: Object.freeze(combined.dependencies),
|
|
45
|
+
counts: Object.freeze({ required: combined.required.length, reference: combined.reference.length, endpointRoles: combined.endpointRoles.length, participantRoles: combined.participantRoles.length, dependencies: combined.dependencies.length }),
|
|
46
|
+
findings: Object.freeze(combined.findings)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function scopeRouteRequirement(requirement, routeWorkspaceId, routePath, preserveId = false) {
|
|
51
|
+
return Object.freeze({
|
|
52
|
+
...requirement,
|
|
53
|
+
id: preserveId ? String(requirement.id || '') : `route:${safeWorkspaceToken(routeWorkspaceId)}:${safeWorkspaceToken(routePath)}:${String(requirement.id || '')}`,
|
|
54
|
+
sourceRequirementId: String(requirement.sourceRequirementId || requirement.id || ''),
|
|
55
|
+
routeWorkspaceId,
|
|
56
|
+
routePath
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export async function resolveWorkspaceRequirementMaterials(requirements, workspaceRuntimeById, bindings = {}) {
|
|
61
|
+
const out = [];
|
|
62
|
+
for (const requirement of [...(requirements.required || []), ...(requirements.reference || []), ...(requirements.endpointRoles || []), ...(requirements.participantRoles || []), ...(requirements.dependencies || [])]) {
|
|
63
|
+
const explicit = bindingForRequirement(bindings, requirement);
|
|
64
|
+
if (explicit) {
|
|
65
|
+
const workspaceBound = materialCandidateFromWorkspaceBinding(requirement, explicit, workspaceRuntimeById);
|
|
66
|
+
if (workspaceBound) { out.push(workspaceBound); continue; }
|
|
67
|
+
const owner = workspaceRuntimeById.get(String(requirement.routeWorkspaceId || '')) || [...workspaceRuntimeById.values()][0];
|
|
68
|
+
const candidate = await materialCandidateFromBinding(requirement, explicit, owner?.root || '.');
|
|
69
|
+
if (candidate) out.push(candidate);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
const targetWorkspaceId = String(requirement.targetWorkspaceId || '').trim();
|
|
73
|
+
const targetPath = normalizeRelativePath(requirement.targetPath || '');
|
|
74
|
+
if (targetWorkspaceId && targetPath) {
|
|
75
|
+
const targetRuntime = workspaceRuntimeById.get(targetWorkspaceId);
|
|
76
|
+
const entry = targetRuntime ? entryFromEnumeration(targetRuntime.enumeration, targetPath) : null;
|
|
77
|
+
if (entry) {
|
|
78
|
+
out.push(materialCandidateFromWorkspaceEntry(requirement, targetWorkspaceId, targetPath, entry, targetRuntime.enumeration));
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const target = String(requirement.reference?.target || '');
|
|
83
|
+
if (!target) continue;
|
|
84
|
+
const workspaceQualified = resolveCarriedWorkspaceQualifiedReference(target, workspaceRuntimeById);
|
|
85
|
+
if (workspaceQualified) {
|
|
86
|
+
const targetRuntime = workspaceRuntimeById.get(workspaceQualified.workspaceId);
|
|
87
|
+
const entry = targetRuntime ? entryFromEnumeration(targetRuntime.enumeration, workspaceQualified.path) : null;
|
|
88
|
+
if (entry) out.push(materialCandidateFromWorkspaceEntry(requirement, workspaceQualified.workspaceId, workspaceQualified.path, entry, targetRuntime.enumeration));
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (isExternalReference(target) || target.startsWith('#')) continue;
|
|
92
|
+
const routeWorkspaceId = String(requirement.routeWorkspaceId || [...workspaceRuntimeById.keys()][0] || '');
|
|
93
|
+
const runtime = workspaceRuntimeById.get(routeWorkspaceId);
|
|
94
|
+
if (!runtime) continue;
|
|
95
|
+
const handoffDir = path.dirname(path.resolve(runtime.root, String(requirement.routePath || '')));
|
|
96
|
+
const absolute = path.resolve(handoffDir, decodeURIComponent(target.split('#')[0]));
|
|
97
|
+
if (!inside(runtime.root, absolute)) continue;
|
|
98
|
+
const relative = normalizeRelativePath(path.relative(runtime.root, absolute));
|
|
99
|
+
const entry = entryFromEnumeration(runtime.enumeration, relative);
|
|
100
|
+
if (!entry) continue;
|
|
101
|
+
out.push(materialCandidateFromWorkspaceEntry(requirement, routeWorkspaceId, relative, entry, runtime.enumeration));
|
|
102
|
+
}
|
|
103
|
+
return out;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
export async function expandPointerDependencyClosure(input = {}) {
|
|
108
|
+
let requirements = input.requirements || {};
|
|
109
|
+
let materials = [...(input.materials || [])];
|
|
110
|
+
const dependencies = [...(requirements.dependencies || [])];
|
|
111
|
+
const findings = [...(requirements.findings || [])];
|
|
112
|
+
const seenSourceTargets = new Set();
|
|
113
|
+
const seenDependencyIds = new Set(dependencies.map((item) => String(item.id || '')));
|
|
114
|
+
const maxDependencies = 128;
|
|
115
|
+
|
|
116
|
+
for (let cursor = 0; cursor < materials.length; cursor += 1) {
|
|
117
|
+
const material = materials[cursor];
|
|
118
|
+
const requirement = findRequirement(requirements, material.requirementId, dependencies);
|
|
119
|
+
if (!requirement) continue;
|
|
120
|
+
const markdown = decodeUtf8(material.data);
|
|
121
|
+
if (!isTiinexPointerMarkdown(markdown)) continue;
|
|
122
|
+
const targets = pointerDependencyTargets(markdown);
|
|
123
|
+
for (let index = 0; index < targets.length; index += 1) {
|
|
124
|
+
const target = targets[index];
|
|
125
|
+
const dedupeKey = `${material.sha256 || sha256Hex(packageFileBytes(material))}\u0000${target}`;
|
|
126
|
+
if (seenSourceTargets.has(dedupeKey)) continue;
|
|
127
|
+
seenSourceTargets.add(dedupeKey);
|
|
128
|
+
if (dependencies.length >= maxDependencies) throw new Error('portable.handoff-manufacture.pointer-dependency.limit-exceeded');
|
|
129
|
+
const derived = derivePointerDependencyRequirement({ sourceRequirement: requirement, sourceMaterial: material, target, index, workspaceRuntimeById: input.workspaceRuntimeById });
|
|
130
|
+
if (seenDependencyIds.has(derived.id)) continue;
|
|
131
|
+
seenDependencyIds.add(derived.id);
|
|
132
|
+
dependencies.push(derived);
|
|
133
|
+
const resolved = await resolveDerivedDependencyMaterial(derived, material, input.workspaceRuntimeById, input.bindings || {});
|
|
134
|
+
if (resolved) materials.push(resolved);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
requirements = Object.freeze({
|
|
139
|
+
...requirements,
|
|
140
|
+
dependencies: Object.freeze(dependencies),
|
|
141
|
+
counts: Object.freeze({ ...(requirements.counts || {}), dependencies: dependencies.length }),
|
|
142
|
+
findings: Object.freeze(findings)
|
|
143
|
+
});
|
|
144
|
+
return Object.freeze({ requirements, materials: Object.freeze(materials) });
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function findRequirement(requirements = {}, requirementId = '', pendingDependencies = []) {
|
|
148
|
+
const id = String(requirementId || '');
|
|
149
|
+
const pending = (pendingDependencies || []).find((item) => String(item.id || '') === id);
|
|
150
|
+
if (pending) return pending;
|
|
151
|
+
for (const key of ['required', 'reference', 'endpointRoles', 'participantRoles', 'dependencies']) {
|
|
152
|
+
const found = (requirements[key] || []).find((item) => String(item.id || '') === id);
|
|
153
|
+
if (found) return found;
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function derivePointerDependencyRequirement({ sourceRequirement = {}, sourceMaterial = {}, target = '', index = 0, workspaceRuntimeById = new Map() }) {
|
|
159
|
+
const routeWorkspaceId = String(sourceRequirement.routeWorkspaceId || sourceMaterial.provenance?.workspaceId || '').trim();
|
|
160
|
+
const routePath = String(sourceRequirement.routePath || '').trim();
|
|
161
|
+
let targetWorkspaceId = '';
|
|
162
|
+
let targetPath = '';
|
|
163
|
+
const workspaceQualified = resolveCarriedWorkspaceQualifiedReference(target, workspaceRuntimeById);
|
|
164
|
+
if (workspaceQualified) {
|
|
165
|
+
targetWorkspaceId = workspaceQualified.workspaceId;
|
|
166
|
+
targetPath = workspaceQualified.path;
|
|
167
|
+
} else if (!isExternalReference(target) && !String(target).startsWith('#')) {
|
|
168
|
+
const sourceWorkspaceId = String(sourceMaterial.provenance?.workspaceId || '').trim();
|
|
169
|
+
const sourceWorkspacePath = normalizeRelativePath(sourceMaterial.provenance?.path || sourceMaterial.path || '');
|
|
170
|
+
if (sourceWorkspaceId && sourceWorkspacePath && workspaceRuntimeById.has(sourceWorkspaceId)) {
|
|
171
|
+
const relative = resolveRelativeWorkspaceTarget(sourceWorkspacePath, target);
|
|
172
|
+
if (relative) {
|
|
173
|
+
targetWorkspaceId = sourceWorkspaceId;
|
|
174
|
+
targetPath = relative;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const sourceRequirementId = String(sourceRequirement.id || 'pointer');
|
|
179
|
+
const id = `pointer-target:${safeWorkspaceToken(sourceRequirementId)}:${index + 1}:${sha256Text(target).slice(0, 12)}`;
|
|
180
|
+
return Object.freeze({
|
|
181
|
+
id,
|
|
182
|
+
name: `Pointer target ${index + 1} from ${String(sourceRequirement.name || sourceRequirementId)}`,
|
|
183
|
+
classification: 'pointer-target',
|
|
184
|
+
material: 'exact Pointer target dependency',
|
|
185
|
+
purpose: 'recursive package-local dependency closure for carried Tiinex Pointer material',
|
|
186
|
+
availability: 'declared',
|
|
187
|
+
materialReference: String(target),
|
|
188
|
+
reference: Object.freeze({ form: isExternalReference(target) ? 'external-target' : 'pointer-target', raw: String(target), label: '', target: String(target), exactTargetDeclared: true }),
|
|
189
|
+
routeWorkspaceId,
|
|
190
|
+
routePath,
|
|
191
|
+
targetWorkspaceId,
|
|
192
|
+
targetPath,
|
|
193
|
+
sourceRequirementId,
|
|
194
|
+
source: null,
|
|
195
|
+
fields: Object.freeze({ RouteWorkspace: routeWorkspaceId, RoutePath: routePath, SourceRequirement: sourceRequirementId, TargetWorkspace: targetWorkspaceId, TargetPath: targetPath, Reference: String(target) })
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async function resolveDerivedDependencyMaterial(requirement, sourceMaterial, workspaceRuntimeById, bindings) {
|
|
200
|
+
const explicit = bindingForRequirement(bindings, requirement);
|
|
201
|
+
if (explicit) {
|
|
202
|
+
const workspaceBound = materialCandidateFromWorkspaceBinding(requirement, explicit, workspaceRuntimeById);
|
|
203
|
+
if (workspaceBound) return workspaceBound;
|
|
204
|
+
const owner = workspaceRuntimeById.get(String(requirement.routeWorkspaceId || '')) || [...workspaceRuntimeById.values()][0];
|
|
205
|
+
return materialCandidateFromBinding(requirement, explicit, owner?.root || '.');
|
|
206
|
+
}
|
|
207
|
+
if (requirement.targetWorkspaceId && requirement.targetPath) {
|
|
208
|
+
const runtime = workspaceRuntimeById.get(String(requirement.targetWorkspaceId));
|
|
209
|
+
const entry = runtime ? entryFromEnumeration(runtime.enumeration, requirement.targetPath) : null;
|
|
210
|
+
if (entry) return materialCandidateFromWorkspaceEntry(requirement, requirement.targetWorkspaceId, requirement.targetPath, entry, runtime.enumeration);
|
|
211
|
+
}
|
|
212
|
+
const target = String(requirement.reference?.target || '');
|
|
213
|
+
const sourcePath = String(sourceMaterial.provenance?.sourcePath || '').trim();
|
|
214
|
+
if (sourcePath && !isExternalReference(target) && !target.startsWith('#')) {
|
|
215
|
+
const clean = safeDecodeURIComponent(target.split('#')[0].split('?')[0]);
|
|
216
|
+
if (clean && !path.isAbsolute(clean)) {
|
|
217
|
+
const absolute = path.resolve(path.dirname(sourcePath), clean);
|
|
218
|
+
if (await regularFileExists(absolute)) {
|
|
219
|
+
return materialCandidateFromBinding(requirement, { sourcePath: absolute, referenceTarget: target }, '.');
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function bindingForRequirement(bindings = {}, requirement = {}) {
|
|
227
|
+
const target = String(requirement.reference?.target || requirement.referenceTarget || '');
|
|
228
|
+
return bindings[requirement.id] || bindings[requirement.name] || (target ? bindings[target] : null) || null;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function isTiinexPointerMarkdown(markdown = '') {
|
|
232
|
+
if (!markdown) return false;
|
|
233
|
+
try { return String(parseArtifactMarkdown(markdown).envelope?.current?.schema?.id || '').trim() === 'tiinex.pointer.v1'; }
|
|
234
|
+
catch { return false; }
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function pointerDependencyTargets(markdown = '') {
|
|
238
|
+
const out = [];
|
|
239
|
+
for (const heading of ['Destinations', 'Current Origin']) {
|
|
240
|
+
const section = markdownSection(markdown, heading);
|
|
241
|
+
const links = /\[[^\]\r\n]+\]\(([^)\r\n]+)\)/g;
|
|
242
|
+
let match;
|
|
243
|
+
while ((match = links.exec(section))) {
|
|
244
|
+
const target = String(match[1] || '').trim();
|
|
245
|
+
if (target && !target.startsWith('#')) out.push(target);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return [...new Set(out)];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function markdownSection(markdown = '', heading = '') {
|
|
252
|
+
const source = String(markdown || '');
|
|
253
|
+
const match = new RegExp(`^##\\s+${escapeRegExp(heading)}\\s*$`, 'mi').exec(source);
|
|
254
|
+
if (!match) return '';
|
|
255
|
+
const rest = source.slice(match.index + match[0].length);
|
|
256
|
+
const next = /^#{1,2}\s+/m.exec(rest);
|
|
257
|
+
return (next ? rest.slice(0, next.index) : rest).trim();
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
function resolveCarriedWorkspaceQualifiedReference(target = '', workspaceRuntimeById = new Map()) {
|
|
262
|
+
const parsed = parseWorkspaceQualifiedReference(target);
|
|
263
|
+
return parsed && workspaceRuntimeById?.has?.(parsed.workspaceId) ? parsed : null;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function resolveRelativeWorkspaceTarget(sourcePath = '', target = '') {
|
|
267
|
+
const raw = safeDecodeURIComponent(String(target || '').split('#')[0].split('?')[0]);
|
|
268
|
+
if (!raw || path.posix.isAbsolute(raw) || raw.startsWith('\\')) return '';
|
|
269
|
+
const base = normalizeRelativePath(sourcePath).split('/').slice(0, -1);
|
|
270
|
+
for (const part of raw.replace(/\\/g, '/').split('/')) {
|
|
271
|
+
if (!part || part === '.') continue;
|
|
272
|
+
if (part === '..') { if (!base.length) return ''; base.pop(); }
|
|
273
|
+
else base.push(part);
|
|
274
|
+
}
|
|
275
|
+
return normalizeRelativePath(base.join('/'));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
async function regularFileExists(absolute) {
|
|
279
|
+
try { await access(absolute); return (await stat(absolute)).isFile(); }
|
|
280
|
+
catch { return false; }
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
export function decodeUtf8(value) { try { return new TextDecoder('utf-8', { fatal: true }).decode(packageFileBytes({ data: value })); } catch { return ''; } }
|
|
285
|
+
function safeDecodeURIComponent(value = '') { try { return decodeURIComponent(value); } catch { return ''; } }
|
|
286
|
+
function escapeRegExp(value = '') { return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); }
|
|
287
|
+
|
|
288
|
+
export function entryFromEnumeration(enumeration = {}, relative = '') {
|
|
289
|
+
const normalized = normalizeRelativePath(relative);
|
|
290
|
+
const matches = (enumeration.materialization?.entries || []).filter((entry) => normalizeRelativePath(entry.path) === normalized);
|
|
291
|
+
return matches.length === 1 ? matches[0] : null;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export function materialCandidateFromWorkspaceEntry(requirement, workspaceId, relative, entry, enumeration) {
|
|
295
|
+
return Object.freeze({
|
|
296
|
+
requirementId: requirement.id,
|
|
297
|
+
referenceTarget: String(requirement.reference?.target || requirement.referenceTarget || ''),
|
|
298
|
+
path: relative,
|
|
299
|
+
data: entry.data,
|
|
300
|
+
bytes: entry.bytes,
|
|
301
|
+
sha256: entry.sha256,
|
|
302
|
+
mediaType: entry.mediaType,
|
|
303
|
+
providerId: 'node-workspace-enumerator',
|
|
304
|
+
providerKind: 'qualified-local-workspace',
|
|
305
|
+
provenance: Object.freeze({ workspaceId, path: relative, boundary: '.' }),
|
|
306
|
+
authority: Object.freeze({ localIdentityQualified: true, completenessEvidenceFingerprint: enumeration.evidence.entriesFingerprint })
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
function materialCandidateFromWorkspaceBinding(requirement, binding, workspaceRuntimeById) {
|
|
312
|
+
if (!binding || typeof binding !== 'object') return null;
|
|
313
|
+
const workspaceId = String(binding.workspaceId || binding.targetWorkspaceId || '').trim();
|
|
314
|
+
const relative = normalizeRelativePath(binding.workspacePath || binding.targetPath || (workspaceId ? binding.path : ''));
|
|
315
|
+
if (!workspaceId || !relative) return null;
|
|
316
|
+
const runtime = workspaceRuntimeById.get(workspaceId);
|
|
317
|
+
const entry = runtime ? entryFromEnumeration(runtime.enumeration, relative) : null;
|
|
318
|
+
if (!entry) return null;
|
|
319
|
+
return materialCandidateFromWorkspaceEntry(requirement, workspaceId, relative, entry, runtime.enumeration);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
async function materialCandidateFromBinding(requirement, binding, workspaceRoot) {
|
|
323
|
+
if (typeof binding === 'string') {
|
|
324
|
+
const absolute = path.resolve(workspaceRoot, binding);
|
|
325
|
+
assertInside(workspaceRoot, absolute, 'portable.handoff-manufacture.material-binding.outside-workspace');
|
|
326
|
+
const data = new Uint8Array(await readFile(absolute));
|
|
327
|
+
return Object.freeze({ requirementId: requirement.id, referenceTarget: String(requirement.reference?.target || ''), path: normalizeRelativePath(path.relative(workspaceRoot, absolute)), data, providerId: 'node-explicit-material-binding', providerKind: 'qualified-local-workspace', authority: Object.freeze({ localIdentityQualified: true }) });
|
|
328
|
+
}
|
|
329
|
+
if (!binding || typeof binding !== 'object') return null;
|
|
330
|
+
if (binding.sourcePath || binding.absolutePath) {
|
|
331
|
+
const sourcePath = path.resolve(String(binding.sourcePath || binding.absolutePath));
|
|
332
|
+
const data = new Uint8Array(await readFile(sourcePath));
|
|
333
|
+
return Object.freeze({ ...binding, requirementId: requirement.id, referenceTarget: String(binding.referenceTarget || requirement.reference?.target || ''), path: normalizeRelativePath(sourcePath), data, bytes: data.byteLength, sha256: sha256Hex(data), providerId: String(binding.providerId || 'node-explicit-external-material-binding'), providerKind: String(binding.providerKind || 'supplied-external-material'), provenance: Object.freeze({ ...(binding.provenance || {}), sourcePath, boundary: 'explicit-material-binding' }), authority: Object.freeze({ ...(binding.authority || {}), localIdentityQualified: true }) });
|
|
334
|
+
}
|
|
335
|
+
if (binding.path) return materialCandidateFromBinding(requirement, String(binding.path), workspaceRoot);
|
|
336
|
+
const data = packageFileBytes(binding);
|
|
337
|
+
return Object.freeze({ ...binding, requirementId: requirement.id, referenceTarget: String(binding.referenceTarget || requirement.reference?.target || ''), data, providerId: String(binding.providerId || 'node-explicit-material-binding'), providerKind: String(binding.providerKind || 'supplied-material'), authority: Object.freeze({ ...(binding.authority || {}), localIdentityQualified: binding.authority?.localIdentityQualified === true || !requirement.reference?.target }) });
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
async function readWorkspaceText(root, relative, code) {
|
|
341
|
+
const absolute = path.resolve(root, relative);
|
|
342
|
+
assertInside(root, absolute, `${code}.outside-workspace`);
|
|
343
|
+
return readFile(absolute, 'utf8');
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
export function normalizeRelativePath(value = '') { return String(value || '').replace(/\\/g, '/').replace(/^\/+/, '').split('/').filter((part) => part && part !== '.').join('/'); }
|
|
348
|
+
function inside(root, absolute) { const relative = path.relative(root, absolute); return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative)); }
|
|
349
|
+
export function assertInside(root, absolute, code) { if (!inside(root, absolute)) throw new Error(code); }
|
|
350
|
+
export function isExternalReference(value = '') { return /^[a-z][a-z0-9+.-]*:/i.test(String(value || '')) || String(value || '').startsWith('//'); }
|
|
351
|
+
export function sha256Text(value = '') { return createHash('sha256').update(String(value), 'utf8').digest('hex'); }
|
|
352
|
+
export function stableJson(value) { return JSON.stringify(sortJson(value)); }
|
|
353
|
+
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])]).filter(([, item]) => typeof item !== 'undefined')); }
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { parseArtifactMarkdown } from '../../../../artifacts/artifact.parse.js';
|
|
2
|
+
import { safeWorkspaceToken } from './handoff.manufacture.multiRoot.js';
|
|
3
|
+
import {
|
|
4
|
+
decodeUtf8,
|
|
5
|
+
entryFromEnumeration,
|
|
6
|
+
isExternalReference,
|
|
7
|
+
materialCandidateFromWorkspaceEntry,
|
|
8
|
+
normalizeRelativePath,
|
|
9
|
+
resolveRelativeWorkspaceTarget,
|
|
10
|
+
sha256Text,
|
|
11
|
+
stableJson
|
|
12
|
+
} from './handoff.manufacture.requirements.js';
|
|
13
|
+
|
|
14
|
+
export function normalizeWorkspaceTargetBindings(input = {}) {
|
|
15
|
+
const byWorkspace = new Map();
|
|
16
|
+
const push = (workspaceIdValue, pathValue, source) => {
|
|
17
|
+
const workspaceId = safeWorkspaceToken(workspaceIdValue || '');
|
|
18
|
+
const path = String(pathValue || '').replace(/\\/g, '/').trim();
|
|
19
|
+
if (!workspaceId || !path) return;
|
|
20
|
+
const list = byWorkspace.get(workspaceId) || [];
|
|
21
|
+
list.push(Object.freeze({ workspaceId, path, source }));
|
|
22
|
+
byWorkspace.set(workspaceId, list);
|
|
23
|
+
};
|
|
24
|
+
push(input.primaryWorkspaceId, input.primaryTargetPath, 'primary-workspace-target');
|
|
25
|
+
const explicit = input.explicitBindings;
|
|
26
|
+
if (Array.isArray(explicit)) {
|
|
27
|
+
for (const entry of explicit) push(entry?.workspaceId || entry?.workspace || entry?.id, entry?.path || entry?.workspaceTargetPath || entry?.workspaceArtifactPath, 'explicit-workspace-target-binding');
|
|
28
|
+
} else if (explicit && typeof explicit === 'object') {
|
|
29
|
+
for (const [workspaceId, value] of Object.entries(explicit)) push(workspaceId, typeof value === 'string' ? value : value?.path || value?.workspaceTargetPath || value?.workspaceArtifactPath, 'explicit-workspace-target-binding');
|
|
30
|
+
}
|
|
31
|
+
for (const descriptor of input.additionalWorkspaceDescriptors || []) push(descriptor.id || descriptor.workspaceId, descriptor.workspaceTargetPath || descriptor.workspaceArtifactPath || descriptor.targetPath || '', 'additional-workspace-target');
|
|
32
|
+
return Object.freeze([...byWorkspace.values()].flat());
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export function normalizeWorkspaceScopes(value = []) {
|
|
37
|
+
const map = new Map();
|
|
38
|
+
const items = Array.isArray(value)
|
|
39
|
+
? value
|
|
40
|
+
: (value && typeof value === 'object' ? Object.entries(value).map(([workspaceId, scope]) => ({ workspaceId, ...(typeof scope === 'object' ? scope : {}) })) : []);
|
|
41
|
+
for (const item of items) {
|
|
42
|
+
const workspaceId = safeWorkspaceToken(item?.workspaceId || item?.workspace || item?.id || '');
|
|
43
|
+
if (!workspaceId) continue;
|
|
44
|
+
const coverage = String(item?.coverage || item?.mode || '').trim();
|
|
45
|
+
if (!coverage) continue;
|
|
46
|
+
if (coverage !== 'bounded' && coverage !== 'complete') throw new Error(`portable.handoff-manufacture.workspace-scope.coverage-invalid:${workspaceId}`);
|
|
47
|
+
const include = [...new Set([...(item?.include || item?.includedEntries || item?.paths || [])].map(normalizeRelativePath).filter(Boolean))].sort();
|
|
48
|
+
map.set(workspaceId, Object.freeze({ workspaceId, coverage, include: Object.freeze(include) }));
|
|
49
|
+
}
|
|
50
|
+
return map;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function projectBoundedWorkspaceMaterialization(materialization = {}, scope = {}, workspaceTargetPath = '') {
|
|
54
|
+
const target = normalizeRelativePath(workspaceTargetPath);
|
|
55
|
+
const selected = new Set([...(scope.include || []).map(normalizeRelativePath).filter(Boolean), target].filter(Boolean));
|
|
56
|
+
if (!selected.size) throw new Error(`portable.handoff-manufacture.workspace-scope.empty:${materialization.id}`);
|
|
57
|
+
const sourceByPath = new Map((materialization.entries || []).map((entry) => [normalizeRelativePath(entry.path), entry]));
|
|
58
|
+
const entries = [];
|
|
59
|
+
const includedEntries = [];
|
|
60
|
+
let totalBytes = 0;
|
|
61
|
+
for (const relative of [...selected].sort()) {
|
|
62
|
+
const source = sourceByPath.get(relative);
|
|
63
|
+
if (!source) throw new Error(`portable.handoff-manufacture.workspace-scope.entry-unresolved:${materialization.id}:${relative}`);
|
|
64
|
+
entries.push(source);
|
|
65
|
+
includedEntries.push(Object.freeze({ path: relative, bytes: Number(source.bytes || 0), sha256: String(source.sha256 || ''), referenceTarget: String(source.referenceTarget || '') }));
|
|
66
|
+
totalBytes += Number(source.bytes || 0);
|
|
67
|
+
}
|
|
68
|
+
const scopeEvidence = Object.freeze({
|
|
69
|
+
schema: 'tiinex.portable.workspace-bounded-scope-evidence.v1',
|
|
70
|
+
state: 'qualified',
|
|
71
|
+
proof: 'explicit-bounded-entry-selection-v1',
|
|
72
|
+
boundary: 'exact-representation-entry-set',
|
|
73
|
+
workspaceId: String(materialization.id || ''),
|
|
74
|
+
scopeBasis: 'exact-representation-entry-set',
|
|
75
|
+
includedEntryAuthority: 'qualified-decoded-entry-set',
|
|
76
|
+
omittedEntryMeaning: 'outside-representation-not-absent-from-workspace',
|
|
77
|
+
sourceMembershipClaim: 'represented-entries-are-workspace-relative-source-bytes',
|
|
78
|
+
recoveryClosureBoundary: 'separate-qualified-closure',
|
|
79
|
+
entryCount: includedEntries.length,
|
|
80
|
+
totalBytes,
|
|
81
|
+
entriesFingerprint: sha256Text(stableJson(includedEntries))
|
|
82
|
+
});
|
|
83
|
+
return Object.freeze({
|
|
84
|
+
...materialization,
|
|
85
|
+
state: 'bounded',
|
|
86
|
+
source: Object.freeze({ ...(materialization.source || {}), projection: 'explicit-bounded-entry-selection-v1', sourceEnumeration: 'qualified-complete-before-projection' }),
|
|
87
|
+
completenessEvidence: Object.freeze({}),
|
|
88
|
+
scopeEvidence,
|
|
89
|
+
entries: Object.freeze(entries),
|
|
90
|
+
includedEntries: Object.freeze(includedEntries)
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function expandBoundedParentBoundaryClosure(input = {}) {
|
|
95
|
+
const requirements = input.requirements || {};
|
|
96
|
+
const dependencies = [...(requirements.dependencies || [])];
|
|
97
|
+
const materials = [...(input.materials || [])];
|
|
98
|
+
const seen = new Set(dependencies.map((item) => String(item.id || '')));
|
|
99
|
+
for (const workspace of input.workspaceMaterializations || []) {
|
|
100
|
+
if (String(workspace.state || workspace.materialization || '') !== 'bounded') continue;
|
|
101
|
+
const workspaceId = String(workspace.id || '');
|
|
102
|
+
const runtime = input.workspaceRuntimeById?.get(workspaceId);
|
|
103
|
+
if (!runtime) continue;
|
|
104
|
+
const included = new Set((workspace.includedEntries || []).map((entry) => normalizeRelativePath(entry.path)));
|
|
105
|
+
for (const entry of workspace.entries || []) {
|
|
106
|
+
const sourcePath = normalizeRelativePath(entry.path || '');
|
|
107
|
+
if (!sourcePath || !/\.md$/i.test(sourcePath)) continue;
|
|
108
|
+
const markdown = decodeUtf8(entry.data);
|
|
109
|
+
if (!markdown) continue;
|
|
110
|
+
let parent;
|
|
111
|
+
try { parent = parseArtifactMarkdown(markdown).envelope?.parent || {}; } catch { continue; }
|
|
112
|
+
const references = [parent.trace, ...(parent.originEntries || []).filter((item) => String(item?.label || '').trim() === 'relative').map((item) => item.target)].filter(Boolean);
|
|
113
|
+
for (const reference of [...new Set(references.map(String))]) {
|
|
114
|
+
if (isExternalReference(reference) || reference.startsWith('#')) continue;
|
|
115
|
+
const parentPath = resolveRelativeWorkspaceTarget(sourcePath, reference);
|
|
116
|
+
if (!parentPath || included.has(parentPath)) continue;
|
|
117
|
+
const parentEntry = entryFromEnumeration(runtime.enumeration, parentPath);
|
|
118
|
+
if (!parentEntry) continue;
|
|
119
|
+
const id = `bounded-parent:${safeWorkspaceToken(workspaceId)}:${sha256Text(`${sourcePath}\0${parentPath}`).slice(0, 20)}`;
|
|
120
|
+
if (seen.has(id)) continue;
|
|
121
|
+
seen.add(id);
|
|
122
|
+
const requirement = Object.freeze({
|
|
123
|
+
id,
|
|
124
|
+
name: `Bounded Parent boundary for ${sourcePath}`,
|
|
125
|
+
classification: 'parent-boundary',
|
|
126
|
+
material: 'exact detached Parent recovery dependency',
|
|
127
|
+
purpose: 'preserve exact Parent recovery outside the bounded Workspace Representation entry set',
|
|
128
|
+
availability: 'declared',
|
|
129
|
+
materialReference: reference,
|
|
130
|
+
reference: Object.freeze({ form: 'parent-relative-target', raw: reference, label: '', target: reference, exactTargetDeclared: true }),
|
|
131
|
+
routeWorkspaceId: workspaceId,
|
|
132
|
+
routePath: sourcePath,
|
|
133
|
+
targetWorkspaceId: workspaceId,
|
|
134
|
+
targetPath: parentPath,
|
|
135
|
+
sourceRequirementId: `bounded-workspace:${workspaceId}:${sourcePath}`,
|
|
136
|
+
fields: Object.freeze({ RouteWorkspace: workspaceId, RoutePath: sourcePath, TargetWorkspace: workspaceId, TargetPath: parentPath, Reference: reference })
|
|
137
|
+
});
|
|
138
|
+
dependencies.push(requirement);
|
|
139
|
+
materials.push(materialCandidateFromWorkspaceEntry(requirement, workspaceId, parentPath, parentEntry, runtime.enumeration));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return Object.freeze({
|
|
144
|
+
requirements: Object.freeze({ ...requirements, dependencies: Object.freeze(dependencies), counts: Object.freeze({ ...(requirements.counts || {}), dependencies: dependencies.length }) }),
|
|
145
|
+
materials: Object.freeze(materials)
|
|
146
|
+
});
|
|
147
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { enumerateNodeWorkspace } from './handoff.manufacture.enumeration.js';
|
|
3
|
+
import { buildToolingBootstrapTransportFiles } from './handoff.manufacture.bootstrap.js';
|
|
4
|
+
import { inferWorkspaceTitle, normalizeAdditionalWorkspaceDescriptors, safeWorkspaceToken } from './handoff.manufacture.multiRoot.js';
|
|
5
|
+
import { normalizeWorkspaceTargetBindings } from './handoff.manufacture.scope.js';
|
|
6
|
+
import { normalizeHandoffCarrierLineage } from '../../handoff/carrierLineage.js';
|
|
7
|
+
import { normalizeHandoffCarrierProfile } from '../../handoff/carrierProfile.js';
|
|
8
|
+
|
|
9
|
+
export async function prepareNodeWorkspaceCarrierManufacturingInput(input = {}, options = {}) {
|
|
10
|
+
const workspaceRoot = path.resolve(String(input.workspaceRoot || input.workspace || '.'));
|
|
11
|
+
const workspaceId = safeWorkspaceToken(input.workspaceId || path.basename(workspaceRoot) || 'workspace');
|
|
12
|
+
const requestedWorkspaceTitle = String(input.workspaceTitle || input.title || '').trim();
|
|
13
|
+
const additionalWorkspaceDescriptors = normalizeAdditionalWorkspaceDescriptors(input.additionalWorkspaces || input.workspaceRoots || input.workspaceDescriptors || []);
|
|
14
|
+
const seen = new Set([workspaceId]);
|
|
15
|
+
const descriptors = [{ id: workspaceId, root: workspaceRoot, title: requestedWorkspaceTitle, primary: true }, ...additionalWorkspaceDescriptors.map((descriptor) => {
|
|
16
|
+
const id = safeWorkspaceToken(descriptor.id || descriptor.workspaceId || '');
|
|
17
|
+
if (!descriptor.id && !descriptor.workspaceId) throw new Error('portable.workspace-carrier.additional-workspace.id.required');
|
|
18
|
+
if (seen.has(id)) throw new Error(`portable.workspace-carrier.workspace-id.duplicate:${id}`);
|
|
19
|
+
seen.add(id);
|
|
20
|
+
const rootValue = descriptor.root || descriptor.workspaceRoot || descriptor.path;
|
|
21
|
+
if (!rootValue) throw new Error(`portable.workspace-carrier.additional-workspace.root.required:${id}`);
|
|
22
|
+
return { ...descriptor, id, root: path.resolve(String(rootValue)), title: String(descriptor.title || descriptor.name || descriptor.workspaceTitle || '').trim(), primary: false };
|
|
23
|
+
})];
|
|
24
|
+
|
|
25
|
+
const enumerations = await Promise.all(descriptors.map(async (descriptor) => {
|
|
26
|
+
const enumeration = await enumerateNodeWorkspace(descriptor.root, {
|
|
27
|
+
workspaceId: descriptor.id,
|
|
28
|
+
workspaceTitle: descriptor.title,
|
|
29
|
+
sourceMetadata: descriptor.source || descriptor.sourceMetadata || {},
|
|
30
|
+
excludeDirectories: descriptor.excludeDirectories || input.excludeDirectories || options.excludeDirectories,
|
|
31
|
+
maxFiles: descriptor.maxFiles || input.maxFiles || options.maxFiles
|
|
32
|
+
});
|
|
33
|
+
if (enumeration.status !== 'qualified-complete') throw new Error(`portable.workspace-carrier.workspace-enumeration.${descriptor.id}.${enumeration.status}`);
|
|
34
|
+
const title = descriptor.title || inferWorkspaceTitle(enumeration) || descriptor.id;
|
|
35
|
+
return Object.freeze({ descriptor, root: descriptor.root, materialization: Object.freeze({ ...enumeration.materialization, title }), evidence: enumeration.evidence });
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
const workspaceTargets = normalizeWorkspaceTargetBindings({
|
|
39
|
+
primaryWorkspaceId: workspaceId,
|
|
40
|
+
primaryTargetPath: input.workspaceTargetPath || input.workspaceArtifactPath || '',
|
|
41
|
+
explicitBindings: input.workspaceTargets || input.workspaceTargetBindings || [],
|
|
42
|
+
additionalWorkspaceDescriptors
|
|
43
|
+
});
|
|
44
|
+
const toolingBootstrap = await buildToolingBootstrapTransportFiles({
|
|
45
|
+
delivery: input.toolingBootstrap || input.bootstrapDelivery || 'embedded',
|
|
46
|
+
runtimeRoot: input.runtimeRoot || options.runtimeRoot,
|
|
47
|
+
expected: input.expectedToolingBootstrap || null,
|
|
48
|
+
maxFiles: input.bootstrapMaxFiles || options.bootstrapMaxFiles
|
|
49
|
+
});
|
|
50
|
+
return Object.freeze({
|
|
51
|
+
carrierMode: 'workspace',
|
|
52
|
+
createdAt: String(input.createdAt || ''),
|
|
53
|
+
workspaceMaterializations: Object.freeze(enumerations.map((item) => item.materialization)),
|
|
54
|
+
workspaceTargets,
|
|
55
|
+
additionalTransportFiles: toolingBootstrap.files,
|
|
56
|
+
carrierLineage: normalizeHandoffCarrierLineage(input.carrierLineage || null),
|
|
57
|
+
carrierProfile: normalizeHandoffCarrierProfile(input.carrierProfile || null),
|
|
58
|
+
toolingBootstrap: toolingBootstrap.summary,
|
|
59
|
+
manufacturingEvidence: Object.freeze({ workspaceEnumerations: Object.freeze(enumerations.map((item) => Object.freeze({ id: item.materialization.id, root: item.root, evidence: item.evidence }))), toolingBootstrap: toolingBootstrap.summary }),
|
|
60
|
+
verifyRoundtrip: input.verifyRoundtrip !== false
|
|
61
|
+
});
|
|
62
|
+
}
|