@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,96 @@
|
|
|
1
|
+
import { mkdir, readdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { inspectRecipientFacingV2Topology } from '../../handoff/recipientV2.inspect.js';
|
|
4
|
+
import { handoffWorkspaceProviderForId } from '../../handoff/workspaceByteProvider.js';
|
|
5
|
+
|
|
6
|
+
export function groundContinuationOperationInput(input = {}, flags = {}) {
|
|
7
|
+
return Object.freeze({
|
|
8
|
+
...input,
|
|
9
|
+
includeRequiredContext: flags['include-required-context'] || (flags.continue && flags.full ? 'all' : input.includeRequiredContext || ''),
|
|
10
|
+
includeCurrentWork: Boolean(flags['include-current-work'] || flags.continue || input.includeCurrentWork)
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function materializeGroundWorkspaceCliOutput(result = {}, input = {}, flags = {}) {
|
|
15
|
+
const outputValue = stringFlag(flags.continue) || stringFlag(flags['materialize-workspace']) || stringFlag(flags['workspace-output']);
|
|
16
|
+
if (!outputValue) {
|
|
17
|
+
if (flags.continue === true) throw new Error('portable.cli.ground.continue-output.required');
|
|
18
|
+
if (flags['materialize-workspace'] === true) throw new Error('portable.cli.ground.workspace-output.required');
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
if (String(result?.readiness?.state || '') !== 'grounded-to-act') throw new Error('portable.cli.ground.workspace-materialization.requires-grounded-to-act');
|
|
22
|
+
const inspection = inspectRecipientFacingV2Topology(input.bundle || input.package || input);
|
|
23
|
+
if (String(inspection.status || '') !== 'valid') throw new Error('portable.cli.ground.workspace-materialization.package-unqualified');
|
|
24
|
+
const workspaceId = String(flags.workspace || result?.authority?.route?.workspaceId || '').trim();
|
|
25
|
+
if (!workspaceId) throw new Error('portable.cli.ground.workspace-id.required');
|
|
26
|
+
const workspace = handoffWorkspaceProviderForId(inspection.workspaceByteProvider, workspaceId);
|
|
27
|
+
if (String(workspace.state || '') !== 'qualified') throw new Error(`portable.cli.ground.workspace-unqualified:${workspaceId}`);
|
|
28
|
+
|
|
29
|
+
const outputDir = path.resolve(outputValue);
|
|
30
|
+
await ensureEmptyOutputDirectory(outputDir);
|
|
31
|
+
let totalBytes = 0;
|
|
32
|
+
for (const entry of workspace.entries || []) {
|
|
33
|
+
const target = safeTarget(outputDir, String(entry.path || ''));
|
|
34
|
+
await mkdir(path.dirname(target), { recursive: true });
|
|
35
|
+
const data = byteView(entry.data);
|
|
36
|
+
await writeFile(target, data);
|
|
37
|
+
totalBytes += data.byteLength;
|
|
38
|
+
}
|
|
39
|
+
const selectedLeafPath = String(result?.lineage?.selectedRouteLeaves?.[0]?.path || '');
|
|
40
|
+
const selectedHandoffPath = selectedLeafPath.startsWith(`${workspaceId}/`) ? selectedLeafPath.slice(workspaceId.length + 1) : '';
|
|
41
|
+
const workspaceInspection = (inspection.workspaces || []).find((item) => String(item.workspaceId || '') === workspaceId) || {};
|
|
42
|
+
const continuationState = Object.freeze({
|
|
43
|
+
schema: 'tiinex.portable.ground-continuation-state.v1',
|
|
44
|
+
version: 1,
|
|
45
|
+
packageParentPath: path.resolve(String(input.packageSourcePath || '')),
|
|
46
|
+
selectedRoutePointer: String(result?.authority?.route?.pointerPath || input.route || ''),
|
|
47
|
+
selectedRouteId: String(result?.authority?.route?.id || ''),
|
|
48
|
+
selectedHandoffPath,
|
|
49
|
+
workspaceId,
|
|
50
|
+
workspaceTarget: String(workspaceInspection.sourceWorkspaceTargetInnerPath || ''),
|
|
51
|
+
roleLabel: String(result?.authority?.role?.label || ''),
|
|
52
|
+
returnOutputDir: path.dirname(path.resolve(String(input.packageSourcePath || outputDir))),
|
|
53
|
+
boundary: 'Runtime-only continuation state carried forward from one qualified ground --continue receipt. It is excluded from canonical Workspace manufacture and is not semantic authority.'
|
|
54
|
+
});
|
|
55
|
+
const continuationStatePath = path.join(outputDir, '.tiinex', 'continuation.json');
|
|
56
|
+
await mkdir(path.dirname(continuationStatePath), { recursive: true });
|
|
57
|
+
await writeFile(continuationStatePath, `${JSON.stringify(continuationState, null, 2)}\n`, 'utf8');
|
|
58
|
+
const materialization = Object.freeze({
|
|
59
|
+
schema: 'tiinex.portable.ground-workspace-materialization.v1',
|
|
60
|
+
state: 'materialized',
|
|
61
|
+
workspaceId,
|
|
62
|
+
outputDir,
|
|
63
|
+
fileCount: (workspace.entries || []).length,
|
|
64
|
+
totalBytes,
|
|
65
|
+
archivePackagePath: String(workspace.archive?.packagePath || workspace.archive?.location || ''),
|
|
66
|
+
coverage: String(workspace.materialization?.materialization || workspace.materialization?.coverage || 'complete'),
|
|
67
|
+
entriesFingerprint: String(workspace.materialization?.completenessEvidence?.entriesFingerprint || workspace.binding?.completeness?.entriesFingerprint || ''),
|
|
68
|
+
continuationStatePath,
|
|
69
|
+
sourceMutation: false,
|
|
70
|
+
remoteWrite: false,
|
|
71
|
+
boundary: 'Local exact-byte materialization of one already-qualified carried Workspace plus runtime-only .tiinex continuation state. The runtime state is excluded from canonical Workspace manufacture; no package content is executed, semantic authority is not inferred from filenames or output placement, and the input carrier remains untouched.'
|
|
72
|
+
});
|
|
73
|
+
return Object.freeze({ ...result, continuationMaterialization: materialization });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function ensureEmptyOutputDirectory(outputDir) {
|
|
77
|
+
await mkdir(outputDir, { recursive: true });
|
|
78
|
+
const existing = await readdir(outputDir);
|
|
79
|
+
if (existing.length) throw new Error(`portable.cli.ground.workspace-output.not-empty:${outputDir}`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function safeTarget(root, relative) {
|
|
83
|
+
const target = path.resolve(root, relative);
|
|
84
|
+
const rel = path.relative(root, target);
|
|
85
|
+
if (!relative || rel === '' || rel.startsWith(`..${path.sep}`) || rel === '..' || path.isAbsolute(rel)) throw new Error(`portable.cli.ground.workspace-path.unsafe:${relative}`);
|
|
86
|
+
return target;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function byteView(value) {
|
|
90
|
+
if (value instanceof Uint8Array) return value;
|
|
91
|
+
if (ArrayBuffer.isView(value)) return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
92
|
+
if (value instanceof ArrayBuffer) return new Uint8Array(value);
|
|
93
|
+
throw new Error('portable.cli.ground.workspace-entry.bytes-unavailable');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function stringFlag(value) { return typeof value === 'string' && value.trim() ? value.trim() : ''; }
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { mkdir } from 'node:fs/promises';
|
|
4
|
+
import { planPortableHostAction, acceptPortableHostActionReceipt, PORTABLE_HOST_ACTION_RECEIPT_SCHEMA_ID } from '../../host/tool.bindings.js';
|
|
5
|
+
import { runPortableOperation } from '../../operation.catalog.js';
|
|
6
|
+
|
|
7
|
+
export async function continueGroundWithHostResult(result = {}, input = {}, options = {}, flags = {}) {
|
|
8
|
+
const resultTarget = flags['host-result'];
|
|
9
|
+
if (!resultTarget) return { result, output: result };
|
|
10
|
+
const recovery = result?.continuity?.recovery;
|
|
11
|
+
if (recovery?.state !== 'host-action-available' || !recovery.hostAction) throw new Error('portable.cli.ground.host-result-without-host-action');
|
|
12
|
+
const { acceptance } = await acceptGroundHostResult(result, input, flags);
|
|
13
|
+
await persistRecoveryState(flags.state || flags['recovery-state'], acceptance);
|
|
14
|
+
const resumed = await runPortableOperation('project-grounding-readiness', { ...input, recoveryAcceptance: acceptance }, options);
|
|
15
|
+
const continuation = Object.freeze({
|
|
16
|
+
schema: 'tiinex.portable.ground-host-recovery-continuation.v1',
|
|
17
|
+
state: resumed.status === 'blocked' ? 'recovery-continues' : 'grounding-resumed',
|
|
18
|
+
hostResultAccepted: true,
|
|
19
|
+
cumulativeRepositoryFiles: Number(acceptance.cumulativeRecovery?.repositoryFiles || 0),
|
|
20
|
+
statePath: String(flags.state || flags['recovery-state'] || ''),
|
|
21
|
+
stateOwnedByTooling: Boolean(flags.state || flags['recovery-state']),
|
|
22
|
+
nextHostAction: resumed?.continuity?.recovery?.state === 'host-action-available' ? resumed.continuity.recovery.hostAction : null,
|
|
23
|
+
boundary: 'The caller returns only exact host-result content. Tooling owns plan identity, receipt normalization, cumulative prior acceptance, and resume composition; accepted material remains subject to grounding lineage qualification.'
|
|
24
|
+
});
|
|
25
|
+
return { result: resumed, output: Object.freeze({ ...resumed, hostRecoveryContinuation: continuation }) };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export async function acceptGroundHostResult(result = {}, input = {}, flags = {}) {
|
|
30
|
+
const resultTarget = flags['host-result'];
|
|
31
|
+
const recovery = result?.continuity?.recovery;
|
|
32
|
+
if (!resultTarget) throw new Error('portable.cli.ground.host-result.required');
|
|
33
|
+
if (recovery?.state !== 'host-action-available' || !recovery.hostAction) throw new Error('portable.cli.ground.host-result-without-host-action');
|
|
34
|
+
const content = await readHostResultContent(resultTarget);
|
|
35
|
+
const action = recovery.hostAction;
|
|
36
|
+
const plan = planPortableHostAction({ ...input.host, host: input.host, action: action.action, request: action.request });
|
|
37
|
+
if (plan.status !== 'ready') throw new Error('portable.cli.ground.host-action-plan-blocked');
|
|
38
|
+
const step = plan.steps.find((entry) => entry.capability === 'repositoryRead');
|
|
39
|
+
if (!step) throw new Error('portable.cli.ground.repository-read-step.required');
|
|
40
|
+
const request = action.request || {};
|
|
41
|
+
const receipt = Object.freeze({
|
|
42
|
+
schema: PORTABLE_HOST_ACTION_RECEIPT_SCHEMA_ID,
|
|
43
|
+
actionId: plan.actionId,
|
|
44
|
+
action: plan.action,
|
|
45
|
+
steps: Object.freeze([Object.freeze({
|
|
46
|
+
stepId: step.stepId,
|
|
47
|
+
toolId: step.tool?.id || action.selectedTool?.id || '',
|
|
48
|
+
status: 'completed',
|
|
49
|
+
normalized: Object.freeze({ files: Object.freeze([Object.freeze({
|
|
50
|
+
path: String(request.path || ''),
|
|
51
|
+
content,
|
|
52
|
+
source: Object.freeze({
|
|
53
|
+
repository: String(request.repository || ''),
|
|
54
|
+
ref: String(request.ref || ''),
|
|
55
|
+
commit: String(request.ref || ''),
|
|
56
|
+
path: String(request.path || ''),
|
|
57
|
+
authority: 'remote-repository-unverified'
|
|
58
|
+
})
|
|
59
|
+
})]) })
|
|
60
|
+
})])
|
|
61
|
+
});
|
|
62
|
+
const acceptance = acceptPortableHostActionReceipt({ plan, receipt, priorAcceptance: input.recoveryAcceptance || {} });
|
|
63
|
+
if (acceptance.status !== 'accepted') throw new Error('portable.cli.ground.host-result-rejected');
|
|
64
|
+
return Object.freeze({ plan, acceptance });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
async function readGroundRecoveryState(file = '') {
|
|
69
|
+
if (!file) return {};
|
|
70
|
+
try { return JSON.parse(await readFile(file, 'utf8')); }
|
|
71
|
+
catch (error) { if (error?.code === 'ENOENT') return {}; throw error; }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function hostToolProfile(host = {}, hostTool = '') {
|
|
75
|
+
const name = String(hostTool || '').trim();
|
|
76
|
+
if (!name) return host;
|
|
77
|
+
const tools = Array.isArray(host?.tools) ? host.tools : [];
|
|
78
|
+
if (tools.some((tool) => String(tool?.id || tool?.name || tool) === name)) return host;
|
|
79
|
+
return Object.freeze({ ...host, tools: Object.freeze([...tools, Object.freeze({ id: name, name })]) });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
export async function groundInput(flags = {}, baseHost = {}) {
|
|
84
|
+
const host = hostToolProfile(baseHost, flags['host-tool']);
|
|
85
|
+
const state = flags.recovery ? JSON.parse(await readFile(flags.recovery, 'utf8')) : await readGroundRecoveryState(flags.state || flags['recovery-state']);
|
|
86
|
+
return Object.freeze({ host, recoveryAcceptance: state.result || state });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function readHostResultContent(target) {
|
|
90
|
+
if (target === true || target === '-') return readFile(0, 'utf8');
|
|
91
|
+
return readFile(String(target), 'utf8');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async function persistRecoveryState(target, acceptance) {
|
|
95
|
+
if (!target || target === true || target === '-') return;
|
|
96
|
+
const outputPath = path.resolve(String(target));
|
|
97
|
+
await mkdir(path.dirname(outputPath), { recursive: true });
|
|
98
|
+
await writeFile(outputPath, `${JSON.stringify(acceptance, null, 2)}\n`, 'utf8');
|
|
99
|
+
}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { prepareNodeHandoffManufacturingInput } from '../node/handoff.manufacture.js';
|
|
4
|
+
import { prepareNodeWorkspaceCarrierManufacturingInput } from '../node/workspaceCarrier.manufacture.js';
|
|
5
|
+
import { projectHandoffHumanOutput } from '../../handoff/carrierProjection.js';
|
|
6
|
+
import { writePortableRuntimePackageZip } from '../../output/node.zip.js';
|
|
7
|
+
import { writeRecipientFacingV2PackageZip } from '../../output/recipientV2.zip.js';
|
|
8
|
+
import { projectRecipientV2HumanOutput } from '../../handoff/recipientV2.humanOutput.js';
|
|
9
|
+
import { inspectRecipientFacingV2Topology } from '../../handoff/recipientV2.inspect.js';
|
|
10
|
+
import { carrierLineageFromCliParent, initialHandoffCarrierLineage, parentHandoffCarrierLineageFromBundle, parentHandoffCarrierProfileFromBundle } from '../../handoff/carrierLineage.js';
|
|
11
|
+
import { loadNodePortableInput } from '../../input/node.input.js';
|
|
12
|
+
import { reserveHandoffSiblingIndex } from './cli.handoff-sibling-allocation.js';
|
|
13
|
+
import { normalizeHandoffCarrierProfile } from '../../handoff/carrierProfile.js';
|
|
14
|
+
|
|
15
|
+
export async function prepareHandoffManufactureCliCommand(parsed = {}, runtime = {}) {
|
|
16
|
+
const flags = parsed.flags || {};
|
|
17
|
+
const workspaceRoot = flags.workspace || parsed.positionals?.[0] || '.';
|
|
18
|
+
const carrierMode = String(flags['carrier-mode'] || 'handoff').trim().toLowerCase();
|
|
19
|
+
if (!['handoff', 'workspace'].includes(carrierMode)) throw new Error(`portable.cli.handoff-carrier.carrier-mode.invalid:${carrierMode}`);
|
|
20
|
+
if (carrierMode === 'workspace') return prepareWorkspaceCarrierCliCommand(flags, workspaceRoot, runtime);
|
|
21
|
+
const continuationState = parsed.surfaceCommand === 'handoff'
|
|
22
|
+
? await readGroundContinuationState(workspaceRoot)
|
|
23
|
+
: {};
|
|
24
|
+
const handoffPath = flags.handoff || parsed.positionals?.[1] || continuationState.returnHandoffPath || '';
|
|
25
|
+
if (!flags['workspace-id'] && continuationState.workspaceId) flags['workspace-id'] = continuationState.workspaceId;
|
|
26
|
+
if (!flags['workspace-target'] && continuationState.workspaceTarget) flags['workspace-target'] = continuationState.workspaceTarget;
|
|
27
|
+
if (!flags['package-parent'] && continuationState.packageParentPath) flags['package-parent'] = continuationState.packageParentPath;
|
|
28
|
+
if (!flags.route && handoffPath) flags.route = handoffPath;
|
|
29
|
+
if (!flags.output && !flags['output-dir'] && parsed.surfaceCommand === 'handoff' && continuationState.returnOutputDir) flags['output-dir'] = continuationState.returnOutputDir;
|
|
30
|
+
const materialBindings = await readOptionalJson(flags['material-bindings'] || flags.materials);
|
|
31
|
+
const operatorCarrierProfile = await readOptionalJson(flags['carrier-profile']);
|
|
32
|
+
const expectedToolingBootstrap = await readOptionalJson(flags['tooling-bootstrap-manifest']);
|
|
33
|
+
const workspaceDescriptorValue = await readOptionalJson(flags['workspace-roots'] || flags['workspace-descriptors']);
|
|
34
|
+
const workspaceTargetValue = await readOptionalJson(flags['workspace-targets']);
|
|
35
|
+
const workspaceScopeValue = await readOptionalJson(flags['workspace-scopes']);
|
|
36
|
+
const routeDescriptorValue = await readOptionalJson(flags['workspace-routes'] || flags['handoff-route-descriptors']);
|
|
37
|
+
const additionalWorkspaces = [
|
|
38
|
+
...splitFlag(flags['additional-workspaces']),
|
|
39
|
+
...descriptorArray(workspaceDescriptorValue, 'workspaces')
|
|
40
|
+
];
|
|
41
|
+
const handoffRoutes = [
|
|
42
|
+
...splitFlag(flags['handoff-routes'] || flags.routes),
|
|
43
|
+
...descriptorArray(routeDescriptorValue, 'routes')
|
|
44
|
+
];
|
|
45
|
+
const verifyRoundtrip = !flags['no-roundtrip'];
|
|
46
|
+
const parentPackagePath = String(flags['package-parent'] || '').trim();
|
|
47
|
+
let packageParentBundle = null;
|
|
48
|
+
let packageParentSha256 = '';
|
|
49
|
+
let carrierLineage = initialHandoffCarrierLineage();
|
|
50
|
+
let inheritedCarrierProfile = normalizeHandoffCarrierProfile(null);
|
|
51
|
+
if (parentPackagePath) {
|
|
52
|
+
const resolvedParent = path.resolve(parentPackagePath);
|
|
53
|
+
const parentBytes = new Uint8Array(await readFile(resolvedParent));
|
|
54
|
+
const parentBundle = await loadNodePortableInput([resolvedParent], { maxFiles: flags['max-files'], maxTextBytes: flags['max-text-bytes'] });
|
|
55
|
+
packageParentBundle = parentBundle;
|
|
56
|
+
inheritedCarrierProfile = parentHandoffCarrierProfileFromBundle(parentBundle);
|
|
57
|
+
let parentLineage = null;
|
|
58
|
+
let routeDimensions = [];
|
|
59
|
+
try {
|
|
60
|
+
// Modern recipient-v2 continuation needs only the qualified package-root lineage
|
|
61
|
+
// plus exact parent package identity. Avoid broad topology requalification here;
|
|
62
|
+
// manufacture performs its own full qualification on the newly produced carrier.
|
|
63
|
+
parentLineage = parentHandoffCarrierLineageFromBundle(parentBundle);
|
|
64
|
+
} catch {
|
|
65
|
+
// Explicit compatibility fallback for older carriers that lack a directly
|
|
66
|
+
// qualified package-root lineage. Preserve the prior strict inspection path.
|
|
67
|
+
const parentInspection = inspectRecipientFacingV2Topology(parentBundle);
|
|
68
|
+
parentLineage = parentInspection.carrierProjection?.lineage || null;
|
|
69
|
+
routeDimensions = (parentInspection.carrierProjection?.routes || []).map((route) => route.dimension);
|
|
70
|
+
if (parentInspection.status !== 'valid' && !parentLineage?.dimension) throw new Error('portable.cli.handoff-carrier.package-parent.invalid');
|
|
71
|
+
}
|
|
72
|
+
// Package-parent lineage is a human progress projection, not Workspace provider authority.
|
|
73
|
+
const provisionalLineage = carrierLineageFromCliParent({
|
|
74
|
+
bundle: parentBundle,
|
|
75
|
+
parentPath: resolvedParent,
|
|
76
|
+
parentBytes,
|
|
77
|
+
routeDimensions,
|
|
78
|
+
qualifiedParentLineage: parentLineage,
|
|
79
|
+
major: Boolean(flags['package-major']),
|
|
80
|
+
majorReason: flags['major-reason'] || ''
|
|
81
|
+
});
|
|
82
|
+
const siblingAllocation = await reserveHandoffSiblingIndex({
|
|
83
|
+
parentPackagePath: resolvedParent,
|
|
84
|
+
parentPackageSha256: provisionalLineage.parentPackageSha256,
|
|
85
|
+
parentDimension: provisionalLineage.parentDimension,
|
|
86
|
+
enabled: !flags['package-major'] && Boolean(flags.output || flags['output-dir'])
|
|
87
|
+
});
|
|
88
|
+
carrierLineage = flags['package-major'] ? provisionalLineage : carrierLineageFromCliParent({
|
|
89
|
+
bundle: parentBundle,
|
|
90
|
+
parentPath: resolvedParent,
|
|
91
|
+
parentBytes,
|
|
92
|
+
routeDimensions,
|
|
93
|
+
qualifiedParentLineage: parentLineage,
|
|
94
|
+
siblingIndex: siblingAllocation.siblingIndex
|
|
95
|
+
});
|
|
96
|
+
packageParentSha256 = String(carrierLineage.parentPackageSha256 || '');
|
|
97
|
+
} else if (flags['package-major']) {
|
|
98
|
+
throw new Error('portable.cli.handoff-carrier.package-major.parent-required');
|
|
99
|
+
}
|
|
100
|
+
const carrierProfile = selectCarrierProfile({
|
|
101
|
+
operator: operatorCarrierProfile,
|
|
102
|
+
inherited: inheritedCarrierProfile,
|
|
103
|
+
runtime: runtime.defaultCarrierProfile || null
|
|
104
|
+
});
|
|
105
|
+
const input = await prepareNodeHandoffManufacturingInput({
|
|
106
|
+
workspaceRoot,
|
|
107
|
+
handoffPath,
|
|
108
|
+
handoffRoutes,
|
|
109
|
+
additionalWorkspaces,
|
|
110
|
+
workspaceId: flags['workspace-id'] || '',
|
|
111
|
+
workspaceTitle: flags['workspace-title'] || flags.title || '',
|
|
112
|
+
workspaceTargetPath: flags['workspace-target'] || flags['workspace-artifact'] || '',
|
|
113
|
+
workspaceTargets: workspaceTargetValue,
|
|
114
|
+
workspaceScopes: descriptorArray(workspaceScopeValue, 'scopes').length ? descriptorArray(workspaceScopeValue, 'scopes') : workspaceScopeValue,
|
|
115
|
+
toolingBootstrap: flags['tooling-bootstrap'] || 'embedded',
|
|
116
|
+
expectedToolingBootstrap,
|
|
117
|
+
materialBindings,
|
|
118
|
+
referenceTargets: splitFlag(flags['reference-targets']),
|
|
119
|
+
maxFiles: flags['max-files'],
|
|
120
|
+
bootstrapMaxFiles: flags['bootstrap-max-files'],
|
|
121
|
+
verifyRoundtrip,
|
|
122
|
+
recipientRouteSelector: flags.route || '',
|
|
123
|
+
carrierLineage,
|
|
124
|
+
carrierProfile,
|
|
125
|
+
packageParentBundle,
|
|
126
|
+
packageParentPath: parentPackagePath ? path.resolve(parentPackagePath) : '',
|
|
127
|
+
packageParentSha256
|
|
128
|
+
}, runtime);
|
|
129
|
+
return {
|
|
130
|
+
input,
|
|
131
|
+
options: {
|
|
132
|
+
verifyRoundtrip,
|
|
133
|
+
legacyRecipientV2Compatibility: Boolean(flags['legacy-recipient-v2-compatibility']),
|
|
134
|
+
packageInput: { builtAt: flags['built-at'] || undefined }
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export async function materializeHandoffManufactureCliOutput(result = {}, flags = {}) {
|
|
140
|
+
const workspaceMode = String(result.carrierProjection?.mode || '') === 'workspace';
|
|
141
|
+
let humanOutput = workspaceMode ? projectWorkspaceCarrierHumanOutput(result) : projectHandoffHumanOutput({
|
|
142
|
+
projection: result.carrierProjection || {},
|
|
143
|
+
route: flags.route || '',
|
|
144
|
+
collisionInstance: flags['collision-instance'] || 1
|
|
145
|
+
});
|
|
146
|
+
if (!workspaceMode && result.bundle?.transportFormat) humanOutput = projectRecipientV2HumanOutput(humanOutput, result.inspection || {});
|
|
147
|
+
const wantsWrite = Boolean(flags.output || flags['output-dir']);
|
|
148
|
+
const blocked = result.status === 'blocked' || result.transportExecutable === false || Number(result.findingSummary?.counts?.error || 0) > 0;
|
|
149
|
+
if (!wantsWrite || blocked) return summarizeHandoffManufactureCliOutput(result, {}, humanOutput, null);
|
|
150
|
+
const shared = result.carrierProjection?.mode === 'shared';
|
|
151
|
+
if ((shared || flags['output-dir'] || flags['transport-text']) && humanOutput.status !== 'ready') throw new Error(humanOutput.status === 'selection-required' ? 'portable.cli.handoff-carrier.route-selection.required' : 'portable.cli.handoff-carrier.output.blocked');
|
|
152
|
+
const target = resolveHandoffOutputPath(flags, humanOutput.primary.filename);
|
|
153
|
+
const writeBundle = result.bundle;
|
|
154
|
+
const writeReceipt = writeBundle?.transportFormat
|
|
155
|
+
? await writeRecipientFacingV2PackageZip(writeBundle, target, writeBundle === result.bundle ? { inspection: result.inspection } : {})
|
|
156
|
+
: await writePortableRuntimePackageZip(writeBundle, target);
|
|
157
|
+
if (workspaceMode && flags['transport-text']) throw new Error('portable.cli.workspace-carrier.transport-text.unavailable');
|
|
158
|
+
const transportTextReceipt = flags['transport-text'] ? await writeTransportTextSidecar(humanOutput, target, flags['transport-text']) : null;
|
|
159
|
+
return summarizeHandoffManufactureCliOutput(result, writeReceipt, humanOutput, transportTextReceipt);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function prepareWorkspaceCarrierCliCommand(flags = {}, workspaceRoot = '.', runtime = {}) {
|
|
163
|
+
if (flags.handoff || flags.route || flags.routes || flags['handoff-routes'] || flags['workspace-routes']) throw new Error('portable.cli.workspace-carrier.handoff-route.forbidden');
|
|
164
|
+
const operatorCarrierProfile = await readOptionalJson(flags['carrier-profile']);
|
|
165
|
+
const expectedToolingBootstrap = await readOptionalJson(flags['tooling-bootstrap-manifest']);
|
|
166
|
+
const workspaceDescriptorValue = await readOptionalJson(flags['workspace-roots'] || flags['workspace-descriptors']);
|
|
167
|
+
const workspaceTargetValue = await readOptionalJson(flags['workspace-targets']);
|
|
168
|
+
const additionalWorkspaces = [...splitFlag(flags['additional-workspaces']), ...descriptorArray(workspaceDescriptorValue, 'workspaces')];
|
|
169
|
+
const verifyRoundtrip = !flags['no-roundtrip'];
|
|
170
|
+
const carrierProfile = selectCarrierProfile({ operator: operatorCarrierProfile, runtime: runtime.defaultCarrierProfile || null });
|
|
171
|
+
const input = await prepareNodeWorkspaceCarrierManufacturingInput({
|
|
172
|
+
workspaceRoot,
|
|
173
|
+
additionalWorkspaces,
|
|
174
|
+
workspaceId: flags['workspace-id'] || '',
|
|
175
|
+
workspaceTitle: flags['workspace-title'] || flags.title || '',
|
|
176
|
+
workspaceTargetPath: flags['workspace-target'] || flags['workspace-artifact'] || '',
|
|
177
|
+
workspaceTargets: workspaceTargetValue,
|
|
178
|
+
toolingBootstrap: flags['tooling-bootstrap'] || 'embedded',
|
|
179
|
+
expectedToolingBootstrap,
|
|
180
|
+
maxFiles: flags['max-files'],
|
|
181
|
+
bootstrapMaxFiles: flags['bootstrap-max-files'],
|
|
182
|
+
verifyRoundtrip,
|
|
183
|
+
createdAt: flags['built-at'] || undefined,
|
|
184
|
+
carrierLineage: Object.freeze({ ...initialHandoffCarrierLineage(), checkpointKind: 'progression', majorReason: '' }),
|
|
185
|
+
carrierProfile
|
|
186
|
+
}, runtime);
|
|
187
|
+
return { input, options: { verifyRoundtrip, packageInput: { builtAt: flags['built-at'] || undefined } } };
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function projectWorkspaceCarrierHumanOutput(result = {}) {
|
|
191
|
+
const projection = result.carrierProjection || {};
|
|
192
|
+
const ready = result.status === 'ready' && projection.status === 'ready' && projection.mode === 'workspace' && (projection.routes || []).length === 0;
|
|
193
|
+
const dimension = String(projection.lineage?.dimension || '001');
|
|
194
|
+
const filename = `tiinex-workspace-${dimension}.handoff-package.zip`;
|
|
195
|
+
return Object.freeze({
|
|
196
|
+
schema: 'tiinex.portable.handoff-human-output.v1',
|
|
197
|
+
status: ready ? 'ready' : 'blocked',
|
|
198
|
+
primary: ready ? Object.freeze({ kind: 'workspace-package', filename, dimension, parentDimension: String(projection.lineage?.parentDimension || ''), checkpointKind: String(projection.lineage?.checkpointKind || ''), routeId: '', workspaceId: '', workspaceRelativeHandoffPath: '', collisionInstance: 1, singleHumanTransportChoice: true }) : null,
|
|
199
|
+
normalInlineRouting: null, sharedRouting: null,
|
|
200
|
+
presentation: Object.freeze({ kind: 'pointerless-workspace-carrier', label: 'Workspace carrier', authority: 'none' }),
|
|
201
|
+
normalEmissionBoundary: Object.freeze({ allowed: Object.freeze(['package-file']), forbidden: Object.freeze(['handoff-routing-text', 'continue-from-pointer']) }),
|
|
202
|
+
fallbackTransportText: null, selectedRoute: null, findings: Object.freeze([]),
|
|
203
|
+
boundary: 'Pointerless Workspace-carrier output projection only. No Handoff routing text exists because the package role declares no Handoff route.'
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function summarizeHandoffManufactureCliOutput(result = {}, writeReceipt = {}, humanOutput = null, transportTextReceipt = null) {
|
|
208
|
+
const summarizeRequirement = (item = {}) => Object.freeze({
|
|
209
|
+
requirementId: String(item.requirementId || ''),
|
|
210
|
+
classification: String(item.classification || ''),
|
|
211
|
+
disposition: String(item.disposition || ''),
|
|
212
|
+
referenceTarget: String(item.referenceTarget || ''),
|
|
213
|
+
selectedPath: String(item.selectedMaterial?.path || ''),
|
|
214
|
+
selectedSha256: String(item.selectedMaterial?.sha256 || ''),
|
|
215
|
+
providerId: String(item.selectedMaterial?.provider?.id || '')
|
|
216
|
+
});
|
|
217
|
+
const summarizeWorkspace = (item = {}) => Object.freeze({
|
|
218
|
+
id: String(item.id || ''),
|
|
219
|
+
materialization: String(item.materialization || ''),
|
|
220
|
+
qualification: String(item.qualification || ''),
|
|
221
|
+
entryCount: Array.isArray(item.includedEntries) ? item.includedEntries.length : 0,
|
|
222
|
+
completenessState: String(item.completenessEvidence?.state || ''),
|
|
223
|
+
completenessProof: String(item.completenessEvidence?.proof || ''),
|
|
224
|
+
scopeState: String(item.scopeEvidence?.state || ''),
|
|
225
|
+
scopeProof: String(item.scopeEvidence?.proof || '')
|
|
226
|
+
});
|
|
227
|
+
const bootstrapInspection = result.toolingBootstrapInspection || {};
|
|
228
|
+
const projection = result.carrierProjection || {};
|
|
229
|
+
const routeSummary = Object.freeze((projection.routes || []).map((route) => Object.freeze({
|
|
230
|
+
id: String(route.id || ''),
|
|
231
|
+
state: String(route.state || ''),
|
|
232
|
+
workspaceId: String(route.workspaceId || ''),
|
|
233
|
+
workspaceRelativePath: String(route.workspaceRelativePath || ''),
|
|
234
|
+
dimension: String(route.dimension || ''),
|
|
235
|
+
from: String(route.parties?.from || ''),
|
|
236
|
+
to: String(route.parties?.to || ''),
|
|
237
|
+
projectedFilename: String(route.projectedFilename || '')
|
|
238
|
+
})));
|
|
239
|
+
return Object.freeze({
|
|
240
|
+
schema: result.schema || 'tiinex.portable.operation.result.v1',
|
|
241
|
+
operation: String(result.operation || 'manufacture-handoff-package'),
|
|
242
|
+
resultSchema: String(result.resultSchema || ''),
|
|
243
|
+
status: String(result.status || 'unknown'),
|
|
244
|
+
executable: Boolean(result.executable),
|
|
245
|
+
transportExecutable: Boolean(result.transportExecutable),
|
|
246
|
+
verification: Object.freeze({ ...(result.verification || {}) }),
|
|
247
|
+
planSummary: Object.freeze({
|
|
248
|
+
status: String(result.plan?.status || 'unknown'),
|
|
249
|
+
requiredClosureReady: Boolean(result.plan?.requiredClosureReady),
|
|
250
|
+
semanticHandoffStatus: String(result.plan?.semanticHandoffStatus || 'unknown'),
|
|
251
|
+
required: Object.freeze((result.plan?.requirements?.required || []).map(summarizeRequirement)),
|
|
252
|
+
reference: Object.freeze((result.plan?.requirements?.reference || []).map(summarizeRequirement)),
|
|
253
|
+
workspaces: Object.freeze((result.plan?.workspaceMaterializations || []).map(summarizeWorkspace))
|
|
254
|
+
}),
|
|
255
|
+
carrierProjection: Object.freeze({
|
|
256
|
+
status: String(projection.status || 'unknown'),
|
|
257
|
+
mode: String(projection.mode || ''),
|
|
258
|
+
lineage: projection.lineage ? Object.freeze({ ...projection.lineage }) : null,
|
|
259
|
+
workspaces: Object.freeze((projection.workspaces || []).map((workspace) => Object.freeze({ ...workspace }))),
|
|
260
|
+
workspace: Object.freeze({ ...(projection.workspace || {}) }),
|
|
261
|
+
selection: Object.freeze({ ...(projection.selection || {}) }),
|
|
262
|
+
routes: routeSummary
|
|
263
|
+
}),
|
|
264
|
+
humanOutput: humanOutput ? Object.freeze({
|
|
265
|
+
status: humanOutput.status,
|
|
266
|
+
primary: humanOutput.primary,
|
|
267
|
+
normalInlineRouting: humanOutput.normalInlineRouting ? Object.freeze({ ...humanOutput.normalInlineRouting }) : null,
|
|
268
|
+
sharedRouting: humanOutput.sharedRouting ? Object.freeze({ ...humanOutput.sharedRouting, routes: Object.freeze([...(humanOutput.sharedRouting.routes || [])].map((item) => Object.freeze({ ...item }))) }) : null,
|
|
269
|
+
presentation: humanOutput.presentation ? Object.freeze({ ...humanOutput.presentation }) : null,
|
|
270
|
+
normalEmissionBoundary: humanOutput.normalEmissionBoundary ? Object.freeze({ ...humanOutput.normalEmissionBoundary, allowed: Object.freeze([...(humanOutput.normalEmissionBoundary.allowed || [])]) }) : null,
|
|
271
|
+
fallbackTransportText: humanOutput.fallbackTransportText ? Object.freeze({ ...humanOutput.fallbackTransportText, content: undefined }) : null
|
|
272
|
+
}) : null,
|
|
273
|
+
toolingBootstrap: result.toolingBootstrap || null,
|
|
274
|
+
carrierLineage: result.carrierLineage || projection.lineage || null,
|
|
275
|
+
majorReadiness: result.majorReadiness || null,
|
|
276
|
+
operationBoundary: result.operationBoundary ? Object.freeze({ ...result.operationBoundary }) : null,
|
|
277
|
+
manufacturingEvidence: result.manufacturingEvidence || null,
|
|
278
|
+
toolingBootstrapInspection: Object.freeze({
|
|
279
|
+
schema: String(bootstrapInspection.schema || ''),
|
|
280
|
+
status: String(bootstrapInspection.status || 'unknown'),
|
|
281
|
+
delivery: String(bootstrapInspection.delivery || 'unknown'),
|
|
282
|
+
counts: Object.freeze({ ...(bootstrapInspection.counts || {}) }),
|
|
283
|
+
qualification: Object.freeze({ ...(bootstrapInspection.qualification || {}) })
|
|
284
|
+
}),
|
|
285
|
+
roundtripSummary: result.roundtrip ? Object.freeze({
|
|
286
|
+
schema: String(result.roundtrip.schema || ''),
|
|
287
|
+
status: String(result.roundtrip.status || 'unknown'),
|
|
288
|
+
verification: Object.freeze({ ...(result.roundtrip.verification || {}) }),
|
|
289
|
+
runtimeStatus: String(result.roundtrip.runtime?.status || '')
|
|
290
|
+
}) : null,
|
|
291
|
+
findings: Object.freeze((result.findings || []).map((finding) => Object.freeze({
|
|
292
|
+
severity: String(finding.severity || ''),
|
|
293
|
+
code: String(finding.code || ''),
|
|
294
|
+
message: String(finding.message || '')
|
|
295
|
+
}))),
|
|
296
|
+
findingSummary: result.findingSummary || null,
|
|
297
|
+
boundary: String(result.boundary || ''),
|
|
298
|
+
writeReceipt: writeReceipt?.status ? writeReceipt : null,
|
|
299
|
+
primaryOutput: writeReceipt?.status ? Object.freeze({ ...writeReceipt, projectedFilename: String(humanOutput?.primary?.filename || ''), selectedRoute: String(humanOutput?.primary?.workspaceRelativeHandoffPath || '') }) : null,
|
|
300
|
+
transportTextSidecar: transportTextReceipt
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
function resolveHandoffOutputPath(flags = {}, projectedFilename = '') {
|
|
306
|
+
const filename = String(projectedFilename || '').trim();
|
|
307
|
+
if (!filename) throw new Error('portable.cli.handoff-carrier.output-filename.unresolved');
|
|
308
|
+
if (flags.output) {
|
|
309
|
+
const requested = path.resolve(String(flags.output));
|
|
310
|
+
if (path.basename(requested) !== filename) throw new Error('portable.cli.handoff-carrier.output-filename.mismatch');
|
|
311
|
+
return requested;
|
|
312
|
+
}
|
|
313
|
+
if (!flags['output-dir']) throw new Error('portable.cli.handoff-carrier.output-dir.required');
|
|
314
|
+
return path.resolve(String(flags['output-dir']), filename);
|
|
315
|
+
}
|
|
316
|
+
async function writeTransportTextSidecar(humanOutput, packageTarget, flagValue) {
|
|
317
|
+
const target = flagValue === true
|
|
318
|
+
? defaultSidecarPath(packageTarget)
|
|
319
|
+
: path.resolve(String(flagValue));
|
|
320
|
+
await mkdir(path.dirname(target), { recursive: true });
|
|
321
|
+
const content = String(humanOutput.fallbackTransportText?.content || '');
|
|
322
|
+
await writeFile(target, content, 'utf8');
|
|
323
|
+
return Object.freeze({ schema: 'tiinex.portable.handoff-transport-text-write.v1', status: 'written', path: target, bytes: Buffer.byteLength(content, 'utf8'), authority: 'none', normalEmission: false });
|
|
324
|
+
}
|
|
325
|
+
function defaultSidecarPath(packageTarget) {
|
|
326
|
+
const suffix = '.handoff-package.zip';
|
|
327
|
+
return packageTarget.toLowerCase().endsWith(suffix) ? `${packageTarget.slice(0, -suffix.length)}.transport.txt` : `${packageTarget}.transport.txt`;
|
|
328
|
+
}
|
|
329
|
+
async function readOptionalJson(file = '') { if (!file) return {}; return JSON.parse(await readFile(file, 'utf8')); }
|
|
330
|
+
function descriptorArray(value, key) { if (Array.isArray(value)) return value; if (Array.isArray(value?.[key])) return value[key]; return []; }
|
|
331
|
+
function splitFlag(value) { if (!value || value === true) return []; return String(value).split(',').map((item) => item.trim()).filter(Boolean); }
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
function selectCarrierProfile({ operator = null, inherited = null, runtime = null } = {}) {
|
|
335
|
+
for (const [value, source] of [[operator, 'operator'], [inherited, 'inherited-package'], [runtime, 'runtime-profile']]) {
|
|
336
|
+
const profile = normalizeHandoffCarrierProfile(value, { source });
|
|
337
|
+
if (profile.state === 'qualified') return profile;
|
|
338
|
+
}
|
|
339
|
+
return normalizeHandoffCarrierProfile(null);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
async function readGroundContinuationState(workspaceRoot = '.') {
|
|
343
|
+
try { return JSON.parse(await readFile(path.join(path.resolve(String(workspaceRoot || '.')), '.tiinex', 'continuation.json'), 'utf8')); }
|
|
344
|
+
catch { return {}; }
|
|
345
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { mkdir, open } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
const MAX_SIBLING_INDEX = 9999;
|
|
5
|
+
|
|
6
|
+
export async function reserveHandoffSiblingIndex({ parentPackagePath = '', parentPackageSha256 = '', parentDimension = '', enabled = true } = {}) {
|
|
7
|
+
if (!enabled) return Object.freeze({ state: 'not-reserved', siblingIndex: 1, allocationPath: '' });
|
|
8
|
+
const parentPath = path.resolve(String(parentPackagePath || ''));
|
|
9
|
+
const digest = String(parentPackageSha256 || '').trim().toLowerCase();
|
|
10
|
+
const dimension = String(parentDimension || '').trim();
|
|
11
|
+
if (!parentPath || !/^[0-9a-f]{64}$/.test(digest) || !/^\d{3}(?:-\d+)*$/.test(dimension)) throw new Error('portable.cli.handoff-carrier.sibling-allocation.parent-unqualified');
|
|
12
|
+
const allocationDir = path.join(path.dirname(parentPath), '.tiinex-handoff-sibling-allocations');
|
|
13
|
+
await mkdir(allocationDir, { recursive: true });
|
|
14
|
+
const key = `${digest.slice(0, 24)}-${dimension.replace(/[^0-9-]/g, '')}`;
|
|
15
|
+
for (let siblingIndex = 1; siblingIndex <= MAX_SIBLING_INDEX; siblingIndex += 1) {
|
|
16
|
+
const allocationPath = path.join(allocationDir, `${key}-${siblingIndex}.allocation`);
|
|
17
|
+
try {
|
|
18
|
+
const handle = await open(allocationPath, 'wx');
|
|
19
|
+
try {
|
|
20
|
+
await handle.writeFile(`${JSON.stringify({ parentPackageSha256: digest, parentDimension: dimension, siblingIndex, childDimension: `${dimension}-${siblingIndex}` })}\n`, 'utf8');
|
|
21
|
+
} finally {
|
|
22
|
+
await handle.close();
|
|
23
|
+
}
|
|
24
|
+
return Object.freeze({ state: 'reserved', siblingIndex, allocationPath });
|
|
25
|
+
} catch (error) {
|
|
26
|
+
if (error?.code === 'EEXIST') continue;
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
throw new Error('portable.cli.handoff-carrier.sibling-allocation.exhausted');
|
|
31
|
+
}
|