@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,326 @@
|
|
|
1
|
+
import { resolveSchemaCapabilities } from '../../../schemas/capability.registry.js';
|
|
2
|
+
import { buildArtifactCreationContract } from '../../../schemas/creation.contracts.js';
|
|
3
|
+
import { schemaRegistry } from '../../../schemas/registry.js';
|
|
4
|
+
import { portableFinding } from '../findings.js';
|
|
5
|
+
import { selectPortableLoadedSchemaMaterial } from '../providers/schema.providers.js';
|
|
6
|
+
import {
|
|
7
|
+
conditionalContractGroups,
|
|
8
|
+
conditionalCreationInputs,
|
|
9
|
+
contractRules,
|
|
10
|
+
parsePortableSchemaDocument,
|
|
11
|
+
readPortableSchemaSections
|
|
12
|
+
} from './schema.contract.js';
|
|
13
|
+
import { resolvePortableLlmCompanion } from './llm.companion.js';
|
|
14
|
+
import { compilePortableSchemaContract } from './contract.compile.js';
|
|
15
|
+
|
|
16
|
+
export const PORTABLE_SCHEMA_GUIDE_SCHEMA_ID = 'tiinex.llm.schema-guide.v1';
|
|
17
|
+
export const PORTABLE_SCHEMA_GUIDE_COMPILER_VERSION = '4';
|
|
18
|
+
|
|
19
|
+
export function buildPortableSchemaGuide(input = {}, options = {}) {
|
|
20
|
+
const schemaId = String(input.schemaId || options.schemaId || '').trim();
|
|
21
|
+
const task = normalizeTask(input.task || options.task || 'read');
|
|
22
|
+
const detail = normalizeDetail(input.detail || options.detail || 'compact');
|
|
23
|
+
const schemaSelection = selectPortableLoadedSchemaMaterial(input.materials || input, { schemaId });
|
|
24
|
+
const schemaMaterial = schemaSelection.material || null;
|
|
25
|
+
const module = schemaRegistry.byId.get(schemaId) || null;
|
|
26
|
+
const binding = module?.binding || {};
|
|
27
|
+
const markdown = schemaMaterial?.markdown || '';
|
|
28
|
+
const document = markdown ? parsePortableSchemaDocument(markdown) : null;
|
|
29
|
+
const compiledContract = document ? compilePortableSchemaContract(document) : null;
|
|
30
|
+
const capabilityName = capabilityForTask(task);
|
|
31
|
+
const resolution = resolveSchemaCapabilities({ schemaId }, { capability: capabilityName });
|
|
32
|
+
const creationContract = task === 'create' || task === 'continue' ? buildArtifactCreationContract({ schemaId, transitionType: task === 'continue' ? 'continue' : 'create-artifact' }) : null;
|
|
33
|
+
const companionResult = resolvePortableLlmCompanion({ schemaId, task, module, input, options });
|
|
34
|
+
const companion = companionResult.companion;
|
|
35
|
+
const exactReadableContract = Boolean(
|
|
36
|
+
schemaMaterial?.markdown
|
|
37
|
+
&& document?.schemaId === schemaId
|
|
38
|
+
&& schemaMaterial.qualification?.exactSchemaIdentity === true
|
|
39
|
+
&& schemaMaterial.qualification?.sourceQualified === true
|
|
40
|
+
&& schemaMaterial.qualification?.representationIntegrity === 'verified'
|
|
41
|
+
);
|
|
42
|
+
const creationRequested = task === 'create' || task === 'continue';
|
|
43
|
+
const requiredSections = compiledContract ? uniqueStrings([
|
|
44
|
+
...compiledContract.validation.requiredSections,
|
|
45
|
+
...(creationRequested ? compiledContract.creation.requiredSections : [])
|
|
46
|
+
]) : [];
|
|
47
|
+
const requiredFields = compiledContract ? [...compiledContract.validation.requiredFields] : [];
|
|
48
|
+
const optionalSections = detail === 'compact' ? [] : compiledContract ? [...compiledContract.validation.optionalSections] : [];
|
|
49
|
+
const optionalFields = detail === 'full' ? (compiledContract ? [...compiledContract.validation.optionalFields] : []) : [];
|
|
50
|
+
const conditionalRequirements = document ? buildConditionalRequirements(document) : [];
|
|
51
|
+
const rules = document ? contractRules(document.validation) : [];
|
|
52
|
+
const creationRules = document ? contractRules(document.creation) : [];
|
|
53
|
+
const requiredInputs = creationRequested ? uniqueStrings([
|
|
54
|
+
...(creationContract?.inputs?.required || []),
|
|
55
|
+
...(compiledContract ? compiledContract.creation.requiredInputs : []),
|
|
56
|
+
...requiredFields
|
|
57
|
+
]) : [];
|
|
58
|
+
const optionalInputs = creationRequested && compiledContract ? [...compiledContract.creation.optionalInputs] : [];
|
|
59
|
+
const toolingConfiguration = creationRequested && compiledContract ? [...compiledContract.creation.toolingConfigurationFields] : [];
|
|
60
|
+
const hardRules = prioritizeRules([...rules, ...creationRules], task, detail);
|
|
61
|
+
const purpose = companion.purpose || document?.summary || module?.label || `Work with ${schemaId || 'an unknown Tiinex schema'}.`;
|
|
62
|
+
const findings = [...schemaSelection.findings, ...companionResult.findings];
|
|
63
|
+
if (!schemaId) findings.push(portableFinding('error', 'portable.schema-guide.schema.required', 'Schema guide generation requires a schema id.'));
|
|
64
|
+
if (!schemaMaterial && !module) findings.push(portableFinding('error', 'portable.schema-guide.schema.unavailable', 'Neither readable schema material nor a registered schema module is available.', { schemaId }));
|
|
65
|
+
if (!schemaMaterial) findings.push(portableFinding('info', 'portable.schema-guide.readable-schema.unavailable', 'The guide is limited to registered runtime metadata because readable schema Markdown was not supplied.', { schemaId }));
|
|
66
|
+
if (schemaMaterial && document?.schemaId && document.schemaId !== schemaId) findings.push(portableFinding('error', 'portable.schema-guide.readable-schema.mismatch', 'Supplied readable schema material declares a different Current Schema than the requested schema.', {
|
|
67
|
+
requestedSchemaId: schemaId,
|
|
68
|
+
declaredSchemaId: document.schemaId,
|
|
69
|
+
ref: schemaMaterial.path
|
|
70
|
+
}));
|
|
71
|
+
if (!companion.available) findings.push(portableFinding('info', 'portable.schema-guide.llm-companion.generic', 'No schema-specific LLM companion hints were registered; the guide was compiled generically from schema contracts and runtime capabilities.', { schemaId }));
|
|
72
|
+
const cacheBasis = binding.checksum?.value || binding.checksum || schemaMaterial?.markdown || `${schemaId}:${module?.id || ''}`;
|
|
73
|
+
const guide = Object.freeze({
|
|
74
|
+
schema: PORTABLE_SCHEMA_GUIDE_SCHEMA_ID,
|
|
75
|
+
schemaId,
|
|
76
|
+
task,
|
|
77
|
+
detail,
|
|
78
|
+
cacheKey: guideCacheKey({ schemaId, task, detail, basis: cacheBasis, companionVersion: companion.version }),
|
|
79
|
+
cacheBasis: Object.freeze({
|
|
80
|
+
schemaChecksum: binding.checksum?.value || binding.checksum || '',
|
|
81
|
+
sourceCommit: binding.sourceCommit || '',
|
|
82
|
+
compilerVersion: PORTABLE_SCHEMA_GUIDE_COMPILER_VERSION,
|
|
83
|
+
companionVersion: companion.version,
|
|
84
|
+
companionSource: companion.source
|
|
85
|
+
}),
|
|
86
|
+
purpose,
|
|
87
|
+
parentSchemaId: document?.parentSchemaId || module?.parentSchemaId || '',
|
|
88
|
+
capability: Object.freeze({
|
|
89
|
+
requested: capabilityName,
|
|
90
|
+
exactModule: Boolean(resolution.descriptor?.moduleId === schemaId && !resolution.fallbackUsed),
|
|
91
|
+
status: exactReadableContract ? 'readable-exact-contract' : (resolution.capability?.status || ''),
|
|
92
|
+
resolvedThrough: exactReadableContract ? schemaId : (resolution.descriptor?.moduleId || 'tiinex.root.v1'),
|
|
93
|
+
fallbackUsed: exactReadableContract ? false : Boolean(resolution.fallbackUsed),
|
|
94
|
+
runtimeStatus: resolution.capability?.status || '',
|
|
95
|
+
runtimeResolvedThrough: resolution.descriptor?.moduleId || 'tiinex.root.v1',
|
|
96
|
+
runtimeFallbackUsed: Boolean(resolution.fallbackUsed)
|
|
97
|
+
}),
|
|
98
|
+
factoryDescriptor: resolution.descriptor?.factory || null,
|
|
99
|
+
requiredInputs: Object.freeze(limitList(requiredInputs, detail === 'compact' ? 18 : 80)),
|
|
100
|
+
requiredStructure: Object.freeze(limitList(requiredSections, detail === 'compact' ? 14 : 80)),
|
|
101
|
+
requiredFields: Object.freeze(limitList(requiredFields, detail === 'compact' ? 24 : 120)),
|
|
102
|
+
declarationContracts: Object.freeze((compiledContract?.declarations || []).map((contract) => Object.freeze({
|
|
103
|
+
group: contract.group,
|
|
104
|
+
targetHeadings: contract.targetHeadings,
|
|
105
|
+
requiredFields: contract.requiredFields,
|
|
106
|
+
optionalFields: detail === 'compact' ? Object.freeze([]) : contract.optionalFields,
|
|
107
|
+
allowLiteralNone: contract.allowLiteralNone
|
|
108
|
+
}))),
|
|
109
|
+
optionalInputs: Object.freeze(limitList(optionalInputs, detail === 'compact' ? 18 : 80)),
|
|
110
|
+
toolingConfiguration: Object.freeze({
|
|
111
|
+
fields: Object.freeze(limitList(toolingConfiguration, detail === 'compact' ? 18 : 80)),
|
|
112
|
+
authoringInputs: false,
|
|
113
|
+
statement: 'Create-surface prompt configuration is tooling metadata, not artifact content.'
|
|
114
|
+
}),
|
|
115
|
+
conditionalRequirements: Object.freeze(conditionalRequirements.slice(0, detail === 'compact' ? 12 : 80)),
|
|
116
|
+
optionalStructure: Object.freeze(optionalSections),
|
|
117
|
+
optionalFields: Object.freeze(optionalFields),
|
|
118
|
+
authoringSteps: Object.freeze(companion.authoringSteps.length ? companion.authoringSteps : defaultAuthoringSteps({ task, schemaId, requiredSections, requiredFields })),
|
|
119
|
+
hardRules: Object.freeze(limitList([...companion.hardRules, ...hardRules], detail === 'compact' ? 18 : 80)),
|
|
120
|
+
questions: Object.freeze(limitList(companion.questions, detail === 'compact' ? 10 : 40)),
|
|
121
|
+
commonFailures: Object.freeze(limitList(companion.commonFailures, detail === 'compact' ? 10 : 40)),
|
|
122
|
+
companion: Object.freeze({
|
|
123
|
+
available: companion.available,
|
|
124
|
+
source: companion.source,
|
|
125
|
+
version: companion.version,
|
|
126
|
+
prioritySections: companion.prioritySections
|
|
127
|
+
}),
|
|
128
|
+
validationPlan: Object.freeze(validationPlan({ schemaId, resolution, document, task })),
|
|
129
|
+
retrieval: Object.freeze({
|
|
130
|
+
recommendedNext: recommendedRetrieval({ task, detail, document, creationContract, companion }),
|
|
131
|
+
availableSections: Object.freeze((document?.outline || []).map((section) => section.title)),
|
|
132
|
+
fullSchemaAvailable: Boolean(schemaMaterial)
|
|
133
|
+
}),
|
|
134
|
+
authority: Object.freeze({
|
|
135
|
+
readableSchemaAvailable: Boolean(schemaMaterial),
|
|
136
|
+
exactReadableContract,
|
|
137
|
+
schemaPath: schemaMaterial?.path || binding.snapshot || '',
|
|
138
|
+
sourcePath: schemaMaterial?.source?.path || binding.sourcePath || '',
|
|
139
|
+
sourceRepository: schemaMaterial?.source?.repository || binding.sourceRepository || '',
|
|
140
|
+
sourceCommit: schemaMaterial?.source?.commit || binding.sourceCommit || '',
|
|
141
|
+
materialQualification: schemaMaterial?.qualification ? Object.freeze({
|
|
142
|
+
authority: schemaMaterial.qualification.authority,
|
|
143
|
+
sourceQualified: schemaMaterial.qualification.sourceQualified,
|
|
144
|
+
representationIntegrity: schemaMaterial.qualification.representationIntegrity,
|
|
145
|
+
runtimeBootstrapProvenance: schemaMaterial.qualification.runtimeBootstrapProvenance,
|
|
146
|
+
registered: schemaMaterial.qualification.registered
|
|
147
|
+
}) : null,
|
|
148
|
+
statement: schemaMaterial ? `resolved readable schema material (${schemaMaterial.qualification?.authority || 'unqualified'})` : 'Registered runtime metadata only; obtain readable canonical schema for prose-bound semantics.'
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
return Object.freeze({ guide, findings: Object.freeze(findings) });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function readPortableSchemaGuideSections(input = {}, options = {}) {
|
|
155
|
+
const schemaId = String(input.schemaId || options.schemaId || '').trim();
|
|
156
|
+
const schemaSelection = selectPortableLoadedSchemaMaterial(input.materials || input, { schemaId });
|
|
157
|
+
const schemaMaterial = schemaSelection.material || null;
|
|
158
|
+
if (!schemaMaterial) return Object.freeze({
|
|
159
|
+
schema: 'tiinex.portable.schema-section.result.v1',
|
|
160
|
+
schemaId,
|
|
161
|
+
selectors: Object.freeze([]),
|
|
162
|
+
matches: Object.freeze([]),
|
|
163
|
+
truncated: false,
|
|
164
|
+
findings: Object.freeze([portableFinding('error', 'portable.schema-section.schema.unavailable', 'Readable schema material is required to read schema sections.', { schemaId })])
|
|
165
|
+
});
|
|
166
|
+
const selectors = input.sections || input.section || options.sections || options.section || [];
|
|
167
|
+
const result = readPortableSchemaSections(schemaMaterial.markdown, selectors, options);
|
|
168
|
+
return Object.freeze({ ...result, findings: Object.freeze(schemaSelection.findings), authority: schemaMaterial.qualification?.authority || '', path: schemaMaterial.path });
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export function planPortableArtifact(input = {}, options = {}) {
|
|
172
|
+
const guideResult = buildPortableSchemaGuide({ ...input, task: input.task || 'create' }, options);
|
|
173
|
+
const guide = guideResult.guide;
|
|
174
|
+
const provided = normalizeProvidedInputs(input.inputs || input.values || {});
|
|
175
|
+
const missingInputs = guide.requiredInputs.filter((name) => !provided.has(normalizeKey(name)));
|
|
176
|
+
const plan = Object.freeze({
|
|
177
|
+
schema: 'tiinex.llm.artifact-plan.v1',
|
|
178
|
+
schemaId: guide.schemaId,
|
|
179
|
+
task: guide.task,
|
|
180
|
+
cacheKey: guide.cacheKey,
|
|
181
|
+
readyToDraft: missingInputs.length === 0 && guide.authority.readableSchemaAvailable && !guideResult.findings.some((finding) => finding.severity === 'error'),
|
|
182
|
+
conditionReviewRequired: guide.conditionalRequirements.length > 0,
|
|
183
|
+
missingInputs: Object.freeze(missingInputs),
|
|
184
|
+
providedInputs: Object.freeze([...provided.values()]),
|
|
185
|
+
structure: Object.freeze(guide.requiredStructure.map((section, index) => Object.freeze({ order: index + 1, section }))),
|
|
186
|
+
requiredFields: guide.requiredFields,
|
|
187
|
+
authoringSteps: guide.authoringSteps,
|
|
188
|
+
validationPlan: guide.validationPlan,
|
|
189
|
+
conditionalRequirements: guide.conditionalRequirements,
|
|
190
|
+
retrieval: guide.retrieval,
|
|
191
|
+
limitations: Object.freeze([
|
|
192
|
+
...(guide.authority.readableSchemaAvailable ? [] : ['Readable schema material is unavailable.']),
|
|
193
|
+
...(guide.capability.fallbackUsed ? ['Runtime capability resolution used fallback.'] : []),
|
|
194
|
+
...(guide.conditionalRequirements.length ? ['Conditional requirements require trigger-aware review before the draft can be qualified.'] : [])
|
|
195
|
+
])
|
|
196
|
+
});
|
|
197
|
+
const findings = [...guideResult.findings];
|
|
198
|
+
if (missingInputs.length) findings.push(portableFinding('warning', 'portable.artifact-plan.inputs.missing', 'Required authoring inputs are missing.', { schemaId: guide.schemaId, missingInputs }));
|
|
199
|
+
return Object.freeze({ plan, guide, findings: Object.freeze(findings) });
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function validationPlan({ resolution = {}, document = null, task = 'read' }) {
|
|
203
|
+
const steps = ['Parse continuity envelope and declared schema identity.'];
|
|
204
|
+
if (document) steps.push('Apply structured requirements compiled from the supplied readable schema contract.');
|
|
205
|
+
if (resolution.capability?.status === 'implemented' && !resolution.fallbackUsed) steps.push(`Run exact registered ${capabilityForTask(task)} capability.`);
|
|
206
|
+
else steps.push('Run available Root/runtime checks and report partial qualification explicitly.');
|
|
207
|
+
if (task === 'create' || task === 'continue') steps.push('Validate the completed local draft before staging or export.');
|
|
208
|
+
return steps;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function recommendedRetrieval({ task, detail, document, creationContract, companion }) {
|
|
212
|
+
const next = [];
|
|
213
|
+
if (!document) next.push('supply-readable-schema');
|
|
214
|
+
next.push(...(companion?.prioritySections || []).map((section) => `read:${section}`));
|
|
215
|
+
next.push(...(companion?.retrievalHints || []));
|
|
216
|
+
if (task === 'create' || task === 'continue') {
|
|
217
|
+
if (creationContract?.status !== 'ready') next.push('read:Artifact Creation Contract');
|
|
218
|
+
next.push('read:Minimal Example');
|
|
219
|
+
}
|
|
220
|
+
if (detail === 'compact') next.push('read:relevant-validation-groups-on-demand');
|
|
221
|
+
return Object.freeze(uniqueStrings(next));
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function buildConditionalRequirements(document = {}) {
|
|
225
|
+
const validation = conditionalContractGroups(document.validation).map((entry) => Object.freeze({
|
|
226
|
+
source: 'validation-contract',
|
|
227
|
+
group: entry.name,
|
|
228
|
+
requiredWhen: entry.requiredWhen,
|
|
229
|
+
requiredSections: entry.requiredSections,
|
|
230
|
+
requiredFields: entry.requiredFields
|
|
231
|
+
}));
|
|
232
|
+
const creation = conditionalCreationInputs(document).map((entry) => Object.freeze({
|
|
233
|
+
source: 'creation-contract',
|
|
234
|
+
group: entry.group,
|
|
235
|
+
requiredWhen: entry.requiredWhen,
|
|
236
|
+
requiredSections: Object.freeze([]),
|
|
237
|
+
requiredFields: entry.fields
|
|
238
|
+
}));
|
|
239
|
+
return Object.freeze([...validation, ...creation]);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function prioritizeRules(rules = [], task = 'read', detail = 'compact') {
|
|
243
|
+
const normalized = uniqueStrings(rules);
|
|
244
|
+
const scored = normalized.map((rule) => ({
|
|
245
|
+
rule,
|
|
246
|
+
score: (/\b(must|must not|required|never|do not|should not)\b/i.test(rule) ? 4 : 0)
|
|
247
|
+
+ (task === 'create' && /\b(create|generated|artifact|field|section)\b/i.test(rule) ? 2 : 0)
|
|
248
|
+
+ (/\b(provenance|parent|origin|boundary|evidence|truth|authority)\b/i.test(rule) ? 1 : 0)
|
|
249
|
+
}));
|
|
250
|
+
scored.sort((a, b) => b.score - a.score || a.rule.localeCompare(b.rule));
|
|
251
|
+
return scored.slice(0, detail === 'compact' ? 16 : 80).map((item) => item.rule);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function defaultAuthoringSteps({ task, schemaId, requiredSections, requiredFields }) {
|
|
255
|
+
if (task === 'read') return [
|
|
256
|
+
`Confirm the declared schema is ${schemaId || 'the requested schema'}.`,
|
|
257
|
+
'Read continuity, parent, origin, boundaries, and qualification before interpreting body meaning.',
|
|
258
|
+
'Retrieve only the schema sections needed for the current question.'
|
|
259
|
+
];
|
|
260
|
+
return [
|
|
261
|
+
'Establish the real continuity parent and origin boundary.',
|
|
262
|
+
...(requiredSections.length ? ['Create the required body sections in schema order.'] : []),
|
|
263
|
+
...(requiredFields.length ? ['Collect every required field before claiming the draft is ready.'] : []),
|
|
264
|
+
'Write a local draft without inheriting or guessing source provenance.',
|
|
265
|
+
'Validate the draft and repair only reported findings.'
|
|
266
|
+
];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function guideCacheKey({ schemaId, task, detail, basis, companionVersion }) {
|
|
270
|
+
return [schemaId || 'unknown', task, detail, `schema-${stableHash(basis)}`, `compiler-${PORTABLE_SCHEMA_GUIDE_COMPILER_VERSION}`, `companion-${companionVersion || 'generic'}`].join(':');
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function stableHash(value = '') {
|
|
274
|
+
const text = String(value || '');
|
|
275
|
+
let hash = 2166136261;
|
|
276
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
277
|
+
hash ^= text.charCodeAt(index);
|
|
278
|
+
hash = Math.imul(hash, 16777619);
|
|
279
|
+
}
|
|
280
|
+
return (hash >>> 0).toString(16).padStart(8, '0');
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function normalizeProvidedInputs(values = {}) {
|
|
284
|
+
const map = new Map();
|
|
285
|
+
if (Array.isArray(values)) {
|
|
286
|
+
for (const value of values) {
|
|
287
|
+
const name = typeof value === 'string' ? value : value?.name || value?.field || '';
|
|
288
|
+
if (name) map.set(normalizeKey(name), String(name));
|
|
289
|
+
}
|
|
290
|
+
return map;
|
|
291
|
+
}
|
|
292
|
+
for (const [name, value] of Object.entries(values || {})) {
|
|
293
|
+
if (value === undefined || value === null || value === '') continue;
|
|
294
|
+
map.set(normalizeKey(name), name);
|
|
295
|
+
}
|
|
296
|
+
return map;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function capabilityForTask(task = 'read') {
|
|
300
|
+
if (task === 'create') return 'create';
|
|
301
|
+
if (task === 'continue') return 'continue';
|
|
302
|
+
if (task === 'validate') return 'validate';
|
|
303
|
+
return 'read';
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function normalizeTask(value = '') {
|
|
307
|
+
const task = String(value || '').toLowerCase().trim();
|
|
308
|
+
return ['read', 'create', 'continue', 'validate', 'repair'].includes(task) ? task : 'read';
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function normalizeDetail(value = '') {
|
|
312
|
+
const detail = String(value || '').toLowerCase().trim();
|
|
313
|
+
return ['compact', 'standard', 'full'].includes(detail) ? detail : 'compact';
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function normalizeKey(value = '') {
|
|
317
|
+
return String(value || '').toLowerCase().replace(/[`*_#]/g, '').replace(/[^a-z0-9]+/g, ' ').trim();
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function limitList(values = [], max = 20) {
|
|
321
|
+
return uniqueStrings(values).slice(0, max);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function uniqueStrings(values = []) {
|
|
325
|
+
return [...new Set((Array.isArray(values) ? values : []).map((value) => String(value || '').trim()).filter(Boolean))];
|
|
326
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { parsePortableSchemaDocument } from './schema.contract.js';
|
|
3
|
+
import { projectMachineShapeSemanticIdentity } from './contract.machine-shape.js';
|
|
4
|
+
|
|
5
|
+
export const PORTABLE_SCHEMA_FRESHNESS_SCHEMA_ID = 'tiinex.portable.schema-freshness.v1';
|
|
6
|
+
|
|
7
|
+
export function comparePortableSchemaSnapshots(input = {}) {
|
|
8
|
+
const candidate = normalizeSide(input.candidate || input.bundled || {});
|
|
9
|
+
const reference = normalizeSide(input.reference || input.canonical || {});
|
|
10
|
+
if (!candidate.markdown || !reference.markdown) return result('comparison-unresolved', candidate, reference, ['Both candidate and reference schema Markdown must be supplied explicitly.']);
|
|
11
|
+
const candidateDoc = parsePortableSchemaDocument(candidate.markdown);
|
|
12
|
+
const referenceDoc = parsePortableSchemaDocument(reference.markdown);
|
|
13
|
+
if (!candidateDoc.schemaId || !referenceDoc.schemaId) return result('comparison-unresolved', candidate, reference, ['Schema identity could not be parsed from one or both supplied materials.']);
|
|
14
|
+
if (candidateDoc.schemaId !== referenceDoc.schemaId) return result('authority-mismatch', candidate, reference, [`Schema identity differs: ${candidateDoc.schemaId} != ${referenceDoc.schemaId}.`], candidateDoc, referenceDoc);
|
|
15
|
+
if (input.expectedReferenceAuthority) {
|
|
16
|
+
const mismatch = authorityMismatch(reference.authority, input.expectedReferenceAuthority);
|
|
17
|
+
if (mismatch.length) return result('authority-mismatch', candidate, reference, mismatch, candidateDoc, referenceDoc);
|
|
18
|
+
}
|
|
19
|
+
const candidateShape = contractShape(candidateDoc);
|
|
20
|
+
const referenceShape = contractShape(referenceDoc);
|
|
21
|
+
const candidateFingerprint = fingerprint(candidateShape);
|
|
22
|
+
const referenceFingerprint = fingerprint(referenceShape);
|
|
23
|
+
const status = candidateFingerprint === referenceFingerprint ? 'equivalent-current' : 'materially-stale';
|
|
24
|
+
return Object.freeze({
|
|
25
|
+
schema: PORTABLE_SCHEMA_FRESHNESS_SCHEMA_ID,
|
|
26
|
+
status,
|
|
27
|
+
schemaId: referenceDoc.schemaId,
|
|
28
|
+
candidate: Object.freeze({ authority: candidate.authority, fingerprint: candidateFingerprint }),
|
|
29
|
+
reference: Object.freeze({ authority: reference.authority, fingerprint: referenceFingerprint }),
|
|
30
|
+
differences: Object.freeze(status === 'materially-stale' ? diffShapes(candidateShape, referenceShape) : [])
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function normalizeSide(value) {
|
|
35
|
+
return Object.freeze({ markdown: String(value.markdown || value.content || ''), authority: Object.freeze({ ...(value.authority || value.source || {}) }) });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function contractShape(document) {
|
|
39
|
+
return Object.freeze({
|
|
40
|
+
schemaId: document.schemaId,
|
|
41
|
+
parentSchemaId: document.parentSchemaId || '',
|
|
42
|
+
envelopeSchemaId: document.envelopeSchemaId || '',
|
|
43
|
+
validation: normalizeContract(document.validation, { suppressValidationMachineShapes: true }),
|
|
44
|
+
creation: normalizeContract(document.creation),
|
|
45
|
+
machineShapes: projectMachineShapeSemanticIdentity(document)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function normalizeContract(contract = {}, options = {}) {
|
|
50
|
+
const suppressValidationMachineShapes = options.suppressValidationMachineShapes === true;
|
|
51
|
+
return (contract.groups || []).map((group) => ({
|
|
52
|
+
name: group.name,
|
|
53
|
+
categories: (group.categories || []).filter((category) => !(suppressValidationMachineShapes && String(category.name || '').trim() === 'Machine Shape Definitions')).map((category) => ({
|
|
54
|
+
name: category.name,
|
|
55
|
+
nodes: canonicalCategoryNodes(category)
|
|
56
|
+
}))
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function canonicalCategoryNodes(category = {}) {
|
|
61
|
+
const ordered = String(category.name || '').trim() === 'Ordering';
|
|
62
|
+
const nodes = (category.nodes || []).map((node) => canonicalNode(node, ordered));
|
|
63
|
+
if (nodes.length) return ordered ? nodes : nodes.sort(compareCanonicalNodes);
|
|
64
|
+
const fallback = [...(category.items || [])].map((value) => ({ value: String(value), children: [] }));
|
|
65
|
+
return ordered ? fallback : fallback.sort(compareCanonicalNodes);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function canonicalNode(node = {}, ordered = false) {
|
|
69
|
+
const children = (node.children || []).map((child) => canonicalNode(child, ordered));
|
|
70
|
+
if (!ordered) children.sort(compareCanonicalNodes);
|
|
71
|
+
return { value: String(node.value || ''), children };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function compareCanonicalNodes(left = {}, right = {}) {
|
|
75
|
+
return compareExactStrings(JSON.stringify(left), JSON.stringify(right));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function compareExactStrings(left = '', right = '') {
|
|
79
|
+
const a = String(left);
|
|
80
|
+
const b = String(right);
|
|
81
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
function fingerprint(value) {
|
|
86
|
+
return createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function diffShapes(candidate, reference) {
|
|
90
|
+
const diffs = [];
|
|
91
|
+
if ((candidate.parentSchemaId || '') !== (reference.parentSchemaId || '')) diffs.push(`parent schema identity differs: ${candidate.parentSchemaId || '(none)'} != ${reference.parentSchemaId || '(none)'}`);
|
|
92
|
+
if ((candidate.envelopeSchemaId || '') !== (reference.envelopeSchemaId || '')) diffs.push(`envelope schema identity differs: ${candidate.envelopeSchemaId || '(none)'} != ${reference.envelopeSchemaId || '(none)'}`);
|
|
93
|
+
for (const surface of ['validation', 'creation']) {
|
|
94
|
+
const a = JSON.stringify(candidate[surface]);
|
|
95
|
+
const b = JSON.stringify(reference[surface]);
|
|
96
|
+
if (a !== b) diffs.push(`${surface} contract differs`);
|
|
97
|
+
}
|
|
98
|
+
if (JSON.stringify(candidate.machineShapes) !== JSON.stringify(reference.machineShapes)) diffs.push('machine-shape authority differs');
|
|
99
|
+
return diffs;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function authorityMismatch(actual = {}, expected = {}) {
|
|
103
|
+
const diffs = [];
|
|
104
|
+
for (const key of ['repository', 'commit', 'path']) {
|
|
105
|
+
if (expected[key] && actual[key] !== expected[key]) diffs.push(`Reference authority ${key} mismatch.`);
|
|
106
|
+
}
|
|
107
|
+
return diffs;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function result(status, candidate, reference, differences, candidateDoc = null, referenceDoc = null) {
|
|
111
|
+
return Object.freeze({
|
|
112
|
+
schema: PORTABLE_SCHEMA_FRESHNESS_SCHEMA_ID,
|
|
113
|
+
status,
|
|
114
|
+
schemaId: referenceDoc?.schemaId || candidateDoc?.schemaId || '',
|
|
115
|
+
candidate: Object.freeze({ authority: candidate.authority, fingerprint: '' }),
|
|
116
|
+
reference: Object.freeze({ authority: reference.authority, fingerprint: '' }),
|
|
117
|
+
differences: Object.freeze(differences)
|
|
118
|
+
});
|
|
119
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import {
|
|
2
|
+
auditPortableMaterial,
|
|
3
|
+
createPortableArtifactDraft,
|
|
4
|
+
discoverPortableTooling,
|
|
5
|
+
compilePortableSchemaGuide,
|
|
6
|
+
explainPortableArtifactFindings,
|
|
7
|
+
describePortableSchemaChain,
|
|
8
|
+
inspectPortableAssetIndex,
|
|
9
|
+
inspectPortableCreationContract,
|
|
10
|
+
inspectPortableMaterial,
|
|
11
|
+
planPortableArtifactCreation,
|
|
12
|
+
planPortableArtifactRepairs,
|
|
13
|
+
preparePortableTaskOperation,
|
|
14
|
+
preparePortableAssetAnalysisOperation,
|
|
15
|
+
readPortableSchemaSection,
|
|
16
|
+
listPortableProviders,
|
|
17
|
+
makePortableWriterBrief,
|
|
18
|
+
resolvePortableCapabilities,
|
|
19
|
+
resolvePortableSchemaChainMaterialOperation,
|
|
20
|
+
resolvePortableSchemaMaterialOperation,
|
|
21
|
+
searchPortableLineage,
|
|
22
|
+
stagePortableArtifactDraft,
|
|
23
|
+
resolvePortableLineage,
|
|
24
|
+
validatePortableArtifactDraft
|
|
25
|
+
} from '../engine.facade.js';
|
|
26
|
+
import { buildPortableRuntimePackage, inspectPortableRuntimePackage, rehydratePortableRuntimePackage, roundTripPortableRuntimePackage } from '../package/runtime.package.js';
|
|
27
|
+
|
|
28
|
+
export const PORTABLE_SESSION_SCHEMA_ID = 'tiinex.portable.session.v1';
|
|
29
|
+
|
|
30
|
+
export function openPortableSession(input = {}) {
|
|
31
|
+
const state = normalizeSessionState(input);
|
|
32
|
+
return Object.freeze({
|
|
33
|
+
schema: PORTABLE_SESSION_SCHEMA_ID,
|
|
34
|
+
prepareTask: (request = {}, options = {}) => preparePortableTaskOperation({ ...state.materials, ...request, schemaCache: state.schemaCache }, options),
|
|
35
|
+
discoverTooling: (request = {}, options = {}) => discoverPortableTooling({ ...request, schemaCache: state.schemaCache }, options),
|
|
36
|
+
listProviders: (request = {}, options = {}) => listPortableProviders({ ...state.materials, ...request, schemaCache: state.schemaCache }, options),
|
|
37
|
+
resolveSchemaMaterial: (request = {}, options = {}) => resolvePortableSchemaMaterialOperation({ ...state.materials, ...request, schemaCache: state.schemaCache }, options),
|
|
38
|
+
resolveSchemaChainMaterial: (request = {}, options = {}) => resolvePortableSchemaChainMaterialOperation({ ...state.materials, ...request, schemaCache: state.schemaCache }, options),
|
|
39
|
+
inspect: (options = {}) => inspectPortableMaterial(state.materials, options),
|
|
40
|
+
audit: (options = {}) => auditPortableMaterial(state.materials, options),
|
|
41
|
+
resolveLineage: (options = {}) => resolvePortableLineage(state.materials, { ...options, startId: options.startId || state.currentFocus }),
|
|
42
|
+
resolveCapabilities: (request = {}, options = {}) => resolvePortableCapabilities(request, options),
|
|
43
|
+
describeSchemaChain: (request = {}, options = {}) => describePortableSchemaChain({ ...state.materials, ...request }, options),
|
|
44
|
+
inspectCreationContract: (request = {}, options = {}) => inspectPortableCreationContract(request, options),
|
|
45
|
+
makeWriterBrief: (request = {}, options = {}) => makePortableWriterBrief({ ...state.materials, ...request }, options),
|
|
46
|
+
schemaGuide: (request = {}, options = {}) => compilePortableSchemaGuide({ ...state.materials, ...request }, options),
|
|
47
|
+
readSchemaSection: (request = {}, options = {}) => readPortableSchemaSection({ ...state.materials, ...request }, options),
|
|
48
|
+
planArtifact: (request = {}, options = {}) => planPortableArtifactCreation({ ...state.materials, ...request }, options),
|
|
49
|
+
createLocalDraft: (request = {}, options = {}) => createPortableArtifactDraft({ ...state.materials, ...request }, options),
|
|
50
|
+
validateDraft: (request = {}, options = {}) => validatePortableArtifactDraft({ ...state.materials, ...request }, options),
|
|
51
|
+
stageDraft: (request = {}, options = {}) => stagePortableArtifactDraft({ ...state.materials, ...request }, options),
|
|
52
|
+
explainFindings: (request = {}, options = {}) => explainPortableArtifactFindings(request, options),
|
|
53
|
+
repairPlan: (request = {}, options = {}) => planPortableArtifactRepairs(request, options),
|
|
54
|
+
searchLineage: (request = {}, options = {}) => searchPortableLineage({ ...state.materials, ...request }, options),
|
|
55
|
+
inspectAssets: (request = {}, options = {}) => inspectPortableAssetIndex({ ...state.materials, ...request }, options),
|
|
56
|
+
prepareAssetAnalysis: (request = {}, options = {}) => preparePortableAssetAnalysisOperation({ ...state.materials, ...request }, options),
|
|
57
|
+
planDurableMaterialization: async (request = {}) => {
|
|
58
|
+
const { planPortableDurableMaterialization } = await import('../materialization/durable.materialize.js');
|
|
59
|
+
return planPortableDurableMaterialization({ session: state, ...request });
|
|
60
|
+
},
|
|
61
|
+
materializeDurableFindings: async (request = {}, options = {}) => {
|
|
62
|
+
const { materializePortableDurableFindings } = await import('../materialization/durable.materialize.js');
|
|
63
|
+
return materializePortableDurableFindings({ session: state, ...request }, options);
|
|
64
|
+
},
|
|
65
|
+
createCheckpoint: async (request = {}, options = {}) => {
|
|
66
|
+
const { createPortableCheckpoint } = await import('../checkpoint/portable.checkpoint.js');
|
|
67
|
+
return createPortableCheckpoint({ session: state, ...request }, options);
|
|
68
|
+
},
|
|
69
|
+
buildRuntimePackage: (request = {}, options = {}) => buildPortableRuntimePackage({ session: state, ...request }, options),
|
|
70
|
+
inspectRuntimePackage: (request = {}) => inspectPortableRuntimePackage(request),
|
|
71
|
+
rehydrateRuntimePackage: (request = {}) => rehydratePortableRuntimePackage(request),
|
|
72
|
+
roundTripRuntimePackage: (request = {}, options = {}) => roundTripPortableRuntimePackage({ session: state, ...request }, options),
|
|
73
|
+
snapshot: () => serializePortableSession(state),
|
|
74
|
+
withFocus: (currentFocus = '') => openPortableSession({ ...state, currentFocus }),
|
|
75
|
+
withDurableFinding: (finding = {}) => openPortableSession({ ...state, durableFindings: [...state.durableFindings, finding] }),
|
|
76
|
+
withStagedArtifact: (artifact = {}) => openPortableSession({ ...state, stagedArtifacts: [...state.stagedArtifacts, artifact] }),
|
|
77
|
+
withSchemaCache: (entries = []) => openPortableSession({ ...state, schemaCache: mergeSchemaCache(state.schemaCache, entries) }),
|
|
78
|
+
withCheckpoint: (lastCheckpoint = {}) => openPortableSession({ ...state, lastCheckpoint })
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function serializePortableSession(sessionOrState = {}) {
|
|
83
|
+
const source = typeof sessionOrState.snapshot === 'function' ? sessionOrState.snapshot() : normalizeSessionState(sessionOrState);
|
|
84
|
+
return Object.freeze(JSON.parse(JSON.stringify(source)));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function restorePortableSession(snapshot = {}) {
|
|
88
|
+
if (snapshot?.schema !== PORTABLE_SESSION_SCHEMA_ID) throw new Error('portable.session.schema.invalid');
|
|
89
|
+
const version = Number(snapshot?.version || 0);
|
|
90
|
+
if (![1, 2].includes(version)) throw new Error('portable.session.version.unsupported');
|
|
91
|
+
return openPortableSession(version === 1 ? { ...snapshot, version: 2, schemaCache: [] } : snapshot);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function normalizeSessionState(input = {}) {
|
|
95
|
+
const materials = input.materials || pickMaterialInput(input);
|
|
96
|
+
return Object.freeze({
|
|
97
|
+
schema: PORTABLE_SESSION_SCHEMA_ID,
|
|
98
|
+
version: 2,
|
|
99
|
+
boundary: Object.freeze({
|
|
100
|
+
hiddenConversationStateIsProvenance: false,
|
|
101
|
+
remoteFetch: 'explicit-host-mediated-only',
|
|
102
|
+
remoteWrite: false,
|
|
103
|
+
sourceMutation: false
|
|
104
|
+
}),
|
|
105
|
+
materials: Object.freeze({
|
|
106
|
+
markdown: typeof materials.markdown === 'string' ? materials.markdown : undefined,
|
|
107
|
+
path: materials.path || undefined,
|
|
108
|
+
files: Object.freeze((materials.files || []).map((file) => Object.freeze({ ...file }))),
|
|
109
|
+
records: Object.freeze((materials.records || []).map((record) => Object.freeze({ ...record }))),
|
|
110
|
+
assets: Object.freeze((materials.assets || []).map((asset) => Object.freeze({ ...asset }))),
|
|
111
|
+
findings: Object.freeze((materials.findings || []).map((finding) => Object.freeze({ ...finding }))),
|
|
112
|
+
sourceMode: materials.sourceMode || 'portable-local'
|
|
113
|
+
}),
|
|
114
|
+
currentFocus: String(input.currentFocus || ''),
|
|
115
|
+
stagedArtifacts: Object.freeze((input.stagedArtifacts || []).map((artifact) => Object.freeze({ ...artifact }))),
|
|
116
|
+
durableFindings: Object.freeze((input.durableFindings || []).map((finding) => Object.freeze({ ...finding }))),
|
|
117
|
+
lastCheckpoint: input.lastCheckpoint ? Object.freeze({ ...input.lastCheckpoint }) : null,
|
|
118
|
+
qualification: input.qualification ? Object.freeze({ ...input.qualification }) : null,
|
|
119
|
+
schemaCache: Object.freeze(normalizeSchemaCache(input.schemaCache))
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function pickMaterialInput(input = {}) {
|
|
124
|
+
return {
|
|
125
|
+
markdown: input.markdown,
|
|
126
|
+
path: input.path,
|
|
127
|
+
files: input.files || [],
|
|
128
|
+
records: input.records || [],
|
|
129
|
+
assets: input.assets || [],
|
|
130
|
+
findings: input.findings || [],
|
|
131
|
+
sourceMode: input.sourceMode
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
function normalizeSchemaCache(value) {
|
|
137
|
+
const entries = value instanceof Map ? [...value.values()] : Array.isArray(value) ? value : value && typeof value === 'object' ? Object.values(value) : [];
|
|
138
|
+
return entries.filter((entry) => entry?.schemaId && typeof entry?.markdown === 'string').map((entry) => Object.freeze({ ...entry }));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function mergeSchemaCache(current, next) {
|
|
142
|
+
const map = new Map(normalizeSchemaCache(current).map((entry) => [entry.cacheKey || `${entry.schemaId}:${entry.path}`, entry]));
|
|
143
|
+
for (const entry of normalizeSchemaCache(next)) map.set(entry.cacheKey || `${entry.schemaId}:${entry.path}`, entry);
|
|
144
|
+
return [...map.values()];
|
|
145
|
+
}
|