@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,162 @@
|
|
|
1
|
+
import { createPortableLocalDraft, stagePortableDraft } from '../draft/draft.create.js';
|
|
2
|
+
import { portableFinding, summarizePortableFindings } from '../findings.js';
|
|
3
|
+
import { resolvePortableSchemaChainMaterial } from '../providers/schema.providers.js';
|
|
4
|
+
import { openPortableSession } from '../session/portable.session.js';
|
|
5
|
+
|
|
6
|
+
export const PORTABLE_DURABLE_MATERIALIZATION_PLAN_SCHEMA_ID = 'tiinex.portable.durable-materialization.plan.v1';
|
|
7
|
+
export const PORTABLE_DURABLE_MATERIALIZATION_RESULT_SCHEMA_ID = 'tiinex.portable.durable-materialization.result.v1';
|
|
8
|
+
|
|
9
|
+
export function planPortableDurableMaterialization(input = {}) {
|
|
10
|
+
const durableFindings = normalizeFindings(input.durableFindings || input.session?.durableFindings || input.snapshot?.durableFindings || []);
|
|
11
|
+
const specs = normalizeSpecs(input.materializations || input.specs || []);
|
|
12
|
+
const findings = [];
|
|
13
|
+
const knownIds = new Set(durableFindings.map(findingId));
|
|
14
|
+
const assigned = new Set();
|
|
15
|
+
for (const spec of specs) {
|
|
16
|
+
if (!spec.schemaId) findings.push(portableFinding('error', 'portable.materialization.schema.required', 'Each durable materialization requires an explicit target schema id; portable tooling will not guess artifact type.', { materializationId: spec.id }));
|
|
17
|
+
if (!spec.findingIds.length) findings.push(portableFinding('warning', 'portable.materialization.findings.empty', 'A materialization spec references no durable findings.', { materializationId: spec.id }));
|
|
18
|
+
for (const id of spec.findingIds) {
|
|
19
|
+
if (!knownIds.has(id)) findings.push(portableFinding('error', 'portable.materialization.finding.unknown', 'A materialization spec references an unknown durable finding.', { materializationId: spec.id, findingId: id }));
|
|
20
|
+
else if (assigned.has(id)) findings.push(portableFinding('error', 'portable.materialization.finding.duplicate', 'A durable finding is assigned to more than one materialization in the same operation.', { findingId: id }));
|
|
21
|
+
else assigned.add(id);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const unassigned = durableFindings.filter((finding) => !assigned.has(findingId(finding)));
|
|
25
|
+
if (unassigned.length) findings.push(portableFinding('info', 'portable.materialization.findings.unassigned', 'Some durable findings remain explicit session state and will not be silently materialized.', { count: unassigned.length }));
|
|
26
|
+
const findingSummary = summarizePortableFindings(findings);
|
|
27
|
+
return Object.freeze({
|
|
28
|
+
schema: PORTABLE_DURABLE_MATERIALIZATION_PLAN_SCHEMA_ID,
|
|
29
|
+
status: findingSummary.counts.error ? 'blocked' : specs.length ? 'ready' : durableFindings.length ? 'mapping-required' : 'empty',
|
|
30
|
+
durableFindings: Object.freeze(durableFindings),
|
|
31
|
+
materializations: Object.freeze(specs.map((spec) => Object.freeze({
|
|
32
|
+
...spec,
|
|
33
|
+
selectedFindings: Object.freeze(durableFindings.filter((finding) => spec.findingIds.includes(findingId(finding))))
|
|
34
|
+
}))),
|
|
35
|
+
unassignedFindings: Object.freeze(unassigned),
|
|
36
|
+
boundary: Object.freeze({ schemaSelectionMustBeExplicit: true, remoteWrite: false, sourceMutation: false }),
|
|
37
|
+
findings: Object.freeze(findings),
|
|
38
|
+
findingSummary
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function materializePortableDurableFindings(input = {}, options = {}) {
|
|
43
|
+
const plan = planPortableDurableMaterialization(input);
|
|
44
|
+
const findings = [...plan.findings];
|
|
45
|
+
if (plan.status === 'blocked') return result('blocked', plan, [], input, findings);
|
|
46
|
+
const created = [];
|
|
47
|
+
for (const item of plan.materializations) {
|
|
48
|
+
const chain = await resolvePortableSchemaChainMaterial({ ...input, schemaId: item.schemaId }, options);
|
|
49
|
+
findings.push(...(chain.findings || []));
|
|
50
|
+
if (chain.status === 'provider-action-required') {
|
|
51
|
+
created.push(Object.freeze({ id: item.id, status: 'provider-action-required', schemaId: item.schemaId, providerRequest: chain.providerRequest, findingIds: item.findingIds }));
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const files = mergeFiles(input.files || input.session?.materials?.files || [], chain.materials?.files || []);
|
|
55
|
+
const draftResult = createPortableLocalDraft({
|
|
56
|
+
...input,
|
|
57
|
+
...item,
|
|
58
|
+
files,
|
|
59
|
+
schemaId: item.schemaId,
|
|
60
|
+
values: item.values,
|
|
61
|
+
sections: item.sections,
|
|
62
|
+
bodyMarkdown: item.bodyMarkdown,
|
|
63
|
+
title: item.title,
|
|
64
|
+
summary: item.summary,
|
|
65
|
+
path: item.path,
|
|
66
|
+
parent: item.parent,
|
|
67
|
+
allowIncomplete: item.allowIncomplete
|
|
68
|
+
}, options);
|
|
69
|
+
findings.push(...dedupeNewFindings(findings, draftResult.findings || []));
|
|
70
|
+
let stageResult = null;
|
|
71
|
+
const unresolvedSchemaLocator = (draftResult.validation?.findings || []).some((finding) => finding.code === 'schema.reference.locator.unresolved');
|
|
72
|
+
if (unresolvedSchemaLocator) findings.push(portableFinding('error', 'portable.materialization.schema-reference.locator-unresolved', 'Durable materialization retained a readable local draft but will not stage it while a declared schema representation locator remains unresolved.', { materializationId: item.id, schemaId: item.schemaId }));
|
|
73
|
+
if (draftResult.draft && item.stage !== false && !unresolvedSchemaLocator) {
|
|
74
|
+
stageResult = stagePortableDraft({
|
|
75
|
+
draft: draftResult.draft,
|
|
76
|
+
validation: draftResult.validation,
|
|
77
|
+
files,
|
|
78
|
+
schemaId: item.schemaId,
|
|
79
|
+
allowInvalid: item.allowInvalid
|
|
80
|
+
}, options);
|
|
81
|
+
findings.push(...dedupeNewFindings(findings, stageResult.findings || []));
|
|
82
|
+
}
|
|
83
|
+
created.push(Object.freeze({
|
|
84
|
+
id: item.id,
|
|
85
|
+
schemaId: item.schemaId,
|
|
86
|
+
findingIds: item.findingIds,
|
|
87
|
+
status: stageResult?.status === 'staged' ? 'materialized-and-staged' : draftResult.status,
|
|
88
|
+
schemaChain: chain,
|
|
89
|
+
draft: draftResult.draft,
|
|
90
|
+
validation: draftResult.validation,
|
|
91
|
+
stagedArtifact: stageResult?.stagedArtifact || null,
|
|
92
|
+
qualification: draftResult.qualification
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
const successfulIds = new Set(created.filter((item) => item.draft && (!item.stagedArtifact ? item.status !== 'blocked' : true)).flatMap((item) => item.findingIds));
|
|
96
|
+
const remaining = plan.durableFindings.filter((finding) => !successfulIds.has(findingId(finding)));
|
|
97
|
+
const status = created.some((item) => item.status === 'provider-action-required') ? 'provider-action-required'
|
|
98
|
+
: findings.some((finding) => finding.severity === 'error') ? 'degraded'
|
|
99
|
+
: remaining.length ? 'partial' : 'materialized';
|
|
100
|
+
return result(status, plan, created, input, findings, remaining);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function result(status, plan, created, input, findings, remaining = plan.unassignedFindings || []) {
|
|
104
|
+
const baseSession = input.session || input.snapshot || {
|
|
105
|
+
files: input.files || [],
|
|
106
|
+
records: input.records || [],
|
|
107
|
+
assets: input.assets || [],
|
|
108
|
+
durableFindings: plan.durableFindings,
|
|
109
|
+
stagedArtifacts: input.stagedArtifacts || []
|
|
110
|
+
};
|
|
111
|
+
const existingStaged = baseSession.stagedArtifacts || baseSession.materials?.stagedArtifacts || [];
|
|
112
|
+
const newStaged = created.map((item) => item.stagedArtifact).filter(Boolean);
|
|
113
|
+
const session = openPortableSession({
|
|
114
|
+
...baseSession,
|
|
115
|
+
materials: baseSession.materials,
|
|
116
|
+
durableFindings: remaining,
|
|
117
|
+
stagedArtifacts: [...existingStaged, ...newStaged]
|
|
118
|
+
}).snapshot();
|
|
119
|
+
const findingSummary = summarizePortableFindings(findings);
|
|
120
|
+
return Object.freeze({
|
|
121
|
+
schema: PORTABLE_DURABLE_MATERIALIZATION_RESULT_SCHEMA_ID,
|
|
122
|
+
status,
|
|
123
|
+
plan,
|
|
124
|
+
materialized: Object.freeze(created),
|
|
125
|
+
remainingFindings: Object.freeze(remaining),
|
|
126
|
+
session,
|
|
127
|
+
boundary: Object.freeze({ schemaSelectionWasExplicit: true, localDraftsOnly: true, remoteWrite: false, sourceMutation: false }),
|
|
128
|
+
findings: Object.freeze(findings),
|
|
129
|
+
findingSummary
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function normalizeFindings(value) {
|
|
134
|
+
const list = Array.isArray(value) ? value : value ? [value] : [];
|
|
135
|
+
return list.map((finding, index) => Object.freeze({ ...finding, id: findingId(finding, index) }));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function normalizeSpecs(value) {
|
|
139
|
+
const list = Array.isArray(value) ? value : value ? [value] : [];
|
|
140
|
+
return list.map((spec, index) => Object.freeze({
|
|
141
|
+
...spec,
|
|
142
|
+
id: String(spec?.id || `materialization-${index + 1}`),
|
|
143
|
+
schemaId: String(spec?.schemaId || ''),
|
|
144
|
+
findingIds: Object.freeze((Array.isArray(spec?.findingIds) ? spec.findingIds : spec?.findingId ? [spec.findingId] : []).map(String)),
|
|
145
|
+
values: Object.freeze({ ...(spec?.values || {}) }),
|
|
146
|
+
sections: Object.freeze({ ...(spec?.sections || {}) })
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function findingId(finding = {}, index = 0) {
|
|
151
|
+
return String(finding.id || finding.code || `finding-${index + 1}`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function mergeFiles(left, right) {
|
|
155
|
+
const map = new Map();
|
|
156
|
+
for (const file of [...left, ...right]) map.set(`${file.path}:${String(file.content || '').length}`, file);
|
|
157
|
+
return [...map.values()];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function dedupeNewFindings(existing, next) {
|
|
161
|
+
return next.filter((finding) => !existing.some((item) => item.code === finding.code && item.message === finding.message && item.ref === finding.ref));
|
|
162
|
+
}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { listCreatableArtifactSchemas, buildArtifactCreationContract } from '../../../schemas/creation.contracts.js';
|
|
2
|
+
import { resolveLineage } from '../../../lineage/lineage.resolve.js';
|
|
3
|
+
import { normalizePortableInput } from '../input/portable.input.js';
|
|
4
|
+
import { portableFinding, summarizePortableFindings } from '../findings.js';
|
|
5
|
+
import { planPortableArtifact } from '../schema/schema.guide.js';
|
|
6
|
+
import { indexPortableLoadedParentRecords, projectPortableLoadedParentRecord, resolvePortableLoadedParentReference } from './loaded.parent.js';
|
|
7
|
+
import { allocateContinuationPath, allocateRootArtifactPath } from '../../../transitions/record.transitions.js';
|
|
8
|
+
|
|
9
|
+
export const PORTABLE_EPISTEMIC_PLAN_SCHEMA_ID = 'tiinex.portable.epistemic-materialization-plan.v1';
|
|
10
|
+
|
|
11
|
+
export function prepareEpistemicMaterialization(input = {}, options = {}) {
|
|
12
|
+
const material = normalizePortableInput(input.materials || input);
|
|
13
|
+
const proposals = normalizeProposals(input.proposals || input.proposal || []);
|
|
14
|
+
const artifactRecords = material.records.filter(isArtifactRecord);
|
|
15
|
+
const lineage = resolveLineage(artifactRecords, { depth: 'portable-epistemic-plan' });
|
|
16
|
+
const loadedIndex = indexPortableLoadedParentRecords(artifactRecords);
|
|
17
|
+
const proposalIds = new Set(proposals.map((proposal) => proposal.id));
|
|
18
|
+
const candidateSchemas = listCreatableArtifactSchemas().map((contract) => Object.freeze({
|
|
19
|
+
schemaId: contract.target.schemaId,
|
|
20
|
+
label: contract.target.label,
|
|
21
|
+
role: contract.target.role,
|
|
22
|
+
transitionType: contract.transitionType,
|
|
23
|
+
status: contract.status,
|
|
24
|
+
binding: contract.target.binding
|
|
25
|
+
}));
|
|
26
|
+
const parentCandidates = lineageParentCandidates(lineage);
|
|
27
|
+
const findings = [...(material.findings || []), ...(lineage.findings || []).map((finding) => portableFinding(finding.severity, finding.code, finding.message, finding))];
|
|
28
|
+
|
|
29
|
+
if (!proposals.length) {
|
|
30
|
+
findings.push(portableFinding('info', 'portable.materialization.proposal.required', 'No artifact proposal was supplied. The LLM should form a bounded proposal from the dialogue before materialization.', { qualification: 'epistemic-planning' }));
|
|
31
|
+
return finalize({
|
|
32
|
+
status: 'needs-proposal',
|
|
33
|
+
material: { ...material, records: artifactRecords },
|
|
34
|
+
proposals: [],
|
|
35
|
+
candidateSchemas,
|
|
36
|
+
parentCandidates,
|
|
37
|
+
lineage,
|
|
38
|
+
findings,
|
|
39
|
+
clarificationNeeds: [{ code: 'proposal', statement: 'Declare what knowledge should be preserved, in which implemented schema, and whether it is a new root or continues an explicit loaded/proposed Parent.' }]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const planned = [];
|
|
44
|
+
const plannedById = new Map();
|
|
45
|
+
const occupiedPaths = new Set([
|
|
46
|
+
...(material.records || []).map((record) => clean(record?.path || '')),
|
|
47
|
+
...(material.files || []).map((file) => clean(file?.path || ''))
|
|
48
|
+
].filter(Boolean));
|
|
49
|
+
for (let index = 0; index < proposals.length; index += 1) {
|
|
50
|
+
const proposal = proposals[index];
|
|
51
|
+
const entry = planProposal({ proposal, index, proposals, proposalIds, loadedIndex, material, options, plannedById, occupiedPaths });
|
|
52
|
+
planned.push(entry);
|
|
53
|
+
plannedById.set(entry.id, entry);
|
|
54
|
+
if (entry.path) occupiedPaths.add(entry.path);
|
|
55
|
+
}
|
|
56
|
+
findings.push(...planned.flatMap((entry) => entry.findings));
|
|
57
|
+
const clarificationNeeds = planned.flatMap((entry) => entry.clarificationNeeds.map((need) => ({ proposalId: entry.id, ...need })));
|
|
58
|
+
const status = planned.some((entry) => entry.status === 'blocked')
|
|
59
|
+
? 'blocked'
|
|
60
|
+
: clarificationNeeds.length
|
|
61
|
+
? 'needs-clarification'
|
|
62
|
+
: 'ready';
|
|
63
|
+
|
|
64
|
+
return finalize({ status, material: { ...material, records: artifactRecords }, proposals: planned, candidateSchemas, parentCandidates, lineage, findings, clarificationNeeds });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function planProposal({ proposal, index, proposals, proposalIds, loadedIndex, material, options, plannedById, occupiedPaths }) {
|
|
68
|
+
const findings = [];
|
|
69
|
+
const clarificationNeeds = [];
|
|
70
|
+
const contract = buildArtifactCreationContract({ schemaId: proposal.schemaId, transitionType: proposal.parentRef ? 'continue-from-record' : 'create-artifact' });
|
|
71
|
+
const artifactPlan = planPortableArtifact({ ...material, schemaId: proposal.schemaId, task: proposal.parentRef ? 'continue' : 'create', values: proposal.values || {}, inputs: proposal.values || {} }, options);
|
|
72
|
+
const parent = resolveParentReference(proposal.parentRef, { loadedIndex, proposalIds, proposalIndex: index, proposals });
|
|
73
|
+
const parentForAllocation = parent.status === 'resolved'
|
|
74
|
+
? parent.kind === 'proposal'
|
|
75
|
+
? plannedParentRecord(plannedById.get(parent.parent?.proposalId || ''))
|
|
76
|
+
: parent.parent
|
|
77
|
+
: null;
|
|
78
|
+
const allocationOptions = Object.freeze({ existingPaths: Object.freeze([...occupiedPaths]), path: proposal.path || '' });
|
|
79
|
+
const allocated = proposal.parentRef && parentForAllocation
|
|
80
|
+
? allocateContinuationPath({ parentRecord: parentForAllocation, targetId: proposal.schemaId, targetLabel: proposal.schemaId, title: proposal.title || proposal.summary || proposal.id }, allocationOptions)
|
|
81
|
+
: !proposal.parentRef
|
|
82
|
+
? allocateRootArtifactPath({ targetId: proposal.schemaId, targetLabel: proposal.schemaId, title: proposal.title || proposal.summary || proposal.id }, allocationOptions)
|
|
83
|
+
: Object.freeze({ path: proposal.path || '', policy: Object.freeze({}) });
|
|
84
|
+
|
|
85
|
+
if (!proposal.schemaId) {
|
|
86
|
+
findings.push(portableFinding('error', 'portable.materialization.schema.required', 'Each proposal must declare an implemented schema id; schema meaning is never inferred by the writer.', { proposalId: proposal.id }));
|
|
87
|
+
clarificationNeeds.push({ code: 'schema', statement: 'Choose one implemented schema using the dialogue purpose and schema companion guidance.' });
|
|
88
|
+
} else if (contract.status !== 'ready') {
|
|
89
|
+
findings.push(...(contract.findings || []).map((finding) => portableFinding(finding.severity, finding.code, finding.message, { ...finding, proposalId: proposal.id })));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (proposal.parentRef && parent.status !== 'resolved') {
|
|
93
|
+
findings.push(portableFinding('error', parent.code, parent.message, { proposalId: proposal.id, parentRef: proposal.parentRef, candidates: parent.candidates || [] }));
|
|
94
|
+
clarificationNeeds.push({ code: 'parent', statement: 'Select one exact loaded artifact or one earlier proposal as Parent. Do not infer a Parent from title similarity, Origin, or basename.' });
|
|
95
|
+
}
|
|
96
|
+
if (!proposal.parentRef && proposal.mode === 'continue') {
|
|
97
|
+
findings.push(portableFinding('error', 'portable.materialization.parent.required', 'Continuation mode requires an explicit Parent reference.', { proposalId: proposal.id }));
|
|
98
|
+
clarificationNeeds.push({ code: 'parent', statement: 'Declare the exact Parent or change the proposal to a new lineage root.' });
|
|
99
|
+
}
|
|
100
|
+
if (proposal.mode === 'root' && proposal.parentRef) findings.push(portableFinding('error', 'portable.materialization.root.parent-conflict', 'A root proposal must not declare a Parent.', { proposalId: proposal.id }));
|
|
101
|
+
if (!proposal.rationale) {
|
|
102
|
+
findings.push(portableFinding('warning', 'portable.materialization.rationale.missing', 'The proposal should state why this artifact is warranted by the dialogue or loaded material.', { proposalId: proposal.id, fixability: 'manual' }));
|
|
103
|
+
clarificationNeeds.push({ code: 'rationale', statement: 'State the smallest evidence-grounded reason this artifact should exist.' });
|
|
104
|
+
}
|
|
105
|
+
if (!proposal.evidenceRefs.length) {
|
|
106
|
+
findings.push(portableFinding('warning', 'portable.materialization.evidence-refs.missing', 'The proposal should bind its rationale to dialogue turns or loaded artifact paths.', { proposalId: proposal.id, fixability: 'manual' }));
|
|
107
|
+
clarificationNeeds.push({ code: 'evidence', statement: 'Reference the dialogue turn(s) or loaded artifact path(s) that support the proposal.' });
|
|
108
|
+
}
|
|
109
|
+
if (artifactPlan.plan.missingInputs.length) {
|
|
110
|
+
findings.push(portableFinding('warning', 'portable.materialization.inputs.missing', 'The proposed artifact is missing schema-required authoring inputs.', { proposalId: proposal.id, schemaId: proposal.schemaId, missingInputs: artifactPlan.plan.missingInputs }));
|
|
111
|
+
clarificationNeeds.push({ code: 'inputs', statement: `Obtain only the missing schema inputs: ${artifactPlan.plan.missingInputs.join(', ')}.` });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const blocking = findings.some((finding) => finding.severity === 'error');
|
|
115
|
+
return Object.freeze({
|
|
116
|
+
id: proposal.id,
|
|
117
|
+
order: index + 1,
|
|
118
|
+
status: blocking ? 'blocked' : clarificationNeeds.length ? 'needs-clarification' : 'ready',
|
|
119
|
+
mode: proposal.parentRef ? 'continue-lineage' : 'new-lineage-root',
|
|
120
|
+
schemaId: proposal.schemaId,
|
|
121
|
+
path: allocated.path || proposal.path,
|
|
122
|
+
title: proposal.title,
|
|
123
|
+
summary: proposal.summary,
|
|
124
|
+
why: proposal.why,
|
|
125
|
+
values: proposal.values,
|
|
126
|
+
sections: proposal.sections,
|
|
127
|
+
bodyMarkdown: proposal.bodyMarkdown,
|
|
128
|
+
schemaReferences: proposal.schemaReferences,
|
|
129
|
+
createdAt: proposal.createdAt,
|
|
130
|
+
rationale: proposal.rationale,
|
|
131
|
+
evidenceRefs: proposal.evidenceRefs,
|
|
132
|
+
parentRef: proposal.parentRef,
|
|
133
|
+
parent: parent.status === 'resolved' ? parent.parent : null,
|
|
134
|
+
parentKind: parent.status === 'resolved' ? parent.kind : '',
|
|
135
|
+
creationContract: contract,
|
|
136
|
+
artifactPlan: artifactPlan.plan,
|
|
137
|
+
clarificationNeeds: Object.freeze(clarificationNeeds),
|
|
138
|
+
findings: Object.freeze(findings)
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function normalizeProposals(value) {
|
|
143
|
+
const list = Array.isArray(value) ? value : value && typeof value === 'object' ? [value] : [];
|
|
144
|
+
return Object.freeze(list.map((raw, index) => {
|
|
145
|
+
const id = clean(raw.id || `artifact-${index + 1}`);
|
|
146
|
+
return Object.freeze({
|
|
147
|
+
id,
|
|
148
|
+
mode: clean(raw.mode || ''),
|
|
149
|
+
schemaId: clean(raw.schemaId || raw.schema || ''),
|
|
150
|
+
parentRef: exact(raw.parentRef ?? raw.parent ?? ''),
|
|
151
|
+
path: clean(raw.path || ''),
|
|
152
|
+
title: clean(raw.title || ''),
|
|
153
|
+
summary: clean(raw.summary || ''),
|
|
154
|
+
why: clean(raw.why || raw.rationale || ''),
|
|
155
|
+
values: clone(raw.values || {}),
|
|
156
|
+
sections: clone(raw.sections || {}),
|
|
157
|
+
bodyMarkdown: String(raw.bodyMarkdown || ''),
|
|
158
|
+
schemaReferences: raw.schemaReferences && typeof raw.schemaReferences === 'object' ? Object.freeze(clone(raw.schemaReferences)) : null,
|
|
159
|
+
createdAt: clean(raw.createdAt || ''),
|
|
160
|
+
rationale: clean(raw.rationale || ''),
|
|
161
|
+
evidenceRefs: Object.freeze(normalizeStrings(raw.evidenceRefs || raw.evidence || []))
|
|
162
|
+
});
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function plannedParentRecord(entry = null) {
|
|
167
|
+
if (!entry?.path) return null;
|
|
168
|
+
return Object.freeze({ id: entry.id || '', path: entry.path, schemaId: entry.schemaId || '', title: entry.title || entry.summary || entry.id || '' });
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function resolveParentReference(ref, { loadedIndex, proposalIds, proposalIndex, proposals }) {
|
|
172
|
+
if (!ref) return { status: 'none', kind: 'none', parent: null };
|
|
173
|
+
const reference = exact(ref);
|
|
174
|
+
const proposalRef = reference.startsWith('proposal:') ? reference.slice('proposal:'.length) : proposalIds.has(reference) ? reference : '';
|
|
175
|
+
if (proposalRef) {
|
|
176
|
+
const targetIndex = proposals.findIndex((proposal) => proposal.id === proposalRef);
|
|
177
|
+
if (targetIndex < 0) return { status: 'missing', code: 'portable.materialization.parent.proposal-missing', message: 'The Parent proposal does not exist.', candidates: [] };
|
|
178
|
+
if (targetIndex >= proposalIndex) return { status: 'invalid-order', code: 'portable.materialization.parent.proposal-order', message: 'A proposal may only continue an earlier proposal in the same artifact set.', candidates: [proposalRef] };
|
|
179
|
+
return { status: 'resolved', kind: 'proposal', parent: Object.freeze({ proposalId: proposalRef }) };
|
|
180
|
+
}
|
|
181
|
+
const resolved = resolvePortableLoadedParentReference(reference, loadedIndex);
|
|
182
|
+
if (resolved.status === 'missing') return { status: 'missing', code: 'portable.materialization.parent.missing', message: 'The declared Parent reference is not present in loaded material.', candidates: [] };
|
|
183
|
+
if (resolved.status === 'ambiguous') return { status: 'ambiguous', code: 'portable.materialization.parent.ambiguous', message: 'The declared Parent reference matches multiple loaded records.', candidates: resolved.candidates.map((record) => record.id || record.path) };
|
|
184
|
+
return { status: 'resolved', kind: 'loaded-record', parent: projectPortableLoadedParentRecord(resolved.record) };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function lineageParentCandidates(lineage = {}) {
|
|
188
|
+
const childIds = new Set((lineage.edges || []).filter((edge) => edge.kind === 'parent' && edge.from).map((edge) => edge.from));
|
|
189
|
+
return Object.freeze((lineage.nodes || []).map((node) => Object.freeze({
|
|
190
|
+
id: node.id,
|
|
191
|
+
path: node.path,
|
|
192
|
+
title: node.title,
|
|
193
|
+
schemaId: node.schemaId,
|
|
194
|
+
sourceMode: node.sourceMode,
|
|
195
|
+
boundary: node.boundary,
|
|
196
|
+
role: childIds.has(node.id) ? 'ancestor-or-branch' : 'loaded-leaf-candidate',
|
|
197
|
+
explicitOnly: true
|
|
198
|
+
})));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function finalize({ status, material, proposals, candidateSchemas, parentCandidates, lineage, findings, clarificationNeeds }) {
|
|
202
|
+
const summary = summarizePortableFindings(findings);
|
|
203
|
+
return Object.freeze({
|
|
204
|
+
schema: PORTABLE_EPISTEMIC_PLAN_SCHEMA_ID,
|
|
205
|
+
status,
|
|
206
|
+
material: Object.freeze({ records: material.records.length, files: material.files.length, sourceMode: material.sourceMode || '', boundary: material.boundary || null }),
|
|
207
|
+
candidateSchemas: Object.freeze(candidateSchemas),
|
|
208
|
+
parentCandidates: Object.freeze(parentCandidates),
|
|
209
|
+
proposals: Object.freeze(proposals),
|
|
210
|
+
clarificationNeeds: Object.freeze(clarificationNeeds),
|
|
211
|
+
lineage: Object.freeze({ stats: lineage.stats, findings: Object.freeze(lineage.findings || []) }),
|
|
212
|
+
epistemicBoundary: Object.freeze({
|
|
213
|
+
fixedQuestionnaire: false,
|
|
214
|
+
oneQuestionAtATimeWhenBlocked: true,
|
|
215
|
+
materializationMustBeEvidenceGrounded: true,
|
|
216
|
+
schemaSelectionMustUseSharedCompanion: true,
|
|
217
|
+
parentMustBeExplicitLoadedOrEarlierProposal: true,
|
|
218
|
+
originIsNotParent: true,
|
|
219
|
+
sourceProvenanceIsNeverGuessed: true,
|
|
220
|
+
noArtifactIsAlsoAValidOutcome: true
|
|
221
|
+
}),
|
|
222
|
+
findings: Object.freeze(findings),
|
|
223
|
+
findingSummary: summary
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function isArtifactRecord(record = {}) {
|
|
228
|
+
const path = String(record.path || '').toLowerCase();
|
|
229
|
+
const role = String(record.materialRole || '').toLowerCase();
|
|
230
|
+
if (path.endsWith('.schema.md') || path.includes('/canonical/schemas/')) return false;
|
|
231
|
+
if (role.includes('schema') || role.includes('supporting')) return false;
|
|
232
|
+
return Boolean(record.hasContinuityContext || record.schemaId || record.kind?.startsWith?.('tiinex.'));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function normalizeStrings(value) { return [...new Set((Array.isArray(value) ? value : [value]).map(clean).filter(Boolean))]; }
|
|
236
|
+
function clean(value) { return String(value || '').replace(/\s+/g, ' ').trim(); }
|
|
237
|
+
function exact(value) { return String(value ?? ''); }
|
|
238
|
+
function slug(value) { return clean(value).toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'artifact'; }
|
|
239
|
+
function clone(value) { return value == null ? {} : JSON.parse(JSON.stringify(value)); }
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export function indexPortableLoadedParentRecords(records = []) {
|
|
2
|
+
const index = new Map();
|
|
3
|
+
for (const record of records) {
|
|
4
|
+
for (const key of exactLoadedIdentityKeys(record)) {
|
|
5
|
+
const list = index.get(key) || [];
|
|
6
|
+
if (!list.includes(record)) list.push(record);
|
|
7
|
+
index.set(key, list);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return index;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function resolvePortableLoadedParentReference(ref = '', indexOrRecords = []) {
|
|
14
|
+
const reference = exact(ref);
|
|
15
|
+
if (!reference) return Object.freeze({ status: 'missing', candidates: Object.freeze([]), record: null });
|
|
16
|
+
const index = indexOrRecords instanceof Map ? indexOrRecords : indexPortableLoadedParentRecords(indexOrRecords);
|
|
17
|
+
const candidates = index.get(reference) || [];
|
|
18
|
+
if (candidates.length !== 1) return Object.freeze({
|
|
19
|
+
status: candidates.length ? 'ambiguous' : 'missing',
|
|
20
|
+
candidates: Object.freeze(candidates.slice()),
|
|
21
|
+
record: null
|
|
22
|
+
});
|
|
23
|
+
return Object.freeze({ status: 'resolved', candidates: Object.freeze(candidates.slice()), record: candidates[0] });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function projectPortableLoadedParentRecord(record = {}) {
|
|
27
|
+
const id = exact(record.id || record.path || '');
|
|
28
|
+
return Object.freeze({
|
|
29
|
+
id,
|
|
30
|
+
path: exact(record.path || ''),
|
|
31
|
+
kind: exact(record.kind || ''),
|
|
32
|
+
schemaId: exact(record.schemaId || ''),
|
|
33
|
+
currentSchemaId: exact(record.currentSchemaId || ''),
|
|
34
|
+
currentCreatedAt: exact(record.currentCreatedAt || ''),
|
|
35
|
+
createdAt: exact(record.createdAt || ''),
|
|
36
|
+
continuationTrace: '',
|
|
37
|
+
boundary: exact(record.boundary || record.source?.boundary || 'loaded material boundary'),
|
|
38
|
+
sourceMode: exact(record.sourceMode || ''),
|
|
39
|
+
source: record.source || null,
|
|
40
|
+
markdown: exact(record.markdown || ''),
|
|
41
|
+
integrity: record.integrity || null,
|
|
42
|
+
publishedReference: record.publishedReference || null,
|
|
43
|
+
schemaReferenceAuthority: record.schemaReferenceAuthority || null,
|
|
44
|
+
title: exact(record.title || ''),
|
|
45
|
+
summary: exact(record.summary || '')
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function exactLoadedIdentityKeys(record = {}) {
|
|
50
|
+
const keys = [exact(record.id || ''), exact(record.path || '')].filter((value) => value !== '');
|
|
51
|
+
return [...new Set(keys)];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function exact(value) { return String(value ?? ''); }
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { portableOperationResult as operationResult } from '../operation.result.js';
|
|
2
|
+
import { createPortableLocalArtifactSet } from '../draft/draft.set.js';
|
|
3
|
+
import { prepareEpistemicMaterialization } from './epistemic.plan.js';
|
|
4
|
+
|
|
5
|
+
export function preparePortableMaterialization(input = {}, options = {}) {
|
|
6
|
+
const result = prepareEpistemicMaterialization(input, options);
|
|
7
|
+
return operationResult('prepare-materialization', {
|
|
8
|
+
status: result.status,
|
|
9
|
+
material: result.material,
|
|
10
|
+
candidateSchemas: result.candidateSchemas,
|
|
11
|
+
parentCandidates: result.parentCandidates,
|
|
12
|
+
proposals: result.proposals,
|
|
13
|
+
clarificationNeeds: result.clarificationNeeds,
|
|
14
|
+
lineage: result.lineage,
|
|
15
|
+
epistemicBoundary: result.epistemicBoundary,
|
|
16
|
+
findings: result.findings
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function createPortableArtifactSet(input = {}, options = {}) {
|
|
21
|
+
const result = createPortableLocalArtifactSet(input, options);
|
|
22
|
+
return operationResult('create-local-artifact-set', {
|
|
23
|
+
status: result.status,
|
|
24
|
+
plan: result.plan,
|
|
25
|
+
artifacts: result.artifacts,
|
|
26
|
+
lineageClosure: result.lineageClosure,
|
|
27
|
+
boundary: result.boundary,
|
|
28
|
+
findings: result.findings
|
|
29
|
+
});
|
|
30
|
+
}
|