@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,401 @@
|
|
|
1
|
+
import { buildExportPackagePreflight } from './package.preflight.js';
|
|
2
|
+
import { packageAssetBytes, utf8Bytes } from './package.bytes.js';
|
|
3
|
+
|
|
4
|
+
export const EXPORT_PACKAGE_MANIFEST_SCHEMA_ID = 'tiinex.export.package.manifest.v1';
|
|
5
|
+
export const EXPORT_PACKAGE_RECEIPT_SCHEMA_ID = 'tiinex.export.package.receipt.v1';
|
|
6
|
+
export const EXPORT_PACKAGE_CONTRACT_SCHEMA_ID = 'tiinex.export.package.contract.v1';
|
|
7
|
+
|
|
8
|
+
export function buildExportPackageManifest(workspace = {}, input = {}) {
|
|
9
|
+
const records = Array.isArray(input.records) ? input.records : (Array.isArray(workspace.records) ? workspace.records : []);
|
|
10
|
+
const assets = Array.isArray(input.assets) ? input.assets : (Array.isArray(workspace.assets) ? workspace.assets : []);
|
|
11
|
+
const workspaceCandidates = Array.isArray(input.workspaceCandidates) ? input.workspaceCandidates : (Array.isArray(workspace.workspaceMergeCandidates) ? workspace.workspaceMergeCandidates : []);
|
|
12
|
+
const preflight = input.preflight || input.exportPackagePreflight || buildExportPackagePreflight(workspace, { records, assets, workspaceCandidates });
|
|
13
|
+
const createdAt = typeof input.clock === 'function' ? input.clock() : (input.createdAt || new Date().toISOString());
|
|
14
|
+
const recordIndex = indexByIdAndPath(records);
|
|
15
|
+
const assetIndex = indexByIdAndPath(assets);
|
|
16
|
+
const candidateIndex = indexByIdAndPath(workspaceCandidates);
|
|
17
|
+
|
|
18
|
+
const localDrafts = (preflight.localDraftEntries || []).map((entry) => manifestLocalDraftEntry(entry, recordIndex));
|
|
19
|
+
const sourceReferences = (preflight.sourceReferenceEntries || []).map((entry) => manifestSourceReferenceEntry(entry));
|
|
20
|
+
const assetEntries = (preflight.assetEntries || []).map((entry) => manifestAssetEntry(entry, assetIndex));
|
|
21
|
+
const contextCandidates = (preflight.workspaceCandidateEntries || []).map((entry) => manifestWorkspaceCandidateEntry(entry, candidateIndex));
|
|
22
|
+
const workspaceContext = manifestWorkspaceContextEntry(preflight.workspaceContext || {}, workspace);
|
|
23
|
+
const blocked = (preflight.blockedLocalEntries || []).map((entry) => manifestBlockedEntry(entry));
|
|
24
|
+
const findings = (preflight.findings || []).map((finding) => manifestFinding('preflight', finding));
|
|
25
|
+
|
|
26
|
+
const packageScope = Object.freeze({
|
|
27
|
+
workspaceId: workspace.id || '',
|
|
28
|
+
workspaceTitle: workspace.title || workspace.name || 'workspace',
|
|
29
|
+
materialBoundary: 'bounded-loaded-workspace',
|
|
30
|
+
includesLocalDraftMarkdown: localDrafts.length > 0,
|
|
31
|
+
includesSourceReferences: sourceReferences.length > 0,
|
|
32
|
+
includesAssets: assetEntries.length > 0,
|
|
33
|
+
includesWorkspaceContextCandidates: contextCandidates.length > 0,
|
|
34
|
+
includesWorkspaceContext: true,
|
|
35
|
+
governanceBoundary: preflight.governanceBoundary || null,
|
|
36
|
+
sourceMutation: false,
|
|
37
|
+
remoteFetch: false,
|
|
38
|
+
packageZipCreated: false
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const material = Object.freeze({
|
|
42
|
+
localDrafts: Object.freeze(localDrafts),
|
|
43
|
+
sourceReferences: Object.freeze(sourceReferences),
|
|
44
|
+
assets: Object.freeze(assetEntries),
|
|
45
|
+
workspaceContextCandidates: Object.freeze(contextCandidates),
|
|
46
|
+
workspaceContext,
|
|
47
|
+
blocked: Object.freeze(blocked)
|
|
48
|
+
});
|
|
49
|
+
const counts = Object.freeze({
|
|
50
|
+
entries: localDrafts.length + sourceReferences.length + assetEntries.length + contextCandidates.length + 1,
|
|
51
|
+
localDrafts: localDrafts.length,
|
|
52
|
+
sourceReferences: sourceReferences.length,
|
|
53
|
+
pinnedSourceReferences: sourceReferences.filter((entry) => entry.status === 'pinned-reference').length,
|
|
54
|
+
degradedSourceReferences: sourceReferences.filter((entry) => entry.status !== 'pinned-reference').length,
|
|
55
|
+
assets: assetEntries.length,
|
|
56
|
+
metadataOnlyAssets: assetEntries.filter((entry) => entry.status === 'metadata-only').length,
|
|
57
|
+
workspaceContextCandidates: contextCandidates.length,
|
|
58
|
+
workspaceContext: 1,
|
|
59
|
+
blocked: blocked.length,
|
|
60
|
+
errors: findings.filter((finding) => finding.severity === 'error').length,
|
|
61
|
+
warnings: findings.filter((finding) => finding.severity === 'warning').length,
|
|
62
|
+
findings: findings.length
|
|
63
|
+
});
|
|
64
|
+
const status = counts.blocked || counts.errors ? 'blocked' : (preflight.status === 'blocked' ? 'blocked' : (preflight.status === 'degraded' || counts.warnings || counts.metadataOnlyAssets || counts.degradedSourceReferences || counts.workspaceContextCandidates ? 'degraded' : 'ready'));
|
|
65
|
+
const fingerprint = exportPackageManifestFingerprint({ packageScope, workspaceId: packageScope.workspaceId, status, material });
|
|
66
|
+
const packageId = `package:${safeToken(packageScope.workspaceId || 'workspace')}:${fingerprint}`;
|
|
67
|
+
|
|
68
|
+
return deepFreeze({
|
|
69
|
+
schema: EXPORT_PACKAGE_MANIFEST_SCHEMA_ID,
|
|
70
|
+
packageId,
|
|
71
|
+
createdAt,
|
|
72
|
+
workspaceId: packageScope.workspaceId,
|
|
73
|
+
title: `Tiinex export package manifest · ${packageScope.workspaceTitle}`,
|
|
74
|
+
status,
|
|
75
|
+
boundary: 'Manifest only. It describes a future bounded export package without creating a zip, mutating sources, or assigning new provenance.',
|
|
76
|
+
packageScope,
|
|
77
|
+
entryPolicy: Object.freeze({
|
|
78
|
+
localDrafts: 'Embed validated local draft Markdown as package artifacts while preserving local/draft boundary.',
|
|
79
|
+
sourceReferences: 'Package source-backed material as explicit pinned/degraded source references, not as new local leaves.',
|
|
80
|
+
assets: 'Package assets as assets; metadata-only assets require reselection or explicit metadata-only receipt.',
|
|
81
|
+
workspaceCandidates: 'Workspace candidates remain context candidates until explicit Open/Merge.',
|
|
82
|
+
blocked: 'Blocked material is listed as excluded; it is never silently converted into a valid Tiinex leaf.'
|
|
83
|
+
}),
|
|
84
|
+
material,
|
|
85
|
+
counts,
|
|
86
|
+
findings: Object.freeze(findings),
|
|
87
|
+
integrity: Object.freeze({
|
|
88
|
+
algorithm: 'tiinex-stable-fingerprint-v1',
|
|
89
|
+
fingerprint,
|
|
90
|
+
note: 'Deterministic manifest fingerprint for conformance and roundtrip checks; not a cryptographic content hash.'
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
export function exportPackageManifestFingerprint(manifest = {}) {
|
|
97
|
+
return stableFingerprint({
|
|
98
|
+
workspaceId: manifest.packageScope?.workspaceId || manifest.workspaceId || '',
|
|
99
|
+
status: manifest.status || 'unknown',
|
|
100
|
+
policy: 'tiinex-export-package-manifest-v1',
|
|
101
|
+
governanceBoundary: manifest.packageScope?.governanceBoundary || null,
|
|
102
|
+
material: manifest.material || {}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function buildExportPackageReceipt(manifest = {}, input = {}) {
|
|
107
|
+
const at = typeof input.clock === 'function' ? input.clock() : (input.at || new Date().toISOString());
|
|
108
|
+
const findings = Array.isArray(manifest.findings) ? manifest.findings : [];
|
|
109
|
+
const status = manifest.status === 'blocked' ? 'blocked' : (manifest.status === 'degraded' ? 'degraded' : 'ready');
|
|
110
|
+
const receiptFingerprint = stableFingerprint({
|
|
111
|
+
manifestSchema: manifest.schema,
|
|
112
|
+
packageId: manifest.packageId,
|
|
113
|
+
manifestFingerprint: manifest.integrity?.fingerprint || '',
|
|
114
|
+
status,
|
|
115
|
+
counts: manifest.counts || {}
|
|
116
|
+
});
|
|
117
|
+
return deepFreeze({
|
|
118
|
+
schema: EXPORT_PACKAGE_RECEIPT_SCHEMA_ID,
|
|
119
|
+
receiptId: `receipt:${safeToken(manifest.packageId || 'package')}:${receiptFingerprint}`,
|
|
120
|
+
packageId: manifest.packageId || '',
|
|
121
|
+
at,
|
|
122
|
+
operation: 'export-package-manifest-created',
|
|
123
|
+
state: status === 'blocked' ? 'blocked' : 'planned',
|
|
124
|
+
status,
|
|
125
|
+
boundary: 'Receipt records manifest planning only. No zip was written, no source was mutated, and no remote material was fetched.',
|
|
126
|
+
manifestFingerprint: manifest.integrity?.fingerprint || '',
|
|
127
|
+
counts: Object.freeze(Object.assign({ entries: 0, blocked: 0, errors: 0, warnings: 0 }, manifest.counts || {})),
|
|
128
|
+
guarantees: Object.freeze([
|
|
129
|
+
'Local/session material remains local unless an explicit later publication transition assigns a durable source.',
|
|
130
|
+
'Source-backed material remains a source reference and is not re-authored as a local draft.',
|
|
131
|
+
'Assets remain assets and are not converted into fake artifact leaves.',
|
|
132
|
+
'Blocked or degraded material is disclosed in findings before any future package builder may proceed.'
|
|
133
|
+
]),
|
|
134
|
+
nextActions: Object.freeze(nextActionsForManifest(manifest)),
|
|
135
|
+
findings: Object.freeze(findings.map((finding) => manifestFinding('manifest', finding)))
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function buildExportPackageContract(workspace = {}, input = {}) {
|
|
140
|
+
const records = Array.isArray(input.records) ? input.records : (Array.isArray(workspace.records) ? workspace.records : []);
|
|
141
|
+
const assets = Array.isArray(input.assets) ? input.assets : (Array.isArray(workspace.assets) ? workspace.assets : []);
|
|
142
|
+
const workspaceCandidates = Array.isArray(input.workspaceCandidates) ? input.workspaceCandidates : (Array.isArray(workspace.workspaceMergeCandidates) ? workspace.workspaceMergeCandidates : []);
|
|
143
|
+
const preflight = input.preflight || input.exportPackagePreflight || buildExportPackagePreflight(workspace, { records, assets, workspaceCandidates });
|
|
144
|
+
const manifest = input.manifest || buildExportPackageManifest(workspace, Object.assign({}, input, { records, assets, workspaceCandidates, preflight }));
|
|
145
|
+
const receipt = input.receipt || buildExportPackageReceipt(manifest, input);
|
|
146
|
+
return deepFreeze({
|
|
147
|
+
schema: EXPORT_PACKAGE_CONTRACT_SCHEMA_ID,
|
|
148
|
+
workspaceId: workspace.id || '',
|
|
149
|
+
status: manifest.status || preflight.status || 'unknown',
|
|
150
|
+
boundary: 'No-mutation package planning contract: preflight, manifest, and receipt are produced together for conformance before an export builder exists.',
|
|
151
|
+
preflight,
|
|
152
|
+
manifest,
|
|
153
|
+
receipt
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function manifestLocalDraftEntry(entry = {}, recordIndex = new Map()) {
|
|
158
|
+
const sourceRecord = lookupEntry(recordIndex, entry);
|
|
159
|
+
const markdown = sourceRecord?.markdown || sourceRecord?.content || sourceRecord?.text || '';
|
|
160
|
+
const path = normalizeRelativePath(entry.path || sourceRecord?.path || `${entry.id || 'draft'}.md`);
|
|
161
|
+
return Object.freeze({
|
|
162
|
+
id: entry.id || sourceRecord?.id || path,
|
|
163
|
+
title: entry.title || sourceRecord?.title || 'Local draft',
|
|
164
|
+
kind: 'artifact-markdown',
|
|
165
|
+
path,
|
|
166
|
+
packagePath: `artifacts/${path}`,
|
|
167
|
+
status: entry.status || 'ready',
|
|
168
|
+
mode: entry.mode || 'embed-local-draft-markdown',
|
|
169
|
+
boundary: entry.boundary || 'Package may embed this validated local draft. It remains local/draft material.',
|
|
170
|
+
content: Object.freeze({
|
|
171
|
+
available: Boolean(markdown),
|
|
172
|
+
mediaType: 'text/markdown',
|
|
173
|
+
bytes: utf8Bytes(markdown).byteLength,
|
|
174
|
+
fingerprint: markdown ? stableFingerprint(markdown) : '',
|
|
175
|
+
embeddedByFutureBuilder: Boolean(markdown)
|
|
176
|
+
})
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function manifestSourceReferenceEntry(entry = {}) {
|
|
181
|
+
const target = entry.target || {};
|
|
182
|
+
const path = normalizeRelativePath(target.path || entry.path || `${entry.id || 'source-reference'}.source.json`);
|
|
183
|
+
return Object.freeze({
|
|
184
|
+
id: entry.id || path,
|
|
185
|
+
title: entry.title || 'Source reference',
|
|
186
|
+
kind: 'source-reference',
|
|
187
|
+
path,
|
|
188
|
+
packagePath: `sources/${safeToken(target.adapterId || entry.adapterId || 'source')}/${safeToken(target.repo || entry.repo || target.inputTarget || 'target')}/${safeToken(target.materializedCommit || target.configuredRef || target.ref || entry.ref || 'unpinned')}/${safeToken(entry.id || path)}.source.json`,
|
|
189
|
+
adapterId: target.adapterId || entry.adapterId || '',
|
|
190
|
+
repo: target.repo || entry.repo || '',
|
|
191
|
+
ref: target.ref || entry.ref || '',
|
|
192
|
+
status: entry.status || target.status || 'degraded-reference',
|
|
193
|
+
mode: entry.mode || 'preserve-source-reference',
|
|
194
|
+
boundary: entry.boundary || 'Package stores exact available source-target authority as a reference; it does not republish it.',
|
|
195
|
+
target: deepFreeze({ ...target })
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function manifestAssetEntry(entry = {}, assetIndex = new Map()) {
|
|
200
|
+
const sourceAsset = lookupEntry(assetIndex, entry) || {};
|
|
201
|
+
const path = normalizeRelativePath(entry.path || sourceAsset.path || `${entry.id || 'asset'}`);
|
|
202
|
+
const byteProjection = packageAssetBytes(sourceAsset);
|
|
203
|
+
const contentAvailable = entry.status === 'content-available' && byteProjection.bytes.byteLength > 0;
|
|
204
|
+
const status = entry.status || (contentAvailable ? 'content-available' : 'metadata-only');
|
|
205
|
+
const id = entry.id || sourceAsset.id || path;
|
|
206
|
+
const packagePath = status === 'source-reference'
|
|
207
|
+
? `sources/assets/${safeToken(id)}.asset.source.json`
|
|
208
|
+
: status === 'metadata-only'
|
|
209
|
+
? `metadata/assets/${path}.asset.json`
|
|
210
|
+
: `assets/${path}`;
|
|
211
|
+
return Object.freeze({
|
|
212
|
+
id,
|
|
213
|
+
title: entry.title || sourceAsset.name || path,
|
|
214
|
+
kind: 'asset',
|
|
215
|
+
path,
|
|
216
|
+
packagePath,
|
|
217
|
+
mediaType: entry.mediaType || sourceAsset.type || sourceAsset.mimeType || byteProjection.mediaType || '',
|
|
218
|
+
byteSize: Number(entry.byteSize || sourceAsset.size || byteProjection.bytes.byteLength || 0),
|
|
219
|
+
status,
|
|
220
|
+
mode: entry.mode || (contentAvailable ? 'asset-content-entry' : 'asset-metadata-entry'),
|
|
221
|
+
boundary: entry.boundary || sourceAsset.source?.boundary || 'Asset boundary follows its intake source; assets are not fake leaves.',
|
|
222
|
+
sourceReference: entry.sourceReference ? deepFreeze({ ...entry.sourceReference }) : null,
|
|
223
|
+
content: Object.freeze({
|
|
224
|
+
available: contentAvailable,
|
|
225
|
+
bytes: contentAvailable ? byteProjection.bytes.byteLength : 0,
|
|
226
|
+
representation: contentAvailable ? byteProjection.representation : 'none',
|
|
227
|
+
note: contentAvailable ? 'Package builder embeds exact owned bytes.' : 'No owned bytes are claimed by this manifest entry.'
|
|
228
|
+
})
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function manifestWorkspaceCandidateEntry(entry = {}, candidateIndex = new Map()) {
|
|
233
|
+
const sourceCandidate = lookupEntry(candidateIndex, entry);
|
|
234
|
+
const path = normalizeRelativePath(entry.path || sourceCandidate?.path || `${entry.id || 'workspace'}.workspace.md`);
|
|
235
|
+
return Object.freeze({
|
|
236
|
+
id: entry.id || sourceCandidate?.id || path,
|
|
237
|
+
title: entry.title || sourceCandidate?.title || path,
|
|
238
|
+
kind: 'workspace-candidate',
|
|
239
|
+
path,
|
|
240
|
+
packagePath: `workspace-candidates/${path}`,
|
|
241
|
+
status: entry.status || 'open-or-merge-required',
|
|
242
|
+
mode: entry.mode || 'context-candidate-reference',
|
|
243
|
+
boundary: entry.boundary || 'Workspace candidate is context material until explicit open/merge.'
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function manifestWorkspaceContextEntry(context = {}, workspace = {}) {
|
|
248
|
+
const id = `workspace-context:${context.id || workspace.id || 'workspace'}`;
|
|
249
|
+
const packagePaths = ['context/workspace.json'];
|
|
250
|
+
if (context.workspaceMarkdown?.available) packagePaths.push(context.workspaceMarkdown.packagePath || 'context/workspace.workspace.md');
|
|
251
|
+
return Object.freeze({
|
|
252
|
+
id,
|
|
253
|
+
title: `Workspace context · ${context.title || workspace.title || workspace.name || 'Workspace'}`,
|
|
254
|
+
kind: 'workspace-context',
|
|
255
|
+
path: context.workspaceImport?.path || '',
|
|
256
|
+
packagePath: packagePaths[0],
|
|
257
|
+
packagePaths: Object.freeze(packagePaths),
|
|
258
|
+
status: 'ready',
|
|
259
|
+
mode: 'canonical-workspace-context',
|
|
260
|
+
boundary: context.boundary || 'Canonical workspace context projection for handoff/re-ingest.',
|
|
261
|
+
context: deepFreeze({ ...context })
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function manifestBlockedEntry(entry = {}) {
|
|
266
|
+
const path = normalizeRelativePath(entry.path || entry.id || 'blocked-entry');
|
|
267
|
+
return Object.freeze({
|
|
268
|
+
id: entry.id || path,
|
|
269
|
+
title: entry.title || 'Blocked material',
|
|
270
|
+
kind: entry.kind || 'blocked-material',
|
|
271
|
+
path,
|
|
272
|
+
status: 'blocked',
|
|
273
|
+
reason: entry.reason || 'not-package-ready',
|
|
274
|
+
boundary: entry.boundary || 'Blocked material is excluded from package entries.'
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export function finalizeExportPackageManifestPaths(manifest = {}, files = []) {
|
|
279
|
+
const byEntryId = new Map();
|
|
280
|
+
for (const file of files) {
|
|
281
|
+
const entryId = String(file.entryId || '');
|
|
282
|
+
if (!entryId) continue;
|
|
283
|
+
const current = byEntryId.get(entryId) || [];
|
|
284
|
+
current.push(String(file.path || ''));
|
|
285
|
+
byEntryId.set(entryId, current);
|
|
286
|
+
}
|
|
287
|
+
const material = manifest.material || {};
|
|
288
|
+
const remap = (entries = []) => entries.map((entry) => {
|
|
289
|
+
const paths = byEntryId.get(String(entry.id || '')) || [];
|
|
290
|
+
return paths.length ? Object.freeze({ ...entry, packagePath: paths[0], packagePaths: Object.freeze(paths.slice()) }) : entry;
|
|
291
|
+
});
|
|
292
|
+
const workspaceContext = material.workspaceContext ? (() => {
|
|
293
|
+
const baseId = String(material.workspaceContext.id || '');
|
|
294
|
+
const direct = byEntryId.get(baseId) || [];
|
|
295
|
+
const markdown = byEntryId.get(`${baseId}:markdown`) || [];
|
|
296
|
+
const paths = [...direct, ...markdown];
|
|
297
|
+
return paths.length ? Object.freeze({ ...material.workspaceContext, packagePath: paths[0], packagePaths: Object.freeze(paths) }) : material.workspaceContext;
|
|
298
|
+
})() : null;
|
|
299
|
+
const nextMaterial = Object.freeze({
|
|
300
|
+
localDrafts: Object.freeze(remap(material.localDrafts || [])),
|
|
301
|
+
sourceReferences: Object.freeze(remap(material.sourceReferences || [])),
|
|
302
|
+
assets: Object.freeze(remap(material.assets || [])),
|
|
303
|
+
workspaceContextCandidates: Object.freeze(remap(material.workspaceContextCandidates || [])),
|
|
304
|
+
workspaceContext,
|
|
305
|
+
blocked: Object.freeze(material.blocked || [])
|
|
306
|
+
});
|
|
307
|
+
const fingerprint = exportPackageManifestFingerprint({ ...manifest, material: nextMaterial });
|
|
308
|
+
const packageId = `package:${safeToken(manifest.packageScope?.workspaceId || manifest.workspaceId || 'workspace')}:${fingerprint}`;
|
|
309
|
+
return deepFreeze({
|
|
310
|
+
...manifest,
|
|
311
|
+
packageId,
|
|
312
|
+
material: nextMaterial,
|
|
313
|
+
integrity: Object.freeze({
|
|
314
|
+
algorithm: 'tiinex-stable-fingerprint-v1',
|
|
315
|
+
fingerprint,
|
|
316
|
+
note: 'Deterministic manifest semantic fingerprint for conformance; durable serialized byte integrity is separately owned by tiinex.package/file-map.json.'
|
|
317
|
+
})
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function nextActionsForManifest(manifest = {}) {
|
|
322
|
+
const actions = [];
|
|
323
|
+
if (manifest.status === 'ready') actions.push('Future export builder may create a package from this manifest.');
|
|
324
|
+
if (manifest.status === 'degraded') actions.push('Review degraded source references, metadata-only assets, and workspace candidates before package creation.');
|
|
325
|
+
if (manifest.status === 'blocked') actions.push('Resolve blocked local material or exclude it before package creation.');
|
|
326
|
+
if ((manifest.counts?.workspaceContextCandidates || 0) > 0) actions.push('Open or merge workspace candidates explicitly if they should become package context.');
|
|
327
|
+
if ((manifest.counts?.metadataOnlyAssets || 0) > 0) actions.push('Reselect metadata-only assets or accept a degraded metadata-only package entry.');
|
|
328
|
+
return actions.length ? actions : ['No action required before a future package builder.'];
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function manifestFinding(source, item = {}) {
|
|
332
|
+
return Object.freeze({
|
|
333
|
+
source,
|
|
334
|
+
severity: item.severity || 'info',
|
|
335
|
+
code: item.code || 'finding',
|
|
336
|
+
message: item.message || String(item.code || 'Finding'),
|
|
337
|
+
recordId: item.recordId || '',
|
|
338
|
+
assetId: item.assetId || '',
|
|
339
|
+
workspaceCandidateId: item.workspaceCandidateId || '',
|
|
340
|
+
path: item.path || '',
|
|
341
|
+
repo: item.repo || ''
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function indexByIdAndPath(items = []) {
|
|
346
|
+
const index = new Map();
|
|
347
|
+
for (const item of items) {
|
|
348
|
+
for (const key of [item.id, item.path, item.name, item.title]) {
|
|
349
|
+
if (key) index.set(String(key), item);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return index;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function lookupEntry(index, entry = {}) {
|
|
356
|
+
for (const key of [entry.id, entry.path, entry.title]) {
|
|
357
|
+
if (key && index.has(String(key))) return index.get(String(key));
|
|
358
|
+
}
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function normalizeRelativePath(path = '') {
|
|
363
|
+
const input = String(path || '').trim().replace(/\\/g, '/').replace(/^\/+/, '');
|
|
364
|
+
const parts = [];
|
|
365
|
+
for (const part of input.split('/')) {
|
|
366
|
+
const clean = part.trim();
|
|
367
|
+
if (!clean || clean === '.') continue;
|
|
368
|
+
if (clean === '..') continue;
|
|
369
|
+
parts.push(clean.replace(/[\u0000-\u001f<>:"|?*]/g, '_'));
|
|
370
|
+
}
|
|
371
|
+
return parts.join('/') || 'entry';
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function safeToken(value = '') {
|
|
375
|
+
return String(value || '').trim().replace(/\\/g, '/').replace(/[^a-zA-Z0-9._/-]+/g, '-').replace(/^[-/.]+|[-/.]+$/g, '').replace(/\/+/, '/').slice(0, 120) || 'unnamed';
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function stableFingerprint(value) {
|
|
379
|
+
const text = typeof value === 'string' ? value : stableStringify(value);
|
|
380
|
+
let hash = 2166136261;
|
|
381
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
382
|
+
hash ^= text.charCodeAt(i);
|
|
383
|
+
hash = Math.imul(hash, 16777619);
|
|
384
|
+
}
|
|
385
|
+
return `tixfp1-${(hash >>> 0).toString(16).padStart(8, '0')}`;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function stableStringify(value) {
|
|
389
|
+
if (value === null || typeof value !== 'object') return JSON.stringify(value);
|
|
390
|
+
if (Array.isArray(value)) return `[${value.map(stableStringify).join(',')}]`;
|
|
391
|
+
const keys = Object.keys(value).sort();
|
|
392
|
+
return `{${keys.map((key) => `${JSON.stringify(key)}:${stableStringify(value[key])}`).join(',')}}`;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function deepFreeze(value) {
|
|
396
|
+
if (!value || typeof value !== 'object' || Object.isFrozen(value)) return value;
|
|
397
|
+
if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer) return value;
|
|
398
|
+
Object.freeze(value);
|
|
399
|
+
for (const item of Object.values(value)) deepFreeze(item);
|
|
400
|
+
return value;
|
|
401
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { buildPublicationPreflight } from '../publication/publication.preflight.js';
|
|
2
|
+
import { buildReingestPlan } from '../reingest/reingest.plan.js';
|
|
3
|
+
import { buildWorkspaceGovernanceSummary, governanceFindingForBoundary } from '../governance/governance.boundary.js';
|
|
4
|
+
import { buildSourceBoundaryReport, isSourceBacked } from '../diagnostics/sourceBoundary.report.js';
|
|
5
|
+
import { packageAssetBytes } from './package.bytes.js';
|
|
6
|
+
import { projectPackageSourceReference } from './package.sourceReference.js';
|
|
7
|
+
import { buildExportWorkspaceContext } from './package.workspaceContext.js';
|
|
8
|
+
|
|
9
|
+
export const EXPORT_PACKAGE_PREFLIGHT_SCHEMA_ID = 'tiinex.export.package.preflight.v1';
|
|
10
|
+
|
|
11
|
+
export function buildExportPackagePreflight(workspace = {}, input = {}) {
|
|
12
|
+
const records = Array.isArray(input.records) ? input.records : (Array.isArray(workspace.records) ? workspace.records : []);
|
|
13
|
+
const assets = Array.isArray(input.assets) ? input.assets : (Array.isArray(workspace.assets) ? workspace.assets : []);
|
|
14
|
+
const workspaceCandidates = Array.isArray(input.workspaceCandidates) ? input.workspaceCandidates : (Array.isArray(workspace.workspaceMergeCandidates) ? workspace.workspaceMergeCandidates : []);
|
|
15
|
+
const sourceBoundary = input.sourceBoundary || buildSourceBoundaryReport(workspace, { records, assets });
|
|
16
|
+
const publicationPreflight = input.publicationPreflight || buildPublicationPreflight(workspace, { records, assets, workspaceCandidates });
|
|
17
|
+
const reingestPlan = input.reingestPlan || buildReingestPlan(workspace, { records, assets, workspaceCandidates, sourceBoundary, publicationPreflight });
|
|
18
|
+
const governanceBoundary = input.governanceBoundary || buildWorkspaceGovernanceSummary(workspace, { records, assets });
|
|
19
|
+
const findings = [];
|
|
20
|
+
|
|
21
|
+
for (const finding of sourceBoundary.findings || []) {
|
|
22
|
+
if (finding.severity === 'error' || finding.code?.includes('provenance-leak')) findings.push(normalizeFinding('source-boundary', finding));
|
|
23
|
+
}
|
|
24
|
+
for (const finding of publicationPreflight.findings || []) {
|
|
25
|
+
if (finding.severity === 'error' || finding.code?.includes('asset.metadata-only') || finding.code?.includes('workspace-candidate') || finding.code?.includes('source-reference.ref-unpinned')) {
|
|
26
|
+
findings.push(normalizeFinding('publication-preflight', finding));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
for (const finding of reingestPlan.findings || []) {
|
|
30
|
+
if (finding.severity === 'error' || finding.code?.includes('metadata-only') || finding.code?.includes('workspace-candidate') || finding.code?.includes('ref-unpinned')) {
|
|
31
|
+
findings.push(normalizeFinding('reingest-plan', finding));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
for (const boundary of governanceBoundary.sources || []) {
|
|
35
|
+
const boundaryFinding = governanceFindingForBoundary(boundary);
|
|
36
|
+
if (boundaryFinding) findings.push(normalizeFinding('governance-boundary', boundaryFinding));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const localDraftEntries = (publicationPreflight.publishableLocalDrafts || []).map((record) => localDraftEntry(record));
|
|
40
|
+
const blockedLocalEntries = (publicationPreflight.blockedLocalDrafts || []).map((record) => blockedLocalEntry(record, findings));
|
|
41
|
+
const sourceReferenceEntries = (publicationPreflight.sourceReferences || []).map((reference) => sourceReferenceEntry(reference, findings));
|
|
42
|
+
const assetEntries = assets.map((asset) => assetEntry(asset, findings));
|
|
43
|
+
const workspaceCandidateEntries = workspaceCandidates.map((candidate) => workspaceCandidateEntry(candidate, findings));
|
|
44
|
+
const workspaceContext = buildExportWorkspaceContext(workspace, { records, assets });
|
|
45
|
+
|
|
46
|
+
if (!localDraftEntries.length && !sourceReferenceEntries.length && !assetEntries.length && !workspaceCandidateEntries.length && !workspaceContext.id && !workspaceContext.workspaceMarkdown?.available) {
|
|
47
|
+
findings.push(finding('warning', 'export.package.empty', 'No loaded material is available for export/package preflight.', { workspaceId: workspace.id || '' }));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const dedupedFindings = prioritizeFindings(dedupeFindings(findings));
|
|
51
|
+
const counts = {
|
|
52
|
+
records: records.length,
|
|
53
|
+
packageEntries: localDraftEntries.length + sourceReferenceEntries.length + assetEntries.length + workspaceCandidateEntries.length + 1,
|
|
54
|
+
localDraftEntries: localDraftEntries.length,
|
|
55
|
+
blockedLocalEntries: blockedLocalEntries.length,
|
|
56
|
+
sourceReferenceEntries: sourceReferenceEntries.length,
|
|
57
|
+
pinnedSourceReferences: sourceReferenceEntries.filter((entry) => entry.status === 'pinned-reference').length,
|
|
58
|
+
degradedSourceReferences: sourceReferenceEntries.filter((entry) => entry.status !== 'pinned-reference').length,
|
|
59
|
+
assetEntries: assetEntries.length,
|
|
60
|
+
metadataOnlyAssets: assetEntries.filter((entry) => entry.status === 'metadata-only').length,
|
|
61
|
+
workspaceCandidateEntries: workspaceCandidateEntries.length,
|
|
62
|
+
workspaceContextEntries: 1,
|
|
63
|
+
errors: dedupedFindings.filter((item) => item.severity === 'error').length,
|
|
64
|
+
warnings: dedupedFindings.filter((item) => item.severity === 'warning').length,
|
|
65
|
+
info: dedupedFindings.filter((item) => item.severity === 'info').length,
|
|
66
|
+
findings: dedupedFindings.length
|
|
67
|
+
};
|
|
68
|
+
const status = counts.errors || counts.blockedLocalEntries ? 'blocked' : (counts.warnings || counts.metadataOnlyAssets || counts.degradedSourceReferences || counts.workspaceCandidateEntries ? 'degraded' : 'ready');
|
|
69
|
+
|
|
70
|
+
return Object.freeze({
|
|
71
|
+
schema: EXPORT_PACKAGE_PREFLIGHT_SCHEMA_ID,
|
|
72
|
+
workspaceId: workspace.id || '',
|
|
73
|
+
title: `Export package preflight · ${workspace.title || workspace.name || 'workspace'}`,
|
|
74
|
+
status,
|
|
75
|
+
boundary: 'Preflight only. It plans a bounded package without creating a zip, mutating sources, or converting local/session material into GitHub provenance.',
|
|
76
|
+
entryPolicy: 'Embed validated local draft Markdown; preserve source-backed material as explicit source references; keep local assets as assets, never fake leaves.',
|
|
77
|
+
counts: Object.freeze(counts),
|
|
78
|
+
governanceBoundary,
|
|
79
|
+
localDraftEntries: Object.freeze(localDraftEntries),
|
|
80
|
+
blockedLocalEntries: Object.freeze(blockedLocalEntries),
|
|
81
|
+
sourceReferenceEntries: Object.freeze(sourceReferenceEntries),
|
|
82
|
+
assetEntries: Object.freeze(assetEntries),
|
|
83
|
+
workspaceCandidateEntries: Object.freeze(workspaceCandidateEntries),
|
|
84
|
+
workspaceContext,
|
|
85
|
+
findings: Object.freeze(dedupedFindings)
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function localDraftEntry(record = {}) {
|
|
90
|
+
return Object.freeze({
|
|
91
|
+
id: record.id || record.path || record.title || '',
|
|
92
|
+
title: record.title || 'Local draft',
|
|
93
|
+
path: record.path || '',
|
|
94
|
+
kind: 'artifact-markdown',
|
|
95
|
+
status: 'ready',
|
|
96
|
+
mode: 'embed-local-draft-markdown',
|
|
97
|
+
boundary: 'Package may embed this validated local draft. It remains a local draft until explicit publication assigns a durable source.'
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function blockedLocalEntry(record = {}, findings = []) {
|
|
102
|
+
const id = record.id || record.path || record.title || '';
|
|
103
|
+
findings.push(finding('error', 'export.package.local-entry.blocked', 'Local record is not package-ready; it needs a readable Markdown envelope or an explicit preservation/export policy.', { recordId: id, path: record.path || '' }));
|
|
104
|
+
return Object.freeze({
|
|
105
|
+
id,
|
|
106
|
+
title: record.title || 'Blocked local record',
|
|
107
|
+
path: record.path || '',
|
|
108
|
+
kind: 'local-record',
|
|
109
|
+
status: 'blocked',
|
|
110
|
+
reason: record.reason || record.status || 'not-package-ready',
|
|
111
|
+
boundary: 'Blocked local/session material must not be silently packaged as a valid Tiinex leaf.'
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function sourceReferenceEntry(reference = {}, findings = []) {
|
|
116
|
+
const target = reference.target || projectPackageSourceReference(reference, reference);
|
|
117
|
+
if (reference.status !== 'pinned-reference' && reference.status !== 'exact-target-reference') {
|
|
118
|
+
findings.push(finding('warning', 'export.package.source-reference.degraded', 'Source-backed material can be packaged only as a degraded source reference until exact source target authority is explicit.', { recordId: reference.id || '', path: target.path || reference.path || '', repo: target.repo || reference.repo || '' }));
|
|
119
|
+
}
|
|
120
|
+
return Object.freeze({
|
|
121
|
+
id: reference.id || reference.path || reference.title || '',
|
|
122
|
+
title: reference.title || 'Source reference',
|
|
123
|
+
path: target.path || reference.path || '',
|
|
124
|
+
kind: 'source-reference',
|
|
125
|
+
adapterId: target.adapterId || reference.adapterId || '',
|
|
126
|
+
repo: target.repo || reference.repo || '',
|
|
127
|
+
ref: target.ref || reference.ref || '',
|
|
128
|
+
status: reference.status || target.status || 'degraded-reference',
|
|
129
|
+
mode: 'preserve-source-reference',
|
|
130
|
+
target,
|
|
131
|
+
boundary: 'Package stores exact available source-target authority as a reference; it does not republish or embed it as a new local draft.'
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function assetEntry(asset = {}, findings = []) {
|
|
136
|
+
const id = asset.id || asset.path || asset.name || '';
|
|
137
|
+
const sourceBacked = isSourceBacked(asset.source || {});
|
|
138
|
+
const byteProjection = packageAssetBytes(asset);
|
|
139
|
+
const hasOwnedBytes = !sourceBacked && byteProjection.bytes.byteLength > 0 && asset.previewState !== 'omitted-large' && asset.cacheState !== 'preview-truncated-for-session-cache';
|
|
140
|
+
const metadataOnly = !sourceBacked && !hasOwnedBytes;
|
|
141
|
+
const sourceReference = sourceBacked ? projectPackageSourceReference(asset) : null;
|
|
142
|
+
if (sourceBacked) {
|
|
143
|
+
findings.push(finding('info', 'export.package.asset.source-reference', 'Source-backed asset remains an exact/degraded source reference; loaded preview/content bytes are not automatically embedded as owned local bytes.', { assetId: id, path: asset.path || '' }));
|
|
144
|
+
if (!sourceReference || sourceReference.status === 'degraded-reference') findings.push(finding('warning', 'export.package.asset.source-reference.degraded', 'Source-backed asset lacks exact source-target authority and remains a degraded reference; loaded bytes are still not promoted to owned local content.', { assetId: id, path: asset.path || '' }));
|
|
145
|
+
} else if (metadataOnly) {
|
|
146
|
+
findings.push(finding('warning', 'export.package.asset.metadata-only', 'Local asset has no full owned bytes in the loaded session; package must mark it metadata-only or require reselection.', { assetId: id, path: asset.path || '' }));
|
|
147
|
+
}
|
|
148
|
+
return Object.freeze({
|
|
149
|
+
id,
|
|
150
|
+
title: asset.name || asset.path || 'Asset',
|
|
151
|
+
path: asset.path || '',
|
|
152
|
+
kind: 'asset',
|
|
153
|
+
mediaType: asset.type || asset.mimeType || byteProjection.mediaType || '',
|
|
154
|
+
byteSize: Number(asset.size || byteProjection.bytes.byteLength || 0),
|
|
155
|
+
status: sourceBacked ? 'source-reference' : (metadataOnly ? 'metadata-only' : 'content-available'),
|
|
156
|
+
mode: sourceBacked ? 'asset-source-reference' : (metadataOnly ? 'asset-metadata-entry' : 'asset-content-entry'),
|
|
157
|
+
sourceReference,
|
|
158
|
+
boundary: asset.source?.boundary || 'Asset boundary follows its intake source; assets are not fake leaves.'
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function workspaceCandidateEntry(candidate = {}, findings = []) {
|
|
163
|
+
const id = candidate.id || candidate.path || '';
|
|
164
|
+
findings.push(finding('info', 'export.package.workspace-candidate.open-merge-required', 'Workspace candidate is context material; it must be explicitly opened or merged before it becomes package entrypoint context.', { workspaceCandidateId: id, path: candidate.path || '' }));
|
|
165
|
+
return Object.freeze({
|
|
166
|
+
id,
|
|
167
|
+
title: candidate.title || candidate.path || 'Workspace candidate',
|
|
168
|
+
path: candidate.path || '',
|
|
169
|
+
kind: 'workspace-candidate',
|
|
170
|
+
status: 'open-or-merge-required',
|
|
171
|
+
mode: 'context-candidate-reference',
|
|
172
|
+
boundary: 'Workspace candidate is not packaged as a leaf without explicit open/merge.'
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function normalizeFinding(source, item = {}) {
|
|
177
|
+
return finding(item.severity || 'info', item.code || 'finding', item.message || String(item.code || 'Finding'), Object.assign({ source }, item.recordId ? { recordId: item.recordId } : {}, item.assetId ? { assetId: item.assetId } : {}, item.workspaceCandidateId ? { workspaceCandidateId: item.workspaceCandidateId } : {}, item.path ? { path: item.path } : {}, item.repo ? { repo: item.repo } : {}));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function prioritizeFindings(items = []) {
|
|
181
|
+
return items.slice().sort((a, b) => {
|
|
182
|
+
const aOwn = String(a.code || '').startsWith('export.package') ? 0 : 1;
|
|
183
|
+
const bOwn = String(b.code || '').startsWith('export.package') ? 0 : 1;
|
|
184
|
+
if (aOwn !== bOwn) return aOwn - bOwn;
|
|
185
|
+
const rank = { error: 0, warning: 1, info: 2 };
|
|
186
|
+
return (rank[a.severity] ?? 3) - (rank[b.severity] ?? 3);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function dedupeFindings(items = []) {
|
|
191
|
+
const seen = new Set();
|
|
192
|
+
const deduped = [];
|
|
193
|
+
for (const item of items) {
|
|
194
|
+
const key = [item.severity, item.code, item.recordId || item.assetId || item.workspaceCandidateId || '', item.path || '', item.repo || ''].join('\u0000');
|
|
195
|
+
if (seen.has(key)) continue;
|
|
196
|
+
seen.add(key);
|
|
197
|
+
deduped.push(item);
|
|
198
|
+
}
|
|
199
|
+
return deduped;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function finding(severity, code, message, extra = {}) {
|
|
203
|
+
return Object.freeze(Object.assign({ severity, code, message }, extra));
|
|
204
|
+
}
|