@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,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COLD_START_INGRESS_KINDS,
|
|
3
|
+
normalizeIngressKind
|
|
4
|
+
} from './coldStartQualification.contract.js';
|
|
5
|
+
import { groundPortableColdConsumer } from './coldStartQualification.grounding.js';
|
|
6
|
+
import { createColdStartMaterialContext, projectGroundedContinuation } from './coldStartQualification.materials.js';
|
|
7
|
+
import { qualifyPortableColdStartTrace } from './coldStartQualification.observation.js';
|
|
8
|
+
import { deepFreeze, normalizeToken } from './coldStartQualification.shared.js';
|
|
9
|
+
|
|
10
|
+
export function qualifyPortableColdStartRun(input = {}, options = {}) {
|
|
11
|
+
const ingressKind = normalizeIngressKind(input.ingressKind || input.kind || COLD_START_INGRESS_KINDS.HANDOFF);
|
|
12
|
+
const bundle = input.bundle || input.package || input;
|
|
13
|
+
const route = String(input.route || input.routeId || input.routePath || '').trim();
|
|
14
|
+
const coldStartMaterialContext = createColdStartMaterialContext();
|
|
15
|
+
const hostEvidence = normalizeOneShotHostEvidence(input.hostEvidence || input.preTakeover || input.preTiinex || input.hostPreTakeover || 'unverified', input.hostEvidenceSource || input.evidenceSource || '');
|
|
16
|
+
const grounding = groundPortableColdConsumer({
|
|
17
|
+
...input,
|
|
18
|
+
bundle,
|
|
19
|
+
package: bundle,
|
|
20
|
+
ingressKind,
|
|
21
|
+
route,
|
|
22
|
+
toolingAvailable: input.toolingAvailable === false ? false : true
|
|
23
|
+
}, { ...options, coldStartMaterialContext });
|
|
24
|
+
const events = [];
|
|
25
|
+
if (hostEvidence.mode === 'minimal-bootstrap-only') events.push({ mechanism: 'native-host', action: 'read declared Start/bootstrap nodes and materialize verified portable Tooling bootstrap', semanticClass: 'minimal-bootstrap', status: 'completed', read: true, arbitrary: false, candidateArtifacts: 0 });
|
|
26
|
+
else if (hostEvidence.mode === 'native-archaeology') events.push({ mechanism: 'native-host', action: 'native package/archive/filesystem inspection before Tiinex takeover', semanticClass: 'semantic-archaeology', status: 'completed', read: true, arbitrary: true, candidateArtifacts: Math.max(1, Number(input.candidateArtifacts || 1) || 1) });
|
|
27
|
+
else if (hostEvidence.mode === 'none') { /* Tooling was already callable; no native bootstrap action is declared. */ }
|
|
28
|
+
events.push({ mechanism: 'tiinex', operation: 'orient-handoff-package', status: String(grounding.orientation?.status || 'blocked') });
|
|
29
|
+
events.push({ mechanism: 'tiinex', operation: 'ground-cold-consumer', status: String(grounding.status || 'blocked') });
|
|
30
|
+
const traceInput = {
|
|
31
|
+
ingressKind,
|
|
32
|
+
toolingAvailable: input.toolingAvailable === false ? false : true,
|
|
33
|
+
events,
|
|
34
|
+
grounding,
|
|
35
|
+
outcome: grounding.status === 'blocked' ? { state: 'failed' } : hostEvidence.mode === 'unverified' ? { state: 'unknown' } : { state: 'recovered' },
|
|
36
|
+
hostEvidence: { state: hostEvidence.mode === 'unverified' ? 'unverified' : 'provided', source: hostEvidence.source, mode: hostEvidence.mode },
|
|
37
|
+
requireHostEvidence: true
|
|
38
|
+
};
|
|
39
|
+
const qualification = qualifyPortableColdStartTrace(traceInput, options);
|
|
40
|
+
const continuation = projectGroundedContinuation({ bundle, route, grounding, qualification, packageSourcePath: input.packageSourcePath || '' }, coldStartMaterialContext);
|
|
41
|
+
return deepFreeze({
|
|
42
|
+
...qualification,
|
|
43
|
+
grounding,
|
|
44
|
+
continuation,
|
|
45
|
+
oneShot: Object.freeze({
|
|
46
|
+
state: grounding.status === 'blocked' ? 'blocked' : 'completed',
|
|
47
|
+
routeSelector: route,
|
|
48
|
+
hostEvidence: Object.freeze(hostEvidence),
|
|
49
|
+
toolingEvidence: 'generated-by-qualify-cold-start-run',
|
|
50
|
+
evidenceAttribution: Object.freeze({
|
|
51
|
+
tooling: Object.freeze({ source: 'portable-tooling', independentlyObserved: true, covers: Object.freeze(['orientation', 'route-resolution', 'recipient-grounding']) }),
|
|
52
|
+
preTakeoverHost: Object.freeze({ source: hostEvidence.source, mode: hostEvidence.mode, independentlyObservedByTooling: false })
|
|
53
|
+
}),
|
|
54
|
+
boundary: 'Tooling can generate and qualify its own orientation/grounding receipts. Pre-takeover native-host behavior is not directly observable by portable Tooling unless supplied by a host observer; caller-declared host evidence remains explicitly attributed rather than promoted to independent proof.'
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function isOneShotColdStartQualificationInput(input = {}) {
|
|
60
|
+
const bundle = input?.bundle || input?.package || null;
|
|
61
|
+
if (!bundle || !Array.isArray(bundle.files)) return false;
|
|
62
|
+
const explicitEvents = input?.events || input?.observations || input?.trace;
|
|
63
|
+
return !(Array.isArray(explicitEvents) && explicitEvents.length);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function normalizeOneShotHostEvidence(value, source = '') {
|
|
67
|
+
const raw = typeof value === 'object' && value ? value : { mode: value };
|
|
68
|
+
const token = normalizeToken(raw.mode || raw.state || raw.kind || value || 'unverified');
|
|
69
|
+
const mode = ['minimal-bootstrap-only', 'minimal-bootstrap', 'bootstrap-only'].includes(token)
|
|
70
|
+
? 'minimal-bootstrap-only'
|
|
71
|
+
: ['none', 'tooling-preinstalled', 'already-available'].includes(token)
|
|
72
|
+
? 'none'
|
|
73
|
+
: ['native-archaeology', 'archaeology', 'fallback'].includes(token)
|
|
74
|
+
? 'native-archaeology'
|
|
75
|
+
: 'unverified';
|
|
76
|
+
return Object.freeze({
|
|
77
|
+
mode,
|
|
78
|
+
source: String(raw.source || source || (mode === 'unverified' ? 'unverified' : 'caller-declared')).trim(),
|
|
79
|
+
independentlyObservedByTooling: false
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export const NON_EXECUTION_MODES = new Set(['review', 'explanation', 'design-discussion', 'orientation', 'collaborative-dialogue']);
|
|
2
|
+
export const READY_OPERATION_STATES = new Set(['ready', 'qualified', 'valid', 'accepted', 'passed', 'completed', 'degraded']);
|
|
3
|
+
export function normalizeAttribution(value) {
|
|
4
|
+
const normalized = normalizeToken(value);
|
|
5
|
+
if (['verified', 'declared', 'unverified', 'unknown'].includes(normalized)) return normalized;
|
|
6
|
+
return normalized ? 'unverified' : 'unknown';
|
|
7
|
+
}
|
|
8
|
+
export function normalizeInteractionMode(value) {
|
|
9
|
+
const normalized = normalizeToken(value).replace(/_/g, '-');
|
|
10
|
+
if (!normalized) return '';
|
|
11
|
+
const aliases = { design: 'design-discussion', discussion: 'collaborative-dialogue', explain: 'explanation', review: 'review', execute: 'execution' };
|
|
12
|
+
return aliases[normalized] || normalized;
|
|
13
|
+
}
|
|
14
|
+
export function sectionText(markdown = '', heading = '') {
|
|
15
|
+
const escaped = escapeRegExp(heading);
|
|
16
|
+
const match = new RegExp(`^##\\s+${escaped}\\s*$`, 'mi').exec(String(markdown || ''));
|
|
17
|
+
if (!match) return '';
|
|
18
|
+
const rest = String(markdown).slice(match.index + match[0].length);
|
|
19
|
+
const next = /^##\s+/m.exec(rest);
|
|
20
|
+
return (next ? rest.slice(0, next.index) : rest).trim();
|
|
21
|
+
}
|
|
22
|
+
export function sectionField(section = '', name = '') {
|
|
23
|
+
const escaped = escapeRegExp(name);
|
|
24
|
+
const match = String(section || '').match(new RegExp(`^\\s*-\\s+${escaped}:\\s*(.+?)\\s*$`, 'mi'));
|
|
25
|
+
return stripMarkdown(String(match?.[1] || '').trim());
|
|
26
|
+
}
|
|
27
|
+
export function sectionReferenceTarget(section = '', name = '') {
|
|
28
|
+
const escaped = escapeRegExp(name);
|
|
29
|
+
const match = String(section || '').match(new RegExp(`^\\s*-\\s+${escaped}:\\s*(.+?)\\s*$`, 'mi'));
|
|
30
|
+
const raw = String(match?.[1] || '').trim();
|
|
31
|
+
const link = raw.match(/^\[[^\]]+\]\(([^)\s]+)\)$/);
|
|
32
|
+
return String(link?.[1] || raw).trim();
|
|
33
|
+
}
|
|
34
|
+
export function stripMarkdown(value = '') {
|
|
35
|
+
const text = String(value || '').trim();
|
|
36
|
+
const link = text.match(/^\[([^\]]+)\]\([^)]+\)$/);
|
|
37
|
+
if (link) return link[1].trim();
|
|
38
|
+
return text.replace(/^`(.+)`$/, '$1').replace(/^\*\*(.+)\*\*$/, '$1').trim();
|
|
39
|
+
}
|
|
40
|
+
export function normalizeSemanticClass(value) {
|
|
41
|
+
const normalized = normalizeToken(value).replace(/_/g, '-');
|
|
42
|
+
if (['bootstrap', 'host-bootstrap', 'minimal-ingress', 'minimal-bootstrap'].includes(normalized)) return 'minimal-bootstrap';
|
|
43
|
+
if (['substantive', 'reasoning', 'work', 'substantive-work'].includes(normalized)) return 'substantive-work';
|
|
44
|
+
if (['fallback', 'degraded-fallback'].includes(normalized)) return 'fallback';
|
|
45
|
+
if (['native-read', 'artifact-read', 'filesystem-read', 'archive-read'].includes(normalized)) return 'native-read';
|
|
46
|
+
return normalized || 'native-action';
|
|
47
|
+
}
|
|
48
|
+
export function normalizeComparable(value) { return stripMarkdown(value).toLowerCase().replace(/\s+/g, ' ').trim(); }
|
|
49
|
+
export function normalizeToken(value) { return String(value || '').trim().toLowerCase(); }
|
|
50
|
+
export function normalizePath(value) { return String(value || '').replace(/\\/g, '/').replace(/^\.\//, '').replace(/^\/+/, ''); }
|
|
51
|
+
export function normalizeStringList(value) { const list = Array.isArray(value) ? value : value ? [value] : []; return [...new Set(list.map((item) => String(item || '').trim()).filter(Boolean))]; }
|
|
52
|
+
export function findFile(bundle = {}, path = '') { return (bundle.files || []).find((file) => String(file.path || '') === String(path || '')) || null; }
|
|
53
|
+
export function decodeUtf8(data) { try { return new TextDecoder('utf-8', { fatal: true }).decode(data); } catch { return ''; } }
|
|
54
|
+
export function finiteOrNull(value) { const number = Number(value); return Number.isFinite(number) ? number : null; }
|
|
55
|
+
export function parseTime(value) { const ms = Date.parse(String(value || '')); return Number.isFinite(ms) ? ms : null; }
|
|
56
|
+
export function escapeRegExp(value = '') { return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); }
|
|
57
|
+
export function deepFreeze(value) { if (!value || typeof value !== 'object' || Object.isFrozen(value)) return value; if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer) return value; for (const child of Object.values(value)) deepFreeze(child); return Object.freeze(value); }
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { packageFileBytes, sha256Hex } from '../../../export/package.bytes.js';
|
|
2
|
+
import { portableFinding } from '../findings.js';
|
|
3
|
+
import { inspectStoredWorkspaceArchive } from './workspaceByteProvider.js';
|
|
4
|
+
|
|
5
|
+
export function resolveColdStartRolePointerMaterial(bundle, facts, findings, pointerPath, roleKind = 'participant-role') {
|
|
6
|
+
const codeKind = roleKind === 'endpoint-role' ? 'endpoint-role' : 'participant-role';
|
|
7
|
+
const labelKind = roleKind === 'endpoint-role' ? 'Endpoint Role' : 'Participant Role';
|
|
8
|
+
const archivePath = String(facts.archivePath || '').trim();
|
|
9
|
+
const archiveFile = findFile(bundle, archivePath);
|
|
10
|
+
if (!archiveFile) {
|
|
11
|
+
findings.push(portableFinding('error', `portable.cold-start.${codeKind}.archive.missing`, `${labelKind} Pointer target archive is not carried.`, { pointerPath, archivePath }));
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const archive = inspectStoredWorkspaceArchive(packageFileBytes(archiveFile), { ownedBytes: true });
|
|
15
|
+
if (archive.state !== 'qualified') {
|
|
16
|
+
findings.push(portableFinding('error', `portable.cold-start.${codeKind}.archive.invalid`, `${labelKind} Pointer target archive is not qualified.`, { pointerPath, archivePath }));
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const targetPath = String(facts.targetCarrierKind || '') === 'workspace-cache-entry'
|
|
20
|
+
? String(facts.targetArchiveEntry || '')
|
|
21
|
+
: String(facts.targetInnerPath || '');
|
|
22
|
+
const matches = (archive.entries || []).filter((entry) => normalizePath(entry.path || '') === normalizePath(targetPath));
|
|
23
|
+
if (matches.length !== 1) {
|
|
24
|
+
findings.push(portableFinding('error', matches.length > 1 ? `portable.cold-start.${codeKind}.target.ambiguous` : `portable.cold-start.${codeKind}.target.missing`, `${labelKind} Pointer does not resolve to exactly one target entry.`, { pointerPath, archivePath, targetPath, matches: matches.length }));
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const data = packageFileBytes({ data: matches[0].data });
|
|
28
|
+
if ((facts.targetBytes && Number(facts.targetBytes) !== data.byteLength)
|
|
29
|
+
|| (facts.targetSha256 && String(facts.targetSha256) !== sha256Hex(data))) {
|
|
30
|
+
findings.push(portableFinding('error', `portable.cold-start.${codeKind}.target.identity-mismatch`, `${labelKind} Pointer target bytes diverge from the declared exact identity.`, { pointerPath, archivePath, targetPath }));
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const markdown = decodeUtf8(data);
|
|
34
|
+
return markdown ? Object.freeze({ path: `${archivePath}::${targetPath}`, markdown }) : null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function findFile(bundle = {}, path = '') { return (bundle.files || []).find((file) => String(file.path || '') === String(path || '')) || null; }
|
|
38
|
+
function normalizePath(value) { return String(value || '').replace(/\\/g, '/').replace(/^\.\//, '').replace(/^\/+/, ''); }
|
|
39
|
+
function decodeUtf8(data) { try { return new TextDecoder('utf-8', { fatal: true }).decode(data); } catch { return ''; } }
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { packageFileBytes, sha256Hex } from '../../../export/package.bytes.js';
|
|
2
|
+
import { inspectHandoffClosureDescriptor } from './materialClosure.descriptor.js';
|
|
3
|
+
import { inspectHandoffCarrierProjection } from './carrierProjection.js';
|
|
4
|
+
import { inspectHandoffPointerEntrypoints, isHandoffPointerEntrypointPath } from './pointerEntrypoint.js';
|
|
5
|
+
import { inspectRecipientFacingV2Topology } from './recipientV2.inspect.js';
|
|
6
|
+
import { RECIPIENT_V2_READ_PATH } from './recipientV2.topology.js';
|
|
7
|
+
import { RECIPIENT_V2_TRANSPORT_MANIFEST_PATH } from './recipientV2.transportManifest.js';
|
|
8
|
+
|
|
9
|
+
export const PORTABLE_HANDOFF_CONTEXT_AUDIT_SCHEMA_ID = 'tiinex.portable.handoff-context-carriage-audit.v1';
|
|
10
|
+
|
|
11
|
+
export function auditHandoffPackageContextCarriage(input = {}) {
|
|
12
|
+
const bundle = input.bundle || input;
|
|
13
|
+
if ((bundle.files || []).some((file) => String(file.path || '') === RECIPIENT_V2_READ_PATH)) return auditRecipientV2(bundle);
|
|
14
|
+
const findings = [];
|
|
15
|
+
const closureInspection = inspectHandoffClosureDescriptor(bundle);
|
|
16
|
+
const carrierInspection = inspectHandoffCarrierProjection(bundle);
|
|
17
|
+
const pointerInspection = inspectHandoffPointerEntrypoints(bundle);
|
|
18
|
+
findings.push(...(closureInspection.findings || []), ...(carrierInspection.findings || []), ...(pointerInspection.findings || []));
|
|
19
|
+
const descriptor = closureInspection.descriptor || {};
|
|
20
|
+
const carrier = carrierInspection.projection || {};
|
|
21
|
+
const fileMap = parseJsonFile(findFile(bundle, 'tiinex.package/file-map.json')) || bundle.fileMap || {};
|
|
22
|
+
const fileMapByPath = new Map((fileMap.entries || []).map((entry) => [String(entry.path || ''), entry]));
|
|
23
|
+
const byPath = new Map((bundle.files || []).map((file) => [String(file.path || ''), file]));
|
|
24
|
+
const workspaceEntries = indexWorkspaceEntries(descriptor.workspaceMaterializations || []);
|
|
25
|
+
const workspaceOuterCarriers = indexWorkspaceOuterCarriers(descriptor.workspaceArchiveBindings || []);
|
|
26
|
+
const workspaceByteIndex = indexWorkspaceBytes(descriptor.workspaceMaterializations || []);
|
|
27
|
+
const materialByPath = indexMaterialized(descriptor.materialized || []);
|
|
28
|
+
const requirementById = new Map([...(descriptor.requirements?.required || []), ...(descriptor.requirements?.reference || [])].map((item) => [String(item.requirementId || ''), item]));
|
|
29
|
+
const routeGroundingByPath = indexRouteGrounding(carrier.routes || []);
|
|
30
|
+
|
|
31
|
+
const bindingByWorkspace = new Map((descriptor.workspaceArchiveBindings || []).map((binding) => [String(binding.workspaceId || ''), binding]));
|
|
32
|
+
const workspaceGroups = (descriptor.workspaceMaterializations || []).map((workspace) => workspaceGroup(workspace, routeGroundingByPath, bindingByWorkspace.get(String(workspace.id || ''))));
|
|
33
|
+
const materialCarriers = [];
|
|
34
|
+
const explicitDetached = [];
|
|
35
|
+
const generatedEntrypoints = [];
|
|
36
|
+
const packageRequirements = [];
|
|
37
|
+
const unexplained = [];
|
|
38
|
+
let nonControlCarrierCount = 0;
|
|
39
|
+
let classifiedCarrierCount = 0;
|
|
40
|
+
|
|
41
|
+
for (const file of bundle.files || []) {
|
|
42
|
+
const path = String(file.path || '');
|
|
43
|
+
if (!path || isControlOrBootstrap(path)) continue;
|
|
44
|
+
nonControlCarrierCount += 1;
|
|
45
|
+
const mapEntry = fileMapByPath.get(path) || {};
|
|
46
|
+
const workspaceMatches = workspaceEntries.get(path) || [];
|
|
47
|
+
const workspaceOuterMatches = workspaceOuterCarriers.get(path) || [];
|
|
48
|
+
const materialMatches = materialByPath.get(path) || [];
|
|
49
|
+
if (workspaceMatches.length === 1 || workspaceOuterMatches.length === 1) {
|
|
50
|
+
classifiedCarrierCount += 1;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (workspaceMatches.length > 1 || workspaceOuterMatches.length > 1) {
|
|
54
|
+
unexplained.push(summaryFile(file, mapEntry, 'ambiguous-workspace-carrier'));
|
|
55
|
+
findings.push(finding('error', 'portable.handoff-context.workspace-carrier.ambiguous', 'One package carrier is claimed by multiple workspace materializations.', { path, count: Math.max(workspaceMatches.length, workspaceOuterMatches.length) }));
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (path.startsWith('handoff.material/')) {
|
|
59
|
+
if (materialMatches.length !== 1) {
|
|
60
|
+
unexplained.push(summaryFile(file, mapEntry, materialMatches.length ? 'ambiguous-requirement-material' : 'unbound-requirement-material'));
|
|
61
|
+
findings.push(finding('error', materialMatches.length ? 'portable.handoff-context.material.ambiguous' : 'portable.handoff-context.material.unbound', 'handoff.material carrier is not uniquely bound to one materialized Handoff requirement.', { path, count: materialMatches.length }));
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const material = materialMatches[0];
|
|
65
|
+
const requirement = requirementById.get(String(material.requirementId || '')) || {};
|
|
66
|
+
const bytes = packageFileBytes(file);
|
|
67
|
+
const actualSha256 = bytes.byteLength ? sha256Hex(bytes) : String(mapEntry.sha256 || '');
|
|
68
|
+
const duplicateWorkspaceBytes = workspaceByteIndex.get(`${Number(material.bytes || 0)}:${String(material.sha256 || '')}`) || [];
|
|
69
|
+
materialCarriers.push(Object.freeze({
|
|
70
|
+
path,
|
|
71
|
+
reason: material.classification === 'reference' ? 'resolved-reference-context' : 'resolved-required-context',
|
|
72
|
+
requirement: Object.freeze({ id: String(material.requirementId || ''), name: String(requirement.name || ''), classification: String(material.classification || ''), referenceTarget: String(material.referenceTarget || '') }),
|
|
73
|
+
selectedProvider: Object.freeze({ ...(material.provider || {}) }),
|
|
74
|
+
provenance: Object.freeze({ ...(material.provenance || {}) }),
|
|
75
|
+
authority: Object.freeze({ ...(material.authority || {}) }),
|
|
76
|
+
bytes: Number(material.bytes || 0),
|
|
77
|
+
sha256: String(material.sha256 || ''),
|
|
78
|
+
actualBytes: bytes.byteLength || Number(mapEntry.bytes || 0),
|
|
79
|
+
actualSha256,
|
|
80
|
+
identicalWorkspaceBytes: Object.freeze(duplicateWorkspaceBytes.map((entry) => Object.freeze({ workspaceId: entry.workspaceId, workspaceRelativePath: entry.path, packagePath: entry.packagePath })))
|
|
81
|
+
}));
|
|
82
|
+
classifiedCarrierCount += 1;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (isHandoffPointerEntrypointPath(path)) {
|
|
86
|
+
generatedEntrypoints.push(Object.freeze({ ...summaryFile(file, mapEntry, 'generated-pointer-entrypoint'), authority: 'none' }));
|
|
87
|
+
classifiedCarrierCount += 1;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (isNamedBasePackageRequirement(mapEntry)) {
|
|
91
|
+
packageRequirements.push(Object.freeze({ ...summaryFile(file, mapEntry, namedBasePackageReason(mapEntry)), boundary: String(mapEntry.boundary || '') }));
|
|
92
|
+
classifiedCarrierCount += 1;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (isExplicitDetachedTransport(mapEntry)) {
|
|
96
|
+
explicitDetached.push(Object.freeze({ ...summaryFile(file, mapEntry, 'explicitly-supplied-detached-material'), semanticLooking: /\.trace\.md$/i.test(path) }));
|
|
97
|
+
classifiedCarrierCount += 1;
|
|
98
|
+
if (/\.trace\.md$/i.test(path)) findings.push(finding('warning', 'portable.handoff-context.detached.semantic-artifact', 'Detached transport material looks like a Tiinex trace artifact but is not route/requirement grounding. Its carriage is explicit, not semantically justified by the Handoff.', { path }));
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
unexplained.push(summaryFile(file, mapEntry, 'unexplained'));
|
|
102
|
+
findings.push(finding('error', 'portable.handoff-context.carrier.unexplained', 'Non-control/non-bootstrap package carrier has no explicit qualified carriage reason.', { path, kind: String(mapEntry.kind || file.kind || '') }));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
for (const material of descriptor.materialized || []) {
|
|
106
|
+
if (String(material.carrierKind || '') !== 'workspace-archive-entry') continue;
|
|
107
|
+
const requirement = requirementById.get(String(material.requirementId || '')) || {};
|
|
108
|
+
const duplicateWorkspaceBytes = workspaceByteIndex.get(`${Number(material.bytes || 0)}:${String(material.sha256 || '')}`) || [];
|
|
109
|
+
materialCarriers.push(Object.freeze({
|
|
110
|
+
path: '',
|
|
111
|
+
reason: material.classification === 'reference' ? 'resolved-reference-context-via-workspace-archive' : 'resolved-required-context-via-workspace-archive',
|
|
112
|
+
requirement: Object.freeze({ id: String(material.requirementId || ''), name: String(requirement.name || ''), classification: String(material.classification || ''), referenceTarget: String(material.referenceTarget || '') }),
|
|
113
|
+
selectedProvider: Object.freeze({ ...(material.provider || {}) }),
|
|
114
|
+
provenance: Object.freeze({ ...(material.provenance || {}) }),
|
|
115
|
+
authority: Object.freeze({ ...(material.authority || {}) }),
|
|
116
|
+
carrierKind: 'workspace-archive-entry',
|
|
117
|
+
workspaceId: String(material.workspaceId || ''),
|
|
118
|
+
workspaceRelativePath: String(material.workspaceRelativePath || ''),
|
|
119
|
+
bytes: Number(material.bytes || 0),
|
|
120
|
+
sha256: String(material.sha256 || ''),
|
|
121
|
+
actualBytes: Number(material.bytes || 0),
|
|
122
|
+
actualSha256: String(material.sha256 || ''),
|
|
123
|
+
identicalWorkspaceBytes: Object.freeze(duplicateWorkspaceBytes.map((entry) => Object.freeze({ workspaceId: entry.workspaceId, workspaceRelativePath: entry.path, packagePath: entry.packagePath })))
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const coverageQualified = classifiedCarrierCount === nonControlCarrierCount && unexplained.length === 0;
|
|
128
|
+
if (!coverageQualified) findings.push(finding('error', 'portable.handoff-context.coverage.incomplete', 'Context-carriage audit did not classify every non-control/non-bootstrap package carrier.', { nonControlCarrierCount, classifiedCarrierCount, unexplained: unexplained.length }));
|
|
129
|
+
|
|
130
|
+
const duplicateMaterialCount = materialCarriers.filter((item) => item.identicalWorkspaceBytes.length > 0).length;
|
|
131
|
+
return deepFreeze({
|
|
132
|
+
schema: PORTABLE_HANDOFF_CONTEXT_AUDIT_SCHEMA_ID,
|
|
133
|
+
status: findings.some((item) => item.severity === 'error') ? 'blocked' : 'ready',
|
|
134
|
+
coverage: Object.freeze({ nonControlCarrierCount, classifiedCarrierCount, unexplainedCarrierCount: unexplained.length, state: coverageQualified ? 'qualified' : 'incomplete' }),
|
|
135
|
+
workspaceMaterializations: Object.freeze(workspaceGroups),
|
|
136
|
+
materialCarriers: Object.freeze(materialCarriers),
|
|
137
|
+
generatedEntrypoints: Object.freeze(generatedEntrypoints),
|
|
138
|
+
namedPackageRequirements: Object.freeze(packageRequirements),
|
|
139
|
+
explicitDetachedMaterial: Object.freeze(explicitDetached),
|
|
140
|
+
unexplainedCarriers: Object.freeze(unexplained),
|
|
141
|
+
duplicateByteSummary: Object.freeze({ materialCarriersAlsoPresentInWorkspace: duplicateMaterialCount, totalMaterialCarriers: materialCarriers.length, interpretation: 'Duplicate bytes are visible evidence only. The audit does not infer that duplication is semantically required.' }),
|
|
142
|
+
routeGrounding: Object.freeze((carrier.routes || []).map((route) => Object.freeze({ routeId: String(route.id || ''), workspaceId: String(route.workspaceId || ''), handoffPackagePath: String(route.packagePath || ''), required: Object.freeze((route.requiredClosure?.requirements || []).map((item) => Object.freeze({ requirementId: String(item.requirementId || ''), name: String(item.name || ''), referenceTarget: String(item.referenceTarget || ''), state: String(item.state || ''), resolution: item.resolution || null }))) }))),
|
|
143
|
+
inspections: Object.freeze({ closure: closureInspection.status, carrier: carrierInspection.status, pointers: pointerInspection.status }),
|
|
144
|
+
findings: Object.freeze(dedupeFindings(findings)),
|
|
145
|
+
boundary: 'Recipient-relative carriage/provenance audit only. Complete workspace membership is classified as snapshot carriage, not automatically as Handoff Required Context; semantic relevance inside complete workspaces is not inferred.'
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
function auditRecipientV2(bundle = {}) {
|
|
151
|
+
const inspection = inspectRecipientFacingV2Topology(bundle);
|
|
152
|
+
const files = bundle.files || [];
|
|
153
|
+
const workspacePayloadPaths = new Set((inspection.workspaces || []).flatMap((item) => [item.workspaceArtifactPath, item.workspaceRepresentationArtifactPath, item.workspacePayloadArtifactPath, item.workspaceArchivePath]));
|
|
154
|
+
const routePointerPaths = new Set((inspection.routes || []).map((item) => item.pointerPath));
|
|
155
|
+
const endpointRolePointerPaths = new Set((inspection.endpointRoles || []).map((item) => item.pointerPath));
|
|
156
|
+
const participantRolePointerPaths = new Set((inspection.participantRoles || []).map((item) => item.pointerPath));
|
|
157
|
+
const cachePaths = new Set((inspection.caches || []).flatMap((cache) => [cache.artifactPath, cache.archivePath]));
|
|
158
|
+
const rootPath = String(inspection.rootArtifact?.path || '');
|
|
159
|
+
const classified = files.filter((file) => {
|
|
160
|
+
const path = String(file.path || '');
|
|
161
|
+
return path === rootPath || path === RECIPIENT_V2_READ_PATH || path === RECIPIENT_V2_TRANSPORT_MANIFEST_PATH || workspacePayloadPaths.has(path) || routePointerPaths.has(path) || endpointRolePointerPaths.has(path) || participantRolePointerPaths.has(path) || cachePaths.has(path) || /bootstrap\.(?:trace\.md|zip)$/i.test(path);
|
|
162
|
+
}).length;
|
|
163
|
+
const unexplained = Math.max(0, files.length - classified);
|
|
164
|
+
const findings = [...(inspection.findings || [])];
|
|
165
|
+
if (unexplained) findings.push(finding('error', 'portable.handoff-context.v2.coverage.incomplete', 'Recipient-facing v2 context audit could not classify every visible root carrier.', { total: files.length, classified, unexplained }));
|
|
166
|
+
const cacheMaterials = (inspection.caches || []).flatMap((cache) => cache.materials || []);
|
|
167
|
+
return deepFreeze({ schema: PORTABLE_HANDOFF_CONTEXT_AUDIT_SCHEMA_ID, status: inspection.status === 'valid' && !unexplained ? 'ready' : 'blocked', coverage: Object.freeze({ nonControlCarrierCount: files.length, classifiedCarrierCount: classified, unexplainedCarrierCount: unexplained, state: unexplained ? 'incomplete' : 'qualified' }), workspaceMaterializations: Object.freeze((inspection.workspaces || []).map((item) => Object.freeze({ workspaceId: item.workspaceId, reason: 'complete-workspace-archive-representation', qualification: 'qualified', carrierMode: 'archive', workspaceTargetPackagePath: item.workspaceArtifactPath, archivePackagePath: item.workspaceArchivePath, sourceWorkspaceTargetInnerPath: item.sourceWorkspaceTargetInnerPath, sourceWorkspaceTargetSha256: item.sourceWorkspaceTargetSha256 }))), materialCarriers: Object.freeze([]), generatedEntrypoints: Object.freeze([String(inspection.rootArtifact?.path || ''), RECIPIENT_V2_READ_PATH, ...(inspection.endpointRoles || []).map((item) => item.pointerPath), ...(inspection.participantRoles || []).map((item) => item.pointerPath), ...(inspection.routes || []).map((item) => item.pointerPath)].filter(Boolean)), namedPackageRequirements: Object.freeze([]), explicitDetachedMaterial: Object.freeze(cacheMaterials), unexplainedCarriers: Object.freeze([]), duplicateByteSummary: Object.freeze({ materialCarriersAlsoPresentInWorkspace: 0, totalMaterialCarriers: cacheMaterials.length, interpretation: 'Exact Workspace-scoped recipient cache material is permitted only when not satisfied by a qualified Workspace archive.' }), routeGrounding: Object.freeze((inspection.carrierProjection?.routes || []).map((route) => Object.freeze({ routeId: route.id, workspaceId: route.workspaceId, handoffPackagePath: route.packagePath, required: route.requiredClosure?.requirements || [] }))), inspections: Object.freeze({ recipientV2: inspection.status }), findings: Object.freeze(dedupeFindings(findings)), boundary: 'Recipient-facing v2 carriage audit over qualified visible Tiinex artifacts, exact payload bytes, and one transport-owned manifest control surface.' });
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function indexWorkspaceEntries(workspaces = []) {
|
|
171
|
+
const map = new Map();
|
|
172
|
+
for (const workspace of workspaces) for (const entry of workspace.includedEntries || []) {
|
|
173
|
+
const path = String(entry.packagePath || '');
|
|
174
|
+
if (!path) continue;
|
|
175
|
+
const list = map.get(path) || [];
|
|
176
|
+
list.push(Object.freeze({ workspaceId: String(workspace.id || ''), materialization: String(workspace.materialization || ''), ...entry }));
|
|
177
|
+
map.set(path, list);
|
|
178
|
+
}
|
|
179
|
+
return map;
|
|
180
|
+
}
|
|
181
|
+
function indexWorkspaceOuterCarriers(bindings = []) {
|
|
182
|
+
const map = new Map();
|
|
183
|
+
const add = (path, value) => { if (!path) return; const list = map.get(path) || []; list.push(value); map.set(path, list); };
|
|
184
|
+
for (const binding of bindings) {
|
|
185
|
+
add(String(binding.workspaceTarget?.packagePath || ''), Object.freeze({ workspaceId: String(binding.workspaceId || ''), role: 'workspace-target' }));
|
|
186
|
+
add(String(binding.representation?.packagePath || ''), Object.freeze({ workspaceId: String(binding.workspaceId || ''), role: 'workspace-archive' }));
|
|
187
|
+
}
|
|
188
|
+
return map;
|
|
189
|
+
}
|
|
190
|
+
function indexWorkspaceBytes(workspaces = []) {
|
|
191
|
+
const map = new Map();
|
|
192
|
+
for (const workspace of workspaces) for (const entry of workspace.includedEntries || []) {
|
|
193
|
+
const key = `${Number(entry.bytes || 0)}:${String(entry.sha256 || '')}`;
|
|
194
|
+
const list = map.get(key) || [];
|
|
195
|
+
list.push(Object.freeze({ workspaceId: String(workspace.id || ''), path: String(entry.path || ''), packagePath: String(entry.packagePath || '') }));
|
|
196
|
+
map.set(key, list);
|
|
197
|
+
}
|
|
198
|
+
return map;
|
|
199
|
+
}
|
|
200
|
+
function indexMaterialized(items = []) {
|
|
201
|
+
const map = new Map();
|
|
202
|
+
for (const item of items) {
|
|
203
|
+
const path = String(item.packagePath || '');
|
|
204
|
+
if (!path) continue;
|
|
205
|
+
const list = map.get(path) || [];
|
|
206
|
+
list.push(item);
|
|
207
|
+
map.set(path, list);
|
|
208
|
+
}
|
|
209
|
+
return map;
|
|
210
|
+
}
|
|
211
|
+
function indexRouteGrounding(routes = []) {
|
|
212
|
+
const map = new Map();
|
|
213
|
+
const add = (path, role) => { if (!path) return; const list = map.get(path) || []; list.push(role); map.set(path, list); };
|
|
214
|
+
for (const route of routes) {
|
|
215
|
+
add(String(route.packagePath || ''), Object.freeze({ routeId: String(route.id || ''), role: 'controlling-handoff' }));
|
|
216
|
+
for (const requirement of route.requiredClosure?.requirements || []) add(String(requirement.resolution?.packagePath || ''), Object.freeze({ routeId: String(route.id || ''), role: 'required-context', requirementId: String(requirement.requirementId || ''), name: String(requirement.name || '') }));
|
|
217
|
+
}
|
|
218
|
+
return map;
|
|
219
|
+
}
|
|
220
|
+
function workspaceGroup(workspace = {}, routeGroundingByPath, archiveBinding = null) {
|
|
221
|
+
const entries = workspace.includedEntries || [];
|
|
222
|
+
const grounding = [];
|
|
223
|
+
for (const entry of entries) for (const role of routeGroundingByPath.get(String(entry.packagePath || '')) || []) grounding.push(Object.freeze({ workspaceRelativePath: String(entry.path || ''), packagePath: String(entry.packagePath || ''), ...role }));
|
|
224
|
+
return Object.freeze({
|
|
225
|
+
workspaceId: String(workspace.id || ''),
|
|
226
|
+
title: String(workspace.title || workspace.id || ''),
|
|
227
|
+
reason: workspace.materialization === 'complete' ? 'complete-workspace-materialization' : 'partial-workspace-materialization',
|
|
228
|
+
qualification: String(workspace.qualification || ''),
|
|
229
|
+
correlationStatus: String(workspace.correlationStatus || ''),
|
|
230
|
+
entryCount: entries.length,
|
|
231
|
+
totalBytes: entries.reduce((sum, entry) => sum + Number(entry.bytes || 0), 0),
|
|
232
|
+
completenessEvidence: Object.freeze({ ...(workspace.completenessEvidence || {}) }),
|
|
233
|
+
routeGrounding: Object.freeze(grounding),
|
|
234
|
+
...(archiveBinding ? { carrierMode: 'archive', workspaceTargetPackagePath: String(archiveBinding.workspaceTarget?.packagePath || ''), archivePackagePath: String(archiveBinding.representation?.packagePath || '') } : { carrierMode: 'exploded' }),
|
|
235
|
+
interpretation: 'Workspace snapshot carriage is distinct from route Required Context; only routeGrounding entries are known to participate in explicit route grounding.'
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function isControlOrBootstrap(path) { return path.startsWith('tiinex.package/') || path.startsWith('tiinex.bootstrap/'); }
|
|
239
|
+
function isNamedBasePackageRequirement(entry = {}) { return ['workspace-context', 'artifact-markdown', 'asset', 'workspace-source-material', 'workspace-member-material'].includes(String(entry.kind || '')) || String(entry.path || '').startsWith('context/'); }
|
|
240
|
+
function namedBasePackageReason(entry = {}) { const kind = String(entry.kind || ''); if (kind === 'workspace-context' || String(entry.path || '').startsWith('context/')) return 'base-package-workspace-context'; return `base-package-${kind || 'material'}`; }
|
|
241
|
+
function isExplicitDetachedTransport(entry = {}) { return String(entry.kind || '').includes('transport-material') || String(entry.logicalKind || '') === 'recipient-relative-transport-material'; }
|
|
242
|
+
function summaryFile(file = {}, mapEntry = {}, reason = '') { const data = packageFileBytes(file); return Object.freeze({ path: String(file.path || ''), reason, kind: String(mapEntry.kind || file.kind || ''), logicalKind: String(mapEntry.logicalKind || file.logicalKind || ''), bytes: data.byteLength || Number(mapEntry.bytes || file.size || 0), sha256: data.byteLength ? sha256Hex(data) : String(mapEntry.sha256 || '') }); }
|
|
243
|
+
function findFile(bundle = {}, path = '') { return (bundle.files || []).find((file) => String(file.path || '') === String(path || '')) || null; }
|
|
244
|
+
function parseJsonFile(file = null) { try { return file ? JSON.parse(new TextDecoder().decode(packageFileBytes(file))) : null; } catch { return null; } }
|
|
245
|
+
function finding(severity, code, message, extra = {}) { return Object.freeze({ severity, code, message, ...extra }); }
|
|
246
|
+
function dedupeFindings(items = []) { const map = new Map(); for (const item of items) { const key = `${item.severity || ''}:${item.code || ''}:${item.path || item.packagePath || item.requirementId || ''}:${item.message || ''}`; if (!map.has(key)) map.set(key, item); } return [...map.values()]; }
|
|
247
|
+
function deepFreeze(value) { if (!value || typeof value !== 'object' || Object.isFrozen(value)) return value; if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer) return value; for (const child of Object.values(value)) deepFreeze(child); return Object.freeze(value); }
|