@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,316 @@
|
|
|
1
|
+
import { resolveLineage } from '../../../lineage/lineage.resolve.js';
|
|
2
|
+
import { normalizePortableInput } from '../input/portable.input.js';
|
|
3
|
+
import { projectPortableOperatingOverview } from '../overview/operatingOverview.js';
|
|
4
|
+
import { summarizePortableFindings } from '../findings.js';
|
|
5
|
+
import { directedLineageCone, isRoutedHandoffBundle, materializeQualifiedWorkspaceSnapshot, normalizeSelectors, projectBlockers, projectRelevantTopology, projectRequiredContext, relevantLineageIssues, resolveRequiredContextRecords, resolveSelectedRouteRecords } from './grounding.readiness.support.js';
|
|
6
|
+
import { groundPortableColdConsumer } from '../handoff/coldStartQualification.grounding.js';
|
|
7
|
+
import { createColdStartMaterialContext, projectGroundedContinuation } from '../handoff/coldStartQualification.materials.js';
|
|
8
|
+
import { auditHandoffPackageContextCarriage } from '../handoff/contextAudit.js';
|
|
9
|
+
import { acceptedRecoveryMaterial, projectColdStartContinuity } from './grounding.continuity.js';
|
|
10
|
+
import { projectGroundingAuthority } from './grounding.readiness.authority.js';
|
|
11
|
+
import { projectGroundingCapsule } from './grounding.capsule.js';
|
|
12
|
+
|
|
13
|
+
export const PORTABLE_GROUNDING_READINESS_SCHEMA_ID = 'tiinex.portable.grounding-readiness.v1';
|
|
14
|
+
|
|
15
|
+
const MAX_ITEMS = 12;
|
|
16
|
+
|
|
17
|
+
export function projectPortableGroundingReadiness(input = {}, options = {}) {
|
|
18
|
+
const bundle = input.bundle || input.package || input;
|
|
19
|
+
const handoffMode = isRoutedHandoffBundle(bundle);
|
|
20
|
+
if (!handoffMode) {
|
|
21
|
+
const material = normalizePortableInput(input.materials || input);
|
|
22
|
+
return composeGroundingReadiness({
|
|
23
|
+
mode: 'loaded-material',
|
|
24
|
+
authority: null,
|
|
25
|
+
continuation: null,
|
|
26
|
+
contextAudit: null,
|
|
27
|
+
material,
|
|
28
|
+
requiredContext: [],
|
|
29
|
+
findings: [...(material.findings || [])]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const route = String(input.route || input.routeId || input.routePath || '').trim();
|
|
34
|
+
const materialContext = createColdStartMaterialContext();
|
|
35
|
+
const grounding = groundPortableColdConsumer({
|
|
36
|
+
...input,
|
|
37
|
+
bundle,
|
|
38
|
+
package: bundle,
|
|
39
|
+
ingressKind: 'routed-handoff-package',
|
|
40
|
+
route,
|
|
41
|
+
toolingAvailable: true
|
|
42
|
+
}, { ...options, coldStartMaterialContext: materialContext });
|
|
43
|
+
const continuation = projectGroundedContinuation({
|
|
44
|
+
bundle,
|
|
45
|
+
route,
|
|
46
|
+
grounding,
|
|
47
|
+
qualification: { status: 'not-assessed-by-ground' },
|
|
48
|
+
packageSourcePath: String(input.packageSourcePath || '')
|
|
49
|
+
}, materialContext);
|
|
50
|
+
const contextAudit = auditHandoffPackageContextCarriage({ bundle });
|
|
51
|
+
const snapshot = materializeQualifiedWorkspaceSnapshot(bundle, contextAudit, {
|
|
52
|
+
includeLegacyTopics: Boolean(input.includeLegacyTopics || options.includeLegacyTopics)
|
|
53
|
+
});
|
|
54
|
+
const recoveryMaterial = acceptedRecoveryMaterial(input.recoveryAcceptance || input.recovery || input.recoveredMaterial || {});
|
|
55
|
+
const material = normalizePortableInput({
|
|
56
|
+
files: [...snapshot.files, ...recoveryMaterial.files],
|
|
57
|
+
findings: [...snapshot.findings, ...recoveryMaterial.findings]
|
|
58
|
+
});
|
|
59
|
+
return composeGroundingReadiness({
|
|
60
|
+
mode: 'routed-handoff-package',
|
|
61
|
+
authority: grounding,
|
|
62
|
+
continuation,
|
|
63
|
+
contextAudit,
|
|
64
|
+
material,
|
|
65
|
+
requiredContext: continuation.requiredContext || [],
|
|
66
|
+
requiredContextSelectors: normalizeSelectors(input.includeRequiredContext || options.includeRequiredContext),
|
|
67
|
+
includeCurrentWork: Boolean(input.includeCurrentWork || options.includeCurrentWork),
|
|
68
|
+
findings: [
|
|
69
|
+
...(grounding.findings || []),
|
|
70
|
+
...(contextAudit.findings || []),
|
|
71
|
+
...(snapshot.findings || []),
|
|
72
|
+
...(material.findings || [])
|
|
73
|
+
]
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function composeGroundingReadiness({ mode = 'loaded-material', authority = null, continuation = null, contextAudit = null, material = {}, requiredContext = [], requiredContextSelectors = [], includeCurrentWork = false, findings = [] } = {}) {
|
|
78
|
+
const records = Array.isArray(material.records) ? material.records : [];
|
|
79
|
+
const lineage = resolveLineage(records, { depth: 'portable-grounding-readiness' });
|
|
80
|
+
const requiredRecordResolution = resolveRequiredContextRecords(requiredContext, records);
|
|
81
|
+
const requiredContextProjection = projectRequiredContext(requiredContext, requiredContextSelectors);
|
|
82
|
+
const handoffMode = mode === 'routed-handoff-package';
|
|
83
|
+
const routeRecordIds = resolveSelectedRouteRecords(authority, records);
|
|
84
|
+
const relevantIds = handoffMode
|
|
85
|
+
? directedLineageCone(lineage, routeRecordIds)
|
|
86
|
+
: new Set((lineage.nodes || []).map((node) => node.id));
|
|
87
|
+
const relevantRecords = records.filter((record) => relevantIds.has(record.id));
|
|
88
|
+
const overview = projectPortableOperatingOverview({ records: relevantRecords });
|
|
89
|
+
const topology = projectRelevantTopology(lineage, relevantIds, overview.frontierCandidates || [], routeRecordIds);
|
|
90
|
+
const lineageIssues = relevantLineageIssues(lineage, relevantIds);
|
|
91
|
+
const routeBlockingLineageIssues = relevantLineageIssues(lineage, routeRecordIds);
|
|
92
|
+
const continuity = projectColdStartContinuity({ mode, lineage, routeRecordIds, authority, material });
|
|
93
|
+
const combinedFindings = dedupeFindings([
|
|
94
|
+
...findings,
|
|
95
|
+
...filterFindingsForIds(lineage.findings || [], relevantIds),
|
|
96
|
+
...(overview.findings || [])
|
|
97
|
+
]);
|
|
98
|
+
|
|
99
|
+
const missingEvidence = [];
|
|
100
|
+
const reasons = [];
|
|
101
|
+
const known = [];
|
|
102
|
+
const inferred = [];
|
|
103
|
+
const unresolved = [];
|
|
104
|
+
const humanOnly = [];
|
|
105
|
+
let holderBindingActReady = !handoffMode;
|
|
106
|
+
|
|
107
|
+
if (handoffMode) {
|
|
108
|
+
const route = authority?.selectedRoute || null;
|
|
109
|
+
const roleState = String(authority?.role?.state || 'unresolved');
|
|
110
|
+
const holderState = String(authority?.holderBinding?.state || 'unresolved');
|
|
111
|
+
if (!route || String(authority?.status || '') === 'blocked') missing(missingEvidence, unresolved, 'authority-route-unqualified', 'The selected Handoff route is not qualified for this grounding result.');
|
|
112
|
+
else known.push(evidence('qualified-handoff-route', 'qualified', route.id || route.pointerPath || 'selected-route'));
|
|
113
|
+
if (roleState === 'qualified' || roleState === 'not-applicable') known.push(evidence('recipient-role-boundary', roleState, authority?.role?.endpoint?.label || 'recipient'));
|
|
114
|
+
else if (roleState === 'blocked') missing(missingEvidence, unresolved, 'recipient-role-blocked', 'The Handoff recipient Role boundary is blocked or contradictory.');
|
|
115
|
+
else missing(missingEvidence, unresolved, 'recipient-role-unresolved', 'The Handoff recipient Role boundary is not qualified for act-ready grounding.');
|
|
116
|
+
|
|
117
|
+
if (holderState === 'qualified' || holderState === 'not-applicable') {
|
|
118
|
+
holderBindingActReady = true;
|
|
119
|
+
known.push(evidence('session-holder-role-binding', holderState, authority?.holderBinding?.roleLabel || authority?.role?.endpoint?.label || 'recipient'));
|
|
120
|
+
} else if (holderState === 'blocked') {
|
|
121
|
+
holderBindingActReady = false;
|
|
122
|
+
missing(missingEvidence, unresolved, 'session-holder-role-binding-blocked', 'The explicit consuming-session holder Role contradicts the selected Handoff recipient Role.');
|
|
123
|
+
} else {
|
|
124
|
+
holderBindingActReady = false;
|
|
125
|
+
unresolved.push(evidence('session-holder-role-binding', 'unresolved', `recipient Role ${authority?.role?.endpoint?.label || authority?.handoff?.to || 'recipient'} is qualified separately from the consuming session`));
|
|
126
|
+
reasons.push(reason('session-holder-role-binding-unresolved', 'The selected recipient Role does not assign itself to this consuming session. Supply an explicit matching session holder Role binding before act-ready continuation.'));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const required = Array.isArray(requiredContext) ? requiredContext : [];
|
|
130
|
+
const unresolvedRequired = required.filter((entry) => entry.state !== 'qualified');
|
|
131
|
+
if (unresolvedRequired.length) missing(missingEvidence, unresolved, 'required-context-unqualified', `${unresolvedRequired.length} declared Required Context item(s) are not exact-qualified.`);
|
|
132
|
+
else known.push(evidence('required-context-closure', 'qualified', `${required.length} item(s)`));
|
|
133
|
+
if (String(continuation?.state || '') !== 'ready') missing(missingEvidence, unresolved, 'continuation-not-ready', 'The grounded continuation is not ready for substantive work.');
|
|
134
|
+
if (String(contextAudit?.status || '') !== 'ready' || String(contextAudit?.coverage?.state || '') !== 'qualified') missing(missingEvidence, unresolved, 'workspace-snapshot-coverage-unqualified', 'Complete carried Workspace snapshot coverage is not qualified.');
|
|
135
|
+
else known.push(evidence('workspace-snapshot-coverage', 'qualified', `${contextAudit.workspaceMaterializations?.length || 0} workspace(s)`));
|
|
136
|
+
for (const item of requiredRecordResolution.missing) missing(missingEvidence, unresolved, 'required-context-not-in-snapshot', item);
|
|
137
|
+
if (!routeRecordIds.size) missing(missingEvidence, unresolved, 'selected-route-not-in-snapshot', 'The qualified selected Handoff route was not found at its exact carried Workspace path.');
|
|
138
|
+
} else {
|
|
139
|
+
unresolved.push(evidence('bounded-handoff-authority', 'not-supplied', 'loaded material only'));
|
|
140
|
+
reasons.push(reason('discussion-only-without-handoff', 'Loaded material can support bounded discussion, but no Handoff authority/Required Context closure was supplied for act-ready grounding.'));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (!records.length) missing(missingEvidence, unresolved, 'no-artifact-records', 'No readable Tiinex artifact records were loaded for grounding.');
|
|
144
|
+
else known.push(evidence('loaded-artifact-records', 'known', `${records.length} record(s)`));
|
|
145
|
+
|
|
146
|
+
inferred.push(evidence('relevant-lineage-scope', 'bounded-inference', handoffMode ? 'directed declared-Parent cone around the exact selected Handoff route within complete carried Workspace snapshots' : 'all loaded records'));
|
|
147
|
+
inferred.push(evidence('lineage-leaf-role', 'bounded-inference', 'derived only from declared Parent edges in the shared resolver'));
|
|
148
|
+
|
|
149
|
+
if (handoffMode) {
|
|
150
|
+
if (routeBlockingLineageIssues.length) {
|
|
151
|
+
missing(missingEvidence, unresolved, 'selected-route-lineage-unresolved', `${routeBlockingLineageIssues.length} Parent-lineage ambiguity/missing/integrity issue(s) affect the selected Handoff route itself.`);
|
|
152
|
+
} else if (topology.routeLeaves.length) {
|
|
153
|
+
known.push(evidence('selected-route-parent-lineage-leaf', 'resolved', `${topology.routeLeaves.length} selected-route leaf/leaves`));
|
|
154
|
+
} else {
|
|
155
|
+
missing(missingEvidence, unresolved, 'selected-route-lineage-leaf-missing', 'The selected Handoff route is not a resolved Parent-lineage leaf in the complete carried Workspace snapshots.');
|
|
156
|
+
}
|
|
157
|
+
if (lineageIssues.length > routeBlockingLineageIssues.length) unresolved.push(evidence('upstream-lineage-diagnostics', continuity.state === 'qualified' ? 'degraded-nonblocking' : 'blocking-for-cold-start-continuity', `${lineageIssues.length - routeBlockingLineageIssues.length} upstream Parent-lineage issue(s) remain outside the selected-route edge boundary.`));
|
|
158
|
+
} else if (lineageIssues.length) {
|
|
159
|
+
missing(missingEvidence, unresolved, 'loaded-lineage-unresolved', `${lineageIssues.length} loaded Parent-lineage ambiguity/missing/integrity issue(s) remain.`);
|
|
160
|
+
} else if (topology.leaves.length) {
|
|
161
|
+
known.push(evidence('loaded-parent-lineage-leaves', 'resolved', `${topology.leaves.length} loaded leaf/leaves`));
|
|
162
|
+
} else {
|
|
163
|
+
missing(missingEvidence, unresolved, 'loaded-lineage-leaf-missing', 'No resolved Parent-lineage leaf is available in the loaded material.');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (handoffMode) {
|
|
167
|
+
if (continuity.state === 'qualified') known.push(evidence('cold-start-root-continuity', 'qualified', `${continuity.proof.qualifiedRoots.length} qualified semantic root(s); ${continuity.proof.ancestorRecordsChecked} ancestor record(s) checked without projecting ancestor bodies.`));
|
|
168
|
+
else missing(missingEvidence, unresolved, 'cold-start-root-continuity-unproven', `Cold-start continuity to a qualified semantic root is unproven; ${continuity.blockingIssues.length} blocking Parent/root issue(s) remain.`);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (topology.currentTasks.length) known.push(evidence('declared-current-work', 'qualified-candidates', `${topology.currentTasks.length} Task candidate(s) on the selected route lineage`));
|
|
172
|
+
else unresolved.push(evidence('declared-current-work', 'unresolved', 'no exact-qualified nonterminal Task candidate on the selected route lineage'));
|
|
173
|
+
|
|
174
|
+
if (topology.currentFrontier.length) known.push(evidence('declared-current-frontier', 'resolved', `${topology.currentFrontier.length} nearest current Task anchor(s) to the selected route leaf`));
|
|
175
|
+
else reasons.push(reason('current-frontier-not-resolved', 'Authority grounding is not act-ready until declared current-work evidence is resolved on the selected Handoff route lineage.'));
|
|
176
|
+
|
|
177
|
+
const frontierTaskIds = new Set((topology.currentFrontier || []).map((item) => String(item.id || '')));
|
|
178
|
+
const blockers = projectBlockers(overview.blockerSignals || [], frontierTaskIds);
|
|
179
|
+
const currentWorkProjection = projectCurrentWork(topology, records, includeCurrentWork);
|
|
180
|
+
const capsule = projectGroundingCapsule({ authority, continuation, contextAudit, requiredContext, records, topology, blockers });
|
|
181
|
+
if (continuity.losses?.items?.length) unresolved.push(evidence('non-critical-material-loss', 'degraded-nonblocking', `${continuity.losses.items.length} unavailable non-lineage asset/reference item(s) remain visible without blocking unrelated work.`));
|
|
182
|
+
const externalHumanGates = Array.isArray(authority?.humanOnlyGates) ? authority.humanOnlyGates : [];
|
|
183
|
+
for (const gate of externalHumanGates) humanOnly.push(evidence('human-only-gate', 'declared', String(gate?.label || gate || 'human gate')));
|
|
184
|
+
|
|
185
|
+
let state = 'grounded-to-act';
|
|
186
|
+
if (missingEvidence.length) state = 'insufficient-grounding';
|
|
187
|
+
else if (!handoffMode || !holderBindingActReady || !topology.currentFrontier.length || humanOnly.length) state = 'grounded-to-discuss';
|
|
188
|
+
if (state === 'grounded-to-act') reasons.push(reason('bounded-act-ready', 'Selected Handoff authority, explicit consuming-session holder Role binding, Required Context, carried Workspace coverage, cold-start continuity to a qualified semantic root, the selected-route Parent-lineage leaf, and declared current-work frontier evidence are all resolved enough for the next bounded action.'));
|
|
189
|
+
|
|
190
|
+
return Object.freeze({
|
|
191
|
+
schema: PORTABLE_GROUNDING_READINESS_SCHEMA_ID,
|
|
192
|
+
status: state === 'insufficient-grounding' ? 'blocked' : 'ready',
|
|
193
|
+
readiness: Object.freeze({
|
|
194
|
+
state,
|
|
195
|
+
reasons: Object.freeze(reasons.slice(0, MAX_ITEMS)),
|
|
196
|
+
missingEvidence: Object.freeze(missingEvidence.slice(0, MAX_ITEMS)),
|
|
197
|
+
nextAction: nextActionFor(state, topology, continuity, authority)
|
|
198
|
+
}),
|
|
199
|
+
authority: projectGroundingAuthority(authority, mode),
|
|
200
|
+
coverage: Object.freeze({
|
|
201
|
+
mode,
|
|
202
|
+
loadedRecords: records.length,
|
|
203
|
+
relevantRecords: relevantIds.size,
|
|
204
|
+
requiredContext: Object.freeze({
|
|
205
|
+
declared: requiredContext.length,
|
|
206
|
+
matchedInWorkspaceSnapshots: requiredRecordResolution.matched,
|
|
207
|
+
missingFromWorkspaceSnapshots: requiredRecordResolution.missing.length,
|
|
208
|
+
items: requiredContextProjection.items,
|
|
209
|
+
itemsOmitted: requiredContextProjection.itemsOmitted,
|
|
210
|
+
bodiesProjected: requiredContextProjection.bodiesProjected,
|
|
211
|
+
bodiesAvailable: requiredContextProjection.bodiesAvailable,
|
|
212
|
+
requestedSelectors: requiredContextProjection.requestedSelectors,
|
|
213
|
+
unmatchedSelectors: requiredContextProjection.unmatchedSelectors
|
|
214
|
+
}),
|
|
215
|
+
workspaceSnapshots: contextAudit ? Object.freeze({
|
|
216
|
+
state: String(contextAudit.coverage?.state || contextAudit.status || 'unresolved'),
|
|
217
|
+
qualified: String(contextAudit.status || '') === 'ready',
|
|
218
|
+
count: contextAudit.workspaceMaterializations?.length || 0
|
|
219
|
+
}) : Object.freeze({ state: 'not-supplied', qualified: false, count: 0 })
|
|
220
|
+
}),
|
|
221
|
+
lineage: Object.freeze({
|
|
222
|
+
state: handoffMode ? (routeBlockingLineageIssues.length ? 'unresolved' : topology.routeLeaves.length ? (lineageIssues.length ? 'resolved-with-upstream-degradation' : 'resolved') : 'missing-leaf') : (lineageIssues.length ? 'unresolved' : topology.leaves.length ? 'resolved' : 'missing-leaf'),
|
|
223
|
+
basis: 'declared-parent-only',
|
|
224
|
+
filenameDimensionsUsed: false,
|
|
225
|
+
carrierDimensionsUsed: false,
|
|
226
|
+
roots: Object.freeze(topology.roots.slice(0, MAX_ITEMS)),
|
|
227
|
+
rootsOmitted: Math.max(0, topology.roots.length - MAX_ITEMS),
|
|
228
|
+
leaves: Object.freeze(topology.leaves.slice(0, MAX_ITEMS)),
|
|
229
|
+
leavesOmitted: Math.max(0, topology.leaves.length - MAX_ITEMS),
|
|
230
|
+
selectedRouteLeaves: Object.freeze(topology.routeLeaves.slice(0, MAX_ITEMS)),
|
|
231
|
+
selectedRouteLeavesOmitted: Math.max(0, topology.routeLeaves.length - MAX_ITEMS),
|
|
232
|
+
blockingIssues: Object.freeze(routeBlockingLineageIssues.slice(0, MAX_ITEMS)),
|
|
233
|
+
blockingIssuesOmitted: Math.max(0, routeBlockingLineageIssues.length - MAX_ITEMS),
|
|
234
|
+
diagnosticIssues: Object.freeze(lineageIssues.slice(0, MAX_ITEMS)),
|
|
235
|
+
diagnosticIssuesOmitted: Math.max(0, lineageIssues.length - MAX_ITEMS),
|
|
236
|
+
boundary: 'Leaf/root roles are derived only from loaded declared Parent edges produced by the shared lineage resolver. Filename numbering, carrier dimensions, directory depth, branch names, and Task lifecycle labels are never substituted for Parent topology.'
|
|
237
|
+
}),
|
|
238
|
+
continuity,
|
|
239
|
+
capsule,
|
|
240
|
+
currentWork: Object.freeze({
|
|
241
|
+
state: topology.currentFrontier.length ? 'current-frontier-resolved' : topology.currentTasks.length ? 'current-candidates-without-frontier' : 'unresolved',
|
|
242
|
+
frontier: currentWorkProjection.frontier,
|
|
243
|
+
frontierOmitted: Math.max(0, topology.currentFrontier.length - MAX_ITEMS),
|
|
244
|
+
candidates: Object.freeze(topology.currentTasks.slice(0, MAX_ITEMS)),
|
|
245
|
+
candidatesOmitted: Math.max(0, topology.currentTasks.length - MAX_ITEMS),
|
|
246
|
+
blockers: Object.freeze(blockers.slice(0, MAX_ITEMS)),
|
|
247
|
+
blockersOmitted: Math.max(0, blockers.length - MAX_ITEMS),
|
|
248
|
+
bodiesProjected: currentWorkProjection.bodiesProjected,
|
|
249
|
+
bodiesAvailable: currentWorkProjection.bodiesAvailable,
|
|
250
|
+
bodyProjectionRequested: Boolean(includeCurrentWork),
|
|
251
|
+
lifecycleIsLineagePosition: false,
|
|
252
|
+
lineageLeafMeansWorkflowFrontier: false
|
|
253
|
+
}),
|
|
254
|
+
evidence: Object.freeze({
|
|
255
|
+
known: Object.freeze(known.slice(0, MAX_ITEMS)),
|
|
256
|
+
inferred: Object.freeze(inferred.slice(0, MAX_ITEMS)),
|
|
257
|
+
unresolved: Object.freeze(unresolved.slice(0, MAX_ITEMS)),
|
|
258
|
+
humanOnly: Object.freeze(humanOnly.slice(0, MAX_ITEMS))
|
|
259
|
+
}),
|
|
260
|
+
findingSummary: summarizePortableFindings(combinedFindings),
|
|
261
|
+
actionableFindings: Object.freeze(combinedFindings.filter((item) => item.severity === 'error' || item.severity === 'warning').slice(0, MAX_ITEMS)),
|
|
262
|
+
actionableFindingsOmitted: Math.max(0, combinedFindings.filter((item) => item.severity === 'error' || item.severity === 'warning').length - MAX_ITEMS),
|
|
263
|
+
deeper: Object.freeze({
|
|
264
|
+
requiredContextBodies: handoffMode ? 'Re-run the same ground command with --include-required-context <requirement-id,name|all> only when exact qualified body text is needed.' : 'not-applicable',
|
|
265
|
+
currentWorkBody: handoffMode ? 'Re-run the same ground command with --include-current-work when the exact current Task body is needed; --continue <workspace-dir> includes it automatically.' : 'not-applicable',
|
|
266
|
+
lineage: 'Use resolve-lineage/search-lineage only when the bounded selected-route leaf/current-work pointers above are insufficient.',
|
|
267
|
+
coldStartQualification: handoffMode ? 'Use qualify-cold-start only when cold-start process qualification/evidence is itself required; ground does not claim pre-takeover host observations.' : 'not-applicable'
|
|
268
|
+
}),
|
|
269
|
+
boundary: 'Decision-oriented grounding projection only. Handoff/Role/Task/Parent artifacts retain authority; this projection composes their loaded evidence and fails visible rather than inventing missing currentness or lineage.'
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function projectCurrentWork(topology = {}, records = [], includeCurrentWork = false) {
|
|
274
|
+
const recordById = new Map((records || []).map((record) => [String(record.id || ''), record]));
|
|
275
|
+
const frontier = (topology.currentFrontier || []).slice(0, MAX_ITEMS).map((item) => {
|
|
276
|
+
const record = recordById.get(String(item.id || ''));
|
|
277
|
+
const available = Boolean(record && typeof record.markdown === 'string' && record.markdown.length > 0);
|
|
278
|
+
return Object.freeze({
|
|
279
|
+
...item,
|
|
280
|
+
contentProjected: Boolean(includeCurrentWork && available),
|
|
281
|
+
...(includeCurrentWork && available ? { content: record.markdown } : {})
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
const bodiesAvailable = (topology.currentFrontier || []).filter((item) => {
|
|
285
|
+
const record = recordById.get(String(item.id || ''));
|
|
286
|
+
return Boolean(record && typeof record.markdown === 'string' && record.markdown.length > 0);
|
|
287
|
+
}).length;
|
|
288
|
+
return Object.freeze({
|
|
289
|
+
frontier: Object.freeze(frontier),
|
|
290
|
+
bodiesProjected: frontier.filter((item) => item.contentProjected).length,
|
|
291
|
+
bodiesAvailable
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function nextActionFor(state, topology, continuity = {}, authority = null) {
|
|
296
|
+
if (state === 'grounded-to-act') return Object.freeze({ kind: 'continue-bounded-handoff-work', target: topology.currentFrontier[0]?.path || '', basis: 'qualified authority + explicit session holder Role binding + required context + cold-start root continuity + selected-route Parent leaf + declared current-work frontier' });
|
|
297
|
+
if (state === 'grounded-to-discuss' && String(authority?.holderBinding?.state || 'unresolved') === 'unresolved') return Object.freeze({ kind: 'declare-explicit-session-holder-role-binding', target: authority?.role?.endpoint?.label || authority?.handoff?.to || '', basis: 'recipient Role qualification is separate from consuming-session holder binding; no transport/provider/assistant-user identity inference is permitted' });
|
|
298
|
+
if (state === 'grounded-to-discuss') return Object.freeze({ kind: topology.currentFrontier.length ? 'obtain-bounded-action-authority-or-human-gate' : 'resolve-current-work-frontier', target: topology.currentTasks[0]?.path || '', basis: 'discussion-ready but act-readiness condition is unresolved' });
|
|
299
|
+
if (continuity?.state === 'unproven') return Object.freeze({
|
|
300
|
+
kind: continuity.recovery?.state === 'host-action-available' ? 'recover-required-parent-with-host-action' : 'request-exact-required-parent-material',
|
|
301
|
+
target: continuity.recovery?.target || '',
|
|
302
|
+
basis: 'cold-start continuity to a qualified semantic root is required before substantive work',
|
|
303
|
+
recovery: continuity.recovery || null
|
|
304
|
+
});
|
|
305
|
+
return Object.freeze({ kind: 'resolve-missing-grounding-evidence', target: '', basis: 'one or more blocking authority/context/lineage conditions remain' });
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function nodeSummary(node = {}) { return Object.freeze({ id: node.id || '', path: node.path || '', title: node.title || '', schemaId: node.schemaId || '', trace: node.trace || '' }); }
|
|
309
|
+
function evidence(code, state, detail) { return Object.freeze({ code, state, detail: compactText(detail, 280) }); }
|
|
310
|
+
function reason(code, message) { return Object.freeze({ code, message }); }
|
|
311
|
+
function missing(list, unresolved, code, message) { const item = reason(code, message); list.push(item); unresolved.push(evidence(code, 'unresolved', message)); }
|
|
312
|
+
function finding(severity, code, message, params = {}) { return Object.freeze({ severity, code, message, source: PORTABLE_GROUNDING_READINESS_SCHEMA_ID, params }); }
|
|
313
|
+
function compactText(value = '', limit = 240) { const text = String(value || '').replace(/\s+/g, ' ').trim(); return text.length > limit ? `${text.slice(0, Math.max(0, limit - 1))}…` : text; }
|
|
314
|
+
function filterFindingsForIds(items = [], ids = new Set()) { return items.filter((item) => !item?.nodeId || ids.has(item.nodeId)); }
|
|
315
|
+
function dedupeFindings(items = []) { return dedupeBy(items, (item) => `${item.severity || ''}:${item.code || ''}:${item.nodeId || ''}:${item.target || ''}:${item.message || ''}`); }
|
|
316
|
+
function dedupeBy(items = [], keyFn) { const map = new Map(); for (const item of items) { const key = keyFn(item); if (!map.has(key)) map.set(key, item); } return Object.freeze([...map.values()]); }
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { packageFileBytes } from '../../../export/package.bytes.js';
|
|
2
|
+
import { inspectStoredWorkspaceArchive } from '../handoff/workspaceByteProvider.js';
|
|
3
|
+
import { RECIPIENT_V2_READ_PATH } from '../handoff/recipientV2.topology.js';
|
|
4
|
+
import { decodeUtf8, findFile } from '../handoff/coldStartQualification.shared.js';
|
|
5
|
+
|
|
6
|
+
const CURRENT_TASK_SCHEMA = 'tiinex.task.v1';
|
|
7
|
+
const MAX_ITEMS = 12;
|
|
8
|
+
const BLOCKING_LINEAGE_CODES = new Set([
|
|
9
|
+
'lineage.target.ambiguous',
|
|
10
|
+
'lineage.parent.integrityMismatch',
|
|
11
|
+
'lineage.parent.selfReference',
|
|
12
|
+
'lineage.parent.exactTargetNotLoaded',
|
|
13
|
+
'lineage.target.outOfBoundary',
|
|
14
|
+
'lineage.parent.boundaryBlocked'
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
export function isRoutedHandoffBundle(bundle = {}) {
|
|
18
|
+
return Array.isArray(bundle?.files) && bundle.files.some((file) => String(file.path || '') === RECIPIENT_V2_READ_PATH);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function materializeQualifiedWorkspaceSnapshot(bundle, contextAudit, options = {}) {
|
|
22
|
+
const files = [];
|
|
23
|
+
const findings = [];
|
|
24
|
+
for (const workspace of contextAudit?.workspaceMaterializations || []) {
|
|
25
|
+
const workspaceId = String(workspace.workspaceId || '').trim();
|
|
26
|
+
const archivePath = String(workspace.archivePackagePath || '').trim();
|
|
27
|
+
const archiveFile = findFile(bundle, archivePath);
|
|
28
|
+
if (!workspaceId || !archivePath || !archiveFile) {
|
|
29
|
+
findings.push(finding('error', 'portable.grounding.workspace-snapshot.unavailable', 'A qualified Workspace snapshot archive could not be resolved from the carrier.', { workspaceId, archivePath }));
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const archive = inspectStoredWorkspaceArchive(packageFileBytes(archiveFile), { ownedBytes: true });
|
|
33
|
+
if (archive.state !== 'qualified') {
|
|
34
|
+
findings.push(finding('error', 'portable.grounding.workspace-snapshot.invalid', 'A carried Workspace snapshot archive is not qualified readable material.', { workspaceId, archivePath }));
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
for (const entry of archive.entries || []) {
|
|
38
|
+
const innerPath = String(entry.path || '').replace(/\\/g, '/');
|
|
39
|
+
if (!isGroundingArtifactPath(innerPath)) continue;
|
|
40
|
+
if (!options.includeLegacyTopics && /(?:^|\/)\.topics\/development(?:\/|$)/.test(innerPath)) continue;
|
|
41
|
+
const content = decodeUtf8(entry.data || new Uint8Array());
|
|
42
|
+
if (!content) continue;
|
|
43
|
+
files.push(Object.freeze({
|
|
44
|
+
path: `${workspaceId}/${innerPath}`,
|
|
45
|
+
content,
|
|
46
|
+
size: Number(entry.size || (entry.data?.byteLength || 0)),
|
|
47
|
+
sourceMode: 'portable-handoff-workspace-snapshot'
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return Object.freeze({ files: Object.freeze(files), findings: Object.freeze(findings) });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function projectRequiredContext(requiredContext = [], selectors = []) {
|
|
55
|
+
const requested = normalizeSelectors(selectors);
|
|
56
|
+
const selected = (entry) => requested.includes('all') || requested.some((selector) => requiredContextMatches(entry, selector));
|
|
57
|
+
const availableBodies = requiredContext.filter((entry) => typeof entry?.content === 'string' && entry.content.length > 0).length;
|
|
58
|
+
const items = requiredContext.slice(0, MAX_ITEMS).map((entry) => {
|
|
59
|
+
const contentProjected = selected(entry) && typeof entry?.content === 'string';
|
|
60
|
+
return Object.freeze({
|
|
61
|
+
requirementId: entry.requirementId || '',
|
|
62
|
+
name: entry.name || '',
|
|
63
|
+
state: entry.state || '',
|
|
64
|
+
workspaceId: entry.workspaceId || '',
|
|
65
|
+
innerPath: entry.innerPath || entry.workspaceRelativePath || '',
|
|
66
|
+
referenceTarget: entry.referenceTarget || '',
|
|
67
|
+
bytes: Number(entry.bytes || entry.actualBytes || 0),
|
|
68
|
+
sha256: entry.sha256 || entry.actualSha256 || '',
|
|
69
|
+
contentProjected,
|
|
70
|
+
...(contentProjected ? { content: entry.content } : {})
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
const unmatched = requested.filter((selector) => selector !== 'all' && !requiredContext.some((entry) => requiredContextMatches(entry, selector)));
|
|
74
|
+
return Object.freeze({
|
|
75
|
+
items: Object.freeze(items),
|
|
76
|
+
itemsOmitted: Math.max(0, requiredContext.length - items.length),
|
|
77
|
+
bodiesProjected: items.filter((item) => item.contentProjected).length,
|
|
78
|
+
bodiesAvailable: availableBodies,
|
|
79
|
+
requestedSelectors: Object.freeze(requested),
|
|
80
|
+
unmatchedSelectors: Object.freeze(unmatched)
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function normalizeSelectors(value) {
|
|
85
|
+
if (!value) return Object.freeze([]);
|
|
86
|
+
if (Array.isArray(value)) return Object.freeze(value.map((item) => String(item || '').trim().toLowerCase()).filter(Boolean));
|
|
87
|
+
if (value === true) return Object.freeze(['all']);
|
|
88
|
+
return Object.freeze(String(value).split(',').map((item) => item.trim().toLowerCase()).filter(Boolean));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function resolveRequiredContextRecords(requiredContext = [], records = []) {
|
|
92
|
+
const byPath = new Map(records.map((record) => [String(record.path || ''), record]));
|
|
93
|
+
const ids = new Set();
|
|
94
|
+
const missing = [];
|
|
95
|
+
let matched = 0;
|
|
96
|
+
for (const entry of requiredContext || []) {
|
|
97
|
+
if (entry.state !== 'qualified') continue;
|
|
98
|
+
const workspaceId = String(entry.workspaceId || '').trim();
|
|
99
|
+
const innerPath = String(entry.innerPath || entry.workspaceRelativePath || '').replace(/^\/+/, '').replace(/\\/g, '/');
|
|
100
|
+
if (!workspaceId || !innerPath) continue;
|
|
101
|
+
const expectedPath = `${workspaceId}/${innerPath}`;
|
|
102
|
+
const record = byPath.get(expectedPath);
|
|
103
|
+
if (record) { ids.add(record.id); matched += 1; continue; }
|
|
104
|
+
if (isExactHydratedWorkspaceContext(entry)) { matched += 1; continue; }
|
|
105
|
+
missing.push(`${entry.requirementId || entry.name || expectedPath}: exact qualified context was not found at ${expectedPath} inside the complete carried Workspace snapshots.`);
|
|
106
|
+
}
|
|
107
|
+
return Object.freeze({ ids, matched, missing: Object.freeze(missing) });
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function isExactHydratedWorkspaceContext(entry = {}) {
|
|
111
|
+
if (String(entry.providerMode || '') !== 'archive') return false;
|
|
112
|
+
if (!['hydrated-text', 'qualified-locator-only'].includes(String(entry.contentState || ''))) return false;
|
|
113
|
+
const expectedBytes = Number(entry.bytes || 0);
|
|
114
|
+
const actualBytes = Number(entry.actualBytes || 0);
|
|
115
|
+
const expectedSha = String(entry.sha256 || '').trim().toLowerCase();
|
|
116
|
+
const actualSha = String(entry.actualSha256 || '').trim().toLowerCase();
|
|
117
|
+
return expectedBytes > 0 && expectedBytes === actualBytes && /^[0-9a-f]{64}$/.test(expectedSha) && expectedSha === actualSha;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function resolveSelectedRouteRecords(authority = {}, records = []) {
|
|
121
|
+
const route = authority?.selectedRoute || {};
|
|
122
|
+
const workspaceId = String(route.workspaceId || '').trim();
|
|
123
|
+
const innerPath = String(route.workspaceRelativeHandoffPath || '').replace(/^\/+/, '').replace(/\\/g, '/');
|
|
124
|
+
if (!workspaceId || !innerPath) return new Set();
|
|
125
|
+
const expectedPath = `${workspaceId}/${innerPath}`;
|
|
126
|
+
return new Set(records.filter((record) => record.path === expectedPath).map((record) => record.id));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function directedLineageCone(lineage = {}, startIds = new Set()) {
|
|
130
|
+
const all = new Set((lineage.nodes || []).map((node) => node.id));
|
|
131
|
+
if (!startIds.size) return new Set();
|
|
132
|
+
const parents = new Map();
|
|
133
|
+
const children = new Map();
|
|
134
|
+
for (const edge of lineage.edges || []) {
|
|
135
|
+
if (edge.kind !== 'parent' || !edge.from || !edge.to || edge.status === 'missing' || edge.status === 'mismatch') continue;
|
|
136
|
+
add(parents, edge.to, edge.from);
|
|
137
|
+
add(children, edge.from, edge.to);
|
|
138
|
+
}
|
|
139
|
+
const starts = [...startIds].filter((id) => all.has(id));
|
|
140
|
+
const out = new Set(starts);
|
|
141
|
+
const walk = (adjacent) => {
|
|
142
|
+
const queue = [...starts];
|
|
143
|
+
const seen = new Set(starts);
|
|
144
|
+
while (queue.length) {
|
|
145
|
+
const id = queue.shift();
|
|
146
|
+
for (const next of adjacent.get(id) || []) {
|
|
147
|
+
if (seen.has(next)) continue;
|
|
148
|
+
seen.add(next);
|
|
149
|
+
out.add(next);
|
|
150
|
+
queue.push(next);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
walk(parents);
|
|
155
|
+
walk(children);
|
|
156
|
+
return out;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function projectRelevantTopology(lineage = {}, relevantIds = new Set(), frontierCandidates = [], routeRecordIds = new Set()) {
|
|
160
|
+
const nodeById = new Map((lineage.nodes || []).map((node) => [node.id, node]));
|
|
161
|
+
const parentIncoming = new Map();
|
|
162
|
+
const parentOutgoing = new Map();
|
|
163
|
+
for (const edge of lineage.edges || []) {
|
|
164
|
+
if (edge.kind !== 'parent' || !edge.to) continue;
|
|
165
|
+
if (edge.from) add(parentOutgoing, edge.from, edge);
|
|
166
|
+
add(parentIncoming, edge.to, edge);
|
|
167
|
+
}
|
|
168
|
+
const roots = [];
|
|
169
|
+
const leaves = [];
|
|
170
|
+
for (const id of relevantIds) {
|
|
171
|
+
const node = nodeById.get(id);
|
|
172
|
+
if (!node) continue;
|
|
173
|
+
const incomingResolved = (parentIncoming.get(id) || []).some((edge) => edge.from && edge.status !== 'missing' && edge.status !== 'mismatch');
|
|
174
|
+
const outgoingResolved = (parentOutgoing.get(id) || []).some((edge) => edge.to && edge.status !== 'missing' && edge.status !== 'mismatch');
|
|
175
|
+
const summary = nodeSummary(node);
|
|
176
|
+
if (!incomingResolved) roots.push(summary);
|
|
177
|
+
if (!outgoingResolved) leaves.push(summary);
|
|
178
|
+
}
|
|
179
|
+
const currentTasks = (frontierCandidates || [])
|
|
180
|
+
.filter((item) => relevantIds.has(item.id) && item.schemaId === CURRENT_TASK_SCHEMA)
|
|
181
|
+
.map((item) => Object.freeze({ id: item.id, path: item.path, title: item.title, declaredStatus: item.declaredStatus, objective: compactText(item.objective, 240) }));
|
|
182
|
+
const currentTaskIds = new Set(currentTasks.map((item) => item.id));
|
|
183
|
+
const routeLeaves = leaves.filter((item) => routeRecordIds.has(item.id));
|
|
184
|
+
const distance = ancestorDistanceFromRoute(lineage, routeRecordIds, relevantIds);
|
|
185
|
+
const rankedCurrent = currentTasks.filter((item) => distance.has(item.id)).sort((a, b) => distance.get(a.id) - distance.get(b.id));
|
|
186
|
+
const nearestDistance = rankedCurrent.length ? distance.get(rankedCurrent[0].id) : Number.POSITIVE_INFINITY;
|
|
187
|
+
const currentFrontier = rankedCurrent.filter((item) => distance.get(item.id) === nearestDistance);
|
|
188
|
+
const relevantPaths = Object.freeze([...relevantIds].map((id) => String(nodeById.get(id)?.path || '')).filter(Boolean));
|
|
189
|
+
return Object.freeze({ roots, leaves, routeLeaves, currentTasks, currentTaskIds, currentFrontier, relevantPaths });
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export function relevantLineageIssues(lineage = {}, relevantIds = new Set()) {
|
|
193
|
+
const issues = [];
|
|
194
|
+
for (const findingEntry of lineage.findings || []) {
|
|
195
|
+
if (!BLOCKING_LINEAGE_CODES.has(String(findingEntry.code || ''))) continue;
|
|
196
|
+
if (findingEntry.nodeId && !relevantIds.has(findingEntry.nodeId)) continue;
|
|
197
|
+
issues.push(Object.freeze({ code: findingEntry.code, severity: findingEntry.severity, nodeId: findingEntry.nodeId || '', target: findingEntry.target || '', message: findingEntry.message || '' }));
|
|
198
|
+
}
|
|
199
|
+
for (const edge of lineage.edges || []) {
|
|
200
|
+
if (edge.kind !== 'parent' || !relevantIds.has(edge.to)) continue;
|
|
201
|
+
if (!['probable', 'missing', 'mismatch'].includes(String(edge.status || ''))) continue;
|
|
202
|
+
issues.push(Object.freeze({ code: `lineage.parent.${edge.status}`, severity: edge.status === 'mismatch' ? 'error' : 'warning', nodeId: edge.to, target: edge.target || '', message: `Relevant Parent edge remains ${edge.status}.` }));
|
|
203
|
+
}
|
|
204
|
+
return dedupeBy(issues, (item) => `${item.code}:${item.nodeId}:${item.target}`);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function projectBlockers(blockers = [], currentTaskIds = new Set()) {
|
|
208
|
+
return blockers.filter((item) => currentTaskIds.has(item.id)).map((item) => Object.freeze({ kind: item.kind, id: item.id, path: item.path, title: item.title, text: compactText(item.text, 240), basis: item.basis }));
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function ancestorDistanceFromRoute(lineage = {}, routeRecordIds = new Set(), relevantIds = new Set()) {
|
|
212
|
+
const parents = new Map();
|
|
213
|
+
for (const edge of lineage.edges || []) {
|
|
214
|
+
if (edge.kind !== 'parent' || !edge.from || !edge.to || edge.status === 'missing' || edge.status === 'mismatch') continue;
|
|
215
|
+
if (!relevantIds.has(edge.from) || !relevantIds.has(edge.to)) continue;
|
|
216
|
+
add(parents, edge.to, edge.from);
|
|
217
|
+
}
|
|
218
|
+
const distance = new Map();
|
|
219
|
+
const queue = [];
|
|
220
|
+
for (const id of routeRecordIds) { distance.set(id, 0); queue.push(id); }
|
|
221
|
+
while (queue.length) {
|
|
222
|
+
const id = queue.shift();
|
|
223
|
+
const nextDistance = distance.get(id) + 1;
|
|
224
|
+
for (const parentId of parents.get(id) || []) {
|
|
225
|
+
if (distance.has(parentId) && distance.get(parentId) <= nextDistance) continue;
|
|
226
|
+
distance.set(parentId, nextDistance);
|
|
227
|
+
queue.push(parentId);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return distance;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function isGroundingArtifactPath(value = '') {
|
|
234
|
+
const path = String(value || '').toLowerCase();
|
|
235
|
+
return path.endsWith('.trace.md') || path.endsWith('.workspace.md');
|
|
236
|
+
}
|
|
237
|
+
function requiredContextMatches(entry = {}, selector = '') {
|
|
238
|
+
const wanted = String(selector || '').trim().toLowerCase();
|
|
239
|
+
return [entry.requirementId, entry.name, entry.referenceTarget, entry.innerPath].some((value) => String(value || '').toLowerCase() === wanted);
|
|
240
|
+
}
|
|
241
|
+
function nodeSummary(node = {}) { return Object.freeze({ id: node.id || '', path: node.path || '', title: node.title || '', schemaId: node.schemaId || '', trace: node.trace || '' }); }
|
|
242
|
+
function finding(severity, code, message, params = {}) { return Object.freeze({ severity, code, message, source: 'tiinex.portable.grounding-readiness.v1', params }); }
|
|
243
|
+
function add(map, key, value) { if (!map.has(key)) map.set(key, []); map.get(key).push(value); }
|
|
244
|
+
function compactText(value = '', limit = 240) { const text = String(value || '').replace(/\s+/g, ' ').trim(); return text.length > limit ? `${text.slice(0, Math.max(0, limit - 1))}…` : text; }
|
|
245
|
+
function dedupeBy(items = [], keyFn) { const map = new Map(); for (const item of items) { const key = keyFn(item); if (!map.has(key)) map.set(key, item); } return Object.freeze([...map.values()]); }
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { parseWorkspaceEntrypoints } from '../handoff/workspaceSourceIdentity.js';
|
|
2
|
+
const MAX_WORKSPACES = 8;
|
|
3
|
+
const MAX_SOURCES = 8;
|
|
4
|
+
|
|
5
|
+
export function projectGroundingSourceEvidence({ records = [], contextAudit = null, continuation = null, sourceProfiles = [] } = {}) {
|
|
6
|
+
const byPath = new Map((records || []).map((record) => [String(record.path || ''), record]));
|
|
7
|
+
const profiles = profileIndex(sourceProfiles);
|
|
8
|
+
const workspaces = (contextAudit?.workspaceMaterializations || []).slice(0, MAX_WORKSPACES).map((workspace) => {
|
|
9
|
+
const workspaceId = String(workspace.workspaceId || '');
|
|
10
|
+
const innerPath = normalizePath(workspace.sourceWorkspaceTargetInnerPath || '');
|
|
11
|
+
const exactPath = workspaceId && innerPath ? `${workspaceId}/${innerPath}` : '';
|
|
12
|
+
const record = exactPath ? byPath.get(exactPath) : null;
|
|
13
|
+
const declared = record ? parseWorkspaceEntrypoints(record.markdown || '') : [];
|
|
14
|
+
const explicitProfile = profiles.get(workspaceId) || [];
|
|
15
|
+
const sources = declared.length ? declared : explicitProfile;
|
|
16
|
+
const unique = sources.length === 1 ? sources[0] : null;
|
|
17
|
+
const qualifiedArtifact = Boolean(
|
|
18
|
+
String(workspace.qualification || '') === 'qualified'
|
|
19
|
+
&& innerPath
|
|
20
|
+
&& record
|
|
21
|
+
&& record.hasContinuityContext
|
|
22
|
+
&& record.hasIntegrity
|
|
23
|
+
);
|
|
24
|
+
if (!qualifiedArtifact && !explicitProfile.length) return Object.freeze({ workspace: workspaceId, state: 'unresolved' });
|
|
25
|
+
return Object.freeze({
|
|
26
|
+
workspace: workspaceId,
|
|
27
|
+
state: qualifiedArtifact ? 'qualified' : 'explicit-profile',
|
|
28
|
+
carrier: String(workspace.reason || 'qualified-workspace-snapshot'),
|
|
29
|
+
sourceArtifactPath: exactPath,
|
|
30
|
+
sourceArtifactSha256: String(workspace.sourceWorkspaceTargetSha256 || ''),
|
|
31
|
+
repository: String(unique?.repository || ''),
|
|
32
|
+
ref: String(unique?.ref || ''),
|
|
33
|
+
rootPath: String(unique?.rootPath || ''),
|
|
34
|
+
remoteState: String(unique?.remoteState || 'not-checked'),
|
|
35
|
+
sources: Object.freeze(sources.slice(0, MAX_SOURCES))
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
return Object.freeze({
|
|
39
|
+
carrier: Object.freeze({
|
|
40
|
+
state: String(contextAudit?.coverage?.state || contextAudit?.status || 'unresolved'),
|
|
41
|
+
workspaceCount: Number(contextAudit?.workspaceMaterializations?.length || 0),
|
|
42
|
+
packageSourcePath: String(continuation?.packageSourcePath || '')
|
|
43
|
+
}),
|
|
44
|
+
workspaces: Object.freeze(workspaces),
|
|
45
|
+
boundary: 'Exact selected Workspace source artifact/profile only.'
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function profileIndex(value = []) {
|
|
50
|
+
const map = new Map();
|
|
51
|
+
if (!value) return map;
|
|
52
|
+
if (!Array.isArray(value) && typeof value === 'object') {
|
|
53
|
+
for (const [workspaceId, profile] of Object.entries(value)) map.set(String(workspaceId), Object.freeze(normalizeProfileList(profile)));
|
|
54
|
+
return map;
|
|
55
|
+
}
|
|
56
|
+
for (const item of value || []) {
|
|
57
|
+
const workspaceId = String(item?.workspaceId || item?.workspace || '');
|
|
58
|
+
if (!workspaceId) continue;
|
|
59
|
+
const list = map.get(workspaceId) || [];
|
|
60
|
+
list.push(normalizeProfile(item));
|
|
61
|
+
map.set(workspaceId, Object.freeze(list));
|
|
62
|
+
}
|
|
63
|
+
return map;
|
|
64
|
+
}
|
|
65
|
+
function normalizeProfileList(value) { return (Array.isArray(value) ? value : [value]).filter(Boolean).map(normalizeProfile); }
|
|
66
|
+
function normalizeProfile(value = {}) { return Object.freeze({ label: String(value.label || ''), sourceKind: String(value.sourceKind || value.kind || ''), repository: String(value.repository || ''), ref: String(value.ref || ''), rootPath: String(value.rootPath || ''), remoteState: String(value.remoteState || 'not-checked'), basis: 'explicit-source-profile' }); }
|
|
67
|
+
function section(markdown = '', heading = '') { const escaped = escape(heading); return String(markdown || '').match(new RegExp(`(?:^|\\n)##\\s+${escaped}\\s*\\r?\\n([\\s\\S]*?)(?=\\n##\\s+|\\n#\\s+Continuity Integrity|$)`, 'i'))?.[1]?.trim() || ''; }
|
|
68
|
+
function field(markdown = '', label = '') { const escaped = escape(label); return strip(String(markdown || '').match(new RegExp(`^\\s*-\\s+${escaped}:\\s*(.+)$`, 'mi'))?.[1] || ''); }
|
|
69
|
+
function normalizePath(value = '') { return String(value || '').replace(/\\/g, '/').replace(/^\/+/, ''); }
|
|
70
|
+
function strip(value = '') { return String(value || '').replace(/^\[([^\]]+)\]\([^)]+\)$/, '$1').replace(/[`*_]/g, '').trim(); }
|
|
71
|
+
function escape(value = '') { return String(value || '').replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); }
|